2 * arch/arm/mach-tegra/tegra30_clocks.c
4 * Copyright (c) 2010-2012 NVIDIA CORPORATION. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <linux/clk-private.h>
22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/list.h>
25 #include <linux/spinlock.h>
26 #include <linux/delay.h>
27 #include <linux/err.h>
29 #include <linux/clk.h>
30 #include <linux/cpufreq.h>
34 #include "tegra30_clocks.h"
35 #include "tegra_cpu_car.h"
37 #define DEFINE_CLK_TEGRA(_name, _rate, _ops, _flags, \
38 _parent_names, _parents, _parent) \
39 static struct clk tegra_##_name = { \
40 .hw = &tegra_##_name##_hw.hw, \
45 .parent_names = _parent_names, \
46 .parents = _parents, \
47 .num_parents = ARRAY_SIZE(_parent_names), \
51 static struct clk tegra_clk_32k
;
52 static struct clk_tegra tegra_clk_32k_hw
= {
54 .clk
= &tegra_clk_32k
,
58 static struct clk tegra_clk_32k
= {
60 .hw
= &tegra_clk_32k_hw
.hw
,
61 .ops
= &tegra30_clk_32k_ops
,
65 static struct clk tegra_clk_m
;
66 static struct clk_tegra tegra_clk_m_hw
= {
70 .flags
= ENABLE_ON_INIT
,
75 static struct clk tegra_clk_m
= {
77 .hw
= &tegra_clk_m_hw
.hw
,
78 .ops
= &tegra30_clk_m_ops
,
79 .flags
= CLK_IS_ROOT
| CLK_IGNORE_UNUSED
,
82 static const char *clk_m_div_parent_names
[] = {
86 static struct clk
*clk_m_div_parents
[] = {
90 static struct clk tegra_clk_m_div2
;
91 static struct clk_tegra tegra_clk_m_div2_hw
= {
93 .clk
= &tegra_clk_m_div2
,
99 DEFINE_CLK_TEGRA(clk_m_div2
, 0, &tegra_clk_m_div_ops
, 0,
100 clk_m_div_parent_names
, clk_m_div_parents
, &tegra_clk_m
);
102 static struct clk tegra_clk_m_div4
;
103 static struct clk_tegra tegra_clk_m_div4_hw
= {
105 .clk
= &tegra_clk_m_div4
,
109 .max_rate
= 12000000,
111 DEFINE_CLK_TEGRA(clk_m_div4
, 0, &tegra_clk_m_div_ops
, 0,
112 clk_m_div_parent_names
, clk_m_div_parents
, &tegra_clk_m
);
114 static struct clk tegra_pll_ref
;
115 static struct clk_tegra tegra_pll_ref_hw
= {
117 .clk
= &tegra_pll_ref
,
119 .flags
= ENABLE_ON_INIT
,
120 .max_rate
= 26000000,
122 DEFINE_CLK_TEGRA(pll_ref
, 0, &tegra_pll_ref_ops
, 0, clk_m_div_parent_names
,
123 clk_m_div_parents
, &tegra_clk_m
);
125 #define DEFINE_PLL(_name, _flags, _reg, _max_rate, _input_min, \
126 _input_max, _cf_min, _cf_max, _vco_min, \
127 _vco_max, _freq_table, _lock_delay, _ops, \
128 _fixed_rate, _clk_cfg_ex, _parent) \
129 static struct clk tegra_##_name; \
130 static const char *_name##_parent_names[] = { \
133 static struct clk *_name##_parents[] = { \
136 static struct clk_tegra tegra_##_name##_hw = { \
138 .clk = &tegra_##_name, \
142 .max_rate = _max_rate, \
144 .input_min = _input_min, \
145 .input_max = _input_max, \
148 .vco_min = _vco_min, \
149 .vco_max = _vco_max, \
150 .freq_table = _freq_table, \
151 .lock_delay = _lock_delay, \
152 .fixed_rate = _fixed_rate, \
154 .clk_cfg_ex = _clk_cfg_ex, \
156 DEFINE_CLK_TEGRA(_name, 0, &_ops, CLK_IGNORE_UNUSED, \
157 _name##_parent_names, _name##_parents, \
160 #define DEFINE_PLL_OUT(_name, _flags, _reg, _reg_shift, \
161 _max_rate, _ops, _parent, _clk_flags) \
162 static const char *_name##_parent_names[] = { \
165 static struct clk *_name##_parents[] = { \
168 static struct clk tegra_##_name; \
169 static struct clk_tegra tegra_##_name##_hw = { \
171 .clk = &tegra_##_name, \
175 .max_rate = _max_rate, \
176 .reg_shift = _reg_shift, \
178 DEFINE_CLK_TEGRA(_name, 0, &tegra30_pll_div_ops, \
179 _clk_flags, _name##_parent_names, \
180 _name##_parents, &tegra_##_parent);
182 static struct clk_pll_freq_table tegra_pll_c_freq_table
[] = {
183 { 12000000, 1040000000, 520, 6, 1, 8},
184 { 13000000, 1040000000, 480, 6, 1, 8},
185 { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */
186 { 19200000, 1040000000, 325, 6, 1, 6},
187 { 26000000, 1040000000, 520, 13, 1, 8},
189 { 12000000, 832000000, 416, 6, 1, 8},
190 { 13000000, 832000000, 832, 13, 1, 8},
191 { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */
192 { 19200000, 832000000, 260, 6, 1, 8},
193 { 26000000, 832000000, 416, 13, 1, 8},
195 { 12000000, 624000000, 624, 12, 1, 8},
196 { 13000000, 624000000, 624, 13, 1, 8},
197 { 16800000, 600000000, 520, 14, 1, 8},
198 { 19200000, 624000000, 520, 16, 1, 8},
199 { 26000000, 624000000, 624, 26, 1, 8},
201 { 12000000, 600000000, 600, 12, 1, 8},
202 { 13000000, 600000000, 600, 13, 1, 8},
203 { 16800000, 600000000, 500, 14, 1, 8},
204 { 19200000, 600000000, 375, 12, 1, 6},
205 { 26000000, 600000000, 600, 26, 1, 8},
207 { 12000000, 520000000, 520, 12, 1, 8},
208 { 13000000, 520000000, 520, 13, 1, 8},
209 { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */
210 { 19200000, 520000000, 325, 12, 1, 6},
211 { 26000000, 520000000, 520, 26, 1, 8},
213 { 12000000, 416000000, 416, 12, 1, 8},
214 { 13000000, 416000000, 416, 13, 1, 8},
215 { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */
216 { 19200000, 416000000, 260, 12, 1, 6},
217 { 26000000, 416000000, 416, 26, 1, 8},
218 { 0, 0, 0, 0, 0, 0 },
221 DEFINE_PLL(pll_c
, PLL_HAS_CPCON
, 0x80, 1400000000, 2000000, 31000000, 1000000,
222 6000000, 20000000, 1400000000, tegra_pll_c_freq_table
, 300,
223 tegra30_pll_ops
, 0, NULL
, pll_ref
);
225 DEFINE_PLL_OUT(pll_c_out1
, DIV_U71
, 0x84, 0, 700000000,
226 tegra30_pll_div_ops
, pll_c
, CLK_IGNORE_UNUSED
);
228 static struct clk_pll_freq_table tegra_pll_m_freq_table
[] = {
229 { 12000000, 666000000, 666, 12, 1, 8},
230 { 13000000, 666000000, 666, 13, 1, 8},
231 { 16800000, 666000000, 555, 14, 1, 8},
232 { 19200000, 666000000, 555, 16, 1, 8},
233 { 26000000, 666000000, 666, 26, 1, 8},
234 { 12000000, 600000000, 600, 12, 1, 8},
235 { 13000000, 600000000, 600, 13, 1, 8},
236 { 16800000, 600000000, 500, 14, 1, 8},
237 { 19200000, 600000000, 375, 12, 1, 6},
238 { 26000000, 600000000, 600, 26, 1, 8},
239 { 0, 0, 0, 0, 0, 0 },
242 DEFINE_PLL(pll_m
, PLL_HAS_CPCON
| PLLM
, 0x90, 800000000, 2000000, 31000000,
243 1000000, 6000000, 20000000, 1200000000, tegra_pll_m_freq_table
,
244 300, tegra30_pll_ops
, 0, NULL
, pll_ref
);
246 DEFINE_PLL_OUT(pll_m_out1
, DIV_U71
, 0x94, 0, 600000000,
247 tegra30_pll_div_ops
, pll_m
, CLK_IGNORE_UNUSED
);
249 static struct clk_pll_freq_table tegra_pll_p_freq_table
[] = {
250 { 12000000, 216000000, 432, 12, 2, 8},
251 { 13000000, 216000000, 432, 13, 2, 8},
252 { 16800000, 216000000, 360, 14, 2, 8},
253 { 19200000, 216000000, 360, 16, 2, 8},
254 { 26000000, 216000000, 432, 26, 2, 8},
255 { 0, 0, 0, 0, 0, 0 },
258 DEFINE_PLL(pll_p
, ENABLE_ON_INIT
| PLL_FIXED
| PLL_HAS_CPCON
, 0xa0, 432000000,
259 2000000, 31000000, 1000000, 6000000, 20000000, 1400000000,
260 tegra_pll_p_freq_table
, 300, tegra30_pll_ops
, 408000000, NULL
,
263 DEFINE_PLL_OUT(pll_p_out1
, ENABLE_ON_INIT
| DIV_U71
| DIV_U71_FIXED
, 0xa4,
264 0, 432000000, tegra30_pll_div_ops
, pll_p
, CLK_IGNORE_UNUSED
);
265 DEFINE_PLL_OUT(pll_p_out2
, ENABLE_ON_INIT
| DIV_U71
| DIV_U71_FIXED
, 0xa4,
266 16, 432000000, tegra30_pll_div_ops
, pll_p
, CLK_IGNORE_UNUSED
);
267 DEFINE_PLL_OUT(pll_p_out3
, ENABLE_ON_INIT
| DIV_U71
| DIV_U71_FIXED
, 0xa8,
268 0, 432000000, tegra30_pll_div_ops
, pll_p
, CLK_IGNORE_UNUSED
);
269 DEFINE_PLL_OUT(pll_p_out4
, ENABLE_ON_INIT
| DIV_U71
| DIV_U71_FIXED
, 0xa8,
270 16, 432000000, tegra30_pll_div_ops
, pll_p
, CLK_IGNORE_UNUSED
);
272 static struct clk_pll_freq_table tegra_pll_a_freq_table
[] = {
273 { 9600000, 564480000, 294, 5, 1, 4},
274 { 9600000, 552960000, 288, 5, 1, 4},
275 { 9600000, 24000000, 5, 2, 1, 1},
277 { 28800000, 56448000, 49, 25, 1, 1},
278 { 28800000, 73728000, 64, 25, 1, 1},
279 { 28800000, 24000000, 5, 6, 1, 1},
280 { 0, 0, 0, 0, 0, 0 },
283 DEFINE_PLL(pll_a
, PLL_HAS_CPCON
, 0xb0, 700000000, 2000000, 31000000, 1000000,
284 6000000, 20000000, 1400000000, tegra_pll_a_freq_table
,
285 300, tegra30_pll_ops
, 0, NULL
, pll_p_out1
);
287 DEFINE_PLL_OUT(pll_a_out0
, DIV_U71
, 0xb4, 0, 100000000, tegra30_pll_div_ops
,
288 pll_a
, CLK_IGNORE_UNUSED
);
290 static struct clk_pll_freq_table tegra_pll_d_freq_table
[] = {
291 { 12000000, 216000000, 216, 12, 1, 4},
292 { 13000000, 216000000, 216, 13, 1, 4},
293 { 16800000, 216000000, 180, 14, 1, 4},
294 { 19200000, 216000000, 180, 16, 1, 4},
295 { 26000000, 216000000, 216, 26, 1, 4},
297 { 12000000, 594000000, 594, 12, 1, 8},
298 { 13000000, 594000000, 594, 13, 1, 8},
299 { 16800000, 594000000, 495, 14, 1, 8},
300 { 19200000, 594000000, 495, 16, 1, 8},
301 { 26000000, 594000000, 594, 26, 1, 8},
303 { 12000000, 1000000000, 1000, 12, 1, 12},
304 { 13000000, 1000000000, 1000, 13, 1, 12},
305 { 19200000, 1000000000, 625, 12, 1, 8},
306 { 26000000, 1000000000, 1000, 26, 1, 12},
308 { 0, 0, 0, 0, 0, 0 },
311 DEFINE_PLL(pll_d
, PLL_HAS_CPCON
| PLLD
, 0xd0, 1000000000, 2000000, 40000000,
312 1000000, 6000000, 40000000, 1000000000, tegra_pll_d_freq_table
,
313 1000, tegra30_pll_ops
, 0, tegra30_plld_clk_cfg_ex
, pll_ref
);
315 DEFINE_PLL_OUT(pll_d_out0
, DIV_2
| PLLD
, 0, 0, 500000000, tegra30_pll_div_ops
,
316 pll_d
, CLK_SET_RATE_PARENT
| CLK_IGNORE_UNUSED
);
318 DEFINE_PLL(pll_d2
, PLL_HAS_CPCON
| PLL_ALT_MISC_REG
| PLLD
, 0x4b8, 1000000000,
319 2000000, 40000000, 1000000, 6000000, 40000000, 1000000000,
320 tegra_pll_d_freq_table
, 1000, tegra30_pll_ops
, 0, NULL
,
323 DEFINE_PLL_OUT(pll_d2_out0
, DIV_2
| PLLD
, 0, 0, 500000000, tegra30_pll_div_ops
,
324 pll_d2
, CLK_SET_RATE_PARENT
| CLK_IGNORE_UNUSED
);
326 static struct clk_pll_freq_table tegra_pll_u_freq_table
[] = {
327 { 12000000, 480000000, 960, 12, 2, 12},
328 { 13000000, 480000000, 960, 13, 2, 12},
329 { 16800000, 480000000, 400, 7, 2, 5},
330 { 19200000, 480000000, 200, 4, 2, 3},
331 { 26000000, 480000000, 960, 26, 2, 12},
332 { 0, 0, 0, 0, 0, 0 },
335 DEFINE_PLL(pll_u
, PLL_HAS_CPCON
| PLLU
, 0xc0, 480000000, 2000000, 40000000,
336 1000000, 6000000, 48000000, 960000000, tegra_pll_u_freq_table
,
337 1000, tegra30_pll_ops
, 0, NULL
, pll_ref
);
339 static struct clk_pll_freq_table tegra_pll_x_freq_table
[] = {
341 { 12000000, 1700000000, 850, 6, 1, 8},
342 { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */
343 { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */
344 { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */
345 { 26000000, 1700000000, 850, 13, 1, 8},
348 { 12000000, 1600000000, 800, 6, 1, 8},
349 { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */
350 { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */
351 { 19200000, 1600000000, 500, 6, 1, 8},
352 { 26000000, 1600000000, 800, 13, 1, 8},
355 { 12000000, 1500000000, 750, 6, 1, 8},
356 { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */
357 { 16800000, 1500000000, 625, 7, 1, 8},
358 { 19200000, 1500000000, 625, 8, 1, 8},
359 { 26000000, 1500000000, 750, 13, 1, 8},
362 { 12000000, 1400000000, 700, 6, 1, 8},
363 { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */
364 { 16800000, 1400000000, 1000, 12, 1, 8},
365 { 19200000, 1400000000, 875, 12, 1, 8},
366 { 26000000, 1400000000, 700, 13, 1, 8},
369 { 12000000, 1300000000, 975, 9, 1, 8},
370 { 13000000, 1300000000, 1000, 10, 1, 8},
371 { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */
372 { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */
373 { 26000000, 1300000000, 650, 13, 1, 8},
376 { 12000000, 1200000000, 1000, 10, 1, 8},
377 { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */
378 { 16800000, 1200000000, 1000, 14, 1, 8},
379 { 19200000, 1200000000, 1000, 16, 1, 8},
380 { 26000000, 1200000000, 600, 13, 1, 8},
383 { 12000000, 1100000000, 825, 9, 1, 8},
384 { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */
385 { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */
386 { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */
387 { 26000000, 1100000000, 550, 13, 1, 8},
390 { 12000000, 1000000000, 1000, 12, 1, 8},
391 { 13000000, 1000000000, 1000, 13, 1, 8},
392 { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */
393 { 19200000, 1000000000, 625, 12, 1, 8},
394 { 26000000, 1000000000, 1000, 26, 1, 8},
396 { 0, 0, 0, 0, 0, 0 },
399 DEFINE_PLL(pll_x
, PLL_HAS_CPCON
| PLL_ALT_MISC_REG
| PLLX
, 0xe0, 1700000000,
400 2000000, 31000000, 1000000, 6000000, 20000000, 1700000000,
401 tegra_pll_x_freq_table
, 300, tegra30_pll_ops
, 0, NULL
, pll_ref
);
403 DEFINE_PLL_OUT(pll_x_out0
, DIV_2
| PLLX
, 0, 0, 850000000, tegra30_pll_div_ops
,
404 pll_x
, CLK_SET_RATE_PARENT
| CLK_IGNORE_UNUSED
);
406 static struct clk_pll_freq_table tegra_pll_e_freq_table
[] = {
407 /* PLLE special case: use cpcon field to store cml divider value */
408 { 12000000, 100000000, 150, 1, 18, 11},
409 { 216000000, 100000000, 200, 18, 24, 13},
410 { 0, 0, 0, 0, 0, 0 },
413 DEFINE_PLL(pll_e
, PLL_ALT_MISC_REG
, 0xe8, 100000000, 2000000, 216000000,
414 12000000, 12000000, 1200000000, 2400000000U,
415 tegra_pll_e_freq_table
, 300, tegra30_plle_ops
, 100000000, NULL
,
418 static const char *mux_plle
[] = {
422 static struct clk
*mux_plle_p
[] = {
426 static struct clk tegra_cml0
;
427 static struct clk_tegra tegra_cml0_hw
= {
432 .fixed_rate
= 100000000,
437 DEFINE_CLK_TEGRA(cml0
, 0, &tegra_cml_clk_ops
, 0, mux_plle
,
438 mux_plle_p
, &tegra_pll_e
);
440 static struct clk tegra_cml1
;
441 static struct clk_tegra tegra_cml1_hw
= {
446 .fixed_rate
= 100000000,
451 DEFINE_CLK_TEGRA(cml1
, 0, &tegra_cml_clk_ops
, 0, mux_plle
,
452 mux_plle_p
, &tegra_pll_e
);
454 static struct clk tegra_pciex
;
455 static struct clk_tegra tegra_pciex_hw
= {
460 .fixed_rate
= 100000000,
461 .reset
= tegra30_periph_clk_reset
,
466 DEFINE_CLK_TEGRA(pciex
, 0, &tegra_pciex_clk_ops
, 0, mux_plle
,
467 mux_plle_p
, &tegra_pll_e
);
469 #define SYNC_SOURCE(_name) \
470 static struct clk tegra_##_name##_sync; \
471 static struct clk_tegra tegra_##_name##_sync_hw = { \
473 .clk = &tegra_##_name##_sync, \
475 .max_rate = 24000000, \
476 .fixed_rate = 24000000, \
478 static struct clk tegra_##_name##_sync = { \
479 .name = #_name "_sync", \
480 .hw = &tegra_##_name##_sync_hw.hw, \
481 .ops = &tegra_sync_source_ops, \
482 .flags = CLK_IS_ROOT, \
485 SYNC_SOURCE(spdif_in
);
493 static struct clk
*tegra_sync_source_list
[] = {
494 &tegra_spdif_in_sync
,
503 static const char *mux_audio_sync_clk
[] = {
513 #define AUDIO_SYNC_CLK(_name, _index) \
514 static struct clk tegra_##_name; \
515 static struct clk_tegra tegra_##_name##_hw = { \
517 .clk = &tegra_##_name, \
519 .max_rate = 24000000, \
520 .reg = 0x4A0 + (_index) * 4, \
522 static struct clk tegra_##_name = { \
524 .ops = &tegra30_audio_sync_clk_ops, \
525 .hw = &tegra_##_name##_hw.hw, \
526 .parent_names = mux_audio_sync_clk, \
527 .parents = tegra_sync_source_list, \
528 .num_parents = ARRAY_SIZE(mux_audio_sync_clk), \
531 AUDIO_SYNC_CLK(audio0
, 0);
532 AUDIO_SYNC_CLK(audio1
, 1);
533 AUDIO_SYNC_CLK(audio2
, 2);
534 AUDIO_SYNC_CLK(audio3
, 3);
535 AUDIO_SYNC_CLK(audio4
, 4);
536 AUDIO_SYNC_CLK(audio5
, 5);
538 static struct clk
*tegra_clk_audio_list
[] = {
544 &tegra_audio5
, /* SPDIF */
547 #define AUDIO_SYNC_2X_CLK(_name, _index) \
548 static const char *_name##_parent_names[] = { \
551 static struct clk *_name##_parents[] = { \
554 static struct clk tegra_##_name##_2x; \
555 static struct clk_tegra tegra_##_name##_2x_hw = { \
557 .clk = &tegra_##_name##_2x, \
559 .flags = PERIPH_NO_RESET, \
560 .max_rate = 48000000, \
562 .reg_shift = 24 + (_index), \
564 .clk_num = 113 + (_index), \
567 static struct clk tegra_##_name##_2x = { \
568 .name = #_name "_2x", \
569 .ops = &tegra30_clk_double_ops, \
570 .hw = &tegra_##_name##_2x_hw.hw, \
571 .parent_names = _name##_parent_names, \
572 .parents = _name##_parents, \
573 .parent = &tegra_##_name, \
577 AUDIO_SYNC_2X_CLK(audio0
, 0);
578 AUDIO_SYNC_2X_CLK(audio1
, 1);
579 AUDIO_SYNC_2X_CLK(audio2
, 2);
580 AUDIO_SYNC_2X_CLK(audio3
, 3);
581 AUDIO_SYNC_2X_CLK(audio4
, 4);
582 AUDIO_SYNC_2X_CLK(audio5
, 5); /* SPDIF */
584 static struct clk
*tegra_clk_audio_2x_list
[] = {
590 &tegra_audio5_2x
, /* SPDIF */
593 #define MUX_I2S_SPDIF(_id) \
594 static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { \
600 static struct clk *mux_pllaout0_##_id##_2x_pllp_clkm_p[] = { \
607 MUX_I2S_SPDIF(audio0
);
608 MUX_I2S_SPDIF(audio1
);
609 MUX_I2S_SPDIF(audio2
);
610 MUX_I2S_SPDIF(audio3
);
611 MUX_I2S_SPDIF(audio4
);
612 MUX_I2S_SPDIF(audio5
); /* SPDIF */
614 static struct clk tegra_extern1
;
615 static struct clk tegra_extern2
;
616 static struct clk tegra_extern3
;
618 /* External clock outputs (through PMC) */
619 #define MUX_EXTERN_OUT(_id) \
620 static const char *mux_clkm_clkm2_clkm4_extern##_id[] = { \
626 static struct clk *mux_clkm_clkm2_clkm4_extern##_id##_p[] = { \
630 &tegra_extern##_id, \
637 #define CLK_OUT_CLK(_name, _index) \
638 static struct clk tegra_##_name; \
639 static struct clk_tegra tegra_##_name##_hw = { \
641 .clk = &tegra_##_name, \
645 .con_id = "extern" #_index, \
647 .flags = MUX_CLK_OUT, \
648 .fixed_rate = 216000000, \
651 .clk_num = (_index - 1) * 8 + 2, \
654 static struct clk tegra_##_name = { \
656 .ops = &tegra_clk_out_ops, \
657 .hw = &tegra_##_name##_hw.hw, \
658 .parent_names = mux_clkm_clkm2_clkm4_extern##_index, \
659 .parents = mux_clkm_clkm2_clkm4_extern##_index##_p, \
660 .num_parents = ARRAY_SIZE(mux_clkm_clkm2_clkm4_extern##_index),\
663 CLK_OUT_CLK(clk_out_1
, 1);
664 CLK_OUT_CLK(clk_out_2
, 2);
665 CLK_OUT_CLK(clk_out_3
, 3);
667 static struct clk
*tegra_clk_out_list
[] = {
673 static const char *mux_sclk
[] = {
684 static struct clk
*mux_sclk_p
[] = {
695 static struct clk tegra_clk_sclk
;
696 static struct clk_tegra tegra_clk_sclk_hw
= {
698 .clk
= &tegra_clk_sclk
,
701 .max_rate
= 334000000,
702 .min_rate
= 40000000,
705 static struct clk tegra_clk_sclk
= {
707 .ops
= &tegra30_super_ops
,
708 .hw
= &tegra_clk_sclk_hw
.hw
,
709 .parent_names
= mux_sclk
,
710 .parents
= mux_sclk_p
,
711 .num_parents
= ARRAY_SIZE(mux_sclk
),
714 static const char *tegra_hclk_parent_names
[] = {
718 static struct clk
*tegra_hclk_parents
[] = {
722 static struct clk tegra_hclk
;
723 static struct clk_tegra tegra_hclk_hw
= {
730 .max_rate
= 378000000,
731 .min_rate
= 12000000,
733 DEFINE_CLK_TEGRA(hclk
, 0, &tegra30_bus_ops
, 0, tegra_hclk_parent_names
,
734 tegra_hclk_parents
, &tegra_clk_sclk
);
736 static const char *tegra_pclk_parent_names
[] = {
740 static struct clk
*tegra_pclk_parents
[] = {
744 static struct clk tegra_pclk
;
745 static struct clk_tegra tegra_pclk_hw
= {
752 .max_rate
= 167000000,
753 .min_rate
= 12000000,
755 DEFINE_CLK_TEGRA(pclk
, 0, &tegra30_bus_ops
, 0, tegra_pclk_parent_names
,
756 tegra_pclk_parents
, &tegra_hclk
);
758 static const char *mux_blink
[] = {
762 static struct clk
*mux_blink_p
[] = {
766 static struct clk tegra_clk_blink
;
767 static struct clk_tegra tegra_clk_blink_hw
= {
769 .clk
= &tegra_clk_blink
,
774 static struct clk tegra_clk_blink
= {
776 .ops
= &tegra30_blink_clk_ops
,
777 .hw
= &tegra_clk_blink_hw
.hw
,
778 .parent
= &tegra_clk_32k
,
779 .parent_names
= mux_blink
,
780 .parents
= mux_blink_p
,
781 .num_parents
= ARRAY_SIZE(mux_blink
),
784 static const char *mux_pllm_pllc_pllp_plla
[] = {
791 static const char *mux_pllp_pllc_pllm_clkm
[] = {
798 static const char *mux_pllp_clkm
[] = {
805 static const char *mux_pllp_plld_pllc_clkm
[] = {
812 static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm
[] = {
822 static const char *mux_plla_pllc_pllp_clkm
[] = {
829 static const char *mux_pllp_pllc_clk32_clkm
[] = {
836 static const char *mux_pllp_pllc_clkm_clk32
[] = {
843 static const char *mux_pllp_pllc_pllm
[] = {
849 static const char *mux_clk_m
[] = {
853 static const char *mux_pllp_out3
[] = {
857 static const char *mux_plld_out0
[] = {
861 static const char *mux_plld_out0_plld2_out0
[] = {
866 static const char *mux_clk_32k
[] = {
870 static const char *mux_plla_clk32_pllp_clkm_plle
[] = {
878 static const char *mux_cclk_g
[] = {
890 static struct clk
*mux_pllm_pllc_pllp_plla_p
[] = {
897 static struct clk
*mux_pllp_pllc_pllm_clkm_p
[] = {
904 static struct clk
*mux_pllp_clkm_p
[] = {
911 static struct clk
*mux_pllp_plld_pllc_clkm_p
[] = {
918 static struct clk
*mux_pllp_pllm_plld_plla_pllc_plld2_clkm_p
[] = {
928 static struct clk
*mux_plla_pllc_pllp_clkm_p
[] = {
935 static struct clk
*mux_pllp_pllc_clk32_clkm_p
[] = {
942 static struct clk
*mux_pllp_pllc_clkm_clk32_p
[] = {
949 static struct clk
*mux_pllp_pllc_pllm_p
[] = {
955 static struct clk
*mux_clk_m_p
[] = {
959 static struct clk
*mux_pllp_out3_p
[] = {
963 static struct clk
*mux_plld_out0_p
[] = {
967 static struct clk
*mux_plld_out0_plld2_out0_p
[] = {
972 static struct clk
*mux_clk_32k_p
[] = {
976 static struct clk
*mux_plla_clk32_pllp_clkm_plle_p
[] = {
984 static struct clk
*mux_cclk_g_p
[] = {
996 static struct clk tegra_clk_cclk_g
;
997 static struct clk_tegra tegra_clk_cclk_g_hw
= {
999 .clk
= &tegra_clk_cclk_g
,
1001 .flags
= DIV_U71
| DIV_U71_INT
,
1003 .max_rate
= 1700000000,
1005 static struct clk tegra_clk_cclk_g
= {
1007 .ops
= &tegra30_super_ops
,
1008 .hw
= &tegra_clk_cclk_g_hw
.hw
,
1009 .parent_names
= mux_cclk_g
,
1010 .parents
= mux_cclk_g_p
,
1011 .num_parents
= ARRAY_SIZE(mux_cclk_g
),
1014 static const char *mux_twd
[] = {
1018 static struct clk
*mux_twd_p
[] = {
1022 static struct clk tegra30_clk_twd
;
1023 static struct clk_tegra tegra30_clk_twd_hw
= {
1025 .clk
= &tegra30_clk_twd
,
1027 .max_rate
= 1400000000,
1032 static struct clk tegra30_clk_twd
= {
1034 .ops
= &tegra30_twd_ops
,
1035 .hw
= &tegra30_clk_twd_hw
.hw
,
1036 .parent
= &tegra_clk_cclk_g
,
1037 .parent_names
= mux_twd
,
1038 .parents
= mux_twd_p
,
1039 .num_parents
= ARRAY_SIZE(mux_twd
),
1042 #define PERIPH_CLK(_name, _dev, _con, _clk_num, _reg, \
1043 _max, _inputs, _flags) \
1044 static struct clk tegra_##_name; \
1045 static struct clk_tegra tegra_##_name##_hw = { \
1047 .clk = &tegra_##_name, \
1057 .clk_num = _clk_num, \
1059 .reset = &tegra30_periph_clk_reset, \
1061 static struct clk tegra_##_name = { \
1063 .ops = &tegra30_periph_clk_ops, \
1064 .hw = &tegra_##_name##_hw.hw, \
1065 .parent_names = _inputs, \
1066 .parents = _inputs##_p, \
1067 .num_parents = ARRAY_SIZE(_inputs), \
1070 PERIPH_CLK(apbdma
, "tegra-apbdma", NULL
, 34, 0, 26000000, mux_clk_m
, 0);
1071 PERIPH_CLK(rtc
, "rtc-tegra", NULL
, 4, 0, 32768, mux_clk_32k
, PERIPH_NO_RESET
| PERIPH_ON_APB
);
1072 PERIPH_CLK(kbc
, "tegra-kbc", NULL
, 36, 0, 32768, mux_clk_32k
, PERIPH_NO_RESET
| PERIPH_ON_APB
);
1073 PERIPH_CLK(timer
, "timer", NULL
, 5, 0, 26000000, mux_clk_m
, 0);
1074 PERIPH_CLK(kfuse
, "kfuse-tegra", NULL
, 40, 0, 26000000, mux_clk_m
, 0);
1075 PERIPH_CLK(fuse
, "fuse-tegra", "fuse", 39, 0, 26000000, mux_clk_m
, PERIPH_ON_APB
);
1076 PERIPH_CLK(fuse_burn
, "fuse-tegra", "fuse_burn", 39, 0, 26000000, mux_clk_m
, PERIPH_ON_APB
);
1077 PERIPH_CLK(apbif
, "tegra30-ahub", "apbif", 107, 0, 26000000, mux_clk_m
, 0);
1078 PERIPH_CLK(i2s0
, "tegra30-i2s.0", NULL
, 30, 0x1d8, 26000000, mux_pllaout0_audio0_2x_pllp_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1079 PERIPH_CLK(i2s1
, "tegra30-i2s.1", NULL
, 11, 0x100, 26000000, mux_pllaout0_audio1_2x_pllp_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1080 PERIPH_CLK(i2s2
, "tegra30-i2s.2", NULL
, 18, 0x104, 26000000, mux_pllaout0_audio2_2x_pllp_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1081 PERIPH_CLK(i2s3
, "tegra30-i2s.3", NULL
, 101, 0x3bc, 26000000, mux_pllaout0_audio3_2x_pllp_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1082 PERIPH_CLK(i2s4
, "tegra30-i2s.4", NULL
, 102, 0x3c0, 26000000, mux_pllaout0_audio4_2x_pllp_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1083 PERIPH_CLK(spdif_out
, "tegra30-spdif", "spdif_out", 10, 0x108, 100000000, mux_pllaout0_audio5_2x_pllp_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1084 PERIPH_CLK(spdif_in
, "tegra30-spdif", "spdif_in", 10, 0x10c, 100000000, mux_pllp_pllc_pllm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1085 PERIPH_CLK(pwm
, "tegra-pwm", NULL
, 17, 0x110, 432000000, mux_pllp_pllc_clk32_clkm
, MUX
| MUX_PWM
| DIV_U71
| PERIPH_ON_APB
);
1086 PERIPH_CLK(d_audio
, "tegra30-ahub", "d_audio", 106, 0x3d0, 48000000, mux_plla_pllc_pllp_clkm
, MUX
| DIV_U71
);
1087 PERIPH_CLK(dam0
, "tegra30-dam.0", NULL
, 108, 0x3d8, 48000000, mux_plla_pllc_pllp_clkm
, MUX
| DIV_U71
);
1088 PERIPH_CLK(dam1
, "tegra30-dam.1", NULL
, 109, 0x3dc, 48000000, mux_plla_pllc_pllp_clkm
, MUX
| DIV_U71
);
1089 PERIPH_CLK(dam2
, "tegra30-dam.2", NULL
, 110, 0x3e0, 48000000, mux_plla_pllc_pllp_clkm
, MUX
| DIV_U71
);
1090 PERIPH_CLK(hda
, "tegra30-hda", "hda", 125, 0x428, 108000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1091 PERIPH_CLK(hda2codec_2x
, "tegra30-hda", "hda2codec", 111, 0x3e4, 48000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1092 PERIPH_CLK(hda2hdmi
, "tegra30-hda", "hda2hdmi", 128, 0, 48000000, mux_clk_m
, 0);
1093 PERIPH_CLK(sbc1
, "spi_tegra.0", NULL
, 41, 0x134, 160000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1094 PERIPH_CLK(sbc2
, "spi_tegra.1", NULL
, 44, 0x118, 160000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1095 PERIPH_CLK(sbc3
, "spi_tegra.2", NULL
, 46, 0x11c, 160000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1096 PERIPH_CLK(sbc4
, "spi_tegra.3", NULL
, 68, 0x1b4, 160000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1097 PERIPH_CLK(sbc5
, "spi_tegra.4", NULL
, 104, 0x3c8, 160000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1098 PERIPH_CLK(sbc6
, "spi_tegra.5", NULL
, 105, 0x3cc, 160000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1099 PERIPH_CLK(sata_oob
, "tegra_sata_oob", NULL
, 123, 0x420, 216000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1100 PERIPH_CLK(sata
, "tegra_sata", NULL
, 124, 0x424, 216000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1101 PERIPH_CLK(sata_cold
, "tegra_sata_cold", NULL
, 129, 0, 48000000, mux_clk_m
, 0);
1102 PERIPH_CLK(ndflash
, "tegra_nand", NULL
, 13, 0x160, 240000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1103 PERIPH_CLK(ndspeed
, "tegra_nand_speed", NULL
, 80, 0x3f8, 240000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1104 PERIPH_CLK(vfir
, "vfir", NULL
, 7, 0x168, 72000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1105 PERIPH_CLK(sdmmc1
, "sdhci-tegra.0", NULL
, 14, 0x150, 208000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
); /* scales with voltage */
1106 PERIPH_CLK(sdmmc2
, "sdhci-tegra.1", NULL
, 9, 0x154, 104000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
); /* scales with voltage */
1107 PERIPH_CLK(sdmmc3
, "sdhci-tegra.2", NULL
, 69, 0x1bc, 208000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
); /* scales with voltage */
1108 PERIPH_CLK(sdmmc4
, "sdhci-tegra.3", NULL
, 15, 0x164, 104000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
); /* scales with voltage */
1109 PERIPH_CLK(vcp
, "tegra-avp", "vcp", 29, 0, 250000000, mux_clk_m
, 0);
1110 PERIPH_CLK(bsea
, "tegra-avp", "bsea", 62, 0, 250000000, mux_clk_m
, 0);
1111 PERIPH_CLK(bsev
, "tegra-aes", "bsev", 63, 0, 250000000, mux_clk_m
, 0);
1112 PERIPH_CLK(vde
, "vde", NULL
, 61, 0x1c8, 520000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_INT
);
1113 PERIPH_CLK(csite
, "csite", NULL
, 73, 0x1d4, 144000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
); /* max rate ??? */
1114 PERIPH_CLK(la
, "la", NULL
, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
);
1115 PERIPH_CLK(owr
, "tegra_w1", NULL
, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1116 PERIPH_CLK(nor
, "nor", NULL
, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
); /* requires min voltage */
1117 PERIPH_CLK(mipi
, "mipi", NULL
, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
); /* scales with voltage */
1118 PERIPH_CLK(i2c1
, "tegra-i2c.0", "div-clk", 12, 0x124, 26000000, mux_pllp_clkm
, MUX
| DIV_U16
| PERIPH_ON_APB
);
1119 PERIPH_CLK(i2c2
, "tegra-i2c.1", "div-clk", 54, 0x198, 26000000, mux_pllp_clkm
, MUX
| DIV_U16
| PERIPH_ON_APB
);
1120 PERIPH_CLK(i2c3
, "tegra-i2c.2", "div-clk", 67, 0x1b8, 26000000, mux_pllp_clkm
, MUX
| DIV_U16
| PERIPH_ON_APB
);
1121 PERIPH_CLK(i2c4
, "tegra-i2c.3", "div-clk", 103, 0x3c4, 26000000, mux_pllp_clkm
, MUX
| DIV_U16
| PERIPH_ON_APB
);
1122 PERIPH_CLK(i2c5
, "tegra-i2c.4", "div-clk", 47, 0x128, 26000000, mux_pllp_clkm
, MUX
| DIV_U16
| PERIPH_ON_APB
);
1123 PERIPH_CLK(uarta
, "tegra-uart.0", NULL
, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_UART
| PERIPH_ON_APB
);
1124 PERIPH_CLK(uartb
, "tegra-uart.1", NULL
, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_UART
| PERIPH_ON_APB
);
1125 PERIPH_CLK(uartc
, "tegra-uart.2", NULL
, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_UART
| PERIPH_ON_APB
);
1126 PERIPH_CLK(uartd
, "tegra-uart.3", NULL
, 65, 0x1c0, 800000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_UART
| PERIPH_ON_APB
);
1127 PERIPH_CLK(uarte
, "tegra-uart.4", NULL
, 66, 0x1c4, 800000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_UART
| PERIPH_ON_APB
);
1128 PERIPH_CLK(vi
, "tegra_camera", "vi", 20, 0x148, 425000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
);
1129 PERIPH_CLK(3d
, "3d", NULL
, 24, 0x158, 520000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
| DIV_U71_IDLE
| PERIPH_MANUAL_RESET
);
1130 PERIPH_CLK(3d2
, "3d2", NULL
, 98, 0x3b0, 520000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
| DIV_U71_IDLE
| PERIPH_MANUAL_RESET
);
1131 PERIPH_CLK(2d
, "2d", NULL
, 21, 0x15c, 520000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
| DIV_U71_IDLE
);
1132 PERIPH_CLK(vi_sensor
, "tegra_camera", "vi_sensor", 20, 0x1a8, 150000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| PERIPH_NO_RESET
);
1133 PERIPH_CLK(epp
, "epp", NULL
, 19, 0x16c, 520000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
);
1134 PERIPH_CLK(mpe
, "mpe", NULL
, 60, 0x170, 520000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
);
1135 PERIPH_CLK(host1x
, "host1x", NULL
, 28, 0x180, 260000000, mux_pllm_pllc_pllp_plla
, MUX
| DIV_U71
| DIV_U71_INT
);
1136 PERIPH_CLK(cve
, "cve", NULL
, 49, 0x140, 250000000, mux_pllp_plld_pllc_clkm
, MUX
| DIV_U71
); /* requires min voltage */
1137 PERIPH_CLK(tvo
, "tvo", NULL
, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm
, MUX
| DIV_U71
); /* requires min voltage */
1138 PERIPH_CLK(dtv
, "dtv", NULL
, 79, 0x1dc, 250000000, mux_clk_m
, 0);
1139 PERIPH_CLK(hdmi
, "hdmi", NULL
, 51, 0x18c, 148500000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm
, MUX
| MUX8
| DIV_U71
);
1140 PERIPH_CLK(tvdac
, "tvdac", NULL
, 53, 0x194, 220000000, mux_pllp_plld_pllc_clkm
, MUX
| DIV_U71
); /* requires min voltage */
1141 PERIPH_CLK(disp1
, "tegradc.0", NULL
, 27, 0x138, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm
, MUX
| MUX8
);
1142 PERIPH_CLK(disp2
, "tegradc.1", NULL
, 26, 0x13c, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm
, MUX
| MUX8
);
1143 PERIPH_CLK(usbd
, "fsl-tegra-udc", NULL
, 22, 0, 480000000, mux_clk_m
, 0); /* requires min voltage */
1144 PERIPH_CLK(usb2
, "tegra-ehci.1", NULL
, 58, 0, 480000000, mux_clk_m
, 0); /* requires min voltage */
1145 PERIPH_CLK(usb3
, "tegra-ehci.2", NULL
, 59, 0, 480000000, mux_clk_m
, 0); /* requires min voltage */
1146 PERIPH_CLK(dsia
, "tegradc.0", "dsia", 48, 0, 500000000, mux_plld_out0
, 0);
1147 PERIPH_CLK(csi
, "tegra_camera", "csi", 52, 0, 102000000, mux_pllp_out3
, 0);
1148 PERIPH_CLK(isp
, "tegra_camera", "isp", 23, 0, 150000000, mux_clk_m
, 0); /* same frequency as VI */
1149 PERIPH_CLK(csus
, "tegra_camera", "csus", 92, 0, 150000000, mux_clk_m
, PERIPH_NO_RESET
);
1150 PERIPH_CLK(tsensor
, "tegra-tsensor", NULL
, 100, 0x3b8, 216000000, mux_pllp_pllc_clkm_clk32
, MUX
| DIV_U71
);
1151 PERIPH_CLK(actmon
, "actmon", NULL
, 119, 0x3e8, 216000000, mux_pllp_pllc_clk32_clkm
, MUX
| DIV_U71
);
1152 PERIPH_CLK(extern1
, "extern1", NULL
, 120, 0x3ec, 216000000, mux_plla_clk32_pllp_clkm_plle
, MUX
| MUX8
| DIV_U71
);
1153 PERIPH_CLK(extern2
, "extern2", NULL
, 121, 0x3f0, 216000000, mux_plla_clk32_pllp_clkm_plle
, MUX
| MUX8
| DIV_U71
);
1154 PERIPH_CLK(extern3
, "extern3", NULL
, 122, 0x3f4, 216000000, mux_plla_clk32_pllp_clkm_plle
, MUX
| MUX8
| DIV_U71
);
1155 PERIPH_CLK(i2cslow
, "i2cslow", NULL
, 81, 0x3fc, 26000000, mux_pllp_pllc_clk32_clkm
, MUX
| DIV_U71
| PERIPH_ON_APB
);
1156 PERIPH_CLK(pcie
, "tegra-pcie", "pcie", 70, 0, 250000000, mux_clk_m
, 0);
1157 PERIPH_CLK(afi
, "tegra-pcie", "afi", 72, 0, 250000000, mux_clk_m
, 0);
1158 PERIPH_CLK(se
, "se", NULL
, 127, 0x42c, 520000000, mux_pllp_pllc_pllm_clkm
, MUX
| DIV_U71
| DIV_U71_INT
);
1160 static struct clk tegra_dsib
;
1161 static struct clk_tegra tegra_dsib_hw
= {
1166 .dev_id
= "tegradc.1",
1170 .flags
= MUX
| PLLD
,
1171 .max_rate
= 500000000,
1175 .reset
= &tegra30_periph_clk_reset
,
1177 static struct clk tegra_dsib
= {
1179 .ops
= &tegra30_dsib_clk_ops
,
1180 .hw
= &tegra_dsib_hw
.hw
,
1181 .parent_names
= mux_plld_out0_plld2_out0
,
1182 .parents
= mux_plld_out0_plld2_out0_p
,
1183 .num_parents
= ARRAY_SIZE(mux_plld_out0_plld2_out0
),
1186 struct clk
*tegra_list_clks
[] = {
1208 &tegra_hda2codec_2x
,
1279 #define CLK_DUPLICATE(_name, _dev, _con) \
1288 /* Some clocks may be used by different drivers depending on the board
1289 * configuration. List those here to register them twice in the clock lookup
1290 * table under two names.
1292 struct clk_duplicate tegra_clk_duplicates
[] = {
1293 CLK_DUPLICATE("uarta", "serial8250.0", NULL
),
1294 CLK_DUPLICATE("uartb", "serial8250.1", NULL
),
1295 CLK_DUPLICATE("uartc", "serial8250.2", NULL
),
1296 CLK_DUPLICATE("uartd", "serial8250.3", NULL
),
1297 CLK_DUPLICATE("uarte", "serial8250.4", NULL
),
1298 CLK_DUPLICATE("usbd", "utmip-pad", NULL
),
1299 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL
),
1300 CLK_DUPLICATE("usbd", "tegra-otg", NULL
),
1301 CLK_DUPLICATE("dsib", "tegradc.0", "dsib"),
1302 CLK_DUPLICATE("dsia", "tegradc.1", "dsia"),
1303 CLK_DUPLICATE("bsev", "tegra-avp", "bsev"),
1304 CLK_DUPLICATE("bsev", "nvavp", "bsev"),
1305 CLK_DUPLICATE("vde", "tegra-aes", "vde"),
1306 CLK_DUPLICATE("bsea", "tegra-aes", "bsea"),
1307 CLK_DUPLICATE("bsea", "nvavp", "bsea"),
1308 CLK_DUPLICATE("cml1", "tegra_sata_cml", NULL
),
1309 CLK_DUPLICATE("cml0", "tegra_pcie", "cml"),
1310 CLK_DUPLICATE("pciex", "tegra_pcie", "pciex"),
1311 CLK_DUPLICATE("i2c1", "tegra-i2c-slave.0", NULL
),
1312 CLK_DUPLICATE("i2c2", "tegra-i2c-slave.1", NULL
),
1313 CLK_DUPLICATE("i2c3", "tegra-i2c-slave.2", NULL
),
1314 CLK_DUPLICATE("i2c4", "tegra-i2c-slave.3", NULL
),
1315 CLK_DUPLICATE("i2c5", "tegra-i2c-slave.4", NULL
),
1316 CLK_DUPLICATE("sbc1", "spi_slave_tegra.0", NULL
),
1317 CLK_DUPLICATE("sbc2", "spi_slave_tegra.1", NULL
),
1318 CLK_DUPLICATE("sbc3", "spi_slave_tegra.2", NULL
),
1319 CLK_DUPLICATE("sbc4", "spi_slave_tegra.3", NULL
),
1320 CLK_DUPLICATE("sbc5", "spi_slave_tegra.4", NULL
),
1321 CLK_DUPLICATE("sbc6", "spi_slave_tegra.5", NULL
),
1322 CLK_DUPLICATE("twd", "smp_twd", NULL
),
1323 CLK_DUPLICATE("vcp", "nvavp", "vcp"),
1324 CLK_DUPLICATE("i2s0", NULL
, "i2s0"),
1325 CLK_DUPLICATE("i2s1", NULL
, "i2s1"),
1326 CLK_DUPLICATE("i2s2", NULL
, "i2s2"),
1327 CLK_DUPLICATE("i2s3", NULL
, "i2s3"),
1328 CLK_DUPLICATE("i2s4", NULL
, "i2s4"),
1329 CLK_DUPLICATE("dam0", NULL
, "dam0"),
1330 CLK_DUPLICATE("dam1", NULL
, "dam1"),
1331 CLK_DUPLICATE("dam2", NULL
, "dam2"),
1332 CLK_DUPLICATE("spdif_in", NULL
, "spdif_in"),
1333 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.0", "fast-clk"),
1334 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"),
1335 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"),
1336 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"),
1337 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.4", "fast-clk"),
1338 CLK_DUPLICATE("pll_p", "tegradc.0", "parent"),
1339 CLK_DUPLICATE("pll_p", "tegradc.1", "parent"),
1340 CLK_DUPLICATE("pll_d2_out0", "hdmi", "parent"),
1343 struct clk
*tegra_ptr_clks
[] = {
1379 static void tegra30_init_one_clock(struct clk
*c
)
1381 struct clk_tegra
*clk
= to_clk_tegra(c
->hw
);
1382 __clk_init(NULL
, c
);
1383 INIT_LIST_HEAD(&clk
->shared_bus_list
);
1384 if (!clk
->lookup
.dev_id
&& !clk
->lookup
.con_id
)
1385 clk
->lookup
.con_id
= c
->name
;
1386 clk
->lookup
.clk
= c
;
1387 clkdev_add(&clk
->lookup
);
1391 void __init
tegra30_init_clocks(void)
1396 for (i
= 0; i
< ARRAY_SIZE(tegra_ptr_clks
); i
++)
1397 tegra30_init_one_clock(tegra_ptr_clks
[i
]);
1399 for (i
= 0; i
< ARRAY_SIZE(tegra_list_clks
); i
++)
1400 tegra30_init_one_clock(tegra_list_clks
[i
]);
1402 for (i
= 0; i
< ARRAY_SIZE(tegra_clk_duplicates
); i
++) {
1403 c
= tegra_get_clock_by_name(tegra_clk_duplicates
[i
].name
);
1405 pr_err("%s: Unknown duplicate clock %s\n", __func__
,
1406 tegra_clk_duplicates
[i
].name
);
1410 tegra_clk_duplicates
[i
].lookup
.clk
= c
;
1411 clkdev_add(&tegra_clk_duplicates
[i
].lookup
);
1414 for (i
= 0; i
< ARRAY_SIZE(tegra_sync_source_list
); i
++)
1415 tegra30_init_one_clock(tegra_sync_source_list
[i
]);
1416 for (i
= 0; i
< ARRAY_SIZE(tegra_clk_audio_list
); i
++)
1417 tegra30_init_one_clock(tegra_clk_audio_list
[i
]);
1418 for (i
= 0; i
< ARRAY_SIZE(tegra_clk_audio_2x_list
); i
++)
1419 tegra30_init_one_clock(tegra_clk_audio_2x_list
[i
]);
1421 for (i
= 0; i
< ARRAY_SIZE(tegra_clk_out_list
); i
++)
1422 tegra30_init_one_clock(tegra_clk_out_list
[i
]);
1424 tegra30_cpu_car_ops_init();