cminst44xx.c 17 KB

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