clk-s5pv210.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. /*
  2. * Copyright (c) 2013 Samsung Electronics Co., Ltd.
  3. * Author: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
  4. *
  5. * Based on clock drivers for S3C64xx and Exynos4 SoCs.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
  12. */
  13. #include <linux/clk-provider.h>
  14. #include <linux/of.h>
  15. #include <linux/of_address.h>
  16. #include <linux/syscore_ops.h>
  17. #include "clk.h"
  18. #include "clk-pll.h"
  19. #include <dt-bindings/clock/s5pv210.h>
  20. /* S5PC110/S5PV210 clock controller register offsets */
  21. #define APLL_LOCK 0x0000
  22. #define MPLL_LOCK 0x0008
  23. #define EPLL_LOCK 0x0010
  24. #define VPLL_LOCK 0x0020
  25. #define APLL_CON0 0x0100
  26. #define APLL_CON1 0x0104
  27. #define MPLL_CON 0x0108
  28. #define EPLL_CON0 0x0110
  29. #define EPLL_CON1 0x0114
  30. #define VPLL_CON 0x0120
  31. #define CLK_SRC0 0x0200
  32. #define CLK_SRC1 0x0204
  33. #define CLK_SRC2 0x0208
  34. #define CLK_SRC3 0x020c
  35. #define CLK_SRC4 0x0210
  36. #define CLK_SRC5 0x0214
  37. #define CLK_SRC6 0x0218
  38. #define CLK_SRC_MASK0 0x0280
  39. #define CLK_SRC_MASK1 0x0284
  40. #define CLK_DIV0 0x0300
  41. #define CLK_DIV1 0x0304
  42. #define CLK_DIV2 0x0308
  43. #define CLK_DIV3 0x030c
  44. #define CLK_DIV4 0x0310
  45. #define CLK_DIV5 0x0314
  46. #define CLK_DIV6 0x0318
  47. #define CLK_DIV7 0x031c
  48. #define CLK_GATE_MAIN0 0x0400
  49. #define CLK_GATE_MAIN1 0x0404
  50. #define CLK_GATE_MAIN2 0x0408
  51. #define CLK_GATE_PERI0 0x0420
  52. #define CLK_GATE_PERI1 0x0424
  53. #define CLK_GATE_SCLK0 0x0440
  54. #define CLK_GATE_SCLK1 0x0444
  55. #define CLK_GATE_IP0 0x0460
  56. #define CLK_GATE_IP1 0x0464
  57. #define CLK_GATE_IP2 0x0468
  58. #define CLK_GATE_IP3 0x046c
  59. #define CLK_GATE_IP4 0x0470
  60. #define CLK_GATE_BLOCK 0x0480
  61. #define CLK_GATE_IP5 0x0484
  62. #define CLK_OUT 0x0500
  63. #define MISC 0xe000
  64. #define OM_STAT 0xe100
  65. /* IDs of PLLs available on S5PV210/S5P6442 SoCs */
  66. enum {
  67. apll,
  68. mpll,
  69. epll,
  70. vpll,
  71. };
  72. /* IDs of external clocks (used for legacy boards) */
  73. enum {
  74. xxti,
  75. xusbxti,
  76. };
  77. static void __iomem *reg_base;
  78. #ifdef CONFIG_PM_SLEEP
  79. static struct samsung_clk_reg_dump *s5pv210_clk_dump;
  80. /* List of registers that need to be preserved across suspend/resume. */
  81. static unsigned long s5pv210_clk_regs[] __initdata = {
  82. CLK_SRC0,
  83. CLK_SRC1,
  84. CLK_SRC2,
  85. CLK_SRC3,
  86. CLK_SRC4,
  87. CLK_SRC5,
  88. CLK_SRC6,
  89. CLK_SRC_MASK0,
  90. CLK_SRC_MASK1,
  91. CLK_DIV0,
  92. CLK_DIV1,
  93. CLK_DIV2,
  94. CLK_DIV3,
  95. CLK_DIV4,
  96. CLK_DIV5,
  97. CLK_DIV6,
  98. CLK_DIV7,
  99. CLK_GATE_MAIN0,
  100. CLK_GATE_MAIN1,
  101. CLK_GATE_MAIN2,
  102. CLK_GATE_PERI0,
  103. CLK_GATE_PERI1,
  104. CLK_GATE_SCLK0,
  105. CLK_GATE_SCLK1,
  106. CLK_GATE_IP0,
  107. CLK_GATE_IP1,
  108. CLK_GATE_IP2,
  109. CLK_GATE_IP3,
  110. CLK_GATE_IP4,
  111. CLK_GATE_IP5,
  112. CLK_GATE_BLOCK,
  113. APLL_LOCK,
  114. MPLL_LOCK,
  115. EPLL_LOCK,
  116. VPLL_LOCK,
  117. APLL_CON0,
  118. APLL_CON1,
  119. MPLL_CON,
  120. EPLL_CON0,
  121. EPLL_CON1,
  122. VPLL_CON,
  123. CLK_OUT,
  124. };
  125. static int s5pv210_clk_suspend(void)
  126. {
  127. samsung_clk_save(reg_base, s5pv210_clk_dump,
  128. ARRAY_SIZE(s5pv210_clk_regs));
  129. return 0;
  130. }
  131. static void s5pv210_clk_resume(void)
  132. {
  133. samsung_clk_restore(reg_base, s5pv210_clk_dump,
  134. ARRAY_SIZE(s5pv210_clk_regs));
  135. }
  136. static struct syscore_ops s5pv210_clk_syscore_ops = {
  137. .suspend = s5pv210_clk_suspend,
  138. .resume = s5pv210_clk_resume,
  139. };
  140. static void s5pv210_clk_sleep_init(void)
  141. {
  142. s5pv210_clk_dump =
  143. samsung_clk_alloc_reg_dump(s5pv210_clk_regs,
  144. ARRAY_SIZE(s5pv210_clk_regs));
  145. if (!s5pv210_clk_dump) {
  146. pr_warn("%s: Failed to allocate sleep save data\n", __func__);
  147. return;
  148. }
  149. register_syscore_ops(&s5pv210_clk_syscore_ops);
  150. }
  151. #else
  152. static inline void s5pv210_clk_sleep_init(void) { }
  153. #endif
  154. /* Mux parent lists. */
  155. static const char *const fin_pll_p[] __initconst = {
  156. "xxti",
  157. "xusbxti"
  158. };
  159. static const char *const mout_apll_p[] __initconst = {
  160. "fin_pll",
  161. "fout_apll"
  162. };
  163. static const char *const mout_mpll_p[] __initconst = {
  164. "fin_pll",
  165. "fout_mpll"
  166. };
  167. static const char *const mout_epll_p[] __initconst = {
  168. "fin_pll",
  169. "fout_epll"
  170. };
  171. static const char *const mout_vpllsrc_p[] __initconst = {
  172. "fin_pll",
  173. "sclk_hdmi27m"
  174. };
  175. static const char *const mout_vpll_p[] __initconst = {
  176. "mout_vpllsrc",
  177. "fout_vpll"
  178. };
  179. static const char *const mout_group1_p[] __initconst = {
  180. "dout_a2m",
  181. "mout_mpll",
  182. "mout_epll",
  183. "mout_vpll"
  184. };
  185. static const char *const mout_group2_p[] __initconst = {
  186. "xxti",
  187. "xusbxti",
  188. "sclk_hdmi27m",
  189. "sclk_usbphy0",
  190. "sclk_usbphy1",
  191. "sclk_hdmiphy",
  192. "mout_mpll",
  193. "mout_epll",
  194. "mout_vpll",
  195. };
  196. static const char *const mout_audio0_p[] __initconst = {
  197. "xxti",
  198. "pcmcdclk0",
  199. "sclk_hdmi27m",
  200. "sclk_usbphy0",
  201. "sclk_usbphy1",
  202. "sclk_hdmiphy",
  203. "mout_mpll",
  204. "mout_epll",
  205. "mout_vpll",
  206. };
  207. static const char *const mout_audio1_p[] __initconst = {
  208. "i2scdclk1",
  209. "pcmcdclk1",
  210. "sclk_hdmi27m",
  211. "sclk_usbphy0",
  212. "sclk_usbphy1",
  213. "sclk_hdmiphy",
  214. "mout_mpll",
  215. "mout_epll",
  216. "mout_vpll",
  217. };
  218. static const char *const mout_audio2_p[] __initconst = {
  219. "i2scdclk2",
  220. "pcmcdclk2",
  221. "sclk_hdmi27m",
  222. "sclk_usbphy0",
  223. "sclk_usbphy1",
  224. "sclk_hdmiphy",
  225. "mout_mpll",
  226. "mout_epll",
  227. "mout_vpll",
  228. };
  229. static const char *const mout_spdif_p[] __initconst = {
  230. "dout_audio0",
  231. "dout_audio1",
  232. "dout_audio3",
  233. };
  234. static const char *const mout_group3_p[] __initconst = {
  235. "mout_apll",
  236. "mout_mpll"
  237. };
  238. static const char *const mout_group4_p[] __initconst = {
  239. "mout_mpll",
  240. "dout_a2m"
  241. };
  242. static const char *const mout_flash_p[] __initconst = {
  243. "dout_hclkd",
  244. "dout_hclkp"
  245. };
  246. static const char *const mout_dac_p[] __initconst = {
  247. "mout_vpll",
  248. "sclk_hdmiphy"
  249. };
  250. static const char *const mout_hdmi_p[] __initconst = {
  251. "sclk_hdmiphy",
  252. "dout_tblk"
  253. };
  254. static const char *const mout_mixer_p[] __initconst = {
  255. "mout_dac",
  256. "mout_hdmi"
  257. };
  258. static const char *const mout_vpll_6442_p[] __initconst = {
  259. "fin_pll",
  260. "fout_vpll"
  261. };
  262. static const char *const mout_mixer_6442_p[] __initconst = {
  263. "mout_vpll",
  264. "dout_mixer"
  265. };
  266. static const char *const mout_d0sync_6442_p[] __initconst = {
  267. "mout_dsys",
  268. "div_apll"
  269. };
  270. static const char *const mout_d1sync_6442_p[] __initconst = {
  271. "mout_psys",
  272. "div_apll"
  273. };
  274. static const char *const mout_group2_6442_p[] __initconst = {
  275. "fin_pll",
  276. "none",
  277. "none",
  278. "sclk_usbphy0",
  279. "none",
  280. "none",
  281. "mout_mpll",
  282. "mout_epll",
  283. "mout_vpll",
  284. };
  285. static const char *const mout_audio0_6442_p[] __initconst = {
  286. "fin_pll",
  287. "pcmcdclk0",
  288. "none",
  289. "sclk_usbphy0",
  290. "none",
  291. "none",
  292. "mout_mpll",
  293. "mout_epll",
  294. "mout_vpll",
  295. };
  296. static const char *const mout_audio1_6442_p[] __initconst = {
  297. "i2scdclk1",
  298. "pcmcdclk1",
  299. "none",
  300. "sclk_usbphy0",
  301. "none",
  302. "none",
  303. "mout_mpll",
  304. "mout_epll",
  305. "mout_vpll",
  306. "fin_pll",
  307. };
  308. static const char *const mout_clksel_p[] __initconst = {
  309. "fout_apll_clkout",
  310. "fout_mpll_clkout",
  311. "fout_epll",
  312. "fout_vpll",
  313. "sclk_usbphy0",
  314. "sclk_usbphy1",
  315. "sclk_hdmiphy",
  316. "rtc",
  317. "rtc_tick",
  318. "dout_hclkm",
  319. "dout_pclkm",
  320. "dout_hclkd",
  321. "dout_pclkd",
  322. "dout_hclkp",
  323. "dout_pclkp",
  324. "dout_apll_clkout",
  325. "dout_hpm",
  326. "xxti",
  327. "xusbxti",
  328. "div_dclk"
  329. };
  330. static const char *const mout_clksel_6442_p[] __initconst = {
  331. "fout_apll_clkout",
  332. "fout_mpll_clkout",
  333. "fout_epll",
  334. "fout_vpll",
  335. "sclk_usbphy0",
  336. "none",
  337. "none",
  338. "rtc",
  339. "rtc_tick",
  340. "none",
  341. "none",
  342. "dout_hclkd",
  343. "dout_pclkd",
  344. "dout_hclkp",
  345. "dout_pclkp",
  346. "dout_apll_clkout",
  347. "none",
  348. "fin_pll",
  349. "none",
  350. "div_dclk"
  351. };
  352. static const char *const mout_clkout_p[] __initconst = {
  353. "dout_clkout",
  354. "none",
  355. "xxti",
  356. "xusbxti"
  357. };
  358. /* Common fixed factor clocks. */
  359. static const struct samsung_fixed_factor_clock ffactor_clks[] __initconst = {
  360. FFACTOR(FOUT_APLL_CLKOUT, "fout_apll_clkout", "fout_apll", 1, 4, 0),
  361. FFACTOR(FOUT_MPLL_CLKOUT, "fout_mpll_clkout", "fout_mpll", 1, 2, 0),
  362. FFACTOR(DOUT_APLL_CLKOUT, "dout_apll_clkout", "dout_apll", 1, 4, 0),
  363. };
  364. /* PLL input mux (fin_pll), which needs to be registered before PLLs. */
  365. static const struct samsung_mux_clock early_mux_clks[] __initconst = {
  366. MUX_F(FIN_PLL, "fin_pll", fin_pll_p, OM_STAT, 0, 1,
  367. CLK_MUX_READ_ONLY, 0),
  368. };
  369. /* Common clock muxes. */
  370. static const struct samsung_mux_clock mux_clks[] __initconst = {
  371. MUX(MOUT_FLASH, "mout_flash", mout_flash_p, CLK_SRC0, 28, 1),
  372. MUX(MOUT_PSYS, "mout_psys", mout_group4_p, CLK_SRC0, 24, 1),
  373. MUX(MOUT_DSYS, "mout_dsys", mout_group4_p, CLK_SRC0, 20, 1),
  374. MUX(MOUT_MSYS, "mout_msys", mout_group3_p, CLK_SRC0, 16, 1),
  375. MUX(MOUT_EPLL, "mout_epll", mout_epll_p, CLK_SRC0, 8, 1),
  376. MUX(MOUT_MPLL, "mout_mpll", mout_mpll_p, CLK_SRC0, 4, 1),
  377. MUX(MOUT_APLL, "mout_apll", mout_apll_p, CLK_SRC0, 0, 1),
  378. MUX(MOUT_CLKOUT, "mout_clkout", mout_clkout_p, MISC, 8, 2),
  379. };
  380. /* S5PV210-specific clock muxes. */
  381. static const struct samsung_mux_clock s5pv210_mux_clks[] __initconst = {
  382. MUX(MOUT_VPLL, "mout_vpll", mout_vpll_p, CLK_SRC0, 12, 1),
  383. MUX(MOUT_VPLLSRC, "mout_vpllsrc", mout_vpllsrc_p, CLK_SRC1, 28, 1),
  384. MUX(MOUT_CSIS, "mout_csis", mout_group2_p, CLK_SRC1, 24, 4),
  385. MUX(MOUT_FIMD, "mout_fimd", mout_group2_p, CLK_SRC1, 20, 4),
  386. MUX(MOUT_CAM1, "mout_cam1", mout_group2_p, CLK_SRC1, 16, 4),
  387. MUX(MOUT_CAM0, "mout_cam0", mout_group2_p, CLK_SRC1, 12, 4),
  388. MUX(MOUT_DAC, "mout_dac", mout_dac_p, CLK_SRC1, 8, 1),
  389. MUX(MOUT_MIXER, "mout_mixer", mout_mixer_p, CLK_SRC1, 4, 1),
  390. MUX(MOUT_HDMI, "mout_hdmi", mout_hdmi_p, CLK_SRC1, 0, 1),
  391. MUX(MOUT_G2D, "mout_g2d", mout_group1_p, CLK_SRC2, 8, 2),
  392. MUX(MOUT_MFC, "mout_mfc", mout_group1_p, CLK_SRC2, 4, 2),
  393. MUX(MOUT_G3D, "mout_g3d", mout_group1_p, CLK_SRC2, 0, 2),
  394. MUX(MOUT_FIMC2, "mout_fimc2", mout_group2_p, CLK_SRC3, 20, 4),
  395. MUX(MOUT_FIMC1, "mout_fimc1", mout_group2_p, CLK_SRC3, 16, 4),
  396. MUX(MOUT_FIMC0, "mout_fimc0", mout_group2_p, CLK_SRC3, 12, 4),
  397. MUX(MOUT_UART3, "mout_uart3", mout_group2_p, CLK_SRC4, 28, 4),
  398. MUX(MOUT_UART2, "mout_uart2", mout_group2_p, CLK_SRC4, 24, 4),
  399. MUX(MOUT_UART1, "mout_uart1", mout_group2_p, CLK_SRC4, 20, 4),
  400. MUX(MOUT_UART0, "mout_uart0", mout_group2_p, CLK_SRC4, 16, 4),
  401. MUX(MOUT_MMC3, "mout_mmc3", mout_group2_p, CLK_SRC4, 12, 4),
  402. MUX(MOUT_MMC2, "mout_mmc2", mout_group2_p, CLK_SRC4, 8, 4),
  403. MUX(MOUT_MMC1, "mout_mmc1", mout_group2_p, CLK_SRC4, 4, 4),
  404. MUX(MOUT_MMC0, "mout_mmc0", mout_group2_p, CLK_SRC4, 0, 4),
  405. MUX(MOUT_PWM, "mout_pwm", mout_group2_p, CLK_SRC5, 12, 4),
  406. MUX(MOUT_SPI1, "mout_spi1", mout_group2_p, CLK_SRC5, 4, 4),
  407. MUX(MOUT_SPI0, "mout_spi0", mout_group2_p, CLK_SRC5, 0, 4),
  408. MUX(MOUT_DMC0, "mout_dmc0", mout_group1_p, CLK_SRC6, 24, 2),
  409. MUX(MOUT_PWI, "mout_pwi", mout_group2_p, CLK_SRC6, 20, 4),
  410. MUX(MOUT_HPM, "mout_hpm", mout_group3_p, CLK_SRC6, 16, 1),
  411. MUX(MOUT_SPDIF, "mout_spdif", mout_spdif_p, CLK_SRC6, 12, 2),
  412. MUX(MOUT_AUDIO2, "mout_audio2", mout_audio2_p, CLK_SRC6, 8, 4),
  413. MUX(MOUT_AUDIO1, "mout_audio1", mout_audio1_p, CLK_SRC6, 4, 4),
  414. MUX(MOUT_AUDIO0, "mout_audio0", mout_audio0_p, CLK_SRC6, 0, 4),
  415. MUX(MOUT_CLKSEL, "mout_clksel", mout_clksel_p, CLK_OUT, 12, 5),
  416. };
  417. /* S5P6442-specific clock muxes. */
  418. static const struct samsung_mux_clock s5p6442_mux_clks[] __initconst = {
  419. MUX(MOUT_VPLL, "mout_vpll", mout_vpll_6442_p, CLK_SRC0, 12, 1),
  420. MUX(MOUT_FIMD, "mout_fimd", mout_group2_6442_p, CLK_SRC1, 20, 4),
  421. MUX(MOUT_CAM1, "mout_cam1", mout_group2_6442_p, CLK_SRC1, 16, 4),
  422. MUX(MOUT_CAM0, "mout_cam0", mout_group2_6442_p, CLK_SRC1, 12, 4),
  423. MUX(MOUT_MIXER, "mout_mixer", mout_mixer_6442_p, CLK_SRC1, 4, 1),
  424. MUX(MOUT_D0SYNC, "mout_d0sync", mout_d0sync_6442_p, CLK_SRC2, 28, 1),
  425. MUX(MOUT_D1SYNC, "mout_d1sync", mout_d1sync_6442_p, CLK_SRC2, 24, 1),
  426. MUX(MOUT_FIMC2, "mout_fimc2", mout_group2_6442_p, CLK_SRC3, 20, 4),
  427. MUX(MOUT_FIMC1, "mout_fimc1", mout_group2_6442_p, CLK_SRC3, 16, 4),
  428. MUX(MOUT_FIMC0, "mout_fimc0", mout_group2_6442_p, CLK_SRC3, 12, 4),
  429. MUX(MOUT_UART2, "mout_uart2", mout_group2_6442_p, CLK_SRC4, 24, 4),
  430. MUX(MOUT_UART1, "mout_uart1", mout_group2_6442_p, CLK_SRC4, 20, 4),
  431. MUX(MOUT_UART0, "mout_uart0", mout_group2_6442_p, CLK_SRC4, 16, 4),
  432. MUX(MOUT_MMC2, "mout_mmc2", mout_group2_6442_p, CLK_SRC4, 8, 4),
  433. MUX(MOUT_MMC1, "mout_mmc1", mout_group2_6442_p, CLK_SRC4, 4, 4),
  434. MUX(MOUT_MMC0, "mout_mmc0", mout_group2_6442_p, CLK_SRC4, 0, 4),
  435. MUX(MOUT_PWM, "mout_pwm", mout_group2_6442_p, CLK_SRC5, 12, 4),
  436. MUX(MOUT_SPI0, "mout_spi0", mout_group2_6442_p, CLK_SRC5, 0, 4),
  437. MUX(MOUT_AUDIO1, "mout_audio1", mout_audio1_6442_p, CLK_SRC6, 4, 4),
  438. MUX(MOUT_AUDIO0, "mout_audio0", mout_audio0_6442_p, CLK_SRC6, 0, 4),
  439. MUX(MOUT_CLKSEL, "mout_clksel", mout_clksel_6442_p, CLK_OUT, 12, 5),
  440. };
  441. /* S5PV210-specific fixed rate clocks generated inside the SoC. */
  442. static const struct samsung_fixed_rate_clock s5pv210_frate_clks[] __initconst = {
  443. FRATE(SCLK_HDMI27M, "sclk_hdmi27m", NULL, 0, 27000000),
  444. FRATE(SCLK_HDMIPHY, "sclk_hdmiphy", NULL, 0, 27000000),
  445. FRATE(SCLK_USBPHY0, "sclk_usbphy0", NULL, 0, 48000000),
  446. FRATE(SCLK_USBPHY1, "sclk_usbphy1", NULL, 0, 48000000),
  447. };
  448. /* S5P6442-specific fixed rate clocks generated inside the SoC. */
  449. static const struct samsung_fixed_rate_clock s5p6442_frate_clks[] __initconst = {
  450. FRATE(SCLK_USBPHY0, "sclk_usbphy0", NULL, 0, 30000000),
  451. };
  452. /* Common clock dividers. */
  453. static const struct samsung_div_clock div_clks[] __initconst = {
  454. DIV(DOUT_PCLKP, "dout_pclkp", "dout_hclkp", CLK_DIV0, 28, 3),
  455. DIV(DOUT_PCLKD, "dout_pclkd", "dout_hclkd", CLK_DIV0, 20, 3),
  456. DIV(DOUT_A2M, "dout_a2m", "mout_apll", CLK_DIV0, 4, 3),
  457. DIV(DOUT_APLL, "dout_apll", "mout_msys", CLK_DIV0, 0, 3),
  458. DIV(DOUT_FIMD, "dout_fimd", "mout_fimd", CLK_DIV1, 20, 4),
  459. DIV(DOUT_CAM1, "dout_cam1", "mout_cam1", CLK_DIV1, 16, 4),
  460. DIV(DOUT_CAM0, "dout_cam0", "mout_cam0", CLK_DIV1, 12, 4),
  461. DIV(DOUT_FIMC2, "dout_fimc2", "mout_fimc2", CLK_DIV3, 20, 4),
  462. DIV(DOUT_FIMC1, "dout_fimc1", "mout_fimc1", CLK_DIV3, 16, 4),
  463. DIV(DOUT_FIMC0, "dout_fimc0", "mout_fimc0", CLK_DIV3, 12, 4),
  464. DIV(DOUT_UART2, "dout_uart2", "mout_uart2", CLK_DIV4, 24, 4),
  465. DIV(DOUT_UART1, "dout_uart1", "mout_uart1", CLK_DIV4, 20, 4),
  466. DIV(DOUT_UART0, "dout_uart0", "mout_uart0", CLK_DIV4, 16, 4),
  467. DIV(DOUT_MMC2, "dout_mmc2", "mout_mmc2", CLK_DIV4, 8, 4),
  468. DIV(DOUT_MMC1, "dout_mmc1", "mout_mmc1", CLK_DIV4, 4, 4),
  469. DIV(DOUT_MMC0, "dout_mmc0", "mout_mmc0", CLK_DIV4, 0, 4),
  470. DIV(DOUT_PWM, "dout_pwm", "mout_pwm", CLK_DIV5, 12, 4),
  471. DIV(DOUT_SPI0, "dout_spi0", "mout_spi0", CLK_DIV5, 0, 4),
  472. DIV(DOUT_FLASH, "dout_flash", "mout_flash", CLK_DIV6, 12, 3),
  473. DIV(DOUT_AUDIO1, "dout_audio1", "mout_audio1", CLK_DIV6, 4, 4),
  474. DIV(DOUT_AUDIO0, "dout_audio0", "mout_audio0", CLK_DIV6, 0, 4),
  475. DIV(DOUT_CLKOUT, "dout_clkout", "mout_clksel", CLK_OUT, 20, 4),
  476. };
  477. /* S5PV210-specific clock dividers. */
  478. static const struct samsung_div_clock s5pv210_div_clks[] __initconst = {
  479. DIV(DOUT_HCLKP, "dout_hclkp", "mout_psys", CLK_DIV0, 24, 4),
  480. DIV(DOUT_HCLKD, "dout_hclkd", "mout_dsys", CLK_DIV0, 16, 4),
  481. DIV(DOUT_PCLKM, "dout_pclkm", "dout_hclkm", CLK_DIV0, 12, 3),
  482. DIV(DOUT_HCLKM, "dout_hclkm", "dout_apll", CLK_DIV0, 8, 3),
  483. DIV(DOUT_CSIS, "dout_csis", "mout_csis", CLK_DIV1, 28, 4),
  484. DIV(DOUT_TBLK, "dout_tblk", "mout_vpll", CLK_DIV1, 0, 4),
  485. DIV(DOUT_G2D, "dout_g2d", "mout_g2d", CLK_DIV2, 8, 4),
  486. DIV(DOUT_MFC, "dout_mfc", "mout_mfc", CLK_DIV2, 4, 4),
  487. DIV(DOUT_G3D, "dout_g3d", "mout_g3d", CLK_DIV2, 0, 4),
  488. DIV(DOUT_UART3, "dout_uart3", "mout_uart3", CLK_DIV4, 28, 4),
  489. DIV(DOUT_MMC3, "dout_mmc3", "mout_mmc3", CLK_DIV4, 12, 4),
  490. DIV(DOUT_SPI1, "dout_spi1", "mout_spi1", CLK_DIV5, 4, 4),
  491. DIV(DOUT_DMC0, "dout_dmc0", "mout_dmc0", CLK_DIV6, 28, 4),
  492. DIV(DOUT_PWI, "dout_pwi", "mout_pwi", CLK_DIV6, 24, 4),
  493. DIV(DOUT_HPM, "dout_hpm", "dout_copy", CLK_DIV6, 20, 3),
  494. DIV(DOUT_COPY, "dout_copy", "mout_hpm", CLK_DIV6, 16, 3),
  495. DIV(DOUT_AUDIO2, "dout_audio2", "mout_audio2", CLK_DIV6, 8, 4),
  496. DIV(DOUT_DPM, "dout_dpm", "dout_pclkp", CLK_DIV7, 8, 7),
  497. DIV(DOUT_DVSEM, "dout_dvsem", "dout_pclkp", CLK_DIV7, 0, 7),
  498. };
  499. /* S5P6442-specific clock dividers. */
  500. static const struct samsung_div_clock s5p6442_div_clks[] __initconst = {
  501. DIV(DOUT_HCLKP, "dout_hclkp", "mout_d1sync", CLK_DIV0, 24, 4),
  502. DIV(DOUT_HCLKD, "dout_hclkd", "mout_d0sync", CLK_DIV0, 16, 4),
  503. DIV(DOUT_MIXER, "dout_mixer", "mout_vpll", CLK_DIV1, 0, 4),
  504. };
  505. /* Common clock gates. */
  506. static const struct samsung_gate_clock gate_clks[] __initconst = {
  507. GATE(CLK_ROTATOR, "rotator", "dout_hclkd", CLK_GATE_IP0, 29, 0, 0),
  508. GATE(CLK_FIMC2, "fimc2", "dout_hclkd", CLK_GATE_IP0, 26, 0, 0),
  509. GATE(CLK_FIMC1, "fimc1", "dout_hclkd", CLK_GATE_IP0, 25, 0, 0),
  510. GATE(CLK_FIMC0, "fimc0", "dout_hclkd", CLK_GATE_IP0, 24, 0, 0),
  511. GATE(CLK_PDMA0, "pdma0", "dout_hclkp", CLK_GATE_IP0, 3, 0, 0),
  512. GATE(CLK_MDMA, "mdma", "dout_hclkd", CLK_GATE_IP0, 2, 0, 0),
  513. GATE(CLK_SROMC, "sromc", "dout_hclkp", CLK_GATE_IP1, 26, 0, 0),
  514. GATE(CLK_NANDXL, "nandxl", "dout_hclkp", CLK_GATE_IP1, 24, 0, 0),
  515. GATE(CLK_USB_OTG, "usb_otg", "dout_hclkp", CLK_GATE_IP1, 16, 0, 0),
  516. GATE(CLK_TVENC, "tvenc", "dout_hclkd", CLK_GATE_IP1, 10, 0, 0),
  517. GATE(CLK_MIXER, "mixer", "dout_hclkd", CLK_GATE_IP1, 9, 0, 0),
  518. GATE(CLK_VP, "vp", "dout_hclkd", CLK_GATE_IP1, 8, 0, 0),
  519. GATE(CLK_FIMD, "fimd", "dout_hclkd", CLK_GATE_IP1, 0, 0, 0),
  520. GATE(CLK_HSMMC2, "hsmmc2", "dout_hclkp", CLK_GATE_IP2, 18, 0, 0),
  521. GATE(CLK_HSMMC1, "hsmmc1", "dout_hclkp", CLK_GATE_IP2, 17, 0, 0),
  522. GATE(CLK_HSMMC0, "hsmmc0", "dout_hclkp", CLK_GATE_IP2, 16, 0, 0),
  523. GATE(CLK_MODEMIF, "modemif", "dout_hclkp", CLK_GATE_IP2, 9, 0, 0),
  524. GATE(CLK_SECSS, "secss", "dout_hclkp", CLK_GATE_IP2, 0, 0, 0),
  525. GATE(CLK_PCM1, "pcm1", "dout_pclkp", CLK_GATE_IP3, 29, 0, 0),
  526. GATE(CLK_PCM0, "pcm0", "dout_pclkp", CLK_GATE_IP3, 28, 0, 0),
  527. GATE(CLK_TSADC, "tsadc", "dout_pclkp", CLK_GATE_IP3, 24, 0, 0),
  528. GATE(CLK_PWM, "pwm", "dout_pclkp", CLK_GATE_IP3, 23, 0, 0),
  529. GATE(CLK_WDT, "watchdog", "dout_pclkp", CLK_GATE_IP3, 22, 0, 0),
  530. GATE(CLK_KEYIF, "keyif", "dout_pclkp", CLK_GATE_IP3, 21, 0, 0),
  531. GATE(CLK_UART2, "uart2", "dout_pclkp", CLK_GATE_IP3, 19, 0, 0),
  532. GATE(CLK_UART1, "uart1", "dout_pclkp", CLK_GATE_IP3, 18, 0, 0),
  533. GATE(CLK_UART0, "uart0", "dout_pclkp", CLK_GATE_IP3, 17, 0, 0),
  534. GATE(CLK_SYSTIMER, "systimer", "dout_pclkp", CLK_GATE_IP3, 16, 0, 0),
  535. GATE(CLK_RTC, "rtc", "dout_pclkp", CLK_GATE_IP3, 15, 0, 0),
  536. GATE(CLK_SPI0, "spi0", "dout_pclkp", CLK_GATE_IP3, 12, 0, 0),
  537. GATE(CLK_I2C2, "i2c2", "dout_pclkp", CLK_GATE_IP3, 9, 0, 0),
  538. GATE(CLK_I2C0, "i2c0", "dout_pclkp", CLK_GATE_IP3, 7, 0, 0),
  539. GATE(CLK_I2S1, "i2s1", "dout_pclkp", CLK_GATE_IP3, 5, 0, 0),
  540. GATE(CLK_I2S0, "i2s0", "dout_pclkp", CLK_GATE_IP3, 4, 0, 0),
  541. GATE(CLK_SECKEY, "seckey", "dout_pclkp", CLK_GATE_IP4, 3, 0, 0),
  542. GATE(CLK_CHIPID, "chipid", "dout_pclkp", CLK_GATE_IP4, 0, 0, 0),
  543. GATE(SCLK_AUDIO1, "sclk_audio1", "dout_audio1", CLK_SRC_MASK0, 25,
  544. CLK_SET_RATE_PARENT, 0),
  545. GATE(SCLK_AUDIO0, "sclk_audio0", "dout_audio0", CLK_SRC_MASK0, 24,
  546. CLK_SET_RATE_PARENT, 0),
  547. GATE(SCLK_PWM, "sclk_pwm", "dout_pwm", CLK_SRC_MASK0, 19,
  548. CLK_SET_RATE_PARENT, 0),
  549. GATE(SCLK_SPI0, "sclk_spi0", "dout_spi0", CLK_SRC_MASK0, 16,
  550. CLK_SET_RATE_PARENT, 0),
  551. GATE(SCLK_UART2, "sclk_uart2", "dout_uart2", CLK_SRC_MASK0, 14,
  552. CLK_SET_RATE_PARENT, 0),
  553. GATE(SCLK_UART1, "sclk_uart1", "dout_uart1", CLK_SRC_MASK0, 13,
  554. CLK_SET_RATE_PARENT, 0),
  555. GATE(SCLK_UART0, "sclk_uart0", "dout_uart0", CLK_SRC_MASK0, 12,
  556. CLK_SET_RATE_PARENT, 0),
  557. GATE(SCLK_MMC2, "sclk_mmc2", "dout_mmc2", CLK_SRC_MASK0, 10,
  558. CLK_SET_RATE_PARENT, 0),
  559. GATE(SCLK_MMC1, "sclk_mmc1", "dout_mmc1", CLK_SRC_MASK0, 9,
  560. CLK_SET_RATE_PARENT, 0),
  561. GATE(SCLK_MMC0, "sclk_mmc0", "dout_mmc0", CLK_SRC_MASK0, 8,
  562. CLK_SET_RATE_PARENT, 0),
  563. GATE(SCLK_FIMD, "sclk_fimd", "dout_fimd", CLK_SRC_MASK0, 5,
  564. CLK_SET_RATE_PARENT, 0),
  565. GATE(SCLK_CAM1, "sclk_cam1", "dout_cam1", CLK_SRC_MASK0, 4,
  566. CLK_SET_RATE_PARENT, 0),
  567. GATE(SCLK_CAM0, "sclk_cam0", "dout_cam0", CLK_SRC_MASK0, 3,
  568. CLK_SET_RATE_PARENT, 0),
  569. GATE(SCLK_MIXER, "sclk_mixer", "mout_mixer", CLK_SRC_MASK0, 1,
  570. CLK_SET_RATE_PARENT, 0),
  571. GATE(SCLK_FIMC2, "sclk_fimc2", "dout_fimc2", CLK_SRC_MASK1, 4,
  572. CLK_SET_RATE_PARENT, 0),
  573. GATE(SCLK_FIMC1, "sclk_fimc1", "dout_fimc1", CLK_SRC_MASK1, 3,
  574. CLK_SET_RATE_PARENT, 0),
  575. GATE(SCLK_FIMC0, "sclk_fimc0", "dout_fimc0", CLK_SRC_MASK1, 2,
  576. CLK_SET_RATE_PARENT, 0),
  577. };
  578. /* S5PV210-specific clock gates. */
  579. static const struct samsung_gate_clock s5pv210_gate_clks[] __initconst = {
  580. GATE(CLK_CSIS, "clk_csis", "dout_hclkd", CLK_GATE_IP0, 31, 0, 0),
  581. GATE(CLK_MFC, "mfc", "dout_hclkm", CLK_GATE_IP0, 16, 0, 0),
  582. GATE(CLK_G2D, "g2d", "dout_hclkd", CLK_GATE_IP0, 12, 0, 0),
  583. GATE(CLK_G3D, "g3d", "dout_hclkm", CLK_GATE_IP0, 8, 0, 0),
  584. GATE(CLK_IMEM, "imem", "dout_hclkm", CLK_GATE_IP0, 5, 0, 0),
  585. GATE(CLK_PDMA1, "pdma1", "dout_hclkp", CLK_GATE_IP0, 4, 0, 0),
  586. GATE(CLK_NFCON, "nfcon", "dout_hclkp", CLK_GATE_IP1, 28, 0, 0),
  587. GATE(CLK_CFCON, "cfcon", "dout_hclkp", CLK_GATE_IP1, 25, 0, 0),
  588. GATE(CLK_USB_HOST, "usb_host", "dout_hclkp", CLK_GATE_IP1, 17, 0, 0),
  589. GATE(CLK_HDMI, "hdmi", "dout_hclkd", CLK_GATE_IP1, 11, 0, 0),
  590. GATE(CLK_DSIM, "dsim", "dout_pclkd", CLK_GATE_IP1, 2, 0, 0),
  591. GATE(CLK_TZIC3, "tzic3", "dout_hclkm", CLK_GATE_IP2, 31, 0, 0),
  592. GATE(CLK_TZIC2, "tzic2", "dout_hclkm", CLK_GATE_IP2, 30, 0, 0),
  593. GATE(CLK_TZIC1, "tzic1", "dout_hclkm", CLK_GATE_IP2, 29, 0, 0),
  594. GATE(CLK_TZIC0, "tzic0", "dout_hclkm", CLK_GATE_IP2, 28, 0, 0),
  595. GATE(CLK_TSI, "tsi", "dout_hclkd", CLK_GATE_IP2, 20, 0, 0),
  596. GATE(CLK_HSMMC3, "hsmmc3", "dout_hclkp", CLK_GATE_IP2, 19, 0, 0),
  597. GATE(CLK_JTAG, "jtag", "dout_hclkp", CLK_GATE_IP2, 11, 0, 0),
  598. GATE(CLK_CORESIGHT, "coresight", "dout_pclkp", CLK_GATE_IP2, 8, 0, 0),
  599. GATE(CLK_SDM, "sdm", "dout_pclkm", CLK_GATE_IP2, 1, 0, 0),
  600. GATE(CLK_PCM2, "pcm2", "dout_pclkp", CLK_GATE_IP3, 30, 0, 0),
  601. GATE(CLK_UART3, "uart3", "dout_pclkp", CLK_GATE_IP3, 20, 0, 0),
  602. GATE(CLK_SPI1, "spi1", "dout_pclkp", CLK_GATE_IP3, 13, 0, 0),
  603. GATE(CLK_I2C_HDMI_PHY, "i2c_hdmi_phy", "dout_pclkd",
  604. CLK_GATE_IP3, 11, 0, 0),
  605. GATE(CLK_I2C1, "i2c1", "dout_pclkd", CLK_GATE_IP3, 10, 0, 0),
  606. GATE(CLK_I2S2, "i2s2", "dout_pclkp", CLK_GATE_IP3, 6, 0, 0),
  607. GATE(CLK_AC97, "ac97", "dout_pclkp", CLK_GATE_IP3, 1, 0, 0),
  608. GATE(CLK_SPDIF, "spdif", "dout_pclkp", CLK_GATE_IP3, 0, 0, 0),
  609. GATE(CLK_TZPC3, "tzpc.3", "dout_pclkd", CLK_GATE_IP4, 8, 0, 0),
  610. GATE(CLK_TZPC2, "tzpc.2", "dout_pclkd", CLK_GATE_IP4, 7, 0, 0),
  611. GATE(CLK_TZPC1, "tzpc.1", "dout_pclkp", CLK_GATE_IP4, 6, 0, 0),
  612. GATE(CLK_TZPC0, "tzpc.0", "dout_pclkm", CLK_GATE_IP4, 5, 0, 0),
  613. GATE(CLK_IEM_APC, "iem_apc", "dout_pclkp", CLK_GATE_IP4, 2, 0, 0),
  614. GATE(CLK_IEM_IEC, "iem_iec", "dout_pclkp", CLK_GATE_IP4, 1, 0, 0),
  615. GATE(CLK_JPEG, "jpeg", "dout_hclkd", CLK_GATE_IP5, 29, 0, 0),
  616. GATE(SCLK_SPDIF, "sclk_spdif", "mout_spdif", CLK_SRC_MASK0, 27,
  617. CLK_SET_RATE_PARENT, 0),
  618. GATE(SCLK_AUDIO2, "sclk_audio2", "dout_audio2", CLK_SRC_MASK0, 26,
  619. CLK_SET_RATE_PARENT, 0),
  620. GATE(SCLK_SPI1, "sclk_spi1", "dout_spi1", CLK_SRC_MASK0, 17,
  621. CLK_SET_RATE_PARENT, 0),
  622. GATE(SCLK_UART3, "sclk_uart3", "dout_uart3", CLK_SRC_MASK0, 15,
  623. CLK_SET_RATE_PARENT, 0),
  624. GATE(SCLK_MMC3, "sclk_mmc3", "dout_mmc3", CLK_SRC_MASK0, 11,
  625. CLK_SET_RATE_PARENT, 0),
  626. GATE(SCLK_CSIS, "sclk_csis", "dout_csis", CLK_SRC_MASK0, 6,
  627. CLK_SET_RATE_PARENT, 0),
  628. GATE(SCLK_DAC, "sclk_dac", "mout_dac", CLK_SRC_MASK0, 2,
  629. CLK_SET_RATE_PARENT, 0),
  630. GATE(SCLK_HDMI, "sclk_hdmi", "mout_hdmi", CLK_SRC_MASK0, 0,
  631. CLK_SET_RATE_PARENT, 0),
  632. };
  633. /* S5P6442-specific clock gates. */
  634. static const struct samsung_gate_clock s5p6442_gate_clks[] __initconst = {
  635. GATE(CLK_JPEG, "jpeg", "dout_hclkd", CLK_GATE_IP0, 28, 0, 0),
  636. GATE(CLK_MFC, "mfc", "dout_hclkd", CLK_GATE_IP0, 16, 0, 0),
  637. GATE(CLK_G2D, "g2d", "dout_hclkd", CLK_GATE_IP0, 12, 0, 0),
  638. GATE(CLK_G3D, "g3d", "dout_hclkd", CLK_GATE_IP0, 8, 0, 0),
  639. GATE(CLK_IMEM, "imem", "dout_hclkd", CLK_GATE_IP0, 5, 0, 0),
  640. GATE(CLK_ETB, "etb", "dout_hclkd", CLK_GATE_IP1, 31, 0, 0),
  641. GATE(CLK_ETM, "etm", "dout_hclkd", CLK_GATE_IP1, 30, 0, 0),
  642. GATE(CLK_I2C1, "i2c1", "dout_pclkp", CLK_GATE_IP3, 8, 0, 0),
  643. GATE(SCLK_DAC, "sclk_dac", "mout_vpll", CLK_SRC_MASK0, 2,
  644. CLK_SET_RATE_PARENT, 0),
  645. };
  646. /*
  647. * Clock aliases for legacy clkdev look-up.
  648. * NOTE: Needed only to support legacy board files.
  649. */
  650. static const struct samsung_clock_alias s5pv210_aliases[] __initconst = {
  651. ALIAS(DOUT_APLL, NULL, "armclk"),
  652. ALIAS(DOUT_HCLKM, NULL, "hclk_msys"),
  653. ALIAS(MOUT_DMC0, NULL, "sclk_dmc0"),
  654. };
  655. /* S5PV210-specific PLLs. */
  656. static const struct samsung_pll_clock s5pv210_pll_clks[] __initconst = {
  657. [apll] = PLL(pll_4508, FOUT_APLL, "fout_apll", "fin_pll",
  658. APLL_LOCK, APLL_CON0, NULL),
  659. [mpll] = PLL(pll_4502, FOUT_MPLL, "fout_mpll", "fin_pll",
  660. MPLL_LOCK, MPLL_CON, NULL),
  661. [epll] = PLL(pll_4600, FOUT_EPLL, "fout_epll", "fin_pll",
  662. EPLL_LOCK, EPLL_CON0, NULL),
  663. [vpll] = PLL(pll_4502, FOUT_VPLL, "fout_vpll", "mout_vpllsrc",
  664. VPLL_LOCK, VPLL_CON, NULL),
  665. };
  666. /* S5P6442-specific PLLs. */
  667. static const struct samsung_pll_clock s5p6442_pll_clks[] __initconst = {
  668. [apll] = PLL(pll_4502, FOUT_APLL, "fout_apll", "fin_pll",
  669. APLL_LOCK, APLL_CON0, NULL),
  670. [mpll] = PLL(pll_4502, FOUT_MPLL, "fout_mpll", "fin_pll",
  671. MPLL_LOCK, MPLL_CON, NULL),
  672. [epll] = PLL(pll_4500, FOUT_EPLL, "fout_epll", "fin_pll",
  673. EPLL_LOCK, EPLL_CON0, NULL),
  674. [vpll] = PLL(pll_4500, FOUT_VPLL, "fout_vpll", "fin_pll",
  675. VPLL_LOCK, VPLL_CON, NULL),
  676. };
  677. static void __init __s5pv210_clk_init(struct device_node *np,
  678. unsigned long xxti_f,
  679. unsigned long xusbxti_f,
  680. bool is_s5p6442)
  681. {
  682. struct samsung_clk_provider *ctx;
  683. ctx = samsung_clk_init(np, reg_base, NR_CLKS);
  684. samsung_clk_register_mux(ctx, early_mux_clks,
  685. ARRAY_SIZE(early_mux_clks));
  686. if (is_s5p6442) {
  687. samsung_clk_register_fixed_rate(ctx, s5p6442_frate_clks,
  688. ARRAY_SIZE(s5p6442_frate_clks));
  689. samsung_clk_register_pll(ctx, s5p6442_pll_clks,
  690. ARRAY_SIZE(s5p6442_pll_clks), reg_base);
  691. samsung_clk_register_mux(ctx, s5p6442_mux_clks,
  692. ARRAY_SIZE(s5p6442_mux_clks));
  693. samsung_clk_register_div(ctx, s5p6442_div_clks,
  694. ARRAY_SIZE(s5p6442_div_clks));
  695. samsung_clk_register_gate(ctx, s5p6442_gate_clks,
  696. ARRAY_SIZE(s5p6442_gate_clks));
  697. } else {
  698. samsung_clk_register_fixed_rate(ctx, s5pv210_frate_clks,
  699. ARRAY_SIZE(s5pv210_frate_clks));
  700. samsung_clk_register_pll(ctx, s5pv210_pll_clks,
  701. ARRAY_SIZE(s5pv210_pll_clks), reg_base);
  702. samsung_clk_register_mux(ctx, s5pv210_mux_clks,
  703. ARRAY_SIZE(s5pv210_mux_clks));
  704. samsung_clk_register_div(ctx, s5pv210_div_clks,
  705. ARRAY_SIZE(s5pv210_div_clks));
  706. samsung_clk_register_gate(ctx, s5pv210_gate_clks,
  707. ARRAY_SIZE(s5pv210_gate_clks));
  708. }
  709. samsung_clk_register_mux(ctx, mux_clks, ARRAY_SIZE(mux_clks));
  710. samsung_clk_register_div(ctx, div_clks, ARRAY_SIZE(div_clks));
  711. samsung_clk_register_gate(ctx, gate_clks, ARRAY_SIZE(gate_clks));
  712. samsung_clk_register_fixed_factor(ctx, ffactor_clks,
  713. ARRAY_SIZE(ffactor_clks));
  714. samsung_clk_register_alias(ctx, s5pv210_aliases,
  715. ARRAY_SIZE(s5pv210_aliases));
  716. s5pv210_clk_sleep_init();
  717. samsung_clk_of_add_provider(np, ctx);
  718. pr_info("%s clocks: mout_apll = %ld, mout_mpll = %ld\n"
  719. "\tmout_epll = %ld, mout_vpll = %ld\n",
  720. is_s5p6442 ? "S5P6442" : "S5PV210",
  721. _get_rate("mout_apll"), _get_rate("mout_mpll"),
  722. _get_rate("mout_epll"), _get_rate("mout_vpll"));
  723. }
  724. static void __init s5pv210_clk_dt_init(struct device_node *np)
  725. {
  726. reg_base = of_iomap(np, 0);
  727. if (!reg_base)
  728. panic("%s: failed to map registers\n", __func__);
  729. __s5pv210_clk_init(np, 0, 0, false);
  730. }
  731. CLK_OF_DECLARE(s5pv210_clk, "samsung,s5pv210-clock", s5pv210_clk_dt_init);
  732. static void __init s5p6442_clk_dt_init(struct device_node *np)
  733. {
  734. reg_base = of_iomap(np, 0);
  735. if (!reg_base)
  736. panic("%s: failed to map registers\n", __func__);
  737. __s5pv210_clk_init(np, 0, 0, true);
  738. }
  739. CLK_OF_DECLARE(s5p6442_clk, "samsung,s5p6442-clock", s5p6442_clk_dt_init);