powerdomains3xxx_data.c 7.9 KB

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