fapll.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License as
  4. * published by the Free Software Foundation version 2.
  5. *
  6. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  7. * kind, whether express or implied; without even the implied warranty
  8. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. */
  11. #include <linux/clk.h>
  12. #include <linux/clk-provider.h>
  13. #include <linux/delay.h>
  14. #include <linux/err.h>
  15. #include <linux/math64.h>
  16. #include <linux/of.h>
  17. #include <linux/of_address.h>
  18. #include <linux/clk/ti.h>
  19. /* FAPLL Control Register PLL_CTRL */
  20. #define FAPLL_MAIN_MULT_N_SHIFT 16
  21. #define FAPLL_MAIN_DIV_P_SHIFT 8
  22. #define FAPLL_MAIN_LOCK BIT(7)
  23. #define FAPLL_MAIN_PLLEN BIT(3)
  24. #define FAPLL_MAIN_BP BIT(2)
  25. #define FAPLL_MAIN_LOC_CTL BIT(0)
  26. #define FAPLL_MAIN_MAX_MULT_N 0xffff
  27. #define FAPLL_MAIN_MAX_DIV_P 0xff
  28. #define FAPLL_MAIN_CLEAR_MASK \
  29. ((FAPLL_MAIN_MAX_MULT_N << FAPLL_MAIN_MULT_N_SHIFT) | \
  30. (FAPLL_MAIN_DIV_P_SHIFT << FAPLL_MAIN_DIV_P_SHIFT) | \
  31. FAPLL_MAIN_LOC_CTL)
  32. /* FAPLL powerdown register PWD */
  33. #define FAPLL_PWD_OFFSET 4
  34. #define MAX_FAPLL_OUTPUTS 7
  35. #define FAPLL_MAX_RETRIES 1000
  36. #define to_fapll(_hw) container_of(_hw, struct fapll_data, hw)
  37. #define to_synth(_hw) container_of(_hw, struct fapll_synth, hw)
  38. /* The bypass bit is inverted on the ddr_pll.. */
  39. #define fapll_is_ddr_pll(va) (((u32)(va) & 0xffff) == 0x0440)
  40. /*
  41. * The audio_pll_clk1 input is hard wired to the 27MHz bypass clock,
  42. * and the audio_pll_clk1 synthesizer is hardwared to 32KiHz output.
  43. */
  44. #define is_ddr_pll_clk1(va) (((u32)(va) & 0xffff) == 0x044c)
  45. #define is_audio_pll_clk1(va) (((u32)(va) & 0xffff) == 0x04a8)
  46. /* Synthesizer divider register */
  47. #define SYNTH_LDMDIV1 BIT(8)
  48. /* Synthesizer frequency register */
  49. #define SYNTH_LDFREQ BIT(31)
  50. #define SYNTH_PHASE_K 8
  51. #define SYNTH_MAX_INT_DIV 0xf
  52. #define SYNTH_MAX_DIV_M 0xff
  53. struct fapll_data {
  54. struct clk_hw hw;
  55. void __iomem *base;
  56. const char *name;
  57. struct clk *clk_ref;
  58. struct clk *clk_bypass;
  59. struct clk_onecell_data outputs;
  60. bool bypass_bit_inverted;
  61. };
  62. struct fapll_synth {
  63. struct clk_hw hw;
  64. struct fapll_data *fd;
  65. int index;
  66. void __iomem *freq;
  67. void __iomem *div;
  68. const char *name;
  69. struct clk *clk_pll;
  70. };
  71. static bool ti_fapll_clock_is_bypass(struct fapll_data *fd)
  72. {
  73. u32 v = readl_relaxed(fd->base);
  74. if (fd->bypass_bit_inverted)
  75. return !(v & FAPLL_MAIN_BP);
  76. else
  77. return !!(v & FAPLL_MAIN_BP);
  78. }
  79. static void ti_fapll_set_bypass(struct fapll_data *fd)
  80. {
  81. u32 v = readl_relaxed(fd->base);
  82. if (fd->bypass_bit_inverted)
  83. v &= ~FAPLL_MAIN_BP;
  84. else
  85. v |= FAPLL_MAIN_BP;
  86. writel_relaxed(v, fd->base);
  87. }
  88. static void ti_fapll_clear_bypass(struct fapll_data *fd)
  89. {
  90. u32 v = readl_relaxed(fd->base);
  91. if (fd->bypass_bit_inverted)
  92. v |= FAPLL_MAIN_BP;
  93. else
  94. v &= ~FAPLL_MAIN_BP;
  95. writel_relaxed(v, fd->base);
  96. }
  97. static int ti_fapll_wait_lock(struct fapll_data *fd)
  98. {
  99. int retries = FAPLL_MAX_RETRIES;
  100. u32 v;
  101. while ((v = readl_relaxed(fd->base))) {
  102. if (v & FAPLL_MAIN_LOCK)
  103. return 0;
  104. if (retries-- <= 0)
  105. break;
  106. udelay(1);
  107. }
  108. pr_err("%s failed to lock\n", fd->name);
  109. return -ETIMEDOUT;
  110. }
  111. static int ti_fapll_enable(struct clk_hw *hw)
  112. {
  113. struct fapll_data *fd = to_fapll(hw);
  114. u32 v = readl_relaxed(fd->base);
  115. v |= FAPLL_MAIN_PLLEN;
  116. writel_relaxed(v, fd->base);
  117. ti_fapll_wait_lock(fd);
  118. return 0;
  119. }
  120. static void ti_fapll_disable(struct clk_hw *hw)
  121. {
  122. struct fapll_data *fd = to_fapll(hw);
  123. u32 v = readl_relaxed(fd->base);
  124. v &= ~FAPLL_MAIN_PLLEN;
  125. writel_relaxed(v, fd->base);
  126. }
  127. static int ti_fapll_is_enabled(struct clk_hw *hw)
  128. {
  129. struct fapll_data *fd = to_fapll(hw);
  130. u32 v = readl_relaxed(fd->base);
  131. return v & FAPLL_MAIN_PLLEN;
  132. }
  133. static unsigned long ti_fapll_recalc_rate(struct clk_hw *hw,
  134. unsigned long parent_rate)
  135. {
  136. struct fapll_data *fd = to_fapll(hw);
  137. u32 fapll_n, fapll_p, v;
  138. u64 rate;
  139. if (ti_fapll_clock_is_bypass(fd))
  140. return parent_rate;
  141. rate = parent_rate;
  142. /* PLL pre-divider is P and multiplier is N */
  143. v = readl_relaxed(fd->base);
  144. fapll_p = (v >> 8) & 0xff;
  145. if (fapll_p)
  146. do_div(rate, fapll_p);
  147. fapll_n = v >> 16;
  148. if (fapll_n)
  149. rate *= fapll_n;
  150. return rate;
  151. }
  152. static u8 ti_fapll_get_parent(struct clk_hw *hw)
  153. {
  154. struct fapll_data *fd = to_fapll(hw);
  155. if (ti_fapll_clock_is_bypass(fd))
  156. return 1;
  157. return 0;
  158. }
  159. static int ti_fapll_set_div_mult(unsigned long rate,
  160. unsigned long parent_rate,
  161. u32 *pre_div_p, u32 *mult_n)
  162. {
  163. /*
  164. * So far no luck getting decent clock with PLL divider,
  165. * PLL does not seem to lock and the signal does not look
  166. * right. It seems the divider can only be used together
  167. * with the multiplier?
  168. */
  169. if (rate < parent_rate) {
  170. pr_warn("FAPLL main divider rates unsupported\n");
  171. return -EINVAL;
  172. }
  173. *mult_n = rate / parent_rate;
  174. if (*mult_n > FAPLL_MAIN_MAX_MULT_N)
  175. return -EINVAL;
  176. *pre_div_p = 1;
  177. return 0;
  178. }
  179. static long ti_fapll_round_rate(struct clk_hw *hw, unsigned long rate,
  180. unsigned long *parent_rate)
  181. {
  182. u32 pre_div_p, mult_n;
  183. int error;
  184. if (!rate)
  185. return -EINVAL;
  186. error = ti_fapll_set_div_mult(rate, *parent_rate,
  187. &pre_div_p, &mult_n);
  188. if (error)
  189. return error;
  190. rate = *parent_rate / pre_div_p;
  191. rate *= mult_n;
  192. return rate;
  193. }
  194. static int ti_fapll_set_rate(struct clk_hw *hw, unsigned long rate,
  195. unsigned long parent_rate)
  196. {
  197. struct fapll_data *fd = to_fapll(hw);
  198. u32 pre_div_p, mult_n, v;
  199. int error;
  200. if (!rate)
  201. return -EINVAL;
  202. error = ti_fapll_set_div_mult(rate, parent_rate,
  203. &pre_div_p, &mult_n);
  204. if (error)
  205. return error;
  206. ti_fapll_set_bypass(fd);
  207. v = readl_relaxed(fd->base);
  208. v &= ~FAPLL_MAIN_CLEAR_MASK;
  209. v |= pre_div_p << FAPLL_MAIN_DIV_P_SHIFT;
  210. v |= mult_n << FAPLL_MAIN_MULT_N_SHIFT;
  211. writel_relaxed(v, fd->base);
  212. if (ti_fapll_is_enabled(hw))
  213. ti_fapll_wait_lock(fd);
  214. ti_fapll_clear_bypass(fd);
  215. return 0;
  216. }
  217. static struct clk_ops ti_fapll_ops = {
  218. .enable = ti_fapll_enable,
  219. .disable = ti_fapll_disable,
  220. .is_enabled = ti_fapll_is_enabled,
  221. .recalc_rate = ti_fapll_recalc_rate,
  222. .get_parent = ti_fapll_get_parent,
  223. .round_rate = ti_fapll_round_rate,
  224. .set_rate = ti_fapll_set_rate,
  225. };
  226. static int ti_fapll_synth_enable(struct clk_hw *hw)
  227. {
  228. struct fapll_synth *synth = to_synth(hw);
  229. u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET);
  230. v &= ~(1 << synth->index);
  231. writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET);
  232. return 0;
  233. }
  234. static void ti_fapll_synth_disable(struct clk_hw *hw)
  235. {
  236. struct fapll_synth *synth = to_synth(hw);
  237. u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET);
  238. v |= 1 << synth->index;
  239. writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET);
  240. }
  241. static int ti_fapll_synth_is_enabled(struct clk_hw *hw)
  242. {
  243. struct fapll_synth *synth = to_synth(hw);
  244. u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET);
  245. return !(v & (1 << synth->index));
  246. }
  247. /*
  248. * See dm816x TRM chapter 1.10.3 Flying Adder PLL fore more info
  249. */
  250. static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw,
  251. unsigned long parent_rate)
  252. {
  253. struct fapll_synth *synth = to_synth(hw);
  254. u32 synth_div_m;
  255. u64 rate;
  256. /* The audio_pll_clk1 is hardwired to produce 32.768KiHz clock */
  257. if (!synth->div)
  258. return 32768;
  259. /*
  260. * PLL in bypass sets the synths in bypass mode too. The PLL rate
  261. * can be also be set to 27MHz, so we can't use parent_rate to
  262. * check for bypass mode.
  263. */
  264. if (ti_fapll_clock_is_bypass(synth->fd))
  265. return parent_rate;
  266. rate = parent_rate;
  267. /*
  268. * Synth frequency integer and fractional divider.
  269. * Note that the phase output K is 8, so the result needs
  270. * to be multiplied by SYNTH_PHASE_K.
  271. */
  272. if (synth->freq) {
  273. u32 v, synth_int_div, synth_frac_div, synth_div_freq;
  274. v = readl_relaxed(synth->freq);
  275. synth_int_div = (v >> 24) & 0xf;
  276. synth_frac_div = v & 0xffffff;
  277. synth_div_freq = (synth_int_div * 10000000) + synth_frac_div;
  278. rate *= 10000000;
  279. do_div(rate, synth_div_freq);
  280. rate *= SYNTH_PHASE_K;
  281. }
  282. /* Synth post-divider M */
  283. synth_div_m = readl_relaxed(synth->div) & SYNTH_MAX_DIV_M;
  284. return DIV_ROUND_UP_ULL(rate, synth_div_m);
  285. }
  286. static unsigned long ti_fapll_synth_get_frac_rate(struct clk_hw *hw,
  287. unsigned long parent_rate)
  288. {
  289. struct fapll_synth *synth = to_synth(hw);
  290. unsigned long current_rate, frac_rate;
  291. u32 post_div_m;
  292. current_rate = ti_fapll_synth_recalc_rate(hw, parent_rate);
  293. post_div_m = readl_relaxed(synth->div) & SYNTH_MAX_DIV_M;
  294. frac_rate = current_rate * post_div_m;
  295. return frac_rate;
  296. }
  297. static u32 ti_fapll_synth_set_frac_rate(struct fapll_synth *synth,
  298. unsigned long rate,
  299. unsigned long parent_rate)
  300. {
  301. u32 post_div_m, synth_int_div = 0, synth_frac_div = 0, v;
  302. post_div_m = DIV_ROUND_UP_ULL((u64)parent_rate * SYNTH_PHASE_K, rate);
  303. post_div_m = post_div_m / SYNTH_MAX_INT_DIV;
  304. if (post_div_m > SYNTH_MAX_DIV_M)
  305. return -EINVAL;
  306. if (!post_div_m)
  307. post_div_m = 1;
  308. for (; post_div_m < SYNTH_MAX_DIV_M; post_div_m++) {
  309. synth_int_div = DIV_ROUND_UP_ULL((u64)parent_rate *
  310. SYNTH_PHASE_K *
  311. 10000000,
  312. rate * post_div_m);
  313. synth_frac_div = synth_int_div % 10000000;
  314. synth_int_div /= 10000000;
  315. if (synth_int_div <= SYNTH_MAX_INT_DIV)
  316. break;
  317. }
  318. if (synth_int_div > SYNTH_MAX_INT_DIV)
  319. return -EINVAL;
  320. v = readl_relaxed(synth->freq);
  321. v &= ~0x1fffffff;
  322. v |= (synth_int_div & SYNTH_MAX_INT_DIV) << 24;
  323. v |= (synth_frac_div & 0xffffff);
  324. v |= SYNTH_LDFREQ;
  325. writel_relaxed(v, synth->freq);
  326. return post_div_m;
  327. }
  328. static long ti_fapll_synth_round_rate(struct clk_hw *hw, unsigned long rate,
  329. unsigned long *parent_rate)
  330. {
  331. struct fapll_synth *synth = to_synth(hw);
  332. struct fapll_data *fd = synth->fd;
  333. unsigned long r;
  334. if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate)
  335. return -EINVAL;
  336. /* Only post divider m available with no fractional divider? */
  337. if (!synth->freq) {
  338. unsigned long frac_rate;
  339. u32 synth_post_div_m;
  340. frac_rate = ti_fapll_synth_get_frac_rate(hw, *parent_rate);
  341. synth_post_div_m = DIV_ROUND_UP(frac_rate, rate);
  342. r = DIV_ROUND_UP(frac_rate, synth_post_div_m);
  343. goto out;
  344. }
  345. r = *parent_rate * SYNTH_PHASE_K;
  346. if (rate > r)
  347. goto out;
  348. r = DIV_ROUND_UP_ULL(r, SYNTH_MAX_INT_DIV * SYNTH_MAX_DIV_M);
  349. if (rate < r)
  350. goto out;
  351. r = rate;
  352. out:
  353. return r;
  354. }
  355. static int ti_fapll_synth_set_rate(struct clk_hw *hw, unsigned long rate,
  356. unsigned long parent_rate)
  357. {
  358. struct fapll_synth *synth = to_synth(hw);
  359. struct fapll_data *fd = synth->fd;
  360. unsigned long frac_rate, post_rate = 0;
  361. u32 post_div_m = 0, v;
  362. if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate)
  363. return -EINVAL;
  364. /* Produce the rate with just post divider M? */
  365. frac_rate = ti_fapll_synth_get_frac_rate(hw, parent_rate);
  366. if (frac_rate < rate) {
  367. if (!synth->freq)
  368. return -EINVAL;
  369. } else {
  370. post_div_m = DIV_ROUND_UP(frac_rate, rate);
  371. if (post_div_m && (post_div_m <= SYNTH_MAX_DIV_M))
  372. post_rate = DIV_ROUND_UP(frac_rate, post_div_m);
  373. if (!synth->freq && !post_rate)
  374. return -EINVAL;
  375. }
  376. /* Need to recalculate the fractional divider? */
  377. if ((post_rate != rate) && synth->freq)
  378. post_div_m = ti_fapll_synth_set_frac_rate(synth,
  379. rate,
  380. parent_rate);
  381. v = readl_relaxed(synth->div);
  382. v &= ~SYNTH_MAX_DIV_M;
  383. v |= post_div_m;
  384. v |= SYNTH_LDMDIV1;
  385. writel_relaxed(v, synth->div);
  386. return 0;
  387. }
  388. static struct clk_ops ti_fapll_synt_ops = {
  389. .enable = ti_fapll_synth_enable,
  390. .disable = ti_fapll_synth_disable,
  391. .is_enabled = ti_fapll_synth_is_enabled,
  392. .recalc_rate = ti_fapll_synth_recalc_rate,
  393. .round_rate = ti_fapll_synth_round_rate,
  394. .set_rate = ti_fapll_synth_set_rate,
  395. };
  396. static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
  397. void __iomem *freq,
  398. void __iomem *div,
  399. int index,
  400. const char *name,
  401. const char *parent,
  402. struct clk *pll_clk)
  403. {
  404. struct clk_init_data *init;
  405. struct fapll_synth *synth;
  406. init = kzalloc(sizeof(*init), GFP_KERNEL);
  407. if (!init)
  408. return ERR_PTR(-ENOMEM);
  409. init->ops = &ti_fapll_synt_ops;
  410. init->name = name;
  411. init->parent_names = &parent;
  412. init->num_parents = 1;
  413. synth = kzalloc(sizeof(*synth), GFP_KERNEL);
  414. if (!synth)
  415. goto free;
  416. synth->fd = fd;
  417. synth->index = index;
  418. synth->freq = freq;
  419. synth->div = div;
  420. synth->name = name;
  421. synth->hw.init = init;
  422. synth->clk_pll = pll_clk;
  423. return clk_register(NULL, &synth->hw);
  424. free:
  425. kfree(synth);
  426. kfree(init);
  427. return ERR_PTR(-ENOMEM);
  428. }
  429. static void __init ti_fapll_setup(struct device_node *node)
  430. {
  431. struct fapll_data *fd;
  432. struct clk_init_data *init = NULL;
  433. const char *parent_name[2];
  434. struct clk *pll_clk;
  435. int i;
  436. fd = kzalloc(sizeof(*fd), GFP_KERNEL);
  437. if (!fd)
  438. return;
  439. fd->outputs.clks = kzalloc(sizeof(struct clk *) *
  440. MAX_FAPLL_OUTPUTS + 1,
  441. GFP_KERNEL);
  442. if (!fd->outputs.clks)
  443. goto free;
  444. init = kzalloc(sizeof(*init), GFP_KERNEL);
  445. if (!init)
  446. goto free;
  447. init->ops = &ti_fapll_ops;
  448. init->name = node->name;
  449. init->num_parents = of_clk_get_parent_count(node);
  450. if (init->num_parents != 2) {
  451. pr_err("%s must have two parents\n", node->name);
  452. goto free;
  453. }
  454. of_clk_parent_fill(node, parent_name, 2);
  455. init->parent_names = parent_name;
  456. fd->clk_ref = of_clk_get(node, 0);
  457. if (IS_ERR(fd->clk_ref)) {
  458. pr_err("%s could not get clk_ref\n", node->name);
  459. goto free;
  460. }
  461. fd->clk_bypass = of_clk_get(node, 1);
  462. if (IS_ERR(fd->clk_bypass)) {
  463. pr_err("%s could not get clk_bypass\n", node->name);
  464. goto free;
  465. }
  466. fd->base = of_iomap(node, 0);
  467. if (!fd->base) {
  468. pr_err("%s could not get IO base\n", node->name);
  469. goto free;
  470. }
  471. if (fapll_is_ddr_pll(fd->base))
  472. fd->bypass_bit_inverted = true;
  473. fd->name = node->name;
  474. fd->hw.init = init;
  475. /* Register the parent PLL */
  476. pll_clk = clk_register(NULL, &fd->hw);
  477. if (IS_ERR(pll_clk))
  478. goto unmap;
  479. fd->outputs.clks[0] = pll_clk;
  480. fd->outputs.clk_num++;
  481. /*
  482. * Set up the child synthesizers starting at index 1 as the
  483. * PLL output is at index 0. We need to check the clock-indices
  484. * for numbering in case there are holes in the synth mapping,
  485. * and then probe the synth register to see if it has a FREQ
  486. * register available.
  487. */
  488. for (i = 0; i < MAX_FAPLL_OUTPUTS; i++) {
  489. const char *output_name;
  490. void __iomem *freq, *div;
  491. struct clk *synth_clk;
  492. int output_instance;
  493. u32 v;
  494. if (of_property_read_string_index(node, "clock-output-names",
  495. i, &output_name))
  496. continue;
  497. if (of_property_read_u32_index(node, "clock-indices", i,
  498. &output_instance))
  499. output_instance = i;
  500. freq = fd->base + (output_instance * 8);
  501. div = freq + 4;
  502. /* Check for hardwired audio_pll_clk1 */
  503. if (is_audio_pll_clk1(freq)) {
  504. freq = NULL;
  505. div = NULL;
  506. } else {
  507. /* Does the synthesizer have a FREQ register? */
  508. v = readl_relaxed(freq);
  509. if (!v)
  510. freq = NULL;
  511. }
  512. synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance,
  513. output_name, node->name,
  514. pll_clk);
  515. if (IS_ERR(synth_clk))
  516. continue;
  517. fd->outputs.clks[output_instance] = synth_clk;
  518. fd->outputs.clk_num++;
  519. clk_register_clkdev(synth_clk, output_name, NULL);
  520. }
  521. /* Register the child synthesizers as the FAPLL outputs */
  522. of_clk_add_provider(node, of_clk_src_onecell_get, &fd->outputs);
  523. /* Add clock alias for the outputs */
  524. kfree(init);
  525. return;
  526. unmap:
  527. iounmap(fd->base);
  528. free:
  529. if (fd->clk_bypass)
  530. clk_put(fd->clk_bypass);
  531. if (fd->clk_ref)
  532. clk_put(fd->clk_ref);
  533. kfree(fd->outputs.clks);
  534. kfree(fd);
  535. kfree(init);
  536. }
  537. CLK_OF_DECLARE(ti_fapll_clock, "ti,dm816-fapll-clock", ti_fapll_setup);