core.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  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/sysdev.h>
  24. #include <linux/seq_file.h>
  25. #include <linux/err.h>
  26. #include <linux/io.h>
  27. #include <linux/debugfs.h>
  28. #include <linux/cpufreq.h>
  29. #include <linux/clk.h>
  30. #include <linux/sh_clk.h>
  31. static LIST_HEAD(clock_list);
  32. static DEFINE_SPINLOCK(clock_lock);
  33. static DEFINE_MUTEX(clock_list_sem);
  34. void clk_rate_table_build(struct clk *clk,
  35. struct cpufreq_frequency_table *freq_table,
  36. int nr_freqs,
  37. struct clk_div_mult_table *src_table,
  38. unsigned long *bitmap)
  39. {
  40. unsigned long mult, div;
  41. unsigned long freq;
  42. int i;
  43. clk->nr_freqs = nr_freqs;
  44. for (i = 0; i < nr_freqs; i++) {
  45. div = 1;
  46. mult = 1;
  47. if (src_table->divisors && i < src_table->nr_divisors)
  48. div = src_table->divisors[i];
  49. if (src_table->multipliers && i < src_table->nr_multipliers)
  50. mult = src_table->multipliers[i];
  51. if (!div || !mult || (bitmap && !test_bit(i, bitmap)))
  52. freq = CPUFREQ_ENTRY_INVALID;
  53. else
  54. freq = clk->parent->rate * mult / div;
  55. freq_table[i].index = i;
  56. freq_table[i].frequency = freq;
  57. }
  58. /* Termination entry */
  59. freq_table[i].index = i;
  60. freq_table[i].frequency = CPUFREQ_TABLE_END;
  61. }
  62. struct clk_rate_round_data;
  63. struct clk_rate_round_data {
  64. unsigned long rate;
  65. unsigned int min, max;
  66. long (*func)(unsigned int, struct clk_rate_round_data *);
  67. void *arg;
  68. };
  69. #define for_each_frequency(pos, r, freq) \
  70. for (pos = r->min, freq = r->func(pos, r); \
  71. pos <= r->max; pos++, freq = r->func(pos, r)) \
  72. if (unlikely(freq == 0)) \
  73. ; \
  74. else
  75. static long clk_rate_round_helper(struct clk_rate_round_data *rounder)
  76. {
  77. unsigned long rate_error, rate_error_prev = ~0UL;
  78. unsigned long highest, lowest, freq;
  79. long rate_best_fit = -ENOENT;
  80. int i;
  81. highest = 0;
  82. lowest = ~0UL;
  83. for_each_frequency(i, rounder, freq) {
  84. if (freq > highest)
  85. highest = freq;
  86. if (freq < lowest)
  87. lowest = freq;
  88. rate_error = abs(freq - rounder->rate);
  89. if (rate_error < rate_error_prev) {
  90. rate_best_fit = freq;
  91. rate_error_prev = rate_error;
  92. }
  93. if (rate_error == 0)
  94. break;
  95. }
  96. if (rounder->rate >= highest)
  97. rate_best_fit = highest;
  98. if (rounder->rate <= lowest)
  99. rate_best_fit = lowest;
  100. return rate_best_fit;
  101. }
  102. static long clk_rate_table_iter(unsigned int pos,
  103. struct clk_rate_round_data *rounder)
  104. {
  105. struct cpufreq_frequency_table *freq_table = rounder->arg;
  106. unsigned long freq = freq_table[pos].frequency;
  107. if (freq == CPUFREQ_ENTRY_INVALID)
  108. freq = 0;
  109. return freq;
  110. }
  111. long clk_rate_table_round(struct clk *clk,
  112. struct cpufreq_frequency_table *freq_table,
  113. unsigned long rate)
  114. {
  115. struct clk_rate_round_data table_round = {
  116. .min = 0,
  117. .max = clk->nr_freqs - 1,
  118. .func = clk_rate_table_iter,
  119. .arg = freq_table,
  120. .rate = rate,
  121. };
  122. if (clk->nr_freqs < 1)
  123. return -ENOSYS;
  124. return clk_rate_round_helper(&table_round);
  125. }
  126. static long clk_rate_div_range_iter(unsigned int pos,
  127. struct clk_rate_round_data *rounder)
  128. {
  129. return clk_get_rate(rounder->arg) / pos;
  130. }
  131. long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
  132. unsigned int div_max, unsigned long rate)
  133. {
  134. struct clk_rate_round_data div_range_round = {
  135. .min = div_min,
  136. .max = div_max,
  137. .func = clk_rate_div_range_iter,
  138. .arg = clk_get_parent(clk),
  139. .rate = rate,
  140. };
  141. return clk_rate_round_helper(&div_range_round);
  142. }
  143. int clk_rate_table_find(struct clk *clk,
  144. struct cpufreq_frequency_table *freq_table,
  145. unsigned long rate)
  146. {
  147. int i;
  148. for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
  149. unsigned long freq = freq_table[i].frequency;
  150. if (freq == CPUFREQ_ENTRY_INVALID)
  151. continue;
  152. if (freq == rate)
  153. return i;
  154. }
  155. return -ENOENT;
  156. }
  157. /* Used for clocks that always have same value as the parent clock */
  158. unsigned long followparent_recalc(struct clk *clk)
  159. {
  160. return clk->parent ? clk->parent->rate : 0;
  161. }
  162. int clk_reparent(struct clk *child, struct clk *parent)
  163. {
  164. list_del_init(&child->sibling);
  165. if (parent)
  166. list_add(&child->sibling, &parent->children);
  167. child->parent = parent;
  168. /* now do the debugfs renaming to reattach the child
  169. to the proper parent */
  170. return 0;
  171. }
  172. /* Propagate rate to children */
  173. void propagate_rate(struct clk *tclk)
  174. {
  175. struct clk *clkp;
  176. list_for_each_entry(clkp, &tclk->children, sibling) {
  177. if (clkp->ops && clkp->ops->recalc)
  178. clkp->rate = clkp->ops->recalc(clkp);
  179. propagate_rate(clkp);
  180. }
  181. }
  182. static void __clk_disable(struct clk *clk)
  183. {
  184. if (WARN(!clk->usecount, "Trying to disable clock %p with 0 usecount\n",
  185. clk))
  186. return;
  187. if (!(--clk->usecount)) {
  188. if (likely(clk->ops && clk->ops->disable))
  189. clk->ops->disable(clk);
  190. if (likely(clk->parent))
  191. __clk_disable(clk->parent);
  192. }
  193. }
  194. void clk_disable(struct clk *clk)
  195. {
  196. unsigned long flags;
  197. if (!clk)
  198. return;
  199. spin_lock_irqsave(&clock_lock, flags);
  200. __clk_disable(clk);
  201. spin_unlock_irqrestore(&clock_lock, flags);
  202. }
  203. EXPORT_SYMBOL_GPL(clk_disable);
  204. static int __clk_enable(struct clk *clk)
  205. {
  206. int ret = 0;
  207. if (clk->usecount++ == 0) {
  208. if (clk->parent) {
  209. ret = __clk_enable(clk->parent);
  210. if (unlikely(ret))
  211. goto err;
  212. }
  213. if (clk->ops && clk->ops->enable) {
  214. ret = clk->ops->enable(clk);
  215. if (ret) {
  216. if (clk->parent)
  217. __clk_disable(clk->parent);
  218. goto err;
  219. }
  220. }
  221. }
  222. return ret;
  223. err:
  224. clk->usecount--;
  225. return ret;
  226. }
  227. int clk_enable(struct clk *clk)
  228. {
  229. unsigned long flags;
  230. int ret;
  231. if (!clk)
  232. return -EINVAL;
  233. spin_lock_irqsave(&clock_lock, flags);
  234. ret = __clk_enable(clk);
  235. spin_unlock_irqrestore(&clock_lock, flags);
  236. return ret;
  237. }
  238. EXPORT_SYMBOL_GPL(clk_enable);
  239. static LIST_HEAD(root_clks);
  240. /**
  241. * recalculate_root_clocks - recalculate and propagate all root clocks
  242. *
  243. * Recalculates all root clocks (clocks with no parent), which if the
  244. * clock's .recalc is set correctly, should also propagate their rates.
  245. * Called at init.
  246. */
  247. void recalculate_root_clocks(void)
  248. {
  249. struct clk *clkp;
  250. list_for_each_entry(clkp, &root_clks, sibling) {
  251. if (clkp->ops && clkp->ops->recalc)
  252. clkp->rate = clkp->ops->recalc(clkp);
  253. propagate_rate(clkp);
  254. }
  255. }
  256. static struct clk_mapping dummy_mapping;
  257. static struct clk *lookup_root_clock(struct clk *clk)
  258. {
  259. while (clk->parent)
  260. clk = clk->parent;
  261. return clk;
  262. }
  263. static int clk_establish_mapping(struct clk *clk)
  264. {
  265. struct clk_mapping *mapping = clk->mapping;
  266. /*
  267. * Propagate mappings.
  268. */
  269. if (!mapping) {
  270. struct clk *clkp;
  271. /*
  272. * dummy mapping for root clocks with no specified ranges
  273. */
  274. if (!clk->parent) {
  275. clk->mapping = &dummy_mapping;
  276. return 0;
  277. }
  278. /*
  279. * If we're on a child clock and it provides no mapping of its
  280. * own, inherit the mapping from its root clock.
  281. */
  282. clkp = lookup_root_clock(clk);
  283. mapping = clkp->mapping;
  284. BUG_ON(!mapping);
  285. }
  286. /*
  287. * Establish initial mapping.
  288. */
  289. if (!mapping->base && mapping->phys) {
  290. kref_init(&mapping->ref);
  291. mapping->base = ioremap_nocache(mapping->phys, mapping->len);
  292. if (unlikely(!mapping->base))
  293. return -ENXIO;
  294. } else if (mapping->base) {
  295. /*
  296. * Bump the refcount for an existing mapping
  297. */
  298. kref_get(&mapping->ref);
  299. }
  300. clk->mapping = mapping;
  301. return 0;
  302. }
  303. static void clk_destroy_mapping(struct kref *kref)
  304. {
  305. struct clk_mapping *mapping;
  306. mapping = container_of(kref, struct clk_mapping, ref);
  307. iounmap(mapping->base);
  308. }
  309. static void clk_teardown_mapping(struct clk *clk)
  310. {
  311. struct clk_mapping *mapping = clk->mapping;
  312. /* Nothing to do */
  313. if (mapping == &dummy_mapping)
  314. return;
  315. kref_put(&mapping->ref, clk_destroy_mapping);
  316. clk->mapping = NULL;
  317. }
  318. int clk_register(struct clk *clk)
  319. {
  320. int ret;
  321. if (clk == NULL || IS_ERR(clk))
  322. return -EINVAL;
  323. /*
  324. * trap out already registered clocks
  325. */
  326. if (clk->node.next || clk->node.prev)
  327. return 0;
  328. mutex_lock(&clock_list_sem);
  329. INIT_LIST_HEAD(&clk->children);
  330. clk->usecount = 0;
  331. ret = clk_establish_mapping(clk);
  332. if (unlikely(ret))
  333. goto out_unlock;
  334. if (clk->parent)
  335. list_add(&clk->sibling, &clk->parent->children);
  336. else
  337. list_add(&clk->sibling, &root_clks);
  338. list_add(&clk->node, &clock_list);
  339. #ifdef CONFIG_SH_CLK_CPG_LEGACY
  340. if (clk->ops && clk->ops->init)
  341. clk->ops->init(clk);
  342. #endif
  343. out_unlock:
  344. mutex_unlock(&clock_list_sem);
  345. return ret;
  346. }
  347. EXPORT_SYMBOL_GPL(clk_register);
  348. void clk_unregister(struct clk *clk)
  349. {
  350. mutex_lock(&clock_list_sem);
  351. list_del(&clk->sibling);
  352. list_del(&clk->node);
  353. clk_teardown_mapping(clk);
  354. mutex_unlock(&clock_list_sem);
  355. }
  356. EXPORT_SYMBOL_GPL(clk_unregister);
  357. void clk_enable_init_clocks(void)
  358. {
  359. struct clk *clkp;
  360. list_for_each_entry(clkp, &clock_list, node)
  361. if (clkp->flags & CLK_ENABLE_ON_INIT)
  362. clk_enable(clkp);
  363. }
  364. unsigned long clk_get_rate(struct clk *clk)
  365. {
  366. return clk->rate;
  367. }
  368. EXPORT_SYMBOL_GPL(clk_get_rate);
  369. int clk_set_rate(struct clk *clk, unsigned long rate)
  370. {
  371. int ret = -EOPNOTSUPP;
  372. unsigned long flags;
  373. spin_lock_irqsave(&clock_lock, flags);
  374. if (likely(clk->ops && clk->ops->set_rate)) {
  375. ret = clk->ops->set_rate(clk, rate);
  376. if (ret != 0)
  377. goto out_unlock;
  378. } else {
  379. clk->rate = rate;
  380. ret = 0;
  381. }
  382. if (clk->ops && clk->ops->recalc)
  383. clk->rate = clk->ops->recalc(clk);
  384. propagate_rate(clk);
  385. out_unlock:
  386. spin_unlock_irqrestore(&clock_lock, flags);
  387. return ret;
  388. }
  389. EXPORT_SYMBOL_GPL(clk_set_rate);
  390. int clk_set_parent(struct clk *clk, struct clk *parent)
  391. {
  392. unsigned long flags;
  393. int ret = -EINVAL;
  394. if (!parent || !clk)
  395. return ret;
  396. if (clk->parent == parent)
  397. return 0;
  398. spin_lock_irqsave(&clock_lock, flags);
  399. if (clk->usecount == 0) {
  400. if (clk->ops->set_parent)
  401. ret = clk->ops->set_parent(clk, parent);
  402. else
  403. ret = clk_reparent(clk, parent);
  404. if (ret == 0) {
  405. if (clk->ops->recalc)
  406. clk->rate = clk->ops->recalc(clk);
  407. pr_debug("set parent of %p to %p (new rate %ld)\n",
  408. clk, clk->parent, clk->rate);
  409. propagate_rate(clk);
  410. }
  411. } else
  412. ret = -EBUSY;
  413. spin_unlock_irqrestore(&clock_lock, flags);
  414. return ret;
  415. }
  416. EXPORT_SYMBOL_GPL(clk_set_parent);
  417. struct clk *clk_get_parent(struct clk *clk)
  418. {
  419. return clk->parent;
  420. }
  421. EXPORT_SYMBOL_GPL(clk_get_parent);
  422. long clk_round_rate(struct clk *clk, unsigned long rate)
  423. {
  424. if (likely(clk->ops && clk->ops->round_rate)) {
  425. unsigned long flags, rounded;
  426. spin_lock_irqsave(&clock_lock, flags);
  427. rounded = clk->ops->round_rate(clk, rate);
  428. spin_unlock_irqrestore(&clock_lock, flags);
  429. return rounded;
  430. }
  431. return clk_get_rate(clk);
  432. }
  433. EXPORT_SYMBOL_GPL(clk_round_rate);
  434. long clk_round_parent(struct clk *clk, unsigned long target,
  435. unsigned long *best_freq, unsigned long *parent_freq,
  436. unsigned int div_min, unsigned int div_max)
  437. {
  438. struct cpufreq_frequency_table *freq, *best = NULL;
  439. unsigned long error = ULONG_MAX, freq_high, freq_low, div;
  440. struct clk *parent = clk_get_parent(clk);
  441. if (!parent) {
  442. *parent_freq = 0;
  443. *best_freq = clk_round_rate(clk, target);
  444. return abs(target - *best_freq);
  445. }
  446. for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END;
  447. freq++) {
  448. if (freq->frequency == CPUFREQ_ENTRY_INVALID)
  449. continue;
  450. if (unlikely(freq->frequency / target <= div_min - 1)) {
  451. unsigned long freq_max;
  452. freq_max = (freq->frequency + div_min / 2) / div_min;
  453. if (error > target - freq_max) {
  454. error = target - freq_max;
  455. best = freq;
  456. if (best_freq)
  457. *best_freq = freq_max;
  458. }
  459. pr_debug("too low freq %u, error %lu\n", freq->frequency,
  460. target - freq_max);
  461. if (!error)
  462. break;
  463. continue;
  464. }
  465. if (unlikely(freq->frequency / target >= div_max)) {
  466. unsigned long freq_min;
  467. freq_min = (freq->frequency + div_max / 2) / div_max;
  468. if (error > freq_min - target) {
  469. error = freq_min - target;
  470. best = freq;
  471. if (best_freq)
  472. *best_freq = freq_min;
  473. }
  474. pr_debug("too high freq %u, error %lu\n", freq->frequency,
  475. freq_min - target);
  476. if (!error)
  477. break;
  478. continue;
  479. }
  480. div = freq->frequency / target;
  481. freq_high = freq->frequency / div;
  482. freq_low = freq->frequency / (div + 1);
  483. if (freq_high - target < error) {
  484. error = freq_high - target;
  485. best = freq;
  486. if (best_freq)
  487. *best_freq = freq_high;
  488. }
  489. if (target - freq_low < error) {
  490. error = target - freq_low;
  491. best = freq;
  492. if (best_freq)
  493. *best_freq = freq_low;
  494. }
  495. pr_debug("%u / %lu = %lu, / %lu = %lu, best %lu, parent %u\n",
  496. freq->frequency, div, freq_high, div + 1, freq_low,
  497. *best_freq, best->frequency);
  498. if (!error)
  499. break;
  500. }
  501. if (parent_freq)
  502. *parent_freq = best->frequency;
  503. return error;
  504. }
  505. EXPORT_SYMBOL_GPL(clk_round_parent);
  506. #ifdef CONFIG_PM
  507. static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
  508. {
  509. static pm_message_t prev_state;
  510. struct clk *clkp;
  511. switch (state.event) {
  512. case PM_EVENT_ON:
  513. /* Resumeing from hibernation */
  514. if (prev_state.event != PM_EVENT_FREEZE)
  515. break;
  516. list_for_each_entry(clkp, &clock_list, node) {
  517. if (likely(clkp->ops)) {
  518. unsigned long rate = clkp->rate;
  519. if (likely(clkp->ops->set_parent))
  520. clkp->ops->set_parent(clkp,
  521. clkp->parent);
  522. if (likely(clkp->ops->set_rate))
  523. clkp->ops->set_rate(clkp, rate);
  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);