cclock33xx_data.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. /*
  2. * AM33XX Clock data
  3. *
  4. * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
  5. * Vaibhav Hiremath <hvaibhav@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation version 2.
  10. *
  11. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  12. * kind, whether express or implied; without even the implied warranty
  13. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/list.h>
  18. #include <linux/clk-private.h>
  19. #include <linux/clkdev.h>
  20. #include <linux/io.h>
  21. #include "am33xx.h"
  22. #include "soc.h"
  23. #include "iomap.h"
  24. #include "clock.h"
  25. #include "control.h"
  26. #include "cm.h"
  27. #include "cm33xx.h"
  28. #include "cm-regbits-33xx.h"
  29. #include "prm.h"
  30. /* Modulemode control */
  31. #define AM33XX_MODULEMODE_HWCTRL_SHIFT 0
  32. #define AM33XX_MODULEMODE_SWCTRL_SHIFT 1
  33. /*LIST_HEAD(clocks);*/
  34. /* Root clocks */
  35. /* RTC 32k */
  36. DEFINE_CLK_FIXED_RATE(clk_32768_ck, CLK_IS_ROOT, 32768, 0x0);
  37. /* On-Chip 32KHz RC OSC */
  38. DEFINE_CLK_FIXED_RATE(clk_rc32k_ck, CLK_IS_ROOT, 32000, 0x0);
  39. /* Crystal input clks */
  40. DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
  41. DEFINE_CLK_FIXED_RATE(virt_24000000_ck, CLK_IS_ROOT, 24000000, 0x0);
  42. DEFINE_CLK_FIXED_RATE(virt_25000000_ck, CLK_IS_ROOT, 25000000, 0x0);
  43. DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
  44. /* Oscillator clock */
  45. /* 19.2, 24, 25 or 26 MHz */
  46. static const char *sys_clkin_ck_parents[] = {
  47. "virt_19200000_ck", "virt_24000000_ck", "virt_25000000_ck",
  48. "virt_26000000_ck",
  49. };
  50. /*
  51. * sys_clk in: input to the dpll and also used as funtional clock for,
  52. * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
  53. *
  54. */
  55. DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
  56. AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
  57. AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT,
  58. AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH,
  59. 0, NULL);
  60. /* External clock - 12 MHz */
  61. DEFINE_CLK_FIXED_RATE(tclkin_ck, CLK_IS_ROOT, 12000000, 0x0);
  62. /* Module clocks and DPLL outputs */
  63. /* DPLL_CORE */
  64. static struct dpll_data dpll_core_dd = {
  65. .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
  66. .clk_bypass = &sys_clkin_ck,
  67. .clk_ref = &sys_clkin_ck,
  68. .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
  69. .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
  70. .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
  71. .mult_mask = AM33XX_DPLL_MULT_MASK,
  72. .div1_mask = AM33XX_DPLL_DIV_MASK,
  73. .enable_mask = AM33XX_DPLL_EN_MASK,
  74. .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
  75. .max_multiplier = 2047,
  76. .max_divider = 128,
  77. .min_divider = 1,
  78. };
  79. /* CLKDCOLDO output */
  80. static const char *dpll_core_ck_parents[] = {
  81. "sys_clkin_ck",
  82. };
  83. static struct clk dpll_core_ck;
  84. static const struct clk_ops dpll_core_ck_ops = {
  85. .recalc_rate = &omap3_dpll_recalc,
  86. .get_parent = &omap2_init_dpll_parent,
  87. };
  88. static struct clk_hw_omap dpll_core_ck_hw = {
  89. .hw = {
  90. .clk = &dpll_core_ck,
  91. },
  92. .dpll_data = &dpll_core_dd,
  93. .ops = &clkhwops_omap3_dpll,
  94. };
  95. DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
  96. static const char *dpll_core_x2_ck_parents[] = {
  97. "dpll_core_ck",
  98. };
  99. static struct clk dpll_core_x2_ck;
  100. static const struct clk_ops dpll_x2_ck_ops = {
  101. .recalc_rate = &omap3_clkoutx2_recalc,
  102. };
  103. static struct clk_hw_omap dpll_core_x2_ck_hw = {
  104. .hw = {
  105. .clk = &dpll_core_x2_ck,
  106. },
  107. .flags = CLOCK_CLKOUTX2,
  108. };
  109. DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_x2_ck_ops);
  110. DEFINE_CLK_DIVIDER(dpll_core_m4_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
  111. 0x0, AM33XX_CM_DIV_M4_DPLL_CORE,
  112. AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT,
  113. AM33XX_HSDIVIDER_CLKOUT1_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
  114. NULL);
  115. DEFINE_CLK_DIVIDER(dpll_core_m5_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
  116. 0x0, AM33XX_CM_DIV_M5_DPLL_CORE,
  117. AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT,
  118. AM33XX_HSDIVIDER_CLKOUT2_DIV_WIDTH,
  119. CLK_DIVIDER_ONE_BASED, NULL);
  120. DEFINE_CLK_DIVIDER(dpll_core_m6_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
  121. 0x0, AM33XX_CM_DIV_M6_DPLL_CORE,
  122. AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT,
  123. AM33XX_HSDIVIDER_CLKOUT3_DIV_WIDTH,
  124. CLK_DIVIDER_ONE_BASED, NULL);
  125. /* DPLL_MPU */
  126. static struct dpll_data dpll_mpu_dd = {
  127. .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
  128. .clk_bypass = &sys_clkin_ck,
  129. .clk_ref = &sys_clkin_ck,
  130. .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
  131. .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
  132. .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
  133. .mult_mask = AM33XX_DPLL_MULT_MASK,
  134. .div1_mask = AM33XX_DPLL_DIV_MASK,
  135. .enable_mask = AM33XX_DPLL_EN_MASK,
  136. .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
  137. .max_multiplier = 2047,
  138. .max_divider = 128,
  139. .min_divider = 1,
  140. };
  141. /* CLKOUT: fdpll/M2 */
  142. static struct clk dpll_mpu_ck;
  143. static const struct clk_ops dpll_mpu_ck_ops = {
  144. .enable = &omap3_noncore_dpll_enable,
  145. .disable = &omap3_noncore_dpll_disable,
  146. .recalc_rate = &omap3_dpll_recalc,
  147. .round_rate = &omap2_dpll_round_rate,
  148. .set_rate = &omap3_noncore_dpll_set_rate,
  149. .get_parent = &omap2_init_dpll_parent,
  150. };
  151. static struct clk_hw_omap dpll_mpu_ck_hw = {
  152. .hw = {
  153. .clk = &dpll_mpu_ck,
  154. },
  155. .dpll_data = &dpll_mpu_dd,
  156. .ops = &clkhwops_omap3_dpll,
  157. };
  158. DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_mpu_ck_ops);
  159. /*
  160. * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
  161. * and ALT_CLK1/2)
  162. */
  163. DEFINE_CLK_DIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck,
  164. 0x0, AM33XX_CM_DIV_M2_DPLL_MPU, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
  165. AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
  166. /* DPLL_DDR */
  167. static struct dpll_data dpll_ddr_dd = {
  168. .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
  169. .clk_bypass = &sys_clkin_ck,
  170. .clk_ref = &sys_clkin_ck,
  171. .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
  172. .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
  173. .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
  174. .mult_mask = AM33XX_DPLL_MULT_MASK,
  175. .div1_mask = AM33XX_DPLL_DIV_MASK,
  176. .enable_mask = AM33XX_DPLL_EN_MASK,
  177. .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
  178. .max_multiplier = 2047,
  179. .max_divider = 128,
  180. .min_divider = 1,
  181. };
  182. /* CLKOUT: fdpll/M2 */
  183. static struct clk dpll_ddr_ck;
  184. static const struct clk_ops dpll_ddr_ck_ops = {
  185. .recalc_rate = &omap3_dpll_recalc,
  186. .get_parent = &omap2_init_dpll_parent,
  187. .round_rate = &omap2_dpll_round_rate,
  188. .set_rate = &omap3_noncore_dpll_set_rate,
  189. };
  190. static struct clk_hw_omap dpll_ddr_ck_hw = {
  191. .hw = {
  192. .clk = &dpll_ddr_ck,
  193. },
  194. .dpll_data = &dpll_ddr_dd,
  195. .ops = &clkhwops_omap3_dpll,
  196. };
  197. DEFINE_STRUCT_CLK(dpll_ddr_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
  198. /*
  199. * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
  200. * and ALT_CLK1/2)
  201. */
  202. DEFINE_CLK_DIVIDER(dpll_ddr_m2_ck, "dpll_ddr_ck", &dpll_ddr_ck,
  203. 0x0, AM33XX_CM_DIV_M2_DPLL_DDR,
  204. AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
  205. CLK_DIVIDER_ONE_BASED, NULL);
  206. /* emif_fck functional clock */
  207. DEFINE_CLK_FIXED_FACTOR(dpll_ddr_m2_div2_ck, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck,
  208. 0x0, 1, 2);
  209. /* DPLL_DISP */
  210. static struct dpll_data dpll_disp_dd = {
  211. .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
  212. .clk_bypass = &sys_clkin_ck,
  213. .clk_ref = &sys_clkin_ck,
  214. .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
  215. .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
  216. .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
  217. .mult_mask = AM33XX_DPLL_MULT_MASK,
  218. .div1_mask = AM33XX_DPLL_DIV_MASK,
  219. .enable_mask = AM33XX_DPLL_EN_MASK,
  220. .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
  221. .max_multiplier = 2047,
  222. .max_divider = 128,
  223. .min_divider = 1,
  224. };
  225. /* CLKOUT: fdpll/M2 */
  226. static struct clk dpll_disp_ck;
  227. static struct clk_hw_omap dpll_disp_ck_hw = {
  228. .hw = {
  229. .clk = &dpll_disp_ck,
  230. },
  231. .dpll_data = &dpll_disp_dd,
  232. .ops = &clkhwops_omap3_dpll,
  233. };
  234. DEFINE_STRUCT_CLK(dpll_disp_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
  235. /*
  236. * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
  237. * and ALT_CLK1/2)
  238. */
  239. DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, "dpll_disp_ck", &dpll_disp_ck,
  240. CLK_SET_RATE_PARENT, AM33XX_CM_DIV_M2_DPLL_DISP,
  241. AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
  242. CLK_DIVIDER_ONE_BASED, NULL);
  243. /* DPLL_PER */
  244. static struct dpll_data dpll_per_dd = {
  245. .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
  246. .clk_bypass = &sys_clkin_ck,
  247. .clk_ref = &sys_clkin_ck,
  248. .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
  249. .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
  250. .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
  251. .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
  252. .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
  253. .enable_mask = AM33XX_DPLL_EN_MASK,
  254. .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
  255. .max_multiplier = 2047,
  256. .max_divider = 128,
  257. .min_divider = 1,
  258. .flags = DPLL_J_TYPE,
  259. };
  260. /* CLKDCOLDO */
  261. static struct clk dpll_per_ck;
  262. static struct clk_hw_omap dpll_per_ck_hw = {
  263. .hw = {
  264. .clk = &dpll_per_ck,
  265. },
  266. .dpll_data = &dpll_per_dd,
  267. .ops = &clkhwops_omap3_dpll,
  268. };
  269. DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
  270. /* CLKOUT: fdpll/M2 */
  271. DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
  272. AM33XX_CM_DIV_M2_DPLL_PER, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
  273. AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
  274. NULL);
  275. DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_wkupdm_ck, "dpll_per_m2_ck",
  276. &dpll_per_m2_ck, 0x0, 1, 4);
  277. DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_ck, "dpll_per_m2_ck",
  278. &dpll_per_m2_ck, 0x0, 1, 4);
  279. DEFINE_CLK_FIXED_FACTOR(dpll_core_m4_div2_ck, "dpll_core_m4_ck",
  280. &dpll_core_m4_ck, 0x0, 1, 2);
  281. DEFINE_CLK_FIXED_FACTOR(l4_rtc_gclk, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
  282. 1, 2);
  283. DEFINE_CLK_FIXED_FACTOR(clk_24mhz, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1,
  284. 8);
  285. /*
  286. * Below clock nodes describes clockdomains derived out
  287. * of core clock.
  288. */
  289. static const struct clk_ops clk_ops_null = {
  290. };
  291. static const char *l3_gclk_parents[] = {
  292. "dpll_core_m4_ck"
  293. };
  294. static struct clk l3_gclk;
  295. DEFINE_STRUCT_CLK_HW_OMAP(l3_gclk, NULL);
  296. DEFINE_STRUCT_CLK(l3_gclk, l3_gclk_parents, clk_ops_null);
  297. static struct clk l4hs_gclk;
  298. DEFINE_STRUCT_CLK_HW_OMAP(l4hs_gclk, NULL);
  299. DEFINE_STRUCT_CLK(l4hs_gclk, l3_gclk_parents, clk_ops_null);
  300. static const char *l3s_gclk_parents[] = {
  301. "dpll_core_m4_div2_ck"
  302. };
  303. static struct clk l3s_gclk;
  304. DEFINE_STRUCT_CLK_HW_OMAP(l3s_gclk, NULL);
  305. DEFINE_STRUCT_CLK(l3s_gclk, l3s_gclk_parents, clk_ops_null);
  306. static struct clk l4fw_gclk;
  307. DEFINE_STRUCT_CLK_HW_OMAP(l4fw_gclk, NULL);
  308. DEFINE_STRUCT_CLK(l4fw_gclk, l3s_gclk_parents, clk_ops_null);
  309. static struct clk l4ls_gclk;
  310. DEFINE_STRUCT_CLK_HW_OMAP(l4ls_gclk, NULL);
  311. DEFINE_STRUCT_CLK(l4ls_gclk, l3s_gclk_parents, clk_ops_null);
  312. static struct clk sysclk_div_ck;
  313. DEFINE_STRUCT_CLK_HW_OMAP(sysclk_div_ck, NULL);
  314. DEFINE_STRUCT_CLK(sysclk_div_ck, l3_gclk_parents, clk_ops_null);
  315. /*
  316. * In order to match the clock domain with hwmod clockdomain entry,
  317. * separate clock nodes is required for the modules which are
  318. * directly getting their funtioncal clock from sys_clkin.
  319. */
  320. static struct clk adc_tsc_fck;
  321. DEFINE_STRUCT_CLK_HW_OMAP(adc_tsc_fck, NULL);
  322. DEFINE_STRUCT_CLK(adc_tsc_fck, dpll_core_ck_parents, clk_ops_null);
  323. static struct clk dcan0_fck;
  324. DEFINE_STRUCT_CLK_HW_OMAP(dcan0_fck, NULL);
  325. DEFINE_STRUCT_CLK(dcan0_fck, dpll_core_ck_parents, clk_ops_null);
  326. static struct clk dcan1_fck;
  327. DEFINE_STRUCT_CLK_HW_OMAP(dcan1_fck, NULL);
  328. DEFINE_STRUCT_CLK(dcan1_fck, dpll_core_ck_parents, clk_ops_null);
  329. static struct clk mcasp0_fck;
  330. DEFINE_STRUCT_CLK_HW_OMAP(mcasp0_fck, NULL);
  331. DEFINE_STRUCT_CLK(mcasp0_fck, dpll_core_ck_parents, clk_ops_null);
  332. static struct clk mcasp1_fck;
  333. DEFINE_STRUCT_CLK_HW_OMAP(mcasp1_fck, NULL);
  334. DEFINE_STRUCT_CLK(mcasp1_fck, dpll_core_ck_parents, clk_ops_null);
  335. static struct clk smartreflex0_fck;
  336. DEFINE_STRUCT_CLK_HW_OMAP(smartreflex0_fck, NULL);
  337. DEFINE_STRUCT_CLK(smartreflex0_fck, dpll_core_ck_parents, clk_ops_null);
  338. static struct clk smartreflex1_fck;
  339. DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
  340. DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
  341. static struct clk sha0_fck;
  342. DEFINE_STRUCT_CLK_HW_OMAP(sha0_fck, NULL);
  343. DEFINE_STRUCT_CLK(sha0_fck, dpll_core_ck_parents, clk_ops_null);
  344. static struct clk aes0_fck;
  345. DEFINE_STRUCT_CLK_HW_OMAP(aes0_fck, NULL);
  346. DEFINE_STRUCT_CLK(aes0_fck, dpll_core_ck_parents, clk_ops_null);
  347. /*
  348. * Modules clock nodes
  349. *
  350. * The following clock leaf nodes are added for the moment because:
  351. *
  352. * - hwmod data is not present for these modules, either hwmod
  353. * control is not required or its not populated.
  354. * - Driver code is not yet migrated to use hwmod/runtime pm
  355. * - Modules outside kernel access (to disable them by default)
  356. *
  357. * - debugss
  358. * - mmu (gfx domain)
  359. * - cefuse
  360. * - usbotg_fck (its additional clock and not really a modulemode)
  361. * - ieee5000
  362. */
  363. DEFINE_CLK_GATE(debugss_ick, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
  364. AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
  365. 0x0, NULL);
  366. DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
  367. AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
  368. 0x0, NULL);
  369. DEFINE_CLK_GATE(cefuse_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
  370. AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
  371. 0x0, NULL);
  372. /*
  373. * clkdiv32 is generated from fixed division of 732.4219
  374. */
  375. DEFINE_CLK_FIXED_FACTOR(clkdiv32k_ck, "clk_24mhz", &clk_24mhz, 0x0, 1, 732);
  376. static struct clk clkdiv32k_ick;
  377. static const char *clkdiv32k_ick_parent_names[] = {
  378. "clkdiv32k_ck",
  379. };
  380. static const struct clk_ops clkdiv32k_ick_ops = {
  381. .enable = &omap2_dflt_clk_enable,
  382. .disable = &omap2_dflt_clk_disable,
  383. .is_enabled = &omap2_dflt_clk_is_enabled,
  384. .init = &omap2_init_clk_clkdm,
  385. };
  386. static struct clk_hw_omap clkdiv32k_ick_hw = {
  387. .hw = {
  388. .clk = &clkdiv32k_ick,
  389. },
  390. .enable_reg = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
  391. .enable_bit = AM33XX_MODULEMODE_SWCTRL_SHIFT,
  392. .clkdm_name = "clk_24mhz_clkdm",
  393. };
  394. DEFINE_STRUCT_CLK(clkdiv32k_ick, clkdiv32k_ick_parent_names, clkdiv32k_ick_ops);
  395. /* "usbotg_fck" is an additional clock and not really a modulemode */
  396. DEFINE_CLK_GATE(usbotg_fck, "dpll_per_ck", &dpll_per_ck, 0x0,
  397. AM33XX_CM_CLKDCOLDO_DPLL_PER, AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
  398. 0x0, NULL);
  399. DEFINE_CLK_GATE(ieee5000_fck, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck,
  400. 0x0, AM33XX_CM_PER_IEEE5000_CLKCTRL,
  401. AM33XX_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
  402. /* Timers */
  403. static const struct clksel timer1_clkmux_sel[] = {
  404. { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
  405. { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
  406. { .parent = &tclkin_ck, .rates = div_1_2_rates },
  407. { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
  408. { .parent = &clk_32768_ck, .rates = div_1_4_rates },
  409. { .parent = NULL },
  410. };
  411. static const char *timer1_ck_parents[] = {
  412. "sys_clkin_ck", "clkdiv32k_ick", "tclkin_ck", "clk_rc32k_ck",
  413. "clk_32768_ck",
  414. };
  415. static struct clk timer1_fck;
  416. static const struct clk_ops timer1_fck_ops = {
  417. .recalc_rate = &omap2_clksel_recalc,
  418. .get_parent = &omap2_clksel_find_parent_index,
  419. .set_parent = &omap2_clksel_set_parent,
  420. .init = &omap2_init_clk_clkdm,
  421. };
  422. static struct clk_hw_omap timer1_fck_hw = {
  423. .hw = {
  424. .clk = &timer1_fck,
  425. },
  426. .clkdm_name = "l4ls_clkdm",
  427. .clksel = timer1_clkmux_sel,
  428. .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
  429. .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
  430. };
  431. DEFINE_STRUCT_CLK(timer1_fck, timer1_ck_parents, timer1_fck_ops);
  432. static const struct clksel timer2_to_7_clk_sel[] = {
  433. { .parent = &tclkin_ck, .rates = div_1_0_rates },
  434. { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
  435. { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
  436. { .parent = NULL },
  437. };
  438. static const char *timer2_to_7_ck_parents[] = {
  439. "tclkin_ck", "sys_clkin_ck", "clkdiv32k_ick",
  440. };
  441. static struct clk timer2_fck;
  442. static struct clk_hw_omap timer2_fck_hw = {
  443. .hw = {
  444. .clk = &timer2_fck,
  445. },
  446. .clkdm_name = "l4ls_clkdm",
  447. .clksel = timer2_to_7_clk_sel,
  448. .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
  449. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  450. };
  451. DEFINE_STRUCT_CLK(timer2_fck, timer2_to_7_ck_parents, timer1_fck_ops);
  452. static struct clk timer3_fck;
  453. static struct clk_hw_omap timer3_fck_hw = {
  454. .hw = {
  455. .clk = &timer3_fck,
  456. },
  457. .clkdm_name = "l4ls_clkdm",
  458. .clksel = timer2_to_7_clk_sel,
  459. .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
  460. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  461. };
  462. DEFINE_STRUCT_CLK(timer3_fck, timer2_to_7_ck_parents, timer1_fck_ops);
  463. static struct clk timer4_fck;
  464. static struct clk_hw_omap timer4_fck_hw = {
  465. .hw = {
  466. .clk = &timer4_fck,
  467. },
  468. .clkdm_name = "l4ls_clkdm",
  469. .clksel = timer2_to_7_clk_sel,
  470. .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
  471. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  472. };
  473. DEFINE_STRUCT_CLK(timer4_fck, timer2_to_7_ck_parents, timer1_fck_ops);
  474. static struct clk timer5_fck;
  475. static struct clk_hw_omap timer5_fck_hw = {
  476. .hw = {
  477. .clk = &timer5_fck,
  478. },
  479. .clkdm_name = "l4ls_clkdm",
  480. .clksel = timer2_to_7_clk_sel,
  481. .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
  482. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  483. };
  484. DEFINE_STRUCT_CLK(timer5_fck, timer2_to_7_ck_parents, timer1_fck_ops);
  485. static struct clk timer6_fck;
  486. static struct clk_hw_omap timer6_fck_hw = {
  487. .hw = {
  488. .clk = &timer6_fck,
  489. },
  490. .clkdm_name = "l4ls_clkdm",
  491. .clksel = timer2_to_7_clk_sel,
  492. .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
  493. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  494. };
  495. DEFINE_STRUCT_CLK(timer6_fck, timer2_to_7_ck_parents, timer1_fck_ops);
  496. static struct clk timer7_fck;
  497. static struct clk_hw_omap timer7_fck_hw = {
  498. .hw = {
  499. .clk = &timer7_fck,
  500. },
  501. .clkdm_name = "l4ls_clkdm",
  502. .clksel = timer2_to_7_clk_sel,
  503. .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
  504. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  505. };
  506. DEFINE_STRUCT_CLK(timer7_fck, timer2_to_7_ck_parents, timer1_fck_ops);
  507. DEFINE_CLK_FIXED_FACTOR(cpsw_125mhz_gclk,
  508. "dpll_core_m5_ck",
  509. &dpll_core_m5_ck,
  510. 0x0,
  511. 1, 2);
  512. static const struct clk_ops cpsw_fck_ops = {
  513. .recalc_rate = &omap2_clksel_recalc,
  514. .get_parent = &omap2_clksel_find_parent_index,
  515. .set_parent = &omap2_clksel_set_parent,
  516. };
  517. static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
  518. { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
  519. { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
  520. { .parent = NULL },
  521. };
  522. static const char *cpsw_cpts_rft_ck_parents[] = {
  523. "dpll_core_m5_ck", "dpll_core_m4_ck",
  524. };
  525. static struct clk cpsw_cpts_rft_clk;
  526. static struct clk_hw_omap cpsw_cpts_rft_clk_hw = {
  527. .hw = {
  528. .clk = &cpsw_cpts_rft_clk,
  529. },
  530. .clkdm_name = "cpsw_125mhz_clkdm",
  531. .clksel = cpsw_cpts_rft_clkmux_sel,
  532. .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
  533. .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
  534. };
  535. DEFINE_STRUCT_CLK(cpsw_cpts_rft_clk, cpsw_cpts_rft_ck_parents, cpsw_fck_ops);
  536. /* gpio */
  537. static const char *gpio0_ck_parents[] = {
  538. "clk_rc32k_ck", "clk_32768_ck", "clkdiv32k_ick",
  539. };
  540. static const struct clksel gpio0_dbclk_mux_sel[] = {
  541. { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
  542. { .parent = &clk_32768_ck, .rates = div_1_1_rates },
  543. { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
  544. { .parent = NULL },
  545. };
  546. static const struct clk_ops gpio_fck_ops = {
  547. .recalc_rate = &omap2_clksel_recalc,
  548. .get_parent = &omap2_clksel_find_parent_index,
  549. .set_parent = &omap2_clksel_set_parent,
  550. .init = &omap2_init_clk_clkdm,
  551. };
  552. static struct clk gpio0_dbclk_mux_ck;
  553. static struct clk_hw_omap gpio0_dbclk_mux_ck_hw = {
  554. .hw = {
  555. .clk = &gpio0_dbclk_mux_ck,
  556. },
  557. .clkdm_name = "l4_wkup_clkdm",
  558. .clksel = gpio0_dbclk_mux_sel,
  559. .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
  560. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  561. };
  562. DEFINE_STRUCT_CLK(gpio0_dbclk_mux_ck, gpio0_ck_parents, gpio_fck_ops);
  563. DEFINE_CLK_GATE(gpio0_dbclk, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, 0x0,
  564. AM33XX_CM_WKUP_GPIO0_CLKCTRL,
  565. AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT, 0x0, NULL);
  566. DEFINE_CLK_GATE(gpio1_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
  567. AM33XX_CM_PER_GPIO1_CLKCTRL,
  568. AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT, 0x0, NULL);
  569. DEFINE_CLK_GATE(gpio2_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
  570. AM33XX_CM_PER_GPIO2_CLKCTRL,
  571. AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT, 0x0, NULL);
  572. DEFINE_CLK_GATE(gpio3_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
  573. AM33XX_CM_PER_GPIO3_CLKCTRL,
  574. AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, 0x0, NULL);
  575. static const char *pruss_ck_parents[] = {
  576. "l3_gclk", "dpll_disp_m2_ck",
  577. };
  578. static const struct clksel pruss_ocp_clk_mux_sel[] = {
  579. { .parent = &l3_gclk, .rates = div_1_0_rates },
  580. { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
  581. { .parent = NULL },
  582. };
  583. static struct clk pruss_ocp_gclk;
  584. static struct clk_hw_omap pruss_ocp_gclk_hw = {
  585. .hw = {
  586. .clk = &pruss_ocp_gclk,
  587. },
  588. .clkdm_name = "pruss_ocp_clkdm",
  589. .clksel = pruss_ocp_clk_mux_sel,
  590. .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
  591. .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
  592. };
  593. DEFINE_STRUCT_CLK(pruss_ocp_gclk, pruss_ck_parents, gpio_fck_ops);
  594. static const char *lcd_ck_parents[] = {
  595. "dpll_disp_m2_ck", "dpll_core_m5_ck", "dpll_per_m2_ck",
  596. };
  597. static const struct clksel lcd_clk_mux_sel[] = {
  598. { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
  599. { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
  600. { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
  601. { .parent = NULL },
  602. };
  603. static struct clk lcd_gclk;
  604. static struct clk_hw_omap lcd_gclk_hw = {
  605. .hw = {
  606. .clk = &lcd_gclk,
  607. },
  608. .clkdm_name = "lcdc_clkdm",
  609. .clksel = lcd_clk_mux_sel,
  610. .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
  611. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  612. };
  613. DEFINE_STRUCT_CLK_FLAGS(lcd_gclk, lcd_ck_parents,
  614. gpio_fck_ops, CLK_SET_RATE_PARENT);
  615. DEFINE_CLK_FIXED_FACTOR(mmc_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1, 2);
  616. static const char *gfx_ck_parents[] = {
  617. "dpll_core_m4_ck", "dpll_per_m2_ck",
  618. };
  619. static const struct clksel gfx_clksel_sel[] = {
  620. { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
  621. { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
  622. { .parent = NULL },
  623. };
  624. static struct clk gfx_fclk_clksel_ck;
  625. static struct clk_hw_omap gfx_fclk_clksel_ck_hw = {
  626. .hw = {
  627. .clk = &gfx_fclk_clksel_ck,
  628. },
  629. .clksel = gfx_clksel_sel,
  630. .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
  631. .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
  632. };
  633. DEFINE_STRUCT_CLK(gfx_fclk_clksel_ck, gfx_ck_parents, gpio_fck_ops);
  634. static const struct clk_div_table div_1_0_2_1_rates[] = {
  635. { .div = 1, .val = 0, },
  636. { .div = 2, .val = 1, },
  637. { .div = 0 },
  638. };
  639. DEFINE_CLK_DIVIDER_TABLE(gfx_fck_div_ck, "gfx_fclk_clksel_ck",
  640. &gfx_fclk_clksel_ck, 0x0, AM33XX_CLKSEL_GFX_FCLK,
  641. AM33XX_CLKSEL_0_0_SHIFT, AM33XX_CLKSEL_0_0_WIDTH,
  642. 0x0, div_1_0_2_1_rates, NULL);
  643. static const char *sysclkout_ck_parents[] = {
  644. "clk_32768_ck", "l3_gclk", "dpll_ddr_m2_ck", "dpll_per_m2_ck",
  645. "lcd_gclk",
  646. };
  647. static const struct clksel sysclkout_pre_sel[] = {
  648. { .parent = &clk_32768_ck, .rates = div_1_0_rates },
  649. { .parent = &l3_gclk, .rates = div_1_1_rates },
  650. { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
  651. { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
  652. { .parent = &lcd_gclk, .rates = div_1_4_rates },
  653. { .parent = NULL },
  654. };
  655. static struct clk sysclkout_pre_ck;
  656. static struct clk_hw_omap sysclkout_pre_ck_hw = {
  657. .hw = {
  658. .clk = &sysclkout_pre_ck,
  659. },
  660. .clksel = sysclkout_pre_sel,
  661. .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
  662. .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
  663. };
  664. DEFINE_STRUCT_CLK(sysclkout_pre_ck, sysclkout_ck_parents, gpio_fck_ops);
  665. /* Divide by 8 clock rates with default clock is 1/1*/
  666. static const struct clk_div_table div8_rates[] = {
  667. { .div = 1, .val = 0, },
  668. { .div = 2, .val = 1, },
  669. { .div = 3, .val = 2, },
  670. { .div = 4, .val = 3, },
  671. { .div = 5, .val = 4, },
  672. { .div = 6, .val = 5, },
  673. { .div = 7, .val = 6, },
  674. { .div = 8, .val = 7, },
  675. { .div = 0 },
  676. };
  677. DEFINE_CLK_DIVIDER_TABLE(clkout2_div_ck, "sysclkout_pre_ck", &sysclkout_pre_ck,
  678. 0x0, AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2DIV_SHIFT,
  679. AM33XX_CLKOUT2DIV_WIDTH, 0x0, div8_rates, NULL);
  680. DEFINE_CLK_GATE(clkout2_ck, "clkout2_div_ck", &clkout2_div_ck, 0x0,
  681. AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2EN_SHIFT, 0x0, NULL);
  682. static const char *wdt_ck_parents[] = {
  683. "clk_rc32k_ck", "clkdiv32k_ick",
  684. };
  685. static const struct clksel wdt_clkmux_sel[] = {
  686. { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
  687. { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
  688. { .parent = NULL },
  689. };
  690. static struct clk wdt1_fck;
  691. static struct clk_hw_omap wdt1_fck_hw = {
  692. .hw = {
  693. .clk = &wdt1_fck,
  694. },
  695. .clkdm_name = "l4_wkup_clkdm",
  696. .clksel = wdt_clkmux_sel,
  697. .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
  698. .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
  699. };
  700. DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
  701. static const char *pwmss_clk_parents[] = {
  702. "dpll_per_m2_ck",
  703. };
  704. static const struct clk_ops ehrpwm_tbclk_ops = {
  705. .enable = &omap2_dflt_clk_enable,
  706. .disable = &omap2_dflt_clk_disable,
  707. };
  708. DEFINE_CLK_OMAP_MUX_GATE(ehrpwm0_tbclk, "l4ls_clkdm",
  709. NULL, NULL, 0,
  710. AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
  711. AM33XX_PWMSS0_TBCLKEN_SHIFT,
  712. NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
  713. DEFINE_CLK_OMAP_MUX_GATE(ehrpwm1_tbclk, "l4ls_clkdm",
  714. NULL, NULL, 0,
  715. AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
  716. AM33XX_PWMSS1_TBCLKEN_SHIFT,
  717. NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
  718. DEFINE_CLK_OMAP_MUX_GATE(ehrpwm2_tbclk, "l4ls_clkdm",
  719. NULL, NULL, 0,
  720. AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
  721. AM33XX_PWMSS2_TBCLKEN_SHIFT,
  722. NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
  723. /*
  724. * clkdev
  725. */
  726. static struct omap_clk am33xx_clks[] = {
  727. CLK(NULL, "clk_32768_ck", &clk_32768_ck),
  728. CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck),
  729. CLK(NULL, "virt_19200000_ck", &virt_19200000_ck),
  730. CLK(NULL, "virt_24000000_ck", &virt_24000000_ck),
  731. CLK(NULL, "virt_25000000_ck", &virt_25000000_ck),
  732. CLK(NULL, "virt_26000000_ck", &virt_26000000_ck),
  733. CLK(NULL, "sys_clkin_ck", &sys_clkin_ck),
  734. CLK(NULL, "tclkin_ck", &tclkin_ck),
  735. CLK(NULL, "dpll_core_ck", &dpll_core_ck),
  736. CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck),
  737. CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck),
  738. CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck),
  739. CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck),
  740. CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck),
  741. CLK("cpu0", NULL, &dpll_mpu_ck),
  742. CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck),
  743. CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck),
  744. CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck),
  745. CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck),
  746. CLK(NULL, "dpll_disp_ck", &dpll_disp_ck),
  747. CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck),
  748. CLK(NULL, "dpll_per_ck", &dpll_per_ck),
  749. CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck),
  750. CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck),
  751. CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck),
  752. CLK(NULL, "adc_tsc_fck", &adc_tsc_fck),
  753. CLK(NULL, "cefuse_fck", &cefuse_fck),
  754. CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck),
  755. CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick),
  756. CLK(NULL, "dcan0_fck", &dcan0_fck),
  757. CLK("481cc000.d_can", NULL, &dcan0_fck),
  758. CLK(NULL, "dcan1_fck", &dcan1_fck),
  759. CLK("481d0000.d_can", NULL, &dcan1_fck),
  760. CLK(NULL, "debugss_ick", &debugss_ick),
  761. CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk),
  762. CLK(NULL, "mcasp0_fck", &mcasp0_fck),
  763. CLK(NULL, "mcasp1_fck", &mcasp1_fck),
  764. CLK(NULL, "mmu_fck", &mmu_fck),
  765. CLK(NULL, "smartreflex0_fck", &smartreflex0_fck),
  766. CLK(NULL, "smartreflex1_fck", &smartreflex1_fck),
  767. CLK(NULL, "sha0_fck", &sha0_fck),
  768. CLK(NULL, "aes0_fck", &aes0_fck),
  769. CLK(NULL, "timer1_fck", &timer1_fck),
  770. CLK(NULL, "timer2_fck", &timer2_fck),
  771. CLK(NULL, "timer3_fck", &timer3_fck),
  772. CLK(NULL, "timer4_fck", &timer4_fck),
  773. CLK(NULL, "timer5_fck", &timer5_fck),
  774. CLK(NULL, "timer6_fck", &timer6_fck),
  775. CLK(NULL, "timer7_fck", &timer7_fck),
  776. CLK(NULL, "usbotg_fck", &usbotg_fck),
  777. CLK(NULL, "ieee5000_fck", &ieee5000_fck),
  778. CLK(NULL, "wdt1_fck", &wdt1_fck),
  779. CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk),
  780. CLK(NULL, "l3_gclk", &l3_gclk),
  781. CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck),
  782. CLK(NULL, "l4hs_gclk", &l4hs_gclk),
  783. CLK(NULL, "l3s_gclk", &l3s_gclk),
  784. CLK(NULL, "l4fw_gclk", &l4fw_gclk),
  785. CLK(NULL, "l4ls_gclk", &l4ls_gclk),
  786. CLK(NULL, "clk_24mhz", &clk_24mhz),
  787. CLK(NULL, "sysclk_div_ck", &sysclk_div_ck),
  788. CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk),
  789. CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk),
  790. CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck),
  791. CLK(NULL, "gpio0_dbclk", &gpio0_dbclk),
  792. CLK(NULL, "gpio1_dbclk", &gpio1_dbclk),
  793. CLK(NULL, "gpio2_dbclk", &gpio2_dbclk),
  794. CLK(NULL, "gpio3_dbclk", &gpio3_dbclk),
  795. CLK(NULL, "lcd_gclk", &lcd_gclk),
  796. CLK(NULL, "mmc_clk", &mmc_clk),
  797. CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck),
  798. CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck),
  799. CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck),
  800. CLK(NULL, "clkout2_div_ck", &clkout2_div_ck),
  801. CLK(NULL, "timer_32k_ck", &clkdiv32k_ick),
  802. CLK(NULL, "timer_sys_ck", &sys_clkin_ck),
  803. CLK("48300200.ehrpwm", "tbclk", &ehrpwm0_tbclk),
  804. CLK("48302200.ehrpwm", "tbclk", &ehrpwm1_tbclk),
  805. CLK("48304200.ehrpwm", "tbclk", &ehrpwm2_tbclk),
  806. };
  807. static const char *enable_init_clks[] = {
  808. "dpll_ddr_m2_ck",
  809. "dpll_mpu_m2_ck",
  810. "l3_gclk",
  811. "l4hs_gclk",
  812. "l4fw_gclk",
  813. "l4ls_gclk",
  814. };
  815. int __init am33xx_clk_init(void)
  816. {
  817. if (soc_is_am33xx())
  818. cpu_mask = RATE_IN_AM33XX;
  819. omap_clocks_register(am33xx_clks, ARRAY_SIZE(am33xx_clks));
  820. omap2_clk_disable_autoidle_all();
  821. omap2_clk_enable_init_clocks(enable_init_clks,
  822. ARRAY_SIZE(enable_init_clks));
  823. /* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
  824. * physically present, in such a case HWMOD enabling of
  825. * clock would be failure with default parent. And timer
  826. * probe thinks clock is already enabled, this leads to
  827. * crash upon accessing timer 3 & 6 registers in probe.
  828. * Fix by setting parent of both these timers to master
  829. * oscillator clock.
  830. */
  831. clk_set_parent(&timer3_fck, &sys_clkin_ck);
  832. clk_set_parent(&timer6_fck, &sys_clkin_ck);
  833. /*
  834. * The On-Chip 32K RC Osc clock is not an accurate clock-source as per
  835. * the design/spec, so as a result, for example, timer which supposed
  836. * to get expired @60Sec, but will expire somewhere ~@40Sec, which is
  837. * not expected by any use-case, so change WDT1 clock source to PRCM
  838. * 32KHz clock.
  839. */
  840. clk_set_parent(&wdt1_fck, &clkdiv32k_ick);
  841. return 0;
  842. }