clk-uniphier-mio.c 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2016 Socionext Inc.
  3. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <linux/stddef.h>
  16. #include "clk-uniphier.h"
  17. #define UNIPHIER_MIO_CLK_SD_FIXED \
  18. UNIPHIER_CLK_FACTOR("sd-44m", -1, "sd-133m", 1, 3), \
  19. UNIPHIER_CLK_FACTOR("sd-33m", -1, "sd-200m", 1, 6), \
  20. UNIPHIER_CLK_FACTOR("sd-50m", -1, "sd-200m", 1, 4), \
  21. UNIPHIER_CLK_FACTOR("sd-67m", -1, "sd-200m", 1, 3), \
  22. UNIPHIER_CLK_FACTOR("sd-100m", -1, "sd-200m", 1, 2), \
  23. UNIPHIER_CLK_FACTOR("sd-40m", -1, "sd-200m", 1, 5), \
  24. UNIPHIER_CLK_FACTOR("sd-25m", -1, "sd-200m", 1, 8), \
  25. UNIPHIER_CLK_FACTOR("sd-22m", -1, "sd-133m", 1, 6)
  26. #define UNIPHIER_MIO_CLK_SD(_idx, ch) \
  27. { \
  28. .name = "sd" #ch "-sel", \
  29. .type = UNIPHIER_CLK_TYPE_MUX, \
  30. .idx = -1, \
  31. .data.mux = { \
  32. .parent_names = { \
  33. "sd-44m", \
  34. "sd-33m", \
  35. "sd-50m", \
  36. "sd-67m", \
  37. "sd-100m", \
  38. "sd-40m", \
  39. "sd-25m", \
  40. "sd-22m", \
  41. }, \
  42. .num_parents = 8, \
  43. .reg = 0x30 + 0x200 * (ch), \
  44. .masks = { \
  45. 0x00031000, \
  46. 0x00031000, \
  47. 0x00031000, \
  48. 0x00031000, \
  49. 0x00001300, \
  50. 0x00001300, \
  51. 0x00001300, \
  52. 0x00001300, \
  53. }, \
  54. .vals = { \
  55. 0x00000000, \
  56. 0x00010000, \
  57. 0x00020000, \
  58. 0x00030000, \
  59. 0x00001000, \
  60. 0x00001100, \
  61. 0x00001200, \
  62. 0x00001300, \
  63. }, \
  64. }, \
  65. }, \
  66. UNIPHIER_CLK_GATE("sd" #ch, (_idx), "sd" #ch "-sel", 0x20 + 0x200 * (ch), 8)
  67. #define UNIPHIER_MIO_CLK_USB2(idx, ch) \
  68. UNIPHIER_CLK_GATE("usb2" #ch, (idx), "usb2", 0x20 + 0x200 * (ch), 28)
  69. #define UNIPHIER_MIO_CLK_USB2_PHY(idx, ch) \
  70. UNIPHIER_CLK_GATE("usb2" #ch "-phy", (idx), "usb2", 0x20 + 0x200 * (ch), 29)
  71. const struct uniphier_clk_data uniphier_ld4_mio_clk_data[] = {
  72. UNIPHIER_MIO_CLK_SD_FIXED,
  73. UNIPHIER_MIO_CLK_SD(0, 0),
  74. UNIPHIER_MIO_CLK_SD(1, 1),
  75. UNIPHIER_MIO_CLK_SD(2, 2),
  76. UNIPHIER_CLK_GATE("miodmac", 7, NULL, 0x20, 25),
  77. UNIPHIER_MIO_CLK_USB2(8, 0),
  78. UNIPHIER_MIO_CLK_USB2(9, 1),
  79. UNIPHIER_MIO_CLK_USB2(10, 2),
  80. UNIPHIER_MIO_CLK_USB2_PHY(12, 0),
  81. UNIPHIER_MIO_CLK_USB2_PHY(13, 1),
  82. UNIPHIER_MIO_CLK_USB2_PHY(14, 2),
  83. { /* sentinel */ }
  84. };
  85. const struct uniphier_clk_data uniphier_pro5_sd_clk_data[] = {
  86. UNIPHIER_MIO_CLK_SD_FIXED,
  87. UNIPHIER_MIO_CLK_SD(0, 0),
  88. UNIPHIER_MIO_CLK_SD(1, 1),
  89. { /* sentinel */ }
  90. };