clk.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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 clk_pll_params - PLL parameters
  119. *
  120. * @input_min: Minimum input frequency
  121. * @input_max: Maximum input frequency
  122. * @cf_min: Minimum comparison frequency
  123. * @cf_max: Maximum comparison frequency
  124. * @vco_min: Minimum VCO frequency
  125. * @vco_max: Maximum VCO frequency
  126. * @base_reg: PLL base reg offset
  127. * @misc_reg: PLL misc reg offset
  128. * @lock_reg: PLL lock reg offset
  129. * @lock_bit_idx: Bit index for PLL lock status
  130. * @lock_enable_bit_idx: Bit index to enable PLL lock
  131. * @lock_delay: Delay in us if PLL lock is not used
  132. */
  133. struct tegra_clk_pll_params {
  134. unsigned long input_min;
  135. unsigned long input_max;
  136. unsigned long cf_min;
  137. unsigned long cf_max;
  138. unsigned long vco_min;
  139. unsigned long vco_max;
  140. u32 base_reg;
  141. u32 misc_reg;
  142. u32 lock_reg;
  143. u32 lock_mask;
  144. u32 lock_enable_bit_idx;
  145. u32 iddq_reg;
  146. u32 iddq_bit_idx;
  147. u32 aux_reg;
  148. u32 dyn_ramp_reg;
  149. u32 ext_misc_reg[3];
  150. int stepa_shift;
  151. int stepb_shift;
  152. int lock_delay;
  153. int max_p;
  154. struct pdiv_map *pdiv_tohw;
  155. };
  156. /**
  157. * struct tegra_clk_pll - Tegra PLL clock
  158. *
  159. * @hw: handle between common and hardware-specifix interfaces
  160. * @clk_base: address of CAR controller
  161. * @pmc: address of PMC, required to read override bits
  162. * @freq_table: array of frequencies supported by PLL
  163. * @params: PLL parameters
  164. * @flags: PLL flags
  165. * @fixed_rate: PLL rate if it is fixed
  166. * @lock: register lock
  167. * @divn_shift: shift to the feedback divider bit field
  168. * @divn_width: width of the feedback divider bit field
  169. * @divm_shift: shift to the input divider bit field
  170. * @divm_width: width of the input divider bit field
  171. * @divp_shift: shift to the post divider bit field
  172. * @divp_width: width of the post divider bit field
  173. *
  174. * Flags:
  175. * TEGRA_PLL_USE_LOCK - This flag indicated to use lock bits for
  176. * PLL locking. If not set it will use lock_delay value to wait.
  177. * TEGRA_PLL_HAS_CPCON - This flag indicates that CPCON value needs
  178. * to be programmed to change output frequency of the PLL.
  179. * TEGRA_PLL_SET_LFCON - This flag indicates that LFCON value needs
  180. * to be programmed to change output frequency of the PLL.
  181. * TEGRA_PLL_SET_DCCON - This flag indicates that DCCON value needs
  182. * to be programmed to change output frequency of the PLL.
  183. * TEGRA_PLLU - PLLU has inverted post divider. This flags indicated
  184. * that it is PLLU and invert post divider value.
  185. * TEGRA_PLLM - PLLM has additional override settings in PMC. This
  186. * flag indicates that it is PLLM and use override settings.
  187. * TEGRA_PLL_FIXED - We are not supposed to change output frequency
  188. * of some plls.
  189. * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling.
  190. * TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the
  191. * base register.
  192. * TEGRA_PLL_BYPASS - PLL has bypass bit
  193. * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring
  194. */
  195. struct tegra_clk_pll {
  196. struct clk_hw hw;
  197. void __iomem *clk_base;
  198. void __iomem *pmc;
  199. u32 flags;
  200. unsigned long fixed_rate;
  201. spinlock_t *lock;
  202. u8 divn_shift;
  203. u8 divn_width;
  204. u8 divm_shift;
  205. u8 divm_width;
  206. u8 divp_shift;
  207. u8 divp_width;
  208. struct tegra_clk_pll_freq_table *freq_table;
  209. struct tegra_clk_pll_params *params;
  210. };
  211. #define to_clk_pll(_hw) container_of(_hw, struct tegra_clk_pll, hw)
  212. #define TEGRA_PLL_USE_LOCK BIT(0)
  213. #define TEGRA_PLL_HAS_CPCON BIT(1)
  214. #define TEGRA_PLL_SET_LFCON BIT(2)
  215. #define TEGRA_PLL_SET_DCCON BIT(3)
  216. #define TEGRA_PLLU BIT(4)
  217. #define TEGRA_PLLM BIT(5)
  218. #define TEGRA_PLL_FIXED BIT(6)
  219. #define TEGRA_PLLE_CONFIGURE BIT(7)
  220. #define TEGRA_PLL_LOCK_MISC BIT(8)
  221. #define TEGRA_PLL_BYPASS BIT(9)
  222. #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10)
  223. extern const struct clk_ops tegra_clk_pll_ops;
  224. extern const struct clk_ops tegra_clk_plle_ops;
  225. struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
  226. void __iomem *clk_base, void __iomem *pmc,
  227. unsigned long flags, unsigned long fixed_rate,
  228. struct tegra_clk_pll_params *pll_params, u32 pll_flags,
  229. struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock);
  230. struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
  231. void __iomem *clk_base, void __iomem *pmc,
  232. unsigned long flags, unsigned long fixed_rate,
  233. struct tegra_clk_pll_params *pll_params, u32 pll_flags,
  234. struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock);
  235. struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
  236. void __iomem *clk_base, void __iomem *pmc,
  237. unsigned long flags, unsigned long fixed_rate,
  238. struct tegra_clk_pll_params *pll_params,
  239. u32 pll_flags,
  240. struct tegra_clk_pll_freq_table *freq_table,
  241. spinlock_t *lock);
  242. struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
  243. void __iomem *clk_base, void __iomem *pmc,
  244. unsigned long flags, unsigned long fixed_rate,
  245. struct tegra_clk_pll_params *pll_params,
  246. u32 pll_flags,
  247. struct tegra_clk_pll_freq_table *freq_table,
  248. spinlock_t *lock);
  249. struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
  250. void __iomem *clk_base, void __iomem *pmc,
  251. unsigned long flags, unsigned long fixed_rate,
  252. struct tegra_clk_pll_params *pll_params,
  253. u32 pll_flags,
  254. struct tegra_clk_pll_freq_table *freq_table,
  255. spinlock_t *lock);
  256. struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
  257. void __iomem *clk_base, void __iomem *pmc,
  258. unsigned long flags, unsigned long fixed_rate,
  259. struct tegra_clk_pll_params *pll_params,
  260. u32 pll_flags,
  261. struct tegra_clk_pll_freq_table *freq_table,
  262. spinlock_t *lock, unsigned long parent_rate);
  263. struct clk *tegra_clk_register_plle_tegra114(const char *name,
  264. const char *parent_name,
  265. void __iomem *clk_base, unsigned long flags,
  266. unsigned long fixed_rate,
  267. struct tegra_clk_pll_params *pll_params,
  268. struct tegra_clk_pll_freq_table *freq_table,
  269. spinlock_t *lock);
  270. /**
  271. * struct tegra_clk_pll_out - PLL divider down clock
  272. *
  273. * @hw: handle between common and hardware-specific interfaces
  274. * @reg: register containing the PLL divider
  275. * @enb_bit_idx: bit to enable/disable PLL divider
  276. * @rst_bit_idx: bit to reset PLL divider
  277. * @lock: register lock
  278. * @flags: hardware-specific flags
  279. */
  280. struct tegra_clk_pll_out {
  281. struct clk_hw hw;
  282. void __iomem *reg;
  283. u8 enb_bit_idx;
  284. u8 rst_bit_idx;
  285. spinlock_t *lock;
  286. u8 flags;
  287. };
  288. #define to_clk_pll_out(_hw) container_of(_hw, struct tegra_clk_pll_out, hw)
  289. extern const struct clk_ops tegra_clk_pll_out_ops;
  290. struct clk *tegra_clk_register_pll_out(const char *name,
  291. const char *parent_name, void __iomem *reg, u8 enb_bit_idx,
  292. u8 rst_bit_idx, unsigned long flags, u8 pll_div_flags,
  293. spinlock_t *lock);
  294. /**
  295. * struct tegra_clk_periph_regs - Registers controlling peripheral clock
  296. *
  297. * @enb_reg: read the enable status
  298. * @enb_set_reg: write 1 to enable clock
  299. * @enb_clr_reg: write 1 to disable clock
  300. * @rst_reg: read the reset status
  301. * @rst_set_reg: write 1 to assert the reset of peripheral
  302. * @rst_clr_reg: write 1 to deassert the reset of peripheral
  303. */
  304. struct tegra_clk_periph_regs {
  305. u32 enb_reg;
  306. u32 enb_set_reg;
  307. u32 enb_clr_reg;
  308. u32 rst_reg;
  309. u32 rst_set_reg;
  310. u32 rst_clr_reg;
  311. };
  312. /**
  313. * struct tegra_clk_periph_gate - peripheral gate clock
  314. *
  315. * @magic: magic number to validate type
  316. * @hw: handle between common and hardware-specific interfaces
  317. * @clk_base: address of CAR controller
  318. * @regs: Registers to control the peripheral
  319. * @flags: hardware-specific flags
  320. * @clk_num: Clock number
  321. * @enable_refcnt: array to maintain reference count of the clock
  322. *
  323. * Flags:
  324. * TEGRA_PERIPH_NO_RESET - This flag indicates that reset is not allowed
  325. * for this module.
  326. * TEGRA_PERIPH_MANUAL_RESET - This flag indicates not to reset module
  327. * after clock enable and driver for the module is responsible for
  328. * doing reset.
  329. * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the
  330. * bus to flush the write operation in apb bus. This flag indicates
  331. * that this peripheral is in apb bus.
  332. * TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug
  333. */
  334. struct tegra_clk_periph_gate {
  335. u32 magic;
  336. struct clk_hw hw;
  337. void __iomem *clk_base;
  338. u8 flags;
  339. int clk_num;
  340. int *enable_refcnt;
  341. struct tegra_clk_periph_regs *regs;
  342. };
  343. #define to_clk_periph_gate(_hw) \
  344. container_of(_hw, struct tegra_clk_periph_gate, hw)
  345. #define TEGRA_CLK_PERIPH_GATE_MAGIC 0x17760309
  346. #define TEGRA_PERIPH_NO_RESET BIT(0)
  347. #define TEGRA_PERIPH_MANUAL_RESET BIT(1)
  348. #define TEGRA_PERIPH_ON_APB BIT(2)
  349. #define TEGRA_PERIPH_WAR_1005168 BIT(3)
  350. void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert);
  351. extern const struct clk_ops tegra_clk_periph_gate_ops;
  352. struct clk *tegra_clk_register_periph_gate(const char *name,
  353. const char *parent_name, u8 gate_flags, void __iomem *clk_base,
  354. unsigned long flags, int clk_num,
  355. struct tegra_clk_periph_regs *pregs, int *enable_refcnt);
  356. /**
  357. * struct clk-periph - peripheral clock
  358. *
  359. * @magic: magic number to validate type
  360. * @hw: handle between common and hardware-specific interfaces
  361. * @mux: mux clock
  362. * @divider: divider clock
  363. * @gate: gate clock
  364. * @mux_ops: mux clock ops
  365. * @div_ops: divider clock ops
  366. * @gate_ops: gate clock ops
  367. */
  368. struct tegra_clk_periph {
  369. u32 magic;
  370. struct clk_hw hw;
  371. struct clk_mux mux;
  372. struct tegra_clk_frac_div divider;
  373. struct tegra_clk_periph_gate gate;
  374. const struct clk_ops *mux_ops;
  375. const struct clk_ops *div_ops;
  376. const struct clk_ops *gate_ops;
  377. };
  378. #define to_clk_periph(_hw) container_of(_hw, struct tegra_clk_periph, hw)
  379. #define TEGRA_CLK_PERIPH_MAGIC 0x18221223
  380. extern const struct clk_ops tegra_clk_periph_ops;
  381. struct clk *tegra_clk_register_periph(const char *name,
  382. const char **parent_names, int num_parents,
  383. struct tegra_clk_periph *periph, void __iomem *clk_base,
  384. u32 offset, unsigned long flags);
  385. struct clk *tegra_clk_register_periph_nodiv(const char *name,
  386. const char **parent_names, int num_parents,
  387. struct tegra_clk_periph *periph, void __iomem *clk_base,
  388. u32 offset);
  389. #define TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, _mux_flags, \
  390. _div_shift, _div_width, _div_frac_width, \
  391. _div_flags, _clk_num, _enb_refcnt, _regs, \
  392. _gate_flags, _table) \
  393. { \
  394. .mux = { \
  395. .flags = _mux_flags, \
  396. .shift = _mux_shift, \
  397. .mask = _mux_mask, \
  398. .table = _table, \
  399. }, \
  400. .divider = { \
  401. .flags = _div_flags, \
  402. .shift = _div_shift, \
  403. .width = _div_width, \
  404. .frac_width = _div_frac_width, \
  405. }, \
  406. .gate = { \
  407. .flags = _gate_flags, \
  408. .clk_num = _clk_num, \
  409. .enable_refcnt = _enb_refcnt, \
  410. .regs = _regs, \
  411. }, \
  412. .mux_ops = &clk_mux_ops, \
  413. .div_ops = &tegra_clk_frac_div_ops, \
  414. .gate_ops = &tegra_clk_periph_gate_ops, \
  415. }
  416. struct tegra_periph_init_data {
  417. const char *name;
  418. int clk_id;
  419. const char **parent_names;
  420. int num_parents;
  421. struct tegra_clk_periph periph;
  422. u32 offset;
  423. const char *con_id;
  424. const char *dev_id;
  425. unsigned long flags;
  426. };
  427. #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\
  428. _mux_shift, _mux_mask, _mux_flags, _div_shift, \
  429. _div_width, _div_frac_width, _div_flags, _regs, \
  430. _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\
  431. _flags) \
  432. { \
  433. .name = _name, \
  434. .clk_id = _clk_id, \
  435. .parent_names = _parent_names, \
  436. .num_parents = ARRAY_SIZE(_parent_names), \
  437. .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, \
  438. _mux_flags, _div_shift, \
  439. _div_width, _div_frac_width, \
  440. _div_flags, _clk_num, \
  441. _enb_refcnt, _regs, \
  442. _gate_flags, _table), \
  443. .offset = _offset, \
  444. .con_id = _con_id, \
  445. .dev_id = _dev_id, \
  446. .flags = _flags \
  447. }
  448. #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\
  449. _mux_shift, _mux_width, _mux_flags, _div_shift, \
  450. _div_width, _div_frac_width, _div_flags, _regs, \
  451. _clk_num, _enb_refcnt, _gate_flags, _clk_id) \
  452. TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\
  453. _mux_shift, BIT(_mux_width) - 1, _mux_flags, \
  454. _div_shift, _div_width, _div_frac_width, _div_flags, \
  455. _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\
  456. NULL, 0)
  457. /**
  458. * struct clk_super_mux - super clock
  459. *
  460. * @hw: handle between common and hardware-specific interfaces
  461. * @reg: register controlling multiplexer
  462. * @width: width of the multiplexer bit field
  463. * @flags: hardware-specific flags
  464. * @div2_index: bit controlling divide-by-2
  465. * @pllx_index: PLLX index in the parent list
  466. * @lock: register lock
  467. *
  468. * Flags:
  469. * TEGRA_DIVIDER_2 - LP cluster has additional divider. This flag indicates
  470. * that this is LP cluster clock.
  471. */
  472. struct tegra_clk_super_mux {
  473. struct clk_hw hw;
  474. void __iomem *reg;
  475. u8 width;
  476. u8 flags;
  477. u8 div2_index;
  478. u8 pllx_index;
  479. spinlock_t *lock;
  480. };
  481. #define to_clk_super_mux(_hw) container_of(_hw, struct tegra_clk_super_mux, hw)
  482. #define TEGRA_DIVIDER_2 BIT(0)
  483. extern const struct clk_ops tegra_clk_super_ops;
  484. struct clk *tegra_clk_register_super_mux(const char *name,
  485. const char **parent_names, u8 num_parents,
  486. unsigned long flags, void __iomem *reg, u8 clk_super_flags,
  487. u8 width, u8 pllx_index, u8 div2_index, spinlock_t *lock);
  488. /**
  489. * struct clk_init_tabel - clock initialization table
  490. * @clk_id: clock id as mentioned in device tree bindings
  491. * @parent_id: parent clock id as mentioned in device tree bindings
  492. * @rate: rate to set
  493. * @state: enable/disable
  494. */
  495. struct tegra_clk_init_table {
  496. unsigned int clk_id;
  497. unsigned int parent_id;
  498. unsigned long rate;
  499. int state;
  500. };
  501. /**
  502. * struct clk_duplicate - duplicate clocks
  503. * @clk_id: clock id as mentioned in device tree bindings
  504. * @lookup: duplicate lookup entry for the clock
  505. */
  506. struct tegra_clk_duplicate {
  507. int clk_id;
  508. struct clk_lookup lookup;
  509. };
  510. #define TEGRA_CLK_DUPLICATE(_clk_id, _dev, _con) \
  511. { \
  512. .clk_id = _clk_id, \
  513. .lookup = { \
  514. .dev_id = _dev, \
  515. .con_id = _con, \
  516. }, \
  517. }
  518. void tegra_init_from_table(struct tegra_clk_init_table *tbl,
  519. struct clk *clks[], int clk_max);
  520. void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
  521. struct clk *clks[], int clk_max);
  522. #ifdef CONFIG_ARCH_TEGRA_2x_SOC
  523. void tegra20_clock_init(struct device_node *np);
  524. #else
  525. static inline void tegra20_clock_init(struct device_node *np) {}
  526. #endif /* CONFIG_ARCH_TEGRA_2x_SOC */
  527. #ifdef CONFIG_ARCH_TEGRA_3x_SOC
  528. void tegra30_clock_init(struct device_node *np);
  529. #else
  530. static inline void tegra30_clock_init(struct device_node *np) {}
  531. #endif /* CONFIG_ARCH_TEGRA_3x_SOC */
  532. #ifdef CONFIG_ARCH_TEGRA_114_SOC
  533. void tegra114_clock_init(struct device_node *np);
  534. #else
  535. static inline void tegra114_clock_init(struct device_node *np) {}
  536. #endif /* CONFIG_ARCH_TEGRA114_SOC */
  537. typedef void (*tegra_clk_apply_init_table_func)(void);
  538. extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table;
  539. #endif /* TEGRA_CLK_H */