clk-uniphier-mio.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 "clk-uniphier.h"
  16. #define UNIPHIER_MIO_CLK_SD_FIXED \
  17. UNIPHIER_CLK_FACTOR("sd-44m", -1, "sd-133m", 1, 3), \
  18. UNIPHIER_CLK_FACTOR("sd-33m", -1, "sd-200m", 1, 6), \
  19. UNIPHIER_CLK_FACTOR("sd-50m", -1, "sd-200m", 1, 4), \
  20. UNIPHIER_CLK_FACTOR("sd-67m", -1, "sd-200m", 1, 3), \
  21. UNIPHIER_CLK_FACTOR("sd-100m", -1, "sd-200m", 1, 2), \
  22. UNIPHIER_CLK_FACTOR("sd-40m", -1, "sd-200m", 1, 5), \
  23. UNIPHIER_CLK_FACTOR("sd-25m", -1, "sd-200m", 1, 8), \
  24. UNIPHIER_CLK_FACTOR("sd-22m", -1, "sd-133m", 1, 6)
  25. #define UNIPHIER_MIO_CLK_SD(_idx, ch) \
  26. { \
  27. .name = "sd" #ch "-sel", \
  28. .type = UNIPHIER_CLK_TYPE_MUX, \
  29. .idx = -1, \
  30. .data.mux = { \
  31. .parent_names = { \
  32. "sd-44m", \
  33. "sd-33m", \
  34. "sd-50m", \
  35. "sd-67m", \
  36. "sd-100m", \
  37. "sd-40m", \
  38. "sd-25m", \
  39. "sd-22m", \
  40. }, \
  41. .num_parents = 8, \
  42. .reg = 0x30 + 0x200 * (ch), \
  43. .masks = { \
  44. 0x00031000, \
  45. 0x00031000, \
  46. 0x00031000, \
  47. 0x00031000, \
  48. 0x00001300, \
  49. 0x00001300, \
  50. 0x00001300, \
  51. 0x00001300, \
  52. }, \
  53. .vals = { \
  54. 0x00000000, \
  55. 0x00010000, \
  56. 0x00020000, \
  57. 0x00030000, \
  58. 0x00001000, \
  59. 0x00001100, \
  60. 0x00001200, \
  61. 0x00001300, \
  62. }, \
  63. }, \
  64. }, \
  65. UNIPHIER_CLK_GATE("sd" #ch, (_idx), "sd" #ch "-sel", 0x20 + 0x200 * (ch), 8)
  66. #define UNIPHIER_MIO_CLK_USB2(idx, ch) \
  67. UNIPHIER_CLK_GATE("usb2" #ch, (idx), "usb2", 0x20 + 0x200 * (ch), 28)
  68. #define UNIPHIER_MIO_CLK_USB2_PHY(idx, ch) \
  69. UNIPHIER_CLK_GATE("usb2" #ch "-phy", (idx), "usb2", 0x20 + 0x200 * (ch), 29)
  70. #define UNIPHIER_MIO_CLK_DMAC(idx) \
  71. UNIPHIER_CLK_GATE("miodmac", (idx), "stdmac", 0x20, 25)
  72. const struct uniphier_clk_data uniphier_sld3_mio_clk_data[] = {
  73. UNIPHIER_MIO_CLK_SD_FIXED,
  74. UNIPHIER_MIO_CLK_SD(0, 0),
  75. UNIPHIER_MIO_CLK_SD(1, 1),
  76. UNIPHIER_MIO_CLK_SD(2, 2),
  77. UNIPHIER_MIO_CLK_DMAC(7),
  78. UNIPHIER_MIO_CLK_USB2(8, 0),
  79. UNIPHIER_MIO_CLK_USB2(9, 1),
  80. UNIPHIER_MIO_CLK_USB2(10, 2),
  81. UNIPHIER_MIO_CLK_USB2(11, 3),
  82. UNIPHIER_MIO_CLK_USB2_PHY(12, 0),
  83. UNIPHIER_MIO_CLK_USB2_PHY(13, 1),
  84. UNIPHIER_MIO_CLK_USB2_PHY(14, 2),
  85. UNIPHIER_MIO_CLK_USB2_PHY(15, 3),
  86. { /* sentinel */ }
  87. };
  88. const struct uniphier_clk_data uniphier_pro5_sd_clk_data[] = {
  89. UNIPHIER_MIO_CLK_SD_FIXED,
  90. UNIPHIER_MIO_CLK_SD(0, 0),
  91. UNIPHIER_MIO_CLK_SD(1, 1),
  92. { /* sentinel */ }
  93. };