sckc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * drivers/clk/at91/sckc.c
  4. *
  5. * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
  6. */
  7. #include <linux/clk-provider.h>
  8. #include <linux/clkdev.h>
  9. #include <linux/delay.h>
  10. #include <linux/of.h>
  11. #include <linux/of_address.h>
  12. #include <linux/io.h>
  13. #define SLOW_CLOCK_FREQ 32768
  14. #define SLOWCK_SW_CYCLES 5
  15. #define SLOWCK_SW_TIME_USEC ((SLOWCK_SW_CYCLES * USEC_PER_SEC) / \
  16. SLOW_CLOCK_FREQ)
  17. #define AT91_SCKC_CR 0x00
  18. struct clk_slow_bits {
  19. u32 cr_rcen;
  20. u32 cr_osc32en;
  21. u32 cr_osc32byp;
  22. u32 cr_oscsel;
  23. };
  24. struct clk_slow_osc {
  25. struct clk_hw hw;
  26. void __iomem *sckcr;
  27. const struct clk_slow_bits *bits;
  28. unsigned long startup_usec;
  29. };
  30. #define to_clk_slow_osc(hw) container_of(hw, struct clk_slow_osc, hw)
  31. struct clk_sama5d4_slow_osc {
  32. struct clk_hw hw;
  33. void __iomem *sckcr;
  34. const struct clk_slow_bits *bits;
  35. unsigned long startup_usec;
  36. bool prepared;
  37. };
  38. #define to_clk_sama5d4_slow_osc(hw) container_of(hw, struct clk_sama5d4_slow_osc, hw)
  39. struct clk_slow_rc_osc {
  40. struct clk_hw hw;
  41. void __iomem *sckcr;
  42. const struct clk_slow_bits *bits;
  43. unsigned long frequency;
  44. unsigned long accuracy;
  45. unsigned long startup_usec;
  46. };
  47. #define to_clk_slow_rc_osc(hw) container_of(hw, struct clk_slow_rc_osc, hw)
  48. struct clk_sam9x5_slow {
  49. struct clk_hw hw;
  50. void __iomem *sckcr;
  51. const struct clk_slow_bits *bits;
  52. u8 parent;
  53. };
  54. #define to_clk_sam9x5_slow(hw) container_of(hw, struct clk_sam9x5_slow, hw)
  55. static int clk_slow_osc_prepare(struct clk_hw *hw)
  56. {
  57. struct clk_slow_osc *osc = to_clk_slow_osc(hw);
  58. void __iomem *sckcr = osc->sckcr;
  59. u32 tmp = readl(sckcr);
  60. if (tmp & (osc->bits->cr_osc32byp | osc->bits->cr_osc32en))
  61. return 0;
  62. writel(tmp | osc->bits->cr_osc32en, sckcr);
  63. if (system_state < SYSTEM_RUNNING)
  64. udelay(osc->startup_usec);
  65. else
  66. usleep_range(osc->startup_usec, osc->startup_usec + 1);
  67. return 0;
  68. }
  69. static void clk_slow_osc_unprepare(struct clk_hw *hw)
  70. {
  71. struct clk_slow_osc *osc = to_clk_slow_osc(hw);
  72. void __iomem *sckcr = osc->sckcr;
  73. u32 tmp = readl(sckcr);
  74. if (tmp & osc->bits->cr_osc32byp)
  75. return;
  76. writel(tmp & ~osc->bits->cr_osc32en, sckcr);
  77. }
  78. static int clk_slow_osc_is_prepared(struct clk_hw *hw)
  79. {
  80. struct clk_slow_osc *osc = to_clk_slow_osc(hw);
  81. void __iomem *sckcr = osc->sckcr;
  82. u32 tmp = readl(sckcr);
  83. if (tmp & osc->bits->cr_osc32byp)
  84. return 1;
  85. return !!(tmp & osc->bits->cr_osc32en);
  86. }
  87. static const struct clk_ops slow_osc_ops = {
  88. .prepare = clk_slow_osc_prepare,
  89. .unprepare = clk_slow_osc_unprepare,
  90. .is_prepared = clk_slow_osc_is_prepared,
  91. };
  92. static struct clk_hw * __init
  93. at91_clk_register_slow_osc(void __iomem *sckcr,
  94. const char *name,
  95. const struct clk_parent_data *parent_data,
  96. unsigned long startup,
  97. bool bypass,
  98. const struct clk_slow_bits *bits)
  99. {
  100. struct clk_slow_osc *osc;
  101. struct clk_hw *hw;
  102. struct clk_init_data init = {};
  103. int ret;
  104. if (!sckcr || !name || !parent_data)
  105. return ERR_PTR(-EINVAL);
  106. osc = kzalloc(sizeof(*osc), GFP_KERNEL);
  107. if (!osc)
  108. return ERR_PTR(-ENOMEM);
  109. init.name = name;
  110. init.ops = &slow_osc_ops;
  111. init.parent_data = parent_data;
  112. init.num_parents = 1;
  113. init.flags = CLK_IGNORE_UNUSED;
  114. osc->hw.init = &init;
  115. osc->sckcr = sckcr;
  116. osc->startup_usec = startup;
  117. osc->bits = bits;
  118. if (bypass)
  119. writel((readl(sckcr) & ~osc->bits->cr_osc32en) |
  120. osc->bits->cr_osc32byp, sckcr);
  121. hw = &osc->hw;
  122. ret = clk_hw_register(NULL, &osc->hw);
  123. if (ret) {
  124. kfree(osc);
  125. hw = ERR_PTR(ret);
  126. }
  127. return hw;
  128. }
  129. static void at91_clk_unregister_slow_osc(struct clk_hw *hw)
  130. {
  131. struct clk_slow_osc *osc = to_clk_slow_osc(hw);
  132. clk_hw_unregister(hw);
  133. kfree(osc);
  134. }
  135. static unsigned long clk_slow_rc_osc_recalc_rate(struct clk_hw *hw,
  136. unsigned long parent_rate)
  137. {
  138. struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw);
  139. return osc->frequency;
  140. }
  141. static unsigned long clk_slow_rc_osc_recalc_accuracy(struct clk_hw *hw,
  142. unsigned long parent_acc)
  143. {
  144. struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw);
  145. return osc->accuracy;
  146. }
  147. static int clk_slow_rc_osc_prepare(struct clk_hw *hw)
  148. {
  149. struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw);
  150. void __iomem *sckcr = osc->sckcr;
  151. writel(readl(sckcr) | osc->bits->cr_rcen, sckcr);
  152. if (system_state < SYSTEM_RUNNING)
  153. udelay(osc->startup_usec);
  154. else
  155. usleep_range(osc->startup_usec, osc->startup_usec + 1);
  156. return 0;
  157. }
  158. static void clk_slow_rc_osc_unprepare(struct clk_hw *hw)
  159. {
  160. struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw);
  161. void __iomem *sckcr = osc->sckcr;
  162. writel(readl(sckcr) & ~osc->bits->cr_rcen, sckcr);
  163. }
  164. static int clk_slow_rc_osc_is_prepared(struct clk_hw *hw)
  165. {
  166. struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw);
  167. return !!(readl(osc->sckcr) & osc->bits->cr_rcen);
  168. }
  169. static const struct clk_ops slow_rc_osc_ops = {
  170. .prepare = clk_slow_rc_osc_prepare,
  171. .unprepare = clk_slow_rc_osc_unprepare,
  172. .is_prepared = clk_slow_rc_osc_is_prepared,
  173. .recalc_rate = clk_slow_rc_osc_recalc_rate,
  174. .recalc_accuracy = clk_slow_rc_osc_recalc_accuracy,
  175. };
  176. static struct clk_hw * __init
  177. at91_clk_register_slow_rc_osc(void __iomem *sckcr,
  178. const char *name,
  179. unsigned long frequency,
  180. unsigned long accuracy,
  181. unsigned long startup,
  182. const struct clk_slow_bits *bits)
  183. {
  184. struct clk_slow_rc_osc *osc;
  185. struct clk_hw *hw;
  186. struct clk_init_data init;
  187. int ret;
  188. if (!sckcr || !name)
  189. return ERR_PTR(-EINVAL);
  190. osc = kzalloc(sizeof(*osc), GFP_KERNEL);
  191. if (!osc)
  192. return ERR_PTR(-ENOMEM);
  193. init.name = name;
  194. init.ops = &slow_rc_osc_ops;
  195. init.parent_names = NULL;
  196. init.num_parents = 0;
  197. init.flags = CLK_IGNORE_UNUSED;
  198. osc->hw.init = &init;
  199. osc->sckcr = sckcr;
  200. osc->bits = bits;
  201. osc->frequency = frequency;
  202. osc->accuracy = accuracy;
  203. osc->startup_usec = startup;
  204. hw = &osc->hw;
  205. ret = clk_hw_register(NULL, &osc->hw);
  206. if (ret) {
  207. kfree(osc);
  208. hw = ERR_PTR(ret);
  209. }
  210. return hw;
  211. }
  212. static void at91_clk_unregister_slow_rc_osc(struct clk_hw *hw)
  213. {
  214. struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw);
  215. clk_hw_unregister(hw);
  216. kfree(osc);
  217. }
  218. static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index)
  219. {
  220. struct clk_sam9x5_slow *slowck = to_clk_sam9x5_slow(hw);
  221. void __iomem *sckcr = slowck->sckcr;
  222. u32 tmp;
  223. if (index > 1)
  224. return -EINVAL;
  225. tmp = readl(sckcr);
  226. if ((!index && !(tmp & slowck->bits->cr_oscsel)) ||
  227. (index && (tmp & slowck->bits->cr_oscsel)))
  228. return 0;
  229. if (index)
  230. tmp |= slowck->bits->cr_oscsel;
  231. else
  232. tmp &= ~slowck->bits->cr_oscsel;
  233. writel(tmp, sckcr);
  234. if (system_state < SYSTEM_RUNNING)
  235. udelay(SLOWCK_SW_TIME_USEC);
  236. else
  237. usleep_range(SLOWCK_SW_TIME_USEC, SLOWCK_SW_TIME_USEC + 1);
  238. return 0;
  239. }
  240. static u8 clk_sam9x5_slow_get_parent(struct clk_hw *hw)
  241. {
  242. struct clk_sam9x5_slow *slowck = to_clk_sam9x5_slow(hw);
  243. return !!(readl(slowck->sckcr) & slowck->bits->cr_oscsel);
  244. }
  245. static const struct clk_ops sam9x5_slow_ops = {
  246. .determine_rate = clk_hw_determine_rate_no_reparent,
  247. .set_parent = clk_sam9x5_slow_set_parent,
  248. .get_parent = clk_sam9x5_slow_get_parent,
  249. };
  250. static struct clk_hw * __init
  251. at91_clk_register_sam9x5_slow(void __iomem *sckcr,
  252. const char *name,
  253. const struct clk_hw **parent_hws,
  254. int num_parents,
  255. const struct clk_slow_bits *bits)
  256. {
  257. struct clk_sam9x5_slow *slowck;
  258. struct clk_hw *hw;
  259. struct clk_init_data init = {};
  260. int ret;
  261. if (!sckcr || !name || !parent_hws || !num_parents)
  262. return ERR_PTR(-EINVAL);
  263. slowck = kzalloc(sizeof(*slowck), GFP_KERNEL);
  264. if (!slowck)
  265. return ERR_PTR(-ENOMEM);
  266. init.name = name;
  267. init.ops = &sam9x5_slow_ops;
  268. init.parent_hws = parent_hws;
  269. init.num_parents = num_parents;
  270. init.flags = 0;
  271. slowck->hw.init = &init;
  272. slowck->sckcr = sckcr;
  273. slowck->bits = bits;
  274. slowck->parent = !!(readl(sckcr) & slowck->bits->cr_oscsel);
  275. hw = &slowck->hw;
  276. ret = clk_hw_register(NULL, &slowck->hw);
  277. if (ret) {
  278. kfree(slowck);
  279. hw = ERR_PTR(ret);
  280. }
  281. return hw;
  282. }
  283. static void at91_clk_unregister_sam9x5_slow(struct clk_hw *hw)
  284. {
  285. struct clk_sam9x5_slow *slowck = to_clk_sam9x5_slow(hw);
  286. clk_hw_unregister(hw);
  287. kfree(slowck);
  288. }
  289. static void __init at91sam9x5_sckc_register(struct device_node *np,
  290. unsigned int rc_osc_startup_us,
  291. const struct clk_slow_bits *bits)
  292. {
  293. void __iomem *regbase = of_iomap(np, 0);
  294. struct device_node *child = NULL;
  295. const char *xtal_name;
  296. struct clk_hw *slow_rc, *slow_osc, *slowck;
  297. static struct clk_parent_data parent_data = {
  298. .name = "slow_xtal",
  299. };
  300. const struct clk_hw *parent_hws[2];
  301. bool bypass;
  302. int ret;
  303. if (!regbase)
  304. return;
  305. slow_rc = at91_clk_register_slow_rc_osc(regbase, "slow_rc_osc",
  306. 32768, 50000000,
  307. rc_osc_startup_us, bits);
  308. if (IS_ERR(slow_rc))
  309. return;
  310. xtal_name = of_clk_get_parent_name(np, 0);
  311. if (!xtal_name) {
  312. /* DT backward compatibility */
  313. child = of_get_compatible_child(np, "atmel,at91sam9x5-clk-slow-osc");
  314. if (!child)
  315. goto unregister_slow_rc;
  316. xtal_name = of_clk_get_parent_name(child, 0);
  317. bypass = of_property_read_bool(child, "atmel,osc-bypass");
  318. child = of_get_compatible_child(np, "atmel,at91sam9x5-clk-slow");
  319. } else {
  320. bypass = of_property_read_bool(np, "atmel,osc-bypass");
  321. }
  322. if (!xtal_name)
  323. goto unregister_slow_rc;
  324. parent_data.fw_name = xtal_name;
  325. slow_osc = at91_clk_register_slow_osc(regbase, "slow_osc",
  326. &parent_data, 1200000, bypass, bits);
  327. if (IS_ERR(slow_osc))
  328. goto unregister_slow_rc;
  329. parent_hws[0] = slow_rc;
  330. parent_hws[1] = slow_osc;
  331. slowck = at91_clk_register_sam9x5_slow(regbase, "slowck", parent_hws,
  332. 2, bits);
  333. if (IS_ERR(slowck))
  334. goto unregister_slow_osc;
  335. /* DT backward compatibility */
  336. if (child)
  337. ret = of_clk_add_hw_provider(child, of_clk_hw_simple_get,
  338. slowck);
  339. else
  340. ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, slowck);
  341. if (WARN_ON(ret))
  342. goto unregister_slowck;
  343. return;
  344. unregister_slowck:
  345. at91_clk_unregister_sam9x5_slow(slowck);
  346. unregister_slow_osc:
  347. at91_clk_unregister_slow_osc(slow_osc);
  348. unregister_slow_rc:
  349. at91_clk_unregister_slow_rc_osc(slow_rc);
  350. }
  351. static const struct clk_slow_bits at91sam9x5_bits = {
  352. .cr_rcen = BIT(0),
  353. .cr_osc32en = BIT(1),
  354. .cr_osc32byp = BIT(2),
  355. .cr_oscsel = BIT(3),
  356. };
  357. static void __init of_at91sam9x5_sckc_setup(struct device_node *np)
  358. {
  359. at91sam9x5_sckc_register(np, 75, &at91sam9x5_bits);
  360. }
  361. CLK_OF_DECLARE(at91sam9x5_clk_sckc, "atmel,at91sam9x5-sckc",
  362. of_at91sam9x5_sckc_setup);
  363. static void __init of_sama5d3_sckc_setup(struct device_node *np)
  364. {
  365. at91sam9x5_sckc_register(np, 500, &at91sam9x5_bits);
  366. }
  367. CLK_OF_DECLARE(sama5d3_clk_sckc, "atmel,sama5d3-sckc",
  368. of_sama5d3_sckc_setup);
  369. static const struct clk_slow_bits at91sam9x60_bits = {
  370. .cr_osc32en = BIT(1),
  371. .cr_osc32byp = BIT(2),
  372. .cr_oscsel = BIT(24),
  373. };
  374. static void __init of_sam9x60_sckc_setup(struct device_node *np)
  375. {
  376. void __iomem *regbase = of_iomap(np, 0);
  377. struct clk_hw_onecell_data *clk_data;
  378. struct clk_hw *slow_rc, *slow_osc;
  379. const char *xtal_name;
  380. const struct clk_hw *parent_hws[2];
  381. static struct clk_parent_data parent_data = {
  382. .name = "slow_xtal",
  383. };
  384. bool bypass;
  385. int ret;
  386. if (!regbase)
  387. return;
  388. slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL, "slow_rc_osc",
  389. NULL, 0, 32768,
  390. 93750000);
  391. if (IS_ERR(slow_rc))
  392. return;
  393. xtal_name = of_clk_get_parent_name(np, 0);
  394. if (!xtal_name)
  395. goto unregister_slow_rc;
  396. parent_data.fw_name = xtal_name;
  397. bypass = of_property_read_bool(np, "atmel,osc-bypass");
  398. slow_osc = at91_clk_register_slow_osc(regbase, "slow_osc",
  399. &parent_data, 5000000, bypass,
  400. &at91sam9x60_bits);
  401. if (IS_ERR(slow_osc))
  402. goto unregister_slow_rc;
  403. clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL);
  404. if (!clk_data)
  405. goto unregister_slow_osc;
  406. /* MD_SLCK and TD_SLCK. */
  407. clk_data->num = 2;
  408. clk_data->hws[0] = clk_hw_register_fixed_rate_parent_hw(NULL, "md_slck",
  409. slow_rc,
  410. 0, 32768);
  411. if (IS_ERR(clk_data->hws[0]))
  412. goto clk_data_free;
  413. parent_hws[0] = slow_rc;
  414. parent_hws[1] = slow_osc;
  415. clk_data->hws[1] = at91_clk_register_sam9x5_slow(regbase, "td_slck",
  416. parent_hws, 2,
  417. &at91sam9x60_bits);
  418. if (IS_ERR(clk_data->hws[1]))
  419. goto unregister_md_slck;
  420. ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data);
  421. if (WARN_ON(ret))
  422. goto unregister_td_slck;
  423. return;
  424. unregister_td_slck:
  425. at91_clk_unregister_sam9x5_slow(clk_data->hws[1]);
  426. unregister_md_slck:
  427. clk_hw_unregister(clk_data->hws[0]);
  428. clk_data_free:
  429. kfree(clk_data);
  430. unregister_slow_osc:
  431. at91_clk_unregister_slow_osc(slow_osc);
  432. unregister_slow_rc:
  433. clk_hw_unregister(slow_rc);
  434. }
  435. CLK_OF_DECLARE(sam9x60_clk_sckc, "microchip,sam9x60-sckc",
  436. of_sam9x60_sckc_setup);
  437. static int clk_sama5d4_slow_osc_prepare(struct clk_hw *hw)
  438. {
  439. struct clk_sama5d4_slow_osc *osc = to_clk_sama5d4_slow_osc(hw);
  440. if (osc->prepared)
  441. return 0;
  442. /*
  443. * Assume that if it has already been selected (for example by the
  444. * bootloader), enough time has already passed.
  445. */
  446. if ((readl(osc->sckcr) & osc->bits->cr_oscsel)) {
  447. osc->prepared = true;
  448. return 0;
  449. }
  450. if (system_state < SYSTEM_RUNNING)
  451. udelay(osc->startup_usec);
  452. else
  453. usleep_range(osc->startup_usec, osc->startup_usec + 1);
  454. osc->prepared = true;
  455. return 0;
  456. }
  457. static int clk_sama5d4_slow_osc_is_prepared(struct clk_hw *hw)
  458. {
  459. struct clk_sama5d4_slow_osc *osc = to_clk_sama5d4_slow_osc(hw);
  460. return osc->prepared;
  461. }
  462. static const struct clk_ops sama5d4_slow_osc_ops = {
  463. .prepare = clk_sama5d4_slow_osc_prepare,
  464. .is_prepared = clk_sama5d4_slow_osc_is_prepared,
  465. };
  466. static const struct clk_slow_bits at91sama5d4_bits = {
  467. .cr_oscsel = BIT(3),
  468. };
  469. static void __init of_sama5d4_sckc_setup(struct device_node *np)
  470. {
  471. void __iomem *regbase = of_iomap(np, 0);
  472. struct clk_hw *slow_rc, *slowck;
  473. struct clk_sama5d4_slow_osc *osc;
  474. struct clk_init_data init = {};
  475. const char *xtal_name;
  476. const struct clk_hw *parent_hws[2];
  477. static struct clk_parent_data parent_data = {
  478. .name = "slow_xtal",
  479. };
  480. int ret;
  481. if (!regbase)
  482. return;
  483. slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL,
  484. "slow_rc_osc",
  485. NULL, 0, 32768,
  486. 250000000);
  487. if (IS_ERR(slow_rc))
  488. return;
  489. xtal_name = of_clk_get_parent_name(np, 0);
  490. if (!xtal_name)
  491. goto unregister_slow_rc;
  492. parent_data.fw_name = xtal_name;
  493. osc = kzalloc(sizeof(*osc), GFP_KERNEL);
  494. if (!osc)
  495. goto unregister_slow_rc;
  496. init.name = "slow_osc";
  497. init.ops = &sama5d4_slow_osc_ops;
  498. init.parent_data = &parent_data;
  499. init.num_parents = 1;
  500. init.flags = CLK_IGNORE_UNUSED;
  501. osc->hw.init = &init;
  502. osc->sckcr = regbase;
  503. osc->startup_usec = 1200000;
  504. osc->bits = &at91sama5d4_bits;
  505. ret = clk_hw_register(NULL, &osc->hw);
  506. if (ret)
  507. goto free_slow_osc_data;
  508. parent_hws[0] = slow_rc;
  509. parent_hws[1] = &osc->hw;
  510. slowck = at91_clk_register_sam9x5_slow(regbase, "slowck",
  511. parent_hws, 2,
  512. &at91sama5d4_bits);
  513. if (IS_ERR(slowck))
  514. goto unregister_slow_osc;
  515. ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, slowck);
  516. if (WARN_ON(ret))
  517. goto unregister_slowck;
  518. return;
  519. unregister_slowck:
  520. at91_clk_unregister_sam9x5_slow(slowck);
  521. unregister_slow_osc:
  522. clk_hw_unregister(&osc->hw);
  523. free_slow_osc_data:
  524. kfree(osc);
  525. unregister_slow_rc:
  526. clk_hw_unregister(slow_rc);
  527. }
  528. CLK_OF_DECLARE(sama5d4_clk_sckc, "atmel,sama5d4-sckc",
  529. of_sama5d4_sckc_setup);