2 * Copyright (c) 2012-2014 NVIDIA CORPORATION. All rights reserved.
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.
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
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/>.
18 #include <linux/clk.h>
19 #include <linux/clk-provider.h>
20 #include <linux/clkdev.h>
22 #include <linux/of_address.h>
23 #include <linux/delay.h>
24 #include <linux/export.h>
25 #include <linux/clk/tegra.h>
26 #include <dt-bindings/clock/tegra210-car.h>
32 * TEGRA210_CAR_BANK_COUNT: the number of peripheral clock register
33 * banks present in the Tegra210 CAR IP block. The banks are
34 * identified by single letters, e.g.: L, H, U, V, W, X, Y. See
35 * periph_regs[] in drivers/clk/tegra/clk.c
37 #define TEGRA210_CAR_BANK_COUNT 7
39 #define CLK_SOURCE_CSITE 0x1d4
40 #define CLK_SOURCE_EMC 0x19c
42 #define PLLC_BASE 0x80
44 #define PLLC_MISC0 0x88
45 #define PLLC_MISC1 0x8c
46 #define PLLC_MISC2 0x5d0
47 #define PLLC_MISC3 0x5d4
49 #define PLLC2_BASE 0x4e8
50 #define PLLC2_MISC0 0x4ec
51 #define PLLC2_MISC1 0x4f0
52 #define PLLC2_MISC2 0x4f4
53 #define PLLC2_MISC3 0x4f8
55 #define PLLC3_BASE 0x4fc
56 #define PLLC3_MISC0 0x500
57 #define PLLC3_MISC1 0x504
58 #define PLLC3_MISC2 0x508
59 #define PLLC3_MISC3 0x50c
61 #define PLLM_BASE 0x90
62 #define PLLM_MISC1 0x98
63 #define PLLM_MISC2 0x9c
64 #define PLLP_BASE 0xa0
65 #define PLLP_MISC0 0xac
66 #define PLLP_MISC1 0x680
67 #define PLLA_BASE 0xb0
68 #define PLLA_MISC0 0xbc
69 #define PLLA_MISC1 0xb8
70 #define PLLA_MISC2 0x5d8
71 #define PLLD_BASE 0xd0
72 #define PLLD_MISC0 0xdc
73 #define PLLD_MISC1 0xd8
74 #define PLLU_BASE 0xc0
75 #define PLLU_OUTA 0xc4
76 #define PLLU_MISC0 0xcc
77 #define PLLU_MISC1 0xc8
78 #define PLLX_BASE 0xe0
79 #define PLLX_MISC0 0xe4
80 #define PLLX_MISC1 0x510
81 #define PLLX_MISC2 0x514
82 #define PLLX_MISC3 0x518
83 #define PLLX_MISC4 0x5f0
84 #define PLLX_MISC5 0x5f4
85 #define PLLE_BASE 0xe8
86 #define PLLE_MISC0 0xec
87 #define PLLD2_BASE 0x4b8
88 #define PLLD2_MISC0 0x4bc
89 #define PLLD2_MISC1 0x570
90 #define PLLD2_MISC2 0x574
91 #define PLLD2_MISC3 0x578
92 #define PLLE_AUX 0x48c
93 #define PLLRE_BASE 0x4c4
94 #define PLLRE_MISC0 0x4c8
95 #define PLLRE_OUT1 0x4cc
96 #define PLLDP_BASE 0x590
97 #define PLLDP_MISC 0x594
99 #define PLLC4_BASE 0x5a4
100 #define PLLC4_MISC0 0x5a8
101 #define PLLC4_OUT 0x5e4
102 #define PLLMB_BASE 0x5e8
103 #define PLLMB_MISC1 0x5ec
104 #define PLLA1_BASE 0x6a4
105 #define PLLA1_MISC0 0x6a8
106 #define PLLA1_MISC1 0x6ac
107 #define PLLA1_MISC2 0x6b0
108 #define PLLA1_MISC3 0x6b4
110 #define PLLU_IDDQ_BIT 31
111 #define PLLCX_IDDQ_BIT 27
112 #define PLLRE_IDDQ_BIT 24
113 #define PLLA_IDDQ_BIT 25
114 #define PLLD_IDDQ_BIT 20
115 #define PLLSS_IDDQ_BIT 18
116 #define PLLM_IDDQ_BIT 5
117 #define PLLMB_IDDQ_BIT 17
118 #define PLLXP_IDDQ_BIT 3
120 #define PLLCX_RESET_BIT 30
122 #define PLL_BASE_LOCK BIT(27)
123 #define PLLCX_BASE_LOCK BIT(26)
124 #define PLLE_MISC_LOCK BIT(11)
125 #define PLLRE_MISC_LOCK BIT(27)
127 #define PLL_MISC_LOCK_ENABLE 18
128 #define PLLC_MISC_LOCK_ENABLE 24
129 #define PLLDU_MISC_LOCK_ENABLE 22
130 #define PLLU_MISC_LOCK_ENABLE 29
131 #define PLLE_MISC_LOCK_ENABLE 9
132 #define PLLRE_MISC_LOCK_ENABLE 30
133 #define PLLSS_MISC_LOCK_ENABLE 30
134 #define PLLP_MISC_LOCK_ENABLE 18
135 #define PLLM_MISC_LOCK_ENABLE 4
136 #define PLLMB_MISC_LOCK_ENABLE 16
137 #define PLLA_MISC_LOCK_ENABLE 28
138 #define PLLU_MISC_LOCK_ENABLE 29
139 #define PLLD_MISC_LOCK_ENABLE 18
141 #define PLLA_SDM_DIN_MASK 0xffff
142 #define PLLA_SDM_EN_MASK BIT(26)
144 #define PLLD_SDM_EN_MASK BIT(16)
146 #define PLLD2_SDM_EN_MASK BIT(31)
147 #define PLLD2_SSC_EN_MASK BIT(30)
149 #define PLLDP_SS_CFG 0x598
150 #define PLLDP_SDM_EN_MASK BIT(31)
151 #define PLLDP_SSC_EN_MASK BIT(30)
152 #define PLLDP_SS_CTRL1 0x59c
153 #define PLLDP_SS_CTRL2 0x5a0
155 #define PMC_PLLM_WB0_OVERRIDE 0x1dc
156 #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0
158 #define SATA_PLL_CFG0 0x490
159 #define SATA_PLL_CFG0_PADPLL_RESET_SWCTL BIT(0)
160 #define SATA_PLL_CFG0_PADPLL_USE_LOCKDET BIT(2)
161 #define SATA_PLL_CFG0_PADPLL_SLEEP_IDDQ BIT(13)
162 #define SATA_PLL_CFG0_SEQ_ENABLE BIT(24)
164 #define XUSBIO_PLL_CFG0 0x51c
165 #define XUSBIO_PLL_CFG0_PADPLL_RESET_SWCTL BIT(0)
166 #define XUSBIO_PLL_CFG0_CLK_ENABLE_SWCTL BIT(2)
167 #define XUSBIO_PLL_CFG0_PADPLL_USE_LOCKDET BIT(6)
168 #define XUSBIO_PLL_CFG0_PADPLL_SLEEP_IDDQ BIT(13)
169 #define XUSBIO_PLL_CFG0_SEQ_ENABLE BIT(24)
171 #define UTMIPLL_HW_PWRDN_CFG0 0x52c
172 #define UTMIPLL_HW_PWRDN_CFG0_UTMIPLL_LOCK BIT(31)
173 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25)
174 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24)
175 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE BIT(7)
176 #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6)
177 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5)
178 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4)
179 #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2)
180 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1)
181 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0)
183 #define PLLU_HW_PWRDN_CFG0 0x530
184 #define PLLU_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE BIT(28)
185 #define PLLU_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24)
186 #define PLLU_HW_PWRDN_CFG0_USE_SWITCH_DETECT BIT(7)
187 #define PLLU_HW_PWRDN_CFG0_USE_LOCKDET BIT(6)
188 #define PLLU_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2)
189 #define PLLU_HW_PWRDN_CFG0_CLK_SWITCH_SWCTL BIT(0)
191 #define XUSB_PLL_CFG0 0x534
192 #define XUSB_PLL_CFG0_UTMIPLL_LOCK_DLY 0x3ff
193 #define XUSB_PLL_CFG0_PLLU_LOCK_DLY_MASK (0x3ff << 14)
195 #define SPARE_REG0 0x55c
196 #define CLK_M_DIVISOR_SHIFT 2
197 #define CLK_M_DIVISOR_MASK 0x3
200 * SDM fractional divisor is 16-bit 2's complement signed number within
201 * (-2^12 ... 2^12-1) range. Represented in PLL data structure as unsigned
202 * 16-bit value, with "0" divisor mapped to 0xFFFF. Data "0" is used to
203 * indicate that SDM is disabled.
205 * Effective ndiv value when SDM is enabled: ndiv + 1/2 + sdm_din/2^13
207 #define PLL_SDM_COEFF BIT(13)
208 #define sdin_din_to_data(din) ((u16)((din) ? : 0xFFFFU))
209 #define sdin_data_to_din(dat) (((dat) == 0xFFFFU) ? 0 : (s16)dat)
211 /* Tegra CPU clock and reset control regs */
212 #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470
214 #ifdef CONFIG_PM_SLEEP
215 static struct cpu_clk_suspend_context
{
217 } tegra210_cpu_clk_sctx
;
220 static void __iomem
*clk_base
;
221 static void __iomem
*pmc_base
;
223 static unsigned long osc_freq
;
224 static unsigned long pll_ref_freq
;
226 static DEFINE_SPINLOCK(pll_d_lock
);
227 static DEFINE_SPINLOCK(pll_e_lock
);
228 static DEFINE_SPINLOCK(pll_re_lock
);
229 static DEFINE_SPINLOCK(pll_u_lock
);
230 static DEFINE_SPINLOCK(emc_lock
);
232 /* possible OSC frequencies in Hz */
233 static unsigned long tegra210_input_freq
[] = {
238 static const char *mux_pllmcp_clkm
[] = {
239 "pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_mb", "pll_mb",
242 #define mux_pllmcp_clkm_idx NULL
244 #define PLL_ENABLE (1 << 30)
246 #define PLLCX_MISC1_IDDQ (1 << 27)
247 #define PLLCX_MISC0_RESET (1 << 30)
249 #define PLLCX_MISC0_DEFAULT_VALUE 0x40080000
250 #define PLLCX_MISC0_WRITE_MASK 0x400ffffb
251 #define PLLCX_MISC1_DEFAULT_VALUE 0x08000000
252 #define PLLCX_MISC1_WRITE_MASK 0x08003cff
253 #define PLLCX_MISC2_DEFAULT_VALUE 0x1f720f05
254 #define PLLCX_MISC2_WRITE_MASK 0xffffff17
255 #define PLLCX_MISC3_DEFAULT_VALUE 0x000000c4
256 #define PLLCX_MISC3_WRITE_MASK 0x00ffffff
259 #define PLLA_BASE_IDDQ (1 << 25)
260 #define PLLA_BASE_LOCK (1 << 27)
262 #define PLLA_MISC0_LOCK_ENABLE (1 << 28)
263 #define PLLA_MISC0_LOCK_OVERRIDE (1 << 27)
265 #define PLLA_MISC2_EN_SDM (1 << 26)
266 #define PLLA_MISC2_EN_DYNRAMP (1 << 25)
268 #define PLLA_MISC0_DEFAULT_VALUE 0x12000020
269 #define PLLA_MISC0_WRITE_MASK 0x7fffffff
270 #define PLLA_MISC2_DEFAULT_VALUE 0x0
271 #define PLLA_MISC2_WRITE_MASK 0x06ffffff
274 #define PLLD_MISC0_EN_SDM (1 << 16)
275 #define PLLD_MISC0_LOCK_OVERRIDE (1 << 17)
276 #define PLLD_MISC0_LOCK_ENABLE (1 << 18)
277 #define PLLD_MISC0_IDDQ (1 << 20)
278 #define PLLD_MISC0_DSI_CLKENABLE (1 << 21)
280 #define PLLD_MISC0_DEFAULT_VALUE 0x00140000
281 #define PLLD_MISC0_WRITE_MASK 0x3ff7ffff
282 #define PLLD_MISC1_DEFAULT_VALUE 0x20
283 #define PLLD_MISC1_WRITE_MASK 0x00ffffff
285 /* PLLD2 and PLLDP and PLLC4 */
286 #define PLLDSS_BASE_LOCK (1 << 27)
287 #define PLLDSS_BASE_LOCK_OVERRIDE (1 << 24)
288 #define PLLDSS_BASE_IDDQ (1 << 18)
289 #define PLLDSS_BASE_REF_SEL_SHIFT 25
290 #define PLLDSS_BASE_REF_SEL_MASK (0x3 << PLLDSS_BASE_REF_SEL_SHIFT)
292 #define PLLDSS_MISC0_LOCK_ENABLE (1 << 30)
294 #define PLLDSS_MISC1_CFG_EN_SDM (1 << 31)
295 #define PLLDSS_MISC1_CFG_EN_SSC (1 << 30)
297 #define PLLD2_MISC0_DEFAULT_VALUE 0x40000020
298 #define PLLD2_MISC1_CFG_DEFAULT_VALUE 0x10000000
299 #define PLLD2_MISC2_CTRL1_DEFAULT_VALUE 0x0
300 #define PLLD2_MISC3_CTRL2_DEFAULT_VALUE 0x0
302 #define PLLDP_MISC0_DEFAULT_VALUE 0x40000020
303 #define PLLDP_MISC1_CFG_DEFAULT_VALUE 0xc0000000
304 #define PLLDP_MISC2_CTRL1_DEFAULT_VALUE 0xf400f0da
305 #define PLLDP_MISC3_CTRL2_DEFAULT_VALUE 0x2004f400
307 #define PLLDSS_MISC0_WRITE_MASK 0x47ffffff
308 #define PLLDSS_MISC1_CFG_WRITE_MASK 0xf8000000
309 #define PLLDSS_MISC2_CTRL1_WRITE_MASK 0xffffffff
310 #define PLLDSS_MISC3_CTRL2_WRITE_MASK 0xffffffff
312 #define PLLC4_MISC0_DEFAULT_VALUE 0x40000000
315 #define PLLRE_MISC0_LOCK_ENABLE (1 << 30)
316 #define PLLRE_MISC0_LOCK_OVERRIDE (1 << 29)
317 #define PLLRE_MISC0_LOCK (1 << 27)
318 #define PLLRE_MISC0_IDDQ (1 << 24)
320 #define PLLRE_BASE_DEFAULT_VALUE 0x0
321 #define PLLRE_MISC0_DEFAULT_VALUE 0x41000000
323 #define PLLRE_BASE_DEFAULT_MASK 0x1c000000
324 #define PLLRE_MISC0_WRITE_MASK 0x67ffffff
327 #define PLLX_USE_DYN_RAMP 1
328 #define PLLX_BASE_LOCK (1 << 27)
330 #define PLLX_MISC0_FO_G_DISABLE (0x1 << 28)
331 #define PLLX_MISC0_LOCK_ENABLE (0x1 << 18)
333 #define PLLX_MISC2_DYNRAMP_STEPB_SHIFT 24
334 #define PLLX_MISC2_DYNRAMP_STEPB_MASK (0xFF << PLLX_MISC2_DYNRAMP_STEPB_SHIFT)
335 #define PLLX_MISC2_DYNRAMP_STEPA_SHIFT 16
336 #define PLLX_MISC2_DYNRAMP_STEPA_MASK (0xFF << PLLX_MISC2_DYNRAMP_STEPA_SHIFT)
337 #define PLLX_MISC2_NDIV_NEW_SHIFT 8
338 #define PLLX_MISC2_NDIV_NEW_MASK (0xFF << PLLX_MISC2_NDIV_NEW_SHIFT)
339 #define PLLX_MISC2_LOCK_OVERRIDE (0x1 << 4)
340 #define PLLX_MISC2_DYNRAMP_DONE (0x1 << 2)
341 #define PLLX_MISC2_EN_DYNRAMP (0x1 << 0)
343 #define PLLX_MISC3_IDDQ (0x1 << 3)
345 #define PLLX_MISC0_DEFAULT_VALUE PLLX_MISC0_LOCK_ENABLE
346 #define PLLX_MISC0_WRITE_MASK 0x10c40000
347 #define PLLX_MISC1_DEFAULT_VALUE 0x20
348 #define PLLX_MISC1_WRITE_MASK 0x00ffffff
349 #define PLLX_MISC2_DEFAULT_VALUE 0x0
350 #define PLLX_MISC2_WRITE_MASK 0xffffff11
351 #define PLLX_MISC3_DEFAULT_VALUE PLLX_MISC3_IDDQ
352 #define PLLX_MISC3_WRITE_MASK 0x01ff0f0f
353 #define PLLX_MISC4_DEFAULT_VALUE 0x0
354 #define PLLX_MISC4_WRITE_MASK 0x8000ffff
355 #define PLLX_MISC5_DEFAULT_VALUE 0x0
356 #define PLLX_MISC5_WRITE_MASK 0x0000ffff
358 #define PLLX_HW_CTRL_CFG 0x548
359 #define PLLX_HW_CTRL_CFG_SWCTRL (0x1 << 0)
362 #define PLLMB_BASE_LOCK (1 << 27)
364 #define PLLMB_MISC1_LOCK_OVERRIDE (1 << 18)
365 #define PLLMB_MISC1_IDDQ (1 << 17)
366 #define PLLMB_MISC1_LOCK_ENABLE (1 << 16)
368 #define PLLMB_MISC1_DEFAULT_VALUE 0x00030000
369 #define PLLMB_MISC1_WRITE_MASK 0x0007ffff
372 #define PLLP_BASE_OVERRIDE (1 << 28)
373 #define PLLP_BASE_LOCK (1 << 27)
375 #define PLLP_MISC0_LOCK_ENABLE (1 << 18)
376 #define PLLP_MISC0_LOCK_OVERRIDE (1 << 17)
377 #define PLLP_MISC0_IDDQ (1 << 3)
379 #define PLLP_MISC1_HSIO_EN_SHIFT 29
380 #define PLLP_MISC1_HSIO_EN (1 << PLLP_MISC1_HSIO_EN_SHIFT)
381 #define PLLP_MISC1_XUSB_EN_SHIFT 28
382 #define PLLP_MISC1_XUSB_EN (1 << PLLP_MISC1_XUSB_EN_SHIFT)
384 #define PLLP_MISC0_DEFAULT_VALUE 0x00040008
385 #define PLLP_MISC1_DEFAULT_VALUE 0x0
387 #define PLLP_MISC0_WRITE_MASK 0xdc6000f
388 #define PLLP_MISC1_WRITE_MASK 0x70ffffff
391 #define PLLU_BASE_LOCK (1 << 27)
392 #define PLLU_BASE_OVERRIDE (1 << 24)
393 #define PLLU_BASE_CLKENABLE_USB (1 << 21)
394 #define PLLU_BASE_CLKENABLE_HSIC (1 << 22)
395 #define PLLU_BASE_CLKENABLE_ICUSB (1 << 23)
396 #define PLLU_BASE_CLKENABLE_48M (1 << 25)
397 #define PLLU_BASE_CLKENABLE_ALL (PLLU_BASE_CLKENABLE_USB |\
398 PLLU_BASE_CLKENABLE_HSIC |\
399 PLLU_BASE_CLKENABLE_ICUSB |\
400 PLLU_BASE_CLKENABLE_48M)
402 #define PLLU_MISC0_IDDQ (1 << 31)
403 #define PLLU_MISC0_LOCK_ENABLE (1 << 29)
404 #define PLLU_MISC1_LOCK_OVERRIDE (1 << 0)
406 #define PLLU_MISC0_DEFAULT_VALUE 0xa0000000
407 #define PLLU_MISC1_DEFAULT_VALUE 0x0
409 #define PLLU_MISC0_WRITE_MASK 0xbfffffff
410 #define PLLU_MISC1_WRITE_MASK 0x00000007
412 void tegra210_xusb_pll_hw_control_enable(void)
416 val
= readl_relaxed(clk_base
+ XUSBIO_PLL_CFG0
);
417 val
&= ~(XUSBIO_PLL_CFG0_CLK_ENABLE_SWCTL
|
418 XUSBIO_PLL_CFG0_PADPLL_RESET_SWCTL
);
419 val
|= XUSBIO_PLL_CFG0_PADPLL_USE_LOCKDET
|
420 XUSBIO_PLL_CFG0_PADPLL_SLEEP_IDDQ
;
421 writel_relaxed(val
, clk_base
+ XUSBIO_PLL_CFG0
);
423 EXPORT_SYMBOL_GPL(tegra210_xusb_pll_hw_control_enable
);
425 void tegra210_xusb_pll_hw_sequence_start(void)
429 val
= readl_relaxed(clk_base
+ XUSBIO_PLL_CFG0
);
430 val
|= XUSBIO_PLL_CFG0_SEQ_ENABLE
;
431 writel_relaxed(val
, clk_base
+ XUSBIO_PLL_CFG0
);
433 EXPORT_SYMBOL_GPL(tegra210_xusb_pll_hw_sequence_start
);
435 void tegra210_sata_pll_hw_control_enable(void)
439 val
= readl_relaxed(clk_base
+ SATA_PLL_CFG0
);
440 val
&= ~SATA_PLL_CFG0_PADPLL_RESET_SWCTL
;
441 val
|= SATA_PLL_CFG0_PADPLL_USE_LOCKDET
|
442 SATA_PLL_CFG0_PADPLL_SLEEP_IDDQ
;
443 writel_relaxed(val
, clk_base
+ SATA_PLL_CFG0
);
445 EXPORT_SYMBOL_GPL(tegra210_sata_pll_hw_control_enable
);
447 void tegra210_sata_pll_hw_sequence_start(void)
451 val
= readl_relaxed(clk_base
+ SATA_PLL_CFG0
);
452 val
|= SATA_PLL_CFG0_SEQ_ENABLE
;
453 writel_relaxed(val
, clk_base
+ SATA_PLL_CFG0
);
455 EXPORT_SYMBOL_GPL(tegra210_sata_pll_hw_sequence_start
);
457 static inline void _pll_misc_chk_default(void __iomem
*base
,
458 struct tegra_clk_pll_params
*params
,
459 u8 misc_num
, u32 default_val
, u32 mask
)
461 u32 boot_val
= readl_relaxed(base
+ params
->ext_misc_reg
[misc_num
]);
465 if (boot_val
!= default_val
) {
466 pr_warn("boot misc%d 0x%x: expected 0x%x\n",
467 misc_num
, boot_val
, default_val
);
468 pr_warn(" (comparison mask = 0x%x)\n", mask
);
469 params
->defaults_set
= false;
474 * PLLCX: PLLC, PLLC2, PLLC3, PLLA1
475 * Hybrid PLLs with dynamic ramp. Dynamic ramp is allowed for any transition
476 * that changes NDIV only, while PLL is already locked.
478 static void pllcx_check_defaults(struct tegra_clk_pll_params
*params
)
482 default_val
= PLLCX_MISC0_DEFAULT_VALUE
& (~PLLCX_MISC0_RESET
);
483 _pll_misc_chk_default(clk_base
, params
, 0, default_val
,
484 PLLCX_MISC0_WRITE_MASK
);
486 default_val
= PLLCX_MISC1_DEFAULT_VALUE
& (~PLLCX_MISC1_IDDQ
);
487 _pll_misc_chk_default(clk_base
, params
, 1, default_val
,
488 PLLCX_MISC1_WRITE_MASK
);
490 default_val
= PLLCX_MISC2_DEFAULT_VALUE
;
491 _pll_misc_chk_default(clk_base
, params
, 2, default_val
,
492 PLLCX_MISC2_WRITE_MASK
);
494 default_val
= PLLCX_MISC3_DEFAULT_VALUE
;
495 _pll_misc_chk_default(clk_base
, params
, 3, default_val
,
496 PLLCX_MISC3_WRITE_MASK
);
499 static void tegra210_pllcx_set_defaults(const char *name
,
500 struct tegra_clk_pll
*pllcx
)
502 pllcx
->params
->defaults_set
= true;
504 if (readl_relaxed(clk_base
+ pllcx
->params
->base_reg
) &
506 /* PLL is ON: only check if defaults already set */
507 pllcx_check_defaults(pllcx
->params
);
508 pr_warn("%s already enabled. Postponing set full defaults\n",
513 /* Defaults assert PLL reset, and set IDDQ */
514 writel_relaxed(PLLCX_MISC0_DEFAULT_VALUE
,
515 clk_base
+ pllcx
->params
->ext_misc_reg
[0]);
516 writel_relaxed(PLLCX_MISC1_DEFAULT_VALUE
,
517 clk_base
+ pllcx
->params
->ext_misc_reg
[1]);
518 writel_relaxed(PLLCX_MISC2_DEFAULT_VALUE
,
519 clk_base
+ pllcx
->params
->ext_misc_reg
[2]);
520 writel_relaxed(PLLCX_MISC3_DEFAULT_VALUE
,
521 clk_base
+ pllcx
->params
->ext_misc_reg
[3]);
525 static void _pllc_set_defaults(struct tegra_clk_pll
*pllcx
)
527 tegra210_pllcx_set_defaults("PLL_C", pllcx
);
530 static void _pllc2_set_defaults(struct tegra_clk_pll
*pllcx
)
532 tegra210_pllcx_set_defaults("PLL_C2", pllcx
);
535 static void _pllc3_set_defaults(struct tegra_clk_pll
*pllcx
)
537 tegra210_pllcx_set_defaults("PLL_C3", pllcx
);
540 static void _plla1_set_defaults(struct tegra_clk_pll
*pllcx
)
542 tegra210_pllcx_set_defaults("PLL_A1", pllcx
);
547 * PLL with dynamic ramp and fractional SDM. Dynamic ramp is not used.
548 * Fractional SDM is allowed to provide exact audio rates.
550 static void tegra210_plla_set_defaults(struct tegra_clk_pll
*plla
)
553 u32 val
= readl_relaxed(clk_base
+ plla
->params
->base_reg
);
555 plla
->params
->defaults_set
= true;
557 if (val
& PLL_ENABLE
) {
559 * PLL is ON: check if defaults already set, then set those
560 * that can be updated in flight.
562 if (val
& PLLA_BASE_IDDQ
) {
563 pr_warn("PLL_A boot enabled with IDDQ set\n");
564 plla
->params
->defaults_set
= false;
567 pr_warn("PLL_A already enabled. Postponing set full defaults\n");
569 val
= PLLA_MISC0_DEFAULT_VALUE
; /* ignore lock enable */
570 mask
= PLLA_MISC0_LOCK_ENABLE
| PLLA_MISC0_LOCK_OVERRIDE
;
571 _pll_misc_chk_default(clk_base
, plla
->params
, 0, val
,
572 ~mask
& PLLA_MISC0_WRITE_MASK
);
574 val
= PLLA_MISC2_DEFAULT_VALUE
; /* ignore all but control bit */
575 _pll_misc_chk_default(clk_base
, plla
->params
, 2, val
,
576 PLLA_MISC2_EN_DYNRAMP
);
578 /* Enable lock detect */
579 val
= readl_relaxed(clk_base
+ plla
->params
->ext_misc_reg
[0]);
581 val
|= PLLA_MISC0_DEFAULT_VALUE
& mask
;
582 writel_relaxed(val
, clk_base
+ plla
->params
->ext_misc_reg
[0]);
588 /* set IDDQ, enable lock detect, disable dynamic ramp and SDM */
589 val
|= PLLA_BASE_IDDQ
;
590 writel_relaxed(val
, clk_base
+ plla
->params
->base_reg
);
591 writel_relaxed(PLLA_MISC0_DEFAULT_VALUE
,
592 clk_base
+ plla
->params
->ext_misc_reg
[0]);
593 writel_relaxed(PLLA_MISC2_DEFAULT_VALUE
,
594 clk_base
+ plla
->params
->ext_misc_reg
[2]);
600 * PLL with fractional SDM.
602 static void tegra210_plld_set_defaults(struct tegra_clk_pll
*plld
)
607 plld
->params
->defaults_set
= true;
609 if (readl_relaxed(clk_base
+ plld
->params
->base_reg
) &
611 pr_warn("PLL_D already enabled. Postponing set full defaults\n");
614 * PLL is ON: check if defaults already set, then set those
615 * that can be updated in flight.
617 val
= PLLD_MISC1_DEFAULT_VALUE
;
618 _pll_misc_chk_default(clk_base
, plld
->params
, 1,
619 val
, PLLD_MISC1_WRITE_MASK
);
621 /* ignore lock, DSI and SDM controls, make sure IDDQ not set */
622 val
= PLLD_MISC0_DEFAULT_VALUE
& (~PLLD_MISC0_IDDQ
);
623 mask
|= PLLD_MISC0_DSI_CLKENABLE
| PLLD_MISC0_LOCK_ENABLE
|
624 PLLD_MISC0_LOCK_OVERRIDE
| PLLD_MISC0_EN_SDM
;
625 _pll_misc_chk_default(clk_base
, plld
->params
, 0, val
,
626 ~mask
& PLLD_MISC0_WRITE_MASK
);
628 /* Enable lock detect */
629 mask
= PLLD_MISC0_LOCK_ENABLE
| PLLD_MISC0_LOCK_OVERRIDE
;
630 val
= readl_relaxed(clk_base
+ plld
->params
->ext_misc_reg
[0]);
632 val
|= PLLD_MISC0_DEFAULT_VALUE
& mask
;
633 writel_relaxed(val
, clk_base
+ plld
->params
->ext_misc_reg
[0]);
639 val
= readl_relaxed(clk_base
+ plld
->params
->ext_misc_reg
[0]);
640 val
&= PLLD_MISC0_DSI_CLKENABLE
;
641 val
|= PLLD_MISC0_DEFAULT_VALUE
;
642 /* set IDDQ, enable lock detect, disable SDM */
643 writel_relaxed(val
, clk_base
+ plld
->params
->ext_misc_reg
[0]);
644 writel_relaxed(PLLD_MISC1_DEFAULT_VALUE
, clk_base
+
645 plld
->params
->ext_misc_reg
[1]);
651 * PLL with fractional SDM and Spread Spectrum (SDM is a must if SSC is used).
653 static void plldss_defaults(const char *pll_name
, struct tegra_clk_pll
*plldss
,
654 u32 misc0_val
, u32 misc1_val
, u32 misc2_val
, u32 misc3_val
)
657 u32 val
= readl_relaxed(clk_base
+ plldss
->params
->base_reg
);
659 plldss
->params
->defaults_set
= true;
661 if (val
& PLL_ENABLE
) {
662 pr_warn("%s already enabled. Postponing set full defaults\n",
666 * PLL is ON: check if defaults already set, then set those
667 * that can be updated in flight.
669 if (val
& PLLDSS_BASE_IDDQ
) {
670 pr_warn("plldss boot enabled with IDDQ set\n");
671 plldss
->params
->defaults_set
= false;
674 /* ignore lock enable */
675 default_val
= misc0_val
;
676 _pll_misc_chk_default(clk_base
, plldss
->params
, 0, default_val
,
677 PLLDSS_MISC0_WRITE_MASK
&
678 (~PLLDSS_MISC0_LOCK_ENABLE
));
681 * If SSC is used, check all settings, otherwise just confirm
682 * that SSC is not used on boot as well. Do nothing when using
683 * this function for PLLC4 that has only MISC0.
685 if (plldss
->params
->ssc_ctrl_en_mask
) {
686 default_val
= misc1_val
;
687 _pll_misc_chk_default(clk_base
, plldss
->params
, 1,
688 default_val
, PLLDSS_MISC1_CFG_WRITE_MASK
);
689 default_val
= misc2_val
;
690 _pll_misc_chk_default(clk_base
, plldss
->params
, 2,
691 default_val
, PLLDSS_MISC2_CTRL1_WRITE_MASK
);
692 default_val
= misc3_val
;
693 _pll_misc_chk_default(clk_base
, plldss
->params
, 3,
694 default_val
, PLLDSS_MISC3_CTRL2_WRITE_MASK
);
695 } else if (plldss
->params
->ext_misc_reg
[1]) {
696 default_val
= misc1_val
;
697 _pll_misc_chk_default(clk_base
, plldss
->params
, 1,
698 default_val
, PLLDSS_MISC1_CFG_WRITE_MASK
&
699 (~PLLDSS_MISC1_CFG_EN_SDM
));
702 /* Enable lock detect */
703 if (val
& PLLDSS_BASE_LOCK_OVERRIDE
) {
704 val
&= ~PLLDSS_BASE_LOCK_OVERRIDE
;
705 writel_relaxed(val
, clk_base
+
706 plldss
->params
->base_reg
);
709 val
= readl_relaxed(clk_base
+ plldss
->params
->ext_misc_reg
[0]);
710 val
&= ~PLLDSS_MISC0_LOCK_ENABLE
;
711 val
|= misc0_val
& PLLDSS_MISC0_LOCK_ENABLE
;
712 writel_relaxed(val
, clk_base
+ plldss
->params
->ext_misc_reg
[0]);
718 /* set IDDQ, enable lock detect, configure SDM/SSC */
719 val
|= PLLDSS_BASE_IDDQ
;
720 val
&= ~PLLDSS_BASE_LOCK_OVERRIDE
;
721 writel_relaxed(val
, clk_base
+ plldss
->params
->base_reg
);
723 /* When using this function for PLLC4 exit here */
724 if (!plldss
->params
->ext_misc_reg
[1]) {
725 writel_relaxed(misc0_val
, clk_base
+
726 plldss
->params
->ext_misc_reg
[0]);
731 writel_relaxed(misc0_val
, clk_base
+
732 plldss
->params
->ext_misc_reg
[0]);
733 /* if SSC used set by 1st enable */
734 writel_relaxed(misc1_val
& (~PLLDSS_MISC1_CFG_EN_SSC
),
735 clk_base
+ plldss
->params
->ext_misc_reg
[1]);
736 writel_relaxed(misc2_val
, clk_base
+ plldss
->params
->ext_misc_reg
[2]);
737 writel_relaxed(misc3_val
, clk_base
+ plldss
->params
->ext_misc_reg
[3]);
741 static void tegra210_plld2_set_defaults(struct tegra_clk_pll
*plld2
)
743 plldss_defaults("PLL_D2", plld2
, PLLD2_MISC0_DEFAULT_VALUE
,
744 PLLD2_MISC1_CFG_DEFAULT_VALUE
,
745 PLLD2_MISC2_CTRL1_DEFAULT_VALUE
,
746 PLLD2_MISC3_CTRL2_DEFAULT_VALUE
);
749 static void tegra210_plldp_set_defaults(struct tegra_clk_pll
*plldp
)
751 plldss_defaults("PLL_DP", plldp
, PLLDP_MISC0_DEFAULT_VALUE
,
752 PLLDP_MISC1_CFG_DEFAULT_VALUE
,
753 PLLDP_MISC2_CTRL1_DEFAULT_VALUE
,
754 PLLDP_MISC3_CTRL2_DEFAULT_VALUE
);
759 * Base and misc0 layout is the same as PLLD2/PLLDP, but no SDM/SSC support.
760 * VCO is exposed to the clock tree via fixed 1/3 and 1/5 dividers.
762 static void tegra210_pllc4_set_defaults(struct tegra_clk_pll
*pllc4
)
764 plldss_defaults("PLL_C4", pllc4
, PLLC4_MISC0_DEFAULT_VALUE
, 0, 0, 0);
769 * VCO is exposed to the clock tree directly along with post-divider output
771 static void tegra210_pllre_set_defaults(struct tegra_clk_pll
*pllre
)
774 u32 val
= readl_relaxed(clk_base
+ pllre
->params
->base_reg
);
776 pllre
->params
->defaults_set
= true;
778 if (val
& PLL_ENABLE
) {
779 pr_warn("PLL_RE already enabled. Postponing set full defaults\n");
782 * PLL is ON: check if defaults already set, then set those
783 * that can be updated in flight.
785 val
&= PLLRE_BASE_DEFAULT_MASK
;
786 if (val
!= PLLRE_BASE_DEFAULT_VALUE
) {
787 pr_warn("pllre boot base 0x%x : expected 0x%x\n",
788 val
, PLLRE_BASE_DEFAULT_VALUE
);
789 pr_warn("(comparison mask = 0x%x)\n",
790 PLLRE_BASE_DEFAULT_MASK
);
791 pllre
->params
->defaults_set
= false;
794 /* Ignore lock enable */
795 val
= PLLRE_MISC0_DEFAULT_VALUE
& (~PLLRE_MISC0_IDDQ
);
796 mask
= PLLRE_MISC0_LOCK_ENABLE
| PLLRE_MISC0_LOCK_OVERRIDE
;
797 _pll_misc_chk_default(clk_base
, pllre
->params
, 0, val
,
798 ~mask
& PLLRE_MISC0_WRITE_MASK
);
800 /* Enable lock detect */
801 val
= readl_relaxed(clk_base
+ pllre
->params
->ext_misc_reg
[0]);
803 val
|= PLLRE_MISC0_DEFAULT_VALUE
& mask
;
804 writel_relaxed(val
, clk_base
+ pllre
->params
->ext_misc_reg
[0]);
810 /* set IDDQ, enable lock detect */
811 val
&= ~PLLRE_BASE_DEFAULT_MASK
;
812 val
|= PLLRE_BASE_DEFAULT_VALUE
& PLLRE_BASE_DEFAULT_MASK
;
813 writel_relaxed(val
, clk_base
+ pllre
->params
->base_reg
);
814 writel_relaxed(PLLRE_MISC0_DEFAULT_VALUE
,
815 clk_base
+ pllre
->params
->ext_misc_reg
[0]);
819 static void pllx_get_dyn_steps(struct clk_hw
*hw
, u32
*step_a
, u32
*step_b
)
821 unsigned long input_rate
;
824 if (!IS_ERR_OR_NULL(hw
->clk
))
825 input_rate
= clk_hw_get_rate(clk_hw_get_parent(hw
));
827 input_rate
= 38400000;
829 input_rate
/= tegra_pll_get_fixed_mdiv(hw
, input_rate
);
831 switch (input_rate
) {
847 pr_err("%s: Unexpected reference rate %lu\n",
848 __func__
, input_rate
);
853 static void pllx_check_defaults(struct tegra_clk_pll
*pll
)
857 default_val
= PLLX_MISC0_DEFAULT_VALUE
;
858 /* ignore lock enable */
859 _pll_misc_chk_default(clk_base
, pll
->params
, 0, default_val
,
860 PLLX_MISC0_WRITE_MASK
& (~PLLX_MISC0_LOCK_ENABLE
));
862 default_val
= PLLX_MISC1_DEFAULT_VALUE
;
863 _pll_misc_chk_default(clk_base
, pll
->params
, 1, default_val
,
864 PLLX_MISC1_WRITE_MASK
);
866 /* ignore all but control bit */
867 default_val
= PLLX_MISC2_DEFAULT_VALUE
;
868 _pll_misc_chk_default(clk_base
, pll
->params
, 2,
869 default_val
, PLLX_MISC2_EN_DYNRAMP
);
871 default_val
= PLLX_MISC3_DEFAULT_VALUE
& (~PLLX_MISC3_IDDQ
);
872 _pll_misc_chk_default(clk_base
, pll
->params
, 3, default_val
,
873 PLLX_MISC3_WRITE_MASK
);
875 default_val
= PLLX_MISC4_DEFAULT_VALUE
;
876 _pll_misc_chk_default(clk_base
, pll
->params
, 4, default_val
,
877 PLLX_MISC4_WRITE_MASK
);
879 default_val
= PLLX_MISC5_DEFAULT_VALUE
;
880 _pll_misc_chk_default(clk_base
, pll
->params
, 5, default_val
,
881 PLLX_MISC5_WRITE_MASK
);
884 static void tegra210_pllx_set_defaults(struct tegra_clk_pll
*pllx
)
889 pllx
->params
->defaults_set
= true;
891 /* Get ready dyn ramp state machine settings */
892 pllx_get_dyn_steps(&pllx
->hw
, &step_a
, &step_b
);
893 val
= PLLX_MISC2_DEFAULT_VALUE
& (~PLLX_MISC2_DYNRAMP_STEPA_MASK
) &
894 (~PLLX_MISC2_DYNRAMP_STEPB_MASK
);
895 val
|= step_a
<< PLLX_MISC2_DYNRAMP_STEPA_SHIFT
;
896 val
|= step_b
<< PLLX_MISC2_DYNRAMP_STEPB_SHIFT
;
898 if (readl_relaxed(clk_base
+ pllx
->params
->base_reg
) & PLL_ENABLE
) {
899 pr_warn("PLL_X already enabled. Postponing set full defaults\n");
902 * PLL is ON: check if defaults already set, then set those
903 * that can be updated in flight.
905 pllx_check_defaults(pllx
);
907 /* Configure dyn ramp, disable lock override */
908 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
910 /* Enable lock detect */
911 val
= readl_relaxed(clk_base
+ pllx
->params
->ext_misc_reg
[0]);
912 val
&= ~PLLX_MISC0_LOCK_ENABLE
;
913 val
|= PLLX_MISC0_DEFAULT_VALUE
& PLLX_MISC0_LOCK_ENABLE
;
914 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[0]);
920 /* Enable lock detect and CPU output */
921 writel_relaxed(PLLX_MISC0_DEFAULT_VALUE
, clk_base
+
922 pllx
->params
->ext_misc_reg
[0]);
925 writel_relaxed(PLLX_MISC1_DEFAULT_VALUE
, clk_base
+
926 pllx
->params
->ext_misc_reg
[1]);
928 /* Configure dyn ramp state machine, disable lock override */
929 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
932 writel_relaxed(PLLX_MISC3_DEFAULT_VALUE
, clk_base
+
933 pllx
->params
->ext_misc_reg
[3]);
936 writel_relaxed(PLLX_MISC4_DEFAULT_VALUE
, clk_base
+
937 pllx
->params
->ext_misc_reg
[4]);
938 writel_relaxed(PLLX_MISC5_DEFAULT_VALUE
, clk_base
+
939 pllx
->params
->ext_misc_reg
[5]);
944 static void tegra210_pllmb_set_defaults(struct tegra_clk_pll
*pllmb
)
946 u32 mask
, val
= readl_relaxed(clk_base
+ pllmb
->params
->base_reg
);
948 pllmb
->params
->defaults_set
= true;
950 if (val
& PLL_ENABLE
) {
951 pr_warn("PLL_MB already enabled. Postponing set full defaults\n");
954 * PLL is ON: check if defaults already set, then set those
955 * that can be updated in flight.
957 val
= PLLMB_MISC1_DEFAULT_VALUE
& (~PLLMB_MISC1_IDDQ
);
958 mask
= PLLMB_MISC1_LOCK_ENABLE
| PLLMB_MISC1_LOCK_OVERRIDE
;
959 _pll_misc_chk_default(clk_base
, pllmb
->params
, 0, val
,
960 ~mask
& PLLMB_MISC1_WRITE_MASK
);
962 /* Enable lock detect */
963 val
= readl_relaxed(clk_base
+ pllmb
->params
->ext_misc_reg
[0]);
965 val
|= PLLMB_MISC1_DEFAULT_VALUE
& mask
;
966 writel_relaxed(val
, clk_base
+ pllmb
->params
->ext_misc_reg
[0]);
972 /* set IDDQ, enable lock detect */
973 writel_relaxed(PLLMB_MISC1_DEFAULT_VALUE
,
974 clk_base
+ pllmb
->params
->ext_misc_reg
[0]);
980 * VCO is exposed to the clock tree directly along with post-divider output.
981 * Both VCO and post-divider output rates are fixed at 408MHz and 204MHz,
984 static void pllp_check_defaults(struct tegra_clk_pll
*pll
, bool enabled
)
988 /* Ignore lock enable (will be set), make sure not in IDDQ if enabled */
989 val
= PLLP_MISC0_DEFAULT_VALUE
& (~PLLP_MISC0_IDDQ
);
990 mask
= PLLP_MISC0_LOCK_ENABLE
| PLLP_MISC0_LOCK_OVERRIDE
;
992 mask
|= PLLP_MISC0_IDDQ
;
993 _pll_misc_chk_default(clk_base
, pll
->params
, 0, val
,
994 ~mask
& PLLP_MISC0_WRITE_MASK
);
996 /* Ignore branch controls */
997 val
= PLLP_MISC1_DEFAULT_VALUE
;
998 mask
= PLLP_MISC1_HSIO_EN
| PLLP_MISC1_XUSB_EN
;
999 _pll_misc_chk_default(clk_base
, pll
->params
, 1, val
,
1000 ~mask
& PLLP_MISC1_WRITE_MASK
);
1003 static void tegra210_pllp_set_defaults(struct tegra_clk_pll
*pllp
)
1006 u32 val
= readl_relaxed(clk_base
+ pllp
->params
->base_reg
);
1008 pllp
->params
->defaults_set
= true;
1010 if (val
& PLL_ENABLE
) {
1011 pr_warn("PLL_P already enabled. Postponing set full defaults\n");
1014 * PLL is ON: check if defaults already set, then set those
1015 * that can be updated in flight.
1017 pllp_check_defaults(pllp
, true);
1019 /* Enable lock detect */
1020 val
= readl_relaxed(clk_base
+ pllp
->params
->ext_misc_reg
[0]);
1021 mask
= PLLP_MISC0_LOCK_ENABLE
| PLLP_MISC0_LOCK_OVERRIDE
;
1023 val
|= PLLP_MISC0_DEFAULT_VALUE
& mask
;
1024 writel_relaxed(val
, clk_base
+ pllp
->params
->ext_misc_reg
[0]);
1030 /* set IDDQ, enable lock detect */
1031 writel_relaxed(PLLP_MISC0_DEFAULT_VALUE
,
1032 clk_base
+ pllp
->params
->ext_misc_reg
[0]);
1034 /* Preserve branch control */
1035 val
= readl_relaxed(clk_base
+ pllp
->params
->ext_misc_reg
[1]);
1036 mask
= PLLP_MISC1_HSIO_EN
| PLLP_MISC1_XUSB_EN
;
1038 val
|= ~mask
& PLLP_MISC1_DEFAULT_VALUE
;
1039 writel_relaxed(val
, clk_base
+ pllp
->params
->ext_misc_reg
[1]);
1045 * VCO is exposed to the clock tree directly along with post-divider output.
1046 * Both VCO and post-divider output rates are fixed at 480MHz and 240MHz,
1049 static void pllu_check_defaults(struct tegra_clk_pll
*pll
, bool hw_control
)
1053 /* Ignore lock enable (will be set) and IDDQ if under h/w control */
1054 val
= PLLU_MISC0_DEFAULT_VALUE
& (~PLLU_MISC0_IDDQ
);
1055 mask
= PLLU_MISC0_LOCK_ENABLE
| (hw_control
? PLLU_MISC0_IDDQ
: 0);
1056 _pll_misc_chk_default(clk_base
, pll
->params
, 0, val
,
1057 ~mask
& PLLU_MISC0_WRITE_MASK
);
1059 val
= PLLU_MISC1_DEFAULT_VALUE
;
1060 mask
= PLLU_MISC1_LOCK_OVERRIDE
;
1061 _pll_misc_chk_default(clk_base
, pll
->params
, 1, val
,
1062 ~mask
& PLLU_MISC1_WRITE_MASK
);
1065 static void tegra210_pllu_set_defaults(struct tegra_clk_pll
*pllu
)
1067 u32 val
= readl_relaxed(clk_base
+ pllu
->params
->base_reg
);
1069 pllu
->params
->defaults_set
= true;
1071 if (val
& PLL_ENABLE
) {
1072 pr_warn("PLL_U already enabled. Postponing set full defaults\n");
1075 * PLL is ON: check if defaults already set, then set those
1076 * that can be updated in flight.
1078 pllu_check_defaults(pllu
, false);
1080 /* Enable lock detect */
1081 val
= readl_relaxed(clk_base
+ pllu
->params
->ext_misc_reg
[0]);
1082 val
&= ~PLLU_MISC0_LOCK_ENABLE
;
1083 val
|= PLLU_MISC0_DEFAULT_VALUE
& PLLU_MISC0_LOCK_ENABLE
;
1084 writel_relaxed(val
, clk_base
+ pllu
->params
->ext_misc_reg
[0]);
1086 val
= readl_relaxed(clk_base
+ pllu
->params
->ext_misc_reg
[1]);
1087 val
&= ~PLLU_MISC1_LOCK_OVERRIDE
;
1088 val
|= PLLU_MISC1_DEFAULT_VALUE
& PLLU_MISC1_LOCK_OVERRIDE
;
1089 writel_relaxed(val
, clk_base
+ pllu
->params
->ext_misc_reg
[1]);
1095 /* set IDDQ, enable lock detect */
1096 writel_relaxed(PLLU_MISC0_DEFAULT_VALUE
,
1097 clk_base
+ pllu
->params
->ext_misc_reg
[0]);
1098 writel_relaxed(PLLU_MISC1_DEFAULT_VALUE
,
1099 clk_base
+ pllu
->params
->ext_misc_reg
[1]);
1103 #define mask(w) ((1 << (w)) - 1)
1104 #define divm_mask(p) mask(p->params->div_nmp->divm_width)
1105 #define divn_mask(p) mask(p->params->div_nmp->divn_width)
1106 #define divp_mask(p) (p->params->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK :\
1107 mask(p->params->div_nmp->divp_width))
1109 #define divm_shift(p) ((p)->params->div_nmp->divm_shift)
1110 #define divn_shift(p) ((p)->params->div_nmp->divn_shift)
1111 #define divp_shift(p) ((p)->params->div_nmp->divp_shift)
1113 #define divm_mask_shifted(p) (divm_mask(p) << divm_shift(p))
1114 #define divn_mask_shifted(p) (divn_mask(p) << divn_shift(p))
1115 #define divp_mask_shifted(p) (divp_mask(p) << divp_shift(p))
1117 #define PLL_LOCKDET_DELAY 2 /* Lock detection safety delays */
1118 static int tegra210_wait_for_mask(struct tegra_clk_pll
*pll
,
1124 for (i
= 0; i
< pll
->params
->lock_delay
/ PLL_LOCKDET_DELAY
+ 1; i
++) {
1125 udelay(PLL_LOCKDET_DELAY
);
1126 val
= readl_relaxed(clk_base
+ reg
);
1127 if ((val
& mask
) == mask
) {
1128 udelay(PLL_LOCKDET_DELAY
);
1135 static int tegra210_pllx_dyn_ramp(struct tegra_clk_pll
*pllx
,
1136 struct tegra_clk_pll_freq_table
*cfg
)
1138 u32 val
, base
, ndiv_new_mask
;
1140 ndiv_new_mask
= (divn_mask(pllx
) >> pllx
->params
->div_nmp
->divn_shift
)
1141 << PLLX_MISC2_NDIV_NEW_SHIFT
;
1143 val
= readl_relaxed(clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1144 val
&= (~ndiv_new_mask
);
1145 val
|= cfg
->n
<< PLLX_MISC2_NDIV_NEW_SHIFT
;
1146 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1149 val
= readl_relaxed(clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1150 val
|= PLLX_MISC2_EN_DYNRAMP
;
1151 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1154 tegra210_wait_for_mask(pllx
, pllx
->params
->ext_misc_reg
[2],
1155 PLLX_MISC2_DYNRAMP_DONE
);
1157 base
= readl_relaxed(clk_base
+ pllx
->params
->base_reg
) &
1158 (~divn_mask_shifted(pllx
));
1159 base
|= cfg
->n
<< pllx
->params
->div_nmp
->divn_shift
;
1160 writel_relaxed(base
, clk_base
+ pllx
->params
->base_reg
);
1163 val
&= ~PLLX_MISC2_EN_DYNRAMP
;
1164 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1167 pr_debug("%s: dynamic ramp to m = %u n = %u p = %u, Fout = %lu kHz\n",
1168 __clk_get_name(pllx
->hw
.clk
), cfg
->m
, cfg
->n
, cfg
->p
,
1169 cfg
->input_rate
/ cfg
->m
* cfg
->n
/
1170 pllx
->params
->pdiv_tohw
[cfg
->p
].pdiv
/ 1000);
1176 * Common configuration for PLLs with fixed input divider policy:
1177 * - always set fixed M-value based on the reference rate
1178 * - always set P-value value 1:1 for output rates above VCO minimum, and
1179 * choose minimum necessary P-value for output rates below VCO maximum
1180 * - calculate N-value based on selected M and P
1181 * - calculate SDM_DIN fractional part
1183 static int tegra210_pll_fixed_mdiv_cfg(struct clk_hw
*hw
,
1184 struct tegra_clk_pll_freq_table
*cfg
,
1185 unsigned long rate
, unsigned long input_rate
)
1187 struct tegra_clk_pll
*pll
= to_clk_pll(hw
);
1188 struct tegra_clk_pll_params
*params
= pll
->params
;
1190 unsigned long cf
, p_rate
;
1196 if (!(params
->flags
& TEGRA_PLL_VCO_OUT
)) {
1197 p
= DIV_ROUND_UP(params
->vco_min
, rate
);
1198 p
= params
->round_p_to_pdiv(p
, &pdiv
);
1200 p
= rate
>= params
->vco_min
? 1 : -EINVAL
;
1206 cfg
->m
= tegra_pll_get_fixed_mdiv(hw
, input_rate
);
1209 /* Store P as HW value, as that is what is expected */
1210 cfg
->p
= tegra_pll_p_div_to_hw(pll
, cfg
->p
);
1213 if (p_rate
> params
->vco_max
)
1214 p_rate
= params
->vco_max
;
1215 cf
= input_rate
/ cfg
->m
;
1216 cfg
->n
= p_rate
/ cf
;
1219 if (params
->sdm_ctrl_reg
) {
1220 unsigned long rem
= p_rate
- cf
* cfg
->n
;
1221 /* If ssc is enabled SDM enabled as well, even for integer n */
1222 if (rem
|| params
->ssc_ctrl_reg
) {
1223 u64 s
= rem
* PLL_SDM_COEFF
;
1226 s
-= PLL_SDM_COEFF
/ 2;
1227 cfg
->sdm_data
= sdin_din_to_data(s
);
1231 cfg
->input_rate
= input_rate
;
1232 cfg
->output_rate
= rate
;
1238 * clk_pll_set_gain - set gain to m, n to calculate correct VCO rate
1240 * @cfg: struct tegra_clk_pll_freq_table * cfg
1243 * Fvco = Fref * NDIV / MDIV
1245 * For fractional mode:
1246 * Fvco = Fref * (NDIV + 0.5 + SDM_DIN / PLL_SDM_COEFF) / MDIV
1248 static void tegra210_clk_pll_set_gain(struct tegra_clk_pll_freq_table
*cfg
)
1250 cfg
->n
= cfg
->n
* PLL_SDM_COEFF
+ PLL_SDM_COEFF
/2 +
1251 sdin_data_to_din(cfg
->sdm_data
);
1252 cfg
->m
*= PLL_SDM_COEFF
;
1255 static unsigned long
1256 tegra210_clk_adjust_vco_min(struct tegra_clk_pll_params
*params
,
1257 unsigned long parent_rate
)
1259 unsigned long vco_min
= params
->vco_min
;
1261 params
->vco_min
+= DIV_ROUND_UP(parent_rate
, PLL_SDM_COEFF
);
1262 vco_min
= min(vco_min
, params
->vco_min
);
1267 static struct div_nmp pllx_nmp
= {
1276 * PLL post divider maps - two types: quasi-linear and exponential
1279 #define PLL_QLIN_PDIV_MAX 16
1280 static const struct pdiv_map pll_qlin_pdiv_to_hw
[] = {
1281 { .pdiv
= 1, .hw_val
= 0 },
1282 { .pdiv
= 2, .hw_val
= 1 },
1283 { .pdiv
= 3, .hw_val
= 2 },
1284 { .pdiv
= 4, .hw_val
= 3 },
1285 { .pdiv
= 5, .hw_val
= 4 },
1286 { .pdiv
= 6, .hw_val
= 5 },
1287 { .pdiv
= 8, .hw_val
= 6 },
1288 { .pdiv
= 9, .hw_val
= 7 },
1289 { .pdiv
= 10, .hw_val
= 8 },
1290 { .pdiv
= 12, .hw_val
= 9 },
1291 { .pdiv
= 15, .hw_val
= 10 },
1292 { .pdiv
= 16, .hw_val
= 11 },
1293 { .pdiv
= 18, .hw_val
= 12 },
1294 { .pdiv
= 20, .hw_val
= 13 },
1295 { .pdiv
= 24, .hw_val
= 14 },
1296 { .pdiv
= 30, .hw_val
= 15 },
1297 { .pdiv
= 32, .hw_val
= 16 },
1300 static u32
pll_qlin_p_to_pdiv(u32 p
, u32
*pdiv
)
1305 for (i
= 0; i
<= PLL_QLIN_PDIV_MAX
; i
++) {
1306 if (p
<= pll_qlin_pdiv_to_hw
[i
].pdiv
) {
1309 return pll_qlin_pdiv_to_hw
[i
].pdiv
;
1317 #define PLL_EXPO_PDIV_MAX 7
1318 static const struct pdiv_map pll_expo_pdiv_to_hw
[] = {
1319 { .pdiv
= 1, .hw_val
= 0 },
1320 { .pdiv
= 2, .hw_val
= 1 },
1321 { .pdiv
= 4, .hw_val
= 2 },
1322 { .pdiv
= 8, .hw_val
= 3 },
1323 { .pdiv
= 16, .hw_val
= 4 },
1324 { .pdiv
= 32, .hw_val
= 5 },
1325 { .pdiv
= 64, .hw_val
= 6 },
1326 { .pdiv
= 128, .hw_val
= 7 },
1329 static u32
pll_expo_p_to_pdiv(u32 p
, u32
*pdiv
)
1337 if (i
<= PLL_EXPO_PDIV_MAX
) {
1346 static struct tegra_clk_pll_freq_table pll_x_freq_table
[] = {
1348 { 12000000, 1000000000, 166, 1, 2, 0 }, /* actual: 996.0 MHz */
1349 { 13000000, 1000000000, 153, 1, 2, 0 }, /* actual: 994.0 MHz */
1350 { 38400000, 1000000000, 156, 3, 2, 0 }, /* actual: 998.4 MHz */
1351 { 0, 0, 0, 0, 0, 0 },
1354 static struct tegra_clk_pll_params pll_x_params
= {
1355 .input_min
= 12000000,
1356 .input_max
= 800000000,
1359 .vco_min
= 1350000000,
1360 .vco_max
= 3000000000UL,
1361 .base_reg
= PLLX_BASE
,
1362 .misc_reg
= PLLX_MISC0
,
1363 .lock_mask
= PLL_BASE_LOCK
,
1364 .lock_enable_bit_idx
= PLL_MISC_LOCK_ENABLE
,
1366 .ext_misc_reg
[0] = PLLX_MISC0
,
1367 .ext_misc_reg
[1] = PLLX_MISC1
,
1368 .ext_misc_reg
[2] = PLLX_MISC2
,
1369 .ext_misc_reg
[3] = PLLX_MISC3
,
1370 .ext_misc_reg
[4] = PLLX_MISC4
,
1371 .ext_misc_reg
[5] = PLLX_MISC5
,
1372 .iddq_reg
= PLLX_MISC3
,
1373 .iddq_bit_idx
= PLLXP_IDDQ_BIT
,
1374 .max_p
= PLL_QLIN_PDIV_MAX
,
1376 .dyn_ramp_reg
= PLLX_MISC2
,
1379 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1380 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1381 .div_nmp
= &pllx_nmp
,
1382 .freq_table
= pll_x_freq_table
,
1383 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_HAS_LOCK_ENABLE
,
1384 .dyn_ramp
= tegra210_pllx_dyn_ramp
,
1385 .set_defaults
= tegra210_pllx_set_defaults
,
1386 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1389 static struct div_nmp pllc_nmp
= {
1398 static struct tegra_clk_pll_freq_table pll_cx_freq_table
[] = {
1399 { 12000000, 510000000, 85, 1, 2, 0 },
1400 { 13000000, 510000000, 78, 1, 2, 0 }, /* actual: 507.0 MHz */
1401 { 38400000, 510000000, 79, 3, 2, 0 }, /* actual: 505.6 MHz */
1402 { 0, 0, 0, 0, 0, 0 },
1405 static struct tegra_clk_pll_params pll_c_params
= {
1406 .input_min
= 12000000,
1407 .input_max
= 700000000,
1410 .vco_min
= 600000000,
1411 .vco_max
= 1200000000,
1412 .base_reg
= PLLC_BASE
,
1413 .misc_reg
= PLLC_MISC0
,
1414 .lock_mask
= PLL_BASE_LOCK
,
1416 .iddq_reg
= PLLC_MISC1
,
1417 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1418 .reset_reg
= PLLC_MISC0
,
1419 .reset_bit_idx
= PLLCX_RESET_BIT
,
1420 .max_p
= PLL_QLIN_PDIV_MAX
,
1421 .ext_misc_reg
[0] = PLLC_MISC0
,
1422 .ext_misc_reg
[1] = PLLC_MISC1
,
1423 .ext_misc_reg
[2] = PLLC_MISC2
,
1424 .ext_misc_reg
[3] = PLLC_MISC3
,
1425 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1426 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1428 .div_nmp
= &pllc_nmp
,
1429 .freq_table
= pll_cx_freq_table
,
1430 .flags
= TEGRA_PLL_USE_LOCK
,
1431 .set_defaults
= _pllc_set_defaults
,
1432 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1435 static struct div_nmp pllcx_nmp
= {
1444 static struct tegra_clk_pll_params pll_c2_params
= {
1445 .input_min
= 12000000,
1446 .input_max
= 700000000,
1449 .vco_min
= 600000000,
1450 .vco_max
= 1200000000,
1451 .base_reg
= PLLC2_BASE
,
1452 .misc_reg
= PLLC2_MISC0
,
1453 .iddq_reg
= PLLC2_MISC1
,
1454 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1455 .reset_reg
= PLLC2_MISC0
,
1456 .reset_bit_idx
= PLLCX_RESET_BIT
,
1457 .lock_mask
= PLLCX_BASE_LOCK
,
1459 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1460 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1462 .div_nmp
= &pllcx_nmp
,
1463 .max_p
= PLL_QLIN_PDIV_MAX
,
1464 .ext_misc_reg
[0] = PLLC2_MISC0
,
1465 .ext_misc_reg
[1] = PLLC2_MISC1
,
1466 .ext_misc_reg
[2] = PLLC2_MISC2
,
1467 .ext_misc_reg
[3] = PLLC2_MISC3
,
1468 .freq_table
= pll_cx_freq_table
,
1469 .flags
= TEGRA_PLL_USE_LOCK
,
1470 .set_defaults
= _pllc2_set_defaults
,
1471 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1474 static struct tegra_clk_pll_params pll_c3_params
= {
1475 .input_min
= 12000000,
1476 .input_max
= 700000000,
1479 .vco_min
= 600000000,
1480 .vco_max
= 1200000000,
1481 .base_reg
= PLLC3_BASE
,
1482 .misc_reg
= PLLC3_MISC0
,
1483 .lock_mask
= PLLCX_BASE_LOCK
,
1485 .iddq_reg
= PLLC3_MISC1
,
1486 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1487 .reset_reg
= PLLC3_MISC0
,
1488 .reset_bit_idx
= PLLCX_RESET_BIT
,
1489 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1490 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1492 .div_nmp
= &pllcx_nmp
,
1493 .max_p
= PLL_QLIN_PDIV_MAX
,
1494 .ext_misc_reg
[0] = PLLC3_MISC0
,
1495 .ext_misc_reg
[1] = PLLC3_MISC1
,
1496 .ext_misc_reg
[2] = PLLC3_MISC2
,
1497 .ext_misc_reg
[3] = PLLC3_MISC3
,
1498 .freq_table
= pll_cx_freq_table
,
1499 .flags
= TEGRA_PLL_USE_LOCK
,
1500 .set_defaults
= _pllc3_set_defaults
,
1501 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1504 static struct div_nmp pllss_nmp
= {
1513 static struct tegra_clk_pll_freq_table pll_c4_vco_freq_table
[] = {
1514 { 12000000, 600000000, 50, 1, 1, 0 },
1515 { 13000000, 600000000, 46, 1, 1, 0 }, /* actual: 598.0 MHz */
1516 { 38400000, 600000000, 62, 4, 1, 0 }, /* actual: 595.2 MHz */
1517 { 0, 0, 0, 0, 0, 0 },
1520 static const struct clk_div_table pll_vco_post_div_table
[] = {
1521 { .val
= 0, .div
= 1 },
1522 { .val
= 1, .div
= 2 },
1523 { .val
= 2, .div
= 3 },
1524 { .val
= 3, .div
= 4 },
1525 { .val
= 4, .div
= 5 },
1526 { .val
= 5, .div
= 6 },
1527 { .val
= 6, .div
= 8 },
1528 { .val
= 7, .div
= 10 },
1529 { .val
= 8, .div
= 12 },
1530 { .val
= 9, .div
= 16 },
1531 { .val
= 10, .div
= 12 },
1532 { .val
= 11, .div
= 16 },
1533 { .val
= 12, .div
= 20 },
1534 { .val
= 13, .div
= 24 },
1535 { .val
= 14, .div
= 32 },
1536 { .val
= 0, .div
= 0 },
1539 static struct tegra_clk_pll_params pll_c4_vco_params
= {
1540 .input_min
= 9600000,
1541 .input_max
= 800000000,
1544 .vco_min
= 500000000,
1545 .vco_max
= 1080000000,
1546 .base_reg
= PLLC4_BASE
,
1547 .misc_reg
= PLLC4_MISC0
,
1548 .lock_mask
= PLL_BASE_LOCK
,
1550 .max_p
= PLL_QLIN_PDIV_MAX
,
1551 .ext_misc_reg
[0] = PLLC4_MISC0
,
1552 .iddq_reg
= PLLC4_BASE
,
1553 .iddq_bit_idx
= PLLSS_IDDQ_BIT
,
1554 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1555 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1557 .div_nmp
= &pllss_nmp
,
1558 .freq_table
= pll_c4_vco_freq_table
,
1559 .set_defaults
= tegra210_pllc4_set_defaults
,
1560 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_VCO_OUT
,
1561 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1564 static struct tegra_clk_pll_freq_table pll_m_freq_table
[] = {
1565 { 12000000, 800000000, 66, 1, 1, 0 }, /* actual: 792.0 MHz */
1566 { 13000000, 800000000, 61, 1, 1, 0 }, /* actual: 793.0 MHz */
1567 { 38400000, 297600000, 93, 4, 3, 0 },
1568 { 38400000, 400000000, 125, 4, 3, 0 },
1569 { 38400000, 532800000, 111, 4, 2, 0 },
1570 { 38400000, 665600000, 104, 3, 2, 0 },
1571 { 38400000, 800000000, 125, 3, 2, 0 },
1572 { 38400000, 931200000, 97, 4, 1, 0 },
1573 { 38400000, 1065600000, 111, 4, 1, 0 },
1574 { 38400000, 1200000000, 125, 4, 1, 0 },
1575 { 38400000, 1331200000, 104, 3, 1, 0 },
1576 { 38400000, 1459200000, 76, 2, 1, 0 },
1577 { 38400000, 1600000000, 125, 3, 1, 0 },
1578 { 0, 0, 0, 0, 0, 0 },
1581 static struct div_nmp pllm_nmp
= {
1584 .override_divm_shift
= 0,
1587 .override_divn_shift
= 8,
1590 .override_divp_shift
= 27,
1593 static struct tegra_clk_pll_params pll_m_params
= {
1594 .input_min
= 9600000,
1595 .input_max
= 500000000,
1598 .vco_min
= 800000000,
1599 .vco_max
= 1866000000,
1600 .base_reg
= PLLM_BASE
,
1601 .misc_reg
= PLLM_MISC2
,
1602 .lock_mask
= PLL_BASE_LOCK
,
1603 .lock_enable_bit_idx
= PLLM_MISC_LOCK_ENABLE
,
1605 .iddq_reg
= PLLM_MISC2
,
1606 .iddq_bit_idx
= PLLM_IDDQ_BIT
,
1607 .max_p
= PLL_QLIN_PDIV_MAX
,
1608 .ext_misc_reg
[0] = PLLM_MISC2
,
1609 .ext_misc_reg
[1] = PLLM_MISC1
,
1610 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1611 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1612 .div_nmp
= &pllm_nmp
,
1613 .pmc_divnm_reg
= PMC_PLLM_WB0_OVERRIDE
,
1614 .pmc_divp_reg
= PMC_PLLM_WB0_OVERRIDE_2
,
1615 .freq_table
= pll_m_freq_table
,
1616 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_HAS_LOCK_ENABLE
,
1617 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1620 static struct tegra_clk_pll_params pll_mb_params
= {
1621 .input_min
= 9600000,
1622 .input_max
= 500000000,
1625 .vco_min
= 800000000,
1626 .vco_max
= 1866000000,
1627 .base_reg
= PLLMB_BASE
,
1628 .misc_reg
= PLLMB_MISC1
,
1629 .lock_mask
= PLL_BASE_LOCK
,
1631 .iddq_reg
= PLLMB_MISC1
,
1632 .iddq_bit_idx
= PLLMB_IDDQ_BIT
,
1633 .max_p
= PLL_QLIN_PDIV_MAX
,
1634 .ext_misc_reg
[0] = PLLMB_MISC1
,
1635 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1636 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1637 .div_nmp
= &pllm_nmp
,
1638 .freq_table
= pll_m_freq_table
,
1639 .flags
= TEGRA_PLL_USE_LOCK
,
1640 .set_defaults
= tegra210_pllmb_set_defaults
,
1641 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1645 static struct tegra_clk_pll_freq_table pll_e_freq_table
[] = {
1646 /* PLLE special case: use cpcon field to store cml divider value */
1647 { 672000000, 100000000, 125, 42, 0, 13 },
1648 { 624000000, 100000000, 125, 39, 0, 13 },
1649 { 336000000, 100000000, 125, 21, 0, 13 },
1650 { 312000000, 100000000, 200, 26, 0, 14 },
1651 { 38400000, 100000000, 125, 2, 0, 14 },
1652 { 12000000, 100000000, 200, 1, 0, 14 },
1653 { 0, 0, 0, 0, 0, 0 },
1656 static struct div_nmp plle_nmp
= {
1665 static struct tegra_clk_pll_params pll_e_params
= {
1666 .input_min
= 12000000,
1667 .input_max
= 800000000,
1670 .vco_min
= 1600000000,
1671 .vco_max
= 2500000000U,
1672 .base_reg
= PLLE_BASE
,
1673 .misc_reg
= PLLE_MISC0
,
1674 .aux_reg
= PLLE_AUX
,
1675 .lock_mask
= PLLE_MISC_LOCK
,
1676 .lock_enable_bit_idx
= PLLE_MISC_LOCK_ENABLE
,
1678 .div_nmp
= &plle_nmp
,
1679 .freq_table
= pll_e_freq_table
,
1680 .flags
= TEGRA_PLL_FIXED
| TEGRA_PLL_LOCK_MISC
| TEGRA_PLL_USE_LOCK
|
1681 TEGRA_PLL_HAS_LOCK_ENABLE
,
1682 .fixed_rate
= 100000000,
1683 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1686 static struct tegra_clk_pll_freq_table pll_re_vco_freq_table
[] = {
1687 { 12000000, 672000000, 56, 1, 1, 0 },
1688 { 13000000, 672000000, 51, 1, 1, 0 }, /* actual: 663.0 MHz */
1689 { 38400000, 672000000, 70, 4, 1, 0 },
1690 { 0, 0, 0, 0, 0, 0 },
1693 static struct div_nmp pllre_nmp
= {
1702 static struct tegra_clk_pll_params pll_re_vco_params
= {
1703 .input_min
= 9600000,
1704 .input_max
= 800000000,
1707 .vco_min
= 350000000,
1708 .vco_max
= 700000000,
1709 .base_reg
= PLLRE_BASE
,
1710 .misc_reg
= PLLRE_MISC0
,
1711 .lock_mask
= PLLRE_MISC_LOCK
,
1713 .max_p
= PLL_QLIN_PDIV_MAX
,
1714 .ext_misc_reg
[0] = PLLRE_MISC0
,
1715 .iddq_reg
= PLLRE_MISC0
,
1716 .iddq_bit_idx
= PLLRE_IDDQ_BIT
,
1717 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1718 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1719 .div_nmp
= &pllre_nmp
,
1720 .freq_table
= pll_re_vco_freq_table
,
1721 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_LOCK_MISC
| TEGRA_PLL_VCO_OUT
,
1722 .set_defaults
= tegra210_pllre_set_defaults
,
1723 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1726 static struct div_nmp pllp_nmp
= {
1735 static struct tegra_clk_pll_freq_table pll_p_freq_table
[] = {
1736 { 12000000, 408000000, 34, 1, 1, 0 },
1737 { 38400000, 408000000, 85, 8, 1, 0 }, /* cf = 4.8MHz, allowed exception */
1738 { 0, 0, 0, 0, 0, 0 },
1741 static struct tegra_clk_pll_params pll_p_params
= {
1742 .input_min
= 9600000,
1743 .input_max
= 800000000,
1746 .vco_min
= 350000000,
1747 .vco_max
= 700000000,
1748 .base_reg
= PLLP_BASE
,
1749 .misc_reg
= PLLP_MISC0
,
1750 .lock_mask
= PLL_BASE_LOCK
,
1752 .iddq_reg
= PLLP_MISC0
,
1753 .iddq_bit_idx
= PLLXP_IDDQ_BIT
,
1754 .ext_misc_reg
[0] = PLLP_MISC0
,
1755 .ext_misc_reg
[1] = PLLP_MISC1
,
1756 .div_nmp
= &pllp_nmp
,
1757 .freq_table
= pll_p_freq_table
,
1758 .fixed_rate
= 408000000,
1759 .flags
= TEGRA_PLL_FIXED
| TEGRA_PLL_USE_LOCK
| TEGRA_PLL_VCO_OUT
,
1760 .set_defaults
= tegra210_pllp_set_defaults
,
1761 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1764 static struct tegra_clk_pll_params pll_a1_params
= {
1765 .input_min
= 12000000,
1766 .input_max
= 700000000,
1769 .vco_min
= 600000000,
1770 .vco_max
= 1200000000,
1771 .base_reg
= PLLA1_BASE
,
1772 .misc_reg
= PLLA1_MISC0
,
1773 .lock_mask
= PLLCX_BASE_LOCK
,
1775 .iddq_reg
= PLLA1_MISC0
,
1776 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1777 .reset_reg
= PLLA1_MISC0
,
1778 .reset_bit_idx
= PLLCX_RESET_BIT
,
1779 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1780 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1781 .div_nmp
= &pllc_nmp
,
1782 .ext_misc_reg
[0] = PLLA1_MISC0
,
1783 .ext_misc_reg
[1] = PLLA1_MISC1
,
1784 .ext_misc_reg
[2] = PLLA1_MISC2
,
1785 .ext_misc_reg
[3] = PLLA1_MISC3
,
1786 .freq_table
= pll_cx_freq_table
,
1787 .flags
= TEGRA_PLL_USE_LOCK
,
1788 .set_defaults
= _plla1_set_defaults
,
1789 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1792 static struct div_nmp plla_nmp
= {
1801 static struct tegra_clk_pll_freq_table pll_a_freq_table
[] = {
1802 { 12000000, 282240000, 47, 1, 2, 1, 0xf148 }, /* actual: 282240234 */
1803 { 12000000, 368640000, 61, 1, 2, 1, 0xfe15 }, /* actual: 368640381 */
1804 { 12000000, 240000000, 60, 1, 3, 1, 0 },
1805 { 13000000, 282240000, 43, 1, 2, 1, 0xfd7d }, /* actual: 282239807 */
1806 { 13000000, 368640000, 56, 1, 2, 1, 0x06d8 }, /* actual: 368640137 */
1807 { 13000000, 240000000, 55, 1, 3, 1, 0 }, /* actual: 238.3 MHz */
1808 { 38400000, 282240000, 44, 3, 2, 1, 0xf333 }, /* actual: 282239844 */
1809 { 38400000, 368640000, 57, 3, 2, 1, 0x0333 }, /* actual: 368639844 */
1810 { 38400000, 240000000, 75, 3, 3, 1, 0 },
1811 { 0, 0, 0, 0, 0, 0, 0 },
1814 static struct tegra_clk_pll_params pll_a_params
= {
1815 .input_min
= 12000000,
1816 .input_max
= 800000000,
1819 .vco_min
= 500000000,
1820 .vco_max
= 1000000000,
1821 .base_reg
= PLLA_BASE
,
1822 .misc_reg
= PLLA_MISC0
,
1823 .lock_mask
= PLL_BASE_LOCK
,
1825 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1826 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1827 .iddq_reg
= PLLA_BASE
,
1828 .iddq_bit_idx
= PLLA_IDDQ_BIT
,
1829 .div_nmp
= &plla_nmp
,
1830 .sdm_din_reg
= PLLA_MISC1
,
1831 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1832 .sdm_ctrl_reg
= PLLA_MISC2
,
1833 .sdm_ctrl_en_mask
= PLLA_SDM_EN_MASK
,
1834 .ext_misc_reg
[0] = PLLA_MISC0
,
1835 .ext_misc_reg
[1] = PLLA_MISC1
,
1836 .ext_misc_reg
[2] = PLLA_MISC2
,
1837 .freq_table
= pll_a_freq_table
,
1838 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_MDIV_NEW
,
1839 .set_defaults
= tegra210_plla_set_defaults
,
1840 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1841 .set_gain
= tegra210_clk_pll_set_gain
,
1842 .adjust_vco
= tegra210_clk_adjust_vco_min
,
1845 static struct div_nmp plld_nmp
= {
1854 static struct tegra_clk_pll_freq_table pll_d_freq_table
[] = {
1855 { 12000000, 594000000, 99, 1, 2, 0, 0 },
1856 { 13000000, 594000000, 91, 1, 2, 0, 0xfc4f }, /* actual: 594000183 */
1857 { 38400000, 594000000, 30, 1, 2, 0, 0x0e00 },
1858 { 0, 0, 0, 0, 0, 0, 0 },
1861 static struct tegra_clk_pll_params pll_d_params
= {
1862 .input_min
= 12000000,
1863 .input_max
= 800000000,
1866 .vco_min
= 750000000,
1867 .vco_max
= 1500000000,
1868 .base_reg
= PLLD_BASE
,
1869 .misc_reg
= PLLD_MISC0
,
1870 .lock_mask
= PLL_BASE_LOCK
,
1872 .iddq_reg
= PLLD_MISC0
,
1873 .iddq_bit_idx
= PLLD_IDDQ_BIT
,
1874 .round_p_to_pdiv
= pll_expo_p_to_pdiv
,
1875 .pdiv_tohw
= pll_expo_pdiv_to_hw
,
1876 .div_nmp
= &plld_nmp
,
1877 .sdm_din_reg
= PLLD_MISC0
,
1878 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1879 .sdm_ctrl_reg
= PLLD_MISC0
,
1880 .sdm_ctrl_en_mask
= PLLD_SDM_EN_MASK
,
1881 .ext_misc_reg
[0] = PLLD_MISC0
,
1882 .ext_misc_reg
[1] = PLLD_MISC1
,
1883 .freq_table
= pll_d_freq_table
,
1884 .flags
= TEGRA_PLL_USE_LOCK
,
1886 .set_defaults
= tegra210_plld_set_defaults
,
1887 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1888 .set_gain
= tegra210_clk_pll_set_gain
,
1889 .adjust_vco
= tegra210_clk_adjust_vco_min
,
1892 static struct tegra_clk_pll_freq_table tegra210_pll_d2_freq_table
[] = {
1893 { 12000000, 594000000, 99, 1, 2, 0, 0xf000 },
1894 { 13000000, 594000000, 91, 1, 2, 0, 0xfc4f }, /* actual: 594000183 */
1895 { 38400000, 594000000, 30, 1, 2, 0, 0x0e00 },
1896 { 0, 0, 0, 0, 0, 0, 0 },
1899 /* s/w policy, always tegra_pll_ref */
1900 static struct tegra_clk_pll_params pll_d2_params
= {
1901 .input_min
= 12000000,
1902 .input_max
= 800000000,
1905 .vco_min
= 750000000,
1906 .vco_max
= 1500000000,
1907 .base_reg
= PLLD2_BASE
,
1908 .misc_reg
= PLLD2_MISC0
,
1909 .lock_mask
= PLL_BASE_LOCK
,
1911 .iddq_reg
= PLLD2_BASE
,
1912 .iddq_bit_idx
= PLLSS_IDDQ_BIT
,
1913 .sdm_din_reg
= PLLD2_MISC3
,
1914 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1915 .sdm_ctrl_reg
= PLLD2_MISC1
,
1916 .sdm_ctrl_en_mask
= PLLD2_SDM_EN_MASK
,
1917 /* disable spread-spectrum for pll_d2 */
1919 .ssc_ctrl_en_mask
= 0,
1920 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1921 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1922 .div_nmp
= &pllss_nmp
,
1923 .ext_misc_reg
[0] = PLLD2_MISC0
,
1924 .ext_misc_reg
[1] = PLLD2_MISC1
,
1925 .ext_misc_reg
[2] = PLLD2_MISC2
,
1926 .ext_misc_reg
[3] = PLLD2_MISC3
,
1927 .max_p
= PLL_QLIN_PDIV_MAX
,
1929 .freq_table
= tegra210_pll_d2_freq_table
,
1930 .set_defaults
= tegra210_plld2_set_defaults
,
1931 .flags
= TEGRA_PLL_USE_LOCK
,
1932 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1933 .set_gain
= tegra210_clk_pll_set_gain
,
1934 .adjust_vco
= tegra210_clk_adjust_vco_min
,
1937 static struct tegra_clk_pll_freq_table pll_dp_freq_table
[] = {
1938 { 12000000, 270000000, 90, 1, 4, 0, 0xf000 },
1939 { 13000000, 270000000, 83, 1, 4, 0, 0xf000 }, /* actual: 269.8 MHz */
1940 { 38400000, 270000000, 28, 1, 4, 0, 0xf400 },
1941 { 0, 0, 0, 0, 0, 0, 0 },
1944 static struct tegra_clk_pll_params pll_dp_params
= {
1945 .input_min
= 12000000,
1946 .input_max
= 800000000,
1949 .vco_min
= 750000000,
1950 .vco_max
= 1500000000,
1951 .base_reg
= PLLDP_BASE
,
1952 .misc_reg
= PLLDP_MISC
,
1953 .lock_mask
= PLL_BASE_LOCK
,
1955 .iddq_reg
= PLLDP_BASE
,
1956 .iddq_bit_idx
= PLLSS_IDDQ_BIT
,
1957 .sdm_din_reg
= PLLDP_SS_CTRL2
,
1958 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1959 .sdm_ctrl_reg
= PLLDP_SS_CFG
,
1960 .sdm_ctrl_en_mask
= PLLDP_SDM_EN_MASK
,
1961 .ssc_ctrl_reg
= PLLDP_SS_CFG
,
1962 .ssc_ctrl_en_mask
= PLLDP_SSC_EN_MASK
,
1963 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1964 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1965 .div_nmp
= &pllss_nmp
,
1966 .ext_misc_reg
[0] = PLLDP_MISC
,
1967 .ext_misc_reg
[1] = PLLDP_SS_CFG
,
1968 .ext_misc_reg
[2] = PLLDP_SS_CTRL1
,
1969 .ext_misc_reg
[3] = PLLDP_SS_CTRL2
,
1970 .max_p
= PLL_QLIN_PDIV_MAX
,
1972 .freq_table
= pll_dp_freq_table
,
1973 .set_defaults
= tegra210_plldp_set_defaults
,
1974 .flags
= TEGRA_PLL_USE_LOCK
,
1975 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1976 .set_gain
= tegra210_clk_pll_set_gain
,
1977 .adjust_vco
= tegra210_clk_adjust_vco_min
,
1980 static struct div_nmp pllu_nmp
= {
1989 static struct tegra_clk_pll_freq_table pll_u_freq_table
[] = {
1990 { 12000000, 480000000, 40, 1, 1, 0 },
1991 { 13000000, 480000000, 36, 1, 1, 0 }, /* actual: 468.0 MHz */
1992 { 38400000, 480000000, 25, 2, 1, 0 },
1993 { 0, 0, 0, 0, 0, 0 },
1996 static struct tegra_clk_pll_params pll_u_vco_params
= {
1997 .input_min
= 9600000,
1998 .input_max
= 800000000,
2001 .vco_min
= 350000000,
2002 .vco_max
= 700000000,
2003 .base_reg
= PLLU_BASE
,
2004 .misc_reg
= PLLU_MISC0
,
2005 .lock_mask
= PLL_BASE_LOCK
,
2007 .iddq_reg
= PLLU_MISC0
,
2008 .iddq_bit_idx
= PLLU_IDDQ_BIT
,
2009 .ext_misc_reg
[0] = PLLU_MISC0
,
2010 .ext_misc_reg
[1] = PLLU_MISC1
,
2011 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
2012 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
2013 .div_nmp
= &pllu_nmp
,
2014 .freq_table
= pll_u_freq_table
,
2015 .flags
= TEGRA_PLLU
| TEGRA_PLL_USE_LOCK
| TEGRA_PLL_VCO_OUT
,
2016 .set_defaults
= tegra210_pllu_set_defaults
,
2017 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
2020 static struct tegra_clk tegra210_clks
[tegra_clk_max
] __initdata
= {
2021 [tegra_clk_ispb
] = { .dt_id
= TEGRA210_CLK_ISPB
, .present
= true },
2022 [tegra_clk_rtc
] = { .dt_id
= TEGRA210_CLK_RTC
, .present
= true },
2023 [tegra_clk_timer
] = { .dt_id
= TEGRA210_CLK_TIMER
, .present
= true },
2024 [tegra_clk_uarta_8
] = { .dt_id
= TEGRA210_CLK_UARTA
, .present
= true },
2025 [tegra_clk_sdmmc2_9
] = { .dt_id
= TEGRA210_CLK_SDMMC2
, .present
= true },
2026 [tegra_clk_i2s1
] = { .dt_id
= TEGRA210_CLK_I2S1
, .present
= true },
2027 [tegra_clk_i2c1
] = { .dt_id
= TEGRA210_CLK_I2C1
, .present
= true },
2028 [tegra_clk_sdmmc1_9
] = { .dt_id
= TEGRA210_CLK_SDMMC1
, .present
= true },
2029 [tegra_clk_sdmmc4_9
] = { .dt_id
= TEGRA210_CLK_SDMMC4
, .present
= true },
2030 [tegra_clk_pwm
] = { .dt_id
= TEGRA210_CLK_PWM
, .present
= true },
2031 [tegra_clk_i2s2
] = { .dt_id
= TEGRA210_CLK_I2S2
, .present
= true },
2032 [tegra_clk_usbd
] = { .dt_id
= TEGRA210_CLK_USBD
, .present
= true },
2033 [tegra_clk_isp_9
] = { .dt_id
= TEGRA210_CLK_ISP
, .present
= true },
2034 [tegra_clk_disp2_8
] = { .dt_id
= TEGRA210_CLK_DISP2
, .present
= true },
2035 [tegra_clk_disp1_8
] = { .dt_id
= TEGRA210_CLK_DISP1
, .present
= true },
2036 [tegra_clk_host1x_9
] = { .dt_id
= TEGRA210_CLK_HOST1X
, .present
= true },
2037 [tegra_clk_i2s0
] = { .dt_id
= TEGRA210_CLK_I2S0
, .present
= true },
2038 [tegra_clk_apbdma
] = { .dt_id
= TEGRA210_CLK_APBDMA
, .present
= true },
2039 [tegra_clk_kfuse
] = { .dt_id
= TEGRA210_CLK_KFUSE
, .present
= true },
2040 [tegra_clk_sbc1_9
] = { .dt_id
= TEGRA210_CLK_SBC1
, .present
= true },
2041 [tegra_clk_sbc2_9
] = { .dt_id
= TEGRA210_CLK_SBC2
, .present
= true },
2042 [tegra_clk_sbc3_9
] = { .dt_id
= TEGRA210_CLK_SBC3
, .present
= true },
2043 [tegra_clk_i2c5
] = { .dt_id
= TEGRA210_CLK_I2C5
, .present
= true },
2044 [tegra_clk_csi
] = { .dt_id
= TEGRA210_CLK_CSI
, .present
= true },
2045 [tegra_clk_i2c2
] = { .dt_id
= TEGRA210_CLK_I2C2
, .present
= true },
2046 [tegra_clk_uartc_8
] = { .dt_id
= TEGRA210_CLK_UARTC
, .present
= true },
2047 [tegra_clk_mipi_cal
] = { .dt_id
= TEGRA210_CLK_MIPI_CAL
, .present
= true },
2048 [tegra_clk_emc
] = { .dt_id
= TEGRA210_CLK_EMC
, .present
= true },
2049 [tegra_clk_usb2
] = { .dt_id
= TEGRA210_CLK_USB2
, .present
= true },
2050 [tegra_clk_bsev
] = { .dt_id
= TEGRA210_CLK_BSEV
, .present
= true },
2051 [tegra_clk_uartd_8
] = { .dt_id
= TEGRA210_CLK_UARTD
, .present
= true },
2052 [tegra_clk_i2c3
] = { .dt_id
= TEGRA210_CLK_I2C3
, .present
= true },
2053 [tegra_clk_sbc4_9
] = { .dt_id
= TEGRA210_CLK_SBC4
, .present
= true },
2054 [tegra_clk_sdmmc3_9
] = { .dt_id
= TEGRA210_CLK_SDMMC3
, .present
= true },
2055 [tegra_clk_pcie
] = { .dt_id
= TEGRA210_CLK_PCIE
, .present
= true },
2056 [tegra_clk_owr_8
] = { .dt_id
= TEGRA210_CLK_OWR
, .present
= true },
2057 [tegra_clk_afi
] = { .dt_id
= TEGRA210_CLK_AFI
, .present
= true },
2058 [tegra_clk_csite_8
] = { .dt_id
= TEGRA210_CLK_CSITE
, .present
= true },
2059 [tegra_clk_soc_therm_8
] = { .dt_id
= TEGRA210_CLK_SOC_THERM
, .present
= true },
2060 [tegra_clk_dtv
] = { .dt_id
= TEGRA210_CLK_DTV
, .present
= true },
2061 [tegra_clk_i2cslow
] = { .dt_id
= TEGRA210_CLK_I2CSLOW
, .present
= true },
2062 [tegra_clk_tsec_8
] = { .dt_id
= TEGRA210_CLK_TSEC
, .present
= true },
2063 [tegra_clk_xusb_host
] = { .dt_id
= TEGRA210_CLK_XUSB_HOST
, .present
= true },
2064 [tegra_clk_csus
] = { .dt_id
= TEGRA210_CLK_CSUS
, .present
= true },
2065 [tegra_clk_mselect
] = { .dt_id
= TEGRA210_CLK_MSELECT
, .present
= true },
2066 [tegra_clk_tsensor
] = { .dt_id
= TEGRA210_CLK_TSENSOR
, .present
= true },
2067 [tegra_clk_i2s3
] = { .dt_id
= TEGRA210_CLK_I2S3
, .present
= true },
2068 [tegra_clk_i2s4
] = { .dt_id
= TEGRA210_CLK_I2S4
, .present
= true },
2069 [tegra_clk_i2c4
] = { .dt_id
= TEGRA210_CLK_I2C4
, .present
= true },
2070 [tegra_clk_d_audio
] = { .dt_id
= TEGRA210_CLK_D_AUDIO
, .present
= true },
2071 [tegra_clk_hda2codec_2x_8
] = { .dt_id
= TEGRA210_CLK_HDA2CODEC_2X
, .present
= true },
2072 [tegra_clk_spdif_2x
] = { .dt_id
= TEGRA210_CLK_SPDIF_2X
, .present
= true },
2073 [tegra_clk_actmon
] = { .dt_id
= TEGRA210_CLK_ACTMON
, .present
= true },
2074 [tegra_clk_extern1
] = { .dt_id
= TEGRA210_CLK_EXTERN1
, .present
= true },
2075 [tegra_clk_extern2
] = { .dt_id
= TEGRA210_CLK_EXTERN2
, .present
= true },
2076 [tegra_clk_extern3
] = { .dt_id
= TEGRA210_CLK_EXTERN3
, .present
= true },
2077 [tegra_clk_sata_oob_8
] = { .dt_id
= TEGRA210_CLK_SATA_OOB
, .present
= true },
2078 [tegra_clk_sata_8
] = { .dt_id
= TEGRA210_CLK_SATA
, .present
= true },
2079 [tegra_clk_hda_8
] = { .dt_id
= TEGRA210_CLK_HDA
, .present
= true },
2080 [tegra_clk_hda2hdmi
] = { .dt_id
= TEGRA210_CLK_HDA2HDMI
, .present
= true },
2081 [tegra_clk_cilab
] = { .dt_id
= TEGRA210_CLK_CILAB
, .present
= true },
2082 [tegra_clk_cilcd
] = { .dt_id
= TEGRA210_CLK_CILCD
, .present
= true },
2083 [tegra_clk_cile
] = { .dt_id
= TEGRA210_CLK_CILE
, .present
= true },
2084 [tegra_clk_dsialp
] = { .dt_id
= TEGRA210_CLK_DSIALP
, .present
= true },
2085 [tegra_clk_dsiblp
] = { .dt_id
= TEGRA210_CLK_DSIBLP
, .present
= true },
2086 [tegra_clk_entropy_8
] = { .dt_id
= TEGRA210_CLK_ENTROPY
, .present
= true },
2087 [tegra_clk_xusb_ss
] = { .dt_id
= TEGRA210_CLK_XUSB_SS
, .present
= true },
2088 [tegra_clk_i2c6
] = { .dt_id
= TEGRA210_CLK_I2C6
, .present
= true },
2089 [tegra_clk_vim2_clk
] = { .dt_id
= TEGRA210_CLK_VIM2_CLK
, .present
= true },
2090 [tegra_clk_clk72Mhz_8
] = { .dt_id
= TEGRA210_CLK_CLK72MHZ
, .present
= true },
2091 [tegra_clk_vic03_8
] = { .dt_id
= TEGRA210_CLK_VIC03
, .present
= true },
2092 [tegra_clk_dpaux
] = { .dt_id
= TEGRA210_CLK_DPAUX
, .present
= true },
2093 [tegra_clk_dpaux1
] = { .dt_id
= TEGRA210_CLK_DPAUX1
, .present
= true },
2094 [tegra_clk_sor0
] = { .dt_id
= TEGRA210_CLK_SOR0
, .present
= true },
2095 [tegra_clk_sor0_lvds
] = { .dt_id
= TEGRA210_CLK_SOR0_LVDS
, .present
= true },
2096 [tegra_clk_sor1
] = { .dt_id
= TEGRA210_CLK_SOR1
, .present
= true },
2097 [tegra_clk_sor1_src
] = { .dt_id
= TEGRA210_CLK_SOR1_SRC
, .present
= true },
2098 [tegra_clk_gpu
] = { .dt_id
= TEGRA210_CLK_GPU
, .present
= true },
2099 [tegra_clk_pll_g_ref
] = { .dt_id
= TEGRA210_CLK_PLL_G_REF
, .present
= true, },
2100 [tegra_clk_uartb_8
] = { .dt_id
= TEGRA210_CLK_UARTB
, .present
= true },
2101 [tegra_clk_vfir
] = { .dt_id
= TEGRA210_CLK_VFIR
, .present
= true },
2102 [tegra_clk_spdif_in_8
] = { .dt_id
= TEGRA210_CLK_SPDIF_IN
, .present
= true },
2103 [tegra_clk_spdif_out
] = { .dt_id
= TEGRA210_CLK_SPDIF_OUT
, .present
= true },
2104 [tegra_clk_vi_10
] = { .dt_id
= TEGRA210_CLK_VI
, .present
= true },
2105 [tegra_clk_vi_sensor_8
] = { .dt_id
= TEGRA210_CLK_VI_SENSOR
, .present
= true },
2106 [tegra_clk_fuse
] = { .dt_id
= TEGRA210_CLK_FUSE
, .present
= true },
2107 [tegra_clk_fuse_burn
] = { .dt_id
= TEGRA210_CLK_FUSE_BURN
, .present
= true },
2108 [tegra_clk_clk_32k
] = { .dt_id
= TEGRA210_CLK_CLK_32K
, .present
= true },
2109 [tegra_clk_clk_m
] = { .dt_id
= TEGRA210_CLK_CLK_M
, .present
= true },
2110 [tegra_clk_clk_m_div2
] = { .dt_id
= TEGRA210_CLK_CLK_M_DIV2
, .present
= true },
2111 [tegra_clk_clk_m_div4
] = { .dt_id
= TEGRA210_CLK_CLK_M_DIV4
, .present
= true },
2112 [tegra_clk_pll_ref
] = { .dt_id
= TEGRA210_CLK_PLL_REF
, .present
= true },
2113 [tegra_clk_pll_c
] = { .dt_id
= TEGRA210_CLK_PLL_C
, .present
= true },
2114 [tegra_clk_pll_c_out1
] = { .dt_id
= TEGRA210_CLK_PLL_C_OUT1
, .present
= true },
2115 [tegra_clk_pll_c2
] = { .dt_id
= TEGRA210_CLK_PLL_C2
, .present
= true },
2116 [tegra_clk_pll_c3
] = { .dt_id
= TEGRA210_CLK_PLL_C3
, .present
= true },
2117 [tegra_clk_pll_m
] = { .dt_id
= TEGRA210_CLK_PLL_M
, .present
= true },
2118 [tegra_clk_pll_m_out1
] = { .dt_id
= TEGRA210_CLK_PLL_M_OUT1
, .present
= true },
2119 [tegra_clk_pll_p
] = { .dt_id
= TEGRA210_CLK_PLL_P
, .present
= true },
2120 [tegra_clk_pll_p_out1
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT1
, .present
= true },
2121 [tegra_clk_pll_p_out3
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT3
, .present
= true },
2122 [tegra_clk_pll_p_out4_cpu
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT4
, .present
= true },
2123 [tegra_clk_pll_p_out_hsio
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_HSIO
, .present
= true },
2124 [tegra_clk_pll_p_out_xusb
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_XUSB
, .present
= true },
2125 [tegra_clk_pll_p_out_cpu
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_CPU
, .present
= true },
2126 [tegra_clk_pll_p_out_adsp
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_ADSP
, .present
= true },
2127 [tegra_clk_pll_a
] = { .dt_id
= TEGRA210_CLK_PLL_A
, .present
= true },
2128 [tegra_clk_pll_a_out0
] = { .dt_id
= TEGRA210_CLK_PLL_A_OUT0
, .present
= true },
2129 [tegra_clk_pll_d
] = { .dt_id
= TEGRA210_CLK_PLL_D
, .present
= true },
2130 [tegra_clk_pll_d_out0
] = { .dt_id
= TEGRA210_CLK_PLL_D_OUT0
, .present
= true },
2131 [tegra_clk_pll_d2
] = { .dt_id
= TEGRA210_CLK_PLL_D2
, .present
= true },
2132 [tegra_clk_pll_d2_out0
] = { .dt_id
= TEGRA210_CLK_PLL_D2_OUT0
, .present
= true },
2133 [tegra_clk_pll_u
] = { .dt_id
= TEGRA210_CLK_PLL_U
, .present
= true },
2134 [tegra_clk_pll_u_out
] = { .dt_id
= TEGRA210_CLK_PLL_U_OUT
, .present
= true },
2135 [tegra_clk_pll_u_out1
] = { .dt_id
= TEGRA210_CLK_PLL_U_OUT1
, .present
= true },
2136 [tegra_clk_pll_u_out2
] = { .dt_id
= TEGRA210_CLK_PLL_U_OUT2
, .present
= true },
2137 [tegra_clk_pll_u_480m
] = { .dt_id
= TEGRA210_CLK_PLL_U_480M
, .present
= true },
2138 [tegra_clk_pll_u_60m
] = { .dt_id
= TEGRA210_CLK_PLL_U_60M
, .present
= true },
2139 [tegra_clk_pll_u_48m
] = { .dt_id
= TEGRA210_CLK_PLL_U_48M
, .present
= true },
2140 [tegra_clk_pll_x
] = { .dt_id
= TEGRA210_CLK_PLL_X
, .present
= true },
2141 [tegra_clk_pll_x_out0
] = { .dt_id
= TEGRA210_CLK_PLL_X_OUT0
, .present
= true },
2142 [tegra_clk_pll_re_vco
] = { .dt_id
= TEGRA210_CLK_PLL_RE_VCO
, .present
= true },
2143 [tegra_clk_pll_re_out
] = { .dt_id
= TEGRA210_CLK_PLL_RE_OUT
, .present
= true },
2144 [tegra_clk_spdif_in_sync
] = { .dt_id
= TEGRA210_CLK_SPDIF_IN_SYNC
, .present
= true },
2145 [tegra_clk_i2s0_sync
] = { .dt_id
= TEGRA210_CLK_I2S0_SYNC
, .present
= true },
2146 [tegra_clk_i2s1_sync
] = { .dt_id
= TEGRA210_CLK_I2S1_SYNC
, .present
= true },
2147 [tegra_clk_i2s2_sync
] = { .dt_id
= TEGRA210_CLK_I2S2_SYNC
, .present
= true },
2148 [tegra_clk_i2s3_sync
] = { .dt_id
= TEGRA210_CLK_I2S3_SYNC
, .present
= true },
2149 [tegra_clk_i2s4_sync
] = { .dt_id
= TEGRA210_CLK_I2S4_SYNC
, .present
= true },
2150 [tegra_clk_vimclk_sync
] = { .dt_id
= TEGRA210_CLK_VIMCLK_SYNC
, .present
= true },
2151 [tegra_clk_audio0
] = { .dt_id
= TEGRA210_CLK_AUDIO0
, .present
= true },
2152 [tegra_clk_audio1
] = { .dt_id
= TEGRA210_CLK_AUDIO1
, .present
= true },
2153 [tegra_clk_audio2
] = { .dt_id
= TEGRA210_CLK_AUDIO2
, .present
= true },
2154 [tegra_clk_audio3
] = { .dt_id
= TEGRA210_CLK_AUDIO3
, .present
= true },
2155 [tegra_clk_audio4
] = { .dt_id
= TEGRA210_CLK_AUDIO4
, .present
= true },
2156 [tegra_clk_spdif
] = { .dt_id
= TEGRA210_CLK_SPDIF
, .present
= true },
2157 [tegra_clk_clk_out_1
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_1
, .present
= true },
2158 [tegra_clk_clk_out_2
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_2
, .present
= true },
2159 [tegra_clk_clk_out_3
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_3
, .present
= true },
2160 [tegra_clk_blink
] = { .dt_id
= TEGRA210_CLK_BLINK
, .present
= true },
2161 [tegra_clk_xusb_gate
] = { .dt_id
= TEGRA210_CLK_XUSB_GATE
, .present
= true },
2162 [tegra_clk_xusb_host_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_HOST_SRC
, .present
= true },
2163 [tegra_clk_xusb_falcon_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_FALCON_SRC
, .present
= true },
2164 [tegra_clk_xusb_fs_src
] = { .dt_id
= TEGRA210_CLK_XUSB_FS_SRC
, .present
= true },
2165 [tegra_clk_xusb_ss_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_SS_SRC
, .present
= true },
2166 [tegra_clk_xusb_ss_div2
] = { .dt_id
= TEGRA210_CLK_XUSB_SS_DIV2
, .present
= true },
2167 [tegra_clk_xusb_dev_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_DEV_SRC
, .present
= true },
2168 [tegra_clk_xusb_dev
] = { .dt_id
= TEGRA210_CLK_XUSB_DEV
, .present
= true },
2169 [tegra_clk_xusb_hs_src_4
] = { .dt_id
= TEGRA210_CLK_XUSB_HS_SRC
, .present
= true },
2170 [tegra_clk_xusb_ssp_src
] = { .dt_id
= TEGRA210_CLK_XUSB_SSP_SRC
, .present
= true },
2171 [tegra_clk_usb2_hsic_trk
] = { .dt_id
= TEGRA210_CLK_USB2_HSIC_TRK
, .present
= true },
2172 [tegra_clk_hsic_trk
] = { .dt_id
= TEGRA210_CLK_HSIC_TRK
, .present
= true },
2173 [tegra_clk_usb2_trk
] = { .dt_id
= TEGRA210_CLK_USB2_TRK
, .present
= true },
2174 [tegra_clk_sclk
] = { .dt_id
= TEGRA210_CLK_SCLK
, .present
= true },
2175 [tegra_clk_sclk_mux
] = { .dt_id
= TEGRA210_CLK_SCLK_MUX
, .present
= true },
2176 [tegra_clk_hclk
] = { .dt_id
= TEGRA210_CLK_HCLK
, .present
= true },
2177 [tegra_clk_pclk
] = { .dt_id
= TEGRA210_CLK_PCLK
, .present
= true },
2178 [tegra_clk_cclk_g
] = { .dt_id
= TEGRA210_CLK_CCLK_G
, .present
= true },
2179 [tegra_clk_cclk_lp
] = { .dt_id
= TEGRA210_CLK_CCLK_LP
, .present
= true },
2180 [tegra_clk_dfll_ref
] = { .dt_id
= TEGRA210_CLK_DFLL_REF
, .present
= true },
2181 [tegra_clk_dfll_soc
] = { .dt_id
= TEGRA210_CLK_DFLL_SOC
, .present
= true },
2182 [tegra_clk_vi_sensor2_8
] = { .dt_id
= TEGRA210_CLK_VI_SENSOR2
, .present
= true },
2183 [tegra_clk_pll_p_out5
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT5
, .present
= true },
2184 [tegra_clk_pll_c4
] = { .dt_id
= TEGRA210_CLK_PLL_C4
, .present
= true },
2185 [tegra_clk_pll_dp
] = { .dt_id
= TEGRA210_CLK_PLL_DP
, .present
= true },
2186 [tegra_clk_audio0_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO0_MUX
, .present
= true },
2187 [tegra_clk_audio1_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO1_MUX
, .present
= true },
2188 [tegra_clk_audio2_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO2_MUX
, .present
= true },
2189 [tegra_clk_audio3_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO3_MUX
, .present
= true },
2190 [tegra_clk_audio4_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO4_MUX
, .present
= true },
2191 [tegra_clk_spdif_mux
] = { .dt_id
= TEGRA210_CLK_SPDIF_MUX
, .present
= true },
2192 [tegra_clk_clk_out_1_mux
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_1_MUX
, .present
= true },
2193 [tegra_clk_clk_out_2_mux
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_2_MUX
, .present
= true },
2194 [tegra_clk_clk_out_3_mux
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_3_MUX
, .present
= true },
2195 [tegra_clk_maud
] = { .dt_id
= TEGRA210_CLK_MAUD
, .present
= true },
2196 [tegra_clk_mipibif
] = { .dt_id
= TEGRA210_CLK_MIPIBIF
, .present
= true },
2197 [tegra_clk_qspi
] = { .dt_id
= TEGRA210_CLK_QSPI
, .present
= true },
2198 [tegra_clk_sdmmc_legacy
] = { .dt_id
= TEGRA210_CLK_SDMMC_LEGACY
, .present
= true },
2199 [tegra_clk_tsecb
] = { .dt_id
= TEGRA210_CLK_TSECB
, .present
= true },
2200 [tegra_clk_uartape
] = { .dt_id
= TEGRA210_CLK_UARTAPE
, .present
= true },
2201 [tegra_clk_vi_i2c
] = { .dt_id
= TEGRA210_CLK_VI_I2C
, .present
= true },
2202 [tegra_clk_ape
] = { .dt_id
= TEGRA210_CLK_APE
, .present
= true },
2203 [tegra_clk_dbgapb
] = { .dt_id
= TEGRA210_CLK_DBGAPB
, .present
= true },
2204 [tegra_clk_nvdec
] = { .dt_id
= TEGRA210_CLK_NVDEC
, .present
= true },
2205 [tegra_clk_nvenc
] = { .dt_id
= TEGRA210_CLK_NVENC
, .present
= true },
2206 [tegra_clk_nvjpg
] = { .dt_id
= TEGRA210_CLK_NVJPG
, .present
= true },
2207 [tegra_clk_pll_c4_out0
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT0
, .present
= true },
2208 [tegra_clk_pll_c4_out1
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT1
, .present
= true },
2209 [tegra_clk_pll_c4_out2
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT2
, .present
= true },
2210 [tegra_clk_pll_c4_out3
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT3
, .present
= true },
2211 [tegra_clk_apb2ape
] = { .dt_id
= TEGRA210_CLK_APB2APE
, .present
= true },
2214 static struct tegra_devclk devclks
[] __initdata
= {
2215 { .con_id
= "clk_m", .dt_id
= TEGRA210_CLK_CLK_M
},
2216 { .con_id
= "pll_ref", .dt_id
= TEGRA210_CLK_PLL_REF
},
2217 { .con_id
= "clk_32k", .dt_id
= TEGRA210_CLK_CLK_32K
},
2218 { .con_id
= "clk_m_div2", .dt_id
= TEGRA210_CLK_CLK_M_DIV2
},
2219 { .con_id
= "clk_m_div4", .dt_id
= TEGRA210_CLK_CLK_M_DIV4
},
2220 { .con_id
= "pll_c", .dt_id
= TEGRA210_CLK_PLL_C
},
2221 { .con_id
= "pll_c_out1", .dt_id
= TEGRA210_CLK_PLL_C_OUT1
},
2222 { .con_id
= "pll_c2", .dt_id
= TEGRA210_CLK_PLL_C2
},
2223 { .con_id
= "pll_c3", .dt_id
= TEGRA210_CLK_PLL_C3
},
2224 { .con_id
= "pll_p", .dt_id
= TEGRA210_CLK_PLL_P
},
2225 { .con_id
= "pll_p_out1", .dt_id
= TEGRA210_CLK_PLL_P_OUT1
},
2226 { .con_id
= "pll_p_out2", .dt_id
= TEGRA210_CLK_PLL_P_OUT2
},
2227 { .con_id
= "pll_p_out3", .dt_id
= TEGRA210_CLK_PLL_P_OUT3
},
2228 { .con_id
= "pll_p_out4", .dt_id
= TEGRA210_CLK_PLL_P_OUT4
},
2229 { .con_id
= "pll_m", .dt_id
= TEGRA210_CLK_PLL_M
},
2230 { .con_id
= "pll_m_out1", .dt_id
= TEGRA210_CLK_PLL_M_OUT1
},
2231 { .con_id
= "pll_x", .dt_id
= TEGRA210_CLK_PLL_X
},
2232 { .con_id
= "pll_x_out0", .dt_id
= TEGRA210_CLK_PLL_X_OUT0
},
2233 { .con_id
= "pll_u", .dt_id
= TEGRA210_CLK_PLL_U
},
2234 { .con_id
= "pll_u_out", .dt_id
= TEGRA210_CLK_PLL_U_OUT
},
2235 { .con_id
= "pll_u_out1", .dt_id
= TEGRA210_CLK_PLL_U_OUT1
},
2236 { .con_id
= "pll_u_out2", .dt_id
= TEGRA210_CLK_PLL_U_OUT2
},
2237 { .con_id
= "pll_u_480M", .dt_id
= TEGRA210_CLK_PLL_U_480M
},
2238 { .con_id
= "pll_u_60M", .dt_id
= TEGRA210_CLK_PLL_U_60M
},
2239 { .con_id
= "pll_u_48M", .dt_id
= TEGRA210_CLK_PLL_U_48M
},
2240 { .con_id
= "pll_d", .dt_id
= TEGRA210_CLK_PLL_D
},
2241 { .con_id
= "pll_d_out0", .dt_id
= TEGRA210_CLK_PLL_D_OUT0
},
2242 { .con_id
= "pll_d2", .dt_id
= TEGRA210_CLK_PLL_D2
},
2243 { .con_id
= "pll_d2_out0", .dt_id
= TEGRA210_CLK_PLL_D2_OUT0
},
2244 { .con_id
= "pll_a", .dt_id
= TEGRA210_CLK_PLL_A
},
2245 { .con_id
= "pll_a_out0", .dt_id
= TEGRA210_CLK_PLL_A_OUT0
},
2246 { .con_id
= "pll_re_vco", .dt_id
= TEGRA210_CLK_PLL_RE_VCO
},
2247 { .con_id
= "pll_re_out", .dt_id
= TEGRA210_CLK_PLL_RE_OUT
},
2248 { .con_id
= "spdif_in_sync", .dt_id
= TEGRA210_CLK_SPDIF_IN_SYNC
},
2249 { .con_id
= "i2s0_sync", .dt_id
= TEGRA210_CLK_I2S0_SYNC
},
2250 { .con_id
= "i2s1_sync", .dt_id
= TEGRA210_CLK_I2S1_SYNC
},
2251 { .con_id
= "i2s2_sync", .dt_id
= TEGRA210_CLK_I2S2_SYNC
},
2252 { .con_id
= "i2s3_sync", .dt_id
= TEGRA210_CLK_I2S3_SYNC
},
2253 { .con_id
= "i2s4_sync", .dt_id
= TEGRA210_CLK_I2S4_SYNC
},
2254 { .con_id
= "vimclk_sync", .dt_id
= TEGRA210_CLK_VIMCLK_SYNC
},
2255 { .con_id
= "audio0", .dt_id
= TEGRA210_CLK_AUDIO0
},
2256 { .con_id
= "audio1", .dt_id
= TEGRA210_CLK_AUDIO1
},
2257 { .con_id
= "audio2", .dt_id
= TEGRA210_CLK_AUDIO2
},
2258 { .con_id
= "audio3", .dt_id
= TEGRA210_CLK_AUDIO3
},
2259 { .con_id
= "audio4", .dt_id
= TEGRA210_CLK_AUDIO4
},
2260 { .con_id
= "spdif", .dt_id
= TEGRA210_CLK_SPDIF
},
2261 { .con_id
= "spdif_2x", .dt_id
= TEGRA210_CLK_SPDIF_2X
},
2262 { .con_id
= "extern1", .dev_id
= "clk_out_1", .dt_id
= TEGRA210_CLK_EXTERN1
},
2263 { .con_id
= "extern2", .dev_id
= "clk_out_2", .dt_id
= TEGRA210_CLK_EXTERN2
},
2264 { .con_id
= "extern3", .dev_id
= "clk_out_3", .dt_id
= TEGRA210_CLK_EXTERN3
},
2265 { .con_id
= "blink", .dt_id
= TEGRA210_CLK_BLINK
},
2266 { .con_id
= "cclk_g", .dt_id
= TEGRA210_CLK_CCLK_G
},
2267 { .con_id
= "cclk_lp", .dt_id
= TEGRA210_CLK_CCLK_LP
},
2268 { .con_id
= "sclk", .dt_id
= TEGRA210_CLK_SCLK
},
2269 { .con_id
= "hclk", .dt_id
= TEGRA210_CLK_HCLK
},
2270 { .con_id
= "pclk", .dt_id
= TEGRA210_CLK_PCLK
},
2271 { .con_id
= "fuse", .dt_id
= TEGRA210_CLK_FUSE
},
2272 { .dev_id
= "rtc-tegra", .dt_id
= TEGRA210_CLK_RTC
},
2273 { .dev_id
= "timer", .dt_id
= TEGRA210_CLK_TIMER
},
2274 { .con_id
= "pll_c4_out0", .dt_id
= TEGRA210_CLK_PLL_C4_OUT0
},
2275 { .con_id
= "pll_c4_out1", .dt_id
= TEGRA210_CLK_PLL_C4_OUT1
},
2276 { .con_id
= "pll_c4_out2", .dt_id
= TEGRA210_CLK_PLL_C4_OUT2
},
2277 { .con_id
= "pll_c4_out3", .dt_id
= TEGRA210_CLK_PLL_C4_OUT3
},
2278 { .con_id
= "dpaux", .dt_id
= TEGRA210_CLK_DPAUX
},
2279 { .con_id
= "sor0", .dt_id
= TEGRA210_CLK_SOR0
},
2282 static struct tegra_audio_clk_info tegra210_audio_plls
[] = {
2283 { "pll_a", &pll_a_params
, tegra_clk_pll_a
, "pll_ref" },
2284 { "pll_a1", &pll_a1_params
, tegra_clk_pll_a1
, "pll_ref" },
2287 static struct clk
**clks
;
2289 static __init
void tegra210_periph_clk_init(void __iomem
*clk_base
,
2290 void __iomem
*pmc_base
)
2295 clk
= clk_register_fixed_factor(NULL
, "xusb_ss_div2", "xusb_ss_src", 0,
2297 clks
[TEGRA210_CLK_XUSB_SS_DIV2
] = clk
;
2299 clk
= tegra_clk_register_periph_fixed("sor_safe", "pll_p", 0, clk_base
,
2301 clks
[TEGRA210_CLK_SOR_SAFE
] = clk
;
2303 clk
= tegra_clk_register_periph_fixed("dpaux", "sor_safe", 0, clk_base
,
2305 clks
[TEGRA210_CLK_DPAUX
] = clk
;
2307 clk
= tegra_clk_register_periph_fixed("dpaux1", "sor_safe", 0, clk_base
,
2309 clks
[TEGRA210_CLK_DPAUX1
] = clk
;
2312 clk
= clk_register_gate(NULL
, "pll_d_dsi_out", "pll_d_out0", 0,
2313 clk_base
+ PLLD_MISC0
, 21, 0, &pll_d_lock
);
2314 clks
[TEGRA210_CLK_PLL_D_DSI_OUT
] = clk
;
2317 clk
= tegra_clk_register_periph_gate("dsia", "pll_d_dsi_out", 0,
2319 periph_clk_enb_refcnt
);
2320 clks
[TEGRA210_CLK_DSIA
] = clk
;
2323 clk
= tegra_clk_register_periph_gate("dsib", "pll_d_dsi_out", 0,
2325 periph_clk_enb_refcnt
);
2326 clks
[TEGRA210_CLK_DSIB
] = clk
;
2329 clk
= clk_register_mux(NULL
, "emc_mux", mux_pllmcp_clkm
,
2330 ARRAY_SIZE(mux_pllmcp_clkm
), 0,
2331 clk_base
+ CLK_SOURCE_EMC
,
2332 29, 3, 0, &emc_lock
);
2334 clk
= tegra_clk_register_mc("mc", "emc_mux", clk_base
+ CLK_SOURCE_EMC
,
2336 clks
[TEGRA210_CLK_MC
] = clk
;
2339 clk
= clk_register_gate(NULL
, "cml0", "pll_e", 0, clk_base
+ PLLE_AUX
,
2341 clk_register_clkdev(clk
, "cml0", NULL
);
2342 clks
[TEGRA210_CLK_CML0
] = clk
;
2345 clk
= clk_register_gate(NULL
, "cml1", "pll_e", 0, clk_base
+ PLLE_AUX
,
2347 clk_register_clkdev(clk
, "cml1", NULL
);
2348 clks
[TEGRA210_CLK_CML1
] = clk
;
2350 tegra_periph_clk_init(clk_base
, pmc_base
, tegra210_clks
, &pll_p_params
);
2353 static void __init
tegra210_pll_init(void __iomem
*clk_base
,
2359 clk
= tegra_clk_register_pllxc_tegra210("pll_c", "pll_ref", clk_base
,
2360 pmc
, 0, &pll_c_params
, NULL
);
2361 if (!WARN_ON(IS_ERR(clk
)))
2362 clk_register_clkdev(clk
, "pll_c", NULL
);
2363 clks
[TEGRA210_CLK_PLL_C
] = clk
;
2366 clk
= tegra_clk_register_divider("pll_c_out1_div", "pll_c",
2367 clk_base
+ PLLC_OUT
, 0, TEGRA_DIVIDER_ROUND_UP
,
2369 clk
= tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
2370 clk_base
+ PLLC_OUT
, 1, 0,
2371 CLK_SET_RATE_PARENT
, 0, NULL
);
2372 clk_register_clkdev(clk
, "pll_c_out1", NULL
);
2373 clks
[TEGRA210_CLK_PLL_C_OUT1
] = clk
;
2376 clk
= clk_register_fixed_factor(NULL
, "pll_c_ud", "pll_c",
2377 CLK_SET_RATE_PARENT
, 1, 1);
2378 clk_register_clkdev(clk
, "pll_c_ud", NULL
);
2379 clks
[TEGRA210_CLK_PLL_C_UD
] = clk
;
2382 clk
= tegra_clk_register_pllc_tegra210("pll_c2", "pll_ref", clk_base
,
2383 pmc
, 0, &pll_c2_params
, NULL
);
2384 clk_register_clkdev(clk
, "pll_c2", NULL
);
2385 clks
[TEGRA210_CLK_PLL_C2
] = clk
;
2388 clk
= tegra_clk_register_pllc_tegra210("pll_c3", "pll_ref", clk_base
,
2389 pmc
, 0, &pll_c3_params
, NULL
);
2390 clk_register_clkdev(clk
, "pll_c3", NULL
);
2391 clks
[TEGRA210_CLK_PLL_C3
] = clk
;
2394 clk
= tegra_clk_register_pllm("pll_m", "osc", clk_base
, pmc
,
2395 CLK_SET_RATE_GATE
, &pll_m_params
, NULL
);
2396 clk_register_clkdev(clk
, "pll_m", NULL
);
2397 clks
[TEGRA210_CLK_PLL_M
] = clk
;
2400 clk
= tegra_clk_register_pllmb("pll_mb", "osc", clk_base
, pmc
,
2401 CLK_SET_RATE_GATE
, &pll_mb_params
, NULL
);
2402 clk_register_clkdev(clk
, "pll_mb", NULL
);
2403 clks
[TEGRA210_CLK_PLL_MB
] = clk
;
2405 clk_register_clkdev(clk
, "pll_m_out1", NULL
);
2406 clks
[TEGRA210_CLK_PLL_M_OUT1
] = clk
;
2409 clk
= clk_register_fixed_factor(NULL
, "pll_m_ud", "pll_m",
2410 CLK_SET_RATE_PARENT
, 1, 1);
2411 clk_register_clkdev(clk
, "pll_m_ud", NULL
);
2412 clks
[TEGRA210_CLK_PLL_M_UD
] = clk
;
2415 clk
= tegra_clk_register_pllu_tegra210("pll_u_vco", "pll_ref",
2416 clk_base
, 0, &pll_u_vco_params
,
2418 clk_register_clkdev(clk
, "pll_u_vco", NULL
);
2419 clks
[TEGRA210_CLK_PLL_U
] = clk
;
2422 clk
= clk_register_divider_table(NULL
, "pll_u_out", "pll_u_vco", 0,
2423 clk_base
+ PLLU_BASE
, 16, 4, 0,
2424 pll_vco_post_div_table
, NULL
);
2425 clk_register_clkdev(clk
, "pll_u_out", NULL
);
2426 clks
[TEGRA210_CLK_PLL_U_OUT
] = clk
;
2429 clk
= tegra_clk_register_divider("pll_u_out1_div", "pll_u_out",
2430 clk_base
+ PLLU_OUTA
, 0,
2431 TEGRA_DIVIDER_ROUND_UP
,
2432 8, 8, 1, &pll_u_lock
);
2433 clk
= tegra_clk_register_pll_out("pll_u_out1", "pll_u_out1_div",
2434 clk_base
+ PLLU_OUTA
, 1, 0,
2435 CLK_SET_RATE_PARENT
, 0, &pll_u_lock
);
2436 clk_register_clkdev(clk
, "pll_u_out1", NULL
);
2437 clks
[TEGRA210_CLK_PLL_U_OUT1
] = clk
;
2440 clk
= tegra_clk_register_divider("pll_u_out2_div", "pll_u_out",
2441 clk_base
+ PLLU_OUTA
, 0,
2442 TEGRA_DIVIDER_ROUND_UP
,
2443 24, 8, 1, &pll_u_lock
);
2444 clk
= tegra_clk_register_pll_out("pll_u_out2", "pll_u_out2_div",
2445 clk_base
+ PLLU_OUTA
, 17, 16,
2446 CLK_SET_RATE_PARENT
, 0, &pll_u_lock
);
2447 clk_register_clkdev(clk
, "pll_u_out2", NULL
);
2448 clks
[TEGRA210_CLK_PLL_U_OUT2
] = clk
;
2451 clk
= clk_register_gate(NULL
, "pll_u_480M", "pll_u_vco",
2452 CLK_SET_RATE_PARENT
, clk_base
+ PLLU_BASE
,
2453 22, 0, &pll_u_lock
);
2454 clk_register_clkdev(clk
, "pll_u_480M", NULL
);
2455 clks
[TEGRA210_CLK_PLL_U_480M
] = clk
;
2458 clk
= clk_register_gate(NULL
, "pll_u_60M", "pll_u_out2",
2459 CLK_SET_RATE_PARENT
, clk_base
+ PLLU_BASE
,
2461 clk_register_clkdev(clk
, "pll_u_60M", NULL
);
2462 clks
[TEGRA210_CLK_PLL_U_60M
] = clk
;
2465 clk
= clk_register_gate(NULL
, "pll_u_48M", "pll_u_out1",
2466 CLK_SET_RATE_PARENT
, clk_base
+ PLLU_BASE
,
2468 clk_register_clkdev(clk
, "pll_u_48M", NULL
);
2469 clks
[TEGRA210_CLK_PLL_U_48M
] = clk
;
2472 clk
= tegra_clk_register_pll("pll_d", "pll_ref", clk_base
, pmc
, 0,
2473 &pll_d_params
, &pll_d_lock
);
2474 clk_register_clkdev(clk
, "pll_d", NULL
);
2475 clks
[TEGRA210_CLK_PLL_D
] = clk
;
2478 clk
= clk_register_fixed_factor(NULL
, "pll_d_out0", "pll_d",
2479 CLK_SET_RATE_PARENT
, 1, 2);
2480 clk_register_clkdev(clk
, "pll_d_out0", NULL
);
2481 clks
[TEGRA210_CLK_PLL_D_OUT0
] = clk
;
2484 clk
= tegra_clk_register_pllre_tegra210("pll_re_vco", "pll_ref",
2487 &pll_re_lock
, pll_ref_freq
);
2488 clk_register_clkdev(clk
, "pll_re_vco", NULL
);
2489 clks
[TEGRA210_CLK_PLL_RE_VCO
] = clk
;
2491 clk
= clk_register_divider_table(NULL
, "pll_re_out", "pll_re_vco", 0,
2492 clk_base
+ PLLRE_BASE
, 16, 5, 0,
2493 pll_vco_post_div_table
, &pll_re_lock
);
2494 clk_register_clkdev(clk
, "pll_re_out", NULL
);
2495 clks
[TEGRA210_CLK_PLL_RE_OUT
] = clk
;
2497 clk
= tegra_clk_register_divider("pll_re_out1_div", "pll_re_vco",
2498 clk_base
+ PLLRE_OUT1
, 0,
2499 TEGRA_DIVIDER_ROUND_UP
,
2501 clk
= tegra_clk_register_pll_out("pll_re_out1", "pll_re_out1_div",
2502 clk_base
+ PLLRE_OUT1
, 1, 0,
2503 CLK_SET_RATE_PARENT
, 0, NULL
);
2504 clks
[TEGRA210_CLK_PLL_RE_OUT1
] = clk
;
2507 clk
= tegra_clk_register_plle_tegra210("pll_e", "pll_ref",
2508 clk_base
, 0, &pll_e_params
, NULL
);
2509 clk_register_clkdev(clk
, "pll_e", NULL
);
2510 clks
[TEGRA210_CLK_PLL_E
] = clk
;
2513 clk
= tegra_clk_register_pllre("pll_c4_vco", "pll_ref", clk_base
, pmc
,
2514 0, &pll_c4_vco_params
, NULL
, pll_ref_freq
);
2515 clk_register_clkdev(clk
, "pll_c4_vco", NULL
);
2516 clks
[TEGRA210_CLK_PLL_C4
] = clk
;
2519 clk
= clk_register_divider_table(NULL
, "pll_c4_out0", "pll_c4_vco", 0,
2520 clk_base
+ PLLC4_BASE
, 19, 4, 0,
2521 pll_vco_post_div_table
, NULL
);
2522 clk_register_clkdev(clk
, "pll_c4_out0", NULL
);
2523 clks
[TEGRA210_CLK_PLL_C4_OUT0
] = clk
;
2526 clk
= clk_register_fixed_factor(NULL
, "pll_c4_out1", "pll_c4_vco",
2527 CLK_SET_RATE_PARENT
, 1, 3);
2528 clk_register_clkdev(clk
, "pll_c4_out1", NULL
);
2529 clks
[TEGRA210_CLK_PLL_C4_OUT1
] = clk
;
2532 clk
= clk_register_fixed_factor(NULL
, "pll_c4_out2", "pll_c4_vco",
2533 CLK_SET_RATE_PARENT
, 1, 5);
2534 clk_register_clkdev(clk
, "pll_c4_out2", NULL
);
2535 clks
[TEGRA210_CLK_PLL_C4_OUT2
] = clk
;
2538 clk
= tegra_clk_register_divider("pll_c4_out3_div", "pll_c4_out0",
2539 clk_base
+ PLLC4_OUT
, 0, TEGRA_DIVIDER_ROUND_UP
,
2541 clk
= tegra_clk_register_pll_out("pll_c4_out3", "pll_c4_out3_div",
2542 clk_base
+ PLLC4_OUT
, 1, 0,
2543 CLK_SET_RATE_PARENT
, 0, NULL
);
2544 clk_register_clkdev(clk
, "pll_c4_out3", NULL
);
2545 clks
[TEGRA210_CLK_PLL_C4_OUT3
] = clk
;
2548 clk
= tegra_clk_register_pllss_tegra210("pll_dp", "pll_ref", clk_base
,
2549 0, &pll_dp_params
, NULL
);
2550 clk_register_clkdev(clk
, "pll_dp", NULL
);
2551 clks
[TEGRA210_CLK_PLL_DP
] = clk
;
2554 clk
= tegra_clk_register_pllss_tegra210("pll_d2", "pll_ref", clk_base
,
2555 0, &pll_d2_params
, NULL
);
2556 clk_register_clkdev(clk
, "pll_d2", NULL
);
2557 clks
[TEGRA210_CLK_PLL_D2
] = clk
;
2560 clk
= clk_register_fixed_factor(NULL
, "pll_d2_out0", "pll_d2",
2561 CLK_SET_RATE_PARENT
, 1, 1);
2562 clk_register_clkdev(clk
, "pll_d2_out0", NULL
);
2563 clks
[TEGRA210_CLK_PLL_D2_OUT0
] = clk
;
2566 clk
= clk_register_fixed_factor(NULL
, "pll_p_out2", "pll_p",
2567 CLK_SET_RATE_PARENT
, 1, 2);
2568 clk_register_clkdev(clk
, "pll_p_out2", NULL
);
2569 clks
[TEGRA210_CLK_PLL_P_OUT2
] = clk
;
2573 /* Tegra210 CPU clock and reset control functions */
2574 static void tegra210_wait_cpu_in_reset(u32 cpu
)
2579 reg
= readl(clk_base
+ CLK_RST_CONTROLLER_CPU_CMPLX_STATUS
);
2581 } while (!(reg
& (1 << cpu
))); /* check CPU been reset or not */
2584 static void tegra210_disable_cpu_clock(u32 cpu
)
2586 /* flow controller would take care in the power sequence. */
2589 #ifdef CONFIG_PM_SLEEP
2590 static void tegra210_cpu_clock_suspend(void)
2592 /* switch coresite to clk_m, save off original source */
2593 tegra210_cpu_clk_sctx
.clk_csite_src
=
2594 readl(clk_base
+ CLK_SOURCE_CSITE
);
2595 writel(3 << 30, clk_base
+ CLK_SOURCE_CSITE
);
2598 static void tegra210_cpu_clock_resume(void)
2600 writel(tegra210_cpu_clk_sctx
.clk_csite_src
,
2601 clk_base
+ CLK_SOURCE_CSITE
);
2605 static struct tegra_cpu_car_ops tegra210_cpu_car_ops
= {
2606 .wait_for_reset
= tegra210_wait_cpu_in_reset
,
2607 .disable_clock
= tegra210_disable_cpu_clock
,
2608 #ifdef CONFIG_PM_SLEEP
2609 .suspend
= tegra210_cpu_clock_suspend
,
2610 .resume
= tegra210_cpu_clock_resume
,
2614 static const struct of_device_id pmc_match
[] __initconst
= {
2615 { .compatible
= "nvidia,tegra210-pmc" },
2619 static struct tegra_clk_init_table init_table
[] __initdata
= {
2620 { TEGRA210_CLK_UARTA
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
2621 { TEGRA210_CLK_UARTB
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
2622 { TEGRA210_CLK_UARTC
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
2623 { TEGRA210_CLK_UARTD
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
2624 { TEGRA210_CLK_PLL_A
, TEGRA210_CLK_CLK_MAX
, 564480000, 1 },
2625 { TEGRA210_CLK_PLL_A_OUT0
, TEGRA210_CLK_CLK_MAX
, 11289600, 1 },
2626 { TEGRA210_CLK_EXTERN1
, TEGRA210_CLK_PLL_A_OUT0
, 0, 1 },
2627 { TEGRA210_CLK_CLK_OUT_1_MUX
, TEGRA210_CLK_EXTERN1
, 0, 1 },
2628 { TEGRA210_CLK_CLK_OUT_1
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
2629 { TEGRA210_CLK_I2S0
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
2630 { TEGRA210_CLK_I2S1
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
2631 { TEGRA210_CLK_I2S2
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
2632 { TEGRA210_CLK_I2S3
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
2633 { TEGRA210_CLK_I2S4
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
2634 { TEGRA210_CLK_HOST1X
, TEGRA210_CLK_PLL_P
, 136000000, 1 },
2635 { TEGRA210_CLK_SCLK_MUX
, TEGRA210_CLK_PLL_P
, 0, 1 },
2636 { TEGRA210_CLK_SCLK
, TEGRA210_CLK_CLK_MAX
, 102000000, 1 },
2637 { TEGRA210_CLK_DFLL_SOC
, TEGRA210_CLK_PLL_P
, 51000000, 1 },
2638 { TEGRA210_CLK_DFLL_REF
, TEGRA210_CLK_PLL_P
, 51000000, 1 },
2639 { TEGRA210_CLK_SBC4
, TEGRA210_CLK_PLL_P
, 12000000, 1 },
2640 { TEGRA210_CLK_PLL_RE_VCO
, TEGRA210_CLK_CLK_MAX
, 672000000, 1 },
2641 { TEGRA210_CLK_XUSB_GATE
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
2642 { TEGRA210_CLK_XUSB_SS_SRC
, TEGRA210_CLK_PLL_U_480M
, 120000000, 0 },
2643 { TEGRA210_CLK_XUSB_FS_SRC
, TEGRA210_CLK_PLL_U_48M
, 48000000, 0 },
2644 { TEGRA210_CLK_XUSB_HS_SRC
, TEGRA210_CLK_XUSB_SS_SRC
, 120000000, 0 },
2645 { TEGRA210_CLK_XUSB_SSP_SRC
, TEGRA210_CLK_XUSB_SS_SRC
, 120000000, 0 },
2646 { TEGRA210_CLK_XUSB_FALCON_SRC
, TEGRA210_CLK_PLL_P_OUT_XUSB
, 204000000, 0 },
2647 { TEGRA210_CLK_XUSB_HOST_SRC
, TEGRA210_CLK_PLL_P_OUT_XUSB
, 102000000, 0 },
2648 { TEGRA210_CLK_XUSB_DEV_SRC
, TEGRA210_CLK_PLL_P_OUT_XUSB
, 102000000, 0 },
2649 { TEGRA210_CLK_SATA
, TEGRA210_CLK_PLL_P
, 104000000, 0 },
2650 { TEGRA210_CLK_SATA_OOB
, TEGRA210_CLK_PLL_P
, 204000000, 0 },
2651 { TEGRA210_CLK_EMC
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
2652 { TEGRA210_CLK_MSELECT
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
2653 { TEGRA210_CLK_CSITE
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
2654 { TEGRA210_CLK_TSENSOR
, TEGRA210_CLK_CLK_M
, 400000, 0 },
2655 { TEGRA210_CLK_I2C1
, TEGRA210_CLK_PLL_P
, 0, 0 },
2656 { TEGRA210_CLK_I2C2
, TEGRA210_CLK_PLL_P
, 0, 0 },
2657 { TEGRA210_CLK_I2C3
, TEGRA210_CLK_PLL_P
, 0, 0 },
2658 { TEGRA210_CLK_I2C4
, TEGRA210_CLK_PLL_P
, 0, 0 },
2659 { TEGRA210_CLK_I2C5
, TEGRA210_CLK_PLL_P
, 0, 0 },
2660 { TEGRA210_CLK_I2C6
, TEGRA210_CLK_PLL_P
, 0, 0 },
2661 { TEGRA210_CLK_PLL_DP
, TEGRA210_CLK_CLK_MAX
, 270000000, 0 },
2662 { TEGRA210_CLK_SOC_THERM
, TEGRA210_CLK_PLL_P
, 51000000, 0 },
2663 { TEGRA210_CLK_CCLK_G
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
2664 /* This MUST be the last entry. */
2665 { TEGRA210_CLK_CLK_MAX
, TEGRA210_CLK_CLK_MAX
, 0, 0 },
2669 * tegra210_clock_apply_init_table - initialize clocks on Tegra210 SoCs
2671 * Program an initial clock rate and enable or disable clocks needed
2672 * by the rest of the kernel, for Tegra210 SoCs. It is intended to be
2673 * called by assigning a pointer to it to tegra_clk_apply_init_table -
2674 * this will be called as an arch_initcall. No return value.
2676 static void __init
tegra210_clock_apply_init_table(void)
2678 tegra_init_from_table(init_table
, clks
, TEGRA210_CLK_CLK_MAX
);
2682 * tegra210_clock_init - Tegra210-specific clock initialization
2683 * @np: struct device_node * of the DT node for the SoC CAR IP block
2685 * Register most SoC clocks for the Tegra210 system-on-chip. Intended
2686 * to be called by the OF init code when a DT node with the
2687 * "nvidia,tegra210-car" string is encountered, and declared with
2688 * CLK_OF_DECLARE. No return value.
2690 static void __init
tegra210_clock_init(struct device_node
*np
)
2692 struct device_node
*node
;
2693 u32 value
, clk_m_div
;
2695 clk_base
= of_iomap(np
, 0);
2697 pr_err("ioremap tegra210 CAR failed\n");
2701 node
= of_find_matching_node(NULL
, pmc_match
);
2703 pr_err("Failed to find pmc node\n");
2708 pmc_base
= of_iomap(node
, 0);
2710 pr_err("Can't map pmc registers\n");
2715 clks
= tegra_clk_init(clk_base
, TEGRA210_CLK_CLK_MAX
,
2716 TEGRA210_CAR_BANK_COUNT
);
2720 value
= clk_readl(clk_base
+ SPARE_REG0
) >> CLK_M_DIVISOR_SHIFT
;
2721 clk_m_div
= (value
& CLK_M_DIVISOR_MASK
) + 1;
2723 if (tegra_osc_clk_init(clk_base
, tegra210_clks
, tegra210_input_freq
,
2724 ARRAY_SIZE(tegra210_input_freq
), clk_m_div
,
2725 &osc_freq
, &pll_ref_freq
) < 0)
2728 tegra_fixed_clk_init(tegra210_clks
);
2729 tegra210_pll_init(clk_base
, pmc_base
);
2730 tegra210_periph_clk_init(clk_base
, pmc_base
);
2731 tegra_audio_clk_init(clk_base
, pmc_base
, tegra210_clks
,
2732 tegra210_audio_plls
,
2733 ARRAY_SIZE(tegra210_audio_plls
));
2734 tegra_pmc_clk_init(pmc_base
, tegra210_clks
);
2736 /* For Tegra210, PLLD is the only source for DSIA & DSIB */
2737 value
= clk_readl(clk_base
+ PLLD_BASE
);
2739 clk_writel(value
, clk_base
+ PLLD_BASE
);
2741 tegra_clk_apply_init_table
= tegra210_clock_apply_init_table
;
2743 tegra_super_clk_gen5_init(clk_base
, pmc_base
, tegra210_clks
,
2745 tegra_add_of_provider(np
);
2746 tegra_register_devclks(devclks
, ARRAY_SIZE(devclks
));
2748 tegra_cpu_car_ops
= &tegra210_cpu_car_ops
;
2750 CLK_OF_DECLARE(tegra210
, "nvidia,tegra210-car", tegra210_clock_init
);