clock.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /* linux/arch/arm/plat-s5pc1xx/clock.c
  2. *
  3. * Copyright 2009 Samsung Electronics Co.
  4. *
  5. * S5PC1XX Base clock support
  6. *
  7. * Based on plat-s3c64xx/clock.c
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/module.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/ioport.h>
  17. #include <linux/clk.h>
  18. #include <linux/io.h>
  19. #include <mach/hardware.h>
  20. #include <mach/map.h>
  21. #include <plat/regs-clock.h>
  22. #include <plat/devs.h>
  23. #include <plat/clock.h>
  24. struct clk clk_27m = {
  25. .name = "clk_27m",
  26. .id = -1,
  27. .rate = 27000000,
  28. };
  29. static int clk_48m_ctrl(struct clk *clk, int enable)
  30. {
  31. unsigned long flags;
  32. u32 val;
  33. /* can't rely on clock lock, this register has other usages */
  34. local_irq_save(flags);
  35. val = __raw_readl(S5PC100_CLKSRC1);
  36. if (enable)
  37. val |= S5PC100_CLKSRC1_CLK48M_MASK;
  38. else
  39. val &= ~S5PC100_CLKSRC1_CLK48M_MASK;
  40. __raw_writel(val, S5PC100_CLKSRC1);
  41. local_irq_restore(flags);
  42. return 0;
  43. }
  44. struct clk clk_48m = {
  45. .name = "clk_48m",
  46. .id = -1,
  47. .rate = 48000000,
  48. .enable = clk_48m_ctrl,
  49. };
  50. struct clk clk_54m = {
  51. .name = "clk_54m",
  52. .id = -1,
  53. .rate = 54000000,
  54. };
  55. static int clk_default_setrate(struct clk *clk, unsigned long rate)
  56. {
  57. clk->rate = rate;
  58. return 0;
  59. }
  60. static int clk_dummy_enable(struct clk *clk, int enable)
  61. {
  62. return 0;
  63. }
  64. struct clk clk_hd0 = {
  65. .name = "hclkd0",
  66. .id = -1,
  67. .rate = 0,
  68. .parent = NULL,
  69. .ctrlbit = 0,
  70. .set_rate = clk_default_setrate,
  71. .enable = clk_dummy_enable,
  72. };
  73. struct clk clk_pd0 = {
  74. .name = "pclkd0",
  75. .id = -1,
  76. .rate = 0,
  77. .parent = NULL,
  78. .ctrlbit = 0,
  79. .set_rate = clk_default_setrate,
  80. .enable = clk_dummy_enable,
  81. };
  82. static int s5pc1xx_clk_gate(void __iomem *reg, struct clk *clk, int enable)
  83. {
  84. unsigned int ctrlbit = clk->ctrlbit;
  85. u32 con;
  86. con = __raw_readl(reg);
  87. if (enable)
  88. con |= ctrlbit;
  89. else
  90. con &= ~ctrlbit;
  91. __raw_writel(con, reg);
  92. return 0;
  93. }
  94. static int s5pc100_clk_d00_ctrl(struct clk *clk, int enable)
  95. {
  96. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D00, clk, enable);
  97. }
  98. static int s5pc100_clk_d01_ctrl(struct clk *clk, int enable)
  99. {
  100. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D01, clk, enable);
  101. }
  102. static int s5pc100_clk_d02_ctrl(struct clk *clk, int enable)
  103. {
  104. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D02, clk, enable);
  105. }
  106. static int s5pc100_clk_d10_ctrl(struct clk *clk, int enable)
  107. {
  108. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D10, clk, enable);
  109. }
  110. static int s5pc100_clk_d11_ctrl(struct clk *clk, int enable)
  111. {
  112. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D11, clk, enable);
  113. }
  114. static int s5pc100_clk_d12_ctrl(struct clk *clk, int enable)
  115. {
  116. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D12, clk, enable);
  117. }
  118. static int s5pc100_clk_d13_ctrl(struct clk *clk, int enable)
  119. {
  120. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D13, clk, enable);
  121. }
  122. static int s5pc100_clk_d14_ctrl(struct clk *clk, int enable)
  123. {
  124. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D14, clk, enable);
  125. }
  126. static int s5pc100_clk_d15_ctrl(struct clk *clk, int enable)
  127. {
  128. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D15, clk, enable);
  129. }
  130. static int s5pc100_clk_d20_ctrl(struct clk *clk, int enable)
  131. {
  132. return s5pc1xx_clk_gate(S5PC100_CLKGATE_D20, clk, enable);
  133. }
  134. int s5pc100_sclk0_ctrl(struct clk *clk, int enable)
  135. {
  136. return s5pc1xx_clk_gate(S5PC100_SCLKGATE0, clk, enable);
  137. }
  138. int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
  139. {
  140. return s5pc1xx_clk_gate(S5PC100_SCLKGATE1, clk, enable);
  141. }
  142. static struct clk s5pc100_init_clocks_disable[] = {
  143. {
  144. .name = "dsi",
  145. .id = -1,
  146. .parent = &clk_p,
  147. .enable = s5pc100_clk_d11_ctrl,
  148. .ctrlbit = S5PC100_CLKGATE_D11_DSI,
  149. }, {
  150. .name = "csi",
  151. .id = -1,
  152. .parent = &clk_h,
  153. .enable = s5pc100_clk_d11_ctrl,
  154. .ctrlbit = S5PC100_CLKGATE_D11_CSI,
  155. }, {
  156. .name = "ccan",
  157. .id = 0,
  158. .parent = &clk_p,
  159. .enable = s5pc100_clk_d14_ctrl,
  160. .ctrlbit = S5PC100_CLKGATE_D14_CCAN0,
  161. }, {
  162. .name = "ccan",
  163. .id = 1,
  164. .parent = &clk_p,
  165. .enable = s5pc100_clk_d14_ctrl,
  166. .ctrlbit = S5PC100_CLKGATE_D14_CCAN1,
  167. }, {
  168. .name = "keypad",
  169. .id = -1,
  170. .parent = &clk_p,
  171. .enable = s5pc100_clk_d15_ctrl,
  172. .ctrlbit = S5PC100_CLKGATE_D15_KEYIF,
  173. }, {
  174. .name = "hclkd2",
  175. .id = -1,
  176. .parent = NULL,
  177. .enable = s5pc100_clk_d20_ctrl,
  178. .ctrlbit = S5PC100_CLKGATE_D20_HCLKD2,
  179. }, {
  180. .name = "iis-d2",
  181. .id = -1,
  182. .parent = NULL,
  183. .enable = s5pc100_clk_d20_ctrl,
  184. .ctrlbit = S5PC100_CLKGATE_D20_I2SD2,
  185. },
  186. };
  187. static struct clk s5pc100_init_clocks[] = {
  188. /* System1 (D0_0) devices */
  189. {
  190. .name = "intc",
  191. .id = -1,
  192. .parent = &clk_hd0,
  193. .enable = s5pc100_clk_d00_ctrl,
  194. .ctrlbit = S5PC100_CLKGATE_D00_INTC,
  195. }, {
  196. .name = "tzic",
  197. .id = -1,
  198. .parent = &clk_hd0,
  199. .enable = s5pc100_clk_d00_ctrl,
  200. .ctrlbit = S5PC100_CLKGATE_D00_TZIC,
  201. }, {
  202. .name = "cf-ata",
  203. .id = -1,
  204. .parent = &clk_hd0,
  205. .enable = s5pc100_clk_d00_ctrl,
  206. .ctrlbit = S5PC100_CLKGATE_D00_CFCON,
  207. }, {
  208. .name = "mdma",
  209. .id = -1,
  210. .parent = &clk_hd0,
  211. .enable = s5pc100_clk_d00_ctrl,
  212. .ctrlbit = S5PC100_CLKGATE_D00_MDMA,
  213. }, {
  214. .name = "g2d",
  215. .id = -1,
  216. .parent = &clk_hd0,
  217. .enable = s5pc100_clk_d00_ctrl,
  218. .ctrlbit = S5PC100_CLKGATE_D00_G2D,
  219. }, {
  220. .name = "secss",
  221. .id = -1,
  222. .parent = &clk_hd0,
  223. .enable = s5pc100_clk_d00_ctrl,
  224. .ctrlbit = S5PC100_CLKGATE_D00_SECSS,
  225. }, {
  226. .name = "cssys",
  227. .id = -1,
  228. .parent = &clk_hd0,
  229. .enable = s5pc100_clk_d00_ctrl,
  230. .ctrlbit = S5PC100_CLKGATE_D00_CSSYS,
  231. },
  232. /* Memory (D0_1) devices */
  233. {
  234. .name = "dmc",
  235. .id = -1,
  236. .parent = &clk_hd0,
  237. .enable = s5pc100_clk_d01_ctrl,
  238. .ctrlbit = S5PC100_CLKGATE_D01_DMC,
  239. }, {
  240. .name = "sromc",
  241. .id = -1,
  242. .parent = &clk_hd0,
  243. .enable = s5pc100_clk_d01_ctrl,
  244. .ctrlbit = S5PC100_CLKGATE_D01_SROMC,
  245. }, {
  246. .name = "onenand",
  247. .id = -1,
  248. .parent = &clk_hd0,
  249. .enable = s5pc100_clk_d01_ctrl,
  250. .ctrlbit = S5PC100_CLKGATE_D01_ONENAND,
  251. }, {
  252. .name = "nand",
  253. .id = -1,
  254. .parent = &clk_hd0,
  255. .enable = s5pc100_clk_d01_ctrl,
  256. .ctrlbit = S5PC100_CLKGATE_D01_NFCON,
  257. }, {
  258. .name = "intmem",
  259. .id = -1,
  260. .parent = &clk_hd0,
  261. .enable = s5pc100_clk_d01_ctrl,
  262. .ctrlbit = S5PC100_CLKGATE_D01_INTMEM,
  263. }, {
  264. .name = "ebi",
  265. .id = -1,
  266. .parent = &clk_hd0,
  267. .enable = s5pc100_clk_d01_ctrl,
  268. .ctrlbit = S5PC100_CLKGATE_D01_EBI,
  269. },
  270. /* System2 (D0_2) devices */
  271. {
  272. .name = "seckey",
  273. .id = -1,
  274. .parent = &clk_pd0,
  275. .enable = s5pc100_clk_d02_ctrl,
  276. .ctrlbit = S5PC100_CLKGATE_D02_SECKEY,
  277. }, {
  278. .name = "sdm",
  279. .id = -1,
  280. .parent = &clk_hd0,
  281. .enable = s5pc100_clk_d02_ctrl,
  282. .ctrlbit = S5PC100_CLKGATE_D02_SDM,
  283. },
  284. /* File (D1_0) devices */
  285. {
  286. .name = "pdma",
  287. .id = 0,
  288. .parent = &clk_h,
  289. .enable = s5pc100_clk_d10_ctrl,
  290. .ctrlbit = S5PC100_CLKGATE_D10_PDMA0,
  291. }, {
  292. .name = "pdma",
  293. .id = 1,
  294. .parent = &clk_h,
  295. .enable = s5pc100_clk_d10_ctrl,
  296. .ctrlbit = S5PC100_CLKGATE_D10_PDMA1,
  297. }, {
  298. .name = "usb-host",
  299. .id = -1,
  300. .parent = &clk_h,
  301. .enable = s5pc100_clk_d10_ctrl,
  302. .ctrlbit = S5PC100_CLKGATE_D10_USBHOST,
  303. }, {
  304. .name = "otg",
  305. .id = -1,
  306. .parent = &clk_h,
  307. .enable = s5pc100_clk_d10_ctrl,
  308. .ctrlbit = S5PC100_CLKGATE_D10_USBOTG,
  309. }, {
  310. .name = "modem",
  311. .id = -1,
  312. .parent = &clk_h,
  313. .enable = s5pc100_clk_d10_ctrl,
  314. .ctrlbit = S5PC100_CLKGATE_D10_MODEMIF,
  315. }, {
  316. .name = "hsmmc",
  317. .id = 0,
  318. .parent = &clk_48m,
  319. .enable = s5pc100_clk_d10_ctrl,
  320. .ctrlbit = S5PC100_CLKGATE_D10_HSMMC0,
  321. }, {
  322. .name = "hsmmc",
  323. .id = 1,
  324. .parent = &clk_48m,
  325. .enable = s5pc100_clk_d10_ctrl,
  326. .ctrlbit = S5PC100_CLKGATE_D10_HSMMC1,
  327. }, {
  328. .name = "hsmmc",
  329. .id = 2,
  330. .parent = &clk_48m,
  331. .enable = s5pc100_clk_d10_ctrl,
  332. .ctrlbit = S5PC100_CLKGATE_D10_HSMMC2,
  333. },
  334. /* Multimedia1 (D1_1) devices */
  335. {
  336. .name = "lcd",
  337. .id = -1,
  338. .parent = &clk_p,
  339. .enable = s5pc100_clk_d11_ctrl,
  340. .ctrlbit = S5PC100_CLKGATE_D11_LCD,
  341. }, {
  342. .name = "rotator",
  343. .id = -1,
  344. .parent = &clk_p,
  345. .enable = s5pc100_clk_d11_ctrl,
  346. .ctrlbit = S5PC100_CLKGATE_D11_ROTATOR,
  347. }, {
  348. .name = "fimc",
  349. .id = -1,
  350. .parent = &clk_p,
  351. .enable = s5pc100_clk_d11_ctrl,
  352. .ctrlbit = S5PC100_CLKGATE_D11_FIMC0,
  353. }, {
  354. .name = "fimc",
  355. .id = -1,
  356. .parent = &clk_p,
  357. .enable = s5pc100_clk_d11_ctrl,
  358. .ctrlbit = S5PC100_CLKGATE_D11_FIMC1,
  359. }, {
  360. .name = "fimc",
  361. .id = -1,
  362. .parent = &clk_p,
  363. .enable = s5pc100_clk_d11_ctrl,
  364. .ctrlbit = S5PC100_CLKGATE_D11_FIMC2,
  365. }, {
  366. .name = "jpeg",
  367. .id = -1,
  368. .parent = &clk_p,
  369. .enable = s5pc100_clk_d11_ctrl,
  370. .ctrlbit = S5PC100_CLKGATE_D11_JPEG,
  371. }, {
  372. .name = "g3d",
  373. .id = -1,
  374. .parent = &clk_p,
  375. .enable = s5pc100_clk_d11_ctrl,
  376. .ctrlbit = S5PC100_CLKGATE_D11_G3D,
  377. },
  378. /* Multimedia2 (D1_2) devices */
  379. {
  380. .name = "tv",
  381. .id = -1,
  382. .parent = &clk_p,
  383. .enable = s5pc100_clk_d12_ctrl,
  384. .ctrlbit = S5PC100_CLKGATE_D12_TV,
  385. }, {
  386. .name = "vp",
  387. .id = -1,
  388. .parent = &clk_p,
  389. .enable = s5pc100_clk_d12_ctrl,
  390. .ctrlbit = S5PC100_CLKGATE_D12_VP,
  391. }, {
  392. .name = "mixer",
  393. .id = -1,
  394. .parent = &clk_p,
  395. .enable = s5pc100_clk_d12_ctrl,
  396. .ctrlbit = S5PC100_CLKGATE_D12_MIXER,
  397. }, {
  398. .name = "hdmi",
  399. .id = -1,
  400. .parent = &clk_p,
  401. .enable = s5pc100_clk_d12_ctrl,
  402. .ctrlbit = S5PC100_CLKGATE_D12_HDMI,
  403. }, {
  404. .name = "mfc",
  405. .id = -1,
  406. .parent = &clk_p,
  407. .enable = s5pc100_clk_d12_ctrl,
  408. .ctrlbit = S5PC100_CLKGATE_D12_MFC,
  409. },
  410. /* System (D1_3) devices */
  411. {
  412. .name = "chipid",
  413. .id = -1,
  414. .parent = &clk_p,
  415. .enable = s5pc100_clk_d13_ctrl,
  416. .ctrlbit = S5PC100_CLKGATE_D13_CHIPID,
  417. }, {
  418. .name = "gpio",
  419. .id = -1,
  420. .parent = &clk_p,
  421. .enable = s5pc100_clk_d13_ctrl,
  422. .ctrlbit = S5PC100_CLKGATE_D13_GPIO,
  423. }, {
  424. .name = "apc",
  425. .id = -1,
  426. .parent = &clk_p,
  427. .enable = s5pc100_clk_d13_ctrl,
  428. .ctrlbit = S5PC100_CLKGATE_D13_APC,
  429. }, {
  430. .name = "iec",
  431. .id = -1,
  432. .parent = &clk_p,
  433. .enable = s5pc100_clk_d13_ctrl,
  434. .ctrlbit = S5PC100_CLKGATE_D13_IEC,
  435. }, {
  436. .name = "timers",
  437. .id = -1,
  438. .parent = &clk_p,
  439. .enable = s5pc100_clk_d13_ctrl,
  440. .ctrlbit = S5PC100_CLKGATE_D13_PWM,
  441. }, {
  442. .name = "systimer",
  443. .id = -1,
  444. .parent = &clk_p,
  445. .enable = s5pc100_clk_d13_ctrl,
  446. .ctrlbit = S5PC100_CLKGATE_D13_SYSTIMER,
  447. }, {
  448. .name = "watchdog",
  449. .id = -1,
  450. .parent = &clk_p,
  451. .enable = s5pc100_clk_d13_ctrl,
  452. .ctrlbit = S5PC100_CLKGATE_D13_WDT,
  453. }, {
  454. .name = "rtc",
  455. .id = -1,
  456. .parent = &clk_p,
  457. .enable = s5pc100_clk_d13_ctrl,
  458. .ctrlbit = S5PC100_CLKGATE_D13_RTC,
  459. },
  460. /* Connectivity (D1_4) devices */
  461. {
  462. .name = "uart",
  463. .id = 0,
  464. .parent = &clk_p,
  465. .enable = s5pc100_clk_d14_ctrl,
  466. .ctrlbit = S5PC100_CLKGATE_D14_UART0,
  467. }, {
  468. .name = "uart",
  469. .id = 1,
  470. .parent = &clk_p,
  471. .enable = s5pc100_clk_d14_ctrl,
  472. .ctrlbit = S5PC100_CLKGATE_D14_UART1,
  473. }, {
  474. .name = "uart",
  475. .id = 2,
  476. .parent = &clk_p,
  477. .enable = s5pc100_clk_d14_ctrl,
  478. .ctrlbit = S5PC100_CLKGATE_D14_UART2,
  479. }, {
  480. .name = "uart",
  481. .id = 3,
  482. .parent = &clk_p,
  483. .enable = s5pc100_clk_d14_ctrl,
  484. .ctrlbit = S5PC100_CLKGATE_D14_UART3,
  485. }, {
  486. .name = "i2c",
  487. .id = -1,
  488. .parent = &clk_p,
  489. .enable = s5pc100_clk_d14_ctrl,
  490. .ctrlbit = S5PC100_CLKGATE_D14_IIC,
  491. }, {
  492. .name = "hdmi-i2c",
  493. .id = -1,
  494. .parent = &clk_p,
  495. .enable = s5pc100_clk_d14_ctrl,
  496. .ctrlbit = S5PC100_CLKGATE_D14_HDMI_IIC,
  497. }, {
  498. .name = "spi",
  499. .id = 0,
  500. .parent = &clk_p,
  501. .enable = s5pc100_clk_d14_ctrl,
  502. .ctrlbit = S5PC100_CLKGATE_D14_SPI0,
  503. }, {
  504. .name = "spi",
  505. .id = 1,
  506. .parent = &clk_p,
  507. .enable = s5pc100_clk_d14_ctrl,
  508. .ctrlbit = S5PC100_CLKGATE_D14_SPI1,
  509. }, {
  510. .name = "spi",
  511. .id = 2,
  512. .parent = &clk_p,
  513. .enable = s5pc100_clk_d14_ctrl,
  514. .ctrlbit = S5PC100_CLKGATE_D14_SPI2,
  515. }, {
  516. .name = "irda",
  517. .id = -1,
  518. .parent = &clk_p,
  519. .enable = s5pc100_clk_d14_ctrl,
  520. .ctrlbit = S5PC100_CLKGATE_D14_IRDA,
  521. }, {
  522. .name = "hsitx",
  523. .id = -1,
  524. .parent = &clk_p,
  525. .enable = s5pc100_clk_d14_ctrl,
  526. .ctrlbit = S5PC100_CLKGATE_D14_HSITX,
  527. }, {
  528. .name = "hsirx",
  529. .id = -1,
  530. .parent = &clk_p,
  531. .enable = s5pc100_clk_d14_ctrl,
  532. .ctrlbit = S5PC100_CLKGATE_D14_HSIRX,
  533. },
  534. /* Audio (D1_5) devices */
  535. {
  536. .name = "iis",
  537. .id = 0,
  538. .parent = &clk_p,
  539. .enable = s5pc100_clk_d15_ctrl,
  540. .ctrlbit = S5PC100_CLKGATE_D15_IIS0,
  541. }, {
  542. .name = "iis",
  543. .id = 1,
  544. .parent = &clk_p,
  545. .enable = s5pc100_clk_d15_ctrl,
  546. .ctrlbit = S5PC100_CLKGATE_D15_IIS1,
  547. }, {
  548. .name = "iis",
  549. .id = 2,
  550. .parent = &clk_p,
  551. .enable = s5pc100_clk_d15_ctrl,
  552. .ctrlbit = S5PC100_CLKGATE_D15_IIS2,
  553. }, {
  554. .name = "ac97",
  555. .id = -1,
  556. .parent = &clk_p,
  557. .enable = s5pc100_clk_d15_ctrl,
  558. .ctrlbit = S5PC100_CLKGATE_D15_AC97,
  559. }, {
  560. .name = "pcm",
  561. .id = 0,
  562. .parent = &clk_p,
  563. .enable = s5pc100_clk_d15_ctrl,
  564. .ctrlbit = S5PC100_CLKGATE_D15_PCM0,
  565. }, {
  566. .name = "pcm",
  567. .id = 1,
  568. .parent = &clk_p,
  569. .enable = s5pc100_clk_d15_ctrl,
  570. .ctrlbit = S5PC100_CLKGATE_D15_PCM1,
  571. }, {
  572. .name = "spdif",
  573. .id = -1,
  574. .parent = &clk_p,
  575. .enable = s5pc100_clk_d15_ctrl,
  576. .ctrlbit = S5PC100_CLKGATE_D15_SPDIF,
  577. }, {
  578. .name = "adc",
  579. .id = -1,
  580. .parent = &clk_p,
  581. .enable = s5pc100_clk_d15_ctrl,
  582. .ctrlbit = S5PC100_CLKGATE_D15_TSADC,
  583. }, {
  584. .name = "cg",
  585. .id = -1,
  586. .parent = &clk_p,
  587. .enable = s5pc100_clk_d15_ctrl,
  588. .ctrlbit = S5PC100_CLKGATE_D15_CG,
  589. },
  590. /* Audio (D2_0) devices: all disabled */
  591. /* Special Clocks 0 */
  592. {
  593. .name = "sclk_hpm",
  594. .id = -1,
  595. .parent = NULL,
  596. .enable = s5pc100_sclk0_ctrl,
  597. .ctrlbit = S5PC100_CLKGATE_SCLK0_HPM,
  598. }, {
  599. .name = "sclk_onenand",
  600. .id = -1,
  601. .parent = NULL,
  602. .enable = s5pc100_sclk0_ctrl,
  603. .ctrlbit = S5PC100_CLKGATE_SCLK0_ONENAND,
  604. }, {
  605. .name = "spi_48",
  606. .id = 0,
  607. .parent = &clk_48m,
  608. .enable = s5pc100_sclk0_ctrl,
  609. .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0_48,
  610. }, {
  611. .name = "spi_48",
  612. .id = 1,
  613. .parent = &clk_48m,
  614. .enable = s5pc100_sclk0_ctrl,
  615. .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1_48,
  616. }, {
  617. .name = "spi_48",
  618. .id = 2,
  619. .parent = &clk_48m,
  620. .enable = s5pc100_sclk0_ctrl,
  621. .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2_48,
  622. }, {
  623. .name = "mmc_48",
  624. .id = 0,
  625. .parent = &clk_48m,
  626. .enable = s5pc100_sclk0_ctrl,
  627. .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0_48,
  628. }, {
  629. .name = "mmc_48",
  630. .id = 1,
  631. .parent = &clk_48m,
  632. .enable = s5pc100_sclk0_ctrl,
  633. .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1_48,
  634. }, {
  635. .name = "mmc_48",
  636. .id = 2,
  637. .parent = &clk_48m,
  638. .enable = s5pc100_sclk0_ctrl,
  639. .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2_48,
  640. },
  641. /* Special Clocks 1 */
  642. };
  643. static struct clk *clks[] __initdata = {
  644. &clk_ext,
  645. &clk_epll,
  646. &clk_27m,
  647. &clk_48m,
  648. &clk_54m,
  649. };
  650. void __init s5pc1xx_register_clocks(void)
  651. {
  652. struct clk *clkp;
  653. int ret;
  654. int ptr;
  655. int size;
  656. s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
  657. clkp = s5pc100_init_clocks;
  658. size = ARRAY_SIZE(s5pc100_init_clocks);
  659. for (ptr = 0; ptr < size; ptr++, clkp++) {
  660. ret = s3c24xx_register_clock(clkp);
  661. if (ret < 0) {
  662. printk(KERN_ERR "Failed to register clock %s (%d)\n",
  663. clkp->name, ret);
  664. }
  665. }
  666. clkp = s5pc100_init_clocks_disable;
  667. size = ARRAY_SIZE(s5pc100_init_clocks_disable);
  668. for (ptr = 0; ptr < size; ptr++, clkp++) {
  669. ret = s3c24xx_register_clock(clkp);
  670. if (ret < 0) {
  671. printk(KERN_ERR "Failed to register clock %s (%d)\n",
  672. clkp->name, ret);
  673. }
  674. (clkp->enable)(clkp, 0);
  675. }
  676. s3c_pwmclk_init();
  677. }