clock.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. /*
  2. * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved.
  3. *
  4. * Author: John Rigby <jrigby@freescale.com>
  5. *
  6. * Implements the clk api defined in include/linux/clk.h
  7. *
  8. * Original based on linux/arch/arm/mach-integrator/clock.c
  9. *
  10. * Copyright (C) 2004 ARM Limited.
  11. * Written by Deep Blue Solutions Limited.
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/list.h>
  19. #include <linux/errno.h>
  20. #include <linux/err.h>
  21. #include <linux/module.h>
  22. #include <linux/string.h>
  23. #include <linux/clk.h>
  24. #include <linux/mutex.h>
  25. #include <linux/io.h>
  26. #include <linux/of_platform.h>
  27. #include <asm/mpc5xxx.h>
  28. #include <asm/mpc5121.h>
  29. #include <asm/clk_interface.h>
  30. #include "mpc512x.h"
  31. #undef CLK_DEBUG
  32. static int clocks_initialized;
  33. #define CLK_HAS_RATE 0x1 /* has rate in MHz */
  34. #define CLK_HAS_CTRL 0x2 /* has control reg and bit */
  35. struct clk {
  36. struct list_head node;
  37. char name[32];
  38. int flags;
  39. struct device *dev;
  40. unsigned long rate;
  41. struct module *owner;
  42. void (*calc) (struct clk *);
  43. struct clk *parent;
  44. int reg, bit; /* CLK_HAS_CTRL */
  45. int div_shift; /* only used by generic_div_clk_calc */
  46. };
  47. static LIST_HEAD(clocks);
  48. static DEFINE_MUTEX(clocks_mutex);
  49. static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
  50. {
  51. struct clk *p, *clk = ERR_PTR(-ENOENT);
  52. int dev_match;
  53. int id_match;
  54. if (dev == NULL || id == NULL)
  55. return clk;
  56. mutex_lock(&clocks_mutex);
  57. list_for_each_entry(p, &clocks, node) {
  58. dev_match = id_match = 0;
  59. if (dev == p->dev)
  60. dev_match++;
  61. if (strcmp(id, p->name) == 0)
  62. id_match++;
  63. if ((dev_match || id_match) && try_module_get(p->owner)) {
  64. clk = p;
  65. break;
  66. }
  67. }
  68. mutex_unlock(&clocks_mutex);
  69. return clk;
  70. }
  71. #ifdef CLK_DEBUG
  72. static void dump_clocks(void)
  73. {
  74. struct clk *p;
  75. mutex_lock(&clocks_mutex);
  76. printk(KERN_INFO "CLOCKS:\n");
  77. list_for_each_entry(p, &clocks, node) {
  78. pr_info(" %s=%ld", p->name, p->rate);
  79. if (p->parent)
  80. pr_cont(" %s=%ld", p->parent->name,
  81. p->parent->rate);
  82. if (p->flags & CLK_HAS_CTRL)
  83. pr_cont(" reg/bit=%d/%d", p->reg, p->bit);
  84. pr_cont("\n");
  85. }
  86. mutex_unlock(&clocks_mutex);
  87. }
  88. #define DEBUG_CLK_DUMP() dump_clocks()
  89. #else
  90. #define DEBUG_CLK_DUMP()
  91. #endif
  92. static void mpc5121_clk_put(struct clk *clk)
  93. {
  94. module_put(clk->owner);
  95. }
  96. #define NRPSC 12
  97. struct mpc512x_clockctl {
  98. u32 spmr; /* System PLL Mode Reg */
  99. u32 sccr[2]; /* System Clk Ctrl Reg 1 & 2 */
  100. u32 scfr1; /* System Clk Freq Reg 1 */
  101. u32 scfr2; /* System Clk Freq Reg 2 */
  102. u32 reserved;
  103. u32 bcr; /* Bread Crumb Reg */
  104. u32 pccr[NRPSC]; /* PSC Clk Ctrl Reg 0-11 */
  105. u32 spccr; /* SPDIF Clk Ctrl Reg */
  106. u32 cccr; /* CFM Clk Ctrl Reg */
  107. u32 dccr; /* DIU Clk Cnfg Reg */
  108. };
  109. static struct mpc512x_clockctl __iomem *clockctl;
  110. static int mpc5121_clk_enable(struct clk *clk)
  111. {
  112. unsigned int mask;
  113. if (clk->flags & CLK_HAS_CTRL) {
  114. mask = in_be32(&clockctl->sccr[clk->reg]);
  115. mask |= 1 << clk->bit;
  116. out_be32(&clockctl->sccr[clk->reg], mask);
  117. }
  118. return 0;
  119. }
  120. static void mpc5121_clk_disable(struct clk *clk)
  121. {
  122. unsigned int mask;
  123. if (clk->flags & CLK_HAS_CTRL) {
  124. mask = in_be32(&clockctl->sccr[clk->reg]);
  125. mask &= ~(1 << clk->bit);
  126. out_be32(&clockctl->sccr[clk->reg], mask);
  127. }
  128. }
  129. static unsigned long mpc5121_clk_get_rate(struct clk *clk)
  130. {
  131. if (clk->flags & CLK_HAS_RATE)
  132. return clk->rate;
  133. else
  134. return 0;
  135. }
  136. static long mpc5121_clk_round_rate(struct clk *clk, unsigned long rate)
  137. {
  138. return rate;
  139. }
  140. static int mpc5121_clk_set_rate(struct clk *clk, unsigned long rate)
  141. {
  142. return 0;
  143. }
  144. static int clk_register(struct clk *clk)
  145. {
  146. mutex_lock(&clocks_mutex);
  147. list_add(&clk->node, &clocks);
  148. mutex_unlock(&clocks_mutex);
  149. return 0;
  150. }
  151. static unsigned long spmf_mult(void)
  152. {
  153. /*
  154. * Convert spmf to multiplier
  155. */
  156. static int spmf_to_mult[] = {
  157. 68, 1, 12, 16,
  158. 20, 24, 28, 32,
  159. 36, 40, 44, 48,
  160. 52, 56, 60, 64
  161. };
  162. int spmf = (in_be32(&clockctl->spmr) >> 24) & 0xf;
  163. return spmf_to_mult[spmf];
  164. }
  165. static unsigned long sysdiv_div_x_2(void)
  166. {
  167. /*
  168. * Convert sysdiv to divisor x 2
  169. * Some divisors have fractional parts so
  170. * multiply by 2 then divide by this value
  171. */
  172. static int sysdiv_to_div_x_2[] = {
  173. 4, 5, 6, 7,
  174. 8, 9, 10, 14,
  175. 12, 16, 18, 22,
  176. 20, 24, 26, 30,
  177. 28, 32, 34, 38,
  178. 36, 40, 42, 46,
  179. 44, 48, 50, 54,
  180. 52, 56, 58, 62,
  181. 60, 64, 66,
  182. };
  183. int sysdiv = (in_be32(&clockctl->scfr2) >> 26) & 0x3f;
  184. return sysdiv_to_div_x_2[sysdiv];
  185. }
  186. static unsigned long ref_to_sys(unsigned long rate)
  187. {
  188. rate *= spmf_mult();
  189. rate *= 2;
  190. rate /= sysdiv_div_x_2();
  191. return rate;
  192. }
  193. static unsigned long sys_to_ref(unsigned long rate)
  194. {
  195. rate *= sysdiv_div_x_2();
  196. rate /= 2;
  197. rate /= spmf_mult();
  198. return rate;
  199. }
  200. static long ips_to_ref(unsigned long rate)
  201. {
  202. int ips_div = (in_be32(&clockctl->scfr1) >> 23) & 0x7;
  203. rate *= ips_div; /* csb_clk = ips_clk * ips_div */
  204. rate *= 2; /* sys_clk = csb_clk * 2 */
  205. return sys_to_ref(rate);
  206. }
  207. static unsigned long devtree_getfreq(char *clockname)
  208. {
  209. struct device_node *np;
  210. const unsigned int *prop;
  211. unsigned int val = 0;
  212. np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-immr");
  213. if (np) {
  214. prop = of_get_property(np, clockname, NULL);
  215. if (prop)
  216. val = *prop;
  217. of_node_put(np);
  218. }
  219. return val;
  220. }
  221. static void ref_clk_calc(struct clk *clk)
  222. {
  223. unsigned long rate;
  224. rate = devtree_getfreq("bus-frequency");
  225. if (rate == 0) {
  226. printk(KERN_ERR "No bus-frequency in dev tree\n");
  227. clk->rate = 0;
  228. return;
  229. }
  230. clk->rate = ips_to_ref(rate);
  231. }
  232. static struct clk ref_clk = {
  233. .name = "ref_clk",
  234. .calc = ref_clk_calc,
  235. };
  236. static void sys_clk_calc(struct clk *clk)
  237. {
  238. clk->rate = ref_to_sys(ref_clk.rate);
  239. }
  240. static struct clk sys_clk = {
  241. .name = "sys_clk",
  242. .calc = sys_clk_calc,
  243. };
  244. static void diu_clk_calc(struct clk *clk)
  245. {
  246. int diudiv_x_2 = in_be32(&clockctl->scfr1) & 0xff;
  247. unsigned long rate;
  248. rate = sys_clk.rate;
  249. rate *= 2;
  250. rate /= diudiv_x_2;
  251. clk->rate = rate;
  252. }
  253. static void viu_clk_calc(struct clk *clk)
  254. {
  255. unsigned long rate;
  256. rate = sys_clk.rate;
  257. rate /= 2;
  258. clk->rate = rate;
  259. }
  260. static void half_clk_calc(struct clk *clk)
  261. {
  262. clk->rate = clk->parent->rate / 2;
  263. }
  264. static void generic_div_clk_calc(struct clk *clk)
  265. {
  266. int div = (in_be32(&clockctl->scfr1) >> clk->div_shift) & 0x7;
  267. clk->rate = clk->parent->rate / div;
  268. }
  269. static void unity_clk_calc(struct clk *clk)
  270. {
  271. clk->rate = clk->parent->rate;
  272. }
  273. static struct clk csb_clk = {
  274. .name = "csb_clk",
  275. .calc = half_clk_calc,
  276. .parent = &sys_clk,
  277. };
  278. static void e300_clk_calc(struct clk *clk)
  279. {
  280. int spmf = (in_be32(&clockctl->spmr) >> 16) & 0xf;
  281. int ratex2 = clk->parent->rate * spmf;
  282. clk->rate = ratex2 / 2;
  283. }
  284. static struct clk e300_clk = {
  285. .name = "e300_clk",
  286. .calc = e300_clk_calc,
  287. .parent = &csb_clk,
  288. };
  289. static struct clk ips_clk = {
  290. .name = "ips_clk",
  291. .calc = generic_div_clk_calc,
  292. .parent = &csb_clk,
  293. .div_shift = 23,
  294. };
  295. /*
  296. * Clocks controlled by SCCR1 (.reg = 0)
  297. */
  298. static struct clk lpc_clk = {
  299. .name = "lpc_clk",
  300. .flags = CLK_HAS_CTRL,
  301. .reg = 0,
  302. .bit = 30,
  303. .calc = generic_div_clk_calc,
  304. .parent = &ips_clk,
  305. .div_shift = 11,
  306. };
  307. static struct clk nfc_clk = {
  308. .name = "nfc_clk",
  309. .flags = CLK_HAS_CTRL,
  310. .reg = 0,
  311. .bit = 29,
  312. .calc = generic_div_clk_calc,
  313. .parent = &ips_clk,
  314. .div_shift = 8,
  315. };
  316. static struct clk pata_clk = {
  317. .name = "pata_clk",
  318. .flags = CLK_HAS_CTRL,
  319. .reg = 0,
  320. .bit = 28,
  321. .calc = unity_clk_calc,
  322. .parent = &ips_clk,
  323. };
  324. /*
  325. * PSC clocks (bits 27 - 16)
  326. * are setup elsewhere
  327. */
  328. static struct clk sata_clk = {
  329. .name = "sata_clk",
  330. .flags = CLK_HAS_CTRL,
  331. .reg = 0,
  332. .bit = 14,
  333. .calc = unity_clk_calc,
  334. .parent = &ips_clk,
  335. };
  336. static struct clk fec_clk = {
  337. .name = "fec_clk",
  338. .flags = CLK_HAS_CTRL,
  339. .reg = 0,
  340. .bit = 13,
  341. .calc = unity_clk_calc,
  342. .parent = &ips_clk,
  343. };
  344. static struct clk pci_clk = {
  345. .name = "pci_clk",
  346. .flags = CLK_HAS_CTRL,
  347. .reg = 0,
  348. .bit = 11,
  349. .calc = generic_div_clk_calc,
  350. .parent = &csb_clk,
  351. .div_shift = 20,
  352. };
  353. /*
  354. * Clocks controlled by SCCR2 (.reg = 1)
  355. */
  356. static struct clk diu_clk = {
  357. .name = "diu_clk",
  358. .flags = CLK_HAS_CTRL,
  359. .reg = 1,
  360. .bit = 31,
  361. .calc = diu_clk_calc,
  362. };
  363. static struct clk viu_clk = {
  364. .name = "viu_clk",
  365. .flags = CLK_HAS_CTRL,
  366. .reg = 1,
  367. .bit = 18,
  368. .calc = viu_clk_calc,
  369. };
  370. static struct clk axe_clk = {
  371. .name = "axe_clk",
  372. .flags = CLK_HAS_CTRL,
  373. .reg = 1,
  374. .bit = 30,
  375. .calc = unity_clk_calc,
  376. .parent = &csb_clk,
  377. };
  378. static struct clk usb1_clk = {
  379. .name = "usb1_clk",
  380. .flags = CLK_HAS_CTRL,
  381. .reg = 1,
  382. .bit = 28,
  383. .calc = unity_clk_calc,
  384. .parent = &csb_clk,
  385. };
  386. static struct clk usb2_clk = {
  387. .name = "usb2_clk",
  388. .flags = CLK_HAS_CTRL,
  389. .reg = 1,
  390. .bit = 27,
  391. .calc = unity_clk_calc,
  392. .parent = &csb_clk,
  393. };
  394. static struct clk i2c_clk = {
  395. .name = "i2c_clk",
  396. .flags = CLK_HAS_CTRL,
  397. .reg = 1,
  398. .bit = 26,
  399. .calc = unity_clk_calc,
  400. .parent = &ips_clk,
  401. };
  402. static struct clk mscan_clk = {
  403. .name = "mscan_clk",
  404. .flags = CLK_HAS_CTRL,
  405. .reg = 1,
  406. .bit = 25,
  407. .calc = unity_clk_calc,
  408. .parent = &ips_clk,
  409. };
  410. static struct clk sdhc_clk = {
  411. .name = "sdhc_clk",
  412. .flags = CLK_HAS_CTRL,
  413. .reg = 1,
  414. .bit = 24,
  415. .calc = unity_clk_calc,
  416. .parent = &ips_clk,
  417. };
  418. static struct clk mbx_bus_clk = {
  419. .name = "mbx_bus_clk",
  420. .flags = CLK_HAS_CTRL,
  421. .reg = 1,
  422. .bit = 22,
  423. .calc = half_clk_calc,
  424. .parent = &csb_clk,
  425. };
  426. static struct clk mbx_clk = {
  427. .name = "mbx_clk",
  428. .flags = CLK_HAS_CTRL,
  429. .reg = 1,
  430. .bit = 21,
  431. .calc = unity_clk_calc,
  432. .parent = &csb_clk,
  433. };
  434. static struct clk mbx_3d_clk = {
  435. .name = "mbx_3d_clk",
  436. .flags = CLK_HAS_CTRL,
  437. .reg = 1,
  438. .bit = 20,
  439. .calc = generic_div_clk_calc,
  440. .parent = &mbx_bus_clk,
  441. .div_shift = 14,
  442. };
  443. static void psc_mclk_in_calc(struct clk *clk)
  444. {
  445. clk->rate = devtree_getfreq("psc_mclk_in");
  446. if (!clk->rate)
  447. clk->rate = 25000000;
  448. }
  449. static struct clk psc_mclk_in = {
  450. .name = "psc_mclk_in",
  451. .calc = psc_mclk_in_calc,
  452. };
  453. static struct clk spdif_txclk = {
  454. .name = "spdif_txclk",
  455. .flags = CLK_HAS_CTRL,
  456. .reg = 1,
  457. .bit = 23,
  458. };
  459. static struct clk spdif_rxclk = {
  460. .name = "spdif_rxclk",
  461. .flags = CLK_HAS_CTRL,
  462. .reg = 1,
  463. .bit = 23,
  464. };
  465. static void ac97_clk_calc(struct clk *clk)
  466. {
  467. /* ac97 bit clock is always 24.567 MHz */
  468. clk->rate = 24567000;
  469. }
  470. static struct clk ac97_clk = {
  471. .name = "ac97_clk_in",
  472. .calc = ac97_clk_calc,
  473. };
  474. static struct clk *rate_clks[] = {
  475. &ref_clk,
  476. &sys_clk,
  477. &diu_clk,
  478. &viu_clk,
  479. &csb_clk,
  480. &e300_clk,
  481. &ips_clk,
  482. &fec_clk,
  483. &sata_clk,
  484. &pata_clk,
  485. &nfc_clk,
  486. &lpc_clk,
  487. &mbx_bus_clk,
  488. &mbx_clk,
  489. &mbx_3d_clk,
  490. &axe_clk,
  491. &usb1_clk,
  492. &usb2_clk,
  493. &i2c_clk,
  494. &mscan_clk,
  495. &sdhc_clk,
  496. &pci_clk,
  497. &psc_mclk_in,
  498. &spdif_txclk,
  499. &spdif_rxclk,
  500. &ac97_clk,
  501. NULL
  502. };
  503. static void rate_clk_init(struct clk *clk)
  504. {
  505. if (clk->calc) {
  506. clk->calc(clk);
  507. clk->flags |= CLK_HAS_RATE;
  508. clk_register(clk);
  509. } else {
  510. printk(KERN_WARNING
  511. "Could not initialize clk %s without a calc routine\n",
  512. clk->name);
  513. }
  514. }
  515. static void rate_clks_init(void)
  516. {
  517. struct clk **cpp, *clk;
  518. cpp = rate_clks;
  519. while ((clk = *cpp++))
  520. rate_clk_init(clk);
  521. }
  522. /*
  523. * There are two clk enable registers with 32 enable bits each
  524. * psc clocks and device clocks are all stored in dev_clks
  525. */
  526. static struct clk dev_clks[2][32];
  527. /*
  528. * Given a psc number return the dev_clk
  529. * associated with it
  530. */
  531. static struct clk *psc_dev_clk(int pscnum)
  532. {
  533. int reg, bit;
  534. struct clk *clk;
  535. reg = 0;
  536. bit = 27 - pscnum;
  537. clk = &dev_clks[reg][bit];
  538. clk->reg = 0;
  539. clk->bit = bit;
  540. return clk;
  541. }
  542. /*
  543. * PSC clock rate calculation
  544. */
  545. static void psc_calc_rate(struct clk *clk, int pscnum, struct device_node *np)
  546. {
  547. unsigned long mclk_src = sys_clk.rate;
  548. unsigned long mclk_div;
  549. /*
  550. * Can only change value of mclk divider
  551. * when the divider is disabled.
  552. *
  553. * Zero is not a valid divider so minimum
  554. * divider is 1
  555. *
  556. * disable/set divider/enable
  557. */
  558. out_be32(&clockctl->pccr[pscnum], 0);
  559. out_be32(&clockctl->pccr[pscnum], 0x00020000);
  560. out_be32(&clockctl->pccr[pscnum], 0x00030000);
  561. if (in_be32(&clockctl->pccr[pscnum]) & 0x80) {
  562. clk->rate = spdif_rxclk.rate;
  563. return;
  564. }
  565. switch ((in_be32(&clockctl->pccr[pscnum]) >> 14) & 0x3) {
  566. case 0:
  567. mclk_src = sys_clk.rate;
  568. break;
  569. case 1:
  570. mclk_src = ref_clk.rate;
  571. break;
  572. case 2:
  573. mclk_src = psc_mclk_in.rate;
  574. break;
  575. case 3:
  576. mclk_src = spdif_txclk.rate;
  577. break;
  578. }
  579. mclk_div = ((in_be32(&clockctl->pccr[pscnum]) >> 17) & 0x7fff) + 1;
  580. clk->rate = mclk_src / mclk_div;
  581. }
  582. /*
  583. * Find all psc nodes in device tree and assign a clock
  584. * with name "psc%d_mclk" and dev pointing at the device
  585. * returned from of_find_device_by_node
  586. */
  587. static void psc_clks_init(void)
  588. {
  589. struct device_node *np;
  590. struct platform_device *ofdev;
  591. u32 reg;
  592. const char *psc_compat;
  593. psc_compat = mpc512x_select_psc_compat();
  594. if (!psc_compat)
  595. return;
  596. for_each_compatible_node(np, NULL, psc_compat) {
  597. if (!of_property_read_u32(np, "reg", &reg)) {
  598. int pscnum = (reg & 0xf00) >> 8;
  599. struct clk *clk = psc_dev_clk(pscnum);
  600. clk->flags = CLK_HAS_RATE | CLK_HAS_CTRL;
  601. ofdev = of_find_device_by_node(np);
  602. clk->dev = &ofdev->dev;
  603. /*
  604. * AC97 is special rate clock does
  605. * not go through normal path
  606. */
  607. if (of_device_is_compatible(np, "fsl,mpc5121-psc-ac97"))
  608. clk->rate = ac97_clk.rate;
  609. else
  610. psc_calc_rate(clk, pscnum, np);
  611. sprintf(clk->name, "psc%d_mclk", pscnum);
  612. clk_register(clk);
  613. clk_enable(clk);
  614. }
  615. }
  616. }
  617. static struct clk_interface mpc5121_clk_functions = {
  618. .clk_get = mpc5121_clk_get,
  619. .clk_enable = mpc5121_clk_enable,
  620. .clk_disable = mpc5121_clk_disable,
  621. .clk_get_rate = mpc5121_clk_get_rate,
  622. .clk_put = mpc5121_clk_put,
  623. .clk_round_rate = mpc5121_clk_round_rate,
  624. .clk_set_rate = mpc5121_clk_set_rate,
  625. .clk_set_parent = NULL,
  626. .clk_get_parent = NULL,
  627. };
  628. int __init mpc5121_clk_init(void)
  629. {
  630. struct device_node *np;
  631. np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
  632. if (np) {
  633. clockctl = of_iomap(np, 0);
  634. of_node_put(np);
  635. }
  636. if (!clockctl) {
  637. printk(KERN_ERR "Could not map clock control registers\n");
  638. return 0;
  639. }
  640. rate_clks_init();
  641. psc_clks_init();
  642. /* leave clockctl mapped forever */
  643. /*iounmap(clockctl); */
  644. DEBUG_CLK_DUMP();
  645. clocks_initialized++;
  646. clk_functions = mpc5121_clk_functions;
  647. return 0;
  648. }