cminst44xx.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * OMAP4 CM instance functions
  4. *
  5. * Copyright (C) 2009 Nokia Corporation
  6. * Copyright (C) 2008-2011 Texas Instruments, Inc.
  7. * Paul Walmsley
  8. * Rajendra Nayak <[email protected]>
  9. *
  10. * This is needed since CM instances can be in the PRM, PRCM_MPU, CM1,
  11. * or CM2 hardware modules. For example, the EMU_CM CM instance is in
  12. * the PRM hardware module. What a mess...
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/errno.h>
  17. #include <linux/err.h>
  18. #include <linux/io.h>
  19. #include "clockdomain.h"
  20. #include "cm.h"
  21. #include "cm1_44xx.h"
  22. #include "cm2_44xx.h"
  23. #include "cm44xx.h"
  24. #include "cm-regbits-34xx.h"
  25. #include "prcm44xx.h"
  26. #include "prm44xx.h"
  27. #include "prcm_mpu44xx.h"
  28. #include "prcm-common.h"
  29. #define OMAP4430_IDLEST_SHIFT 16
  30. #define OMAP4430_IDLEST_MASK (0x3 << 16)
  31. #define OMAP4430_CLKTRCTRL_SHIFT 0
  32. #define OMAP4430_CLKTRCTRL_MASK (0x3 << 0)
  33. #define OMAP4430_MODULEMODE_SHIFT 0
  34. #define OMAP4430_MODULEMODE_MASK (0x3 << 0)
  35. /*
  36. * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
  37. *
  38. * 0x0 func: Module is fully functional, including OCP
  39. * 0x1 trans: Module is performing transition: wakeup, or sleep, or sleep
  40. * abortion
  41. * 0x2 idle: Module is in Idle mode (only OCP part). It is functional if
  42. * using separate functional clock
  43. * 0x3 disabled: Module is disabled and cannot be accessed
  44. *
  45. */
  46. #define CLKCTRL_IDLEST_FUNCTIONAL 0x0
  47. #define CLKCTRL_IDLEST_INTRANSITION 0x1
  48. #define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2
  49. #define CLKCTRL_IDLEST_DISABLED 0x3
  50. static struct omap_domain_base _cm_bases[OMAP4_MAX_PRCM_PARTITIONS];
  51. /**
  52. * omap_cm_base_init - Populates the cm partitions
  53. *
  54. * Populates the base addresses of the _cm_bases
  55. * array used for read/write of cm module registers.
  56. */
  57. static void omap_cm_base_init(void)
  58. {
  59. memcpy(&_cm_bases[OMAP4430_PRM_PARTITION], &prm_base, sizeof(prm_base));
  60. memcpy(&_cm_bases[OMAP4430_CM1_PARTITION], &cm_base, sizeof(cm_base));
  61. memcpy(&_cm_bases[OMAP4430_CM2_PARTITION], &cm2_base, sizeof(cm2_base));
  62. memcpy(&_cm_bases[OMAP4430_PRCM_MPU_PARTITION], &prcm_mpu_base,
  63. sizeof(prcm_mpu_base));
  64. }
  65. /* Private functions */
  66. static u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx);
  67. /**
  68. * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
  69. * @part: PRCM partition ID that the CM_CLKCTRL register exists in
  70. * @inst: CM instance register offset (*_INST macro)
  71. * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
  72. *
  73. * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
  74. * bit 0.
  75. */
  76. static u32 _clkctrl_idlest(u8 part, u16 inst, u16 clkctrl_offs)
  77. {
  78. u32 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
  79. v &= OMAP4430_IDLEST_MASK;
  80. v >>= OMAP4430_IDLEST_SHIFT;
  81. return v;
  82. }
  83. /**
  84. * _is_module_ready - can module registers be accessed without causing an abort?
  85. * @part: PRCM partition ID that the CM_CLKCTRL register exists in
  86. * @inst: CM instance register offset (*_INST macro)
  87. * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
  88. *
  89. * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
  90. * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
  91. */
  92. static bool _is_module_ready(u8 part, u16 inst, u16 clkctrl_offs)
  93. {
  94. u32 v;
  95. v = _clkctrl_idlest(part, inst, clkctrl_offs);
  96. return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
  97. v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
  98. }
  99. /* Read a register in a CM instance */
  100. static u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
  101. {
  102. BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
  103. part == OMAP4430_INVALID_PRCM_PARTITION ||
  104. !_cm_bases[part].va);
  105. return readl_relaxed(_cm_bases[part].va + inst + idx);
  106. }
  107. /* Write into a register in a CM instance */
  108. static void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
  109. {
  110. BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
  111. part == OMAP4430_INVALID_PRCM_PARTITION ||
  112. !_cm_bases[part].va);
  113. writel_relaxed(val, _cm_bases[part].va + inst + idx);
  114. }
  115. /* Read-modify-write a register in CM1. Caller must lock */
  116. static u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, u16 inst,
  117. s16 idx)
  118. {
  119. u32 v;
  120. v = omap4_cminst_read_inst_reg(part, inst, idx);
  121. v &= ~mask;
  122. v |= bits;
  123. omap4_cminst_write_inst_reg(v, part, inst, idx);
  124. return v;
  125. }
  126. static u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, u16 inst, s16 idx)
  127. {
  128. return omap4_cminst_rmw_inst_reg_bits(bits, bits, part, inst, idx);
  129. }
  130. static u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, u16 inst,
  131. s16 idx)
  132. {
  133. return omap4_cminst_rmw_inst_reg_bits(bits, 0x0, part, inst, idx);
  134. }
  135. static u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, u32 mask)
  136. {
  137. u32 v;
  138. v = omap4_cminst_read_inst_reg(part, inst, idx);
  139. v &= mask;
  140. v >>= __ffs(mask);
  141. return v;
  142. }
  143. /*
  144. *
  145. */
  146. /**
  147. * _clktrctrl_write - write @c to a CM_CLKSTCTRL.CLKTRCTRL register bitfield
  148. * @c: CLKTRCTRL register bitfield (LSB = bit 0, i.e., unshifted)
  149. * @part: PRCM partition ID that the CM_CLKSTCTRL register exists in
  150. * @inst: CM instance register offset (*_INST macro)
  151. * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
  152. *
  153. * @c must be the unshifted value for CLKTRCTRL - i.e., this function
  154. * will handle the shift itself.
  155. */
  156. static void _clktrctrl_write(u8 c, u8 part, u16 inst, u16 cdoffs)
  157. {
  158. u32 v;
  159. v = omap4_cminst_read_inst_reg(part, inst, cdoffs + OMAP4_CM_CLKSTCTRL);
  160. v &= ~OMAP4430_CLKTRCTRL_MASK;
  161. v |= c << OMAP4430_CLKTRCTRL_SHIFT;
  162. omap4_cminst_write_inst_reg(v, part, inst, cdoffs + OMAP4_CM_CLKSTCTRL);
  163. }
  164. /**
  165. * omap4_cminst_is_clkdm_in_hwsup - is a clockdomain in hwsup idle mode?
  166. * @part: PRCM partition ID that the CM_CLKSTCTRL register exists in
  167. * @inst: CM instance register offset (*_INST macro)
  168. * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
  169. *
  170. * Returns true if the clockdomain referred to by (@part, @inst, @cdoffs)
  171. * is in hardware-supervised idle mode, or 0 otherwise.
  172. */
  173. static bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs)
  174. {
  175. u32 v;
  176. v = omap4_cminst_read_inst_reg(part, inst, cdoffs + OMAP4_CM_CLKSTCTRL);
  177. v &= OMAP4430_CLKTRCTRL_MASK;
  178. v >>= OMAP4430_CLKTRCTRL_SHIFT;
  179. return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? true : false;
  180. }
  181. /**
  182. * omap4_cminst_clkdm_enable_hwsup - put a clockdomain in hwsup-idle mode
  183. * @part: PRCM partition ID that the clockdomain registers exist in
  184. * @inst: CM instance register offset (*_INST macro)
  185. * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
  186. *
  187. * Put a clockdomain referred to by (@part, @inst, @cdoffs) into
  188. * hardware-supervised idle mode. No return value.
  189. */
  190. static void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs)
  191. {
  192. _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, part, inst, cdoffs);
  193. }
  194. /**
  195. * omap4_cminst_clkdm_disable_hwsup - put a clockdomain in swsup-idle mode
  196. * @part: PRCM partition ID that the clockdomain registers exist in
  197. * @inst: CM instance register offset (*_INST macro)
  198. * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
  199. *
  200. * Put a clockdomain referred to by (@part, @inst, @cdoffs) into
  201. * software-supervised idle mode, i.e., controlled manually by the
  202. * Linux OMAP clockdomain code. No return value.
  203. */
  204. static void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs)
  205. {
  206. _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs);
  207. }
  208. /**
  209. * omap4_cminst_clkdm_force_sleep - try to take a clockdomain out of idle
  210. * @part: PRCM partition ID that the clockdomain registers exist in
  211. * @inst: CM instance register offset (*_INST macro)
  212. * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
  213. *
  214. * Take a clockdomain referred to by (@part, @inst, @cdoffs) out of idle,
  215. * waking it up. No return value.
  216. */
  217. static void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs)
  218. {
  219. _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs);
  220. }
  221. /*
  222. *
  223. */
  224. static void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs)
  225. {
  226. _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
  227. }
  228. /**
  229. * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state
  230. * @part: PRCM partition ID that the CM_CLKCTRL register exists in
  231. * @inst: CM instance register offset (*_INST macro)
  232. * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
  233. * @bit_shift: bit shift for the register, ignored for OMAP4+
  234. *
  235. * Wait for the module IDLEST to be functional. If the idle state is in any
  236. * the non functional state (trans, idle or disabled), module and thus the
  237. * sysconfig cannot be accessed and will probably lead to an "imprecise
  238. * external abort"
  239. */
  240. static int omap4_cminst_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs,
  241. u8 bit_shift)
  242. {
  243. int i = 0;
  244. omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs),
  245. MAX_MODULE_READY_TIME, i);
  246. return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
  247. }
  248. /**
  249. * omap4_cminst_wait_module_idle - wait for a module to be in 'disabled'
  250. * state
  251. * @part: PRCM partition ID that the CM_CLKCTRL register exists in
  252. * @inst: CM instance register offset (*_INST macro)
  253. * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
  254. * @bit_shift: Bit shift for the register, ignored for OMAP4+
  255. *
  256. * Wait for the module IDLEST to be disabled. Some PRCM transition,
  257. * like reset assertion or parent clock de-activation must wait the
  258. * module to be fully disabled.
  259. */
  260. static int omap4_cminst_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs,
  261. u8 bit_shift)
  262. {
  263. int i = 0;
  264. omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) ==
  265. CLKCTRL_IDLEST_DISABLED),
  266. MAX_MODULE_DISABLE_TIME, i);
  267. return (i < MAX_MODULE_DISABLE_TIME) ? 0 : -EBUSY;
  268. }
  269. /**
  270. * omap4_cminst_module_enable - Enable the modulemode inside CLKCTRL
  271. * @mode: Module mode (SW or HW)
  272. * @part: PRCM partition ID that the CM_CLKCTRL register exists in
  273. * @inst: CM instance register offset (*_INST macro)
  274. * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
  275. *
  276. * No return value.
  277. */
  278. static void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
  279. u16 clkctrl_offs)
  280. {
  281. u32 v;
  282. v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
  283. v &= ~OMAP4430_MODULEMODE_MASK;
  284. v |= mode << OMAP4430_MODULEMODE_SHIFT;
  285. omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
  286. }
  287. /**
  288. * omap4_cminst_module_disable - Disable the module inside CLKCTRL
  289. * @part: PRCM partition ID that the CM_CLKCTRL register exists in
  290. * @inst: CM instance register offset (*_INST macro)
  291. * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
  292. *
  293. * No return value.
  294. */
  295. static void omap4_cminst_module_disable(u8 part, u16 inst, u16 clkctrl_offs)
  296. {
  297. u32 v;
  298. v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
  299. v &= ~OMAP4430_MODULEMODE_MASK;
  300. omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
  301. }
  302. /*
  303. * Clockdomain low-level functions
  304. */
  305. static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
  306. struct clockdomain *clkdm2)
  307. {
  308. omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
  309. clkdm1->prcm_partition,
  310. clkdm1->cm_inst, clkdm1->clkdm_offs +
  311. OMAP4_CM_STATICDEP);
  312. return 0;
  313. }
  314. static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
  315. struct clockdomain *clkdm2)
  316. {
  317. omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
  318. clkdm1->prcm_partition,
  319. clkdm1->cm_inst, clkdm1->clkdm_offs +
  320. OMAP4_CM_STATICDEP);
  321. return 0;
  322. }
  323. static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
  324. struct clockdomain *clkdm2)
  325. {
  326. return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
  327. clkdm1->cm_inst,
  328. clkdm1->clkdm_offs +
  329. OMAP4_CM_STATICDEP,
  330. (1 << clkdm2->dep_bit));
  331. }
  332. static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
  333. {
  334. struct clkdm_dep *cd;
  335. u32 mask = 0;
  336. if (!clkdm->prcm_partition)
  337. return 0;
  338. for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
  339. if (!cd->clkdm)
  340. continue; /* only happens if data is erroneous */
  341. mask |= 1 << cd->clkdm->dep_bit;
  342. cd->wkdep_usecount = 0;
  343. }
  344. omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
  345. clkdm->cm_inst, clkdm->clkdm_offs +
  346. OMAP4_CM_STATICDEP);
  347. return 0;
  348. }
  349. static int omap4_clkdm_sleep(struct clockdomain *clkdm)
  350. {
  351. if (clkdm->flags & CLKDM_CAN_HWSUP)
  352. omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
  353. clkdm->cm_inst,
  354. clkdm->clkdm_offs);
  355. else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
  356. omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
  357. clkdm->cm_inst,
  358. clkdm->clkdm_offs);
  359. else
  360. return -EINVAL;
  361. return 0;
  362. }
  363. static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
  364. {
  365. omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
  366. clkdm->cm_inst, clkdm->clkdm_offs);
  367. return 0;
  368. }
  369. static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
  370. {
  371. omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
  372. clkdm->cm_inst, clkdm->clkdm_offs);
  373. }
  374. static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
  375. {
  376. if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
  377. omap4_clkdm_wakeup(clkdm);
  378. else
  379. omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
  380. clkdm->cm_inst,
  381. clkdm->clkdm_offs);
  382. }
  383. static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
  384. {
  385. if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
  386. return omap4_clkdm_wakeup(clkdm);
  387. return 0;
  388. }
  389. static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
  390. {
  391. bool hwsup = false;
  392. if (!clkdm->prcm_partition)
  393. return 0;
  394. /*
  395. * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
  396. * more details on the unpleasant problem this is working
  397. * around
  398. */
  399. if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
  400. !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
  401. omap4_clkdm_allow_idle(clkdm);
  402. return 0;
  403. }
  404. hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
  405. clkdm->cm_inst, clkdm->clkdm_offs);
  406. if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
  407. omap4_clkdm_sleep(clkdm);
  408. return 0;
  409. }
  410. static u32 omap4_cminst_xlate_clkctrl(u8 part, u16 inst, u16 offset)
  411. {
  412. return _cm_bases[part].pa + inst + offset;
  413. }
  414. /**
  415. * omap4_clkdm_save_context - Save the clockdomain modulemode context
  416. * @clkdm: The clockdomain pointer whose context needs to be saved
  417. *
  418. * Save the clockdomain modulemode context.
  419. */
  420. static int omap4_clkdm_save_context(struct clockdomain *clkdm)
  421. {
  422. clkdm->context = omap4_cminst_read_inst_reg(clkdm->prcm_partition,
  423. clkdm->cm_inst,
  424. clkdm->clkdm_offs +
  425. OMAP4_CM_CLKSTCTRL);
  426. clkdm->context &= OMAP4430_MODULEMODE_MASK;
  427. return 0;
  428. }
  429. /**
  430. * omap4_clkdm_restore_context - Restore the clockdomain modulemode context
  431. * @clkdm: The clockdomain pointer whose context needs to be restored
  432. *
  433. * Restore the clockdomain modulemode context.
  434. */
  435. static int omap4_clkdm_restore_context(struct clockdomain *clkdm)
  436. {
  437. switch (clkdm->context) {
  438. case OMAP34XX_CLKSTCTRL_DISABLE_AUTO:
  439. omap4_clkdm_deny_idle(clkdm);
  440. break;
  441. case OMAP34XX_CLKSTCTRL_FORCE_SLEEP:
  442. omap4_clkdm_sleep(clkdm);
  443. break;
  444. case OMAP34XX_CLKSTCTRL_FORCE_WAKEUP:
  445. omap4_clkdm_wakeup(clkdm);
  446. break;
  447. case OMAP34XX_CLKSTCTRL_ENABLE_AUTO:
  448. omap4_clkdm_allow_idle(clkdm);
  449. break;
  450. }
  451. return 0;
  452. }
  453. struct clkdm_ops omap4_clkdm_operations = {
  454. .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
  455. .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
  456. .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
  457. .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
  458. .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
  459. .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
  460. .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
  461. .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
  462. .clkdm_sleep = omap4_clkdm_sleep,
  463. .clkdm_wakeup = omap4_clkdm_wakeup,
  464. .clkdm_allow_idle = omap4_clkdm_allow_idle,
  465. .clkdm_deny_idle = omap4_clkdm_deny_idle,
  466. .clkdm_clk_enable = omap4_clkdm_clk_enable,
  467. .clkdm_clk_disable = omap4_clkdm_clk_disable,
  468. .clkdm_save_context = omap4_clkdm_save_context,
  469. .clkdm_restore_context = omap4_clkdm_restore_context,
  470. };
  471. struct clkdm_ops am43xx_clkdm_operations = {
  472. .clkdm_sleep = omap4_clkdm_sleep,
  473. .clkdm_wakeup = omap4_clkdm_wakeup,
  474. .clkdm_allow_idle = omap4_clkdm_allow_idle,
  475. .clkdm_deny_idle = omap4_clkdm_deny_idle,
  476. .clkdm_clk_enable = omap4_clkdm_clk_enable,
  477. .clkdm_clk_disable = omap4_clkdm_clk_disable,
  478. };
  479. static const struct cm_ll_data omap4xxx_cm_ll_data = {
  480. .wait_module_ready = &omap4_cminst_wait_module_ready,
  481. .wait_module_idle = &omap4_cminst_wait_module_idle,
  482. .module_enable = &omap4_cminst_module_enable,
  483. .module_disable = &omap4_cminst_module_disable,
  484. .xlate_clkctrl = &omap4_cminst_xlate_clkctrl,
  485. };
  486. int __init omap4_cm_init(const struct omap_prcm_init_data *data)
  487. {
  488. omap_cm_base_init();
  489. return cm_register(&omap4xxx_cm_ll_data);
  490. }
  491. static void __exit omap4_cm_exit(void)
  492. {
  493. cm_unregister(&omap4xxx_cm_ll_data);
  494. }
  495. __exitcall(omap4_cm_exit);