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>
27 #include <dt-bindings/reset/tegra210-car.h>
28 #include <linux/iopoll.h>
34 * TEGRA210_CAR_BANK_COUNT: the number of peripheral clock register
35 * banks present in the Tegra210 CAR IP block. The banks are
36 * identified by single letters, e.g.: L, H, U, V, W, X, Y. See
37 * periph_regs[] in drivers/clk/tegra/clk.c
39 #define TEGRA210_CAR_BANK_COUNT 7
41 #define CLK_SOURCE_CSITE 0x1d4
42 #define CLK_SOURCE_EMC 0x19c
43 #define CLK_SOURCE_SOR1 0x410
45 #define PLLC_BASE 0x80
47 #define PLLC_MISC0 0x88
48 #define PLLC_MISC1 0x8c
49 #define PLLC_MISC2 0x5d0
50 #define PLLC_MISC3 0x5d4
52 #define PLLC2_BASE 0x4e8
53 #define PLLC2_MISC0 0x4ec
54 #define PLLC2_MISC1 0x4f0
55 #define PLLC2_MISC2 0x4f4
56 #define PLLC2_MISC3 0x4f8
58 #define PLLC3_BASE 0x4fc
59 #define PLLC3_MISC0 0x500
60 #define PLLC3_MISC1 0x504
61 #define PLLC3_MISC2 0x508
62 #define PLLC3_MISC3 0x50c
64 #define PLLM_BASE 0x90
65 #define PLLM_MISC1 0x98
66 #define PLLM_MISC2 0x9c
67 #define PLLP_BASE 0xa0
68 #define PLLP_MISC0 0xac
69 #define PLLP_MISC1 0x680
70 #define PLLA_BASE 0xb0
71 #define PLLA_MISC0 0xbc
72 #define PLLA_MISC1 0xb8
73 #define PLLA_MISC2 0x5d8
74 #define PLLD_BASE 0xd0
75 #define PLLD_MISC0 0xdc
76 #define PLLD_MISC1 0xd8
77 #define PLLU_BASE 0xc0
78 #define PLLU_OUTA 0xc4
79 #define PLLU_MISC0 0xcc
80 #define PLLU_MISC1 0xc8
81 #define PLLX_BASE 0xe0
82 #define PLLX_MISC0 0xe4
83 #define PLLX_MISC1 0x510
84 #define PLLX_MISC2 0x514
85 #define PLLX_MISC3 0x518
86 #define PLLX_MISC4 0x5f0
87 #define PLLX_MISC5 0x5f4
88 #define PLLE_BASE 0xe8
89 #define PLLE_MISC0 0xec
90 #define PLLD2_BASE 0x4b8
91 #define PLLD2_MISC0 0x4bc
92 #define PLLD2_MISC1 0x570
93 #define PLLD2_MISC2 0x574
94 #define PLLD2_MISC3 0x578
95 #define PLLE_AUX 0x48c
96 #define PLLRE_BASE 0x4c4
97 #define PLLRE_MISC0 0x4c8
98 #define PLLRE_OUT1 0x4cc
99 #define PLLDP_BASE 0x590
100 #define PLLDP_MISC 0x594
102 #define PLLC4_BASE 0x5a4
103 #define PLLC4_MISC0 0x5a8
104 #define PLLC4_OUT 0x5e4
105 #define PLLMB_BASE 0x5e8
106 #define PLLMB_MISC1 0x5ec
107 #define PLLA1_BASE 0x6a4
108 #define PLLA1_MISC0 0x6a8
109 #define PLLA1_MISC1 0x6ac
110 #define PLLA1_MISC2 0x6b0
111 #define PLLA1_MISC3 0x6b4
113 #define PLLU_IDDQ_BIT 31
114 #define PLLCX_IDDQ_BIT 27
115 #define PLLRE_IDDQ_BIT 24
116 #define PLLA_IDDQ_BIT 25
117 #define PLLD_IDDQ_BIT 20
118 #define PLLSS_IDDQ_BIT 18
119 #define PLLM_IDDQ_BIT 5
120 #define PLLMB_IDDQ_BIT 17
121 #define PLLXP_IDDQ_BIT 3
123 #define PLLCX_RESET_BIT 30
125 #define PLL_BASE_LOCK BIT(27)
126 #define PLLCX_BASE_LOCK BIT(26)
127 #define PLLE_MISC_LOCK BIT(11)
128 #define PLLRE_MISC_LOCK BIT(27)
130 #define PLL_MISC_LOCK_ENABLE 18
131 #define PLLC_MISC_LOCK_ENABLE 24
132 #define PLLDU_MISC_LOCK_ENABLE 22
133 #define PLLU_MISC_LOCK_ENABLE 29
134 #define PLLE_MISC_LOCK_ENABLE 9
135 #define PLLRE_MISC_LOCK_ENABLE 30
136 #define PLLSS_MISC_LOCK_ENABLE 30
137 #define PLLP_MISC_LOCK_ENABLE 18
138 #define PLLM_MISC_LOCK_ENABLE 4
139 #define PLLMB_MISC_LOCK_ENABLE 16
140 #define PLLA_MISC_LOCK_ENABLE 28
141 #define PLLU_MISC_LOCK_ENABLE 29
142 #define PLLD_MISC_LOCK_ENABLE 18
144 #define PLLA_SDM_DIN_MASK 0xffff
145 #define PLLA_SDM_EN_MASK BIT(26)
147 #define PLLD_SDM_EN_MASK BIT(16)
149 #define PLLD2_SDM_EN_MASK BIT(31)
150 #define PLLD2_SSC_EN_MASK 0
152 #define PLLDP_SS_CFG 0x598
153 #define PLLDP_SDM_EN_MASK BIT(31)
154 #define PLLDP_SSC_EN_MASK BIT(30)
155 #define PLLDP_SS_CTRL1 0x59c
156 #define PLLDP_SS_CTRL2 0x5a0
158 #define PMC_PLLM_WB0_OVERRIDE 0x1dc
159 #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0
161 #define UTMIP_PLL_CFG2 0x488
162 #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xfff) << 6)
163 #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
164 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0)
165 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERUP BIT(1)
166 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2)
167 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERUP BIT(3)
168 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4)
169 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERUP BIT(5)
170 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_D_POWERDOWN BIT(24)
171 #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_D_POWERUP BIT(25)
173 #define UTMIP_PLL_CFG1 0x484
174 #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27)
175 #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0)
176 #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17)
177 #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16)
178 #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15)
179 #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14)
180 #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12)
182 #define SATA_PLL_CFG0 0x490
183 #define SATA_PLL_CFG0_PADPLL_RESET_SWCTL BIT(0)
184 #define SATA_PLL_CFG0_PADPLL_USE_LOCKDET BIT(2)
185 #define SATA_PLL_CFG0_SATA_SEQ_IN_SWCTL BIT(4)
186 #define SATA_PLL_CFG0_SATA_SEQ_RESET_INPUT_VALUE BIT(5)
187 #define SATA_PLL_CFG0_SATA_SEQ_LANE_PD_INPUT_VALUE BIT(6)
188 #define SATA_PLL_CFG0_SATA_SEQ_PADPLL_PD_INPUT_VALUE BIT(7)
190 #define SATA_PLL_CFG0_PADPLL_SLEEP_IDDQ BIT(13)
191 #define SATA_PLL_CFG0_SEQ_ENABLE BIT(24)
193 #define XUSBIO_PLL_CFG0 0x51c
194 #define XUSBIO_PLL_CFG0_PADPLL_RESET_SWCTL BIT(0)
195 #define XUSBIO_PLL_CFG0_CLK_ENABLE_SWCTL BIT(2)
196 #define XUSBIO_PLL_CFG0_PADPLL_USE_LOCKDET BIT(6)
197 #define XUSBIO_PLL_CFG0_PADPLL_SLEEP_IDDQ BIT(13)
198 #define XUSBIO_PLL_CFG0_SEQ_ENABLE BIT(24)
200 #define UTMIPLL_HW_PWRDN_CFG0 0x52c
201 #define UTMIPLL_HW_PWRDN_CFG0_UTMIPLL_LOCK BIT(31)
202 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25)
203 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24)
204 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE BIT(7)
205 #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6)
206 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5)
207 #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4)
208 #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2)
209 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1)
210 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0)
212 #define PLLU_HW_PWRDN_CFG0 0x530
213 #define PLLU_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE BIT(28)
214 #define PLLU_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24)
215 #define PLLU_HW_PWRDN_CFG0_USE_SWITCH_DETECT BIT(7)
216 #define PLLU_HW_PWRDN_CFG0_USE_LOCKDET BIT(6)
217 #define PLLU_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2)
218 #define PLLU_HW_PWRDN_CFG0_CLK_SWITCH_SWCTL BIT(0)
220 #define XUSB_PLL_CFG0 0x534
221 #define XUSB_PLL_CFG0_UTMIPLL_LOCK_DLY 0x3ff
222 #define XUSB_PLL_CFG0_PLLU_LOCK_DLY_MASK (0x3ff << 14)
224 #define SPARE_REG0 0x55c
225 #define CLK_M_DIVISOR_SHIFT 2
226 #define CLK_M_DIVISOR_MASK 0x3
228 #define RST_DFLL_DVCO 0x2f4
229 #define DVFS_DFLL_RESET_SHIFT 0
231 #define CLK_RST_CONTROLLER_RST_DEV_Y_SET 0x2a8
232 #define CLK_RST_CONTROLLER_RST_DEV_Y_CLR 0x2ac
235 * SDM fractional divisor is 16-bit 2's complement signed number within
236 * (-2^12 ... 2^12-1) range. Represented in PLL data structure as unsigned
237 * 16-bit value, with "0" divisor mapped to 0xFFFF. Data "0" is used to
238 * indicate that SDM is disabled.
240 * Effective ndiv value when SDM is enabled: ndiv + 1/2 + sdm_din/2^13
242 #define PLL_SDM_COEFF BIT(13)
243 #define sdin_din_to_data(din) ((u16)((din) ? : 0xFFFFU))
244 #define sdin_data_to_din(dat) (((dat) == 0xFFFFU) ? 0 : (s16)dat)
245 /* This macro returns ndiv effective scaled to SDM range */
246 #define sdin_get_n_eff(cfg) ((cfg)->n * PLL_SDM_COEFF + ((cfg)->sdm_data ? \
247 (PLL_SDM_COEFF/2 + sdin_data_to_din((cfg)->sdm_data)) : 0))
249 /* Tegra CPU clock and reset control regs */
250 #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470
252 #ifdef CONFIG_PM_SLEEP
253 static struct cpu_clk_suspend_context
{
255 } tegra210_cpu_clk_sctx
;
258 static void __iomem
*clk_base
;
259 static void __iomem
*pmc_base
;
261 static unsigned long osc_freq
;
262 static unsigned long pll_ref_freq
;
264 static DEFINE_SPINLOCK(pll_d_lock
);
265 static DEFINE_SPINLOCK(pll_e_lock
);
266 static DEFINE_SPINLOCK(pll_re_lock
);
267 static DEFINE_SPINLOCK(pll_u_lock
);
268 static DEFINE_SPINLOCK(sor1_lock
);
269 static DEFINE_SPINLOCK(emc_lock
);
271 /* possible OSC frequencies in Hz */
272 static unsigned long tegra210_input_freq
[] = {
277 static const char *mux_pllmcp_clkm
[] = {
278 "pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_mb", "pll_mb",
281 #define mux_pllmcp_clkm_idx NULL
283 #define PLL_ENABLE (1 << 30)
285 #define PLLCX_MISC1_IDDQ (1 << 27)
286 #define PLLCX_MISC0_RESET (1 << 30)
288 #define PLLCX_MISC0_DEFAULT_VALUE 0x40080000
289 #define PLLCX_MISC0_WRITE_MASK 0x400ffffb
290 #define PLLCX_MISC1_DEFAULT_VALUE 0x08000000
291 #define PLLCX_MISC1_WRITE_MASK 0x08003cff
292 #define PLLCX_MISC2_DEFAULT_VALUE 0x1f720f05
293 #define PLLCX_MISC2_WRITE_MASK 0xffffff17
294 #define PLLCX_MISC3_DEFAULT_VALUE 0x000000c4
295 #define PLLCX_MISC3_WRITE_MASK 0x00ffffff
298 #define PLLA_BASE_IDDQ (1 << 25)
299 #define PLLA_BASE_LOCK (1 << 27)
301 #define PLLA_MISC0_LOCK_ENABLE (1 << 28)
302 #define PLLA_MISC0_LOCK_OVERRIDE (1 << 27)
304 #define PLLA_MISC2_EN_SDM (1 << 26)
305 #define PLLA_MISC2_EN_DYNRAMP (1 << 25)
307 #define PLLA_MISC0_DEFAULT_VALUE 0x12000020
308 #define PLLA_MISC0_WRITE_MASK 0x7fffffff
309 #define PLLA_MISC2_DEFAULT_VALUE 0x0
310 #define PLLA_MISC2_WRITE_MASK 0x06ffffff
313 #define PLLD_MISC0_EN_SDM (1 << 16)
314 #define PLLD_MISC0_LOCK_OVERRIDE (1 << 17)
315 #define PLLD_MISC0_LOCK_ENABLE (1 << 18)
316 #define PLLD_MISC0_IDDQ (1 << 20)
317 #define PLLD_MISC0_DSI_CLKENABLE (1 << 21)
319 #define PLLD_MISC0_DEFAULT_VALUE 0x00140000
320 #define PLLD_MISC0_WRITE_MASK 0x3ff7ffff
321 #define PLLD_MISC1_DEFAULT_VALUE 0x20
322 #define PLLD_MISC1_WRITE_MASK 0x00ffffff
324 /* PLLD2 and PLLDP and PLLC4 */
325 #define PLLDSS_BASE_LOCK (1 << 27)
326 #define PLLDSS_BASE_LOCK_OVERRIDE (1 << 24)
327 #define PLLDSS_BASE_IDDQ (1 << 18)
328 #define PLLDSS_BASE_REF_SEL_SHIFT 25
329 #define PLLDSS_BASE_REF_SEL_MASK (0x3 << PLLDSS_BASE_REF_SEL_SHIFT)
331 #define PLLDSS_MISC0_LOCK_ENABLE (1 << 30)
333 #define PLLDSS_MISC1_CFG_EN_SDM (1 << 31)
334 #define PLLDSS_MISC1_CFG_EN_SSC (1 << 30)
336 #define PLLD2_MISC0_DEFAULT_VALUE 0x40000020
337 #define PLLD2_MISC1_CFG_DEFAULT_VALUE 0x10000000
338 #define PLLD2_MISC2_CTRL1_DEFAULT_VALUE 0x0
339 #define PLLD2_MISC3_CTRL2_DEFAULT_VALUE 0x0
341 #define PLLDP_MISC0_DEFAULT_VALUE 0x40000020
342 #define PLLDP_MISC1_CFG_DEFAULT_VALUE 0xc0000000
343 #define PLLDP_MISC2_CTRL1_DEFAULT_VALUE 0xf400f0da
344 #define PLLDP_MISC3_CTRL2_DEFAULT_VALUE 0x2004f400
346 #define PLLDSS_MISC0_WRITE_MASK 0x47ffffff
347 #define PLLDSS_MISC1_CFG_WRITE_MASK 0xf8000000
348 #define PLLDSS_MISC2_CTRL1_WRITE_MASK 0xffffffff
349 #define PLLDSS_MISC3_CTRL2_WRITE_MASK 0xffffffff
351 #define PLLC4_MISC0_DEFAULT_VALUE 0x40000000
354 #define PLLRE_MISC0_LOCK_ENABLE (1 << 30)
355 #define PLLRE_MISC0_LOCK_OVERRIDE (1 << 29)
356 #define PLLRE_MISC0_LOCK (1 << 27)
357 #define PLLRE_MISC0_IDDQ (1 << 24)
359 #define PLLRE_BASE_DEFAULT_VALUE 0x0
360 #define PLLRE_MISC0_DEFAULT_VALUE 0x41000000
362 #define PLLRE_BASE_DEFAULT_MASK 0x1c000000
363 #define PLLRE_MISC0_WRITE_MASK 0x67ffffff
366 #define PLLX_USE_DYN_RAMP 1
367 #define PLLX_BASE_LOCK (1 << 27)
369 #define PLLX_MISC0_FO_G_DISABLE (0x1 << 28)
370 #define PLLX_MISC0_LOCK_ENABLE (0x1 << 18)
372 #define PLLX_MISC2_DYNRAMP_STEPB_SHIFT 24
373 #define PLLX_MISC2_DYNRAMP_STEPB_MASK (0xFF << PLLX_MISC2_DYNRAMP_STEPB_SHIFT)
374 #define PLLX_MISC2_DYNRAMP_STEPA_SHIFT 16
375 #define PLLX_MISC2_DYNRAMP_STEPA_MASK (0xFF << PLLX_MISC2_DYNRAMP_STEPA_SHIFT)
376 #define PLLX_MISC2_NDIV_NEW_SHIFT 8
377 #define PLLX_MISC2_NDIV_NEW_MASK (0xFF << PLLX_MISC2_NDIV_NEW_SHIFT)
378 #define PLLX_MISC2_LOCK_OVERRIDE (0x1 << 4)
379 #define PLLX_MISC2_DYNRAMP_DONE (0x1 << 2)
380 #define PLLX_MISC2_EN_DYNRAMP (0x1 << 0)
382 #define PLLX_MISC3_IDDQ (0x1 << 3)
384 #define PLLX_MISC0_DEFAULT_VALUE PLLX_MISC0_LOCK_ENABLE
385 #define PLLX_MISC0_WRITE_MASK 0x10c40000
386 #define PLLX_MISC1_DEFAULT_VALUE 0x20
387 #define PLLX_MISC1_WRITE_MASK 0x00ffffff
388 #define PLLX_MISC2_DEFAULT_VALUE 0x0
389 #define PLLX_MISC2_WRITE_MASK 0xffffff11
390 #define PLLX_MISC3_DEFAULT_VALUE PLLX_MISC3_IDDQ
391 #define PLLX_MISC3_WRITE_MASK 0x01ff0f0f
392 #define PLLX_MISC4_DEFAULT_VALUE 0x0
393 #define PLLX_MISC4_WRITE_MASK 0x8000ffff
394 #define PLLX_MISC5_DEFAULT_VALUE 0x0
395 #define PLLX_MISC5_WRITE_MASK 0x0000ffff
397 #define PLLX_HW_CTRL_CFG 0x548
398 #define PLLX_HW_CTRL_CFG_SWCTRL (0x1 << 0)
401 #define PLLMB_BASE_LOCK (1 << 27)
403 #define PLLMB_MISC1_LOCK_OVERRIDE (1 << 18)
404 #define PLLMB_MISC1_IDDQ (1 << 17)
405 #define PLLMB_MISC1_LOCK_ENABLE (1 << 16)
407 #define PLLMB_MISC1_DEFAULT_VALUE 0x00030000
408 #define PLLMB_MISC1_WRITE_MASK 0x0007ffff
411 #define PLLP_BASE_OVERRIDE (1 << 28)
412 #define PLLP_BASE_LOCK (1 << 27)
414 #define PLLP_MISC0_LOCK_ENABLE (1 << 18)
415 #define PLLP_MISC0_LOCK_OVERRIDE (1 << 17)
416 #define PLLP_MISC0_IDDQ (1 << 3)
418 #define PLLP_MISC1_HSIO_EN_SHIFT 29
419 #define PLLP_MISC1_HSIO_EN (1 << PLLP_MISC1_HSIO_EN_SHIFT)
420 #define PLLP_MISC1_XUSB_EN_SHIFT 28
421 #define PLLP_MISC1_XUSB_EN (1 << PLLP_MISC1_XUSB_EN_SHIFT)
423 #define PLLP_MISC0_DEFAULT_VALUE 0x00040008
424 #define PLLP_MISC1_DEFAULT_VALUE 0x0
426 #define PLLP_MISC0_WRITE_MASK 0xdc6000f
427 #define PLLP_MISC1_WRITE_MASK 0x70ffffff
430 #define PLLU_BASE_LOCK (1 << 27)
431 #define PLLU_BASE_OVERRIDE (1 << 24)
432 #define PLLU_BASE_CLKENABLE_USB (1 << 21)
433 #define PLLU_BASE_CLKENABLE_HSIC (1 << 22)
434 #define PLLU_BASE_CLKENABLE_ICUSB (1 << 23)
435 #define PLLU_BASE_CLKENABLE_48M (1 << 25)
436 #define PLLU_BASE_CLKENABLE_ALL (PLLU_BASE_CLKENABLE_USB |\
437 PLLU_BASE_CLKENABLE_HSIC |\
438 PLLU_BASE_CLKENABLE_ICUSB |\
439 PLLU_BASE_CLKENABLE_48M)
441 #define PLLU_MISC0_IDDQ (1 << 31)
442 #define PLLU_MISC0_LOCK_ENABLE (1 << 29)
443 #define PLLU_MISC1_LOCK_OVERRIDE (1 << 0)
445 #define PLLU_MISC0_DEFAULT_VALUE 0xa0000000
446 #define PLLU_MISC1_DEFAULT_VALUE 0x0
448 #define PLLU_MISC0_WRITE_MASK 0xbfffffff
449 #define PLLU_MISC1_WRITE_MASK 0x00000007
451 void tegra210_xusb_pll_hw_control_enable(void)
455 val
= readl_relaxed(clk_base
+ XUSBIO_PLL_CFG0
);
456 val
&= ~(XUSBIO_PLL_CFG0_CLK_ENABLE_SWCTL
|
457 XUSBIO_PLL_CFG0_PADPLL_RESET_SWCTL
);
458 val
|= XUSBIO_PLL_CFG0_PADPLL_USE_LOCKDET
|
459 XUSBIO_PLL_CFG0_PADPLL_SLEEP_IDDQ
;
460 writel_relaxed(val
, clk_base
+ XUSBIO_PLL_CFG0
);
462 EXPORT_SYMBOL_GPL(tegra210_xusb_pll_hw_control_enable
);
464 void tegra210_xusb_pll_hw_sequence_start(void)
468 val
= readl_relaxed(clk_base
+ XUSBIO_PLL_CFG0
);
469 val
|= XUSBIO_PLL_CFG0_SEQ_ENABLE
;
470 writel_relaxed(val
, clk_base
+ XUSBIO_PLL_CFG0
);
472 EXPORT_SYMBOL_GPL(tegra210_xusb_pll_hw_sequence_start
);
474 void tegra210_sata_pll_hw_control_enable(void)
478 val
= readl_relaxed(clk_base
+ SATA_PLL_CFG0
);
479 val
&= ~SATA_PLL_CFG0_PADPLL_RESET_SWCTL
;
480 val
|= SATA_PLL_CFG0_PADPLL_USE_LOCKDET
|
481 SATA_PLL_CFG0_PADPLL_SLEEP_IDDQ
;
482 writel_relaxed(val
, clk_base
+ SATA_PLL_CFG0
);
484 EXPORT_SYMBOL_GPL(tegra210_sata_pll_hw_control_enable
);
486 void tegra210_sata_pll_hw_sequence_start(void)
490 val
= readl_relaxed(clk_base
+ SATA_PLL_CFG0
);
491 val
|= SATA_PLL_CFG0_SEQ_ENABLE
;
492 writel_relaxed(val
, clk_base
+ SATA_PLL_CFG0
);
494 EXPORT_SYMBOL_GPL(tegra210_sata_pll_hw_sequence_start
);
496 void tegra210_set_sata_pll_seq_sw(bool state
)
500 val
= readl_relaxed(clk_base
+ SATA_PLL_CFG0
);
502 val
|= SATA_PLL_CFG0_SATA_SEQ_IN_SWCTL
;
503 val
|= SATA_PLL_CFG0_SATA_SEQ_RESET_INPUT_VALUE
;
504 val
|= SATA_PLL_CFG0_SATA_SEQ_LANE_PD_INPUT_VALUE
;
505 val
|= SATA_PLL_CFG0_SATA_SEQ_PADPLL_PD_INPUT_VALUE
;
507 val
&= ~SATA_PLL_CFG0_SATA_SEQ_IN_SWCTL
;
508 val
&= ~SATA_PLL_CFG0_SATA_SEQ_RESET_INPUT_VALUE
;
509 val
&= ~SATA_PLL_CFG0_SATA_SEQ_LANE_PD_INPUT_VALUE
;
510 val
&= ~SATA_PLL_CFG0_SATA_SEQ_PADPLL_PD_INPUT_VALUE
;
512 writel_relaxed(val
, clk_base
+ SATA_PLL_CFG0
);
514 EXPORT_SYMBOL_GPL(tegra210_set_sata_pll_seq_sw
);
516 static inline void _pll_misc_chk_default(void __iomem
*base
,
517 struct tegra_clk_pll_params
*params
,
518 u8 misc_num
, u32 default_val
, u32 mask
)
520 u32 boot_val
= readl_relaxed(base
+ params
->ext_misc_reg
[misc_num
]);
524 if (boot_val
!= default_val
) {
525 pr_warn("boot misc%d 0x%x: expected 0x%x\n",
526 misc_num
, boot_val
, default_val
);
527 pr_warn(" (comparison mask = 0x%x)\n", mask
);
528 params
->defaults_set
= false;
533 * PLLCX: PLLC, PLLC2, PLLC3, PLLA1
534 * Hybrid PLLs with dynamic ramp. Dynamic ramp is allowed for any transition
535 * that changes NDIV only, while PLL is already locked.
537 static void pllcx_check_defaults(struct tegra_clk_pll_params
*params
)
541 default_val
= PLLCX_MISC0_DEFAULT_VALUE
& (~PLLCX_MISC0_RESET
);
542 _pll_misc_chk_default(clk_base
, params
, 0, default_val
,
543 PLLCX_MISC0_WRITE_MASK
);
545 default_val
= PLLCX_MISC1_DEFAULT_VALUE
& (~PLLCX_MISC1_IDDQ
);
546 _pll_misc_chk_default(clk_base
, params
, 1, default_val
,
547 PLLCX_MISC1_WRITE_MASK
);
549 default_val
= PLLCX_MISC2_DEFAULT_VALUE
;
550 _pll_misc_chk_default(clk_base
, params
, 2, default_val
,
551 PLLCX_MISC2_WRITE_MASK
);
553 default_val
= PLLCX_MISC3_DEFAULT_VALUE
;
554 _pll_misc_chk_default(clk_base
, params
, 3, default_val
,
555 PLLCX_MISC3_WRITE_MASK
);
558 static void tegra210_pllcx_set_defaults(const char *name
,
559 struct tegra_clk_pll
*pllcx
)
561 pllcx
->params
->defaults_set
= true;
563 if (readl_relaxed(clk_base
+ pllcx
->params
->base_reg
) & PLL_ENABLE
) {
564 /* PLL is ON: only check if defaults already set */
565 pllcx_check_defaults(pllcx
->params
);
566 if (!pllcx
->params
->defaults_set
)
567 pr_warn("%s already enabled. Postponing set full defaults\n",
572 /* Defaults assert PLL reset, and set IDDQ */
573 writel_relaxed(PLLCX_MISC0_DEFAULT_VALUE
,
574 clk_base
+ pllcx
->params
->ext_misc_reg
[0]);
575 writel_relaxed(PLLCX_MISC1_DEFAULT_VALUE
,
576 clk_base
+ pllcx
->params
->ext_misc_reg
[1]);
577 writel_relaxed(PLLCX_MISC2_DEFAULT_VALUE
,
578 clk_base
+ pllcx
->params
->ext_misc_reg
[2]);
579 writel_relaxed(PLLCX_MISC3_DEFAULT_VALUE
,
580 clk_base
+ pllcx
->params
->ext_misc_reg
[3]);
584 static void _pllc_set_defaults(struct tegra_clk_pll
*pllcx
)
586 tegra210_pllcx_set_defaults("PLL_C", pllcx
);
589 static void _pllc2_set_defaults(struct tegra_clk_pll
*pllcx
)
591 tegra210_pllcx_set_defaults("PLL_C2", pllcx
);
594 static void _pllc3_set_defaults(struct tegra_clk_pll
*pllcx
)
596 tegra210_pllcx_set_defaults("PLL_C3", pllcx
);
599 static void _plla1_set_defaults(struct tegra_clk_pll
*pllcx
)
601 tegra210_pllcx_set_defaults("PLL_A1", pllcx
);
606 * PLL with dynamic ramp and fractional SDM. Dynamic ramp is not used.
607 * Fractional SDM is allowed to provide exact audio rates.
609 static void tegra210_plla_set_defaults(struct tegra_clk_pll
*plla
)
612 u32 val
= readl_relaxed(clk_base
+ plla
->params
->base_reg
);
614 plla
->params
->defaults_set
= true;
616 if (val
& PLL_ENABLE
) {
618 * PLL is ON: check if defaults already set, then set those
619 * that can be updated in flight.
621 if (val
& PLLA_BASE_IDDQ
) {
622 pr_warn("PLL_A boot enabled with IDDQ set\n");
623 plla
->params
->defaults_set
= false;
626 pr_warn("PLL_A already enabled. Postponing set full defaults\n");
628 val
= PLLA_MISC0_DEFAULT_VALUE
; /* ignore lock enable */
629 mask
= PLLA_MISC0_LOCK_ENABLE
| PLLA_MISC0_LOCK_OVERRIDE
;
630 _pll_misc_chk_default(clk_base
, plla
->params
, 0, val
,
631 ~mask
& PLLA_MISC0_WRITE_MASK
);
633 val
= PLLA_MISC2_DEFAULT_VALUE
; /* ignore all but control bit */
634 _pll_misc_chk_default(clk_base
, plla
->params
, 2, val
,
635 PLLA_MISC2_EN_DYNRAMP
);
637 /* Enable lock detect */
638 val
= readl_relaxed(clk_base
+ plla
->params
->ext_misc_reg
[0]);
640 val
|= PLLA_MISC0_DEFAULT_VALUE
& mask
;
641 writel_relaxed(val
, clk_base
+ plla
->params
->ext_misc_reg
[0]);
647 /* set IDDQ, enable lock detect, disable dynamic ramp and SDM */
648 val
|= PLLA_BASE_IDDQ
;
649 writel_relaxed(val
, clk_base
+ plla
->params
->base_reg
);
650 writel_relaxed(PLLA_MISC0_DEFAULT_VALUE
,
651 clk_base
+ plla
->params
->ext_misc_reg
[0]);
652 writel_relaxed(PLLA_MISC2_DEFAULT_VALUE
,
653 clk_base
+ plla
->params
->ext_misc_reg
[2]);
659 * PLL with fractional SDM.
661 static void tegra210_plld_set_defaults(struct tegra_clk_pll
*plld
)
666 plld
->params
->defaults_set
= true;
668 if (readl_relaxed(clk_base
+ plld
->params
->base_reg
) &
672 * PLL is ON: check if defaults already set, then set those
673 * that can be updated in flight.
675 val
= PLLD_MISC1_DEFAULT_VALUE
;
676 _pll_misc_chk_default(clk_base
, plld
->params
, 1,
677 val
, PLLD_MISC1_WRITE_MASK
);
679 /* ignore lock, DSI and SDM controls, make sure IDDQ not set */
680 val
= PLLD_MISC0_DEFAULT_VALUE
& (~PLLD_MISC0_IDDQ
);
681 mask
|= PLLD_MISC0_DSI_CLKENABLE
| PLLD_MISC0_LOCK_ENABLE
|
682 PLLD_MISC0_LOCK_OVERRIDE
| PLLD_MISC0_EN_SDM
;
683 _pll_misc_chk_default(clk_base
, plld
->params
, 0, val
,
684 ~mask
& PLLD_MISC0_WRITE_MASK
);
686 if (!plld
->params
->defaults_set
)
687 pr_warn("PLL_D already enabled. Postponing set full defaults\n");
689 /* Enable lock detect */
690 mask
= PLLD_MISC0_LOCK_ENABLE
| PLLD_MISC0_LOCK_OVERRIDE
;
691 val
= readl_relaxed(clk_base
+ plld
->params
->ext_misc_reg
[0]);
693 val
|= PLLD_MISC0_DEFAULT_VALUE
& mask
;
694 writel_relaxed(val
, clk_base
+ plld
->params
->ext_misc_reg
[0]);
700 val
= readl_relaxed(clk_base
+ plld
->params
->ext_misc_reg
[0]);
701 val
&= PLLD_MISC0_DSI_CLKENABLE
;
702 val
|= PLLD_MISC0_DEFAULT_VALUE
;
703 /* set IDDQ, enable lock detect, disable SDM */
704 writel_relaxed(val
, clk_base
+ plld
->params
->ext_misc_reg
[0]);
705 writel_relaxed(PLLD_MISC1_DEFAULT_VALUE
, clk_base
+
706 plld
->params
->ext_misc_reg
[1]);
712 * PLL with fractional SDM and Spread Spectrum (SDM is a must if SSC is used).
714 static void plldss_defaults(const char *pll_name
, struct tegra_clk_pll
*plldss
,
715 u32 misc0_val
, u32 misc1_val
, u32 misc2_val
, u32 misc3_val
)
718 u32 val
= readl_relaxed(clk_base
+ plldss
->params
->base_reg
);
720 plldss
->params
->defaults_set
= true;
722 if (val
& PLL_ENABLE
) {
725 * PLL is ON: check if defaults already set, then set those
726 * that can be updated in flight.
728 if (val
& PLLDSS_BASE_IDDQ
) {
729 pr_warn("plldss boot enabled with IDDQ set\n");
730 plldss
->params
->defaults_set
= false;
733 /* ignore lock enable */
734 default_val
= misc0_val
;
735 _pll_misc_chk_default(clk_base
, plldss
->params
, 0, default_val
,
736 PLLDSS_MISC0_WRITE_MASK
&
737 (~PLLDSS_MISC0_LOCK_ENABLE
));
740 * If SSC is used, check all settings, otherwise just confirm
741 * that SSC is not used on boot as well. Do nothing when using
742 * this function for PLLC4 that has only MISC0.
744 if (plldss
->params
->ssc_ctrl_en_mask
) {
745 default_val
= misc1_val
;
746 _pll_misc_chk_default(clk_base
, plldss
->params
, 1,
747 default_val
, PLLDSS_MISC1_CFG_WRITE_MASK
);
748 default_val
= misc2_val
;
749 _pll_misc_chk_default(clk_base
, plldss
->params
, 2,
750 default_val
, PLLDSS_MISC2_CTRL1_WRITE_MASK
);
751 default_val
= misc3_val
;
752 _pll_misc_chk_default(clk_base
, plldss
->params
, 3,
753 default_val
, PLLDSS_MISC3_CTRL2_WRITE_MASK
);
754 } else if (plldss
->params
->ext_misc_reg
[1]) {
755 default_val
= misc1_val
;
756 _pll_misc_chk_default(clk_base
, plldss
->params
, 1,
757 default_val
, PLLDSS_MISC1_CFG_WRITE_MASK
&
758 (~PLLDSS_MISC1_CFG_EN_SDM
));
761 if (!plldss
->params
->defaults_set
)
762 pr_warn("%s already enabled. Postponing set full defaults\n",
765 /* Enable lock detect */
766 if (val
& PLLDSS_BASE_LOCK_OVERRIDE
) {
767 val
&= ~PLLDSS_BASE_LOCK_OVERRIDE
;
768 writel_relaxed(val
, clk_base
+
769 plldss
->params
->base_reg
);
772 val
= readl_relaxed(clk_base
+ plldss
->params
->ext_misc_reg
[0]);
773 val
&= ~PLLDSS_MISC0_LOCK_ENABLE
;
774 val
|= misc0_val
& PLLDSS_MISC0_LOCK_ENABLE
;
775 writel_relaxed(val
, clk_base
+ plldss
->params
->ext_misc_reg
[0]);
781 /* set IDDQ, enable lock detect, configure SDM/SSC */
782 val
|= PLLDSS_BASE_IDDQ
;
783 val
&= ~PLLDSS_BASE_LOCK_OVERRIDE
;
784 writel_relaxed(val
, clk_base
+ plldss
->params
->base_reg
);
786 /* When using this function for PLLC4 exit here */
787 if (!plldss
->params
->ext_misc_reg
[1]) {
788 writel_relaxed(misc0_val
, clk_base
+
789 plldss
->params
->ext_misc_reg
[0]);
794 writel_relaxed(misc0_val
, clk_base
+
795 plldss
->params
->ext_misc_reg
[0]);
796 /* if SSC used set by 1st enable */
797 writel_relaxed(misc1_val
& (~PLLDSS_MISC1_CFG_EN_SSC
),
798 clk_base
+ plldss
->params
->ext_misc_reg
[1]);
799 writel_relaxed(misc2_val
, clk_base
+ plldss
->params
->ext_misc_reg
[2]);
800 writel_relaxed(misc3_val
, clk_base
+ plldss
->params
->ext_misc_reg
[3]);
804 static void tegra210_plld2_set_defaults(struct tegra_clk_pll
*plld2
)
806 plldss_defaults("PLL_D2", plld2
, PLLD2_MISC0_DEFAULT_VALUE
,
807 PLLD2_MISC1_CFG_DEFAULT_VALUE
,
808 PLLD2_MISC2_CTRL1_DEFAULT_VALUE
,
809 PLLD2_MISC3_CTRL2_DEFAULT_VALUE
);
812 static void tegra210_plldp_set_defaults(struct tegra_clk_pll
*plldp
)
814 plldss_defaults("PLL_DP", plldp
, PLLDP_MISC0_DEFAULT_VALUE
,
815 PLLDP_MISC1_CFG_DEFAULT_VALUE
,
816 PLLDP_MISC2_CTRL1_DEFAULT_VALUE
,
817 PLLDP_MISC3_CTRL2_DEFAULT_VALUE
);
822 * Base and misc0 layout is the same as PLLD2/PLLDP, but no SDM/SSC support.
823 * VCO is exposed to the clock tree via fixed 1/3 and 1/5 dividers.
825 static void tegra210_pllc4_set_defaults(struct tegra_clk_pll
*pllc4
)
827 plldss_defaults("PLL_C4", pllc4
, PLLC4_MISC0_DEFAULT_VALUE
, 0, 0, 0);
832 * VCO is exposed to the clock tree directly along with post-divider output
834 static void tegra210_pllre_set_defaults(struct tegra_clk_pll
*pllre
)
837 u32 val
= readl_relaxed(clk_base
+ pllre
->params
->base_reg
);
839 pllre
->params
->defaults_set
= true;
841 if (val
& PLL_ENABLE
) {
842 pr_warn("PLL_RE already enabled. Postponing set full defaults\n");
845 * PLL is ON: check if defaults already set, then set those
846 * that can be updated in flight.
848 val
&= PLLRE_BASE_DEFAULT_MASK
;
849 if (val
!= PLLRE_BASE_DEFAULT_VALUE
) {
850 pr_warn("pllre boot base 0x%x : expected 0x%x\n",
851 val
, PLLRE_BASE_DEFAULT_VALUE
);
852 pr_warn("(comparison mask = 0x%x)\n",
853 PLLRE_BASE_DEFAULT_MASK
);
854 pllre
->params
->defaults_set
= false;
857 /* Ignore lock enable */
858 val
= PLLRE_MISC0_DEFAULT_VALUE
& (~PLLRE_MISC0_IDDQ
);
859 mask
= PLLRE_MISC0_LOCK_ENABLE
| PLLRE_MISC0_LOCK_OVERRIDE
;
860 _pll_misc_chk_default(clk_base
, pllre
->params
, 0, val
,
861 ~mask
& PLLRE_MISC0_WRITE_MASK
);
863 /* Enable lock detect */
864 val
= readl_relaxed(clk_base
+ pllre
->params
->ext_misc_reg
[0]);
866 val
|= PLLRE_MISC0_DEFAULT_VALUE
& mask
;
867 writel_relaxed(val
, clk_base
+ pllre
->params
->ext_misc_reg
[0]);
873 /* set IDDQ, enable lock detect */
874 val
&= ~PLLRE_BASE_DEFAULT_MASK
;
875 val
|= PLLRE_BASE_DEFAULT_VALUE
& PLLRE_BASE_DEFAULT_MASK
;
876 writel_relaxed(val
, clk_base
+ pllre
->params
->base_reg
);
877 writel_relaxed(PLLRE_MISC0_DEFAULT_VALUE
,
878 clk_base
+ pllre
->params
->ext_misc_reg
[0]);
882 static void pllx_get_dyn_steps(struct clk_hw
*hw
, u32
*step_a
, u32
*step_b
)
884 unsigned long input_rate
;
887 if (!IS_ERR_OR_NULL(hw
->clk
))
888 input_rate
= clk_hw_get_rate(clk_hw_get_parent(hw
));
890 input_rate
= 38400000;
892 input_rate
/= tegra_pll_get_fixed_mdiv(hw
, input_rate
);
894 switch (input_rate
) {
910 pr_err("%s: Unexpected reference rate %lu\n",
911 __func__
, input_rate
);
916 static void pllx_check_defaults(struct tegra_clk_pll
*pll
)
920 default_val
= PLLX_MISC0_DEFAULT_VALUE
;
921 /* ignore lock enable */
922 _pll_misc_chk_default(clk_base
, pll
->params
, 0, default_val
,
923 PLLX_MISC0_WRITE_MASK
& (~PLLX_MISC0_LOCK_ENABLE
));
925 default_val
= PLLX_MISC1_DEFAULT_VALUE
;
926 _pll_misc_chk_default(clk_base
, pll
->params
, 1, default_val
,
927 PLLX_MISC1_WRITE_MASK
);
929 /* ignore all but control bit */
930 default_val
= PLLX_MISC2_DEFAULT_VALUE
;
931 _pll_misc_chk_default(clk_base
, pll
->params
, 2,
932 default_val
, PLLX_MISC2_EN_DYNRAMP
);
934 default_val
= PLLX_MISC3_DEFAULT_VALUE
& (~PLLX_MISC3_IDDQ
);
935 _pll_misc_chk_default(clk_base
, pll
->params
, 3, default_val
,
936 PLLX_MISC3_WRITE_MASK
);
938 default_val
= PLLX_MISC4_DEFAULT_VALUE
;
939 _pll_misc_chk_default(clk_base
, pll
->params
, 4, default_val
,
940 PLLX_MISC4_WRITE_MASK
);
942 default_val
= PLLX_MISC5_DEFAULT_VALUE
;
943 _pll_misc_chk_default(clk_base
, pll
->params
, 5, default_val
,
944 PLLX_MISC5_WRITE_MASK
);
947 static void tegra210_pllx_set_defaults(struct tegra_clk_pll
*pllx
)
952 pllx
->params
->defaults_set
= true;
954 /* Get ready dyn ramp state machine settings */
955 pllx_get_dyn_steps(&pllx
->hw
, &step_a
, &step_b
);
956 val
= PLLX_MISC2_DEFAULT_VALUE
& (~PLLX_MISC2_DYNRAMP_STEPA_MASK
) &
957 (~PLLX_MISC2_DYNRAMP_STEPB_MASK
);
958 val
|= step_a
<< PLLX_MISC2_DYNRAMP_STEPA_SHIFT
;
959 val
|= step_b
<< PLLX_MISC2_DYNRAMP_STEPB_SHIFT
;
961 if (readl_relaxed(clk_base
+ pllx
->params
->base_reg
) & PLL_ENABLE
) {
964 * PLL is ON: check if defaults already set, then set those
965 * that can be updated in flight.
967 pllx_check_defaults(pllx
);
969 if (!pllx
->params
->defaults_set
)
970 pr_warn("PLL_X already enabled. Postponing set full defaults\n");
971 /* Configure dyn ramp, disable lock override */
972 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
974 /* Enable lock detect */
975 val
= readl_relaxed(clk_base
+ pllx
->params
->ext_misc_reg
[0]);
976 val
&= ~PLLX_MISC0_LOCK_ENABLE
;
977 val
|= PLLX_MISC0_DEFAULT_VALUE
& PLLX_MISC0_LOCK_ENABLE
;
978 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[0]);
984 /* Enable lock detect and CPU output */
985 writel_relaxed(PLLX_MISC0_DEFAULT_VALUE
, clk_base
+
986 pllx
->params
->ext_misc_reg
[0]);
989 writel_relaxed(PLLX_MISC1_DEFAULT_VALUE
, clk_base
+
990 pllx
->params
->ext_misc_reg
[1]);
992 /* Configure dyn ramp state machine, disable lock override */
993 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
996 writel_relaxed(PLLX_MISC3_DEFAULT_VALUE
, clk_base
+
997 pllx
->params
->ext_misc_reg
[3]);
1000 writel_relaxed(PLLX_MISC4_DEFAULT_VALUE
, clk_base
+
1001 pllx
->params
->ext_misc_reg
[4]);
1002 writel_relaxed(PLLX_MISC5_DEFAULT_VALUE
, clk_base
+
1003 pllx
->params
->ext_misc_reg
[5]);
1008 static void tegra210_pllmb_set_defaults(struct tegra_clk_pll
*pllmb
)
1010 u32 mask
, val
= readl_relaxed(clk_base
+ pllmb
->params
->base_reg
);
1012 pllmb
->params
->defaults_set
= true;
1014 if (val
& PLL_ENABLE
) {
1017 * PLL is ON: check if defaults already set, then set those
1018 * that can be updated in flight.
1020 val
= PLLMB_MISC1_DEFAULT_VALUE
& (~PLLMB_MISC1_IDDQ
);
1021 mask
= PLLMB_MISC1_LOCK_ENABLE
| PLLMB_MISC1_LOCK_OVERRIDE
;
1022 _pll_misc_chk_default(clk_base
, pllmb
->params
, 0, val
,
1023 ~mask
& PLLMB_MISC1_WRITE_MASK
);
1025 if (!pllmb
->params
->defaults_set
)
1026 pr_warn("PLL_MB already enabled. Postponing set full defaults\n");
1027 /* Enable lock detect */
1028 val
= readl_relaxed(clk_base
+ pllmb
->params
->ext_misc_reg
[0]);
1030 val
|= PLLMB_MISC1_DEFAULT_VALUE
& mask
;
1031 writel_relaxed(val
, clk_base
+ pllmb
->params
->ext_misc_reg
[0]);
1037 /* set IDDQ, enable lock detect */
1038 writel_relaxed(PLLMB_MISC1_DEFAULT_VALUE
,
1039 clk_base
+ pllmb
->params
->ext_misc_reg
[0]);
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 408MHz and 204MHz,
1049 static void pllp_check_defaults(struct tegra_clk_pll
*pll
, bool enabled
)
1053 /* Ignore lock enable (will be set), make sure not in IDDQ if enabled */
1054 val
= PLLP_MISC0_DEFAULT_VALUE
& (~PLLP_MISC0_IDDQ
);
1055 mask
= PLLP_MISC0_LOCK_ENABLE
| PLLP_MISC0_LOCK_OVERRIDE
;
1057 mask
|= PLLP_MISC0_IDDQ
;
1058 _pll_misc_chk_default(clk_base
, pll
->params
, 0, val
,
1059 ~mask
& PLLP_MISC0_WRITE_MASK
);
1061 /* Ignore branch controls */
1062 val
= PLLP_MISC1_DEFAULT_VALUE
;
1063 mask
= PLLP_MISC1_HSIO_EN
| PLLP_MISC1_XUSB_EN
;
1064 _pll_misc_chk_default(clk_base
, pll
->params
, 1, val
,
1065 ~mask
& PLLP_MISC1_WRITE_MASK
);
1068 static void tegra210_pllp_set_defaults(struct tegra_clk_pll
*pllp
)
1071 u32 val
= readl_relaxed(clk_base
+ pllp
->params
->base_reg
);
1073 pllp
->params
->defaults_set
= true;
1075 if (val
& PLL_ENABLE
) {
1078 * PLL is ON: check if defaults already set, then set those
1079 * that can be updated in flight.
1081 pllp_check_defaults(pllp
, true);
1082 if (!pllp
->params
->defaults_set
)
1083 pr_warn("PLL_P already enabled. Postponing set full defaults\n");
1085 /* Enable lock detect */
1086 val
= readl_relaxed(clk_base
+ pllp
->params
->ext_misc_reg
[0]);
1087 mask
= PLLP_MISC0_LOCK_ENABLE
| PLLP_MISC0_LOCK_OVERRIDE
;
1089 val
|= PLLP_MISC0_DEFAULT_VALUE
& mask
;
1090 writel_relaxed(val
, clk_base
+ pllp
->params
->ext_misc_reg
[0]);
1096 /* set IDDQ, enable lock detect */
1097 writel_relaxed(PLLP_MISC0_DEFAULT_VALUE
,
1098 clk_base
+ pllp
->params
->ext_misc_reg
[0]);
1100 /* Preserve branch control */
1101 val
= readl_relaxed(clk_base
+ pllp
->params
->ext_misc_reg
[1]);
1102 mask
= PLLP_MISC1_HSIO_EN
| PLLP_MISC1_XUSB_EN
;
1104 val
|= ~mask
& PLLP_MISC1_DEFAULT_VALUE
;
1105 writel_relaxed(val
, clk_base
+ pllp
->params
->ext_misc_reg
[1]);
1111 * VCO is exposed to the clock tree directly along with post-divider output.
1112 * Both VCO and post-divider output rates are fixed at 480MHz and 240MHz,
1115 static void pllu_check_defaults(struct tegra_clk_pll_params
*params
,
1120 /* Ignore lock enable (will be set) and IDDQ if under h/w control */
1121 val
= PLLU_MISC0_DEFAULT_VALUE
& (~PLLU_MISC0_IDDQ
);
1122 mask
= PLLU_MISC0_LOCK_ENABLE
| (hw_control
? PLLU_MISC0_IDDQ
: 0);
1123 _pll_misc_chk_default(clk_base
, params
, 0, val
,
1124 ~mask
& PLLU_MISC0_WRITE_MASK
);
1126 val
= PLLU_MISC1_DEFAULT_VALUE
;
1127 mask
= PLLU_MISC1_LOCK_OVERRIDE
;
1128 _pll_misc_chk_default(clk_base
, params
, 1, val
,
1129 ~mask
& PLLU_MISC1_WRITE_MASK
);
1132 static void tegra210_pllu_set_defaults(struct tegra_clk_pll_params
*pllu
)
1134 u32 val
= readl_relaxed(clk_base
+ pllu
->base_reg
);
1136 pllu
->defaults_set
= true;
1138 if (val
& PLL_ENABLE
) {
1141 * PLL is ON: check if defaults already set, then set those
1142 * that can be updated in flight.
1144 pllu_check_defaults(pllu
, false);
1145 if (!pllu
->defaults_set
)
1146 pr_warn("PLL_U already enabled. Postponing set full defaults\n");
1148 /* Enable lock detect */
1149 val
= readl_relaxed(clk_base
+ pllu
->ext_misc_reg
[0]);
1150 val
&= ~PLLU_MISC0_LOCK_ENABLE
;
1151 val
|= PLLU_MISC0_DEFAULT_VALUE
& PLLU_MISC0_LOCK_ENABLE
;
1152 writel_relaxed(val
, clk_base
+ pllu
->ext_misc_reg
[0]);
1154 val
= readl_relaxed(clk_base
+ pllu
->ext_misc_reg
[1]);
1155 val
&= ~PLLU_MISC1_LOCK_OVERRIDE
;
1156 val
|= PLLU_MISC1_DEFAULT_VALUE
& PLLU_MISC1_LOCK_OVERRIDE
;
1157 writel_relaxed(val
, clk_base
+ pllu
->ext_misc_reg
[1]);
1163 /* set IDDQ, enable lock detect */
1164 writel_relaxed(PLLU_MISC0_DEFAULT_VALUE
,
1165 clk_base
+ pllu
->ext_misc_reg
[0]);
1166 writel_relaxed(PLLU_MISC1_DEFAULT_VALUE
,
1167 clk_base
+ pllu
->ext_misc_reg
[1]);
1171 #define mask(w) ((1 << (w)) - 1)
1172 #define divm_mask(p) mask(p->params->div_nmp->divm_width)
1173 #define divn_mask(p) mask(p->params->div_nmp->divn_width)
1174 #define divp_mask(p) (p->params->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK :\
1175 mask(p->params->div_nmp->divp_width))
1177 #define divm_shift(p) ((p)->params->div_nmp->divm_shift)
1178 #define divn_shift(p) ((p)->params->div_nmp->divn_shift)
1179 #define divp_shift(p) ((p)->params->div_nmp->divp_shift)
1181 #define divm_mask_shifted(p) (divm_mask(p) << divm_shift(p))
1182 #define divn_mask_shifted(p) (divn_mask(p) << divn_shift(p))
1183 #define divp_mask_shifted(p) (divp_mask(p) << divp_shift(p))
1185 #define PLL_LOCKDET_DELAY 2 /* Lock detection safety delays */
1186 static int tegra210_wait_for_mask(struct tegra_clk_pll
*pll
,
1192 for (i
= 0; i
< pll
->params
->lock_delay
/ PLL_LOCKDET_DELAY
+ 1; i
++) {
1193 udelay(PLL_LOCKDET_DELAY
);
1194 val
= readl_relaxed(clk_base
+ reg
);
1195 if ((val
& mask
) == mask
) {
1196 udelay(PLL_LOCKDET_DELAY
);
1203 static int tegra210_pllx_dyn_ramp(struct tegra_clk_pll
*pllx
,
1204 struct tegra_clk_pll_freq_table
*cfg
)
1206 u32 val
, base
, ndiv_new_mask
;
1208 ndiv_new_mask
= (divn_mask(pllx
) >> pllx
->params
->div_nmp
->divn_shift
)
1209 << PLLX_MISC2_NDIV_NEW_SHIFT
;
1211 val
= readl_relaxed(clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1212 val
&= (~ndiv_new_mask
);
1213 val
|= cfg
->n
<< PLLX_MISC2_NDIV_NEW_SHIFT
;
1214 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1217 val
= readl_relaxed(clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1218 val
|= PLLX_MISC2_EN_DYNRAMP
;
1219 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1222 tegra210_wait_for_mask(pllx
, pllx
->params
->ext_misc_reg
[2],
1223 PLLX_MISC2_DYNRAMP_DONE
);
1225 base
= readl_relaxed(clk_base
+ pllx
->params
->base_reg
) &
1226 (~divn_mask_shifted(pllx
));
1227 base
|= cfg
->n
<< pllx
->params
->div_nmp
->divn_shift
;
1228 writel_relaxed(base
, clk_base
+ pllx
->params
->base_reg
);
1231 val
&= ~PLLX_MISC2_EN_DYNRAMP
;
1232 writel_relaxed(val
, clk_base
+ pllx
->params
->ext_misc_reg
[2]);
1235 pr_debug("%s: dynamic ramp to m = %u n = %u p = %u, Fout = %lu kHz\n",
1236 __clk_get_name(pllx
->hw
.clk
), cfg
->m
, cfg
->n
, cfg
->p
,
1237 cfg
->input_rate
/ cfg
->m
* cfg
->n
/
1238 pllx
->params
->pdiv_tohw
[cfg
->p
].pdiv
/ 1000);
1244 * Common configuration for PLLs with fixed input divider policy:
1245 * - always set fixed M-value based on the reference rate
1246 * - always set P-value value 1:1 for output rates above VCO minimum, and
1247 * choose minimum necessary P-value for output rates below VCO maximum
1248 * - calculate N-value based on selected M and P
1249 * - calculate SDM_DIN fractional part
1251 static int tegra210_pll_fixed_mdiv_cfg(struct clk_hw
*hw
,
1252 struct tegra_clk_pll_freq_table
*cfg
,
1253 unsigned long rate
, unsigned long input_rate
)
1255 struct tegra_clk_pll
*pll
= to_clk_pll(hw
);
1256 struct tegra_clk_pll_params
*params
= pll
->params
;
1258 unsigned long cf
, p_rate
;
1264 if (!(params
->flags
& TEGRA_PLL_VCO_OUT
)) {
1265 p
= DIV_ROUND_UP(params
->vco_min
, rate
);
1266 p
= params
->round_p_to_pdiv(p
, &pdiv
);
1268 p
= rate
>= params
->vco_min
? 1 : -EINVAL
;
1274 cfg
->m
= tegra_pll_get_fixed_mdiv(hw
, input_rate
);
1277 /* Store P as HW value, as that is what is expected */
1278 cfg
->p
= tegra_pll_p_div_to_hw(pll
, cfg
->p
);
1281 if (p_rate
> params
->vco_max
)
1282 p_rate
= params
->vco_max
;
1283 cf
= input_rate
/ cfg
->m
;
1284 cfg
->n
= p_rate
/ cf
;
1287 cfg
->output_rate
= input_rate
;
1288 if (params
->sdm_ctrl_reg
) {
1289 unsigned long rem
= p_rate
- cf
* cfg
->n
;
1290 /* If ssc is enabled SDM enabled as well, even for integer n */
1291 if (rem
|| params
->ssc_ctrl_reg
) {
1292 u64 s
= rem
* PLL_SDM_COEFF
;
1295 s
-= PLL_SDM_COEFF
/ 2;
1296 cfg
->sdm_data
= sdin_din_to_data(s
);
1298 cfg
->output_rate
*= sdin_get_n_eff(cfg
);
1299 cfg
->output_rate
/= p
* cfg
->m
* PLL_SDM_COEFF
;
1301 cfg
->output_rate
*= cfg
->n
;
1302 cfg
->output_rate
/= p
* cfg
->m
;
1305 cfg
->input_rate
= input_rate
;
1311 * clk_pll_set_gain - set gain to m, n to calculate correct VCO rate
1313 * @cfg: struct tegra_clk_pll_freq_table * cfg
1316 * Fvco = Fref * NDIV / MDIV
1318 * For fractional mode:
1319 * Fvco = Fref * (NDIV + 0.5 + SDM_DIN / PLL_SDM_COEFF) / MDIV
1321 static void tegra210_clk_pll_set_gain(struct tegra_clk_pll_freq_table
*cfg
)
1323 cfg
->n
= sdin_get_n_eff(cfg
);
1324 cfg
->m
*= PLL_SDM_COEFF
;
1327 static unsigned long
1328 tegra210_clk_adjust_vco_min(struct tegra_clk_pll_params
*params
,
1329 unsigned long parent_rate
)
1331 unsigned long vco_min
= params
->vco_min
;
1333 params
->vco_min
+= DIV_ROUND_UP(parent_rate
, PLL_SDM_COEFF
);
1334 vco_min
= min(vco_min
, params
->vco_min
);
1339 static struct div_nmp pllx_nmp
= {
1348 * PLL post divider maps - two types: quasi-linear and exponential
1351 #define PLL_QLIN_PDIV_MAX 16
1352 static const struct pdiv_map pll_qlin_pdiv_to_hw
[] = {
1353 { .pdiv
= 1, .hw_val
= 0 },
1354 { .pdiv
= 2, .hw_val
= 1 },
1355 { .pdiv
= 3, .hw_val
= 2 },
1356 { .pdiv
= 4, .hw_val
= 3 },
1357 { .pdiv
= 5, .hw_val
= 4 },
1358 { .pdiv
= 6, .hw_val
= 5 },
1359 { .pdiv
= 8, .hw_val
= 6 },
1360 { .pdiv
= 9, .hw_val
= 7 },
1361 { .pdiv
= 10, .hw_val
= 8 },
1362 { .pdiv
= 12, .hw_val
= 9 },
1363 { .pdiv
= 15, .hw_val
= 10 },
1364 { .pdiv
= 16, .hw_val
= 11 },
1365 { .pdiv
= 18, .hw_val
= 12 },
1366 { .pdiv
= 20, .hw_val
= 13 },
1367 { .pdiv
= 24, .hw_val
= 14 },
1368 { .pdiv
= 30, .hw_val
= 15 },
1369 { .pdiv
= 32, .hw_val
= 16 },
1372 static u32
pll_qlin_p_to_pdiv(u32 p
, u32
*pdiv
)
1377 for (i
= 0; i
<= PLL_QLIN_PDIV_MAX
; i
++) {
1378 if (p
<= pll_qlin_pdiv_to_hw
[i
].pdiv
) {
1381 return pll_qlin_pdiv_to_hw
[i
].pdiv
;
1389 #define PLL_EXPO_PDIV_MAX 7
1390 static const struct pdiv_map pll_expo_pdiv_to_hw
[] = {
1391 { .pdiv
= 1, .hw_val
= 0 },
1392 { .pdiv
= 2, .hw_val
= 1 },
1393 { .pdiv
= 4, .hw_val
= 2 },
1394 { .pdiv
= 8, .hw_val
= 3 },
1395 { .pdiv
= 16, .hw_val
= 4 },
1396 { .pdiv
= 32, .hw_val
= 5 },
1397 { .pdiv
= 64, .hw_val
= 6 },
1398 { .pdiv
= 128, .hw_val
= 7 },
1401 static u32
pll_expo_p_to_pdiv(u32 p
, u32
*pdiv
)
1409 if (i
<= PLL_EXPO_PDIV_MAX
) {
1418 static struct tegra_clk_pll_freq_table pll_x_freq_table
[] = {
1420 { 12000000, 1000000000, 166, 1, 2, 0 }, /* actual: 996.0 MHz */
1421 { 13000000, 1000000000, 153, 1, 2, 0 }, /* actual: 994.0 MHz */
1422 { 38400000, 1000000000, 156, 3, 2, 0 }, /* actual: 998.4 MHz */
1423 { 0, 0, 0, 0, 0, 0 },
1426 static struct tegra_clk_pll_params pll_x_params
= {
1427 .input_min
= 12000000,
1428 .input_max
= 800000000,
1431 .vco_min
= 1350000000,
1432 .vco_max
= 3000000000UL,
1433 .base_reg
= PLLX_BASE
,
1434 .misc_reg
= PLLX_MISC0
,
1435 .lock_mask
= PLL_BASE_LOCK
,
1436 .lock_enable_bit_idx
= PLL_MISC_LOCK_ENABLE
,
1438 .ext_misc_reg
[0] = PLLX_MISC0
,
1439 .ext_misc_reg
[1] = PLLX_MISC1
,
1440 .ext_misc_reg
[2] = PLLX_MISC2
,
1441 .ext_misc_reg
[3] = PLLX_MISC3
,
1442 .ext_misc_reg
[4] = PLLX_MISC4
,
1443 .ext_misc_reg
[5] = PLLX_MISC5
,
1444 .iddq_reg
= PLLX_MISC3
,
1445 .iddq_bit_idx
= PLLXP_IDDQ_BIT
,
1446 .max_p
= PLL_QLIN_PDIV_MAX
,
1448 .dyn_ramp_reg
= PLLX_MISC2
,
1451 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1452 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1453 .div_nmp
= &pllx_nmp
,
1454 .freq_table
= pll_x_freq_table
,
1455 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_HAS_LOCK_ENABLE
,
1456 .dyn_ramp
= tegra210_pllx_dyn_ramp
,
1457 .set_defaults
= tegra210_pllx_set_defaults
,
1458 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1461 static struct div_nmp pllc_nmp
= {
1470 static struct tegra_clk_pll_freq_table pll_cx_freq_table
[] = {
1471 { 12000000, 510000000, 85, 1, 2, 0 },
1472 { 13000000, 510000000, 78, 1, 2, 0 }, /* actual: 507.0 MHz */
1473 { 38400000, 510000000, 79, 3, 2, 0 }, /* actual: 505.6 MHz */
1474 { 0, 0, 0, 0, 0, 0 },
1477 static struct tegra_clk_pll_params pll_c_params
= {
1478 .input_min
= 12000000,
1479 .input_max
= 700000000,
1482 .vco_min
= 600000000,
1483 .vco_max
= 1200000000,
1484 .base_reg
= PLLC_BASE
,
1485 .misc_reg
= PLLC_MISC0
,
1486 .lock_mask
= PLL_BASE_LOCK
,
1488 .iddq_reg
= PLLC_MISC1
,
1489 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1490 .reset_reg
= PLLC_MISC0
,
1491 .reset_bit_idx
= PLLCX_RESET_BIT
,
1492 .max_p
= PLL_QLIN_PDIV_MAX
,
1493 .ext_misc_reg
[0] = PLLC_MISC0
,
1494 .ext_misc_reg
[1] = PLLC_MISC1
,
1495 .ext_misc_reg
[2] = PLLC_MISC2
,
1496 .ext_misc_reg
[3] = PLLC_MISC3
,
1497 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1498 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1500 .div_nmp
= &pllc_nmp
,
1501 .freq_table
= pll_cx_freq_table
,
1502 .flags
= TEGRA_PLL_USE_LOCK
,
1503 .set_defaults
= _pllc_set_defaults
,
1504 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1507 static struct div_nmp pllcx_nmp
= {
1516 static struct tegra_clk_pll_params pll_c2_params
= {
1517 .input_min
= 12000000,
1518 .input_max
= 700000000,
1521 .vco_min
= 600000000,
1522 .vco_max
= 1200000000,
1523 .base_reg
= PLLC2_BASE
,
1524 .misc_reg
= PLLC2_MISC0
,
1525 .iddq_reg
= PLLC2_MISC1
,
1526 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1527 .reset_reg
= PLLC2_MISC0
,
1528 .reset_bit_idx
= PLLCX_RESET_BIT
,
1529 .lock_mask
= PLLCX_BASE_LOCK
,
1531 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1532 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1534 .div_nmp
= &pllcx_nmp
,
1535 .max_p
= PLL_QLIN_PDIV_MAX
,
1536 .ext_misc_reg
[0] = PLLC2_MISC0
,
1537 .ext_misc_reg
[1] = PLLC2_MISC1
,
1538 .ext_misc_reg
[2] = PLLC2_MISC2
,
1539 .ext_misc_reg
[3] = PLLC2_MISC3
,
1540 .freq_table
= pll_cx_freq_table
,
1541 .flags
= TEGRA_PLL_USE_LOCK
,
1542 .set_defaults
= _pllc2_set_defaults
,
1543 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1546 static struct tegra_clk_pll_params pll_c3_params
= {
1547 .input_min
= 12000000,
1548 .input_max
= 700000000,
1551 .vco_min
= 600000000,
1552 .vco_max
= 1200000000,
1553 .base_reg
= PLLC3_BASE
,
1554 .misc_reg
= PLLC3_MISC0
,
1555 .lock_mask
= PLLCX_BASE_LOCK
,
1557 .iddq_reg
= PLLC3_MISC1
,
1558 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1559 .reset_reg
= PLLC3_MISC0
,
1560 .reset_bit_idx
= PLLCX_RESET_BIT
,
1561 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1562 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1564 .div_nmp
= &pllcx_nmp
,
1565 .max_p
= PLL_QLIN_PDIV_MAX
,
1566 .ext_misc_reg
[0] = PLLC3_MISC0
,
1567 .ext_misc_reg
[1] = PLLC3_MISC1
,
1568 .ext_misc_reg
[2] = PLLC3_MISC2
,
1569 .ext_misc_reg
[3] = PLLC3_MISC3
,
1570 .freq_table
= pll_cx_freq_table
,
1571 .flags
= TEGRA_PLL_USE_LOCK
,
1572 .set_defaults
= _pllc3_set_defaults
,
1573 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1576 static struct div_nmp pllss_nmp
= {
1585 static struct tegra_clk_pll_freq_table pll_c4_vco_freq_table
[] = {
1586 { 12000000, 600000000, 50, 1, 1, 0 },
1587 { 13000000, 600000000, 46, 1, 1, 0 }, /* actual: 598.0 MHz */
1588 { 38400000, 600000000, 62, 4, 1, 0 }, /* actual: 595.2 MHz */
1589 { 0, 0, 0, 0, 0, 0 },
1592 static const struct clk_div_table pll_vco_post_div_table
[] = {
1593 { .val
= 0, .div
= 1 },
1594 { .val
= 1, .div
= 2 },
1595 { .val
= 2, .div
= 3 },
1596 { .val
= 3, .div
= 4 },
1597 { .val
= 4, .div
= 5 },
1598 { .val
= 5, .div
= 6 },
1599 { .val
= 6, .div
= 8 },
1600 { .val
= 7, .div
= 10 },
1601 { .val
= 8, .div
= 12 },
1602 { .val
= 9, .div
= 16 },
1603 { .val
= 10, .div
= 12 },
1604 { .val
= 11, .div
= 16 },
1605 { .val
= 12, .div
= 20 },
1606 { .val
= 13, .div
= 24 },
1607 { .val
= 14, .div
= 32 },
1608 { .val
= 0, .div
= 0 },
1611 static struct tegra_clk_pll_params pll_c4_vco_params
= {
1612 .input_min
= 9600000,
1613 .input_max
= 800000000,
1616 .vco_min
= 500000000,
1617 .vco_max
= 1080000000,
1618 .base_reg
= PLLC4_BASE
,
1619 .misc_reg
= PLLC4_MISC0
,
1620 .lock_mask
= PLL_BASE_LOCK
,
1622 .max_p
= PLL_QLIN_PDIV_MAX
,
1623 .ext_misc_reg
[0] = PLLC4_MISC0
,
1624 .iddq_reg
= PLLC4_BASE
,
1625 .iddq_bit_idx
= PLLSS_IDDQ_BIT
,
1626 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1627 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1629 .div_nmp
= &pllss_nmp
,
1630 .freq_table
= pll_c4_vco_freq_table
,
1631 .set_defaults
= tegra210_pllc4_set_defaults
,
1632 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_VCO_OUT
,
1633 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1636 static struct tegra_clk_pll_freq_table pll_m_freq_table
[] = {
1637 { 12000000, 800000000, 66, 1, 1, 0 }, /* actual: 792.0 MHz */
1638 { 13000000, 800000000, 61, 1, 1, 0 }, /* actual: 793.0 MHz */
1639 { 38400000, 297600000, 93, 4, 3, 0 },
1640 { 38400000, 400000000, 125, 4, 3, 0 },
1641 { 38400000, 532800000, 111, 4, 2, 0 },
1642 { 38400000, 665600000, 104, 3, 2, 0 },
1643 { 38400000, 800000000, 125, 3, 2, 0 },
1644 { 38400000, 931200000, 97, 4, 1, 0 },
1645 { 38400000, 1065600000, 111, 4, 1, 0 },
1646 { 38400000, 1200000000, 125, 4, 1, 0 },
1647 { 38400000, 1331200000, 104, 3, 1, 0 },
1648 { 38400000, 1459200000, 76, 2, 1, 0 },
1649 { 38400000, 1600000000, 125, 3, 1, 0 },
1650 { 0, 0, 0, 0, 0, 0 },
1653 static struct div_nmp pllm_nmp
= {
1656 .override_divm_shift
= 0,
1659 .override_divn_shift
= 8,
1662 .override_divp_shift
= 27,
1665 static struct tegra_clk_pll_params pll_m_params
= {
1666 .input_min
= 9600000,
1667 .input_max
= 500000000,
1670 .vco_min
= 800000000,
1671 .vco_max
= 1866000000,
1672 .base_reg
= PLLM_BASE
,
1673 .misc_reg
= PLLM_MISC2
,
1674 .lock_mask
= PLL_BASE_LOCK
,
1675 .lock_enable_bit_idx
= PLLM_MISC_LOCK_ENABLE
,
1677 .iddq_reg
= PLLM_MISC2
,
1678 .iddq_bit_idx
= PLLM_IDDQ_BIT
,
1679 .max_p
= PLL_QLIN_PDIV_MAX
,
1680 .ext_misc_reg
[0] = PLLM_MISC2
,
1681 .ext_misc_reg
[1] = PLLM_MISC1
,
1682 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1683 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1684 .div_nmp
= &pllm_nmp
,
1685 .pmc_divnm_reg
= PMC_PLLM_WB0_OVERRIDE
,
1686 .pmc_divp_reg
= PMC_PLLM_WB0_OVERRIDE_2
,
1687 .freq_table
= pll_m_freq_table
,
1688 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_HAS_LOCK_ENABLE
,
1689 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1692 static struct tegra_clk_pll_params pll_mb_params
= {
1693 .input_min
= 9600000,
1694 .input_max
= 500000000,
1697 .vco_min
= 800000000,
1698 .vco_max
= 1866000000,
1699 .base_reg
= PLLMB_BASE
,
1700 .misc_reg
= PLLMB_MISC1
,
1701 .lock_mask
= PLL_BASE_LOCK
,
1703 .iddq_reg
= PLLMB_MISC1
,
1704 .iddq_bit_idx
= PLLMB_IDDQ_BIT
,
1705 .max_p
= PLL_QLIN_PDIV_MAX
,
1706 .ext_misc_reg
[0] = PLLMB_MISC1
,
1707 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1708 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1709 .div_nmp
= &pllm_nmp
,
1710 .freq_table
= pll_m_freq_table
,
1711 .flags
= TEGRA_PLL_USE_LOCK
,
1712 .set_defaults
= tegra210_pllmb_set_defaults
,
1713 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1717 static struct tegra_clk_pll_freq_table pll_e_freq_table
[] = {
1718 /* PLLE special case: use cpcon field to store cml divider value */
1719 { 672000000, 100000000, 125, 42, 0, 13 },
1720 { 624000000, 100000000, 125, 39, 0, 13 },
1721 { 336000000, 100000000, 125, 21, 0, 13 },
1722 { 312000000, 100000000, 200, 26, 0, 14 },
1723 { 38400000, 100000000, 125, 2, 0, 14 },
1724 { 12000000, 100000000, 200, 1, 0, 14 },
1725 { 0, 0, 0, 0, 0, 0 },
1728 static struct div_nmp plle_nmp
= {
1737 static struct tegra_clk_pll_params pll_e_params
= {
1738 .input_min
= 12000000,
1739 .input_max
= 800000000,
1742 .vco_min
= 1600000000,
1743 .vco_max
= 2500000000U,
1744 .base_reg
= PLLE_BASE
,
1745 .misc_reg
= PLLE_MISC0
,
1746 .aux_reg
= PLLE_AUX
,
1747 .lock_mask
= PLLE_MISC_LOCK
,
1748 .lock_enable_bit_idx
= PLLE_MISC_LOCK_ENABLE
,
1750 .div_nmp
= &plle_nmp
,
1751 .freq_table
= pll_e_freq_table
,
1752 .flags
= TEGRA_PLL_FIXED
| TEGRA_PLL_LOCK_MISC
| TEGRA_PLL_USE_LOCK
|
1753 TEGRA_PLL_HAS_LOCK_ENABLE
,
1754 .fixed_rate
= 100000000,
1755 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1758 static struct tegra_clk_pll_freq_table pll_re_vco_freq_table
[] = {
1759 { 12000000, 672000000, 56, 1, 1, 0 },
1760 { 13000000, 672000000, 51, 1, 1, 0 }, /* actual: 663.0 MHz */
1761 { 38400000, 672000000, 70, 4, 1, 0 },
1762 { 0, 0, 0, 0, 0, 0 },
1765 static struct div_nmp pllre_nmp
= {
1774 static struct tegra_clk_pll_params pll_re_vco_params
= {
1775 .input_min
= 9600000,
1776 .input_max
= 800000000,
1779 .vco_min
= 350000000,
1780 .vco_max
= 700000000,
1781 .base_reg
= PLLRE_BASE
,
1782 .misc_reg
= PLLRE_MISC0
,
1783 .lock_mask
= PLLRE_MISC_LOCK
,
1785 .max_p
= PLL_QLIN_PDIV_MAX
,
1786 .ext_misc_reg
[0] = PLLRE_MISC0
,
1787 .iddq_reg
= PLLRE_MISC0
,
1788 .iddq_bit_idx
= PLLRE_IDDQ_BIT
,
1789 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1790 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1791 .div_nmp
= &pllre_nmp
,
1792 .freq_table
= pll_re_vco_freq_table
,
1793 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_PLL_LOCK_MISC
| TEGRA_PLL_VCO_OUT
,
1794 .set_defaults
= tegra210_pllre_set_defaults
,
1795 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1798 static struct div_nmp pllp_nmp
= {
1807 static struct tegra_clk_pll_freq_table pll_p_freq_table
[] = {
1808 { 12000000, 408000000, 34, 1, 1, 0 },
1809 { 38400000, 408000000, 85, 8, 1, 0 }, /* cf = 4.8MHz, allowed exception */
1810 { 0, 0, 0, 0, 0, 0 },
1813 static struct tegra_clk_pll_params pll_p_params
= {
1814 .input_min
= 9600000,
1815 .input_max
= 800000000,
1818 .vco_min
= 350000000,
1819 .vco_max
= 700000000,
1820 .base_reg
= PLLP_BASE
,
1821 .misc_reg
= PLLP_MISC0
,
1822 .lock_mask
= PLL_BASE_LOCK
,
1824 .iddq_reg
= PLLP_MISC0
,
1825 .iddq_bit_idx
= PLLXP_IDDQ_BIT
,
1826 .ext_misc_reg
[0] = PLLP_MISC0
,
1827 .ext_misc_reg
[1] = PLLP_MISC1
,
1828 .div_nmp
= &pllp_nmp
,
1829 .freq_table
= pll_p_freq_table
,
1830 .fixed_rate
= 408000000,
1831 .flags
= TEGRA_PLL_FIXED
| TEGRA_PLL_USE_LOCK
| TEGRA_PLL_VCO_OUT
,
1832 .set_defaults
= tegra210_pllp_set_defaults
,
1833 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1836 static struct tegra_clk_pll_params pll_a1_params
= {
1837 .input_min
= 12000000,
1838 .input_max
= 700000000,
1841 .vco_min
= 600000000,
1842 .vco_max
= 1200000000,
1843 .base_reg
= PLLA1_BASE
,
1844 .misc_reg
= PLLA1_MISC0
,
1845 .lock_mask
= PLLCX_BASE_LOCK
,
1847 .iddq_reg
= PLLA1_MISC1
,
1848 .iddq_bit_idx
= PLLCX_IDDQ_BIT
,
1849 .reset_reg
= PLLA1_MISC0
,
1850 .reset_bit_idx
= PLLCX_RESET_BIT
,
1851 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1852 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1853 .div_nmp
= &pllc_nmp
,
1854 .ext_misc_reg
[0] = PLLA1_MISC0
,
1855 .ext_misc_reg
[1] = PLLA1_MISC1
,
1856 .ext_misc_reg
[2] = PLLA1_MISC2
,
1857 .ext_misc_reg
[3] = PLLA1_MISC3
,
1858 .freq_table
= pll_cx_freq_table
,
1859 .flags
= TEGRA_PLL_USE_LOCK
,
1860 .set_defaults
= _plla1_set_defaults
,
1861 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1864 static struct div_nmp plla_nmp
= {
1873 static struct tegra_clk_pll_freq_table pll_a_freq_table
[] = {
1874 { 12000000, 282240000, 47, 1, 2, 1, 0xf148 }, /* actual: 282240234 */
1875 { 12000000, 368640000, 61, 1, 2, 1, 0xfe15 }, /* actual: 368640381 */
1876 { 12000000, 240000000, 60, 1, 3, 1, 0 },
1877 { 13000000, 282240000, 43, 1, 2, 1, 0xfd7d }, /* actual: 282239807 */
1878 { 13000000, 368640000, 56, 1, 2, 1, 0x06d8 }, /* actual: 368640137 */
1879 { 13000000, 240000000, 55, 1, 3, 1, 0 }, /* actual: 238.3 MHz */
1880 { 38400000, 282240000, 44, 3, 2, 1, 0xf333 }, /* actual: 282239844 */
1881 { 38400000, 368640000, 57, 3, 2, 1, 0x0333 }, /* actual: 368639844 */
1882 { 38400000, 240000000, 75, 3, 3, 1, 0 },
1883 { 0, 0, 0, 0, 0, 0, 0 },
1886 static struct tegra_clk_pll_params pll_a_params
= {
1887 .input_min
= 12000000,
1888 .input_max
= 800000000,
1891 .vco_min
= 500000000,
1892 .vco_max
= 1000000000,
1893 .base_reg
= PLLA_BASE
,
1894 .misc_reg
= PLLA_MISC0
,
1895 .lock_mask
= PLL_BASE_LOCK
,
1897 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1898 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1899 .iddq_reg
= PLLA_BASE
,
1900 .iddq_bit_idx
= PLLA_IDDQ_BIT
,
1901 .div_nmp
= &plla_nmp
,
1902 .sdm_din_reg
= PLLA_MISC1
,
1903 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1904 .sdm_ctrl_reg
= PLLA_MISC2
,
1905 .sdm_ctrl_en_mask
= PLLA_SDM_EN_MASK
,
1906 .ext_misc_reg
[0] = PLLA_MISC0
,
1907 .ext_misc_reg
[1] = PLLA_MISC1
,
1908 .ext_misc_reg
[2] = PLLA_MISC2
,
1909 .freq_table
= pll_a_freq_table
,
1910 .flags
= TEGRA_PLL_USE_LOCK
| TEGRA_MDIV_NEW
,
1911 .set_defaults
= tegra210_plla_set_defaults
,
1912 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1913 .set_gain
= tegra210_clk_pll_set_gain
,
1914 .adjust_vco
= tegra210_clk_adjust_vco_min
,
1917 static struct div_nmp plld_nmp
= {
1926 static struct tegra_clk_pll_freq_table pll_d_freq_table
[] = {
1927 { 12000000, 594000000, 99, 1, 2, 0, 0 },
1928 { 13000000, 594000000, 91, 1, 2, 0, 0xfc4f }, /* actual: 594000183 */
1929 { 38400000, 594000000, 30, 1, 2, 0, 0x0e00 },
1930 { 0, 0, 0, 0, 0, 0, 0 },
1933 static struct tegra_clk_pll_params pll_d_params
= {
1934 .input_min
= 12000000,
1935 .input_max
= 800000000,
1938 .vco_min
= 750000000,
1939 .vco_max
= 1500000000,
1940 .base_reg
= PLLD_BASE
,
1941 .misc_reg
= PLLD_MISC0
,
1942 .lock_mask
= PLL_BASE_LOCK
,
1944 .iddq_reg
= PLLD_MISC0
,
1945 .iddq_bit_idx
= PLLD_IDDQ_BIT
,
1946 .round_p_to_pdiv
= pll_expo_p_to_pdiv
,
1947 .pdiv_tohw
= pll_expo_pdiv_to_hw
,
1948 .div_nmp
= &plld_nmp
,
1949 .sdm_din_reg
= PLLD_MISC0
,
1950 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1951 .sdm_ctrl_reg
= PLLD_MISC0
,
1952 .sdm_ctrl_en_mask
= PLLD_SDM_EN_MASK
,
1953 .ext_misc_reg
[0] = PLLD_MISC0
,
1954 .ext_misc_reg
[1] = PLLD_MISC1
,
1955 .freq_table
= pll_d_freq_table
,
1956 .flags
= TEGRA_PLL_USE_LOCK
,
1958 .set_defaults
= tegra210_plld_set_defaults
,
1959 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
1960 .set_gain
= tegra210_clk_pll_set_gain
,
1961 .adjust_vco
= tegra210_clk_adjust_vco_min
,
1964 static struct tegra_clk_pll_freq_table tegra210_pll_d2_freq_table
[] = {
1965 { 12000000, 594000000, 99, 1, 2, 0, 0xf000 },
1966 { 13000000, 594000000, 91, 1, 2, 0, 0xfc4f }, /* actual: 594000183 */
1967 { 38400000, 594000000, 30, 1, 2, 0, 0x0e00 },
1968 { 0, 0, 0, 0, 0, 0, 0 },
1971 /* s/w policy, always tegra_pll_ref */
1972 static struct tegra_clk_pll_params pll_d2_params
= {
1973 .input_min
= 12000000,
1974 .input_max
= 800000000,
1977 .vco_min
= 750000000,
1978 .vco_max
= 1500000000,
1979 .base_reg
= PLLD2_BASE
,
1980 .misc_reg
= PLLD2_MISC0
,
1981 .lock_mask
= PLL_BASE_LOCK
,
1983 .iddq_reg
= PLLD2_BASE
,
1984 .iddq_bit_idx
= PLLSS_IDDQ_BIT
,
1985 .sdm_din_reg
= PLLD2_MISC3
,
1986 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
1987 .sdm_ctrl_reg
= PLLD2_MISC1
,
1988 .sdm_ctrl_en_mask
= PLLD2_SDM_EN_MASK
,
1989 /* disable spread-spectrum for pll_d2 */
1991 .ssc_ctrl_en_mask
= 0,
1992 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
1993 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
1994 .div_nmp
= &pllss_nmp
,
1995 .ext_misc_reg
[0] = PLLD2_MISC0
,
1996 .ext_misc_reg
[1] = PLLD2_MISC1
,
1997 .ext_misc_reg
[2] = PLLD2_MISC2
,
1998 .ext_misc_reg
[3] = PLLD2_MISC3
,
1999 .max_p
= PLL_QLIN_PDIV_MAX
,
2001 .freq_table
= tegra210_pll_d2_freq_table
,
2002 .set_defaults
= tegra210_plld2_set_defaults
,
2003 .flags
= TEGRA_PLL_USE_LOCK
,
2004 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
2005 .set_gain
= tegra210_clk_pll_set_gain
,
2006 .adjust_vco
= tegra210_clk_adjust_vco_min
,
2009 static struct tegra_clk_pll_freq_table pll_dp_freq_table
[] = {
2010 { 12000000, 270000000, 90, 1, 4, 0, 0xf000 },
2011 { 13000000, 270000000, 83, 1, 4, 0, 0xf000 }, /* actual: 269.8 MHz */
2012 { 38400000, 270000000, 28, 1, 4, 0, 0xf400 },
2013 { 0, 0, 0, 0, 0, 0, 0 },
2016 static struct tegra_clk_pll_params pll_dp_params
= {
2017 .input_min
= 12000000,
2018 .input_max
= 800000000,
2021 .vco_min
= 750000000,
2022 .vco_max
= 1500000000,
2023 .base_reg
= PLLDP_BASE
,
2024 .misc_reg
= PLLDP_MISC
,
2025 .lock_mask
= PLL_BASE_LOCK
,
2027 .iddq_reg
= PLLDP_BASE
,
2028 .iddq_bit_idx
= PLLSS_IDDQ_BIT
,
2029 .sdm_din_reg
= PLLDP_SS_CTRL2
,
2030 .sdm_din_mask
= PLLA_SDM_DIN_MASK
,
2031 .sdm_ctrl_reg
= PLLDP_SS_CFG
,
2032 .sdm_ctrl_en_mask
= PLLDP_SDM_EN_MASK
,
2033 .ssc_ctrl_reg
= PLLDP_SS_CFG
,
2034 .ssc_ctrl_en_mask
= PLLDP_SSC_EN_MASK
,
2035 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
2036 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
2037 .div_nmp
= &pllss_nmp
,
2038 .ext_misc_reg
[0] = PLLDP_MISC
,
2039 .ext_misc_reg
[1] = PLLDP_SS_CFG
,
2040 .ext_misc_reg
[2] = PLLDP_SS_CTRL1
,
2041 .ext_misc_reg
[3] = PLLDP_SS_CTRL2
,
2042 .max_p
= PLL_QLIN_PDIV_MAX
,
2044 .freq_table
= pll_dp_freq_table
,
2045 .set_defaults
= tegra210_plldp_set_defaults
,
2046 .flags
= TEGRA_PLL_USE_LOCK
,
2047 .calc_rate
= tegra210_pll_fixed_mdiv_cfg
,
2048 .set_gain
= tegra210_clk_pll_set_gain
,
2049 .adjust_vco
= tegra210_clk_adjust_vco_min
,
2052 static struct div_nmp pllu_nmp
= {
2061 static struct tegra_clk_pll_freq_table pll_u_freq_table
[] = {
2062 { 12000000, 480000000, 40, 1, 0, 0 },
2063 { 13000000, 480000000, 36, 1, 0, 0 }, /* actual: 468.0 MHz */
2064 { 38400000, 480000000, 25, 2, 0, 0 },
2065 { 0, 0, 0, 0, 0, 0 },
2068 static struct tegra_clk_pll_params pll_u_vco_params
= {
2069 .input_min
= 9600000,
2070 .input_max
= 800000000,
2073 .vco_min
= 350000000,
2074 .vco_max
= 700000000,
2075 .base_reg
= PLLU_BASE
,
2076 .misc_reg
= PLLU_MISC0
,
2077 .lock_mask
= PLL_BASE_LOCK
,
2079 .iddq_reg
= PLLU_MISC0
,
2080 .iddq_bit_idx
= PLLU_IDDQ_BIT
,
2081 .ext_misc_reg
[0] = PLLU_MISC0
,
2082 .ext_misc_reg
[1] = PLLU_MISC1
,
2083 .round_p_to_pdiv
= pll_qlin_p_to_pdiv
,
2084 .pdiv_tohw
= pll_qlin_pdiv_to_hw
,
2085 .div_nmp
= &pllu_nmp
,
2086 .freq_table
= pll_u_freq_table
,
2087 .flags
= TEGRA_PLLU
| TEGRA_PLL_USE_LOCK
| TEGRA_PLL_VCO_OUT
,
2090 struct utmi_clk_param
{
2091 /* Oscillator Frequency in KHz */
2093 /* UTMIP PLL Enable Delay Count */
2094 u8 enable_delay_count
;
2095 /* UTMIP PLL Stable count */
2097 /* UTMIP PLL Active delay count */
2098 u8 active_delay_count
;
2099 /* UTMIP PLL Xtal frequency count */
2100 u16 xtal_freq_count
;
2103 static const struct utmi_clk_param utmi_parameters
[] = {
2105 .osc_frequency
= 38400000, .enable_delay_count
= 0x0,
2106 .stable_count
= 0x0, .active_delay_count
= 0x6,
2107 .xtal_freq_count
= 0x80
2109 .osc_frequency
= 13000000, .enable_delay_count
= 0x02,
2110 .stable_count
= 0x33, .active_delay_count
= 0x05,
2111 .xtal_freq_count
= 0x7f
2113 .osc_frequency
= 19200000, .enable_delay_count
= 0x03,
2114 .stable_count
= 0x4b, .active_delay_count
= 0x06,
2115 .xtal_freq_count
= 0xbb
2117 .osc_frequency
= 12000000, .enable_delay_count
= 0x02,
2118 .stable_count
= 0x2f, .active_delay_count
= 0x08,
2119 .xtal_freq_count
= 0x76
2121 .osc_frequency
= 26000000, .enable_delay_count
= 0x04,
2122 .stable_count
= 0x66, .active_delay_count
= 0x09,
2123 .xtal_freq_count
= 0xfe
2125 .osc_frequency
= 16800000, .enable_delay_count
= 0x03,
2126 .stable_count
= 0x41, .active_delay_count
= 0x0a,
2127 .xtal_freq_count
= 0xa4
2131 static struct tegra_clk tegra210_clks
[tegra_clk_max
] __initdata
= {
2132 [tegra_clk_ispb
] = { .dt_id
= TEGRA210_CLK_ISPB
, .present
= true },
2133 [tegra_clk_rtc
] = { .dt_id
= TEGRA210_CLK_RTC
, .present
= true },
2134 [tegra_clk_timer
] = { .dt_id
= TEGRA210_CLK_TIMER
, .present
= true },
2135 [tegra_clk_uarta_8
] = { .dt_id
= TEGRA210_CLK_UARTA
, .present
= true },
2136 [tegra_clk_sdmmc2_9
] = { .dt_id
= TEGRA210_CLK_SDMMC2
, .present
= true },
2137 [tegra_clk_i2s1
] = { .dt_id
= TEGRA210_CLK_I2S1
, .present
= true },
2138 [tegra_clk_i2c1
] = { .dt_id
= TEGRA210_CLK_I2C1
, .present
= true },
2139 [tegra_clk_sdmmc1_9
] = { .dt_id
= TEGRA210_CLK_SDMMC1
, .present
= true },
2140 [tegra_clk_sdmmc4_9
] = { .dt_id
= TEGRA210_CLK_SDMMC4
, .present
= true },
2141 [tegra_clk_pwm
] = { .dt_id
= TEGRA210_CLK_PWM
, .present
= true },
2142 [tegra_clk_i2s2
] = { .dt_id
= TEGRA210_CLK_I2S2
, .present
= true },
2143 [tegra_clk_usbd
] = { .dt_id
= TEGRA210_CLK_USBD
, .present
= true },
2144 [tegra_clk_isp_9
] = { .dt_id
= TEGRA210_CLK_ISP
, .present
= true },
2145 [tegra_clk_disp2_8
] = { .dt_id
= TEGRA210_CLK_DISP2
, .present
= true },
2146 [tegra_clk_disp1_8
] = { .dt_id
= TEGRA210_CLK_DISP1
, .present
= true },
2147 [tegra_clk_host1x_9
] = { .dt_id
= TEGRA210_CLK_HOST1X
, .present
= true },
2148 [tegra_clk_i2s0
] = { .dt_id
= TEGRA210_CLK_I2S0
, .present
= true },
2149 [tegra_clk_apbdma
] = { .dt_id
= TEGRA210_CLK_APBDMA
, .present
= true },
2150 [tegra_clk_kfuse
] = { .dt_id
= TEGRA210_CLK_KFUSE
, .present
= true },
2151 [tegra_clk_sbc1_9
] = { .dt_id
= TEGRA210_CLK_SBC1
, .present
= true },
2152 [tegra_clk_sbc2_9
] = { .dt_id
= TEGRA210_CLK_SBC2
, .present
= true },
2153 [tegra_clk_sbc3_9
] = { .dt_id
= TEGRA210_CLK_SBC3
, .present
= true },
2154 [tegra_clk_i2c5
] = { .dt_id
= TEGRA210_CLK_I2C5
, .present
= true },
2155 [tegra_clk_csi
] = { .dt_id
= TEGRA210_CLK_CSI
, .present
= true },
2156 [tegra_clk_i2c2
] = { .dt_id
= TEGRA210_CLK_I2C2
, .present
= true },
2157 [tegra_clk_uartc_8
] = { .dt_id
= TEGRA210_CLK_UARTC
, .present
= true },
2158 [tegra_clk_mipi_cal
] = { .dt_id
= TEGRA210_CLK_MIPI_CAL
, .present
= true },
2159 [tegra_clk_emc
] = { .dt_id
= TEGRA210_CLK_EMC
, .present
= true },
2160 [tegra_clk_usb2
] = { .dt_id
= TEGRA210_CLK_USB2
, .present
= true },
2161 [tegra_clk_bsev
] = { .dt_id
= TEGRA210_CLK_BSEV
, .present
= true },
2162 [tegra_clk_uartd_8
] = { .dt_id
= TEGRA210_CLK_UARTD
, .present
= true },
2163 [tegra_clk_i2c3
] = { .dt_id
= TEGRA210_CLK_I2C3
, .present
= true },
2164 [tegra_clk_sbc4_9
] = { .dt_id
= TEGRA210_CLK_SBC4
, .present
= true },
2165 [tegra_clk_sdmmc3_9
] = { .dt_id
= TEGRA210_CLK_SDMMC3
, .present
= true },
2166 [tegra_clk_pcie
] = { .dt_id
= TEGRA210_CLK_PCIE
, .present
= true },
2167 [tegra_clk_owr_8
] = { .dt_id
= TEGRA210_CLK_OWR
, .present
= true },
2168 [tegra_clk_afi
] = { .dt_id
= TEGRA210_CLK_AFI
, .present
= true },
2169 [tegra_clk_csite_8
] = { .dt_id
= TEGRA210_CLK_CSITE
, .present
= true },
2170 [tegra_clk_soc_therm_8
] = { .dt_id
= TEGRA210_CLK_SOC_THERM
, .present
= true },
2171 [tegra_clk_dtv
] = { .dt_id
= TEGRA210_CLK_DTV
, .present
= true },
2172 [tegra_clk_i2cslow
] = { .dt_id
= TEGRA210_CLK_I2CSLOW
, .present
= true },
2173 [tegra_clk_tsec_8
] = { .dt_id
= TEGRA210_CLK_TSEC
, .present
= true },
2174 [tegra_clk_xusb_host
] = { .dt_id
= TEGRA210_CLK_XUSB_HOST
, .present
= true },
2175 [tegra_clk_csus
] = { .dt_id
= TEGRA210_CLK_CSUS
, .present
= true },
2176 [tegra_clk_mselect
] = { .dt_id
= TEGRA210_CLK_MSELECT
, .present
= true },
2177 [tegra_clk_tsensor
] = { .dt_id
= TEGRA210_CLK_TSENSOR
, .present
= true },
2178 [tegra_clk_i2s3
] = { .dt_id
= TEGRA210_CLK_I2S3
, .present
= true },
2179 [tegra_clk_i2s4
] = { .dt_id
= TEGRA210_CLK_I2S4
, .present
= true },
2180 [tegra_clk_i2c4
] = { .dt_id
= TEGRA210_CLK_I2C4
, .present
= true },
2181 [tegra_clk_d_audio
] = { .dt_id
= TEGRA210_CLK_D_AUDIO
, .present
= true },
2182 [tegra_clk_hda2codec_2x_8
] = { .dt_id
= TEGRA210_CLK_HDA2CODEC_2X
, .present
= true },
2183 [tegra_clk_spdif_2x
] = { .dt_id
= TEGRA210_CLK_SPDIF_2X
, .present
= true },
2184 [tegra_clk_actmon
] = { .dt_id
= TEGRA210_CLK_ACTMON
, .present
= true },
2185 [tegra_clk_extern1
] = { .dt_id
= TEGRA210_CLK_EXTERN1
, .present
= true },
2186 [tegra_clk_extern2
] = { .dt_id
= TEGRA210_CLK_EXTERN2
, .present
= true },
2187 [tegra_clk_extern3
] = { .dt_id
= TEGRA210_CLK_EXTERN3
, .present
= true },
2188 [tegra_clk_sata_oob_8
] = { .dt_id
= TEGRA210_CLK_SATA_OOB
, .present
= true },
2189 [tegra_clk_sata_8
] = { .dt_id
= TEGRA210_CLK_SATA
, .present
= true },
2190 [tegra_clk_hda_8
] = { .dt_id
= TEGRA210_CLK_HDA
, .present
= true },
2191 [tegra_clk_hda2hdmi
] = { .dt_id
= TEGRA210_CLK_HDA2HDMI
, .present
= true },
2192 [tegra_clk_cilab
] = { .dt_id
= TEGRA210_CLK_CILAB
, .present
= true },
2193 [tegra_clk_cilcd
] = { .dt_id
= TEGRA210_CLK_CILCD
, .present
= true },
2194 [tegra_clk_cile
] = { .dt_id
= TEGRA210_CLK_CILE
, .present
= true },
2195 [tegra_clk_dsialp
] = { .dt_id
= TEGRA210_CLK_DSIALP
, .present
= true },
2196 [tegra_clk_dsiblp
] = { .dt_id
= TEGRA210_CLK_DSIBLP
, .present
= true },
2197 [tegra_clk_entropy_8
] = { .dt_id
= TEGRA210_CLK_ENTROPY
, .present
= true },
2198 [tegra_clk_xusb_ss
] = { .dt_id
= TEGRA210_CLK_XUSB_SS
, .present
= true },
2199 [tegra_clk_i2c6
] = { .dt_id
= TEGRA210_CLK_I2C6
, .present
= true },
2200 [tegra_clk_vim2_clk
] = { .dt_id
= TEGRA210_CLK_VIM2_CLK
, .present
= true },
2201 [tegra_clk_clk72Mhz_8
] = { .dt_id
= TEGRA210_CLK_CLK72MHZ
, .present
= true },
2202 [tegra_clk_vic03_8
] = { .dt_id
= TEGRA210_CLK_VIC03
, .present
= true },
2203 [tegra_clk_dpaux
] = { .dt_id
= TEGRA210_CLK_DPAUX
, .present
= true },
2204 [tegra_clk_dpaux1
] = { .dt_id
= TEGRA210_CLK_DPAUX1
, .present
= true },
2205 [tegra_clk_sor0
] = { .dt_id
= TEGRA210_CLK_SOR0
, .present
= true },
2206 [tegra_clk_sor0_lvds
] = { .dt_id
= TEGRA210_CLK_SOR0_LVDS
, .present
= true },
2207 [tegra_clk_sor1
] = { .dt_id
= TEGRA210_CLK_SOR1
, .present
= true },
2208 [tegra_clk_sor1_src
] = { .dt_id
= TEGRA210_CLK_SOR1_SRC
, .present
= true },
2209 [tegra_clk_gpu
] = { .dt_id
= TEGRA210_CLK_GPU
, .present
= true },
2210 [tegra_clk_pll_g_ref
] = { .dt_id
= TEGRA210_CLK_PLL_G_REF
, .present
= true, },
2211 [tegra_clk_uartb_8
] = { .dt_id
= TEGRA210_CLK_UARTB
, .present
= true },
2212 [tegra_clk_spdif_in_8
] = { .dt_id
= TEGRA210_CLK_SPDIF_IN
, .present
= true },
2213 [tegra_clk_spdif_out
] = { .dt_id
= TEGRA210_CLK_SPDIF_OUT
, .present
= true },
2214 [tegra_clk_vi_10
] = { .dt_id
= TEGRA210_CLK_VI
, .present
= true },
2215 [tegra_clk_vi_sensor_8
] = { .dt_id
= TEGRA210_CLK_VI_SENSOR
, .present
= true },
2216 [tegra_clk_fuse
] = { .dt_id
= TEGRA210_CLK_FUSE
, .present
= true },
2217 [tegra_clk_fuse_burn
] = { .dt_id
= TEGRA210_CLK_FUSE_BURN
, .present
= true },
2218 [tegra_clk_clk_32k
] = { .dt_id
= TEGRA210_CLK_CLK_32K
, .present
= true },
2219 [tegra_clk_clk_m
] = { .dt_id
= TEGRA210_CLK_CLK_M
, .present
= true },
2220 [tegra_clk_clk_m_div2
] = { .dt_id
= TEGRA210_CLK_CLK_M_DIV2
, .present
= true },
2221 [tegra_clk_clk_m_div4
] = { .dt_id
= TEGRA210_CLK_CLK_M_DIV4
, .present
= true },
2222 [tegra_clk_pll_ref
] = { .dt_id
= TEGRA210_CLK_PLL_REF
, .present
= true },
2223 [tegra_clk_pll_c
] = { .dt_id
= TEGRA210_CLK_PLL_C
, .present
= true },
2224 [tegra_clk_pll_c_out1
] = { .dt_id
= TEGRA210_CLK_PLL_C_OUT1
, .present
= true },
2225 [tegra_clk_pll_c2
] = { .dt_id
= TEGRA210_CLK_PLL_C2
, .present
= true },
2226 [tegra_clk_pll_c3
] = { .dt_id
= TEGRA210_CLK_PLL_C3
, .present
= true },
2227 [tegra_clk_pll_m
] = { .dt_id
= TEGRA210_CLK_PLL_M
, .present
= true },
2228 [tegra_clk_pll_p
] = { .dt_id
= TEGRA210_CLK_PLL_P
, .present
= true },
2229 [tegra_clk_pll_p_out1
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT1
, .present
= true },
2230 [tegra_clk_pll_p_out3
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT3
, .present
= true },
2231 [tegra_clk_pll_p_out4_cpu
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT4
, .present
= true },
2232 [tegra_clk_pll_p_out_hsio
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_HSIO
, .present
= true },
2233 [tegra_clk_pll_p_out_xusb
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_XUSB
, .present
= true },
2234 [tegra_clk_pll_p_out_cpu
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_CPU
, .present
= true },
2235 [tegra_clk_pll_p_out_adsp
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT_ADSP
, .present
= true },
2236 [tegra_clk_pll_a
] = { .dt_id
= TEGRA210_CLK_PLL_A
, .present
= true },
2237 [tegra_clk_pll_a_out0
] = { .dt_id
= TEGRA210_CLK_PLL_A_OUT0
, .present
= true },
2238 [tegra_clk_pll_d
] = { .dt_id
= TEGRA210_CLK_PLL_D
, .present
= true },
2239 [tegra_clk_pll_d_out0
] = { .dt_id
= TEGRA210_CLK_PLL_D_OUT0
, .present
= true },
2240 [tegra_clk_pll_d2
] = { .dt_id
= TEGRA210_CLK_PLL_D2
, .present
= true },
2241 [tegra_clk_pll_d2_out0
] = { .dt_id
= TEGRA210_CLK_PLL_D2_OUT0
, .present
= true },
2242 [tegra_clk_pll_u
] = { .dt_id
= TEGRA210_CLK_PLL_U
, .present
= true },
2243 [tegra_clk_pll_u_out
] = { .dt_id
= TEGRA210_CLK_PLL_U_OUT
, .present
= true },
2244 [tegra_clk_pll_u_out1
] = { .dt_id
= TEGRA210_CLK_PLL_U_OUT1
, .present
= true },
2245 [tegra_clk_pll_u_out2
] = { .dt_id
= TEGRA210_CLK_PLL_U_OUT2
, .present
= true },
2246 [tegra_clk_pll_u_480m
] = { .dt_id
= TEGRA210_CLK_PLL_U_480M
, .present
= true },
2247 [tegra_clk_pll_u_60m
] = { .dt_id
= TEGRA210_CLK_PLL_U_60M
, .present
= true },
2248 [tegra_clk_pll_u_48m
] = { .dt_id
= TEGRA210_CLK_PLL_U_48M
, .present
= true },
2249 [tegra_clk_pll_x
] = { .dt_id
= TEGRA210_CLK_PLL_X
, .present
= true },
2250 [tegra_clk_pll_x_out0
] = { .dt_id
= TEGRA210_CLK_PLL_X_OUT0
, .present
= true },
2251 [tegra_clk_pll_re_vco
] = { .dt_id
= TEGRA210_CLK_PLL_RE_VCO
, .present
= true },
2252 [tegra_clk_pll_re_out
] = { .dt_id
= TEGRA210_CLK_PLL_RE_OUT
, .present
= true },
2253 [tegra_clk_spdif_in_sync
] = { .dt_id
= TEGRA210_CLK_SPDIF_IN_SYNC
, .present
= true },
2254 [tegra_clk_i2s0_sync
] = { .dt_id
= TEGRA210_CLK_I2S0_SYNC
, .present
= true },
2255 [tegra_clk_i2s1_sync
] = { .dt_id
= TEGRA210_CLK_I2S1_SYNC
, .present
= true },
2256 [tegra_clk_i2s2_sync
] = { .dt_id
= TEGRA210_CLK_I2S2_SYNC
, .present
= true },
2257 [tegra_clk_i2s3_sync
] = { .dt_id
= TEGRA210_CLK_I2S3_SYNC
, .present
= true },
2258 [tegra_clk_i2s4_sync
] = { .dt_id
= TEGRA210_CLK_I2S4_SYNC
, .present
= true },
2259 [tegra_clk_vimclk_sync
] = { .dt_id
= TEGRA210_CLK_VIMCLK_SYNC
, .present
= true },
2260 [tegra_clk_audio0
] = { .dt_id
= TEGRA210_CLK_AUDIO0
, .present
= true },
2261 [tegra_clk_audio1
] = { .dt_id
= TEGRA210_CLK_AUDIO1
, .present
= true },
2262 [tegra_clk_audio2
] = { .dt_id
= TEGRA210_CLK_AUDIO2
, .present
= true },
2263 [tegra_clk_audio3
] = { .dt_id
= TEGRA210_CLK_AUDIO3
, .present
= true },
2264 [tegra_clk_audio4
] = { .dt_id
= TEGRA210_CLK_AUDIO4
, .present
= true },
2265 [tegra_clk_spdif
] = { .dt_id
= TEGRA210_CLK_SPDIF
, .present
= true },
2266 [tegra_clk_clk_out_1
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_1
, .present
= true },
2267 [tegra_clk_clk_out_2
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_2
, .present
= true },
2268 [tegra_clk_clk_out_3
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_3
, .present
= true },
2269 [tegra_clk_blink
] = { .dt_id
= TEGRA210_CLK_BLINK
, .present
= true },
2270 [tegra_clk_xusb_gate
] = { .dt_id
= TEGRA210_CLK_XUSB_GATE
, .present
= true },
2271 [tegra_clk_xusb_host_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_HOST_SRC
, .present
= true },
2272 [tegra_clk_xusb_falcon_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_FALCON_SRC
, .present
= true },
2273 [tegra_clk_xusb_fs_src
] = { .dt_id
= TEGRA210_CLK_XUSB_FS_SRC
, .present
= true },
2274 [tegra_clk_xusb_ss_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_SS_SRC
, .present
= true },
2275 [tegra_clk_xusb_ss_div2
] = { .dt_id
= TEGRA210_CLK_XUSB_SS_DIV2
, .present
= true },
2276 [tegra_clk_xusb_dev_src_8
] = { .dt_id
= TEGRA210_CLK_XUSB_DEV_SRC
, .present
= true },
2277 [tegra_clk_xusb_dev
] = { .dt_id
= TEGRA210_CLK_XUSB_DEV
, .present
= true },
2278 [tegra_clk_xusb_hs_src_4
] = { .dt_id
= TEGRA210_CLK_XUSB_HS_SRC
, .present
= true },
2279 [tegra_clk_xusb_ssp_src
] = { .dt_id
= TEGRA210_CLK_XUSB_SSP_SRC
, .present
= true },
2280 [tegra_clk_usb2_hsic_trk
] = { .dt_id
= TEGRA210_CLK_USB2_HSIC_TRK
, .present
= true },
2281 [tegra_clk_hsic_trk
] = { .dt_id
= TEGRA210_CLK_HSIC_TRK
, .present
= true },
2282 [tegra_clk_usb2_trk
] = { .dt_id
= TEGRA210_CLK_USB2_TRK
, .present
= true },
2283 [tegra_clk_sclk
] = { .dt_id
= TEGRA210_CLK_SCLK
, .present
= true },
2284 [tegra_clk_sclk_mux
] = { .dt_id
= TEGRA210_CLK_SCLK_MUX
, .present
= true },
2285 [tegra_clk_hclk
] = { .dt_id
= TEGRA210_CLK_HCLK
, .present
= true },
2286 [tegra_clk_pclk
] = { .dt_id
= TEGRA210_CLK_PCLK
, .present
= true },
2287 [tegra_clk_cclk_g
] = { .dt_id
= TEGRA210_CLK_CCLK_G
, .present
= true },
2288 [tegra_clk_cclk_lp
] = { .dt_id
= TEGRA210_CLK_CCLK_LP
, .present
= true },
2289 [tegra_clk_dfll_ref
] = { .dt_id
= TEGRA210_CLK_DFLL_REF
, .present
= true },
2290 [tegra_clk_dfll_soc
] = { .dt_id
= TEGRA210_CLK_DFLL_SOC
, .present
= true },
2291 [tegra_clk_vi_sensor2_8
] = { .dt_id
= TEGRA210_CLK_VI_SENSOR2
, .present
= true },
2292 [tegra_clk_pll_p_out5
] = { .dt_id
= TEGRA210_CLK_PLL_P_OUT5
, .present
= true },
2293 [tegra_clk_pll_c4
] = { .dt_id
= TEGRA210_CLK_PLL_C4
, .present
= true },
2294 [tegra_clk_pll_dp
] = { .dt_id
= TEGRA210_CLK_PLL_DP
, .present
= true },
2295 [tegra_clk_audio0_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO0_MUX
, .present
= true },
2296 [tegra_clk_audio1_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO1_MUX
, .present
= true },
2297 [tegra_clk_audio2_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO2_MUX
, .present
= true },
2298 [tegra_clk_audio3_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO3_MUX
, .present
= true },
2299 [tegra_clk_audio4_mux
] = { .dt_id
= TEGRA210_CLK_AUDIO4_MUX
, .present
= true },
2300 [tegra_clk_spdif_mux
] = { .dt_id
= TEGRA210_CLK_SPDIF_MUX
, .present
= true },
2301 [tegra_clk_clk_out_1_mux
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_1_MUX
, .present
= true },
2302 [tegra_clk_clk_out_2_mux
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_2_MUX
, .present
= true },
2303 [tegra_clk_clk_out_3_mux
] = { .dt_id
= TEGRA210_CLK_CLK_OUT_3_MUX
, .present
= true },
2304 [tegra_clk_maud
] = { .dt_id
= TEGRA210_CLK_MAUD
, .present
= true },
2305 [tegra_clk_mipibif
] = { .dt_id
= TEGRA210_CLK_MIPIBIF
, .present
= true },
2306 [tegra_clk_qspi
] = { .dt_id
= TEGRA210_CLK_QSPI
, .present
= true },
2307 [tegra_clk_sdmmc_legacy
] = { .dt_id
= TEGRA210_CLK_SDMMC_LEGACY
, .present
= true },
2308 [tegra_clk_tsecb
] = { .dt_id
= TEGRA210_CLK_TSECB
, .present
= true },
2309 [tegra_clk_uartape
] = { .dt_id
= TEGRA210_CLK_UARTAPE
, .present
= true },
2310 [tegra_clk_vi_i2c
] = { .dt_id
= TEGRA210_CLK_VI_I2C
, .present
= true },
2311 [tegra_clk_ape
] = { .dt_id
= TEGRA210_CLK_APE
, .present
= true },
2312 [tegra_clk_dbgapb
] = { .dt_id
= TEGRA210_CLK_DBGAPB
, .present
= true },
2313 [tegra_clk_nvdec
] = { .dt_id
= TEGRA210_CLK_NVDEC
, .present
= true },
2314 [tegra_clk_nvenc
] = { .dt_id
= TEGRA210_CLK_NVENC
, .present
= true },
2315 [tegra_clk_nvjpg
] = { .dt_id
= TEGRA210_CLK_NVJPG
, .present
= true },
2316 [tegra_clk_pll_c4_out0
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT0
, .present
= true },
2317 [tegra_clk_pll_c4_out1
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT1
, .present
= true },
2318 [tegra_clk_pll_c4_out2
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT2
, .present
= true },
2319 [tegra_clk_pll_c4_out3
] = { .dt_id
= TEGRA210_CLK_PLL_C4_OUT3
, .present
= true },
2320 [tegra_clk_apb2ape
] = { .dt_id
= TEGRA210_CLK_APB2APE
, .present
= true },
2321 [tegra_clk_pll_a1
] = { .dt_id
= TEGRA210_CLK_PLL_A1
, .present
= true },
2322 [tegra_clk_ispa
] = { .dt_id
= TEGRA210_CLK_ISPA
, .present
= true },
2323 [tegra_clk_cec
] = { .dt_id
= TEGRA210_CLK_CEC
, .present
= true },
2324 [tegra_clk_dmic1
] = { .dt_id
= TEGRA210_CLK_DMIC1
, .present
= true },
2325 [tegra_clk_dmic2
] = { .dt_id
= TEGRA210_CLK_DMIC2
, .present
= true },
2326 [tegra_clk_dmic3
] = { .dt_id
= TEGRA210_CLK_DMIC3
, .present
= true },
2327 [tegra_clk_dmic1_sync_clk
] = { .dt_id
= TEGRA210_CLK_DMIC1_SYNC_CLK
, .present
= true },
2328 [tegra_clk_dmic2_sync_clk
] = { .dt_id
= TEGRA210_CLK_DMIC2_SYNC_CLK
, .present
= true },
2329 [tegra_clk_dmic3_sync_clk
] = { .dt_id
= TEGRA210_CLK_DMIC3_SYNC_CLK
, .present
= true },
2330 [tegra_clk_dmic1_sync_clk_mux
] = { .dt_id
= TEGRA210_CLK_DMIC1_SYNC_CLK_MUX
, .present
= true },
2331 [tegra_clk_dmic2_sync_clk_mux
] = { .dt_id
= TEGRA210_CLK_DMIC2_SYNC_CLK_MUX
, .present
= true },
2332 [tegra_clk_dmic3_sync_clk_mux
] = { .dt_id
= TEGRA210_CLK_DMIC3_SYNC_CLK_MUX
, .present
= true },
2333 [tegra_clk_dp2
] = { .dt_id
= TEGRA210_CLK_DP2
, .present
= true },
2334 [tegra_clk_iqc1
] = { .dt_id
= TEGRA210_CLK_IQC1
, .present
= true },
2335 [tegra_clk_iqc2
] = { .dt_id
= TEGRA210_CLK_IQC2
, .present
= true },
2336 [tegra_clk_pll_a_out_adsp
] = { .dt_id
= TEGRA210_CLK_PLL_A_OUT_ADSP
, .present
= true },
2337 [tegra_clk_pll_a_out0_out_adsp
] = { .dt_id
= TEGRA210_CLK_PLL_A_OUT0_OUT_ADSP
, .present
= true },
2338 [tegra_clk_adsp
] = { .dt_id
= TEGRA210_CLK_ADSP
, .present
= true },
2339 [tegra_clk_adsp_neon
] = { .dt_id
= TEGRA210_CLK_ADSP_NEON
, .present
= true },
2342 static struct tegra_devclk devclks
[] __initdata
= {
2343 { .con_id
= "clk_m", .dt_id
= TEGRA210_CLK_CLK_M
},
2344 { .con_id
= "pll_ref", .dt_id
= TEGRA210_CLK_PLL_REF
},
2345 { .con_id
= "clk_32k", .dt_id
= TEGRA210_CLK_CLK_32K
},
2346 { .con_id
= "clk_m_div2", .dt_id
= TEGRA210_CLK_CLK_M_DIV2
},
2347 { .con_id
= "clk_m_div4", .dt_id
= TEGRA210_CLK_CLK_M_DIV4
},
2348 { .con_id
= "pll_c", .dt_id
= TEGRA210_CLK_PLL_C
},
2349 { .con_id
= "pll_c_out1", .dt_id
= TEGRA210_CLK_PLL_C_OUT1
},
2350 { .con_id
= "pll_c2", .dt_id
= TEGRA210_CLK_PLL_C2
},
2351 { .con_id
= "pll_c3", .dt_id
= TEGRA210_CLK_PLL_C3
},
2352 { .con_id
= "pll_p", .dt_id
= TEGRA210_CLK_PLL_P
},
2353 { .con_id
= "pll_p_out1", .dt_id
= TEGRA210_CLK_PLL_P_OUT1
},
2354 { .con_id
= "pll_p_out2", .dt_id
= TEGRA210_CLK_PLL_P_OUT2
},
2355 { .con_id
= "pll_p_out3", .dt_id
= TEGRA210_CLK_PLL_P_OUT3
},
2356 { .con_id
= "pll_p_out4", .dt_id
= TEGRA210_CLK_PLL_P_OUT4
},
2357 { .con_id
= "pll_m", .dt_id
= TEGRA210_CLK_PLL_M
},
2358 { .con_id
= "pll_x", .dt_id
= TEGRA210_CLK_PLL_X
},
2359 { .con_id
= "pll_x_out0", .dt_id
= TEGRA210_CLK_PLL_X_OUT0
},
2360 { .con_id
= "pll_u", .dt_id
= TEGRA210_CLK_PLL_U
},
2361 { .con_id
= "pll_u_out", .dt_id
= TEGRA210_CLK_PLL_U_OUT
},
2362 { .con_id
= "pll_u_out1", .dt_id
= TEGRA210_CLK_PLL_U_OUT1
},
2363 { .con_id
= "pll_u_out2", .dt_id
= TEGRA210_CLK_PLL_U_OUT2
},
2364 { .con_id
= "pll_u_480M", .dt_id
= TEGRA210_CLK_PLL_U_480M
},
2365 { .con_id
= "pll_u_60M", .dt_id
= TEGRA210_CLK_PLL_U_60M
},
2366 { .con_id
= "pll_u_48M", .dt_id
= TEGRA210_CLK_PLL_U_48M
},
2367 { .con_id
= "pll_d", .dt_id
= TEGRA210_CLK_PLL_D
},
2368 { .con_id
= "pll_d_out0", .dt_id
= TEGRA210_CLK_PLL_D_OUT0
},
2369 { .con_id
= "pll_d2", .dt_id
= TEGRA210_CLK_PLL_D2
},
2370 { .con_id
= "pll_d2_out0", .dt_id
= TEGRA210_CLK_PLL_D2_OUT0
},
2371 { .con_id
= "pll_a", .dt_id
= TEGRA210_CLK_PLL_A
},
2372 { .con_id
= "pll_a_out0", .dt_id
= TEGRA210_CLK_PLL_A_OUT0
},
2373 { .con_id
= "pll_re_vco", .dt_id
= TEGRA210_CLK_PLL_RE_VCO
},
2374 { .con_id
= "pll_re_out", .dt_id
= TEGRA210_CLK_PLL_RE_OUT
},
2375 { .con_id
= "spdif_in_sync", .dt_id
= TEGRA210_CLK_SPDIF_IN_SYNC
},
2376 { .con_id
= "i2s0_sync", .dt_id
= TEGRA210_CLK_I2S0_SYNC
},
2377 { .con_id
= "i2s1_sync", .dt_id
= TEGRA210_CLK_I2S1_SYNC
},
2378 { .con_id
= "i2s2_sync", .dt_id
= TEGRA210_CLK_I2S2_SYNC
},
2379 { .con_id
= "i2s3_sync", .dt_id
= TEGRA210_CLK_I2S3_SYNC
},
2380 { .con_id
= "i2s4_sync", .dt_id
= TEGRA210_CLK_I2S4_SYNC
},
2381 { .con_id
= "vimclk_sync", .dt_id
= TEGRA210_CLK_VIMCLK_SYNC
},
2382 { .con_id
= "audio0", .dt_id
= TEGRA210_CLK_AUDIO0
},
2383 { .con_id
= "audio1", .dt_id
= TEGRA210_CLK_AUDIO1
},
2384 { .con_id
= "audio2", .dt_id
= TEGRA210_CLK_AUDIO2
},
2385 { .con_id
= "audio3", .dt_id
= TEGRA210_CLK_AUDIO3
},
2386 { .con_id
= "audio4", .dt_id
= TEGRA210_CLK_AUDIO4
},
2387 { .con_id
= "spdif", .dt_id
= TEGRA210_CLK_SPDIF
},
2388 { .con_id
= "spdif_2x", .dt_id
= TEGRA210_CLK_SPDIF_2X
},
2389 { .con_id
= "extern1", .dev_id
= "clk_out_1", .dt_id
= TEGRA210_CLK_EXTERN1
},
2390 { .con_id
= "extern2", .dev_id
= "clk_out_2", .dt_id
= TEGRA210_CLK_EXTERN2
},
2391 { .con_id
= "extern3", .dev_id
= "clk_out_3", .dt_id
= TEGRA210_CLK_EXTERN3
},
2392 { .con_id
= "blink", .dt_id
= TEGRA210_CLK_BLINK
},
2393 { .con_id
= "cclk_g", .dt_id
= TEGRA210_CLK_CCLK_G
},
2394 { .con_id
= "cclk_lp", .dt_id
= TEGRA210_CLK_CCLK_LP
},
2395 { .con_id
= "sclk", .dt_id
= TEGRA210_CLK_SCLK
},
2396 { .con_id
= "hclk", .dt_id
= TEGRA210_CLK_HCLK
},
2397 { .con_id
= "pclk", .dt_id
= TEGRA210_CLK_PCLK
},
2398 { .con_id
= "fuse", .dt_id
= TEGRA210_CLK_FUSE
},
2399 { .dev_id
= "rtc-tegra", .dt_id
= TEGRA210_CLK_RTC
},
2400 { .dev_id
= "timer", .dt_id
= TEGRA210_CLK_TIMER
},
2401 { .con_id
= "pll_c4_out0", .dt_id
= TEGRA210_CLK_PLL_C4_OUT0
},
2402 { .con_id
= "pll_c4_out1", .dt_id
= TEGRA210_CLK_PLL_C4_OUT1
},
2403 { .con_id
= "pll_c4_out2", .dt_id
= TEGRA210_CLK_PLL_C4_OUT2
},
2404 { .con_id
= "pll_c4_out3", .dt_id
= TEGRA210_CLK_PLL_C4_OUT3
},
2405 { .con_id
= "dpaux", .dt_id
= TEGRA210_CLK_DPAUX
},
2406 { .con_id
= "sor0", .dt_id
= TEGRA210_CLK_SOR0
},
2409 static struct tegra_audio_clk_info tegra210_audio_plls
[] = {
2410 { "pll_a", &pll_a_params
, tegra_clk_pll_a
, "pll_ref" },
2411 { "pll_a1", &pll_a1_params
, tegra_clk_pll_a1
, "pll_ref" },
2414 static struct clk
**clks
;
2416 static const char * const aclk_parents
[] = {
2417 "pll_a1", "pll_c", "pll_p", "pll_a_out0", "pll_c2", "pll_c3",
2421 void tegra210_put_utmipll_in_iddq(void)
2425 reg
= readl_relaxed(clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2427 if (reg
& UTMIPLL_HW_PWRDN_CFG0_UTMIPLL_LOCK
) {
2428 pr_err("trying to assert IDDQ while UTMIPLL is locked\n");
2432 reg
|= UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE
;
2433 writel_relaxed(reg
, clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2435 EXPORT_SYMBOL_GPL(tegra210_put_utmipll_in_iddq
);
2437 void tegra210_put_utmipll_out_iddq(void)
2441 reg
= readl_relaxed(clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2442 reg
&= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE
;
2443 writel_relaxed(reg
, clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2445 EXPORT_SYMBOL_GPL(tegra210_put_utmipll_out_iddq
);
2447 static void tegra210_utmi_param_configure(void)
2452 for (i
= 0; i
< ARRAY_SIZE(utmi_parameters
); i
++) {
2453 if (osc_freq
== utmi_parameters
[i
].osc_frequency
)
2457 if (i
>= ARRAY_SIZE(utmi_parameters
)) {
2458 pr_err("%s: Unexpected oscillator freq %lu\n", __func__
,
2463 reg
= readl_relaxed(clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2464 reg
&= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE
;
2465 writel_relaxed(reg
, clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2469 reg
= readl_relaxed(clk_base
+ UTMIP_PLL_CFG2
);
2471 /* Program UTMIP PLL stable and active counts */
2472 /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */
2473 reg
&= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0);
2474 reg
|= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters
[i
].stable_count
);
2476 reg
&= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0);
2478 UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters
[i
].active_delay_count
);
2479 writel_relaxed(reg
, clk_base
+ UTMIP_PLL_CFG2
);
2481 /* Program UTMIP PLL delay and oscillator frequency counts */
2482 reg
= readl_relaxed(clk_base
+ UTMIP_PLL_CFG1
);
2484 reg
&= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0);
2486 UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters
[i
].enable_delay_count
);
2488 reg
&= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0);
2490 UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters
[i
].xtal_freq_count
);
2492 reg
|= UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN
;
2493 writel_relaxed(reg
, clk_base
+ UTMIP_PLL_CFG1
);
2495 /* Remove power downs from UTMIP PLL control bits */
2496 reg
= readl_relaxed(clk_base
+ UTMIP_PLL_CFG1
);
2497 reg
&= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN
;
2498 reg
|= UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP
;
2499 writel_relaxed(reg
, clk_base
+ UTMIP_PLL_CFG1
);
2503 /* Enable samplers for SNPS, XUSB_HOST, XUSB_DEV */
2504 reg
= readl_relaxed(clk_base
+ UTMIP_PLL_CFG2
);
2505 reg
|= UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERUP
;
2506 reg
|= UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERUP
;
2507 reg
|= UTMIP_PLL_CFG2_FORCE_PD_SAMP_D_POWERUP
;
2508 reg
&= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN
;
2509 reg
&= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN
;
2510 reg
&= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_D_POWERDOWN
;
2511 writel_relaxed(reg
, clk_base
+ UTMIP_PLL_CFG2
);
2513 /* Setup HW control of UTMIPLL */
2514 reg
= readl_relaxed(clk_base
+ UTMIP_PLL_CFG1
);
2515 reg
&= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN
;
2516 reg
&= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP
;
2517 writel_relaxed(reg
, clk_base
+ UTMIP_PLL_CFG1
);
2519 reg
= readl_relaxed(clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2520 reg
|= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET
;
2521 reg
&= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL
;
2522 writel_relaxed(reg
, clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2526 reg
= readl_relaxed(clk_base
+ XUSB_PLL_CFG0
);
2527 reg
&= ~XUSB_PLL_CFG0_UTMIPLL_LOCK_DLY
;
2528 writel_relaxed(reg
, clk_base
+ XUSB_PLL_CFG0
);
2532 /* Enable HW control UTMIPLL */
2533 reg
= readl_relaxed(clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2534 reg
|= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE
;
2535 writel_relaxed(reg
, clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2538 static int tegra210_enable_pllu(void)
2540 struct tegra_clk_pll_freq_table
*fentry
;
2541 struct tegra_clk_pll pllu
;
2544 for (fentry
= pll_u_freq_table
; fentry
->input_rate
; fentry
++) {
2545 if (fentry
->input_rate
== pll_ref_freq
)
2549 if (!fentry
->input_rate
) {
2550 pr_err("Unknown PLL_U reference frequency %lu\n", pll_ref_freq
);
2554 /* clear IDDQ bit */
2555 pllu
.params
= &pll_u_vco_params
;
2556 reg
= readl_relaxed(clk_base
+ pllu
.params
->ext_misc_reg
[0]);
2557 reg
&= ~BIT(pllu
.params
->iddq_bit_idx
);
2558 writel_relaxed(reg
, clk_base
+ pllu
.params
->ext_misc_reg
[0]);
2561 reg
= readl_relaxed(clk_base
+ PLLU_BASE
);
2562 reg
&= ~GENMASK(20, 0);
2564 reg
|= fentry
->n
<< 8;
2565 reg
|= fentry
->p
<< 16;
2566 writel(reg
, clk_base
+ PLLU_BASE
);
2569 writel(reg
, clk_base
+ PLLU_BASE
);
2571 readl_relaxed_poll_timeout_atomic(clk_base
+ PLLU_BASE
, reg
,
2572 reg
& PLL_BASE_LOCK
, 2, 1000);
2573 if (!(reg
& PLL_BASE_LOCK
)) {
2574 pr_err("Timed out waiting for PLL_U to lock\n");
2581 static int tegra210_init_pllu(void)
2586 tegra210_pllu_set_defaults(&pll_u_vco_params
);
2587 /* skip initialization when pllu is in hw controlled mode */
2588 reg
= readl_relaxed(clk_base
+ PLLU_BASE
);
2589 if (reg
& PLLU_BASE_OVERRIDE
) {
2590 if (!(reg
& PLL_ENABLE
)) {
2591 err
= tegra210_enable_pllu();
2597 /* enable hw controlled mode */
2598 reg
= readl_relaxed(clk_base
+ PLLU_BASE
);
2599 reg
&= ~PLLU_BASE_OVERRIDE
;
2600 writel(reg
, clk_base
+ PLLU_BASE
);
2602 reg
= readl_relaxed(clk_base
+ PLLU_HW_PWRDN_CFG0
);
2603 reg
|= PLLU_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE
|
2604 PLLU_HW_PWRDN_CFG0_USE_SWITCH_DETECT
|
2605 PLLU_HW_PWRDN_CFG0_USE_LOCKDET
;
2606 reg
&= ~(PLLU_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL
|
2607 PLLU_HW_PWRDN_CFG0_CLK_SWITCH_SWCTL
);
2608 writel_relaxed(reg
, clk_base
+ PLLU_HW_PWRDN_CFG0
);
2610 reg
= readl_relaxed(clk_base
+ XUSB_PLL_CFG0
);
2611 reg
&= ~XUSB_PLL_CFG0_PLLU_LOCK_DLY_MASK
;
2612 writel_relaxed(reg
, clk_base
+ XUSB_PLL_CFG0
);
2615 reg
= readl_relaxed(clk_base
+ PLLU_HW_PWRDN_CFG0
);
2616 reg
|= PLLU_HW_PWRDN_CFG0_SEQ_ENABLE
;
2617 writel_relaxed(reg
, clk_base
+ PLLU_HW_PWRDN_CFG0
);
2620 reg
= readl_relaxed(clk_base
+ PLLU_BASE
);
2621 reg
&= ~PLLU_BASE_CLKENABLE_USB
;
2622 writel_relaxed(reg
, clk_base
+ PLLU_BASE
);
2625 /* enable UTMIPLL hw control if not yet done by the bootloader */
2626 reg
= readl_relaxed(clk_base
+ UTMIPLL_HW_PWRDN_CFG0
);
2627 if (!(reg
& UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE
))
2628 tegra210_utmi_param_configure();
2633 static const char * const sor1_out_parents
[] = {
2635 * Bit 0 of the mux selects sor1_pad_clkout, irrespective of bit 1, so
2636 * the sor1_pad_clkout parent appears twice in the list below. This is
2637 * merely to support clk_get_parent() if firmware happened to set
2638 * these bits to 0b11. While not an invalid setting, code should
2639 * always set the bits to 0b01 to select sor1_pad_clkout.
2641 "sor_safe", "sor1_pad_clkout", "sor1", "sor1_pad_clkout",
2644 static const char * const sor1_parents
[] = {
2645 "pll_p", "pll_d_out0", "pll_d2_out0", "clk_m",
2648 static u32 sor1_parents_idx
[] = { 0, 2, 5, 6 };
2650 static struct tegra_periph_init_data tegra210_periph
[] = {
2651 TEGRA_INIT_DATA_TABLE("sor1", NULL
, NULL
, sor1_parents
,
2652 CLK_SOURCE_SOR1
, 29, 0x7, 0, 0, 8, 1,
2653 TEGRA_DIVIDER_ROUND_UP
, 183, 0, tegra_clk_sor1
,
2654 sor1_parents_idx
, 0, &sor1_lock
),
2657 static __init
void tegra210_periph_clk_init(void __iomem
*clk_base
,
2658 void __iomem
*pmc_base
)
2664 clk
= clk_register_fixed_factor(NULL
, "xusb_ss_div2", "xusb_ss_src", 0,
2666 clks
[TEGRA210_CLK_XUSB_SS_DIV2
] = clk
;
2668 clk
= tegra_clk_register_periph_fixed("sor_safe", "pll_p", 0, clk_base
,
2670 clks
[TEGRA210_CLK_SOR_SAFE
] = clk
;
2672 clk
= tegra_clk_register_periph_fixed("dpaux", "sor_safe", 0, clk_base
,
2674 clks
[TEGRA210_CLK_DPAUX
] = clk
;
2676 clk
= tegra_clk_register_periph_fixed("dpaux1", "sor_safe", 0, clk_base
,
2678 clks
[TEGRA210_CLK_DPAUX1
] = clk
;
2680 clk
= clk_register_mux_table(NULL
, "sor1_out", sor1_out_parents
,
2681 ARRAY_SIZE(sor1_out_parents
), 0,
2682 clk_base
+ CLK_SOURCE_SOR1
, 14, 0x3,
2683 0, NULL
, &sor1_lock
);
2684 clks
[TEGRA210_CLK_SOR1_OUT
] = clk
;
2687 clk
= clk_register_gate(NULL
, "pll_d_dsi_out", "pll_d_out0", 0,
2688 clk_base
+ PLLD_MISC0
, 21, 0, &pll_d_lock
);
2689 clks
[TEGRA210_CLK_PLL_D_DSI_OUT
] = clk
;
2692 clk
= tegra_clk_register_periph_gate("dsia", "pll_d_dsi_out", 0,
2694 periph_clk_enb_refcnt
);
2695 clks
[TEGRA210_CLK_DSIA
] = clk
;
2698 clk
= tegra_clk_register_periph_gate("dsib", "pll_d_dsi_out", 0,
2700 periph_clk_enb_refcnt
);
2701 clks
[TEGRA210_CLK_DSIB
] = clk
;
2704 clk
= clk_register_mux(NULL
, "emc_mux", mux_pllmcp_clkm
,
2705 ARRAY_SIZE(mux_pllmcp_clkm
), 0,
2706 clk_base
+ CLK_SOURCE_EMC
,
2707 29, 3, 0, &emc_lock
);
2709 clk
= tegra_clk_register_mc("mc", "emc_mux", clk_base
+ CLK_SOURCE_EMC
,
2711 clks
[TEGRA210_CLK_MC
] = clk
;
2714 clk
= clk_register_gate(NULL
, "cml0", "pll_e", 0, clk_base
+ PLLE_AUX
,
2716 clk_register_clkdev(clk
, "cml0", NULL
);
2717 clks
[TEGRA210_CLK_CML0
] = clk
;
2720 clk
= clk_register_gate(NULL
, "cml1", "pll_e", 0, clk_base
+ PLLE_AUX
,
2722 clk_register_clkdev(clk
, "cml1", NULL
);
2723 clks
[TEGRA210_CLK_CML1
] = clk
;
2725 clk
= tegra_clk_register_super_clk("aclk", aclk_parents
,
2726 ARRAY_SIZE(aclk_parents
), 0, clk_base
+ 0x6e0,
2728 clks
[TEGRA210_CLK_ACLK
] = clk
;
2730 for (i
= 0; i
< ARRAY_SIZE(tegra210_periph
); i
++) {
2731 struct tegra_periph_init_data
*init
= &tegra210_periph
[i
];
2734 clkp
= tegra_lookup_dt_id(init
->clk_id
, tegra210_clks
);
2736 pr_warn("clock %u not found\n", init
->clk_id
);
2740 clk
= tegra_clk_register_periph_data(clk_base
, init
);
2744 tegra_periph_clk_init(clk_base
, pmc_base
, tegra210_clks
, &pll_p_params
);
2747 static void __init
tegra210_pll_init(void __iomem
*clk_base
,
2753 clk
= tegra_clk_register_pllc_tegra210("pll_c", "pll_ref", clk_base
,
2754 pmc
, 0, &pll_c_params
, NULL
);
2755 if (!WARN_ON(IS_ERR(clk
)))
2756 clk_register_clkdev(clk
, "pll_c", NULL
);
2757 clks
[TEGRA210_CLK_PLL_C
] = clk
;
2760 clk
= tegra_clk_register_divider("pll_c_out1_div", "pll_c",
2761 clk_base
+ PLLC_OUT
, 0, TEGRA_DIVIDER_ROUND_UP
,
2763 clk
= tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
2764 clk_base
+ PLLC_OUT
, 1, 0,
2765 CLK_SET_RATE_PARENT
, 0, NULL
);
2766 clk_register_clkdev(clk
, "pll_c_out1", NULL
);
2767 clks
[TEGRA210_CLK_PLL_C_OUT1
] = clk
;
2770 clk
= clk_register_fixed_factor(NULL
, "pll_c_ud", "pll_c",
2771 CLK_SET_RATE_PARENT
, 1, 1);
2772 clk_register_clkdev(clk
, "pll_c_ud", NULL
);
2773 clks
[TEGRA210_CLK_PLL_C_UD
] = clk
;
2776 clk
= tegra_clk_register_pllc_tegra210("pll_c2", "pll_ref", clk_base
,
2777 pmc
, 0, &pll_c2_params
, NULL
);
2778 clk_register_clkdev(clk
, "pll_c2", NULL
);
2779 clks
[TEGRA210_CLK_PLL_C2
] = clk
;
2782 clk
= tegra_clk_register_pllc_tegra210("pll_c3", "pll_ref", clk_base
,
2783 pmc
, 0, &pll_c3_params
, NULL
);
2784 clk_register_clkdev(clk
, "pll_c3", NULL
);
2785 clks
[TEGRA210_CLK_PLL_C3
] = clk
;
2788 clk
= tegra_clk_register_pllm("pll_m", "osc", clk_base
, pmc
,
2789 CLK_SET_RATE_GATE
, &pll_m_params
, NULL
);
2790 clk_register_clkdev(clk
, "pll_m", NULL
);
2791 clks
[TEGRA210_CLK_PLL_M
] = clk
;
2794 clk
= tegra_clk_register_pllmb("pll_mb", "osc", clk_base
, pmc
,
2795 CLK_SET_RATE_GATE
, &pll_mb_params
, NULL
);
2796 clk_register_clkdev(clk
, "pll_mb", NULL
);
2797 clks
[TEGRA210_CLK_PLL_MB
] = clk
;
2800 clk
= clk_register_fixed_factor(NULL
, "pll_m_ud", "pll_m",
2801 CLK_SET_RATE_PARENT
, 1, 1);
2802 clk_register_clkdev(clk
, "pll_m_ud", NULL
);
2803 clks
[TEGRA210_CLK_PLL_M_UD
] = clk
;
2806 if (!tegra210_init_pllu()) {
2807 clk
= clk_register_fixed_rate(NULL
, "pll_u_vco", "pll_ref", 0,
2809 clk_register_clkdev(clk
, "pll_u_vco", NULL
);
2810 clks
[TEGRA210_CLK_PLL_U
] = clk
;
2814 clk
= clk_register_divider_table(NULL
, "pll_u_out", "pll_u_vco", 0,
2815 clk_base
+ PLLU_BASE
, 16, 4, 0,
2816 pll_vco_post_div_table
, NULL
);
2817 clk_register_clkdev(clk
, "pll_u_out", NULL
);
2818 clks
[TEGRA210_CLK_PLL_U_OUT
] = clk
;
2821 clk
= tegra_clk_register_divider("pll_u_out1_div", "pll_u_out",
2822 clk_base
+ PLLU_OUTA
, 0,
2823 TEGRA_DIVIDER_ROUND_UP
,
2824 8, 8, 1, &pll_u_lock
);
2825 clk
= tegra_clk_register_pll_out("pll_u_out1", "pll_u_out1_div",
2826 clk_base
+ PLLU_OUTA
, 1, 0,
2827 CLK_SET_RATE_PARENT
, 0, &pll_u_lock
);
2828 clk_register_clkdev(clk
, "pll_u_out1", NULL
);
2829 clks
[TEGRA210_CLK_PLL_U_OUT1
] = clk
;
2832 clk
= tegra_clk_register_divider("pll_u_out2_div", "pll_u_out",
2833 clk_base
+ PLLU_OUTA
, 0,
2834 TEGRA_DIVIDER_ROUND_UP
,
2835 24, 8, 1, &pll_u_lock
);
2836 clk
= tegra_clk_register_pll_out("pll_u_out2", "pll_u_out2_div",
2837 clk_base
+ PLLU_OUTA
, 17, 16,
2838 CLK_SET_RATE_PARENT
, 0, &pll_u_lock
);
2839 clk_register_clkdev(clk
, "pll_u_out2", NULL
);
2840 clks
[TEGRA210_CLK_PLL_U_OUT2
] = clk
;
2843 clk
= clk_register_gate(NULL
, "pll_u_480M", "pll_u_vco",
2844 CLK_SET_RATE_PARENT
, clk_base
+ PLLU_BASE
,
2845 22, 0, &pll_u_lock
);
2846 clk_register_clkdev(clk
, "pll_u_480M", NULL
);
2847 clks
[TEGRA210_CLK_PLL_U_480M
] = clk
;
2850 clk
= clk_register_gate(NULL
, "pll_u_60M", "pll_u_out2",
2851 CLK_SET_RATE_PARENT
, clk_base
+ PLLU_BASE
,
2852 23, 0, &pll_u_lock
);
2853 clk_register_clkdev(clk
, "pll_u_60M", NULL
);
2854 clks
[TEGRA210_CLK_PLL_U_60M
] = clk
;
2857 clk
= clk_register_gate(NULL
, "pll_u_48M", "pll_u_out1",
2858 CLK_SET_RATE_PARENT
, clk_base
+ PLLU_BASE
,
2859 25, 0, &pll_u_lock
);
2860 clk_register_clkdev(clk
, "pll_u_48M", NULL
);
2861 clks
[TEGRA210_CLK_PLL_U_48M
] = clk
;
2864 clk
= tegra_clk_register_pll("pll_d", "pll_ref", clk_base
, pmc
, 0,
2865 &pll_d_params
, &pll_d_lock
);
2866 clk_register_clkdev(clk
, "pll_d", NULL
);
2867 clks
[TEGRA210_CLK_PLL_D
] = clk
;
2870 clk
= clk_register_fixed_factor(NULL
, "pll_d_out0", "pll_d",
2871 CLK_SET_RATE_PARENT
, 1, 2);
2872 clk_register_clkdev(clk
, "pll_d_out0", NULL
);
2873 clks
[TEGRA210_CLK_PLL_D_OUT0
] = clk
;
2876 clk
= tegra_clk_register_pllre_tegra210("pll_re_vco", "pll_ref",
2879 &pll_re_lock
, pll_ref_freq
);
2880 clk_register_clkdev(clk
, "pll_re_vco", NULL
);
2881 clks
[TEGRA210_CLK_PLL_RE_VCO
] = clk
;
2883 clk
= clk_register_divider_table(NULL
, "pll_re_out", "pll_re_vco", 0,
2884 clk_base
+ PLLRE_BASE
, 16, 5, 0,
2885 pll_vco_post_div_table
, &pll_re_lock
);
2886 clk_register_clkdev(clk
, "pll_re_out", NULL
);
2887 clks
[TEGRA210_CLK_PLL_RE_OUT
] = clk
;
2889 clk
= tegra_clk_register_divider("pll_re_out1_div", "pll_re_vco",
2890 clk_base
+ PLLRE_OUT1
, 0,
2891 TEGRA_DIVIDER_ROUND_UP
,
2893 clk
= tegra_clk_register_pll_out("pll_re_out1", "pll_re_out1_div",
2894 clk_base
+ PLLRE_OUT1
, 1, 0,
2895 CLK_SET_RATE_PARENT
, 0, NULL
);
2896 clks
[TEGRA210_CLK_PLL_RE_OUT1
] = clk
;
2899 clk
= tegra_clk_register_plle_tegra210("pll_e", "pll_ref",
2900 clk_base
, 0, &pll_e_params
, NULL
);
2901 clk_register_clkdev(clk
, "pll_e", NULL
);
2902 clks
[TEGRA210_CLK_PLL_E
] = clk
;
2905 clk
= tegra_clk_register_pllre("pll_c4_vco", "pll_ref", clk_base
, pmc
,
2906 0, &pll_c4_vco_params
, NULL
, pll_ref_freq
);
2907 clk_register_clkdev(clk
, "pll_c4_vco", NULL
);
2908 clks
[TEGRA210_CLK_PLL_C4
] = clk
;
2911 clk
= clk_register_divider_table(NULL
, "pll_c4_out0", "pll_c4_vco", 0,
2912 clk_base
+ PLLC4_BASE
, 19, 4, 0,
2913 pll_vco_post_div_table
, NULL
);
2914 clk_register_clkdev(clk
, "pll_c4_out0", NULL
);
2915 clks
[TEGRA210_CLK_PLL_C4_OUT0
] = clk
;
2918 clk
= clk_register_fixed_factor(NULL
, "pll_c4_out1", "pll_c4_vco",
2919 CLK_SET_RATE_PARENT
, 1, 3);
2920 clk_register_clkdev(clk
, "pll_c4_out1", NULL
);
2921 clks
[TEGRA210_CLK_PLL_C4_OUT1
] = clk
;
2924 clk
= clk_register_fixed_factor(NULL
, "pll_c4_out2", "pll_c4_vco",
2925 CLK_SET_RATE_PARENT
, 1, 5);
2926 clk_register_clkdev(clk
, "pll_c4_out2", NULL
);
2927 clks
[TEGRA210_CLK_PLL_C4_OUT2
] = clk
;
2930 clk
= tegra_clk_register_divider("pll_c4_out3_div", "pll_c4_out0",
2931 clk_base
+ PLLC4_OUT
, 0, TEGRA_DIVIDER_ROUND_UP
,
2933 clk
= tegra_clk_register_pll_out("pll_c4_out3", "pll_c4_out3_div",
2934 clk_base
+ PLLC4_OUT
, 1, 0,
2935 CLK_SET_RATE_PARENT
, 0, NULL
);
2936 clk_register_clkdev(clk
, "pll_c4_out3", NULL
);
2937 clks
[TEGRA210_CLK_PLL_C4_OUT3
] = clk
;
2940 clk
= tegra_clk_register_pllss_tegra210("pll_dp", "pll_ref", clk_base
,
2941 0, &pll_dp_params
, NULL
);
2942 clk_register_clkdev(clk
, "pll_dp", NULL
);
2943 clks
[TEGRA210_CLK_PLL_DP
] = clk
;
2946 clk
= tegra_clk_register_pllss_tegra210("pll_d2", "pll_ref", clk_base
,
2947 0, &pll_d2_params
, NULL
);
2948 clk_register_clkdev(clk
, "pll_d2", NULL
);
2949 clks
[TEGRA210_CLK_PLL_D2
] = clk
;
2952 clk
= clk_register_fixed_factor(NULL
, "pll_d2_out0", "pll_d2",
2953 CLK_SET_RATE_PARENT
, 1, 1);
2954 clk_register_clkdev(clk
, "pll_d2_out0", NULL
);
2955 clks
[TEGRA210_CLK_PLL_D2_OUT0
] = clk
;
2958 clk
= clk_register_fixed_factor(NULL
, "pll_p_out2", "pll_p",
2959 CLK_SET_RATE_PARENT
, 1, 2);
2960 clk_register_clkdev(clk
, "pll_p_out2", NULL
);
2961 clks
[TEGRA210_CLK_PLL_P_OUT2
] = clk
;
2965 /* Tegra210 CPU clock and reset control functions */
2966 static void tegra210_wait_cpu_in_reset(u32 cpu
)
2971 reg
= readl(clk_base
+ CLK_RST_CONTROLLER_CPU_CMPLX_STATUS
);
2973 } while (!(reg
& (1 << cpu
))); /* check CPU been reset or not */
2976 static void tegra210_disable_cpu_clock(u32 cpu
)
2978 /* flow controller would take care in the power sequence. */
2981 #ifdef CONFIG_PM_SLEEP
2982 static void tegra210_cpu_clock_suspend(void)
2984 /* switch coresite to clk_m, save off original source */
2985 tegra210_cpu_clk_sctx
.clk_csite_src
=
2986 readl(clk_base
+ CLK_SOURCE_CSITE
);
2987 writel(3 << 30, clk_base
+ CLK_SOURCE_CSITE
);
2990 static void tegra210_cpu_clock_resume(void)
2992 writel(tegra210_cpu_clk_sctx
.clk_csite_src
,
2993 clk_base
+ CLK_SOURCE_CSITE
);
2997 static struct tegra_cpu_car_ops tegra210_cpu_car_ops
= {
2998 .wait_for_reset
= tegra210_wait_cpu_in_reset
,
2999 .disable_clock
= tegra210_disable_cpu_clock
,
3000 #ifdef CONFIG_PM_SLEEP
3001 .suspend
= tegra210_cpu_clock_suspend
,
3002 .resume
= tegra210_cpu_clock_resume
,
3006 static const struct of_device_id pmc_match
[] __initconst
= {
3007 { .compatible
= "nvidia,tegra210-pmc" },
3011 static struct tegra_clk_init_table init_table
[] __initdata
= {
3012 { TEGRA210_CLK_UARTA
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
3013 { TEGRA210_CLK_UARTB
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
3014 { TEGRA210_CLK_UARTC
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
3015 { TEGRA210_CLK_UARTD
, TEGRA210_CLK_PLL_P
, 408000000, 0 },
3016 { TEGRA210_CLK_PLL_A
, TEGRA210_CLK_CLK_MAX
, 564480000, 1 },
3017 { TEGRA210_CLK_PLL_A_OUT0
, TEGRA210_CLK_CLK_MAX
, 11289600, 1 },
3018 { TEGRA210_CLK_EXTERN1
, TEGRA210_CLK_PLL_A_OUT0
, 0, 1 },
3019 { TEGRA210_CLK_CLK_OUT_1_MUX
, TEGRA210_CLK_EXTERN1
, 0, 1 },
3020 { TEGRA210_CLK_CLK_OUT_1
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3021 { TEGRA210_CLK_I2S0
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
3022 { TEGRA210_CLK_I2S1
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
3023 { TEGRA210_CLK_I2S2
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
3024 { TEGRA210_CLK_I2S3
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
3025 { TEGRA210_CLK_I2S4
, TEGRA210_CLK_PLL_A_OUT0
, 11289600, 0 },
3026 { TEGRA210_CLK_HOST1X
, TEGRA210_CLK_PLL_P
, 136000000, 1 },
3027 { TEGRA210_CLK_SCLK_MUX
, TEGRA210_CLK_PLL_P
, 0, 1 },
3028 { TEGRA210_CLK_SCLK
, TEGRA210_CLK_CLK_MAX
, 102000000, 1 },
3029 { TEGRA210_CLK_DFLL_SOC
, TEGRA210_CLK_PLL_P
, 51000000, 1 },
3030 { TEGRA210_CLK_DFLL_REF
, TEGRA210_CLK_PLL_P
, 51000000, 1 },
3031 { TEGRA210_CLK_SBC4
, TEGRA210_CLK_PLL_P
, 12000000, 1 },
3032 { TEGRA210_CLK_PLL_RE_VCO
, TEGRA210_CLK_CLK_MAX
, 672000000, 1 },
3033 { TEGRA210_CLK_XUSB_GATE
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3034 { TEGRA210_CLK_XUSB_SS_SRC
, TEGRA210_CLK_PLL_U_480M
, 120000000, 0 },
3035 { TEGRA210_CLK_XUSB_FS_SRC
, TEGRA210_CLK_PLL_U_48M
, 48000000, 0 },
3036 { TEGRA210_CLK_XUSB_HS_SRC
, TEGRA210_CLK_XUSB_SS_SRC
, 120000000, 0 },
3037 { TEGRA210_CLK_XUSB_SSP_SRC
, TEGRA210_CLK_XUSB_SS_SRC
, 120000000, 0 },
3038 { TEGRA210_CLK_XUSB_FALCON_SRC
, TEGRA210_CLK_PLL_P_OUT_XUSB
, 204000000, 0 },
3039 { TEGRA210_CLK_XUSB_HOST_SRC
, TEGRA210_CLK_PLL_P_OUT_XUSB
, 102000000, 0 },
3040 { TEGRA210_CLK_XUSB_DEV_SRC
, TEGRA210_CLK_PLL_P_OUT_XUSB
, 102000000, 0 },
3041 { TEGRA210_CLK_SATA
, TEGRA210_CLK_PLL_P
, 104000000, 0 },
3042 { TEGRA210_CLK_SATA_OOB
, TEGRA210_CLK_PLL_P
, 204000000, 0 },
3043 { TEGRA210_CLK_EMC
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3044 { TEGRA210_CLK_MSELECT
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3045 { TEGRA210_CLK_CSITE
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3046 /* TODO find a way to enable this on-demand */
3047 { TEGRA210_CLK_DBGAPB
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3048 { TEGRA210_CLK_TSENSOR
, TEGRA210_CLK_CLK_M
, 400000, 0 },
3049 { TEGRA210_CLK_I2C1
, TEGRA210_CLK_PLL_P
, 0, 0 },
3050 { TEGRA210_CLK_I2C2
, TEGRA210_CLK_PLL_P
, 0, 0 },
3051 { TEGRA210_CLK_I2C3
, TEGRA210_CLK_PLL_P
, 0, 0 },
3052 { TEGRA210_CLK_I2C4
, TEGRA210_CLK_PLL_P
, 0, 0 },
3053 { TEGRA210_CLK_I2C5
, TEGRA210_CLK_PLL_P
, 0, 0 },
3054 { TEGRA210_CLK_I2C6
, TEGRA210_CLK_PLL_P
, 0, 0 },
3055 { TEGRA210_CLK_PLL_DP
, TEGRA210_CLK_CLK_MAX
, 270000000, 0 },
3056 { TEGRA210_CLK_SOC_THERM
, TEGRA210_CLK_PLL_P
, 51000000, 0 },
3057 { TEGRA210_CLK_CCLK_G
, TEGRA210_CLK_CLK_MAX
, 0, 1 },
3058 { TEGRA210_CLK_PLL_U_OUT1
, TEGRA210_CLK_CLK_MAX
, 48000000, 1 },
3059 { TEGRA210_CLK_PLL_U_OUT2
, TEGRA210_CLK_CLK_MAX
, 60000000, 1 },
3060 /* This MUST be the last entry. */
3061 { TEGRA210_CLK_CLK_MAX
, TEGRA210_CLK_CLK_MAX
, 0, 0 },
3065 * tegra210_clock_apply_init_table - initialize clocks on Tegra210 SoCs
3067 * Program an initial clock rate and enable or disable clocks needed
3068 * by the rest of the kernel, for Tegra210 SoCs. It is intended to be
3069 * called by assigning a pointer to it to tegra_clk_apply_init_table -
3070 * this will be called as an arch_initcall. No return value.
3072 static void __init
tegra210_clock_apply_init_table(void)
3074 tegra_init_from_table(init_table
, clks
, TEGRA210_CLK_CLK_MAX
);
3078 * tegra210_car_barrier - wait for pending writes to the CAR to complete
3080 * Wait for any outstanding writes to the CAR MMIO space from this CPU
3081 * to complete before continuing execution. No return value.
3083 static void tegra210_car_barrier(void)
3085 readl_relaxed(clk_base
+ RST_DFLL_DVCO
);
3089 * tegra210_clock_assert_dfll_dvco_reset - assert the DFLL's DVCO reset
3091 * Assert the reset line of the DFLL's DVCO. No return value.
3093 static void tegra210_clock_assert_dfll_dvco_reset(void)
3097 v
= readl_relaxed(clk_base
+ RST_DFLL_DVCO
);
3098 v
|= (1 << DVFS_DFLL_RESET_SHIFT
);
3099 writel_relaxed(v
, clk_base
+ RST_DFLL_DVCO
);
3100 tegra210_car_barrier();
3104 * tegra210_clock_deassert_dfll_dvco_reset - deassert the DFLL's DVCO reset
3106 * Deassert the reset line of the DFLL's DVCO, allowing the DVCO to
3107 * operate. No return value.
3109 static void tegra210_clock_deassert_dfll_dvco_reset(void)
3113 v
= readl_relaxed(clk_base
+ RST_DFLL_DVCO
);
3114 v
&= ~(1 << DVFS_DFLL_RESET_SHIFT
);
3115 writel_relaxed(v
, clk_base
+ RST_DFLL_DVCO
);
3116 tegra210_car_barrier();
3119 static int tegra210_reset_assert(unsigned long id
)
3121 if (id
== TEGRA210_RST_DFLL_DVCO
)
3122 tegra210_clock_assert_dfll_dvco_reset();
3123 else if (id
== TEGRA210_RST_ADSP
)
3124 writel(GENMASK(26, 21) | BIT(7),
3125 clk_base
+ CLK_RST_CONTROLLER_RST_DEV_Y_SET
);
3132 static int tegra210_reset_deassert(unsigned long id
)
3134 if (id
== TEGRA210_RST_DFLL_DVCO
)
3135 tegra210_clock_deassert_dfll_dvco_reset();
3136 else if (id
== TEGRA210_RST_ADSP
) {
3137 writel(BIT(21), clk_base
+ CLK_RST_CONTROLLER_RST_DEV_Y_CLR
);
3139 * Considering adsp cpu clock (min: 12.5MHZ, max: 1GHz)
3140 * a delay of 5us ensures that it's at least
3141 * 6 * adsp_cpu_cycle_period long.
3144 writel(GENMASK(26, 22) | BIT(7),
3145 clk_base
+ CLK_RST_CONTROLLER_RST_DEV_Y_CLR
);
3153 * tegra210_clock_init - Tegra210-specific clock initialization
3154 * @np: struct device_node * of the DT node for the SoC CAR IP block
3156 * Register most SoC clocks for the Tegra210 system-on-chip. Intended
3157 * to be called by the OF init code when a DT node with the
3158 * "nvidia,tegra210-car" string is encountered, and declared with
3159 * CLK_OF_DECLARE. No return value.
3161 static void __init
tegra210_clock_init(struct device_node
*np
)
3163 struct device_node
*node
;
3164 u32 value
, clk_m_div
;
3166 clk_base
= of_iomap(np
, 0);
3168 pr_err("ioremap tegra210 CAR failed\n");
3172 node
= of_find_matching_node(NULL
, pmc_match
);
3174 pr_err("Failed to find pmc node\n");
3179 pmc_base
= of_iomap(node
, 0);
3181 pr_err("Can't map pmc registers\n");
3186 clks
= tegra_clk_init(clk_base
, TEGRA210_CLK_CLK_MAX
,
3187 TEGRA210_CAR_BANK_COUNT
);
3191 value
= clk_readl(clk_base
+ SPARE_REG0
) >> CLK_M_DIVISOR_SHIFT
;
3192 clk_m_div
= (value
& CLK_M_DIVISOR_MASK
) + 1;
3194 if (tegra_osc_clk_init(clk_base
, tegra210_clks
, tegra210_input_freq
,
3195 ARRAY_SIZE(tegra210_input_freq
), clk_m_div
,
3196 &osc_freq
, &pll_ref_freq
) < 0)
3199 tegra_fixed_clk_init(tegra210_clks
);
3200 tegra210_pll_init(clk_base
, pmc_base
);
3201 tegra210_periph_clk_init(clk_base
, pmc_base
);
3202 tegra_audio_clk_init(clk_base
, pmc_base
, tegra210_clks
,
3203 tegra210_audio_plls
,
3204 ARRAY_SIZE(tegra210_audio_plls
));
3205 tegra_pmc_clk_init(pmc_base
, tegra210_clks
);
3207 /* For Tegra210, PLLD is the only source for DSIA & DSIB */
3208 value
= clk_readl(clk_base
+ PLLD_BASE
);
3210 clk_writel(value
, clk_base
+ PLLD_BASE
);
3212 tegra_clk_apply_init_table
= tegra210_clock_apply_init_table
;
3214 tegra_super_clk_gen5_init(clk_base
, pmc_base
, tegra210_clks
,
3216 tegra_init_special_resets(2, tegra210_reset_assert
,
3217 tegra210_reset_deassert
);
3219 tegra_add_of_provider(np
);
3220 tegra_register_devclks(devclks
, ARRAY_SIZE(devclks
));
3222 tegra_cpu_car_ops
= &tegra210_cpu_car_ops
;
3224 CLK_OF_DECLARE(tegra210
, "nvidia,tegra210-car", tegra210_clock_init
);