powerdomains33xx_data.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * AM33XX Power domain data
  3. *
  4. * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation version 2.
  9. *
  10. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  11. * kind, whether express or implied; without even the implied warranty
  12. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include "powerdomain.h"
  18. #include "prcm-common.h"
  19. #include "prm-regbits-33xx.h"
  20. #include "prm33xx.h"
  21. static struct powerdomain gfx_33xx_pwrdm = {
  22. .name = "gfx_pwrdm",
  23. .voltdm = { .name = "core" },
  24. .prcm_offs = AM33XX_PRM_GFX_MOD,
  25. .pwrstctrl_offs = AM33XX_PM_GFX_PWRSTCTRL_OFFSET,
  26. .pwrstst_offs = AM33XX_PM_GFX_PWRSTST_OFFSET,
  27. .pwrsts = PWRSTS_OFF_RET_ON,
  28. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  29. .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
  30. .banks = 1,
  31. .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
  32. .mem_on_mask = {
  33. [0] = AM33XX_GFX_MEM_ONSTATE_MASK, /* gfx_mem */
  34. },
  35. .mem_ret_mask = {
  36. [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */
  37. },
  38. .mem_pwrst_mask = {
  39. [0] = AM33XX_GFX_MEM_STATEST_MASK, /* gfx_mem */
  40. },
  41. .mem_retst_mask = {
  42. [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */
  43. },
  44. .pwrsts_mem_ret = {
  45. [0] = PWRSTS_OFF_RET, /* gfx_mem */
  46. },
  47. .pwrsts_mem_on = {
  48. [0] = PWRSTS_ON, /* gfx_mem */
  49. },
  50. };
  51. static struct powerdomain rtc_33xx_pwrdm = {
  52. .name = "rtc_pwrdm",
  53. .voltdm = { .name = "rtc" },
  54. .prcm_offs = AM33XX_PRM_RTC_MOD,
  55. .pwrstctrl_offs = AM33XX_PM_RTC_PWRSTCTRL_OFFSET,
  56. .pwrstst_offs = AM33XX_PM_RTC_PWRSTST_OFFSET,
  57. .pwrsts = PWRSTS_ON,
  58. .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
  59. };
  60. static struct powerdomain wkup_33xx_pwrdm = {
  61. .name = "wkup_pwrdm",
  62. .voltdm = { .name = "core" },
  63. .prcm_offs = AM33XX_PRM_WKUP_MOD,
  64. .pwrstctrl_offs = AM33XX_PM_WKUP_PWRSTCTRL_OFFSET,
  65. .pwrstst_offs = AM33XX_PM_WKUP_PWRSTST_OFFSET,
  66. .pwrsts = PWRSTS_ON,
  67. .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK,
  68. };
  69. static struct powerdomain per_33xx_pwrdm = {
  70. .name = "per_pwrdm",
  71. .voltdm = { .name = "core" },
  72. .prcm_offs = AM33XX_PRM_PER_MOD,
  73. .pwrstctrl_offs = AM33XX_PM_PER_PWRSTCTRL_OFFSET,
  74. .pwrstst_offs = AM33XX_PM_PER_PWRSTST_OFFSET,
  75. .pwrsts = PWRSTS_OFF_RET_ON,
  76. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  77. .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
  78. .banks = 3,
  79. .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK,
  80. .mem_on_mask = {
  81. [0] = AM33XX_PRUSS_MEM_ONSTATE_MASK, /* pruss_mem */
  82. [1] = AM33XX_PER_MEM_ONSTATE_MASK, /* per_mem */
  83. [2] = AM33XX_RAM_MEM_ONSTATE_MASK, /* ram_mem */
  84. },
  85. .mem_ret_mask = {
  86. [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */
  87. [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */
  88. [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */
  89. },
  90. .mem_pwrst_mask = {
  91. [0] = AM33XX_PRUSS_MEM_STATEST_MASK, /* pruss_mem */
  92. [1] = AM33XX_PER_MEM_STATEST_MASK, /* per_mem */
  93. [2] = AM33XX_RAM_MEM_STATEST_MASK, /* ram_mem */
  94. },
  95. .mem_retst_mask = {
  96. [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */
  97. [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */
  98. [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */
  99. },
  100. .pwrsts_mem_ret = {
  101. [0] = PWRSTS_OFF_RET, /* pruss_mem */
  102. [1] = PWRSTS_OFF_RET, /* per_mem */
  103. [2] = PWRSTS_OFF_RET, /* ram_mem */
  104. },
  105. .pwrsts_mem_on = {
  106. [0] = PWRSTS_ON, /* pruss_mem */
  107. [1] = PWRSTS_ON, /* per_mem */
  108. [2] = PWRSTS_ON, /* ram_mem */
  109. },
  110. };
  111. static struct powerdomain mpu_33xx_pwrdm = {
  112. .name = "mpu_pwrdm",
  113. .voltdm = { .name = "mpu" },
  114. .prcm_offs = AM33XX_PRM_MPU_MOD,
  115. .pwrstctrl_offs = AM33XX_PM_MPU_PWRSTCTRL_OFFSET,
  116. .pwrstst_offs = AM33XX_PM_MPU_PWRSTST_OFFSET,
  117. .pwrsts = PWRSTS_OFF_RET_ON,
  118. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  119. .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
  120. .banks = 3,
  121. .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
  122. .mem_on_mask = {
  123. [0] = AM33XX_MPU_L1_ONSTATE_MASK, /* mpu_l1 */
  124. [1] = AM33XX_MPU_L2_ONSTATE_MASK, /* mpu_l2 */
  125. [2] = AM33XX_MPU_RAM_ONSTATE_MASK, /* mpu_ram */
  126. },
  127. .mem_ret_mask = {
  128. [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */
  129. [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */
  130. [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */
  131. },
  132. .mem_pwrst_mask = {
  133. [0] = AM33XX_MPU_L1_STATEST_MASK, /* mpu_l1 */
  134. [1] = AM33XX_MPU_L2_STATEST_MASK, /* mpu_l2 */
  135. [2] = AM33XX_MPU_RAM_STATEST_MASK, /* mpu_ram */
  136. },
  137. .mem_retst_mask = {
  138. [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */
  139. [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */
  140. [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */
  141. },
  142. .pwrsts_mem_ret = {
  143. [0] = PWRSTS_OFF_RET, /* mpu_l1 */
  144. [1] = PWRSTS_OFF_RET, /* mpu_l2 */
  145. [2] = PWRSTS_OFF_RET, /* mpu_ram */
  146. },
  147. .pwrsts_mem_on = {
  148. [0] = PWRSTS_ON, /* mpu_l1 */
  149. [1] = PWRSTS_ON, /* mpu_l2 */
  150. [2] = PWRSTS_ON, /* mpu_ram */
  151. },
  152. };
  153. static struct powerdomain cefuse_33xx_pwrdm = {
  154. .name = "cefuse_pwrdm",
  155. .voltdm = { .name = "core" },
  156. .prcm_offs = AM33XX_PRM_CEFUSE_MOD,
  157. .pwrstctrl_offs = AM33XX_PM_CEFUSE_PWRSTCTRL_OFFSET,
  158. .pwrstst_offs = AM33XX_PM_CEFUSE_PWRSTST_OFFSET,
  159. .pwrsts = PWRSTS_OFF_ON,
  160. };
  161. static struct powerdomain *powerdomains_am33xx[] __initdata = {
  162. &gfx_33xx_pwrdm,
  163. &rtc_33xx_pwrdm,
  164. &wkup_33xx_pwrdm,
  165. &per_33xx_pwrdm,
  166. &mpu_33xx_pwrdm,
  167. &cefuse_33xx_pwrdm,
  168. NULL,
  169. };
  170. void __init am33xx_powerdomains_init(void)
  171. {
  172. pwrdm_register_platform_funcs(&am33xx_pwrdm_operations);
  173. pwrdm_register_pwrdms(powerdomains_am33xx);
  174. pwrdm_complete_init();
  175. }