clock.c 15 KB

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