core.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. /*
  2. * SuperH clock framework
  3. *
  4. * Copyright (C) 2005 - 2010 Paul Mundt
  5. *
  6. * This clock framework is derived from the OMAP version by:
  7. *
  8. * Copyright (C) 2004 - 2008 Nokia Corporation
  9. * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
  10. *
  11. * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
  12. *
  13. * This file is subject to the terms and conditions of the GNU General Public
  14. * License. See the file "COPYING" in the main directory of this archive
  15. * for more details.
  16. */
  17. #define pr_fmt(fmt) "clock: " fmt
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/module.h>
  21. #include <linux/mutex.h>
  22. #include <linux/list.h>
  23. #include <linux/kobject.h>
  24. #include <linux/sysdev.h>
  25. #include <linux/seq_file.h>
  26. #include <linux/err.h>
  27. #include <linux/io.h>
  28. #include <linux/debugfs.h>
  29. #include <linux/cpufreq.h>
  30. #include <linux/clk.h>
  31. #include <linux/sh_clk.h>
  32. static LIST_HEAD(clock_list);
  33. static DEFINE_SPINLOCK(clock_lock);
  34. static DEFINE_MUTEX(clock_list_sem);
  35. void clk_rate_table_build(struct clk *clk,
  36. struct cpufreq_frequency_table *freq_table,
  37. int nr_freqs,
  38. struct clk_div_mult_table *src_table,
  39. unsigned long *bitmap)
  40. {
  41. unsigned long mult, div;
  42. unsigned long freq;
  43. int i;
  44. clk->nr_freqs = nr_freqs;
  45. for (i = 0; i < nr_freqs; i++) {
  46. div = 1;
  47. mult = 1;
  48. if (src_table->divisors && i < src_table->nr_divisors)
  49. div = src_table->divisors[i];
  50. if (src_table->multipliers && i < src_table->nr_multipliers)
  51. mult = src_table->multipliers[i];
  52. if (!div || !mult || (bitmap && !test_bit(i, bitmap)))
  53. freq = CPUFREQ_ENTRY_INVALID;
  54. else
  55. freq = clk->parent->rate * mult / div;
  56. freq_table[i].index = i;
  57. freq_table[i].frequency = freq;
  58. }
  59. /* Termination entry */
  60. freq_table[i].index = i;
  61. freq_table[i].frequency = CPUFREQ_TABLE_END;
  62. }
  63. struct clk_rate_round_data;
  64. struct clk_rate_round_data {
  65. unsigned long rate;
  66. unsigned int min, max;
  67. long (*func)(unsigned int, struct clk_rate_round_data *);
  68. void *arg;
  69. };
  70. #define for_each_frequency(pos, r, freq) \
  71. for (pos = r->min, freq = r->func(pos, r); \
  72. pos <= r->max; pos++, freq = r->func(pos, r)) \
  73. if (unlikely(freq == 0)) \
  74. ; \
  75. else
  76. static long clk_rate_round_helper(struct clk_rate_round_data *rounder)
  77. {
  78. unsigned long rate_error, rate_error_prev = ~0UL;
  79. unsigned long highest, lowest, freq;
  80. long rate_best_fit = -ENOENT;
  81. int i;
  82. highest = 0;
  83. lowest = ~0UL;
  84. for_each_frequency(i, rounder, freq) {
  85. if (freq > highest)
  86. highest = freq;
  87. if (freq < lowest)
  88. lowest = freq;
  89. rate_error = abs(freq - rounder->rate);
  90. if (rate_error < rate_error_prev) {
  91. rate_best_fit = freq;
  92. rate_error_prev = rate_error;
  93. }
  94. if (rate_error == 0)
  95. break;
  96. }
  97. if (rounder->rate >= highest)
  98. rate_best_fit = highest;
  99. if (rounder->rate <= lowest)
  100. rate_best_fit = lowest;
  101. return rate_best_fit;
  102. }
  103. static long clk_rate_table_iter(unsigned int pos,
  104. struct clk_rate_round_data *rounder)
  105. {
  106. struct cpufreq_frequency_table *freq_table = rounder->arg;
  107. unsigned long freq = freq_table[pos].frequency;
  108. if (freq == CPUFREQ_ENTRY_INVALID)
  109. freq = 0;
  110. return freq;
  111. }
  112. long clk_rate_table_round(struct clk *clk,
  113. struct cpufreq_frequency_table *freq_table,
  114. unsigned long rate)
  115. {
  116. struct clk_rate_round_data table_round = {
  117. .min = 0,
  118. .max = clk->nr_freqs - 1,
  119. .func = clk_rate_table_iter,
  120. .arg = freq_table,
  121. .rate = rate,
  122. };
  123. if (clk->nr_freqs < 1)
  124. return -ENOSYS;
  125. return clk_rate_round_helper(&table_round);
  126. }
  127. static long clk_rate_div_range_iter(unsigned int pos,
  128. struct clk_rate_round_data *rounder)
  129. {
  130. return clk_get_rate(rounder->arg) / pos;
  131. }
  132. long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
  133. unsigned int div_max, unsigned long rate)
  134. {
  135. struct clk_rate_round_data div_range_round = {
  136. .min = div_min,
  137. .max = div_max,
  138. .func = clk_rate_div_range_iter,
  139. .arg = clk_get_parent(clk),
  140. .rate = rate,
  141. };
  142. return clk_rate_round_helper(&div_range_round);
  143. }
  144. int clk_rate_table_find(struct clk *clk,
  145. struct cpufreq_frequency_table *freq_table,
  146. unsigned long rate)
  147. {
  148. int i;
  149. for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
  150. unsigned long freq = freq_table[i].frequency;
  151. if (freq == CPUFREQ_ENTRY_INVALID)
  152. continue;
  153. if (freq == rate)
  154. return i;
  155. }
  156. return -ENOENT;
  157. }
  158. /* Used for clocks that always have same value as the parent clock */
  159. unsigned long followparent_recalc(struct clk *clk)
  160. {
  161. return clk->parent ? clk->parent->rate : 0;
  162. }
  163. int clk_reparent(struct clk *child, struct clk *parent)
  164. {
  165. list_del_init(&child->sibling);
  166. if (parent)
  167. list_add(&child->sibling, &parent->children);
  168. child->parent = parent;
  169. /* now do the debugfs renaming to reattach the child
  170. to the proper parent */
  171. return 0;
  172. }
  173. /* Propagate rate to children */
  174. void propagate_rate(struct clk *tclk)
  175. {
  176. struct clk *clkp;
  177. list_for_each_entry(clkp, &tclk->children, sibling) {
  178. if (clkp->ops && clkp->ops->recalc)
  179. clkp->rate = clkp->ops->recalc(clkp);
  180. propagate_rate(clkp);
  181. }
  182. }
  183. static void __clk_disable(struct clk *clk)
  184. {
  185. if (WARN(!clk->usecount, "Trying to disable clock %p with 0 usecount\n",
  186. clk))
  187. return;
  188. if (!(--clk->usecount)) {
  189. if (likely(clk->ops && clk->ops->disable))
  190. clk->ops->disable(clk);
  191. if (likely(clk->parent))
  192. __clk_disable(clk->parent);
  193. }
  194. }
  195. void clk_disable(struct clk *clk)
  196. {
  197. unsigned long flags;
  198. if (!clk)
  199. return;
  200. spin_lock_irqsave(&clock_lock, flags);
  201. __clk_disable(clk);
  202. spin_unlock_irqrestore(&clock_lock, flags);
  203. }
  204. EXPORT_SYMBOL_GPL(clk_disable);
  205. static int __clk_enable(struct clk *clk)
  206. {
  207. int ret = 0;
  208. if (clk->usecount++ == 0) {
  209. if (clk->parent) {
  210. ret = __clk_enable(clk->parent);
  211. if (unlikely(ret))
  212. goto err;
  213. }
  214. if (clk->ops && clk->ops->enable) {
  215. ret = clk->ops->enable(clk);
  216. if (ret) {
  217. if (clk->parent)
  218. __clk_disable(clk->parent);
  219. goto err;
  220. }
  221. }
  222. }
  223. return ret;
  224. err:
  225. clk->usecount--;
  226. return ret;
  227. }
  228. int clk_enable(struct clk *clk)
  229. {
  230. unsigned long flags;
  231. int ret;
  232. if (!clk)
  233. return -EINVAL;
  234. spin_lock_irqsave(&clock_lock, flags);
  235. ret = __clk_enable(clk);
  236. spin_unlock_irqrestore(&clock_lock, flags);
  237. return ret;
  238. }
  239. EXPORT_SYMBOL_GPL(clk_enable);
  240. static LIST_HEAD(root_clks);
  241. /**
  242. * recalculate_root_clocks - recalculate and propagate all root clocks
  243. *
  244. * Recalculates all root clocks (clocks with no parent), which if the
  245. * clock's .recalc is set correctly, should also propagate their rates.
  246. * Called at init.
  247. */
  248. void recalculate_root_clocks(void)
  249. {
  250. struct clk *clkp;
  251. list_for_each_entry(clkp, &root_clks, sibling) {
  252. if (clkp->ops && clkp->ops->recalc)
  253. clkp->rate = clkp->ops->recalc(clkp);
  254. propagate_rate(clkp);
  255. }
  256. }
  257. static struct clk_mapping dummy_mapping;
  258. static struct clk *lookup_root_clock(struct clk *clk)
  259. {
  260. while (clk->parent)
  261. clk = clk->parent;
  262. return clk;
  263. }
  264. static int clk_establish_mapping(struct clk *clk)
  265. {
  266. struct clk_mapping *mapping = clk->mapping;
  267. /*
  268. * Propagate mappings.
  269. */
  270. if (!mapping) {
  271. struct clk *clkp;
  272. /*
  273. * dummy mapping for root clocks with no specified ranges
  274. */
  275. if (!clk->parent) {
  276. clk->mapping = &dummy_mapping;
  277. return 0;
  278. }
  279. /*
  280. * If we're on a child clock and it provides no mapping of its
  281. * own, inherit the mapping from its root clock.
  282. */
  283. clkp = lookup_root_clock(clk);
  284. mapping = clkp->mapping;
  285. BUG_ON(!mapping);
  286. }
  287. /*
  288. * Establish initial mapping.
  289. */
  290. if (!mapping->base && mapping->phys) {
  291. kref_init(&mapping->ref);
  292. mapping->base = ioremap_nocache(mapping->phys, mapping->len);
  293. if (unlikely(!mapping->base))
  294. return -ENXIO;
  295. } else if (mapping->base) {
  296. /*
  297. * Bump the refcount for an existing mapping
  298. */
  299. kref_get(&mapping->ref);
  300. }
  301. clk->mapping = mapping;
  302. return 0;
  303. }
  304. static void clk_destroy_mapping(struct kref *kref)
  305. {
  306. struct clk_mapping *mapping;
  307. mapping = container_of(kref, struct clk_mapping, ref);
  308. iounmap(mapping->base);
  309. }
  310. static void clk_teardown_mapping(struct clk *clk)
  311. {
  312. struct clk_mapping *mapping = clk->mapping;
  313. /* Nothing to do */
  314. if (mapping == &dummy_mapping)
  315. return;
  316. kref_put(&mapping->ref, clk_destroy_mapping);
  317. clk->mapping = NULL;
  318. }
  319. int clk_register(struct clk *clk)
  320. {
  321. int ret;
  322. if (clk == NULL || IS_ERR(clk))
  323. return -EINVAL;
  324. /*
  325. * trap out already registered clocks
  326. */
  327. if (clk->node.next || clk->node.prev)
  328. return 0;
  329. mutex_lock(&clock_list_sem);
  330. INIT_LIST_HEAD(&clk->children);
  331. clk->usecount = 0;
  332. ret = clk_establish_mapping(clk);
  333. if (unlikely(ret))
  334. goto out_unlock;
  335. if (clk->parent)
  336. list_add(&clk->sibling, &clk->parent->children);
  337. else
  338. list_add(&clk->sibling, &root_clks);
  339. list_add(&clk->node, &clock_list);
  340. if (clk->ops && clk->ops->init)
  341. clk->ops->init(clk);
  342. out_unlock:
  343. mutex_unlock(&clock_list_sem);
  344. return ret;
  345. }
  346. EXPORT_SYMBOL_GPL(clk_register);
  347. void clk_unregister(struct clk *clk)
  348. {
  349. mutex_lock(&clock_list_sem);
  350. list_del(&clk->sibling);
  351. list_del(&clk->node);
  352. clk_teardown_mapping(clk);
  353. mutex_unlock(&clock_list_sem);
  354. }
  355. EXPORT_SYMBOL_GPL(clk_unregister);
  356. void clk_enable_init_clocks(void)
  357. {
  358. struct clk *clkp;
  359. list_for_each_entry(clkp, &clock_list, node)
  360. if (clkp->flags & CLK_ENABLE_ON_INIT)
  361. clk_enable(clkp);
  362. }
  363. unsigned long clk_get_rate(struct clk *clk)
  364. {
  365. return clk->rate;
  366. }
  367. EXPORT_SYMBOL_GPL(clk_get_rate);
  368. int clk_set_rate(struct clk *clk, unsigned long rate)
  369. {
  370. int ret = -EOPNOTSUPP;
  371. unsigned long flags;
  372. spin_lock_irqsave(&clock_lock, flags);
  373. if (likely(clk->ops && clk->ops->set_rate)) {
  374. ret = clk->ops->set_rate(clk, rate, 0);
  375. if (ret != 0)
  376. goto out_unlock;
  377. } else {
  378. clk->rate = rate;
  379. ret = 0;
  380. }
  381. if (clk->ops && clk->ops->recalc)
  382. clk->rate = clk->ops->recalc(clk);
  383. propagate_rate(clk);
  384. out_unlock:
  385. spin_unlock_irqrestore(&clock_lock, flags);
  386. return ret;
  387. }
  388. EXPORT_SYMBOL_GPL(clk_set_rate);
  389. int clk_set_parent(struct clk *clk, struct clk *parent)
  390. {
  391. unsigned long flags;
  392. int ret = -EINVAL;
  393. if (!parent || !clk)
  394. return ret;
  395. if (clk->parent == parent)
  396. return 0;
  397. spin_lock_irqsave(&clock_lock, flags);
  398. if (clk->usecount == 0) {
  399. if (clk->ops->set_parent)
  400. ret = clk->ops->set_parent(clk, parent);
  401. else
  402. ret = clk_reparent(clk, parent);
  403. if (ret == 0) {
  404. if (clk->ops->recalc)
  405. clk->rate = clk->ops->recalc(clk);
  406. pr_debug("set parent of %p to %p (new rate %ld)\n",
  407. clk, clk->parent, clk->rate);
  408. propagate_rate(clk);
  409. }
  410. } else
  411. ret = -EBUSY;
  412. spin_unlock_irqrestore(&clock_lock, flags);
  413. return ret;
  414. }
  415. EXPORT_SYMBOL_GPL(clk_set_parent);
  416. struct clk *clk_get_parent(struct clk *clk)
  417. {
  418. return clk->parent;
  419. }
  420. EXPORT_SYMBOL_GPL(clk_get_parent);
  421. long clk_round_rate(struct clk *clk, unsigned long rate)
  422. {
  423. if (likely(clk->ops && clk->ops->round_rate)) {
  424. unsigned long flags, rounded;
  425. spin_lock_irqsave(&clock_lock, flags);
  426. rounded = clk->ops->round_rate(clk, rate);
  427. spin_unlock_irqrestore(&clock_lock, flags);
  428. return rounded;
  429. }
  430. return clk_get_rate(clk);
  431. }
  432. EXPORT_SYMBOL_GPL(clk_round_rate);
  433. long clk_round_parent(struct clk *clk, unsigned long target,
  434. unsigned long *best_freq, unsigned long *parent_freq,
  435. unsigned int div_min, unsigned int div_max)
  436. {
  437. struct cpufreq_frequency_table *freq, *best = NULL;
  438. unsigned long error = ULONG_MAX, freq_high, freq_low, div;
  439. struct clk *parent = clk_get_parent(clk);
  440. if (!parent) {
  441. *parent_freq = 0;
  442. *best_freq = clk_round_rate(clk, target);
  443. return abs(target - *best_freq);
  444. }
  445. for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END;
  446. freq++) {
  447. if (freq->frequency == CPUFREQ_ENTRY_INVALID)
  448. continue;
  449. if (unlikely(freq->frequency / target <= div_min - 1)) {
  450. unsigned long freq_max;
  451. freq_max = (freq->frequency + div_min / 2) / div_min;
  452. if (error > target - freq_max) {
  453. error = target - freq_max;
  454. best = freq;
  455. if (best_freq)
  456. *best_freq = freq_max;
  457. }
  458. pr_debug("too low freq %u, error %lu\n", freq->frequency,
  459. target - freq_max);
  460. if (!error)
  461. break;
  462. continue;
  463. }
  464. if (unlikely(freq->frequency / target >= div_max)) {
  465. unsigned long freq_min;
  466. freq_min = (freq->frequency + div_max / 2) / div_max;
  467. if (error > freq_min - target) {
  468. error = freq_min - target;
  469. best = freq;
  470. if (best_freq)
  471. *best_freq = freq_min;
  472. }
  473. pr_debug("too high freq %u, error %lu\n", freq->frequency,
  474. freq_min - target);
  475. if (!error)
  476. break;
  477. continue;
  478. }
  479. div = freq->frequency / target;
  480. freq_high = freq->frequency / div;
  481. freq_low = freq->frequency / (div + 1);
  482. if (freq_high - target < error) {
  483. error = freq_high - target;
  484. best = freq;
  485. if (best_freq)
  486. *best_freq = freq_high;
  487. }
  488. if (target - freq_low < error) {
  489. error = target - freq_low;
  490. best = freq;
  491. if (best_freq)
  492. *best_freq = freq_low;
  493. }
  494. pr_debug("%u / %lu = %lu, / %lu = %lu, best %lu, parent %u\n",
  495. freq->frequency, div, freq_high, div + 1, freq_low,
  496. *best_freq, best->frequency);
  497. if (!error)
  498. break;
  499. }
  500. if (parent_freq)
  501. *parent_freq = best->frequency;
  502. return error;
  503. }
  504. EXPORT_SYMBOL_GPL(clk_round_parent);
  505. #ifdef CONFIG_PM
  506. static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
  507. {
  508. static pm_message_t prev_state;
  509. struct clk *clkp;
  510. switch (state.event) {
  511. case PM_EVENT_ON:
  512. /* Resumeing from hibernation */
  513. if (prev_state.event != PM_EVENT_FREEZE)
  514. break;
  515. list_for_each_entry(clkp, &clock_list, node) {
  516. if (likely(clkp->ops)) {
  517. unsigned long rate = clkp->rate;
  518. if (likely(clkp->ops->set_parent))
  519. clkp->ops->set_parent(clkp,
  520. clkp->parent);
  521. if (likely(clkp->ops->set_rate))
  522. clkp->ops->set_rate(clkp,
  523. rate, 0);
  524. else if (likely(clkp->ops->recalc))
  525. clkp->rate = clkp->ops->recalc(clkp);
  526. }
  527. }
  528. break;
  529. case PM_EVENT_FREEZE:
  530. break;
  531. case PM_EVENT_SUSPEND:
  532. break;
  533. }
  534. prev_state = state;
  535. return 0;
  536. }
  537. static int clks_sysdev_resume(struct sys_device *dev)
  538. {
  539. return clks_sysdev_suspend(dev, PMSG_ON);
  540. }
  541. static struct sysdev_class clks_sysdev_class = {
  542. .name = "clks",
  543. };
  544. static struct sysdev_driver clks_sysdev_driver = {
  545. .suspend = clks_sysdev_suspend,
  546. .resume = clks_sysdev_resume,
  547. };
  548. static struct sys_device clks_sysdev_dev = {
  549. .cls = &clks_sysdev_class,
  550. };
  551. static int __init clk_sysdev_init(void)
  552. {
  553. sysdev_class_register(&clks_sysdev_class);
  554. sysdev_driver_register(&clks_sysdev_class, &clks_sysdev_driver);
  555. sysdev_register(&clks_sysdev_dev);
  556. return 0;
  557. }
  558. subsys_initcall(clk_sysdev_init);
  559. #endif
  560. /*
  561. * debugfs support to trace clock tree hierarchy and attributes
  562. */
  563. static struct dentry *clk_debugfs_root;
  564. static int clk_debugfs_register_one(struct clk *c)
  565. {
  566. int err;
  567. struct dentry *d, *child, *child_tmp;
  568. struct clk *pa = c->parent;
  569. char s[255];
  570. char *p = s;
  571. p += sprintf(p, "%p", c);
  572. d = debugfs_create_dir(s, pa ? pa->dentry : clk_debugfs_root);
  573. if (!d)
  574. return -ENOMEM;
  575. c->dentry = d;
  576. d = debugfs_create_u8("usecount", S_IRUGO, c->dentry, (u8 *)&c->usecount);
  577. if (!d) {
  578. err = -ENOMEM;
  579. goto err_out;
  580. }
  581. d = debugfs_create_u32("rate", S_IRUGO, c->dentry, (u32 *)&c->rate);
  582. if (!d) {
  583. err = -ENOMEM;
  584. goto err_out;
  585. }
  586. d = debugfs_create_x32("flags", S_IRUGO, c->dentry, (u32 *)&c->flags);
  587. if (!d) {
  588. err = -ENOMEM;
  589. goto err_out;
  590. }
  591. return 0;
  592. err_out:
  593. d = c->dentry;
  594. list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
  595. debugfs_remove(child);
  596. debugfs_remove(c->dentry);
  597. return err;
  598. }
  599. static int clk_debugfs_register(struct clk *c)
  600. {
  601. int err;
  602. struct clk *pa = c->parent;
  603. if (pa && !pa->dentry) {
  604. err = clk_debugfs_register(pa);
  605. if (err)
  606. return err;
  607. }
  608. if (!c->dentry) {
  609. err = clk_debugfs_register_one(c);
  610. if (err)
  611. return err;
  612. }
  613. return 0;
  614. }
  615. static int __init clk_debugfs_init(void)
  616. {
  617. struct clk *c;
  618. struct dentry *d;
  619. int err;
  620. d = debugfs_create_dir("clock", NULL);
  621. if (!d)
  622. return -ENOMEM;
  623. clk_debugfs_root = d;
  624. list_for_each_entry(c, &clock_list, node) {
  625. err = clk_debugfs_register(c);
  626. if (err)
  627. goto err_out;
  628. }
  629. return 0;
  630. err_out:
  631. debugfs_remove_recursive(clk_debugfs_root);
  632. return err;
  633. }
  634. late_initcall(clk_debugfs_init);