clk.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. /*
  2. * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef __TEGRA_CLK_H
  17. #define __TEGRA_CLK_H
  18. #include <linux/clk-provider.h>
  19. #include <linux/clkdev.h>
  20. /**
  21. * struct tegra_clk_sync_source - external clock source from codec
  22. *
  23. * @hw: handle between common and hardware-specific interfaces
  24. * @rate: input frequency from source
  25. * @max_rate: max rate allowed
  26. */
  27. struct tegra_clk_sync_source {
  28. struct clk_hw hw;
  29. unsigned long rate;
  30. unsigned long max_rate;
  31. };
  32. #define to_clk_sync_source(_hw) \
  33. container_of(_hw, struct tegra_clk_sync_source, hw)
  34. extern const struct clk_ops tegra_clk_sync_source_ops;
  35. struct clk *tegra_clk_register_sync_source(const char *name,
  36. unsigned long fixed_rate, unsigned long max_rate);
  37. /**
  38. * struct tegra_clk_frac_div - fractional divider clock
  39. *
  40. * @hw: handle between common and hardware-specific interfaces
  41. * @reg: register containing divider
  42. * @flags: hardware-specific flags
  43. * @shift: shift to the divider bit field
  44. * @width: width of the divider bit field
  45. * @frac_width: width of the fractional bit field
  46. * @lock: register lock
  47. *
  48. * Flags:
  49. * TEGRA_DIVIDER_ROUND_UP - This flags indicates to round up the divider value.
  50. * TEGRA_DIVIDER_FIXED - Fixed rate PLL dividers has addition override bit, this
  51. * flag indicates that this divider is for fixed rate PLL.
  52. * TEGRA_DIVIDER_INT - Some modules can not cope with the duty cycle when
  53. * fraction bit is set. This flags indicates to calculate divider for which
  54. * fracton bit will be zero.
  55. * TEGRA_DIVIDER_UART - UART module divider has additional enable bit which is
  56. * set when divider value is not 0. This flags indicates that the divider
  57. * is for UART module.
  58. */
  59. struct tegra_clk_frac_div {
  60. struct clk_hw hw;
  61. void __iomem *reg;
  62. u8 flags;
  63. u8 shift;
  64. u8 width;
  65. u8 frac_width;
  66. spinlock_t *lock;
  67. };
  68. #define to_clk_frac_div(_hw) container_of(_hw, struct tegra_clk_frac_div, hw)
  69. #define TEGRA_DIVIDER_ROUND_UP BIT(0)
  70. #define TEGRA_DIVIDER_FIXED BIT(1)
  71. #define TEGRA_DIVIDER_INT BIT(2)
  72. #define TEGRA_DIVIDER_UART BIT(3)
  73. extern const struct clk_ops tegra_clk_frac_div_ops;
  74. struct clk *tegra_clk_register_divider(const char *name,
  75. const char *parent_name, void __iomem *reg,
  76. unsigned long flags, u8 clk_divider_flags, u8 shift, u8 width,
  77. u8 frac_width, spinlock_t *lock);
  78. /*
  79. * Tegra PLL:
  80. *
  81. * In general, there are 3 requirements for each PLL
  82. * that SW needs to be comply with.
  83. * (1) Input frequency range (REF).
  84. * (2) Comparison frequency range (CF). CF = REF/DIVM.
  85. * (3) VCO frequency range (VCO). VCO = CF * DIVN.
  86. *
  87. * The final PLL output frequency (FO) = VCO >> DIVP.
  88. */
  89. /**
  90. * struct tegra_clk_pll_freq_table - PLL frequecy table
  91. *
  92. * @input_rate: input rate from source
  93. * @output_rate: output rate from PLL for the input rate
  94. * @n: feedback divider
  95. * @m: input divider
  96. * @p: post divider
  97. * @cpcon: charge pump current
  98. */
  99. struct tegra_clk_pll_freq_table {
  100. unsigned long input_rate;
  101. unsigned long output_rate;
  102. u16 n;
  103. u16 m;
  104. u8 p;
  105. u8 cpcon;
  106. };
  107. /**
  108. * struct pdiv_map - map post divider to hw value
  109. *
  110. * @pdiv: post divider
  111. * @hw_val: value to be written to the PLL hw
  112. */
  113. struct pdiv_map {
  114. u8 pdiv;
  115. u8 hw_val;
  116. };
  117. /**
  118. * struct div_nmp - offset and width of m,n and p fields
  119. *
  120. * @divn_shift: shift to the feedback divider bit field
  121. * @divn_width: width of the feedback divider bit field
  122. * @divm_shift: shift to the input divider bit field
  123. * @divm_width: width of the input divider bit field
  124. * @divp_shift: shift to the post divider bit field
  125. * @divp_width: width of the post divider bit field
  126. * @override_divn_shift: shift to the feedback divider bitfield in override reg
  127. * @override_divm_shift: shift to the input divider bitfield in override reg
  128. * @override_divp_shift: shift to the post divider bitfield in override reg
  129. */
  130. struct div_nmp {
  131. u8 divn_shift;
  132. u8 divn_width;
  133. u8 divm_shift;
  134. u8 divm_width;
  135. u8 divp_shift;
  136. u8 divp_width;
  137. u8 override_divn_shift;
  138. u8 override_divm_shift;
  139. u8 override_divp_shift;
  140. };
  141. /**
  142. * struct clk_pll_params - PLL parameters
  143. *
  144. * @input_min: Minimum input frequency
  145. * @input_max: Maximum input frequency
  146. * @cf_min: Minimum comparison frequency
  147. * @cf_max: Maximum comparison frequency
  148. * @vco_min: Minimum VCO frequency
  149. * @vco_max: Maximum VCO frequency
  150. * @base_reg: PLL base reg offset
  151. * @misc_reg: PLL misc reg offset
  152. * @lock_reg: PLL lock reg offset
  153. * @lock_bit_idx: Bit index for PLL lock status
  154. * @lock_enable_bit_idx: Bit index to enable PLL lock
  155. * @lock_delay: Delay in us if PLL lock is not used
  156. */
  157. struct tegra_clk_pll_params {
  158. unsigned long input_min;
  159. unsigned long input_max;
  160. unsigned long cf_min;
  161. unsigned long cf_max;
  162. unsigned long vco_min;
  163. unsigned long vco_max;
  164. u32 base_reg;
  165. u32 misc_reg;
  166. u32 lock_reg;
  167. u32 lock_mask;
  168. u32 lock_enable_bit_idx;
  169. u32 iddq_reg;
  170. u32 iddq_bit_idx;
  171. u32 aux_reg;
  172. u32 dyn_ramp_reg;
  173. u32 ext_misc_reg[3];
  174. u32 pmc_divnm_reg;
  175. u32 pmc_divp_reg;
  176. int stepa_shift;
  177. int stepb_shift;
  178. int lock_delay;
  179. int max_p;
  180. struct pdiv_map *pdiv_tohw;
  181. struct div_nmp *div_nmp;
  182. };
  183. /**
  184. * struct tegra_clk_pll - Tegra PLL clock
  185. *
  186. * @hw: handle between common and hardware-specifix interfaces
  187. * @clk_base: address of CAR controller
  188. * @pmc: address of PMC, required to read override bits
  189. * @freq_table: array of frequencies supported by PLL
  190. * @params: PLL parameters
  191. * @flags: PLL flags
  192. * @fixed_rate: PLL rate if it is fixed
  193. * @lock: register lock
  194. *
  195. * Flags:
  196. * TEGRA_PLL_USE_LOCK - This flag indicated to use lock bits for
  197. * PLL locking. If not set it will use lock_delay value to wait.
  198. * TEGRA_PLL_HAS_CPCON - This flag indicates that CPCON value needs
  199. * to be programmed to change output frequency of the PLL.
  200. * TEGRA_PLL_SET_LFCON - This flag indicates that LFCON value needs
  201. * to be programmed to change output frequency of the PLL.
  202. * TEGRA_PLL_SET_DCCON - This flag indicates that DCCON value needs
  203. * to be programmed to change output frequency of the PLL.
  204. * TEGRA_PLLU - PLLU has inverted post divider. This flags indicated
  205. * that it is PLLU and invert post divider value.
  206. * TEGRA_PLLM - PLLM has additional override settings in PMC. This
  207. * flag indicates that it is PLLM and use override settings.
  208. * TEGRA_PLL_FIXED - We are not supposed to change output frequency
  209. * of some plls.
  210. * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling.
  211. * TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the
  212. * base register.
  213. * TEGRA_PLL_BYPASS - PLL has bypass bit
  214. * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring
  215. */
  216. struct tegra_clk_pll {
  217. struct clk_hw hw;
  218. void __iomem *clk_base;
  219. void __iomem *pmc;
  220. u32 flags;
  221. unsigned long fixed_rate;
  222. spinlock_t *lock;
  223. struct tegra_clk_pll_freq_table *freq_table;
  224. struct tegra_clk_pll_params *params;
  225. };
  226. #define to_clk_pll(_hw) container_of(_hw, struct tegra_clk_pll, hw)
  227. #define TEGRA_PLL_USE_LOCK BIT(0)
  228. #define TEGRA_PLL_HAS_CPCON BIT(1)
  229. #define TEGRA_PLL_SET_LFCON BIT(2)
  230. #define TEGRA_PLL_SET_DCCON BIT(3)
  231. #define TEGRA_PLLU BIT(4)
  232. #define TEGRA_PLLM BIT(5)
  233. #define TEGRA_PLL_FIXED BIT(6)
  234. #define TEGRA_PLLE_CONFIGURE BIT(7)
  235. #define TEGRA_PLL_LOCK_MISC BIT(8)
  236. #define TEGRA_PLL_BYPASS BIT(9)
  237. #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10)
  238. extern const struct clk_ops tegra_clk_pll_ops;
  239. extern const struct clk_ops tegra_clk_plle_ops;
  240. struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
  241. void __iomem *clk_base, void __iomem *pmc,
  242. unsigned long flags, unsigned long fixed_rate,
  243. struct tegra_clk_pll_params *pll_params, u32 pll_flags,
  244. struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock);
  245. struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
  246. void __iomem *clk_base, void __iomem *pmc,
  247. unsigned long flags, unsigned long fixed_rate,
  248. struct tegra_clk_pll_params *pll_params, u32 pll_flags,
  249. struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock);
  250. struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
  251. void __iomem *clk_base, void __iomem *pmc,
  252. unsigned long flags, unsigned long fixed_rate,
  253. struct tegra_clk_pll_params *pll_params,
  254. u32 pll_flags,
  255. struct tegra_clk_pll_freq_table *freq_table,
  256. spinlock_t *lock);
  257. struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
  258. void __iomem *clk_base, void __iomem *pmc,
  259. unsigned long flags, unsigned long fixed_rate,
  260. struct tegra_clk_pll_params *pll_params,
  261. u32 pll_flags,
  262. struct tegra_clk_pll_freq_table *freq_table,
  263. spinlock_t *lock);
  264. struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
  265. void __iomem *clk_base, void __iomem *pmc,
  266. unsigned long flags, unsigned long fixed_rate,
  267. struct tegra_clk_pll_params *pll_params,
  268. u32 pll_flags,
  269. struct tegra_clk_pll_freq_table *freq_table,
  270. spinlock_t *lock);
  271. struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
  272. void __iomem *clk_base, void __iomem *pmc,
  273. unsigned long flags, unsigned long fixed_rate,
  274. struct tegra_clk_pll_params *pll_params,
  275. u32 pll_flags,
  276. struct tegra_clk_pll_freq_table *freq_table,
  277. spinlock_t *lock, unsigned long parent_rate);
  278. struct clk *tegra_clk_register_plle_tegra114(const char *name,
  279. const char *parent_name,
  280. void __iomem *clk_base, unsigned long flags,
  281. unsigned long fixed_rate,
  282. struct tegra_clk_pll_params *pll_params,
  283. struct tegra_clk_pll_freq_table *freq_table,
  284. spinlock_t *lock);
  285. /**
  286. * struct tegra_clk_pll_out - PLL divider down clock
  287. *
  288. * @hw: handle between common and hardware-specific interfaces
  289. * @reg: register containing the PLL divider
  290. * @enb_bit_idx: bit to enable/disable PLL divider
  291. * @rst_bit_idx: bit to reset PLL divider
  292. * @lock: register lock
  293. * @flags: hardware-specific flags
  294. */
  295. struct tegra_clk_pll_out {
  296. struct clk_hw hw;
  297. void __iomem *reg;
  298. u8 enb_bit_idx;
  299. u8 rst_bit_idx;
  300. spinlock_t *lock;
  301. u8 flags;
  302. };
  303. #define to_clk_pll_out(_hw) container_of(_hw, struct tegra_clk_pll_out, hw)
  304. extern const struct clk_ops tegra_clk_pll_out_ops;
  305. struct clk *tegra_clk_register_pll_out(const char *name,
  306. const char *parent_name, void __iomem *reg, u8 enb_bit_idx,
  307. u8 rst_bit_idx, unsigned long flags, u8 pll_div_flags,
  308. spinlock_t *lock);
  309. /**
  310. * struct tegra_clk_periph_regs - Registers controlling peripheral clock
  311. *
  312. * @enb_reg: read the enable status
  313. * @enb_set_reg: write 1 to enable clock
  314. * @enb_clr_reg: write 1 to disable clock
  315. * @rst_reg: read the reset status
  316. * @rst_set_reg: write 1 to assert the reset of peripheral
  317. * @rst_clr_reg: write 1 to deassert the reset of peripheral
  318. */
  319. struct tegra_clk_periph_regs {
  320. u32 enb_reg;
  321. u32 enb_set_reg;
  322. u32 enb_clr_reg;
  323. u32 rst_reg;
  324. u32 rst_set_reg;
  325. u32 rst_clr_reg;
  326. };
  327. /**
  328. * struct tegra_clk_periph_gate - peripheral gate clock
  329. *
  330. * @magic: magic number to validate type
  331. * @hw: handle between common and hardware-specific interfaces
  332. * @clk_base: address of CAR controller
  333. * @regs: Registers to control the peripheral
  334. * @flags: hardware-specific flags
  335. * @clk_num: Clock number
  336. * @enable_refcnt: array to maintain reference count of the clock
  337. *
  338. * Flags:
  339. * TEGRA_PERIPH_NO_RESET - This flag indicates that reset is not allowed
  340. * for this module.
  341. * TEGRA_PERIPH_MANUAL_RESET - This flag indicates not to reset module
  342. * after clock enable and driver for the module is responsible for
  343. * doing reset.
  344. * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the
  345. * bus to flush the write operation in apb bus. This flag indicates
  346. * that this peripheral is in apb bus.
  347. * TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug
  348. */
  349. struct tegra_clk_periph_gate {
  350. u32 magic;
  351. struct clk_hw hw;
  352. void __iomem *clk_base;
  353. u8 flags;
  354. int clk_num;
  355. int *enable_refcnt;
  356. struct tegra_clk_periph_regs *regs;
  357. };
  358. #define to_clk_periph_gate(_hw) \
  359. container_of(_hw, struct tegra_clk_periph_gate, hw)
  360. #define TEGRA_CLK_PERIPH_GATE_MAGIC 0x17760309
  361. #define TEGRA_PERIPH_NO_RESET BIT(0)
  362. #define TEGRA_PERIPH_MANUAL_RESET BIT(1)
  363. #define TEGRA_PERIPH_ON_APB BIT(2)
  364. #define TEGRA_PERIPH_WAR_1005168 BIT(3)
  365. void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert);
  366. extern const struct clk_ops tegra_clk_periph_gate_ops;
  367. struct clk *tegra_clk_register_periph_gate(const char *name,
  368. const char *parent_name, u8 gate_flags, void __iomem *clk_base,
  369. unsigned long flags, int clk_num,
  370. struct tegra_clk_periph_regs *pregs, int *enable_refcnt);
  371. /**
  372. * struct clk-periph - peripheral clock
  373. *
  374. * @magic: magic number to validate type
  375. * @hw: handle between common and hardware-specific interfaces
  376. * @mux: mux clock
  377. * @divider: divider clock
  378. * @gate: gate clock
  379. * @mux_ops: mux clock ops
  380. * @div_ops: divider clock ops
  381. * @gate_ops: gate clock ops
  382. */
  383. struct tegra_clk_periph {
  384. u32 magic;
  385. struct clk_hw hw;
  386. struct clk_mux mux;
  387. struct tegra_clk_frac_div divider;
  388. struct tegra_clk_periph_gate gate;
  389. const struct clk_ops *mux_ops;
  390. const struct clk_ops *div_ops;
  391. const struct clk_ops *gate_ops;
  392. };
  393. #define to_clk_periph(_hw) container_of(_hw, struct tegra_clk_periph, hw)
  394. #define TEGRA_CLK_PERIPH_MAGIC 0x18221223
  395. extern const struct clk_ops tegra_clk_periph_ops;
  396. struct clk *tegra_clk_register_periph(const char *name,
  397. const char **parent_names, int num_parents,
  398. struct tegra_clk_periph *periph, void __iomem *clk_base,
  399. u32 offset, unsigned long flags);
  400. struct clk *tegra_clk_register_periph_nodiv(const char *name,
  401. const char **parent_names, int num_parents,
  402. struct tegra_clk_periph *periph, void __iomem *clk_base,
  403. u32 offset);
  404. #define TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, _mux_flags, \
  405. _div_shift, _div_width, _div_frac_width, \
  406. _div_flags, _clk_num, _enb_refcnt, _regs, \
  407. _gate_flags, _table) \
  408. { \
  409. .mux = { \
  410. .flags = _mux_flags, \
  411. .shift = _mux_shift, \
  412. .mask = _mux_mask, \
  413. .table = _table, \
  414. }, \
  415. .divider = { \
  416. .flags = _div_flags, \
  417. .shift = _div_shift, \
  418. .width = _div_width, \
  419. .frac_width = _div_frac_width, \
  420. }, \
  421. .gate = { \
  422. .flags = _gate_flags, \
  423. .clk_num = _clk_num, \
  424. .enable_refcnt = _enb_refcnt, \
  425. .regs = _regs, \
  426. }, \
  427. .mux_ops = &clk_mux_ops, \
  428. .div_ops = &tegra_clk_frac_div_ops, \
  429. .gate_ops = &tegra_clk_periph_gate_ops, \
  430. }
  431. struct tegra_periph_init_data {
  432. const char *name;
  433. int clk_id;
  434. const char **parent_names;
  435. int num_parents;
  436. struct tegra_clk_periph periph;
  437. u32 offset;
  438. const char *con_id;
  439. const char *dev_id;
  440. unsigned long flags;
  441. };
  442. #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\
  443. _mux_shift, _mux_mask, _mux_flags, _div_shift, \
  444. _div_width, _div_frac_width, _div_flags, _regs, \
  445. _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\
  446. _flags) \
  447. { \
  448. .name = _name, \
  449. .clk_id = _clk_id, \
  450. .parent_names = _parent_names, \
  451. .num_parents = ARRAY_SIZE(_parent_names), \
  452. .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, \
  453. _mux_flags, _div_shift, \
  454. _div_width, _div_frac_width, \
  455. _div_flags, _clk_num, \
  456. _enb_refcnt, _regs, \
  457. _gate_flags, _table), \
  458. .offset = _offset, \
  459. .con_id = _con_id, \
  460. .dev_id = _dev_id, \
  461. .flags = _flags \
  462. }
  463. #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\
  464. _mux_shift, _mux_width, _mux_flags, _div_shift, \
  465. _div_width, _div_frac_width, _div_flags, _regs, \
  466. _clk_num, _enb_refcnt, _gate_flags, _clk_id) \
  467. TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\
  468. _mux_shift, BIT(_mux_width) - 1, _mux_flags, \
  469. _div_shift, _div_width, _div_frac_width, _div_flags, \
  470. _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\
  471. NULL, 0)
  472. /**
  473. * struct clk_super_mux - super clock
  474. *
  475. * @hw: handle between common and hardware-specific interfaces
  476. * @reg: register controlling multiplexer
  477. * @width: width of the multiplexer bit field
  478. * @flags: hardware-specific flags
  479. * @div2_index: bit controlling divide-by-2
  480. * @pllx_index: PLLX index in the parent list
  481. * @lock: register lock
  482. *
  483. * Flags:
  484. * TEGRA_DIVIDER_2 - LP cluster has additional divider. This flag indicates
  485. * that this is LP cluster clock.
  486. */
  487. struct tegra_clk_super_mux {
  488. struct clk_hw hw;
  489. void __iomem *reg;
  490. u8 width;
  491. u8 flags;
  492. u8 div2_index;
  493. u8 pllx_index;
  494. spinlock_t *lock;
  495. };
  496. #define to_clk_super_mux(_hw) container_of(_hw, struct tegra_clk_super_mux, hw)
  497. #define TEGRA_DIVIDER_2 BIT(0)
  498. extern const struct clk_ops tegra_clk_super_ops;
  499. struct clk *tegra_clk_register_super_mux(const char *name,
  500. const char **parent_names, u8 num_parents,
  501. unsigned long flags, void __iomem *reg, u8 clk_super_flags,
  502. u8 width, u8 pllx_index, u8 div2_index, spinlock_t *lock);
  503. /**
  504. * struct clk_init_tabel - clock initialization table
  505. * @clk_id: clock id as mentioned in device tree bindings
  506. * @parent_id: parent clock id as mentioned in device tree bindings
  507. * @rate: rate to set
  508. * @state: enable/disable
  509. */
  510. struct tegra_clk_init_table {
  511. unsigned int clk_id;
  512. unsigned int parent_id;
  513. unsigned long rate;
  514. int state;
  515. };
  516. /**
  517. * struct clk_duplicate - duplicate clocks
  518. * @clk_id: clock id as mentioned in device tree bindings
  519. * @lookup: duplicate lookup entry for the clock
  520. */
  521. struct tegra_clk_duplicate {
  522. int clk_id;
  523. struct clk_lookup lookup;
  524. };
  525. #define TEGRA_CLK_DUPLICATE(_clk_id, _dev, _con) \
  526. { \
  527. .clk_id = _clk_id, \
  528. .lookup = { \
  529. .dev_id = _dev, \
  530. .con_id = _con, \
  531. }, \
  532. }
  533. void tegra_init_from_table(struct tegra_clk_init_table *tbl,
  534. struct clk *clks[], int clk_max);
  535. void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
  536. struct clk *clks[], int clk_max);
  537. void tegra114_clock_tune_cpu_trimmers_high(void);
  538. void tegra114_clock_tune_cpu_trimmers_low(void);
  539. void tegra114_clock_tune_cpu_trimmers_init(void);
  540. void tegra114_clock_assert_dfll_dvco_reset(void);
  541. void tegra114_clock_deassert_dfll_dvco_reset(void);
  542. typedef void (*tegra_clk_apply_init_table_func)(void);
  543. extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table;
  544. #endif /* TEGRA_CLK_H */