clockdomains2430_data.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * OMAP2xxx clockdomains
  4. *
  5. * Copyright (C) 2008-2009 Texas Instruments, Inc.
  6. * Copyright (C) 2008-2010 Nokia Corporation
  7. *
  8. * Paul Walmsley, Jouni Högander
  9. *
  10. * This file contains clockdomains and clockdomain wakeup dependencies
  11. * for OMAP2xxx chips. Some notes:
  12. *
  13. * A useful validation rule for struct clockdomain: Any clockdomain
  14. * referenced by a wkdep_srcs must have a dep_bit assigned. So
  15. * wkdep_srcs are really just software-controllable dependencies.
  16. * Non-software-controllable dependencies do exist, but they are not
  17. * encoded below (yet).
  18. *
  19. * 24xx does not support programmable sleep dependencies (SLEEPDEP)
  20. *
  21. * The overly-specific dep_bit names are due to a bit name collision
  22. * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
  23. * value are the same for all powerdomains: 2
  24. *
  25. * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
  26. * sanity check?
  27. * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
  28. */
  29. /*
  30. * To-Do List
  31. * -> Port the Sleep/Wakeup dependencies for the domains
  32. * from the Power domain framework
  33. */
  34. #include <linux/kernel.h>
  35. #include <linux/io.h>
  36. #include "soc.h"
  37. #include "clockdomain.h"
  38. #include "prm2xxx_3xxx.h"
  39. #include "cm2xxx_3xxx.h"
  40. #include "cm-regbits-24xx.h"
  41. #include "prm-regbits-24xx.h"
  42. /*
  43. * Clockdomain dependencies for wkdeps
  44. *
  45. * XXX Hardware dependencies (e.g., dependencies that cannot be
  46. * changed in software) are not included here yet, but should be.
  47. */
  48. /* Wakeup dependency source arrays */
  49. /* 2430-specific possible wakeup dependencies */
  50. /* 2430 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP, MDM */
  51. static struct clkdm_dep core_2430_wkdeps[] = {
  52. { .clkdm_name = "dsp_clkdm" },
  53. { .clkdm_name = "gfx_clkdm" },
  54. { .clkdm_name = "mpu_clkdm" },
  55. { .clkdm_name = "wkup_clkdm" },
  56. { .clkdm_name = "mdm_clkdm" },
  57. { NULL },
  58. };
  59. /* 2430 PM_WKDEP_MPU: CORE, DSP, WKUP, MDM */
  60. static struct clkdm_dep mpu_2430_wkdeps[] = {
  61. { .clkdm_name = "core_l3_clkdm" },
  62. { .clkdm_name = "core_l4_clkdm" },
  63. { .clkdm_name = "dsp_clkdm" },
  64. { .clkdm_name = "wkup_clkdm" },
  65. { .clkdm_name = "mdm_clkdm" },
  66. { NULL },
  67. };
  68. /* 2430 PM_WKDEP_MDM: CORE, MPU, WKUP */
  69. static struct clkdm_dep mdm_2430_wkdeps[] = {
  70. { .clkdm_name = "core_l3_clkdm" },
  71. { .clkdm_name = "core_l4_clkdm" },
  72. { .clkdm_name = "mpu_clkdm" },
  73. { .clkdm_name = "wkup_clkdm" },
  74. { NULL },
  75. };
  76. /*
  77. * 2430-only clockdomains
  78. */
  79. static struct clockdomain mpu_2430_clkdm = {
  80. .name = "mpu_clkdm",
  81. .pwrdm = { .name = "mpu_pwrdm" },
  82. .flags = CLKDM_CAN_HWSUP_SWSUP,
  83. .wkdep_srcs = mpu_2430_wkdeps,
  84. .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
  85. };
  86. /* Another case of bit name collisions between several registers: EN_MDM */
  87. static struct clockdomain mdm_clkdm = {
  88. .name = "mdm_clkdm",
  89. .pwrdm = { .name = "mdm_pwrdm" },
  90. .flags = CLKDM_CAN_HWSUP_SWSUP,
  91. .dep_bit = OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
  92. .wkdep_srcs = mdm_2430_wkdeps,
  93. .clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
  94. };
  95. static struct clockdomain dsp_2430_clkdm = {
  96. .name = "dsp_clkdm",
  97. .pwrdm = { .name = "dsp_pwrdm" },
  98. .flags = CLKDM_CAN_HWSUP_SWSUP,
  99. .dep_bit = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
  100. .wkdep_srcs = dsp_24xx_wkdeps,
  101. .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
  102. };
  103. static struct clockdomain gfx_2430_clkdm = {
  104. .name = "gfx_clkdm",
  105. .pwrdm = { .name = "gfx_pwrdm" },
  106. .flags = CLKDM_CAN_HWSUP_SWSUP,
  107. .wkdep_srcs = gfx_24xx_wkdeps,
  108. .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
  109. };
  110. /*
  111. * XXX add usecounting for clkdm dependencies, otherwise the presence
  112. * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
  113. * could cause trouble
  114. */
  115. static struct clockdomain core_l3_2430_clkdm = {
  116. .name = "core_l3_clkdm",
  117. .pwrdm = { .name = "core_pwrdm" },
  118. .flags = CLKDM_CAN_HWSUP,
  119. .dep_bit = OMAP24XX_EN_CORE_SHIFT,
  120. .wkdep_srcs = core_2430_wkdeps,
  121. .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
  122. };
  123. /*
  124. * XXX add usecounting for clkdm dependencies, otherwise the presence
  125. * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
  126. * could cause trouble
  127. */
  128. static struct clockdomain core_l4_2430_clkdm = {
  129. .name = "core_l4_clkdm",
  130. .pwrdm = { .name = "core_pwrdm" },
  131. .flags = CLKDM_CAN_HWSUP,
  132. .dep_bit = OMAP24XX_EN_CORE_SHIFT,
  133. .wkdep_srcs = core_2430_wkdeps,
  134. .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
  135. };
  136. static struct clockdomain dss_2430_clkdm = {
  137. .name = "dss_clkdm",
  138. .pwrdm = { .name = "core_pwrdm" },
  139. .flags = CLKDM_CAN_HWSUP,
  140. .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
  141. };
  142. static struct clockdomain *clockdomains_omap243x[] __initdata = {
  143. &wkup_common_clkdm,
  144. &mpu_2430_clkdm,
  145. &mdm_clkdm,
  146. &dsp_2430_clkdm,
  147. &gfx_2430_clkdm,
  148. &core_l3_2430_clkdm,
  149. &core_l4_2430_clkdm,
  150. &dss_2430_clkdm,
  151. NULL,
  152. };
  153. void __init omap243x_clockdomains_init(void)
  154. {
  155. if (!cpu_is_omap243x())
  156. return;
  157. clkdm_register_platform_funcs(&omap2_clkdm_operations);
  158. clkdm_register_clkdms(clockdomains_omap243x);
  159. clkdm_complete_init();
  160. }