clock34xx.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. /*
  2. * OMAP3-specific clock framework functions
  3. *
  4. * Copyright (C) 2007-2008 Texas Instruments, Inc.
  5. * Copyright (C) 2007-2008 Nokia Corporation
  6. *
  7. * Written by Paul Walmsley
  8. * Testing and integration fixes by Jouni Högander
  9. *
  10. * Parts of this code are based on code written by
  11. * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #undef DEBUG
  18. #include <linux/module.h>
  19. #include <linux/kernel.h>
  20. #include <linux/device.h>
  21. #include <linux/list.h>
  22. #include <linux/errno.h>
  23. #include <linux/delay.h>
  24. #include <linux/clk.h>
  25. #include <linux/io.h>
  26. #include <linux/limits.h>
  27. #include <linux/bitops.h>
  28. #include <mach/clock.h>
  29. #include <mach/sram.h>
  30. #include <asm/div64.h>
  31. #include <asm/clkdev.h>
  32. #include <mach/sdrc.h>
  33. #include "clock.h"
  34. #include "prm.h"
  35. #include "prm-regbits-34xx.h"
  36. #include "cm.h"
  37. #include "cm-regbits-34xx.h"
  38. static const struct clkops clkops_noncore_dpll_ops;
  39. #include "clock34xx.h"
  40. struct omap_clk {
  41. u32 cpu;
  42. struct clk_lookup lk;
  43. };
  44. #define CLK(dev, con, ck, cp) \
  45. { \
  46. .cpu = cp, \
  47. .lk = { \
  48. .dev_id = dev, \
  49. .con_id = con, \
  50. .clk = ck, \
  51. }, \
  52. }
  53. #define CK_343X (1 << 0)
  54. #define CK_3430ES1 (1 << 1)
  55. #define CK_3430ES2 (1 << 2)
  56. static struct omap_clk omap34xx_clks[] = {
  57. CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_343X),
  58. CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_343X),
  59. CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_343X),
  60. CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2),
  61. CLK(NULL, "virt_19_2m_ck", &virt_19_2m_ck, CK_343X),
  62. CLK(NULL, "virt_26m_ck", &virt_26m_ck, CK_343X),
  63. CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_343X),
  64. CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_343X),
  65. CLK(NULL, "sys_ck", &sys_ck, CK_343X),
  66. CLK(NULL, "sys_altclk", &sys_altclk, CK_343X),
  67. CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_343X),
  68. CLK(NULL, "sys_clkout1", &sys_clkout1, CK_343X),
  69. CLK(NULL, "dpll1_ck", &dpll1_ck, CK_343X),
  70. CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_343X),
  71. CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_343X),
  72. CLK(NULL, "dpll2_ck", &dpll2_ck, CK_343X),
  73. CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_343X),
  74. CLK(NULL, "dpll3_ck", &dpll3_ck, CK_343X),
  75. CLK(NULL, "core_ck", &core_ck, CK_343X),
  76. CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_343X),
  77. CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_343X),
  78. CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X),
  79. CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_343X),
  80. CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X),
  81. CLK(NULL, "emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
  82. CLK(NULL, "dpll4_ck", &dpll4_ck, CK_343X),
  83. CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_343X),
  84. CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X),
  85. CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_343X),
  86. CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_343X),
  87. CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_343X),
  88. CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_343X),
  89. CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_343X),
  90. CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_343X),
  91. CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_343X),
  92. CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_343X),
  93. CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_343X),
  94. CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_343X),
  95. CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_343X),
  96. CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_343X),
  97. CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X),
  98. CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_343X),
  99. CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X),
  100. CLK(NULL, "emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
  101. CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2),
  102. CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2),
  103. CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_343X),
  104. CLK(NULL, "sys_clkout2", &sys_clkout2, CK_343X),
  105. CLK(NULL, "corex2_fck", &corex2_fck, CK_343X),
  106. CLK(NULL, "dpll1_fck", &dpll1_fck, CK_343X),
  107. CLK(NULL, "mpu_ck", &mpu_ck, CK_343X),
  108. CLK(NULL, "arm_fck", &arm_fck, CK_343X),
  109. CLK(NULL, "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
  110. CLK(NULL, "dpll2_fck", &dpll2_fck, CK_343X),
  111. CLK(NULL, "iva2_ck", &iva2_ck, CK_343X),
  112. CLK(NULL, "l3_ick", &l3_ick, CK_343X),
  113. CLK(NULL, "l4_ick", &l4_ick, CK_343X),
  114. CLK(NULL, "rm_ick", &rm_ick, CK_343X),
  115. CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
  116. CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
  117. CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
  118. CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
  119. CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
  120. CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2),
  121. CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2),
  122. CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
  123. CLK(NULL, "gpt10_fck", &gpt10_fck, CK_343X),
  124. CLK(NULL, "gpt11_fck", &gpt11_fck, CK_343X),
  125. CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2),
  126. CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2),
  127. CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2),
  128. CLK(NULL, "core_96m_fck", &core_96m_fck, CK_343X),
  129. CLK("mmci-omap-hs.2", "fck", &mmchs3_fck, CK_3430ES2),
  130. CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_343X),
  131. CLK(NULL, "mspro_fck", &mspro_fck, CK_343X),
  132. CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_343X),
  133. CLK("i2c_omap.3", "fck", &i2c3_fck, CK_343X),
  134. CLK("i2c_omap.2", "fck", &i2c2_fck, CK_343X),
  135. CLK("i2c_omap.1", "fck", &i2c1_fck, CK_343X),
  136. CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_343X),
  137. CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_343X),
  138. CLK(NULL, "core_48m_fck", &core_48m_fck, CK_343X),
  139. CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_343X),
  140. CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_343X),
  141. CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_343X),
  142. CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_343X),
  143. CLK(NULL, "uart2_fck", &uart2_fck, CK_343X),
  144. CLK(NULL, "uart1_fck", &uart1_fck, CK_343X),
  145. CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
  146. CLK(NULL, "core_12m_fck", &core_12m_fck, CK_343X),
  147. CLK("omap_hdq.0", "fck", &hdq_fck, CK_343X),
  148. CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck, CK_343X),
  149. CLK(NULL, "ssi_sst_fck", &ssi_sst_fck, CK_343X),
  150. CLK(NULL, "core_l3_ick", &core_l3_ick, CK_343X),
  151. CLK("musb_hdrc", "ick", &hsotgusb_ick, CK_343X),
  152. CLK(NULL, "sdrc_ick", &sdrc_ick, CK_343X),
  153. CLK(NULL, "gpmc_fck", &gpmc_fck, CK_343X),
  154. CLK(NULL, "security_l3_ick", &security_l3_ick, CK_343X),
  155. CLK(NULL, "pka_ick", &pka_ick, CK_343X),
  156. CLK(NULL, "core_l4_ick", &core_l4_ick, CK_343X),
  157. CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2),
  158. CLK("mmci-omap-hs.2", "ick", &mmchs3_ick, CK_3430ES2),
  159. CLK(NULL, "icr_ick", &icr_ick, CK_343X),
  160. CLK(NULL, "aes2_ick", &aes2_ick, CK_343X),
  161. CLK(NULL, "sha12_ick", &sha12_ick, CK_343X),
  162. CLK(NULL, "des2_ick", &des2_ick, CK_343X),
  163. CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_343X),
  164. CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_343X),
  165. CLK(NULL, "mspro_ick", &mspro_ick, CK_343X),
  166. CLK("omap_hdq.0", "ick", &hdq_ick, CK_343X),
  167. CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_343X),
  168. CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_343X),
  169. CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_343X),
  170. CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_343X),
  171. CLK("i2c_omap.3", "ick", &i2c3_ick, CK_343X),
  172. CLK("i2c_omap.2", "ick", &i2c2_ick, CK_343X),
  173. CLK("i2c_omap.1", "ick", &i2c1_ick, CK_343X),
  174. CLK(NULL, "uart2_ick", &uart2_ick, CK_343X),
  175. CLK(NULL, "uart1_ick", &uart1_ick, CK_343X),
  176. CLK(NULL, "gpt11_ick", &gpt11_ick, CK_343X),
  177. CLK(NULL, "gpt10_ick", &gpt10_ick, CK_343X),
  178. CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_343X),
  179. CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_343X),
  180. CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
  181. CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X),
  182. CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X),
  183. CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_343X),
  184. CLK(NULL, "ssi_ick", &ssi_ick, CK_343X),
  185. CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
  186. CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_343X),
  187. CLK(NULL, "aes1_ick", &aes1_ick, CK_343X),
  188. CLK("omap_rng", "ick", &rng_ick, CK_343X),
  189. CLK(NULL, "sha11_ick", &sha11_ick, CK_343X),
  190. CLK(NULL, "des1_ick", &des1_ick, CK_343X),
  191. CLK("omapfb", "dss1_fck", &dss1_alwon_fck, CK_343X),
  192. CLK("omapfb", "tv_fck", &dss_tv_fck, CK_343X),
  193. CLK("omapfb", "video_fck", &dss_96m_fck, CK_343X),
  194. CLK("omapfb", "dss2_fck", &dss2_alwon_fck, CK_343X),
  195. CLK("omapfb", "ick", &dss_ick, CK_343X),
  196. CLK(NULL, "cam_mclk", &cam_mclk, CK_343X),
  197. CLK(NULL, "cam_ick", &cam_ick, CK_343X),
  198. CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_343X),
  199. CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2),
  200. CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2),
  201. CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2),
  202. CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2),
  203. CLK(NULL, "gpt1_fck", &gpt1_fck, CK_343X),
  204. CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_343X),
  205. CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_343X),
  206. CLK("omap_wdt", "fck", &wdt2_fck, CK_343X),
  207. CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_343X),
  208. CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2),
  209. CLK("omap_wdt", "ick", &wdt2_ick, CK_343X),
  210. CLK(NULL, "wdt1_ick", &wdt1_ick, CK_343X),
  211. CLK(NULL, "gpio1_ick", &gpio1_ick, CK_343X),
  212. CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
  213. CLK(NULL, "gpt12_ick", &gpt12_ick, CK_343X),
  214. CLK(NULL, "gpt1_ick", &gpt1_ick, CK_343X),
  215. CLK(NULL, "per_96m_fck", &per_96m_fck, CK_343X),
  216. CLK(NULL, "per_48m_fck", &per_48m_fck, CK_343X),
  217. CLK(NULL, "uart3_fck", &uart3_fck, CK_343X),
  218. CLK(NULL, "gpt2_fck", &gpt2_fck, CK_343X),
  219. CLK(NULL, "gpt3_fck", &gpt3_fck, CK_343X),
  220. CLK(NULL, "gpt4_fck", &gpt4_fck, CK_343X),
  221. CLK(NULL, "gpt5_fck", &gpt5_fck, CK_343X),
  222. CLK(NULL, "gpt6_fck", &gpt6_fck, CK_343X),
  223. CLK(NULL, "gpt7_fck", &gpt7_fck, CK_343X),
  224. CLK(NULL, "gpt8_fck", &gpt8_fck, CK_343X),
  225. CLK(NULL, "gpt9_fck", &gpt9_fck, CK_343X),
  226. CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_343X),
  227. CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_343X),
  228. CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_343X),
  229. CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_343X),
  230. CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_343X),
  231. CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_343X),
  232. CLK(NULL, "wdt3_fck", &wdt3_fck, CK_343X),
  233. CLK(NULL, "per_l4_ick", &per_l4_ick, CK_343X),
  234. CLK(NULL, "gpio6_ick", &gpio6_ick, CK_343X),
  235. CLK(NULL, "gpio5_ick", &gpio5_ick, CK_343X),
  236. CLK(NULL, "gpio4_ick", &gpio4_ick, CK_343X),
  237. CLK(NULL, "gpio3_ick", &gpio3_ick, CK_343X),
  238. CLK(NULL, "gpio2_ick", &gpio2_ick, CK_343X),
  239. CLK(NULL, "wdt3_ick", &wdt3_ick, CK_343X),
  240. CLK(NULL, "uart3_ick", &uart3_ick, CK_343X),
  241. CLK(NULL, "gpt9_ick", &gpt9_ick, CK_343X),
  242. CLK(NULL, "gpt8_ick", &gpt8_ick, CK_343X),
  243. CLK(NULL, "gpt7_ick", &gpt7_ick, CK_343X),
  244. CLK(NULL, "gpt6_ick", &gpt6_ick, CK_343X),
  245. CLK(NULL, "gpt5_ick", &gpt5_ick, CK_343X),
  246. CLK(NULL, "gpt4_ick", &gpt4_ick, CK_343X),
  247. CLK(NULL, "gpt3_ick", &gpt3_ick, CK_343X),
  248. CLK(NULL, "gpt2_ick", &gpt2_ick, CK_343X),
  249. CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_343X),
  250. CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_343X),
  251. CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_343X),
  252. CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_343X),
  253. CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_343X),
  254. CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_343X),
  255. CLK(NULL, "emu_src_ck", &emu_src_ck, CK_343X),
  256. CLK(NULL, "pclk_fck", &pclk_fck, CK_343X),
  257. CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X),
  258. CLK(NULL, "atclk_fck", &atclk_fck, CK_343X),
  259. CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_343X),
  260. CLK(NULL, "traceclk_fck", &traceclk_fck, CK_343X),
  261. CLK(NULL, "sr1_fck", &sr1_fck, CK_343X),
  262. CLK(NULL, "sr2_fck", &sr2_fck, CK_343X),
  263. CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_343X),
  264. CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_343X),
  265. CLK(NULL, "gpt12_fck", &gpt12_fck, CK_343X),
  266. CLK(NULL, "wdt1_fck", &wdt1_fck, CK_343X),
  267. };
  268. /* CM_AUTOIDLE_PLL*.AUTO_* bit values */
  269. #define DPLL_AUTOIDLE_DISABLE 0x0
  270. #define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
  271. #define MAX_DPLL_WAIT_TRIES 1000000
  272. /**
  273. * omap3_dpll_recalc - recalculate DPLL rate
  274. * @clk: DPLL struct clk
  275. *
  276. * Recalculate and propagate the DPLL rate.
  277. */
  278. static unsigned long omap3_dpll_recalc(struct clk *clk)
  279. {
  280. return omap2_get_dpll_rate(clk);
  281. }
  282. /* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
  283. static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
  284. {
  285. const struct dpll_data *dd;
  286. u32 v;
  287. dd = clk->dpll_data;
  288. v = __raw_readl(dd->control_reg);
  289. v &= ~dd->enable_mask;
  290. v |= clken_bits << __ffs(dd->enable_mask);
  291. __raw_writel(v, dd->control_reg);
  292. }
  293. /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
  294. static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
  295. {
  296. const struct dpll_data *dd;
  297. int i = 0;
  298. int ret = -EINVAL;
  299. dd = clk->dpll_data;
  300. state <<= __ffs(dd->idlest_mask);
  301. while (((__raw_readl(dd->idlest_reg) & dd->idlest_mask) != state) &&
  302. i < MAX_DPLL_WAIT_TRIES) {
  303. i++;
  304. udelay(1);
  305. }
  306. if (i == MAX_DPLL_WAIT_TRIES) {
  307. printk(KERN_ERR "clock: %s failed transition to '%s'\n",
  308. clk->name, (state) ? "locked" : "bypassed");
  309. } else {
  310. pr_debug("clock: %s transition to '%s' in %d loops\n",
  311. clk->name, (state) ? "locked" : "bypassed", i);
  312. ret = 0;
  313. }
  314. return ret;
  315. }
  316. /* From 3430 TRM ES2 4.7.6.2 */
  317. static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
  318. {
  319. unsigned long fint;
  320. u16 f = 0;
  321. fint = clk->dpll_data->clk_ref->rate / (n + 1);
  322. pr_debug("clock: fint is %lu\n", fint);
  323. if (fint >= 750000 && fint <= 1000000)
  324. f = 0x3;
  325. else if (fint > 1000000 && fint <= 1250000)
  326. f = 0x4;
  327. else if (fint > 1250000 && fint <= 1500000)
  328. f = 0x5;
  329. else if (fint > 1500000 && fint <= 1750000)
  330. f = 0x6;
  331. else if (fint > 1750000 && fint <= 2100000)
  332. f = 0x7;
  333. else if (fint > 7500000 && fint <= 10000000)
  334. f = 0xB;
  335. else if (fint > 10000000 && fint <= 12500000)
  336. f = 0xC;
  337. else if (fint > 12500000 && fint <= 15000000)
  338. f = 0xD;
  339. else if (fint > 15000000 && fint <= 17500000)
  340. f = 0xE;
  341. else if (fint > 17500000 && fint <= 21000000)
  342. f = 0xF;
  343. else
  344. pr_debug("clock: unknown freqsel setting for %d\n", n);
  345. return f;
  346. }
  347. /* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
  348. /*
  349. * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
  350. * @clk: pointer to a DPLL struct clk
  351. *
  352. * Instructs a non-CORE DPLL to lock. Waits for the DPLL to report
  353. * readiness before returning. Will save and restore the DPLL's
  354. * autoidle state across the enable, per the CDP code. If the DPLL
  355. * locked successfully, return 0; if the DPLL did not lock in the time
  356. * allotted, or DPLL3 was passed in, return -EINVAL.
  357. */
  358. static int _omap3_noncore_dpll_lock(struct clk *clk)
  359. {
  360. u8 ai;
  361. int r;
  362. if (clk == &dpll3_ck)
  363. return -EINVAL;
  364. pr_debug("clock: locking DPLL %s\n", clk->name);
  365. ai = omap3_dpll_autoidle_read(clk);
  366. omap3_dpll_deny_idle(clk);
  367. _omap3_dpll_write_clken(clk, DPLL_LOCKED);
  368. r = _omap3_wait_dpll_status(clk, 1);
  369. if (ai)
  370. omap3_dpll_allow_idle(clk);
  371. return r;
  372. }
  373. /*
  374. * _omap3_noncore_dpll_bypass - instruct a DPLL to bypass and wait for readiness
  375. * @clk: pointer to a DPLL struct clk
  376. *
  377. * Instructs a non-CORE DPLL to enter low-power bypass mode. In
  378. * bypass mode, the DPLL's rate is set equal to its parent clock's
  379. * rate. Waits for the DPLL to report readiness before returning.
  380. * Will save and restore the DPLL's autoidle state across the enable,
  381. * per the CDP code. If the DPLL entered bypass mode successfully,
  382. * return 0; if the DPLL did not enter bypass in the time allotted, or
  383. * DPLL3 was passed in, or the DPLL does not support low-power bypass,
  384. * return -EINVAL.
  385. */
  386. static int _omap3_noncore_dpll_bypass(struct clk *clk)
  387. {
  388. int r;
  389. u8 ai;
  390. if (clk == &dpll3_ck)
  391. return -EINVAL;
  392. if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
  393. return -EINVAL;
  394. pr_debug("clock: configuring DPLL %s for low-power bypass\n",
  395. clk->name);
  396. ai = omap3_dpll_autoidle_read(clk);
  397. _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_BYPASS);
  398. r = _omap3_wait_dpll_status(clk, 0);
  399. if (ai)
  400. omap3_dpll_allow_idle(clk);
  401. else
  402. omap3_dpll_deny_idle(clk);
  403. return r;
  404. }
  405. /*
  406. * _omap3_noncore_dpll_stop - instruct a DPLL to stop
  407. * @clk: pointer to a DPLL struct clk
  408. *
  409. * Instructs a non-CORE DPLL to enter low-power stop. Will save and
  410. * restore the DPLL's autoidle state across the stop, per the CDP
  411. * code. If DPLL3 was passed in, or the DPLL does not support
  412. * low-power stop, return -EINVAL; otherwise, return 0.
  413. */
  414. static int _omap3_noncore_dpll_stop(struct clk *clk)
  415. {
  416. u8 ai;
  417. if (clk == &dpll3_ck)
  418. return -EINVAL;
  419. if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
  420. return -EINVAL;
  421. pr_debug("clock: stopping DPLL %s\n", clk->name);
  422. ai = omap3_dpll_autoidle_read(clk);
  423. _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_STOP);
  424. if (ai)
  425. omap3_dpll_allow_idle(clk);
  426. else
  427. omap3_dpll_deny_idle(clk);
  428. return 0;
  429. }
  430. /**
  431. * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
  432. * @clk: pointer to a DPLL struct clk
  433. *
  434. * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
  435. * The choice of modes depends on the DPLL's programmed rate: if it is
  436. * the same as the DPLL's parent clock, it will enter bypass;
  437. * otherwise, it will enter lock. This code will wait for the DPLL to
  438. * indicate readiness before returning, unless the DPLL takes too long
  439. * to enter the target state. Intended to be used as the struct clk's
  440. * enable function. If DPLL3 was passed in, or the DPLL does not
  441. * support low-power stop, or if the DPLL took too long to enter
  442. * bypass or lock, return -EINVAL; otherwise, return 0.
  443. */
  444. static int omap3_noncore_dpll_enable(struct clk *clk)
  445. {
  446. int r;
  447. struct dpll_data *dd;
  448. if (clk == &dpll3_ck)
  449. return -EINVAL;
  450. dd = clk->dpll_data;
  451. if (!dd)
  452. return -EINVAL;
  453. if (clk->rate == dd->clk_bypass->rate) {
  454. WARN_ON(clk->parent != dd->clk_bypass);
  455. r = _omap3_noncore_dpll_bypass(clk);
  456. } else {
  457. WARN_ON(clk->parent != dd->clk_ref);
  458. r = _omap3_noncore_dpll_lock(clk);
  459. }
  460. /* FIXME: this is dubious - if clk->rate has changed, what about propagating? */
  461. if (!r)
  462. clk->rate = omap2_get_dpll_rate(clk);
  463. return r;
  464. }
  465. /**
  466. * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
  467. * @clk: pointer to a DPLL struct clk
  468. *
  469. * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
  470. * The choice of modes depends on the DPLL's programmed rate: if it is
  471. * the same as the DPLL's parent clock, it will enter bypass;
  472. * otherwise, it will enter lock. This code will wait for the DPLL to
  473. * indicate readiness before returning, unless the DPLL takes too long
  474. * to enter the target state. Intended to be used as the struct clk's
  475. * enable function. If DPLL3 was passed in, or the DPLL does not
  476. * support low-power stop, or if the DPLL took too long to enter
  477. * bypass or lock, return -EINVAL; otherwise, return 0.
  478. */
  479. static void omap3_noncore_dpll_disable(struct clk *clk)
  480. {
  481. if (clk == &dpll3_ck)
  482. return;
  483. _omap3_noncore_dpll_stop(clk);
  484. }
  485. /* Non-CORE DPLL rate set code */
  486. /*
  487. * omap3_noncore_dpll_program - set non-core DPLL M,N values directly
  488. * @clk: struct clk * of DPLL to set
  489. * @m: DPLL multiplier to set
  490. * @n: DPLL divider to set
  491. * @freqsel: FREQSEL value to set
  492. *
  493. * Program the DPLL with the supplied M, N values, and wait for the DPLL to
  494. * lock.. Returns -EINVAL upon error, or 0 upon success.
  495. */
  496. static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
  497. {
  498. struct dpll_data *dd = clk->dpll_data;
  499. u32 v;
  500. /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */
  501. _omap3_noncore_dpll_bypass(clk);
  502. /* Set jitter correction */
  503. v = __raw_readl(dd->control_reg);
  504. v &= ~dd->freqsel_mask;
  505. v |= freqsel << __ffs(dd->freqsel_mask);
  506. __raw_writel(v, dd->control_reg);
  507. /* Set DPLL multiplier, divider */
  508. v = __raw_readl(dd->mult_div1_reg);
  509. v &= ~(dd->mult_mask | dd->div1_mask);
  510. v |= m << __ffs(dd->mult_mask);
  511. v |= (n - 1) << __ffs(dd->div1_mask);
  512. __raw_writel(v, dd->mult_div1_reg);
  513. /* We let the clock framework set the other output dividers later */
  514. /* REVISIT: Set ramp-up delay? */
  515. _omap3_noncore_dpll_lock(clk);
  516. return 0;
  517. }
  518. /**
  519. * omap3_noncore_dpll_set_rate - set non-core DPLL rate
  520. * @clk: struct clk * of DPLL to set
  521. * @rate: rounded target rate
  522. *
  523. * Set the DPLL CLKOUT to the target rate. If the DPLL can enter
  524. * low-power bypass, and the target rate is the bypass source clock
  525. * rate, then configure the DPLL for bypass. Otherwise, round the
  526. * target rate if it hasn't been done already, then program and lock
  527. * the DPLL. Returns -EINVAL upon error, or 0 upon success.
  528. */
  529. static int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
  530. {
  531. struct clk *new_parent = NULL;
  532. u16 freqsel;
  533. struct dpll_data *dd;
  534. int ret;
  535. if (!clk || !rate)
  536. return -EINVAL;
  537. dd = clk->dpll_data;
  538. if (!dd)
  539. return -EINVAL;
  540. if (rate == omap2_get_dpll_rate(clk))
  541. return 0;
  542. /*
  543. * Ensure both the bypass and ref clocks are enabled prior to
  544. * doing anything; we need the bypass clock running to reprogram
  545. * the DPLL.
  546. */
  547. omap2_clk_enable(dd->clk_bypass);
  548. omap2_clk_enable(dd->clk_ref);
  549. if (dd->clk_bypass->rate == rate &&
  550. (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
  551. pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
  552. ret = _omap3_noncore_dpll_bypass(clk);
  553. if (!ret)
  554. new_parent = dd->clk_bypass;
  555. } else {
  556. if (dd->last_rounded_rate != rate)
  557. omap2_dpll_round_rate(clk, rate);
  558. if (dd->last_rounded_rate == 0)
  559. return -EINVAL;
  560. freqsel = _omap3_dpll_compute_freqsel(clk, dd->last_rounded_n);
  561. if (!freqsel)
  562. WARN_ON(1);
  563. pr_debug("clock: %s: set rate: locking rate to %lu.\n",
  564. clk->name, rate);
  565. ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
  566. dd->last_rounded_n, freqsel);
  567. if (!ret)
  568. new_parent = dd->clk_ref;
  569. }
  570. if (!ret) {
  571. /*
  572. * Switch the parent clock in the heirarchy, and make sure
  573. * that the new parent's usecount is correct. Note: we
  574. * enable the new parent before disabling the old to avoid
  575. * any unnecessary hardware disable->enable transitions.
  576. */
  577. if (clk->usecount) {
  578. omap2_clk_enable(new_parent);
  579. omap2_clk_disable(clk->parent);
  580. }
  581. clk_reparent(clk, new_parent);
  582. clk->rate = rate;
  583. }
  584. omap2_clk_disable(dd->clk_ref);
  585. omap2_clk_disable(dd->clk_bypass);
  586. return 0;
  587. }
  588. static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
  589. {
  590. /*
  591. * According to the 12-5 CDP code from TI, "Limitation 2.5"
  592. * on 3430ES1 prevents us from changing DPLL multipliers or dividers
  593. * on DPLL4.
  594. */
  595. if (omap_rev() == OMAP3430_REV_ES1_0) {
  596. printk(KERN_ERR "clock: DPLL4 cannot change rate due to "
  597. "silicon 'Limitation 2.5' on 3430ES1.\n");
  598. return -EINVAL;
  599. }
  600. return omap3_noncore_dpll_set_rate(clk, rate);
  601. }
  602. /*
  603. * CORE DPLL (DPLL3) rate programming functions
  604. *
  605. * These call into SRAM code to do the actual CM writes, since the SDRAM
  606. * is clocked from DPLL3.
  607. */
  608. /**
  609. * omap3_core_dpll_m2_set_rate - set CORE DPLL M2 divider
  610. * @clk: struct clk * of DPLL to set
  611. * @rate: rounded target rate
  612. *
  613. * Program the DPLL M2 divider with the rounded target rate. Returns
  614. * -EINVAL upon error, or 0 upon success.
  615. */
  616. static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
  617. {
  618. u32 new_div = 0;
  619. unsigned long validrate, sdrcrate;
  620. struct omap_sdrc_params *sp;
  621. if (!clk || !rate)
  622. return -EINVAL;
  623. if (clk != &dpll3_m2_ck)
  624. return -EINVAL;
  625. if (rate == clk->rate)
  626. return 0;
  627. validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
  628. if (validrate != rate)
  629. return -EINVAL;
  630. sdrcrate = sdrc_ick.rate;
  631. if (rate > clk->rate)
  632. sdrcrate <<= ((rate / clk->rate) - 1);
  633. else
  634. sdrcrate >>= ((clk->rate / rate) - 1);
  635. sp = omap2_sdrc_get_params(sdrcrate);
  636. if (!sp)
  637. return -EINVAL;
  638. pr_info("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
  639. validrate);
  640. pr_info("clock: SDRC timing params used: %08x %08x %08x\n",
  641. sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
  642. /* REVISIT: SRAM code doesn't support other M2 divisors yet */
  643. WARN_ON(new_div != 1 && new_div != 2);
  644. /* REVISIT: Add SDRC_MR changing to this code also */
  645. omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
  646. sp->actim_ctrlb, new_div);
  647. return 0;
  648. }
  649. static const struct clkops clkops_noncore_dpll_ops = {
  650. .enable = &omap3_noncore_dpll_enable,
  651. .disable = &omap3_noncore_dpll_disable,
  652. };
  653. /* DPLL autoidle read/set code */
  654. /**
  655. * omap3_dpll_autoidle_read - read a DPLL's autoidle bits
  656. * @clk: struct clk * of the DPLL to read
  657. *
  658. * Return the DPLL's autoidle bits, shifted down to bit 0. Returns
  659. * -EINVAL if passed a null pointer or if the struct clk does not
  660. * appear to refer to a DPLL.
  661. */
  662. static u32 omap3_dpll_autoidle_read(struct clk *clk)
  663. {
  664. const struct dpll_data *dd;
  665. u32 v;
  666. if (!clk || !clk->dpll_data)
  667. return -EINVAL;
  668. dd = clk->dpll_data;
  669. v = __raw_readl(dd->autoidle_reg);
  670. v &= dd->autoidle_mask;
  671. v >>= __ffs(dd->autoidle_mask);
  672. return v;
  673. }
  674. /**
  675. * omap3_dpll_allow_idle - enable DPLL autoidle bits
  676. * @clk: struct clk * of the DPLL to operate on
  677. *
  678. * Enable DPLL automatic idle control. This automatic idle mode
  679. * switching takes effect only when the DPLL is locked, at least on
  680. * OMAP3430. The DPLL will enter low-power stop when its downstream
  681. * clocks are gated. No return value.
  682. */
  683. static void omap3_dpll_allow_idle(struct clk *clk)
  684. {
  685. const struct dpll_data *dd;
  686. u32 v;
  687. if (!clk || !clk->dpll_data)
  688. return;
  689. dd = clk->dpll_data;
  690. /*
  691. * REVISIT: CORE DPLL can optionally enter low-power bypass
  692. * by writing 0x5 instead of 0x1. Add some mechanism to
  693. * optionally enter this mode.
  694. */
  695. v = __raw_readl(dd->autoidle_reg);
  696. v &= ~dd->autoidle_mask;
  697. v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
  698. __raw_writel(v, dd->autoidle_reg);
  699. }
  700. /**
  701. * omap3_dpll_deny_idle - prevent DPLL from automatically idling
  702. * @clk: struct clk * of the DPLL to operate on
  703. *
  704. * Disable DPLL automatic idle control. No return value.
  705. */
  706. static void omap3_dpll_deny_idle(struct clk *clk)
  707. {
  708. const struct dpll_data *dd;
  709. u32 v;
  710. if (!clk || !clk->dpll_data)
  711. return;
  712. dd = clk->dpll_data;
  713. v = __raw_readl(dd->autoidle_reg);
  714. v &= ~dd->autoidle_mask;
  715. v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
  716. __raw_writel(v, dd->autoidle_reg);
  717. }
  718. /* Clock control for DPLL outputs */
  719. /**
  720. * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
  721. * @clk: DPLL output struct clk
  722. *
  723. * Using parent clock DPLL data, look up DPLL state. If locked, set our
  724. * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
  725. */
  726. static unsigned long omap3_clkoutx2_recalc(struct clk *clk)
  727. {
  728. const struct dpll_data *dd;
  729. unsigned long rate;
  730. u32 v;
  731. struct clk *pclk;
  732. /* Walk up the parents of clk, looking for a DPLL */
  733. pclk = clk->parent;
  734. while (pclk && !pclk->dpll_data)
  735. pclk = pclk->parent;
  736. /* clk does not have a DPLL as a parent? */
  737. WARN_ON(!pclk);
  738. dd = pclk->dpll_data;
  739. WARN_ON(!dd->enable_mask);
  740. v = __raw_readl(dd->control_reg) & dd->enable_mask;
  741. v >>= __ffs(dd->enable_mask);
  742. if (v != OMAP3XXX_EN_DPLL_LOCKED)
  743. rate = clk->parent->rate;
  744. else
  745. rate = clk->parent->rate * 2;
  746. return rate;
  747. }
  748. /* Common clock code */
  749. /*
  750. * As it is structured now, this will prevent an OMAP2/3 multiboot
  751. * kernel from compiling. This will need further attention.
  752. */
  753. #if defined(CONFIG_ARCH_OMAP3)
  754. static struct clk_functions omap2_clk_functions = {
  755. .clk_enable = omap2_clk_enable,
  756. .clk_disable = omap2_clk_disable,
  757. .clk_round_rate = omap2_clk_round_rate,
  758. .clk_set_rate = omap2_clk_set_rate,
  759. .clk_set_parent = omap2_clk_set_parent,
  760. .clk_disable_unused = omap2_clk_disable_unused,
  761. };
  762. /*
  763. * Set clocks for bypass mode for reboot to work.
  764. */
  765. void omap2_clk_prepare_for_reboot(void)
  766. {
  767. /* REVISIT: Not ready for 343x */
  768. #if 0
  769. u32 rate;
  770. if (vclk == NULL || sclk == NULL)
  771. return;
  772. rate = clk_get_rate(sclk);
  773. clk_set_rate(vclk, rate);
  774. #endif
  775. }
  776. /* REVISIT: Move this init stuff out into clock.c */
  777. /*
  778. * Switch the MPU rate if specified on cmdline.
  779. * We cannot do this early until cmdline is parsed.
  780. */
  781. static int __init omap2_clk_arch_init(void)
  782. {
  783. if (!mpurate)
  784. return -EINVAL;
  785. /* REVISIT: not yet ready for 343x */
  786. #if 0
  787. if (clk_set_rate(&virt_prcm_set, mpurate))
  788. printk(KERN_ERR "Could not find matching MPU rate\n");
  789. #endif
  790. recalculate_root_clocks();
  791. printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL3/MPU): "
  792. "%ld.%01ld/%ld/%ld MHz\n",
  793. (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
  794. (core_ck.rate / 1000000), (dpll1_fck.rate / 1000000)) ;
  795. return 0;
  796. }
  797. arch_initcall(omap2_clk_arch_init);
  798. int __init omap2_clk_init(void)
  799. {
  800. /* struct prcm_config *prcm; */
  801. struct omap_clk *c;
  802. /* u32 clkrate; */
  803. u32 cpu_clkflg;
  804. if (cpu_is_omap34xx()) {
  805. cpu_mask = RATE_IN_343X;
  806. cpu_clkflg = CK_343X;
  807. /*
  808. * Update this if there are further clock changes between ES2
  809. * and production parts
  810. */
  811. if (omap_rev() == OMAP3430_REV_ES1_0) {
  812. /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
  813. cpu_clkflg |= CK_3430ES1;
  814. } else {
  815. cpu_mask |= RATE_IN_3430ES2;
  816. cpu_clkflg |= CK_3430ES2;
  817. }
  818. }
  819. clk_init(&omap2_clk_functions);
  820. for (c = omap34xx_clks; c < omap34xx_clks + ARRAY_SIZE(omap34xx_clks); c++)
  821. clk_init_one(c->lk.clk);
  822. for (c = omap34xx_clks; c < omap34xx_clks + ARRAY_SIZE(omap34xx_clks); c++)
  823. if (c->cpu & cpu_clkflg) {
  824. clkdev_add(&c->lk);
  825. clk_register(c->lk.clk);
  826. omap2_init_clk_clkdm(c->lk.clk);
  827. }
  828. /* REVISIT: Not yet ready for OMAP3 */
  829. #if 0
  830. /* Check the MPU rate set by bootloader */
  831. clkrate = omap2_get_dpll_rate_24xx(&dpll_ck);
  832. for (prcm = rate_table; prcm->mpu_speed; prcm++) {
  833. if (!(prcm->flags & cpu_mask))
  834. continue;
  835. if (prcm->xtal_speed != sys_ck.rate)
  836. continue;
  837. if (prcm->dpll_speed <= clkrate)
  838. break;
  839. }
  840. curr_prcm_set = prcm;
  841. #endif
  842. recalculate_root_clocks();
  843. printk(KERN_INFO "Clocking rate (Crystal/DPLL/ARM core): "
  844. "%ld.%01ld/%ld/%ld MHz\n",
  845. (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
  846. (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
  847. /*
  848. * Only enable those clocks we will need, let the drivers
  849. * enable other clocks as necessary
  850. */
  851. clk_enable_init_clocks();
  852. /* Avoid sleeping during omap2_clk_prepare_for_reboot() */
  853. /* REVISIT: not yet ready for 343x */
  854. #if 0
  855. vclk = clk_get(NULL, "virt_prcm_set");
  856. sclk = clk_get(NULL, "sys_ck");
  857. #endif
  858. return 0;
  859. }
  860. #endif