powerdomains3xxx_data.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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 "soc.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. static struct powerdomain mpu_am35x_pwrdm = {
  66. .name = "mpu_pwrdm",
  67. .prcm_offs = MPU_MOD,
  68. .pwrsts = PWRSTS_ON,
  69. .pwrsts_logic_ret = PWRSTS_ON,
  70. .flags = PWRDM_HAS_MPU_QUIRK,
  71. .banks = 1,
  72. .pwrsts_mem_ret = {
  73. [0] = PWRSTS_ON,
  74. },
  75. .pwrsts_mem_on = {
  76. [0] = PWRSTS_ON,
  77. },
  78. .voltdm = { .name = "mpu_iva" },
  79. };
  80. /*
  81. * The USBTLL Save-and-Restore mechanism is broken on
  82. * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
  83. * needs to be disabled on these chips.
  84. * Refer: 3430 errata ID i459 and 3630 errata ID i579
  85. *
  86. * Note: setting the SAR flag could help for errata ID i478
  87. * which applies to 3430 <= ES3.1, but since the SAR feature
  88. * is broken, do not use it.
  89. */
  90. static struct powerdomain core_3xxx_pre_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. .banks = 2,
  96. .pwrsts_mem_ret = {
  97. [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
  98. [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
  99. },
  100. .pwrsts_mem_on = {
  101. [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
  102. [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
  103. },
  104. .voltdm = { .name = "core" },
  105. };
  106. static struct powerdomain core_3xxx_es3_1_pwrdm = {
  107. .name = "core_pwrdm",
  108. .prcm_offs = CORE_MOD,
  109. .pwrsts = PWRSTS_OFF_RET_ON,
  110. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  111. /*
  112. * Setting the SAR flag for errata ID i478 which applies
  113. * to 3430 <= ES3.1
  114. */
  115. .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */
  116. .banks = 2,
  117. .pwrsts_mem_ret = {
  118. [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
  119. [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
  120. },
  121. .pwrsts_mem_on = {
  122. [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
  123. [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
  124. },
  125. .voltdm = { .name = "core" },
  126. };
  127. static struct powerdomain core_am35x_pwrdm = {
  128. .name = "core_pwrdm",
  129. .prcm_offs = CORE_MOD,
  130. .pwrsts = PWRSTS_ON,
  131. .pwrsts_logic_ret = PWRSTS_ON,
  132. .banks = 2,
  133. .pwrsts_mem_ret = {
  134. [0] = PWRSTS_ON, /* MEM1RETSTATE */
  135. [1] = PWRSTS_ON, /* MEM2RETSTATE */
  136. },
  137. .pwrsts_mem_on = {
  138. [0] = PWRSTS_ON, /* MEM1ONSTATE */
  139. [1] = PWRSTS_ON, /* MEM2ONSTATE */
  140. },
  141. .voltdm = { .name = "core" },
  142. };
  143. static struct powerdomain dss_pwrdm = {
  144. .name = "dss_pwrdm",
  145. .prcm_offs = OMAP3430_DSS_MOD,
  146. .pwrsts = PWRSTS_OFF_RET_ON,
  147. .pwrsts_logic_ret = PWRSTS_RET,
  148. .banks = 1,
  149. .pwrsts_mem_ret = {
  150. [0] = PWRSTS_RET, /* MEMRETSTATE */
  151. },
  152. .pwrsts_mem_on = {
  153. [0] = PWRSTS_ON, /* MEMONSTATE */
  154. },
  155. .voltdm = { .name = "core" },
  156. };
  157. static struct powerdomain dss_am35x_pwrdm = {
  158. .name = "dss_pwrdm",
  159. .prcm_offs = OMAP3430_DSS_MOD,
  160. .pwrsts = PWRSTS_ON,
  161. .pwrsts_logic_ret = PWRSTS_ON,
  162. .banks = 1,
  163. .pwrsts_mem_ret = {
  164. [0] = PWRSTS_ON, /* MEMRETSTATE */
  165. },
  166. .pwrsts_mem_on = {
  167. [0] = PWRSTS_ON, /* MEMONSTATE */
  168. },
  169. .voltdm = { .name = "core" },
  170. };
  171. /*
  172. * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
  173. * possible SGX powerstate, the SGX device itself does not support
  174. * retention.
  175. */
  176. static struct powerdomain sgx_pwrdm = {
  177. .name = "sgx_pwrdm",
  178. .prcm_offs = OMAP3430ES2_SGX_MOD,
  179. /* XXX This is accurate for 3430 SGX, but what about GFX? */
  180. .pwrsts = PWRSTS_OFF_ON,
  181. .pwrsts_logic_ret = PWRSTS_RET,
  182. .banks = 1,
  183. .pwrsts_mem_ret = {
  184. [0] = PWRSTS_RET, /* MEMRETSTATE */
  185. },
  186. .pwrsts_mem_on = {
  187. [0] = PWRSTS_ON, /* MEMONSTATE */
  188. },
  189. .voltdm = { .name = "core" },
  190. };
  191. static struct powerdomain sgx_am35x_pwrdm = {
  192. .name = "sgx_pwrdm",
  193. .prcm_offs = OMAP3430ES2_SGX_MOD,
  194. .pwrsts = PWRSTS_ON,
  195. .pwrsts_logic_ret = PWRSTS_ON,
  196. .banks = 1,
  197. .pwrsts_mem_ret = {
  198. [0] = PWRSTS_ON, /* MEMRETSTATE */
  199. },
  200. .pwrsts_mem_on = {
  201. [0] = PWRSTS_ON, /* MEMONSTATE */
  202. },
  203. .voltdm = { .name = "core" },
  204. };
  205. static struct powerdomain cam_pwrdm = {
  206. .name = "cam_pwrdm",
  207. .prcm_offs = OMAP3430_CAM_MOD,
  208. .pwrsts = PWRSTS_OFF_RET_ON,
  209. .pwrsts_logic_ret = PWRSTS_RET,
  210. .banks = 1,
  211. .pwrsts_mem_ret = {
  212. [0] = PWRSTS_RET, /* MEMRETSTATE */
  213. },
  214. .pwrsts_mem_on = {
  215. [0] = PWRSTS_ON, /* MEMONSTATE */
  216. },
  217. .voltdm = { .name = "core" },
  218. };
  219. static struct powerdomain per_pwrdm = {
  220. .name = "per_pwrdm",
  221. .prcm_offs = OMAP3430_PER_MOD,
  222. .pwrsts = PWRSTS_OFF_RET_ON,
  223. .pwrsts_logic_ret = PWRSTS_OFF_RET,
  224. .banks = 1,
  225. .pwrsts_mem_ret = {
  226. [0] = PWRSTS_RET, /* MEMRETSTATE */
  227. },
  228. .pwrsts_mem_on = {
  229. [0] = PWRSTS_ON, /* MEMONSTATE */
  230. },
  231. .voltdm = { .name = "core" },
  232. };
  233. static struct powerdomain per_am35x_pwrdm = {
  234. .name = "per_pwrdm",
  235. .prcm_offs = OMAP3430_PER_MOD,
  236. .pwrsts = PWRSTS_ON,
  237. .pwrsts_logic_ret = PWRSTS_ON,
  238. .banks = 1,
  239. .pwrsts_mem_ret = {
  240. [0] = PWRSTS_ON, /* MEMRETSTATE */
  241. },
  242. .pwrsts_mem_on = {
  243. [0] = PWRSTS_ON, /* MEMONSTATE */
  244. },
  245. .voltdm = { .name = "core" },
  246. };
  247. static struct powerdomain emu_pwrdm = {
  248. .name = "emu_pwrdm",
  249. .prcm_offs = OMAP3430_EMU_MOD,
  250. .voltdm = { .name = "core" },
  251. };
  252. static struct powerdomain neon_pwrdm = {
  253. .name = "neon_pwrdm",
  254. .prcm_offs = OMAP3430_NEON_MOD,
  255. .pwrsts = PWRSTS_OFF_RET_ON,
  256. .pwrsts_logic_ret = PWRSTS_RET,
  257. .voltdm = { .name = "mpu_iva" },
  258. };
  259. static struct powerdomain neon_am35x_pwrdm = {
  260. .name = "neon_pwrdm",
  261. .prcm_offs = OMAP3430_NEON_MOD,
  262. .pwrsts = PWRSTS_ON,
  263. .pwrsts_logic_ret = PWRSTS_ON,
  264. .voltdm = { .name = "mpu_iva" },
  265. };
  266. static struct powerdomain usbhost_pwrdm = {
  267. .name = "usbhost_pwrdm",
  268. .prcm_offs = OMAP3430ES2_USBHOST_MOD,
  269. .pwrsts = PWRSTS_OFF_RET_ON,
  270. .pwrsts_logic_ret = PWRSTS_RET,
  271. /*
  272. * REVISIT: Enabling usb host save and restore mechanism seems to
  273. * leave the usb host domain permanently in ACTIVE mode after
  274. * changing the usb host power domain state from OFF to active once.
  275. * Disabling for now.
  276. */
  277. /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
  278. .banks = 1,
  279. .pwrsts_mem_ret = {
  280. [0] = PWRSTS_RET, /* MEMRETSTATE */
  281. },
  282. .pwrsts_mem_on = {
  283. [0] = PWRSTS_ON, /* MEMONSTATE */
  284. },
  285. .voltdm = { .name = "core" },
  286. };
  287. static struct powerdomain dpll1_pwrdm = {
  288. .name = "dpll1_pwrdm",
  289. .prcm_offs = MPU_MOD,
  290. .voltdm = { .name = "mpu_iva" },
  291. };
  292. static struct powerdomain dpll2_pwrdm = {
  293. .name = "dpll2_pwrdm",
  294. .prcm_offs = OMAP3430_IVA2_MOD,
  295. .voltdm = { .name = "mpu_iva" },
  296. };
  297. static struct powerdomain dpll3_pwrdm = {
  298. .name = "dpll3_pwrdm",
  299. .prcm_offs = PLL_MOD,
  300. .voltdm = { .name = "core" },
  301. };
  302. static struct powerdomain dpll4_pwrdm = {
  303. .name = "dpll4_pwrdm",
  304. .prcm_offs = PLL_MOD,
  305. .voltdm = { .name = "core" },
  306. };
  307. static struct powerdomain dpll5_pwrdm = {
  308. .name = "dpll5_pwrdm",
  309. .prcm_offs = PLL_MOD,
  310. .voltdm = { .name = "core" },
  311. };
  312. static struct powerdomain alwon_81xx_pwrdm = {
  313. .name = "alwon_pwrdm",
  314. .prcm_offs = TI81XX_PRM_ALWON_MOD,
  315. .pwrsts = PWRSTS_OFF_ON,
  316. .voltdm = { .name = "core" },
  317. };
  318. static struct powerdomain device_81xx_pwrdm = {
  319. .name = "device_pwrdm",
  320. .prcm_offs = TI81XX_PRM_DEVICE_MOD,
  321. .voltdm = { .name = "core" },
  322. };
  323. static struct powerdomain gem_814x_pwrdm = {
  324. .name = "gem_pwrdm",
  325. .prcm_offs = TI814X_PRM_DSP_MOD,
  326. .pwrsts = PWRSTS_OFF_ON,
  327. .voltdm = { .name = "dsp" },
  328. };
  329. static struct powerdomain ivahd_814x_pwrdm = {
  330. .name = "ivahd_pwrdm",
  331. .prcm_offs = TI814X_PRM_HDVICP_MOD,
  332. .pwrsts = PWRSTS_OFF_ON,
  333. .voltdm = { .name = "iva" },
  334. };
  335. static struct powerdomain hdvpss_814x_pwrdm = {
  336. .name = "hdvpss_pwrdm",
  337. .prcm_offs = TI814X_PRM_HDVPSS_MOD,
  338. .pwrsts = PWRSTS_OFF_ON,
  339. .voltdm = { .name = "dsp" },
  340. };
  341. static struct powerdomain sgx_814x_pwrdm = {
  342. .name = "sgx_pwrdm",
  343. .prcm_offs = TI814X_PRM_GFX_MOD,
  344. .pwrsts = PWRSTS_OFF_ON,
  345. .voltdm = { .name = "core" },
  346. };
  347. static struct powerdomain isp_814x_pwrdm = {
  348. .name = "isp_pwrdm",
  349. .prcm_offs = TI814X_PRM_ISP_MOD,
  350. .pwrsts = PWRSTS_OFF_ON,
  351. .voltdm = { .name = "core" },
  352. };
  353. static struct powerdomain active_81xx_pwrdm = {
  354. .name = "active_pwrdm",
  355. .prcm_offs = TI816X_PRM_ACTIVE_MOD,
  356. .pwrsts = PWRSTS_OFF_ON,
  357. .voltdm = { .name = "core" },
  358. };
  359. static struct powerdomain default_81xx_pwrdm = {
  360. .name = "default_pwrdm",
  361. .prcm_offs = TI81XX_PRM_DEFAULT_MOD,
  362. .pwrsts = PWRSTS_OFF_ON,
  363. .voltdm = { .name = "core" },
  364. };
  365. static struct powerdomain ivahd0_816x_pwrdm = {
  366. .name = "ivahd0_pwrdm",
  367. .prcm_offs = TI816X_PRM_IVAHD0_MOD,
  368. .pwrsts = PWRSTS_OFF_ON,
  369. .voltdm = { .name = "mpu_iva" },
  370. };
  371. static struct powerdomain ivahd1_816x_pwrdm = {
  372. .name = "ivahd1_pwrdm",
  373. .prcm_offs = TI816X_PRM_IVAHD1_MOD,
  374. .pwrsts = PWRSTS_OFF_ON,
  375. .voltdm = { .name = "mpu_iva" },
  376. };
  377. static struct powerdomain ivahd2_816x_pwrdm = {
  378. .name = "ivahd2_pwrdm",
  379. .prcm_offs = TI816X_PRM_IVAHD2_MOD,
  380. .pwrsts = PWRSTS_OFF_ON,
  381. .voltdm = { .name = "mpu_iva" },
  382. };
  383. static struct powerdomain sgx_816x_pwrdm = {
  384. .name = "sgx_pwrdm",
  385. .prcm_offs = TI816X_PRM_SGX_MOD,
  386. .pwrsts = PWRSTS_OFF_ON,
  387. .voltdm = { .name = "core" },
  388. };
  389. /* As powerdomains are added or removed above, this list must also be changed */
  390. static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
  391. &wkup_omap2_pwrdm,
  392. &iva2_pwrdm,
  393. &mpu_3xxx_pwrdm,
  394. &neon_pwrdm,
  395. &cam_pwrdm,
  396. &dss_pwrdm,
  397. &per_pwrdm,
  398. &emu_pwrdm,
  399. &dpll1_pwrdm,
  400. &dpll2_pwrdm,
  401. &dpll3_pwrdm,
  402. &dpll4_pwrdm,
  403. NULL
  404. };
  405. static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
  406. &gfx_omap2_pwrdm,
  407. &core_3xxx_pre_es3_1_pwrdm,
  408. NULL
  409. };
  410. /* also includes 3630ES1.0 */
  411. static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
  412. &core_3xxx_pre_es3_1_pwrdm,
  413. &sgx_pwrdm,
  414. &usbhost_pwrdm,
  415. &dpll5_pwrdm,
  416. NULL
  417. };
  418. /* also includes 3630ES1.1+ */
  419. static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
  420. &core_3xxx_es3_1_pwrdm,
  421. &sgx_pwrdm,
  422. &usbhost_pwrdm,
  423. &dpll5_pwrdm,
  424. NULL
  425. };
  426. static struct powerdomain *powerdomains_am35x[] __initdata = {
  427. &wkup_omap2_pwrdm,
  428. &mpu_am35x_pwrdm,
  429. &neon_am35x_pwrdm,
  430. &core_am35x_pwrdm,
  431. &sgx_am35x_pwrdm,
  432. &dss_am35x_pwrdm,
  433. &per_am35x_pwrdm,
  434. &emu_pwrdm,
  435. &dpll1_pwrdm,
  436. &dpll3_pwrdm,
  437. &dpll4_pwrdm,
  438. &dpll5_pwrdm,
  439. NULL
  440. };
  441. static struct powerdomain *powerdomains_ti814x[] __initdata = {
  442. &alwon_81xx_pwrdm,
  443. &device_81xx_pwrdm,
  444. &active_81xx_pwrdm,
  445. &default_81xx_pwrdm,
  446. &gem_814x_pwrdm,
  447. &ivahd_814x_pwrdm,
  448. &hdvpss_814x_pwrdm,
  449. &sgx_814x_pwrdm,
  450. &isp_814x_pwrdm,
  451. NULL
  452. };
  453. static struct powerdomain *powerdomains_ti816x[] __initdata = {
  454. &alwon_81xx_pwrdm,
  455. &device_81xx_pwrdm,
  456. &active_81xx_pwrdm,
  457. &default_81xx_pwrdm,
  458. &ivahd0_816x_pwrdm,
  459. &ivahd1_816x_pwrdm,
  460. &ivahd2_816x_pwrdm,
  461. &sgx_816x_pwrdm,
  462. NULL
  463. };
  464. /* TI81XX specific ops */
  465. #define TI81XX_PM_PWSTCTRL 0x0000
  466. #define TI81XX_RM_RSTCTRL 0x0010
  467. #define TI81XX_PM_PWSTST 0x0004
  468. static int ti81xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
  469. {
  470. omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
  471. (pwrst << OMAP_POWERSTATE_SHIFT),
  472. pwrdm->prcm_offs, TI81XX_PM_PWSTCTRL);
  473. return 0;
  474. }
  475. static int ti81xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
  476. {
  477. return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
  478. TI81XX_PM_PWSTCTRL,
  479. OMAP_POWERSTATE_MASK);
  480. }
  481. static int ti81xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
  482. {
  483. return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
  484. (pwrdm->prcm_offs == TI814X_PRM_GFX_MOD) ? TI81XX_RM_RSTCTRL :
  485. TI81XX_PM_PWSTST,
  486. OMAP_POWERSTATEST_MASK);
  487. }
  488. static int ti81xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
  489. {
  490. return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
  491. (pwrdm->prcm_offs == TI814X_PRM_GFX_MOD) ? TI81XX_RM_RSTCTRL :
  492. TI81XX_PM_PWSTST,
  493. OMAP3430_LOGICSTATEST_MASK);
  494. }
  495. static int ti81xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
  496. {
  497. u32 c = 0;
  498. while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs,
  499. (pwrdm->prcm_offs == TI814X_PRM_GFX_MOD) ? TI81XX_RM_RSTCTRL :
  500. TI81XX_PM_PWSTST) &
  501. OMAP_INTRANSITION_MASK) &&
  502. (c++ < PWRDM_TRANSITION_BAILOUT))
  503. udelay(1);
  504. if (c > PWRDM_TRANSITION_BAILOUT) {
  505. pr_err("powerdomain: %s timeout waiting for transition\n",
  506. pwrdm->name);
  507. return -EAGAIN;
  508. }
  509. pr_debug("powerdomain: completed transition in %d loops\n", c);
  510. return 0;
  511. }
  512. /* For dm814x we need to fix up fix GFX pwstst and rstctrl reg offsets */
  513. static struct pwrdm_ops ti81xx_pwrdm_operations = {
  514. .pwrdm_set_next_pwrst = ti81xx_pwrdm_set_next_pwrst,
  515. .pwrdm_read_next_pwrst = ti81xx_pwrdm_read_next_pwrst,
  516. .pwrdm_read_pwrst = ti81xx_pwrdm_read_pwrst,
  517. .pwrdm_read_logic_pwrst = ti81xx_pwrdm_read_logic_pwrst,
  518. .pwrdm_wait_transition = ti81xx_pwrdm_wait_transition,
  519. };
  520. void __init omap3xxx_powerdomains_init(void)
  521. {
  522. unsigned int rev;
  523. if (!cpu_is_omap34xx() && !cpu_is_ti81xx())
  524. return;
  525. /* Only 81xx needs custom pwrdm_operations */
  526. if (!cpu_is_ti81xx())
  527. pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
  528. rev = omap_rev();
  529. if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
  530. pwrdm_register_pwrdms(powerdomains_am35x);
  531. } else if (rev == TI8148_REV_ES1_0 || rev == TI8148_REV_ES2_0 ||
  532. rev == TI8148_REV_ES2_1) {
  533. pwrdm_register_platform_funcs(&ti81xx_pwrdm_operations);
  534. pwrdm_register_pwrdms(powerdomains_ti814x);
  535. } else if (rev == TI8168_REV_ES1_0 || rev == TI8168_REV_ES1_1
  536. || rev == TI8168_REV_ES2_0 || rev == TI8168_REV_ES2_1) {
  537. pwrdm_register_platform_funcs(&ti81xx_pwrdm_operations);
  538. pwrdm_register_pwrdms(powerdomains_ti816x);
  539. } else {
  540. pwrdm_register_pwrdms(powerdomains_omap3430_common);
  541. switch (rev) {
  542. case OMAP3430_REV_ES1_0:
  543. pwrdm_register_pwrdms(powerdomains_omap3430es1);
  544. break;
  545. case OMAP3430_REV_ES2_0:
  546. case OMAP3430_REV_ES2_1:
  547. case OMAP3430_REV_ES3_0:
  548. case OMAP3630_REV_ES1_0:
  549. pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
  550. break;
  551. case OMAP3430_REV_ES3_1:
  552. case OMAP3430_REV_ES3_1_2:
  553. case OMAP3630_REV_ES1_1:
  554. case OMAP3630_REV_ES1_2:
  555. pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
  556. break;
  557. default:
  558. WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
  559. }
  560. }
  561. pwrdm_complete_init();
  562. }