clockdomains3xxx_data.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /*
  2. * OMAP3xxx clockdomains
  3. *
  4. * Copyright (C) 2008-2011 Texas Instruments, Inc.
  5. * Copyright (C) 2008-2010 Nokia Corporation
  6. *
  7. * Paul Walmsley, Jouni Högander
  8. *
  9. * This file contains clockdomains and clockdomain wakeup/sleep
  10. * dependencies for the OMAP3xxx chips. Some notes:
  11. *
  12. * A useful validation rule for struct clockdomain: Any clockdomain
  13. * referenced by a wkdep_srcs or sleepdep_srcs array must have a
  14. * dep_bit assigned. So wkdep_srcs/sleepdep_srcs are really just
  15. * software-controllable dependencies. Non-software-controllable
  16. * dependencies do exist, but they are not encoded below (yet).
  17. *
  18. * The overly-specific dep_bit names are due to a bit name collision
  19. * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
  20. * value are the same for all powerdomains: 2
  21. *
  22. * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
  23. * sanity check?
  24. * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
  25. */
  26. /*
  27. * To-Do List
  28. * -> Port the Sleep/Wakeup dependencies for the domains
  29. * from the Power domain framework
  30. */
  31. #include <linux/kernel.h>
  32. #include <linux/io.h>
  33. #include "soc.h"
  34. #include "clockdomain.h"
  35. #include "prm2xxx_3xxx.h"
  36. #include "cm2xxx_3xxx.h"
  37. #include "cm-regbits-34xx.h"
  38. #include "prm-regbits-34xx.h"
  39. /*
  40. * Clockdomain dependencies for wkdeps/sleepdeps
  41. *
  42. * XXX Hardware dependencies (e.g., dependencies that cannot be
  43. * changed in software) are not included here yet, but should be.
  44. */
  45. /* OMAP3-specific possible dependencies */
  46. /*
  47. * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
  48. * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
  49. */
  50. static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = {
  51. { .clkdm_name = "iva2_clkdm" },
  52. { .clkdm_name = "mpu_clkdm" },
  53. { .clkdm_name = "wkup_clkdm" },
  54. { NULL },
  55. };
  56. static struct clkdm_dep gfx_sgx_am35x_wkdeps[] = {
  57. { .clkdm_name = "mpu_clkdm" },
  58. { .clkdm_name = "wkup_clkdm" },
  59. { NULL },
  60. };
  61. /* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
  62. static struct clkdm_dep per_wkdeps[] = {
  63. { .clkdm_name = "core_l3_clkdm" },
  64. { .clkdm_name = "core_l4_clkdm" },
  65. { .clkdm_name = "iva2_clkdm" },
  66. { .clkdm_name = "mpu_clkdm" },
  67. { .clkdm_name = "wkup_clkdm" },
  68. { NULL },
  69. };
  70. static struct clkdm_dep per_am35x_wkdeps[] = {
  71. { .clkdm_name = "core_l3_clkdm" },
  72. { .clkdm_name = "core_l4_clkdm" },
  73. { .clkdm_name = "mpu_clkdm" },
  74. { .clkdm_name = "wkup_clkdm" },
  75. { NULL },
  76. };
  77. /* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
  78. static struct clkdm_dep usbhost_wkdeps[] = {
  79. { .clkdm_name = "core_l3_clkdm" },
  80. { .clkdm_name = "core_l4_clkdm" },
  81. { .clkdm_name = "iva2_clkdm" },
  82. { .clkdm_name = "mpu_clkdm" },
  83. { .clkdm_name = "wkup_clkdm" },
  84. { NULL },
  85. };
  86. static struct clkdm_dep usbhost_am35x_wkdeps[] = {
  87. { .clkdm_name = "core_l3_clkdm" },
  88. { .clkdm_name = "core_l4_clkdm" },
  89. { .clkdm_name = "mpu_clkdm" },
  90. { .clkdm_name = "wkup_clkdm" },
  91. { NULL },
  92. };
  93. /* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */
  94. static struct clkdm_dep mpu_3xxx_wkdeps[] = {
  95. { .clkdm_name = "core_l3_clkdm" },
  96. { .clkdm_name = "core_l4_clkdm" },
  97. { .clkdm_name = "iva2_clkdm" },
  98. { .clkdm_name = "dss_clkdm" },
  99. { .clkdm_name = "per_clkdm" },
  100. { NULL },
  101. };
  102. static struct clkdm_dep mpu_am35x_wkdeps[] = {
  103. { .clkdm_name = "core_l3_clkdm" },
  104. { .clkdm_name = "core_l4_clkdm" },
  105. { .clkdm_name = "dss_clkdm" },
  106. { .clkdm_name = "per_clkdm" },
  107. { NULL },
  108. };
  109. /* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
  110. static struct clkdm_dep iva2_wkdeps[] = {
  111. { .clkdm_name = "core_l3_clkdm" },
  112. { .clkdm_name = "core_l4_clkdm" },
  113. { .clkdm_name = "mpu_clkdm" },
  114. { .clkdm_name = "wkup_clkdm" },
  115. { .clkdm_name = "dss_clkdm" },
  116. { .clkdm_name = "per_clkdm" },
  117. { NULL },
  118. };
  119. /* 3430 PM_WKDEP_CAM: IVA2, MPU, WKUP */
  120. static struct clkdm_dep cam_wkdeps[] = {
  121. { .clkdm_name = "iva2_clkdm" },
  122. { .clkdm_name = "mpu_clkdm" },
  123. { .clkdm_name = "wkup_clkdm" },
  124. { NULL },
  125. };
  126. /* 3430 PM_WKDEP_DSS: IVA2, MPU, WKUP */
  127. static struct clkdm_dep dss_wkdeps[] = {
  128. { .clkdm_name = "iva2_clkdm" },
  129. { .clkdm_name = "mpu_clkdm" },
  130. { .clkdm_name = "wkup_clkdm" },
  131. { NULL },
  132. };
  133. static struct clkdm_dep dss_am35x_wkdeps[] = {
  134. { .clkdm_name = "mpu_clkdm" },
  135. { .clkdm_name = "wkup_clkdm" },
  136. { NULL },
  137. };
  138. /* 3430: PM_WKDEP_NEON: MPU */
  139. static struct clkdm_dep neon_wkdeps[] = {
  140. { .clkdm_name = "mpu_clkdm" },
  141. { NULL },
  142. };
  143. /* Sleep dependency source arrays for OMAP3-specific clkdms */
  144. /* 3430: CM_SLEEPDEP_DSS: MPU, IVA */
  145. static struct clkdm_dep dss_sleepdeps[] = {
  146. { .clkdm_name = "mpu_clkdm" },
  147. { .clkdm_name = "iva2_clkdm" },
  148. { NULL },
  149. };
  150. static struct clkdm_dep dss_am35x_sleepdeps[] = {
  151. { .clkdm_name = "mpu_clkdm" },
  152. { NULL },
  153. };
  154. /* 3430: CM_SLEEPDEP_PER: MPU, IVA */
  155. static struct clkdm_dep per_sleepdeps[] = {
  156. { .clkdm_name = "mpu_clkdm" },
  157. { .clkdm_name = "iva2_clkdm" },
  158. { NULL },
  159. };
  160. static struct clkdm_dep per_am35x_sleepdeps[] = {
  161. { .clkdm_name = "mpu_clkdm" },
  162. { NULL },
  163. };
  164. /* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
  165. static struct clkdm_dep usbhost_sleepdeps[] = {
  166. { .clkdm_name = "mpu_clkdm" },
  167. { .clkdm_name = "iva2_clkdm" },
  168. { NULL },
  169. };
  170. static struct clkdm_dep usbhost_am35x_sleepdeps[] = {
  171. { .clkdm_name = "mpu_clkdm" },
  172. { NULL },
  173. };
  174. /* 3430: CM_SLEEPDEP_CAM: MPU */
  175. static struct clkdm_dep cam_sleepdeps[] = {
  176. { .clkdm_name = "mpu_clkdm" },
  177. { NULL },
  178. };
  179. /*
  180. * 3430ES1: CM_SLEEPDEP_GFX: MPU
  181. * 3430ES2: CM_SLEEPDEP_SGX: MPU
  182. * These can share data since they will never be present simultaneously
  183. * on the same device.
  184. */
  185. static struct clkdm_dep gfx_sgx_sleepdeps[] = {
  186. { .clkdm_name = "mpu_clkdm" },
  187. { NULL },
  188. };
  189. /*
  190. * OMAP3 clockdomains
  191. */
  192. static struct clockdomain mpu_3xxx_clkdm = {
  193. .name = "mpu_clkdm",
  194. .pwrdm = { .name = "mpu_pwrdm" },
  195. .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
  196. .dep_bit = OMAP3430_EN_MPU_SHIFT,
  197. .wkdep_srcs = mpu_3xxx_wkdeps,
  198. .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
  199. };
  200. static struct clockdomain mpu_am35x_clkdm = {
  201. .name = "mpu_clkdm",
  202. .pwrdm = { .name = "mpu_pwrdm" },
  203. .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
  204. .dep_bit = OMAP3430_EN_MPU_SHIFT,
  205. .wkdep_srcs = mpu_am35x_wkdeps,
  206. .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
  207. };
  208. static struct clockdomain neon_clkdm = {
  209. .name = "neon_clkdm",
  210. .pwrdm = { .name = "neon_pwrdm" },
  211. .flags = CLKDM_CAN_HWSUP_SWSUP,
  212. .wkdep_srcs = neon_wkdeps,
  213. .clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
  214. };
  215. static struct clockdomain iva2_clkdm = {
  216. .name = "iva2_clkdm",
  217. .pwrdm = { .name = "iva2_pwrdm" },
  218. .flags = CLKDM_CAN_SWSUP,
  219. .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
  220. .wkdep_srcs = iva2_wkdeps,
  221. .clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
  222. };
  223. static struct clockdomain gfx_3430es1_clkdm = {
  224. .name = "gfx_clkdm",
  225. .pwrdm = { .name = "gfx_pwrdm" },
  226. .flags = CLKDM_CAN_HWSUP_SWSUP,
  227. .wkdep_srcs = gfx_sgx_3xxx_wkdeps,
  228. .sleepdep_srcs = gfx_sgx_sleepdeps,
  229. .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
  230. };
  231. static struct clockdomain sgx_clkdm = {
  232. .name = "sgx_clkdm",
  233. .pwrdm = { .name = "sgx_pwrdm" },
  234. .flags = CLKDM_CAN_HWSUP_SWSUP,
  235. .wkdep_srcs = gfx_sgx_3xxx_wkdeps,
  236. .sleepdep_srcs = gfx_sgx_sleepdeps,
  237. .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
  238. };
  239. static struct clockdomain sgx_am35x_clkdm = {
  240. .name = "sgx_clkdm",
  241. .pwrdm = { .name = "sgx_pwrdm" },
  242. .flags = CLKDM_CAN_HWSUP_SWSUP,
  243. .wkdep_srcs = gfx_sgx_am35x_wkdeps,
  244. .sleepdep_srcs = gfx_sgx_sleepdeps,
  245. .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
  246. };
  247. /*
  248. * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
  249. * then that information was removed from the 34xx ES2+ TRM. It is
  250. * unclear whether the core is still there, but the clockdomain logic
  251. * is there, and must be programmed to an appropriate state if the
  252. * CORE clockdomain is to become inactive.
  253. */
  254. static struct clockdomain d2d_clkdm = {
  255. .name = "d2d_clkdm",
  256. .pwrdm = { .name = "core_pwrdm" },
  257. .flags = CLKDM_CAN_HWSUP_SWSUP,
  258. .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
  259. };
  260. /*
  261. * XXX add usecounting for clkdm dependencies, otherwise the presence
  262. * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
  263. * could cause trouble
  264. */
  265. static struct clockdomain core_l3_3xxx_clkdm = {
  266. .name = "core_l3_clkdm",
  267. .pwrdm = { .name = "core_pwrdm" },
  268. .flags = CLKDM_CAN_HWSUP,
  269. .dep_bit = OMAP3430_EN_CORE_SHIFT,
  270. .clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
  271. };
  272. /*
  273. * XXX add usecounting for clkdm dependencies, otherwise the presence
  274. * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
  275. * could cause trouble
  276. */
  277. static struct clockdomain core_l4_3xxx_clkdm = {
  278. .name = "core_l4_clkdm",
  279. .pwrdm = { .name = "core_pwrdm" },
  280. .flags = CLKDM_CAN_HWSUP,
  281. .dep_bit = OMAP3430_EN_CORE_SHIFT,
  282. .clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
  283. };
  284. /* Another case of bit name collisions between several registers: EN_DSS */
  285. static struct clockdomain dss_3xxx_clkdm = {
  286. .name = "dss_clkdm",
  287. .pwrdm = { .name = "dss_pwrdm" },
  288. .flags = CLKDM_CAN_HWSUP_SWSUP,
  289. .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
  290. .wkdep_srcs = dss_wkdeps,
  291. .sleepdep_srcs = dss_sleepdeps,
  292. .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
  293. };
  294. static struct clockdomain dss_am35x_clkdm = {
  295. .name = "dss_clkdm",
  296. .pwrdm = { .name = "dss_pwrdm" },
  297. .flags = CLKDM_CAN_HWSUP_SWSUP,
  298. .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
  299. .wkdep_srcs = dss_am35x_wkdeps,
  300. .sleepdep_srcs = dss_am35x_sleepdeps,
  301. .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
  302. };
  303. static struct clockdomain cam_clkdm = {
  304. .name = "cam_clkdm",
  305. .pwrdm = { .name = "cam_pwrdm" },
  306. .flags = CLKDM_CAN_HWSUP_SWSUP,
  307. .wkdep_srcs = cam_wkdeps,
  308. .sleepdep_srcs = cam_sleepdeps,
  309. .clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
  310. };
  311. static struct clockdomain usbhost_clkdm = {
  312. .name = "usbhost_clkdm",
  313. .pwrdm = { .name = "usbhost_pwrdm" },
  314. .flags = CLKDM_CAN_HWSUP_SWSUP,
  315. .wkdep_srcs = usbhost_wkdeps,
  316. .sleepdep_srcs = usbhost_sleepdeps,
  317. .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
  318. };
  319. static struct clockdomain usbhost_am35x_clkdm = {
  320. .name = "usbhost_clkdm",
  321. .pwrdm = { .name = "core_pwrdm" },
  322. .flags = CLKDM_CAN_HWSUP_SWSUP,
  323. .wkdep_srcs = usbhost_am35x_wkdeps,
  324. .sleepdep_srcs = usbhost_am35x_sleepdeps,
  325. .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
  326. };
  327. static struct clockdomain per_clkdm = {
  328. .name = "per_clkdm",
  329. .pwrdm = { .name = "per_pwrdm" },
  330. .flags = CLKDM_CAN_HWSUP_SWSUP,
  331. .dep_bit = OMAP3430_EN_PER_SHIFT,
  332. .wkdep_srcs = per_wkdeps,
  333. .sleepdep_srcs = per_sleepdeps,
  334. .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
  335. };
  336. static struct clockdomain per_am35x_clkdm = {
  337. .name = "per_clkdm",
  338. .pwrdm = { .name = "per_pwrdm" },
  339. .flags = CLKDM_CAN_HWSUP_SWSUP,
  340. .dep_bit = OMAP3430_EN_PER_SHIFT,
  341. .wkdep_srcs = per_am35x_wkdeps,
  342. .sleepdep_srcs = per_am35x_sleepdeps,
  343. .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
  344. };
  345. static struct clockdomain emu_clkdm = {
  346. .name = "emu_clkdm",
  347. .pwrdm = { .name = "emu_pwrdm" },
  348. .flags = (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_SWSUP |
  349. CLKDM_MISSING_IDLE_REPORTING),
  350. .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
  351. };
  352. static struct clockdomain dpll1_clkdm = {
  353. .name = "dpll1_clkdm",
  354. .pwrdm = { .name = "dpll1_pwrdm" },
  355. };
  356. static struct clockdomain dpll2_clkdm = {
  357. .name = "dpll2_clkdm",
  358. .pwrdm = { .name = "dpll2_pwrdm" },
  359. };
  360. static struct clockdomain dpll3_clkdm = {
  361. .name = "dpll3_clkdm",
  362. .pwrdm = { .name = "dpll3_pwrdm" },
  363. };
  364. static struct clockdomain dpll4_clkdm = {
  365. .name = "dpll4_clkdm",
  366. .pwrdm = { .name = "dpll4_pwrdm" },
  367. };
  368. static struct clockdomain dpll5_clkdm = {
  369. .name = "dpll5_clkdm",
  370. .pwrdm = { .name = "dpll5_pwrdm" },
  371. };
  372. /*
  373. * Clockdomain hwsup dependencies
  374. */
  375. static struct clkdm_autodep clkdm_autodeps[] = {
  376. {
  377. .clkdm = { .name = "mpu_clkdm" },
  378. },
  379. {
  380. .clkdm = { .name = "iva2_clkdm" },
  381. },
  382. {
  383. .clkdm = { .name = NULL },
  384. }
  385. };
  386. static struct clkdm_autodep clkdm_am35x_autodeps[] = {
  387. {
  388. .clkdm = { .name = "mpu_clkdm" },
  389. },
  390. {
  391. .clkdm = { .name = NULL },
  392. }
  393. };
  394. /*
  395. *
  396. */
  397. static struct clockdomain *clockdomains_common[] __initdata = {
  398. &wkup_common_clkdm,
  399. &neon_clkdm,
  400. &core_l3_3xxx_clkdm,
  401. &core_l4_3xxx_clkdm,
  402. &emu_clkdm,
  403. &dpll1_clkdm,
  404. &dpll3_clkdm,
  405. &dpll4_clkdm,
  406. NULL
  407. };
  408. static struct clockdomain *clockdomains_omap3430[] __initdata = {
  409. &mpu_3xxx_clkdm,
  410. &iva2_clkdm,
  411. &d2d_clkdm,
  412. &dss_3xxx_clkdm,
  413. &cam_clkdm,
  414. &per_clkdm,
  415. &dpll2_clkdm,
  416. NULL
  417. };
  418. static struct clockdomain *clockdomains_omap3430es1[] __initdata = {
  419. &gfx_3430es1_clkdm,
  420. NULL,
  421. };
  422. static struct clockdomain *clockdomains_omap3430es2plus[] __initdata = {
  423. &sgx_clkdm,
  424. &dpll5_clkdm,
  425. &usbhost_clkdm,
  426. NULL,
  427. };
  428. static struct clockdomain *clockdomains_am35x[] __initdata = {
  429. &mpu_am35x_clkdm,
  430. &sgx_am35x_clkdm,
  431. &dss_am35x_clkdm,
  432. &per_am35x_clkdm,
  433. &usbhost_am35x_clkdm,
  434. &dpll5_clkdm,
  435. NULL
  436. };
  437. void __init omap3xxx_clockdomains_init(void)
  438. {
  439. struct clockdomain **sc;
  440. unsigned int rev;
  441. if (!cpu_is_omap34xx())
  442. return;
  443. clkdm_register_platform_funcs(&omap3_clkdm_operations);
  444. clkdm_register_clkdms(clockdomains_common);
  445. rev = omap_rev();
  446. if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
  447. clkdm_register_clkdms(clockdomains_am35x);
  448. clkdm_register_autodeps(clkdm_am35x_autodeps);
  449. } else {
  450. clkdm_register_clkdms(clockdomains_omap3430);
  451. sc = (rev == OMAP3430_REV_ES1_0) ?
  452. clockdomains_omap3430es1 : clockdomains_omap3430es2plus;
  453. clkdm_register_clkdms(sc);
  454. clkdm_register_autodeps(clkdm_autodeps);
  455. }
  456. clkdm_complete_init();
  457. }