clock-s5p6440.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. /* linux/arch/arm/mach-s5p64x0/clock-s5p6440.c
  2. *
  3. * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * S5P6440 - Clock support
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/kernel.h>
  15. #include <linux/list.h>
  16. #include <linux/errno.h>
  17. #include <linux/err.h>
  18. #include <linux/clk.h>
  19. #include <linux/device.h>
  20. #include <linux/io.h>
  21. #include <mach/hardware.h>
  22. #include <mach/map.h>
  23. #include <mach/regs-clock.h>
  24. #include <mach/s5p64x0-clock.h>
  25. #include <plat/cpu-freq.h>
  26. #include <plat/clock.h>
  27. #include <plat/cpu.h>
  28. #include <plat/pll.h>
  29. #include <plat/s5p-clock.h>
  30. #include <plat/clock-clksrc.h>
  31. #include "common.h"
  32. static u32 epll_div[][5] = {
  33. { 36000000, 0, 48, 1, 4 },
  34. { 48000000, 0, 32, 1, 3 },
  35. { 60000000, 0, 40, 1, 3 },
  36. { 72000000, 0, 48, 1, 3 },
  37. { 84000000, 0, 28, 1, 2 },
  38. { 96000000, 0, 32, 1, 2 },
  39. { 32768000, 45264, 43, 1, 4 },
  40. { 45158000, 6903, 30, 1, 3 },
  41. { 49152000, 50332, 32, 1, 3 },
  42. { 67738000, 10398, 45, 1, 3 },
  43. { 73728000, 9961, 49, 1, 3 }
  44. };
  45. static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate)
  46. {
  47. unsigned int epll_con, epll_con_k;
  48. unsigned int i;
  49. if (clk->rate == rate) /* Return if nothing changed */
  50. return 0;
  51. epll_con = __raw_readl(S5P64X0_EPLL_CON);
  52. epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
  53. epll_con_k &= ~(PLL90XX_KDIV_MASK);
  54. epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
  55. for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
  56. if (epll_div[i][0] == rate) {
  57. epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
  58. epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
  59. (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
  60. (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
  61. break;
  62. }
  63. }
  64. if (i == ARRAY_SIZE(epll_div)) {
  65. printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
  66. return -EINVAL;
  67. }
  68. __raw_writel(epll_con, S5P64X0_EPLL_CON);
  69. __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
  70. printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
  71. clk->rate, rate);
  72. clk->rate = rate;
  73. return 0;
  74. }
  75. static struct clk_ops s5p6440_epll_ops = {
  76. .get_rate = s5p_epll_get_rate,
  77. .set_rate = s5p6440_epll_set_rate,
  78. };
  79. static struct clksrc_clk clk_hclk = {
  80. .clk = {
  81. .name = "clk_hclk",
  82. .parent = &clk_armclk.clk,
  83. },
  84. .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
  85. };
  86. static struct clksrc_clk clk_pclk = {
  87. .clk = {
  88. .name = "clk_pclk",
  89. .parent = &clk_hclk.clk,
  90. },
  91. .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
  92. };
  93. static struct clksrc_clk clk_hclk_low = {
  94. .clk = {
  95. .name = "clk_hclk_low",
  96. },
  97. .sources = &clkset_hclk_low,
  98. .reg_src = { .reg = S5P64X0_SYS_OTHERS, .shift = 6, .size = 1 },
  99. .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
  100. };
  101. static struct clksrc_clk clk_pclk_low = {
  102. .clk = {
  103. .name = "clk_pclk_low",
  104. .parent = &clk_hclk_low.clk,
  105. },
  106. .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
  107. };
  108. /*
  109. * The following clocks will be disabled during clock initialization. It is
  110. * recommended to keep the following clocks disabled until the driver requests
  111. * for enabling the clock.
  112. */
  113. static struct clk init_clocks_off[] = {
  114. {
  115. .name = "nand",
  116. .parent = &clk_hclk.clk,
  117. .enable = s5p64x0_mem_ctrl,
  118. .ctrlbit = (1 << 2),
  119. }, {
  120. .name = "post",
  121. .parent = &clk_hclk_low.clk,
  122. .enable = s5p64x0_hclk0_ctrl,
  123. .ctrlbit = (1 << 5)
  124. }, {
  125. .name = "2d",
  126. .parent = &clk_hclk.clk,
  127. .enable = s5p64x0_hclk0_ctrl,
  128. .ctrlbit = (1 << 8),
  129. }, {
  130. .name = "dma",
  131. .devname = "dma-pl330",
  132. .parent = &clk_hclk_low.clk,
  133. .enable = s5p64x0_hclk0_ctrl,
  134. .ctrlbit = (1 << 12),
  135. }, {
  136. .name = "hsmmc",
  137. .devname = "s3c-sdhci.0",
  138. .parent = &clk_hclk_low.clk,
  139. .enable = s5p64x0_hclk0_ctrl,
  140. .ctrlbit = (1 << 17),
  141. }, {
  142. .name = "hsmmc",
  143. .devname = "s3c-sdhci.1",
  144. .parent = &clk_hclk_low.clk,
  145. .enable = s5p64x0_hclk0_ctrl,
  146. .ctrlbit = (1 << 18),
  147. }, {
  148. .name = "hsmmc",
  149. .devname = "s3c-sdhci.2",
  150. .parent = &clk_hclk_low.clk,
  151. .enable = s5p64x0_hclk0_ctrl,
  152. .ctrlbit = (1 << 19),
  153. }, {
  154. .name = "otg",
  155. .parent = &clk_hclk_low.clk,
  156. .enable = s5p64x0_hclk0_ctrl,
  157. .ctrlbit = (1 << 20)
  158. }, {
  159. .name = "irom",
  160. .parent = &clk_hclk.clk,
  161. .enable = s5p64x0_hclk0_ctrl,
  162. .ctrlbit = (1 << 25),
  163. }, {
  164. .name = "lcd",
  165. .parent = &clk_hclk_low.clk,
  166. .enable = s5p64x0_hclk1_ctrl,
  167. .ctrlbit = (1 << 1),
  168. }, {
  169. .name = "hclk_fimgvg",
  170. .parent = &clk_hclk.clk,
  171. .enable = s5p64x0_hclk1_ctrl,
  172. .ctrlbit = (1 << 2),
  173. }, {
  174. .name = "tsi",
  175. .parent = &clk_hclk_low.clk,
  176. .enable = s5p64x0_hclk1_ctrl,
  177. .ctrlbit = (1 << 0),
  178. }, {
  179. .name = "watchdog",
  180. .parent = &clk_pclk_low.clk,
  181. .enable = s5p64x0_pclk_ctrl,
  182. .ctrlbit = (1 << 5),
  183. }, {
  184. .name = "rtc",
  185. .parent = &clk_pclk_low.clk,
  186. .enable = s5p64x0_pclk_ctrl,
  187. .ctrlbit = (1 << 6),
  188. }, {
  189. .name = "timers",
  190. .parent = &clk_pclk_low.clk,
  191. .enable = s5p64x0_pclk_ctrl,
  192. .ctrlbit = (1 << 7),
  193. }, {
  194. .name = "pcm",
  195. .parent = &clk_pclk_low.clk,
  196. .enable = s5p64x0_pclk_ctrl,
  197. .ctrlbit = (1 << 8),
  198. }, {
  199. .name = "adc",
  200. .parent = &clk_pclk_low.clk,
  201. .enable = s5p64x0_pclk_ctrl,
  202. .ctrlbit = (1 << 12),
  203. }, {
  204. .name = "i2c",
  205. .parent = &clk_pclk_low.clk,
  206. .enable = s5p64x0_pclk_ctrl,
  207. .ctrlbit = (1 << 17),
  208. }, {
  209. .name = "spi",
  210. .devname = "s3c64xx-spi.0",
  211. .parent = &clk_pclk_low.clk,
  212. .enable = s5p64x0_pclk_ctrl,
  213. .ctrlbit = (1 << 21),
  214. }, {
  215. .name = "spi",
  216. .devname = "s3c64xx-spi.1",
  217. .parent = &clk_pclk_low.clk,
  218. .enable = s5p64x0_pclk_ctrl,
  219. .ctrlbit = (1 << 22),
  220. }, {
  221. .name = "gps",
  222. .parent = &clk_pclk_low.clk,
  223. .enable = s5p64x0_pclk_ctrl,
  224. .ctrlbit = (1 << 25),
  225. }, {
  226. .name = "iis",
  227. .devname = "samsung-i2s.0",
  228. .parent = &clk_pclk_low.clk,
  229. .enable = s5p64x0_pclk_ctrl,
  230. .ctrlbit = (1 << 26),
  231. }, {
  232. .name = "dsim",
  233. .parent = &clk_pclk_low.clk,
  234. .enable = s5p64x0_pclk_ctrl,
  235. .ctrlbit = (1 << 28),
  236. }, {
  237. .name = "etm",
  238. .parent = &clk_pclk.clk,
  239. .enable = s5p64x0_pclk_ctrl,
  240. .ctrlbit = (1 << 29),
  241. }, {
  242. .name = "dmc0",
  243. .parent = &clk_pclk.clk,
  244. .enable = s5p64x0_pclk_ctrl,
  245. .ctrlbit = (1 << 30),
  246. }, {
  247. .name = "pclk_fimgvg",
  248. .parent = &clk_pclk.clk,
  249. .enable = s5p64x0_pclk_ctrl,
  250. .ctrlbit = (1 << 31),
  251. }, {
  252. .name = "mmc_48m",
  253. .devname = "s3c-sdhci.0",
  254. .parent = &clk_48m,
  255. .enable = s5p64x0_sclk_ctrl,
  256. .ctrlbit = (1 << 27),
  257. }, {
  258. .name = "mmc_48m",
  259. .devname = "s3c-sdhci.1",
  260. .parent = &clk_48m,
  261. .enable = s5p64x0_sclk_ctrl,
  262. .ctrlbit = (1 << 28),
  263. }, {
  264. .name = "mmc_48m",
  265. .devname = "s3c-sdhci.2",
  266. .parent = &clk_48m,
  267. .enable = s5p64x0_sclk_ctrl,
  268. .ctrlbit = (1 << 29),
  269. },
  270. };
  271. /*
  272. * The following clocks will be enabled during clock initialization.
  273. */
  274. static struct clk init_clocks[] = {
  275. {
  276. .name = "intc",
  277. .parent = &clk_hclk.clk,
  278. .enable = s5p64x0_hclk0_ctrl,
  279. .ctrlbit = (1 << 1),
  280. }, {
  281. .name = "mem",
  282. .parent = &clk_hclk.clk,
  283. .enable = s5p64x0_hclk0_ctrl,
  284. .ctrlbit = (1 << 21),
  285. }, {
  286. .name = "uart",
  287. .devname = "s3c6400-uart.0",
  288. .parent = &clk_pclk_low.clk,
  289. .enable = s5p64x0_pclk_ctrl,
  290. .ctrlbit = (1 << 1),
  291. }, {
  292. .name = "uart",
  293. .devname = "s3c6400-uart.1",
  294. .parent = &clk_pclk_low.clk,
  295. .enable = s5p64x0_pclk_ctrl,
  296. .ctrlbit = (1 << 2),
  297. }, {
  298. .name = "uart",
  299. .devname = "s3c6400-uart.2",
  300. .parent = &clk_pclk_low.clk,
  301. .enable = s5p64x0_pclk_ctrl,
  302. .ctrlbit = (1 << 3),
  303. }, {
  304. .name = "uart",
  305. .devname = "s3c6400-uart.3",
  306. .parent = &clk_pclk_low.clk,
  307. .enable = s5p64x0_pclk_ctrl,
  308. .ctrlbit = (1 << 4),
  309. }, {
  310. .name = "gpio",
  311. .parent = &clk_pclk_low.clk,
  312. .enable = s5p64x0_pclk_ctrl,
  313. .ctrlbit = (1 << 18),
  314. },
  315. };
  316. static struct clk clk_iis_cd_v40 = {
  317. .name = "iis_cdclk_v40",
  318. };
  319. static struct clk clk_pcm_cd = {
  320. .name = "pcm_cdclk",
  321. };
  322. static struct clk *clkset_group1_list[] = {
  323. &clk_mout_epll.clk,
  324. &clk_dout_mpll.clk,
  325. &clk_fin_epll,
  326. };
  327. static struct clksrc_sources clkset_group1 = {
  328. .sources = clkset_group1_list,
  329. .nr_sources = ARRAY_SIZE(clkset_group1_list),
  330. };
  331. static struct clk *clkset_uart_list[] = {
  332. &clk_mout_epll.clk,
  333. &clk_dout_mpll.clk,
  334. };
  335. static struct clksrc_sources clkset_uart = {
  336. .sources = clkset_uart_list,
  337. .nr_sources = ARRAY_SIZE(clkset_uart_list),
  338. };
  339. static struct clk *clkset_audio_list[] = {
  340. &clk_mout_epll.clk,
  341. &clk_dout_mpll.clk,
  342. &clk_fin_epll,
  343. &clk_iis_cd_v40,
  344. &clk_pcm_cd,
  345. };
  346. static struct clksrc_sources clkset_audio = {
  347. .sources = clkset_audio_list,
  348. .nr_sources = ARRAY_SIZE(clkset_audio_list),
  349. };
  350. static struct clksrc_clk clksrcs[] = {
  351. {
  352. .clk = {
  353. .name = "sclk_post",
  354. .ctrlbit = (1 << 10),
  355. .enable = s5p64x0_sclk_ctrl,
  356. },
  357. .sources = &clkset_group1,
  358. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
  359. .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
  360. }, {
  361. .clk = {
  362. .name = "sclk_dispcon",
  363. .ctrlbit = (1 << 1),
  364. .enable = s5p64x0_sclk1_ctrl,
  365. },
  366. .sources = &clkset_group1,
  367. .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
  368. .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
  369. }, {
  370. .clk = {
  371. .name = "sclk_fimgvg",
  372. .ctrlbit = (1 << 2),
  373. .enable = s5p64x0_sclk1_ctrl,
  374. },
  375. .sources = &clkset_group1,
  376. .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
  377. .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
  378. }, {
  379. .clk = {
  380. .name = "sclk_audio2",
  381. .ctrlbit = (1 << 11),
  382. .enable = s5p64x0_sclk_ctrl,
  383. },
  384. .sources = &clkset_audio,
  385. .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 0, .size = 3 },
  386. .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 24, .size = 4 },
  387. },
  388. };
  389. static struct clksrc_clk clk_sclk_mmc0 = {
  390. .clk = {
  391. .name = "sclk_mmc",
  392. .devname = "s3c-sdhci.0",
  393. .ctrlbit = (1 << 24),
  394. .enable = s5p64x0_sclk_ctrl,
  395. },
  396. .sources = &clkset_group1,
  397. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
  398. .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
  399. };
  400. static struct clksrc_clk clk_sclk_mmc1 = {
  401. .clk = {
  402. .name = "sclk_mmc",
  403. .devname = "s3c-sdhci.1",
  404. .ctrlbit = (1 << 25),
  405. .enable = s5p64x0_sclk_ctrl,
  406. },
  407. .sources = &clkset_group1,
  408. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
  409. .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
  410. };
  411. static struct clksrc_clk clk_sclk_mmc2 = {
  412. .clk = {
  413. .name = "sclk_mmc",
  414. .devname = "s3c-sdhci.2",
  415. .ctrlbit = (1 << 26),
  416. .enable = s5p64x0_sclk_ctrl,
  417. },
  418. .sources = &clkset_group1,
  419. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
  420. .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
  421. };
  422. static struct clksrc_clk clk_sclk_uclk = {
  423. .clk = {
  424. .name = "uclk1",
  425. .ctrlbit = (1 << 5),
  426. .enable = s5p64x0_sclk_ctrl,
  427. },
  428. .sources = &clkset_uart,
  429. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
  430. .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
  431. };
  432. static struct clksrc_clk clk_sclk_spi0 = {
  433. .clk = {
  434. .name = "sclk_spi",
  435. .devname = "s3c64xx-spi.0",
  436. .ctrlbit = (1 << 20),
  437. .enable = s5p64x0_sclk_ctrl,
  438. },
  439. .sources = &clkset_group1,
  440. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
  441. .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
  442. };
  443. static struct clksrc_clk clk_sclk_spi1 = {
  444. .clk = {
  445. .name = "sclk_spi",
  446. .devname = "s3c64xx-spi.1",
  447. .ctrlbit = (1 << 21),
  448. .enable = s5p64x0_sclk_ctrl,
  449. },
  450. .sources = &clkset_group1,
  451. .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
  452. .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
  453. };
  454. /* Clock initialization code */
  455. static struct clksrc_clk *sysclks[] = {
  456. &clk_mout_apll,
  457. &clk_mout_epll,
  458. &clk_mout_mpll,
  459. &clk_dout_mpll,
  460. &clk_armclk,
  461. &clk_hclk,
  462. &clk_pclk,
  463. &clk_hclk_low,
  464. &clk_pclk_low,
  465. };
  466. static struct clk dummy_apb_pclk = {
  467. .name = "apb_pclk",
  468. .id = -1,
  469. };
  470. static struct clksrc_clk *clksrc_cdev[] = {
  471. &clk_sclk_uclk,
  472. &clk_sclk_spi0,
  473. &clk_sclk_spi1,
  474. &clk_sclk_mmc0,
  475. &clk_sclk_mmc1,
  476. &clk_sclk_mmc2
  477. };
  478. static struct clk_lookup s5p6440_clk_lookup[] = {
  479. CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
  480. CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
  481. CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
  482. CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
  483. CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
  484. CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
  485. CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
  486. CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
  487. };
  488. void __init_or_cpufreq s5p6440_setup_clocks(void)
  489. {
  490. struct clk *xtal_clk;
  491. unsigned long xtal;
  492. unsigned long fclk;
  493. unsigned long hclk;
  494. unsigned long hclk_low;
  495. unsigned long pclk;
  496. unsigned long pclk_low;
  497. unsigned long apll;
  498. unsigned long mpll;
  499. unsigned long epll;
  500. unsigned int ptr;
  501. /* Set S5P6440 functions for clk_fout_epll */
  502. clk_fout_epll.enable = s5p_epll_enable;
  503. clk_fout_epll.ops = &s5p6440_epll_ops;
  504. clk_48m.enable = s5p64x0_clk48m_ctrl;
  505. xtal_clk = clk_get(NULL, "ext_xtal");
  506. BUG_ON(IS_ERR(xtal_clk));
  507. xtal = clk_get_rate(xtal_clk);
  508. clk_put(xtal_clk);
  509. apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
  510. mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
  511. epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
  512. __raw_readl(S5P64X0_EPLL_CON_K));
  513. clk_fout_apll.rate = apll;
  514. clk_fout_mpll.rate = mpll;
  515. clk_fout_epll.rate = epll;
  516. printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
  517. " E=%ld.%ldMHz\n",
  518. print_mhz(apll), print_mhz(mpll), print_mhz(epll));
  519. fclk = clk_get_rate(&clk_armclk.clk);
  520. hclk = clk_get_rate(&clk_hclk.clk);
  521. pclk = clk_get_rate(&clk_pclk.clk);
  522. hclk_low = clk_get_rate(&clk_hclk_low.clk);
  523. pclk_low = clk_get_rate(&clk_pclk_low.clk);
  524. printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
  525. " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
  526. print_mhz(hclk), print_mhz(hclk_low),
  527. print_mhz(pclk), print_mhz(pclk_low));
  528. clk_f.rate = fclk;
  529. clk_h.rate = hclk;
  530. clk_p.rate = pclk;
  531. for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
  532. s3c_set_clksrc(&clksrcs[ptr], true);
  533. }
  534. static struct clk *clks[] __initdata = {
  535. &clk_ext,
  536. &clk_iis_cd_v40,
  537. &clk_pcm_cd,
  538. };
  539. void __init s5p6440_register_clocks(void)
  540. {
  541. int ptr;
  542. s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
  543. for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
  544. s3c_register_clksrc(sysclks[ptr], 1);
  545. s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
  546. s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
  547. for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
  548. s3c_register_clksrc(clksrc_cdev[ptr], 1);
  549. s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
  550. s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
  551. clkdev_add_table(s5p6440_clk_lookup, ARRAY_SIZE(s5p6440_clk_lookup));
  552. s3c24xx_register_clock(&dummy_apb_pclk);
  553. s3c_pwmclk_init();
  554. }