clock.c 15 KB

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