zx296718_pm_domains.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) 2017 ZTE Ltd.
  4. *
  5. * Author: Baoyou Xie <baoyou.xie@linaro.org>
  6. */
  7. #include <dt-bindings/soc/zte,pm_domains.h>
  8. #include "zx2967_pm_domains.h"
  9. static u16 zx296718_offsets[REG_ARRAY_SIZE] = {
  10. [REG_CLKEN] = 0x18,
  11. [REG_ISOEN] = 0x1c,
  12. [REG_RSTEN] = 0x20,
  13. [REG_PWREN] = 0x24,
  14. [REG_ACK_SYNC] = 0x28,
  15. };
  16. enum {
  17. PCU_DM_VOU = 0,
  18. PCU_DM_SAPPU,
  19. PCU_DM_VDE,
  20. PCU_DM_VCE,
  21. PCU_DM_HDE,
  22. PCU_DM_VIU,
  23. PCU_DM_USB20,
  24. PCU_DM_USB21,
  25. PCU_DM_USB30,
  26. PCU_DM_HSIC,
  27. PCU_DM_GMAC,
  28. PCU_DM_TS,
  29. };
  30. static struct zx2967_pm_domain vou_domain = {
  31. .dm = {
  32. .name = "vou_domain",
  33. },
  34. .bit = PCU_DM_VOU,
  35. .polarity = PWREN,
  36. .reg_offset = zx296718_offsets,
  37. };
  38. static struct zx2967_pm_domain sappu_domain = {
  39. .dm = {
  40. .name = "sappu_domain",
  41. },
  42. .bit = PCU_DM_SAPPU,
  43. .polarity = PWREN,
  44. .reg_offset = zx296718_offsets,
  45. };
  46. static struct zx2967_pm_domain vde_domain = {
  47. .dm = {
  48. .name = "vde_domain",
  49. },
  50. .bit = PCU_DM_VDE,
  51. .polarity = PWREN,
  52. .reg_offset = zx296718_offsets,
  53. };
  54. static struct zx2967_pm_domain vce_domain = {
  55. .dm = {
  56. .name = "vce_domain",
  57. },
  58. .bit = PCU_DM_VCE,
  59. .polarity = PWREN,
  60. .reg_offset = zx296718_offsets,
  61. };
  62. static struct zx2967_pm_domain hde_domain = {
  63. .dm = {
  64. .name = "hde_domain",
  65. },
  66. .bit = PCU_DM_HDE,
  67. .polarity = PWREN,
  68. .reg_offset = zx296718_offsets,
  69. };
  70. static struct zx2967_pm_domain viu_domain = {
  71. .dm = {
  72. .name = "viu_domain",
  73. },
  74. .bit = PCU_DM_VIU,
  75. .polarity = PWREN,
  76. .reg_offset = zx296718_offsets,
  77. };
  78. static struct zx2967_pm_domain usb20_domain = {
  79. .dm = {
  80. .name = "usb20_domain",
  81. },
  82. .bit = PCU_DM_USB20,
  83. .polarity = PWREN,
  84. .reg_offset = zx296718_offsets,
  85. };
  86. static struct zx2967_pm_domain usb21_domain = {
  87. .dm = {
  88. .name = "usb21_domain",
  89. },
  90. .bit = PCU_DM_USB21,
  91. .polarity = PWREN,
  92. .reg_offset = zx296718_offsets,
  93. };
  94. static struct zx2967_pm_domain usb30_domain = {
  95. .dm = {
  96. .name = "usb30_domain",
  97. },
  98. .bit = PCU_DM_USB30,
  99. .polarity = PWREN,
  100. .reg_offset = zx296718_offsets,
  101. };
  102. static struct zx2967_pm_domain hsic_domain = {
  103. .dm = {
  104. .name = "hsic_domain",
  105. },
  106. .bit = PCU_DM_HSIC,
  107. .polarity = PWREN,
  108. .reg_offset = zx296718_offsets,
  109. };
  110. static struct zx2967_pm_domain gmac_domain = {
  111. .dm = {
  112. .name = "gmac_domain",
  113. },
  114. .bit = PCU_DM_GMAC,
  115. .polarity = PWREN,
  116. .reg_offset = zx296718_offsets,
  117. };
  118. static struct zx2967_pm_domain ts_domain = {
  119. .dm = {
  120. .name = "ts_domain",
  121. },
  122. .bit = PCU_DM_TS,
  123. .polarity = PWREN,
  124. .reg_offset = zx296718_offsets,
  125. };
  126. static struct generic_pm_domain *zx296718_pm_domains[] = {
  127. [DM_ZX296718_VOU] = &vou_domain.dm,
  128. [DM_ZX296718_SAPPU] = &sappu_domain.dm,
  129. [DM_ZX296718_VDE] = &vde_domain.dm,
  130. [DM_ZX296718_VCE] = &vce_domain.dm,
  131. [DM_ZX296718_HDE] = &hde_domain.dm,
  132. [DM_ZX296718_VIU] = &viu_domain.dm,
  133. [DM_ZX296718_USB20] = &usb20_domain.dm,
  134. [DM_ZX296718_USB21] = &usb21_domain.dm,
  135. [DM_ZX296718_USB30] = &usb30_domain.dm,
  136. [DM_ZX296718_HSIC] = &hsic_domain.dm,
  137. [DM_ZX296718_GMAC] = &gmac_domain.dm,
  138. [DM_ZX296718_TS] = &ts_domain.dm,
  139. };
  140. static int zx296718_pd_probe(struct platform_device *pdev)
  141. {
  142. return zx2967_pd_probe(pdev,
  143. zx296718_pm_domains,
  144. ARRAY_SIZE(zx296718_pm_domains));
  145. }
  146. static const struct of_device_id zx296718_pm_domain_matches[] = {
  147. { .compatible = "zte,zx296718-pcu", },
  148. { },
  149. };
  150. static struct platform_driver zx296718_pd_driver = {
  151. .driver = {
  152. .name = "zx296718-powerdomain",
  153. .of_match_table = zx296718_pm_domain_matches,
  154. },
  155. .probe = zx296718_pd_probe,
  156. };
  157. static int __init zx296718_pd_init(void)
  158. {
  159. return platform_driver_register(&zx296718_pd_driver);
  160. }
  161. subsys_initcall(zx296718_pd_init);