analysisDataOperation.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. /*
  2. * OMAP2420 clock data
  3. *
  4. * Copyright (C) 2005-2012 Texas Instruments, Inc.
  5. * Copyright (C) 2004-2011 Nokia Corporation
  6. *
  7. * Contacts:
  8. * Richard Woodruff <r-woodruff2@ti.com>
  9. * Paul Walmsley
  10. * Updated to COMMON clk format by Rajendra Nayak <rnayak@ti.com>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/io.h>
  18. #include <linux/clk.h>
  19. #include <linux/clk-private.h>
  20. #include <linux/list.h>
  21. #include "soc.h"
  22. #include "iomap.h"
  23. #include "clock.h"
  24. #include "clock2xxx.h"
  25. #include "opp2xxx.h"
  26. #include "cm2xxx.h"
  27. #include "prm2xxx.h"
  28. #include "prm-regbits-24xx.h"
  29. #include "cm-regbits-24xx.h"
  30. #include "sdrc.h"
  31. #include "control.h"
  32. #define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
  33. /*
  34. * 2420 clock tree.
  35. *
  36. * NOTE:In many cases here we are assigning a 'default' parent. In
  37. * many cases the parent is selectable. The set parent calls will
  38. * also switch sources.
  39. *
  40. * Several sources are given initial rates which may be wrong, this will
  41. * be fixed up in the init func.
  42. *
  43. * Things are broadly separated below by clock domains. It is
  44. * noteworthy that most peripherals have dependencies on multiple clock
  45. * domains. Many get their interface clocks from the L4 domain, but get
  46. * functional clocks from fixed sources or other core domain derived
  47. * clocks.
  48. */
  49. DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
  50. DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
  51. DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
  52. static struct clk osc_ck;
  53. static const struct clk_ops osc_ck_ops = {
  54. .recalc_rate = &omap2_osc_clk_recalc,
  55. };
  56. static struct clk_hw_omap osc_ck_hw = {
  57. .hw = {
  58. .clk = &osc_ck,
  59. },
  60. };
  61. static struct clk osc_ck = {
  62. .name = "osc_ck",
  63. .ops = &osc_ck_ops,
  64. .hw = &osc_ck_hw.hw,
  65. .flags = CLK_IS_ROOT,
  66. };
  67. DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
  68. static struct clk sys_ck;
  69. static const char *sys_ck_parent_names[] = {
  70. "osc_ck",
  71. };
  72. static const struct clk_ops sys_ck_ops = {
  73. .init = &omap2_init_clk_clkdm,
  74. .recalc_rate = &omap2xxx_sys_clk_recalc,
  75. };
  76. DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
  77. DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
  78. static struct dpll_data dpll_dd = {
  79. .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
  80. .mult_mask = OMAP24XX_DPLL_MULT_MASK,
  81. .div1_mask = OMAP24XX_DPLL_DIV_MASK,
  82. .clk_bypass = &sys_ck,
  83. .clk_ref = &sys_ck,
  84. .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
  85. .enable_mask = OMAP24XX_EN_DPLL_MASK,
  86. .max_multiplier = 1023,
  87. .min_divider = 1,
  88. .max_divider = 16,
  89. };
  90. static struct clk dpll_ck;
  91. static const char *dpll_ck_parent_names[] = {
  92. "sys_ck",
  93. };
  94. static const struct clk_ops dpll_ck_ops = {
  95. .init = &omap2_init_clk_clkdm,
  96. .get_parent = &omap2_init_dpll_parent,
  97. .recalc_rate = &omap2_dpllcore_recalc,
  98. .round_rate = &omap2_dpll_round_rate,
  99. .set_rate = &omap2_reprogram_dpllcore,
  100. };
  101. static struct clk_hw_omap dpll_ck_hw = {
  102. .hw = {
  103. .clk = &dpll_ck,
  104. },
  105. .ops = &clkhwops_omap2xxx_dpll,
  106. .dpll_data = &dpll_dd,
  107. .clkdm_name = "wkup_clkdm",
  108. };
  109. DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
  110. static struct clk core_ck;
  111. static const char *core_ck_parent_names[] = {
  112. "dpll_ck",
  113. };
  114. static const struct clk_ops core_ck_ops = {
  115. .init = &omap2_init_clk_clkdm,
  116. };
  117. DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
  118. DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
  119. DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
  120. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
  121. OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
  122. CLK_DIVIDER_ONE_BASED, NULL);
  123. DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
  124. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
  125. OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
  126. CLK_DIVIDER_ONE_BASED, NULL);
  127. static struct clk aes_ick;
  128. static const char *aes_ick_parent_names[] = {
  129. "l4_ck",
  130. };
  131. static const struct clk_ops aes_ick_ops = {
  132. .init = &omap2_init_clk_clkdm,
  133. .enable = &omap2_dflt_clk_enable,
  134. .disable = &omap2_dflt_clk_disable,
  135. .is_enabled = &omap2_dflt_clk_is_enabled,
  136. };
  137. static struct clk_hw_omap aes_ick_hw = {
  138. .hw = {
  139. .clk = &aes_ick,
  140. },
  141. .ops = &clkhwops_iclk_wait,
  142. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
  143. .enable_bit = OMAP24XX_EN_AES_SHIFT,
  144. .clkdm_name = "core_l4_clkdm",
  145. };
  146. DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
  147. static struct clk apll54_ck;
  148. static const struct clk_ops apll54_ck_ops = {
  149. .init = &omap2_init_clk_clkdm,
  150. .enable = &omap2_clk_apll54_enable,
  151. .disable = &omap2_clk_apll54_disable,
  152. .recalc_rate = &omap2_clk_apll54_recalc,
  153. };
  154. static struct clk_hw_omap apll54_ck_hw = {
  155. .hw = {
  156. .clk = &apll54_ck,
  157. },
  158. .ops = &clkhwops_apll54,
  159. .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
  160. .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
  161. .flags = ENABLE_ON_INIT,
  162. .clkdm_name = "wkup_clkdm",
  163. };
  164. DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
  165. static struct clk apll96_ck;
  166. static const struct clk_ops apll96_ck_ops = {
  167. .init = &omap2_init_clk_clkdm,
  168. .enable = &omap2_clk_apll96_enable,
  169. .disable = &omap2_clk_apll96_disable,
  170. .recalc_rate = &omap2_clk_apll96_recalc,
  171. };
  172. static struct clk_hw_omap apll96_ck_hw = {
  173. .hw = {
  174. .clk = &apll96_ck,
  175. },
  176. .ops = &clkhwops_apll96,
  177. .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
  178. .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
  179. .flags = ENABLE_ON_INIT,
  180. .clkdm_name = "wkup_clkdm",
  181. };
  182. DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
  183. static struct clk func_96m_ck;
  184. static const char *func_96m_ck_parent_names[] = {
  185. "apll96_ck",
  186. };
  187. DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm");
  188. DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops);
  189. static struct clk cam_fck;
  190. static const char *cam_fck_parent_names[] = {
  191. "func_96m_ck",
  192. };
  193. static struct clk_hw_omap cam_fck_hw = {
  194. .hw = {
  195. .clk = &cam_fck,
  196. },
  197. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  198. .enable_bit = OMAP24XX_EN_CAM_SHIFT,
  199. .clkdm_name = "core_l3_clkdm",
  200. };
  201. DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
  202. static struct clk cam_ick;
  203. static struct clk_hw_omap cam_ick_hw = {
  204. .hw = {
  205. .clk = &cam_ick,
  206. },
  207. .ops = &clkhwops_iclk,
  208. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  209. .enable_bit = OMAP24XX_EN_CAM_SHIFT,
  210. .clkdm_name = "core_l4_clkdm",
  211. };
  212. DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
  213. static struct clk des_ick;
  214. static struct clk_hw_omap des_ick_hw = {
  215. .hw = {
  216. .clk = &des_ick,
  217. },
  218. .ops = &clkhwops_iclk_wait,
  219. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
  220. .enable_bit = OMAP24XX_EN_DES_SHIFT,
  221. .clkdm_name = "core_l4_clkdm",
  222. };
  223. DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
  224. static const struct clksel_rate dsp_fck_core_rates[] = {
  225. { .div = 1, .val = 1, .flags = RATE_IN_24XX },
  226. { .div = 2, .val = 2, .flags = RATE_IN_24XX },
  227. { .div = 3, .val = 3, .flags = RATE_IN_24XX },
  228. { .div = 4, .val = 4, .flags = RATE_IN_24XX },
  229. { .div = 6, .val = 6, .flags = RATE_IN_242X },
  230. { .div = 8, .val = 8, .flags = RATE_IN_242X },
  231. { .div = 12, .val = 12, .flags = RATE_IN_242X },
  232. { .div = 0 }
  233. };
  234. static const struct clksel dsp_fck_clksel[] = {
  235. { .parent = &core_ck, .rates = dsp_fck_core_rates },
  236. { .parent = NULL },
  237. };
  238. static const char *dsp_fck_parent_names[] = {
  239. "core_ck",
  240. };
  241. static const struct clk_ops dsp_fck_ops = {
  242. .init = &omap2_init_clk_clkdm,
  243. .enable = &omap2_dflt_clk_enable,
  244. .disable = &omap2_dflt_clk_disable,
  245. .is_enabled = &omap2_dflt_clk_is_enabled,
  246. .recalc_rate = &omap2_clksel_recalc,
  247. .set_rate = &omap2_clksel_set_rate,
  248. .round_rate = &omap2_clksel_round_rate,
  249. };
  250. DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
  251. OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
  252. OMAP24XX_CLKSEL_DSP_MASK,
  253. OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
  254. OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
  255. dsp_fck_parent_names, dsp_fck_ops);
  256. static const struct clksel dsp_ick_clksel[] = {
  257. { .parent = &dsp_fck, .rates = dsp_ick_rates },
  258. { .parent = NULL },
  259. };
  260. static const char *dsp_ick_parent_names[] = {
  261. "dsp_fck",
  262. };
  263. DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
  264. OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
  265. OMAP24XX_CLKSEL_DSP_IF_MASK,
  266. OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
  267. OMAP2420_EN_DSP_IPI_SHIFT, &clkhwops_iclk_wait,
  268. dsp_ick_parent_names, dsp_fck_ops);
  269. static const struct clksel_rate dss1_fck_sys_rates[] = {
  270. { .div = 1, .val = 0, .flags = RATE_IN_24XX },
  271. { .div = 0 }
  272. };
  273. static const struct clksel_rate dss1_fck_core_rates[] = {
  274. { .div = 1, .val = 1, .flags = RATE_IN_24XX },
  275. { .div = 2, .val = 2, .flags = RATE_IN_24XX },
  276. { .div = 3, .val = 3, .flags = RATE_IN_24XX },
  277. { .div = 4, .val = 4, .flags = RATE_IN_24XX },
  278. { .div = 5, .val = 5, .flags = RATE_IN_24XX },
  279. { .div = 6, .val = 6, .flags = RATE_IN_24XX },
  280. { .div = 8, .val = 8, .flags = RATE_IN_24XX },
  281. { .div = 9, .val = 9, .flags = RATE_IN_24XX },
  282. { .div = 12, .val = 12, .flags = RATE_IN_24XX },
  283. { .div = 16, .val = 16, .flags = RATE_IN_24XX },
  284. { .div = 0 }
  285. };
  286. static const struct clksel dss1_fck_clksel[] = {
  287. { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
  288. { .parent = &core_ck, .rates = dss1_fck_core_rates },
  289. { .parent = NULL },
  290. };
  291. static const char *dss1_fck_parent_names[] = {
  292. "sys_ck", "core_ck",
  293. };
  294. static struct clk dss1_fck;
  295. static const struct clk_ops dss1_fck_ops = {
  296. .init = &omap2_init_clk_clkdm,
  297. .enable = &omap2_dflt_clk_enable,
  298. .disable = &omap2_dflt_clk_disable,
  299. .is_enabled = &omap2_dflt_clk_is_enabled,
  300. .recalc_rate = &omap2_clksel_recalc,
  301. .get_parent = &omap2_clksel_find_parent_index,
  302. .set_parent = &omap2_clksel_set_parent,
  303. };
  304. DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
  305. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
  306. OMAP24XX_CLKSEL_DSS1_MASK,
  307. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  308. OMAP24XX_EN_DSS1_SHIFT, NULL,
  309. dss1_fck_parent_names, dss1_fck_ops);
  310. static const struct clksel_rate dss2_fck_sys_rates[] = {
  311. { .div = 1, .val = 0, .flags = RATE_IN_24XX },
  312. { .div = 0 }
  313. };
  314. static const struct clksel_rate dss2_fck_48m_rates[] = {
  315. { .div = 1, .val = 1, .flags = RATE_IN_24XX },
  316. { .div = 0 }
  317. };
  318. static const struct clksel_rate func_48m_apll96_rates[] = {
  319. { .div = 2, .val = 0, .flags = RATE_IN_24XX },
  320. { .div = 0 }
  321. };
  322. static const struct clksel_rate func_48m_alt_rates[] = {
  323. { .div = 1, .val = 1, .flags = RATE_IN_24XX },
  324. { .div = 0 }
  325. };
  326. static const struct clksel func_48m_clksel[] = {
  327. { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
  328. { .parent = &alt_ck, .rates = func_48m_alt_rates },
  329. { .parent = NULL },
  330. };
  331. static const char *func_48m_ck_parent_names[] = {
  332. "apll96_ck", "alt_ck",
  333. };
  334. static struct clk func_48m_ck;
  335. static const struct clk_ops func_48m_ck_ops = {
  336. .init = &omap2_init_clk_clkdm,
  337. .recalc_rate = &omap2_clksel_recalc,
  338. .set_rate = &omap2_clksel_set_rate,
  339. .round_rate = &omap2_clksel_round_rate,
  340. .get_parent = &omap2_clksel_find_parent_index,
  341. .set_parent = &omap2_clksel_set_parent,
  342. };
  343. static struct clk_hw_omap func_48m_ck_hw = {
  344. .hw = {
  345. .clk = &func_48m_ck,
  346. },
  347. .clksel = func_48m_clksel,
  348. .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
  349. .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
  350. .clkdm_name = "wkup_clkdm",
  351. };
  352. DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
  353. static const struct clksel dss2_fck_clksel[] = {
  354. { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
  355. { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
  356. { .parent = NULL },
  357. };
  358. static const char *dss2_fck_parent_names[] = {
  359. "sys_ck", "func_48m_ck",
  360. };
  361. DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
  362. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
  363. OMAP24XX_CLKSEL_DSS2_MASK,
  364. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  365. OMAP24XX_EN_DSS2_SHIFT, NULL,
  366. dss2_fck_parent_names, dss1_fck_ops);
  367. static const char *func_54m_ck_parent_names[] = {
  368. "apll54_ck", "alt_ck",
  369. };
  370. DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
  371. OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
  372. OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
  373. 0x0, NULL);
  374. static struct clk dss_54m_fck;
  375. static const char *dss_54m_fck_parent_names[] = {
  376. "func_54m_ck",
  377. };
  378. static struct clk_hw_omap dss_54m_fck_hw = {
  379. .hw = {
  380. .clk = &dss_54m_fck,
  381. },
  382. .ops = &clkhwops_wait,
  383. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  384. .enable_bit = OMAP24XX_EN_TV_SHIFT,
  385. .clkdm_name = "dss_clkdm",
  386. };
  387. DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
  388. static struct clk dss_ick;
  389. static struct clk_hw_omap dss_ick_hw = {
  390. .hw = {
  391. .clk = &dss_ick,
  392. },
  393. .ops = &clkhwops_iclk,
  394. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  395. .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
  396. .clkdm_name = "dss_clkdm",
  397. };
  398. DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
  399. static struct clk eac_fck;
  400. static struct clk_hw_omap eac_fck_hw = {
  401. .hw = {
  402. .clk = &eac_fck,
  403. },
  404. .ops = &clkhwops_wait,
  405. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  406. .enable_bit = OMAP2420_EN_EAC_SHIFT,
  407. .clkdm_name = "core_l4_clkdm",
  408. };
  409. DEFINE_STRUCT_CLK(eac_fck, cam_fck_parent_names, aes_ick_ops);
  410. static struct clk eac_ick;
  411. static struct clk_hw_omap eac_ick_hw = {
  412. .hw = {
  413. .clk = &eac_ick,
  414. },
  415. .ops = &clkhwops_iclk_wait,
  416. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  417. .enable_bit = OMAP2420_EN_EAC_SHIFT,
  418. .clkdm_name = "core_l4_clkdm",
  419. };
  420. DEFINE_STRUCT_CLK(eac_ick, aes_ick_parent_names, aes_ick_ops);
  421. static struct clk emul_ck;
  422. static struct clk_hw_omap emul_ck_hw = {
  423. .hw = {
  424. .clk = &emul_ck,
  425. },
  426. .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
  427. .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
  428. .clkdm_name = "wkup_clkdm",
  429. };
  430. DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
  431. DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
  432. static struct clk fac_fck;
  433. static const char *fac_fck_parent_names[] = {
  434. "func_12m_ck",
  435. };
  436. static struct clk_hw_omap fac_fck_hw = {
  437. .hw = {
  438. .clk = &fac_fck,
  439. },
  440. .ops = &clkhwops_wait,
  441. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  442. .enable_bit = OMAP24XX_EN_FAC_SHIFT,
  443. .clkdm_name = "core_l4_clkdm",
  444. };
  445. DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
  446. static struct clk fac_ick;
  447. static struct clk_hw_omap fac_ick_hw = {
  448. .hw = {
  449. .clk = &fac_ick,
  450. },
  451. .ops = &clkhwops_iclk_wait,
  452. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  453. .enable_bit = OMAP24XX_EN_FAC_SHIFT,
  454. .clkdm_name = "core_l4_clkdm",
  455. };
  456. DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
  457. static const struct clksel gfx_fck_clksel[] = {
  458. { .parent = &core_l3_ck, .rates = gfx_l3_rates },
  459. { .parent = NULL },
  460. };
  461. static const char *gfx_2d_fck_parent_names[] = {
  462. "core_l3_ck",
  463. };
  464. DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
  465. OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
  466. OMAP_CLKSEL_GFX_MASK,
  467. OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
  468. OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
  469. gfx_2d_fck_parent_names, dsp_fck_ops);
  470. DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
  471. OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
  472. OMAP_CLKSEL_GFX_MASK,
  473. OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
  474. OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
  475. gfx_2d_fck_parent_names, dsp_fck_ops);
  476. static struct clk gfx_ick;
  477. static const char *gfx_ick_parent_names[] = {
  478. "core_l3_ck",
  479. };
  480. static struct clk_hw_omap gfx_ick_hw = {
  481. .hw = {
  482. .clk = &gfx_ick,
  483. },
  484. .ops = &clkhwops_wait,
  485. .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
  486. .enable_bit = OMAP_EN_GFX_SHIFT,
  487. .clkdm_name = "gfx_clkdm",
  488. };
  489. DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
  490. static struct clk gpios_fck;
  491. static const char *gpios_fck_parent_names[] = {
  492. "func_32k_ck",
  493. };
  494. static struct clk_hw_omap gpios_fck_hw = {
  495. .hw = {
  496. .clk = &gpios_fck,
  497. },
  498. .ops = &clkhwops_wait,
  499. .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
  500. .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
  501. .clkdm_name = "wkup_clkdm",
  502. };
  503. DEFINE_STRUCT_CLK(gpios_fck, gpios_fck_parent_names, aes_ick_ops);
  504. static struct clk wu_l4_ick;
  505. DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
  506. DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
  507. static struct clk gpios_ick;
  508. static const char *gpios_ick_parent_names[] = {
  509. "wu_l4_ick",
  510. };
  511. static struct clk_hw_omap gpios_ick_hw = {
  512. .hw = {
  513. .clk = &gpios_ick,
  514. },
  515. .ops = &clkhwops_iclk_wait,
  516. .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
  517. .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
  518. .clkdm_name = "wkup_clkdm",
  519. };
  520. DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
  521. static struct clk gpmc_fck;
  522. static struct clk_hw_omap gpmc_fck_hw = {
  523. .hw = {
  524. .clk = &gpmc_fck,
  525. },
  526. .ops = &clkhwops_iclk,
  527. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
  528. .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
  529. .flags = ENABLE_ON_INIT,
  530. .clkdm_name = "core_l3_clkdm",
  531. };
  532. DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
  533. static const struct clksel_rate gpt_alt_rates[] = {
  534. { .div = 1, .val = 2, .flags = RATE_IN_24XX },
  535. { .div = 0 }
  536. };
  537. static const struct clksel omap24xx_gpt_clksel[] = {
  538. { .parent = &func_32k_ck, .rates = gpt_32k_rates },
  539. { .parent = &sys_ck, .rates = gpt_sys_rates },
  540. { .parent = &alt_ck, .rates = gpt_alt_rates },
  541. { .parent = NULL },
  542. };
  543. static const char *gpt10_fck_parent_names[] = {
  544. "func_32k_ck", "sys_ck", "alt_ck",
  545. };
  546. DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  547. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  548. OMAP24XX_CLKSEL_GPT10_MASK,
  549. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  550. OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
  551. gpt10_fck_parent_names, dss1_fck_ops);
  552. static struct clk gpt10_ick;
  553. static struct clk_hw_omap gpt10_ick_hw = {
  554. .hw = {
  555. .clk = &gpt10_ick,
  556. },
  557. .ops = &clkhwops_iclk_wait,
  558. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  559. .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
  560. .clkdm_name = "core_l4_clkdm",
  561. };
  562. DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
  563. DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  564. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  565. OMAP24XX_CLKSEL_GPT11_MASK,
  566. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  567. OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
  568. gpt10_fck_parent_names, dss1_fck_ops);
  569. static struct clk gpt11_ick;
  570. static struct clk_hw_omap gpt11_ick_hw = {
  571. .hw = {
  572. .clk = &gpt11_ick,
  573. },
  574. .ops = &clkhwops_iclk_wait,
  575. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  576. .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
  577. .clkdm_name = "core_l4_clkdm",
  578. };
  579. DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
  580. DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  581. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  582. OMAP24XX_CLKSEL_GPT12_MASK,
  583. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  584. OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
  585. gpt10_fck_parent_names, dss1_fck_ops);
  586. static struct clk gpt12_ick;
  587. static struct clk_hw_omap gpt12_ick_hw = {
  588. .hw = {
  589. .clk = &gpt12_ick,
  590. },
  591. .ops = &clkhwops_iclk_wait,
  592. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  593. .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
  594. .clkdm_name = "core_l4_clkdm",
  595. };
  596. DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
  597. static const struct clk_ops gpt1_fck_ops = {
  598. .init = &omap2_init_clk_clkdm,
  599. .enable = &omap2_dflt_clk_enable,
  600. .disable = &omap2_dflt_clk_disable,
  601. .is_enabled = &omap2_dflt_clk_is_enabled,
  602. .recalc_rate = &omap2_clksel_recalc,
  603. .set_rate = &omap2_clksel_set_rate,
  604. .round_rate = &omap2_clksel_round_rate,
  605. .get_parent = &omap2_clksel_find_parent_index,
  606. .set_parent = &omap2_clksel_set_parent,
  607. };
  608. DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  609. OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
  610. OMAP24XX_CLKSEL_GPT1_MASK,
  611. OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
  612. OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
  613. gpt10_fck_parent_names, gpt1_fck_ops);
  614. static struct clk gpt1_ick;
  615. static struct clk_hw_omap gpt1_ick_hw = {
  616. .hw = {
  617. .clk = &gpt1_ick,
  618. },
  619. .ops = &clkhwops_iclk_wait,
  620. .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
  621. .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
  622. .clkdm_name = "wkup_clkdm",
  623. };
  624. DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
  625. DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  626. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  627. OMAP24XX_CLKSEL_GPT2_MASK,
  628. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  629. OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
  630. gpt10_fck_parent_names, dss1_fck_ops);
  631. static struct clk gpt2_ick;
  632. static struct clk_hw_omap gpt2_ick_hw = {
  633. .hw = {
  634. .clk = &gpt2_ick,
  635. },
  636. .ops = &clkhwops_iclk_wait,
  637. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  638. .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
  639. .clkdm_name = "core_l4_clkdm",
  640. };
  641. DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
  642. DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  643. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  644. OMAP24XX_CLKSEL_GPT3_MASK,
  645. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  646. OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
  647. gpt10_fck_parent_names, dss1_fck_ops);
  648. static struct clk gpt3_ick;
  649. static struct clk_hw_omap gpt3_ick_hw = {
  650. .hw = {
  651. .clk = &gpt3_ick,
  652. },
  653. .ops = &clkhwops_iclk_wait,
  654. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  655. .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
  656. .clkdm_name = "core_l4_clkdm",
  657. };
  658. DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
  659. DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  660. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  661. OMAP24XX_CLKSEL_GPT4_MASK,
  662. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  663. OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
  664. gpt10_fck_parent_names, dss1_fck_ops);
  665. static struct clk gpt4_ick;
  666. static struct clk_hw_omap gpt4_ick_hw = {
  667. .hw = {
  668. .clk = &gpt4_ick,
  669. },
  670. .ops = &clkhwops_iclk_wait,
  671. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  672. .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
  673. .clkdm_name = "core_l4_clkdm",
  674. };
  675. DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
  676. DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  677. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  678. OMAP24XX_CLKSEL_GPT5_MASK,
  679. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  680. OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
  681. gpt10_fck_parent_names, dss1_fck_ops);
  682. static struct clk gpt5_ick;
  683. static struct clk_hw_omap gpt5_ick_hw = {
  684. .hw = {
  685. .clk = &gpt5_ick,
  686. },
  687. .ops = &clkhwops_iclk_wait,
  688. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  689. .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
  690. .clkdm_name = "core_l4_clkdm",
  691. };
  692. DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
  693. DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  694. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  695. OMAP24XX_CLKSEL_GPT6_MASK,
  696. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  697. OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
  698. gpt10_fck_parent_names, dss1_fck_ops);
  699. static struct clk gpt6_ick;
  700. static struct clk_hw_omap gpt6_ick_hw = {
  701. .hw = {
  702. .clk = &gpt6_ick,
  703. },
  704. .ops = &clkhwops_iclk_wait,
  705. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  706. .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
  707. .clkdm_name = "core_l4_clkdm",
  708. };
  709. DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
  710. DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  711. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  712. OMAP24XX_CLKSEL_GPT7_MASK,
  713. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  714. OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
  715. gpt10_fck_parent_names, dss1_fck_ops);
  716. static struct clk gpt7_ick;
  717. static struct clk_hw_omap gpt7_ick_hw = {
  718. .hw = {
  719. .clk = &gpt7_ick,
  720. },
  721. .ops = &clkhwops_iclk_wait,
  722. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  723. .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
  724. .clkdm_name = "core_l4_clkdm",
  725. };
  726. DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
  727. DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  728. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  729. OMAP24XX_CLKSEL_GPT8_MASK,
  730. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
  731. OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
  732. gpt10_fck_parent_names, dss1_fck_ops);
  733. static struct clk gpt8_ick;
  734. static struct clk_hw_omap gpt8_ick_hw = {
  735. .hw = {
  736. .clk = &gpt8_ick,
  737. },
  738. .ops = &clkhwops_iclk_wait,
  739. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
  740. .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
  741. .clkdm_name = "core_l4_clkdm",
  742. };
  743. DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
  744. DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
  745. OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
  746. OMAP24XX_CLKSEL_GPT9_MASK,
  747. OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),