powerdomains3xxx_data.c 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /*
  2. * OMAP3 powerdomain definitions
  3. *
  4. * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
  5. * Copyright (C) 2007-2011 Nokia Corporation
  6. *
  7. * Paul Walmsley, Jouni Högander
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <plat/cpu.h>
  16. #include "powerdomain.h"
  17. #include "powerdomains2xxx_3xxx_data.h"
  18. #include "prcm-common.h"
  19. #include "prm2xxx_3xxx.h"
  20. #include "prm-regbits-34xx.h"
  21. #include "cm2xxx_3xxx.h"
  22. #include "cm-regbits-34xx.h"
  23. /*
  24. * 34XX-specific powerdomains, dependencies
  25. */
  26. /*
  27. * Powerdomains
  28. */
  29. static struct powerdomain iva2_pwrdm = {
  30. .name = "iva2_pwrdm",
  31. .prcm_offs = OMAP3430_IVA2_MOD,
  32. .pwrsts = PWRSTS_OFF_RET_ON,
  33. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  34. .banks = 4,
  35. .pwrsts_mem_ret = {
  36. [0] = PWRSTS_OFF_RET,
  37. [1] = PWRSTS_OFF_RET,
  38. [2] = PWRSTS_OFF_RET,
  39. [3] = PWRSTS_OFF_RET,
  40. },
  41. .pwrsts_mem_on = {
  42. [0] = PWRSTS_ON,
  43. [1] = PWRSTS_ON,
  44. [2] = PWRSTS_OFF_ON,
  45. [3] = PWRSTS_ON,
  46. },
  47. .voltdm = { .name = "mpu_iva" },
  48. };
  49. static struct powerdomain mpu_3xxx_pwrdm = {
  50. .name = "mpu_pwrdm",
  51. .prcm_offs = MPU_MOD,
  52. .pwrsts = PWRSTS_OFF_RET_ON,
  53. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  54. .flags = PWRDM_HAS_MPU_QUIRK,
  55. .banks = 1,
  56. .pwrsts_mem_ret = {
  57. [0] = PWRSTS_OFF_RET,
  58. },
  59. .pwrsts_mem_on = {
  60. [0] = PWRSTS_OFF_ON,
  61. },
  62. .voltdm = { .name = "mpu_iva" },
  63. };
  64. /*
  65. * The USBTLL Save-and-Restore mechanism is broken on
  66. * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
  67. * needs to be disabled on these chips.
  68. * Refer: 3430 errata ID i459 and 3630 errata ID i579
  69. *
  70. * Note: setting the SAR flag could help for errata ID i478
  71. * which applies to 3430 <= ES3.1, but since the SAR feature
  72. * is broken, do not use it.
  73. */
  74. static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
  75. .name = "core_pwrdm",
  76. .prcm_offs = CORE_MOD,
  77. .pwrsts = PWRSTS_OFF_RET_ON,
  78. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  79. .banks = 2,
  80. .pwrsts_mem_ret = {
  81. [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
  82. [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
  83. },
  84. .pwrsts_mem_on = {
  85. [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
  86. [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
  87. },
  88. .voltdm = { .name = "core" },
  89. };
  90. static struct powerdomain core_3xxx_es3_1_pwrdm = {
  91. .name = "core_pwrdm",
  92. .prcm_offs = CORE_MOD,
  93. .pwrsts = PWRSTS_OFF_RET_ON,
  94. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  95. /*
  96. * Setting the SAR flag for errata ID i478 which applies
  97. * to 3430 <= ES3.1
  98. */
  99. .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */
  100. .banks = 2,
  101. .pwrsts_mem_ret = {
  102. [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
  103. [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
  104. },
  105. .pwrsts_mem_on = {
  106. [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
  107. [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
  108. },
  109. .voltdm = { .name = "core" },
  110. };
  111. static struct powerdomain dss_pwrdm = {
  112. .name = "dss_pwrdm",
  113. .prcm_offs = OMAP3430_DSS_MOD,
  114. .pwrsts = PWRSTS_OFF_RET_ON,
  115. .pwrsts_logic_ret = PWRSTS_RET,
  116. .banks = 1,
  117. .pwrsts_mem_ret = {
  118. [0] = PWRSTS_RET, /* MEMRETSTATE */
  119. },
  120. .pwrsts_mem_on = {
  121. [0] = PWRSTS_ON, /* MEMONSTATE */
  122. },
  123. .voltdm = { .name = "core" },
  124. };
  125. /*
  126. * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
  127. * possible SGX powerstate, the SGX device itself does not support
  128. * retention.
  129. */
  130. static struct powerdomain sgx_pwrdm = {
  131. .name = "sgx_pwrdm",
  132. .prcm_offs = OMAP3430ES2_SGX_MOD,
  133. /* XXX This is accurate for 3430 SGX, but what about GFX? */
  134. .pwrsts = PWRSTS_OFF_ON,
  135. .pwrsts_logic_ret = PWRSTS_RET,
  136. .banks = 1,
  137. .pwrsts_mem_ret = {
  138. [0] = PWRSTS_RET, /* MEMRETSTATE */
  139. },
  140. .pwrsts_mem_on = {
  141. [0] = PWRSTS_ON, /* MEMONSTATE */
  142. },
  143. .voltdm = { .name = "core" },
  144. };
  145. static struct powerdomain cam_pwrdm = {
  146. .name = "cam_pwrdm",
  147. .prcm_offs = OMAP3430_CAM_MOD,
  148. .pwrsts = PWRSTS_OFF_RET_ON,
  149. .pwrsts_logic_ret = PWRSTS_RET,
  150. .banks = 1,
  151. .pwrsts_mem_ret = {
  152. [0] = PWRSTS_RET, /* MEMRETSTATE */
  153. },
  154. .pwrsts_mem_on = {
  155. [0] = PWRSTS_ON, /* MEMONSTATE */
  156. },
  157. .voltdm = { .name = "core" },
  158. };
  159. static struct powerdomain per_pwrdm = {
  160. .name = "per_pwrdm",
  161. .prcm_offs = OMAP3430_PER_MOD,
  162. .pwrsts = PWRSTS_OFF_RET_ON,
  163. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  164. .banks = 1,
  165. .pwrsts_mem_ret = {
  166. [0] = PWRSTS_RET, /* MEMRETSTATE */
  167. },
  168. .pwrsts_mem_on = {
  169. [0] = PWRSTS_ON, /* MEMONSTATE */
  170. },
  171. .voltdm = { .name = "core" },
  172. };
  173. static struct powerdomain emu_pwrdm = {
  174. .name = "emu_pwrdm",
  175. .prcm_offs = OMAP3430_EMU_MOD,
  176. .voltdm = { .name = "core" },
  177. };
  178. static struct powerdomain neon_pwrdm = {
  179. .name = "neon_pwrdm",
  180. .prcm_offs = OMAP3430_NEON_MOD,
  181. .pwrsts = PWRSTS_OFF_RET_ON,
  182. .pwrsts_logic_ret = PWRSTS_RET,
  183. .voltdm = { .name = "mpu_iva" },
  184. };
  185. static struct powerdomain usbhost_pwrdm = {
  186. .name = "usbhost_pwrdm",
  187. .prcm_offs = OMAP3430ES2_USBHOST_MOD,
  188. .pwrsts = PWRSTS_OFF_RET_ON,
  189. .pwrsts_logic_ret = PWRSTS_RET,
  190. /*
  191. * REVISIT: Enabling usb host save and restore mechanism seems to
  192. * leave the usb host domain permanently in ACTIVE mode after
  193. * changing the usb host power domain state from OFF to active once.
  194. * Disabling for now.
  195. */
  196. /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
  197. .banks = 1,
  198. .pwrsts_mem_ret = {
  199. [0] = PWRSTS_RET, /* MEMRETSTATE */
  200. },
  201. .pwrsts_mem_on = {
  202. [0] = PWRSTS_ON, /* MEMONSTATE */
  203. },
  204. .voltdm = { .name = "core" },
  205. };
  206. static struct powerdomain dpll1_pwrdm = {
  207. .name = "dpll1_pwrdm",
  208. .prcm_offs = MPU_MOD,
  209. .voltdm = { .name = "mpu_iva" },
  210. };
  211. static struct powerdomain dpll2_pwrdm = {
  212. .name = "dpll2_pwrdm",
  213. .prcm_offs = OMAP3430_IVA2_MOD,
  214. .voltdm = { .name = "mpu_iva" },
  215. };
  216. static struct powerdomain dpll3_pwrdm = {
  217. .name = "dpll3_pwrdm",
  218. .prcm_offs = PLL_MOD,
  219. .voltdm = { .name = "core" },
  220. };
  221. static struct powerdomain dpll4_pwrdm = {
  222. .name = "dpll4_pwrdm",
  223. .prcm_offs = PLL_MOD,
  224. .voltdm = { .name = "core" },
  225. };
  226. static struct powerdomain dpll5_pwrdm = {
  227. .name = "dpll5_pwrdm",
  228. .prcm_offs = PLL_MOD,
  229. .voltdm = { .name = "core" },
  230. };
  231. /* As powerdomains are added or removed above, this list must also be changed */
  232. static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
  233. &wkup_omap2_pwrdm,
  234. &iva2_pwrdm,
  235. &mpu_3xxx_pwrdm,
  236. &neon_pwrdm,
  237. &cam_pwrdm,
  238. &dss_pwrdm,
  239. &per_pwrdm,
  240. &emu_pwrdm,
  241. &dpll1_pwrdm,
  242. &dpll2_pwrdm,
  243. &dpll3_pwrdm,
  244. &dpll4_pwrdm,
  245. NULL
  246. };
  247. static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
  248. &gfx_omap2_pwrdm,
  249. &core_3xxx_pre_es3_1_pwrdm,
  250. NULL
  251. };
  252. /* also includes 3630ES1.0 */
  253. static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
  254. &core_3xxx_pre_es3_1_pwrdm,
  255. &sgx_pwrdm,
  256. &usbhost_pwrdm,
  257. &dpll5_pwrdm,
  258. NULL
  259. };
  260. /* also includes 3630ES1.1+ */
  261. static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
  262. &core_3xxx_es3_1_pwrdm,
  263. &sgx_pwrdm,
  264. &usbhost_pwrdm,
  265. &dpll5_pwrdm,
  266. NULL
  267. };
  268. void __init omap3xxx_powerdomains_init(void)
  269. {
  270. unsigned int rev;
  271. if (!cpu_is_omap34xx())
  272. return;
  273. pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
  274. pwrdm_register_pwrdms(powerdomains_omap3430_common);
  275. rev = omap_rev();
  276. if (rev == OMAP3430_REV_ES1_0)
  277. pwrdm_register_pwrdms(powerdomains_omap3430es1);
  278. else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
  279. rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
  280. pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
  281. else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
  282. rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1 ||
  283. rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
  284. pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
  285. else
  286. WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
  287. pwrdm_complete_init();
  288. }