blob: dcdd0d09783701d118865c13bd3f1cb7db2a95fb [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Tom Warren61c6d0e2012-12-11 13:34:15 +00002/*
Tom Warrena8480ef2015-06-25 09:50:44 -07003 * (C) Copyright 2010-2015
4 * NVIDIA Corporation <www.nvidia.com>
Tom Warren61c6d0e2012-12-11 13:34:15 +00005 */
6
7/* Tegra30 Clock control functions */
8
9#include <common.h>
Thierry Reding4bf98692014-12-09 22:25:06 -070010#include <errno.h>
Simon Glass97589732020-05-10 11:40:02 -060011#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -060012#include <log.h>
Tom Warren61c6d0e2012-12-11 13:34:15 +000013#include <asm/io.h>
14#include <asm/arch/clock.h>
15#include <asm/arch/tegra.h>
16#include <asm/arch-tegra/clk_rst.h>
17#include <asm/arch-tegra/timer.h>
18#include <div64.h>
19#include <fdtdec.h>
Simon Glassdbd79542020-05-10 11:40:11 -060020#include <linux/delay.h>
Tom Warren61c6d0e2012-12-11 13:34:15 +000021
Svyatoslav Ryhel19a5b032023-02-14 19:35:25 +020022#include <dt-bindings/clock/tegra30-car.h>
23
Tom Warren61c6d0e2012-12-11 13:34:15 +000024/*
Tom Warren795f9d72013-01-23 14:01:01 -070025 * Clock types that we can use as a source. The Tegra30 has muxes for the
Tom Warren61c6d0e2012-12-11 13:34:15 +000026 * peripheral clocks, and in most cases there are four options for the clock
27 * source. This gives us a clock 'type' and exploits what commonality exists
28 * in the device.
29 *
30 * Letters are obvious, except for T which means CLK_M, and S which means the
31 * clock derived from 32KHz. Beware that CLK_M (also called OSC in the
32 * datasheet) and PLL_M are different things. The former is the basic
33 * clock supplied to the SOC from an external oscillator. The latter is the
34 * memory clock PLL.
35 *
36 * See definitions in clock_id in the header file.
37 */
38enum clock_type_id {
39 CLOCK_TYPE_AXPT, /* PLL_A, PLL_X, PLL_P, CLK_M */
40 CLOCK_TYPE_MCPA, /* and so on */
41 CLOCK_TYPE_MCPT,
42 CLOCK_TYPE_PCM,
43 CLOCK_TYPE_PCMT,
Tom Warrenea226042012-12-21 15:02:45 -070044 CLOCK_TYPE_PCMT16,
Tom Warren61c6d0e2012-12-11 13:34:15 +000045 CLOCK_TYPE_PDCT,
46 CLOCK_TYPE_ACPT,
47 CLOCK_TYPE_ASPTE,
48 CLOCK_TYPE_PMDACD2T,
49 CLOCK_TYPE_PCST,
50
51 CLOCK_TYPE_COUNT,
Tom Warren795f9d72013-01-23 14:01:01 -070052 CLOCK_TYPE_NONE = -1, /* invalid clock type */
Tom Warren61c6d0e2012-12-11 13:34:15 +000053};
54
Tom Warren61c6d0e2012-12-11 13:34:15 +000055enum {
Tom Warren795f9d72013-01-23 14:01:01 -070056 CLOCK_MAX_MUX = 8 /* number of source options for each clock */
Tom Warren61c6d0e2012-12-11 13:34:15 +000057};
58
Tom Warren61c6d0e2012-12-11 13:34:15 +000059/*
60 * Clock source mux for each clock type. This just converts our enum into
61 * a list of mux sources for use by the code.
62 *
63 * Note:
64 * The extra column in each clock source array is used to store the mask
65 * bits in its register for the source.
66 */
67#define CLK(x) CLOCK_ID_ ## x
68static enum clock_id clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX+1] = {
Tom Warren795f9d72013-01-23 14:01:01 -070069 { CLK(AUDIO), CLK(XCPU), CLK(PERIPH), CLK(OSC),
70 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000071 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070072 { CLK(MEMORY), CLK(CGENERAL), CLK(PERIPH), CLK(AUDIO),
73 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000074 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070075 { CLK(MEMORY), CLK(CGENERAL), CLK(PERIPH), CLK(OSC),
76 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000077 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070078 { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(NONE),
79 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000080 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070081 { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(OSC),
82 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000083 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070084 { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(OSC),
85 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warrenea226042012-12-21 15:02:45 -070086 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070087 { CLK(PERIPH), CLK(DISPLAY), CLK(CGENERAL), CLK(OSC),
88 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000089 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070090 { CLK(AUDIO), CLK(CGENERAL), CLK(PERIPH), CLK(OSC),
91 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000092 MASK_BITS_31_30},
Tom Warren795f9d72013-01-23 14:01:01 -070093 { CLK(AUDIO), CLK(SFROM32KHZ), CLK(PERIPH), CLK(OSC),
94 CLK(EPCI), CLK(NONE), CLK(NONE), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000095 MASK_BITS_31_29},
Tom Warren795f9d72013-01-23 14:01:01 -070096 { CLK(PERIPH), CLK(MEMORY), CLK(DISPLAY), CLK(AUDIO),
97 CLK(CGENERAL), CLK(DISPLAY2), CLK(OSC), CLK(NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +000098 MASK_BITS_31_29},
Tom Warren795f9d72013-01-23 14:01:01 -070099 { CLK(PERIPH), CLK(CGENERAL), CLK(SFROM32KHZ), CLK(OSC),
100 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
Stephen Warren510c0ae2014-01-24 10:16:18 -0700101 MASK_BITS_31_28}
Tom Warren61c6d0e2012-12-11 13:34:15 +0000102};
103
Tom Warren61c6d0e2012-12-11 13:34:15 +0000104/*
105 * Clock type for each peripheral clock source. We put the name in each
106 * record just so it is easy to match things up
107 */
108#define TYPE(name, type) type
109static enum clock_type_id clock_periph_type[PERIPHC_COUNT] = {
110 /* 0x00 */
111 TYPE(PERIPHC_I2S1, CLOCK_TYPE_AXPT),
Tom Warren795f9d72013-01-23 14:01:01 -0700112 TYPE(PERIPHC_I2S2, CLOCK_TYPE_AXPT),
113 TYPE(PERIPHC_SPDIF_OUT, CLOCK_TYPE_AXPT),
114 TYPE(PERIPHC_SPDIF_IN, CLOCK_TYPE_PCM),
115 TYPE(PERIPHC_PWM, CLOCK_TYPE_PCST), /* only PWM uses b29:28 */
116 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
117 TYPE(PERIPHC_SBC2, CLOCK_TYPE_PCMT),
118 TYPE(PERIPHC_SBC3, CLOCK_TYPE_PCMT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000119
120 /* 0x08 */
Tom Warren795f9d72013-01-23 14:01:01 -0700121 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
122 TYPE(PERIPHC_I2C1, CLOCK_TYPE_PCMT16),
123 TYPE(PERIPHC_DVC_I2C, CLOCK_TYPE_PCMT16),
124 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
125 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
126 TYPE(PERIPHC_SBC1, CLOCK_TYPE_PCMT),
127 TYPE(PERIPHC_DISP1, CLOCK_TYPE_PMDACD2T),
128 TYPE(PERIPHC_DISP2, CLOCK_TYPE_PMDACD2T),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000129
130 /* 0x10 */
Tom Warren795f9d72013-01-23 14:01:01 -0700131 TYPE(PERIPHC_CVE, CLOCK_TYPE_PDCT),
132 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000133 TYPE(PERIPHC_VI, CLOCK_TYPE_MCPA),
Tom Warren795f9d72013-01-23 14:01:01 -0700134 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
135 TYPE(PERIPHC_SDMMC1, CLOCK_TYPE_PCMT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000136 TYPE(PERIPHC_SDMMC2, CLOCK_TYPE_PCMT),
137 TYPE(PERIPHC_G3D, CLOCK_TYPE_MCPA),
138 TYPE(PERIPHC_G2D, CLOCK_TYPE_MCPA),
139
140 /* 0x18 */
141 TYPE(PERIPHC_NDFLASH, CLOCK_TYPE_PCMT),
142 TYPE(PERIPHC_SDMMC4, CLOCK_TYPE_PCMT),
Tom Warren795f9d72013-01-23 14:01:01 -0700143 TYPE(PERIPHC_VFIR, CLOCK_TYPE_PCMT),
144 TYPE(PERIPHC_EPP, CLOCK_TYPE_MCPA),
145 TYPE(PERIPHC_MPE, CLOCK_TYPE_MCPA),
146 TYPE(PERIPHC_MIPI, CLOCK_TYPE_PCMT), /* MIPI base-band HSI */
147 TYPE(PERIPHC_UART1, CLOCK_TYPE_PCMT),
148 TYPE(PERIPHC_UART2, CLOCK_TYPE_PCMT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000149
150 /* 0x20 */
Tom Warren795f9d72013-01-23 14:01:01 -0700151 TYPE(PERIPHC_HOST1X, CLOCK_TYPE_MCPA),
152 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
153 TYPE(PERIPHC_TVO, CLOCK_TYPE_PDCT),
154 TYPE(PERIPHC_HDMI, CLOCK_TYPE_PMDACD2T),
155 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
156 TYPE(PERIPHC_TVDAC, CLOCK_TYPE_PDCT),
157 TYPE(PERIPHC_I2C2, CLOCK_TYPE_PCMT16),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000158 TYPE(PERIPHC_EMC, CLOCK_TYPE_MCPT),
159
160 /* 0x28 */
161 TYPE(PERIPHC_UART3, CLOCK_TYPE_PCMT),
162 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
163 TYPE(PERIPHC_VI, CLOCK_TYPE_MCPA),
Tom Warren795f9d72013-01-23 14:01:01 -0700164 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
165 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
166 TYPE(PERIPHC_SBC4, CLOCK_TYPE_PCMT),
167 TYPE(PERIPHC_I2C3, CLOCK_TYPE_PCMT16),
168 TYPE(PERIPHC_SDMMC3, CLOCK_TYPE_PCMT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000169
170 /* 0x30 */
171 TYPE(PERIPHC_UART4, CLOCK_TYPE_PCMT),
172 TYPE(PERIPHC_UART5, CLOCK_TYPE_PCMT),
173 TYPE(PERIPHC_VDE, CLOCK_TYPE_PCMT),
Tom Warren795f9d72013-01-23 14:01:01 -0700174 TYPE(PERIPHC_OWR, CLOCK_TYPE_PCMT),
175 TYPE(PERIPHC_NOR, CLOCK_TYPE_PCMT),
176 TYPE(PERIPHC_CSITE, CLOCK_TYPE_PCMT),
177 TYPE(PERIPHC_I2S0, CLOCK_TYPE_AXPT),
178 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000179
Tom Warren795f9d72013-01-23 14:01:01 -0700180 /* 0x38h */ /* Jumps to reg offset 0x3B0h - new for T30 */
181 TYPE(PERIPHC_G3D2, CLOCK_TYPE_MCPA),
182 TYPE(PERIPHC_MSELECT, CLOCK_TYPE_PCMT),
183 TYPE(PERIPHC_TSENSOR, CLOCK_TYPE_PCST), /* s/b PCTS */
184 TYPE(PERIPHC_I2S3, CLOCK_TYPE_AXPT),
185 TYPE(PERIPHC_I2S4, CLOCK_TYPE_AXPT),
186 TYPE(PERIPHC_I2C4, CLOCK_TYPE_PCMT16),
187 TYPE(PERIPHC_SBC5, CLOCK_TYPE_PCMT),
188 TYPE(PERIPHC_SBC6, CLOCK_TYPE_PCMT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000189
190 /* 0x40 */
Tom Warren795f9d72013-01-23 14:01:01 -0700191 TYPE(PERIPHC_AUDIO, CLOCK_TYPE_ACPT),
192 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
193 TYPE(PERIPHC_DAM0, CLOCK_TYPE_ACPT),
194 TYPE(PERIPHC_DAM1, CLOCK_TYPE_ACPT),
195 TYPE(PERIPHC_DAM2, CLOCK_TYPE_ACPT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000196 TYPE(PERIPHC_HDA2CODEC2X, CLOCK_TYPE_PCMT),
Tom Warren795f9d72013-01-23 14:01:01 -0700197 TYPE(PERIPHC_ACTMON, CLOCK_TYPE_PCST), /* MASK 31:30 */
Tom Warren61c6d0e2012-12-11 13:34:15 +0000198 TYPE(PERIPHC_EXTPERIPH1, CLOCK_TYPE_ASPTE),
199
200 /* 0x48 */
201 TYPE(PERIPHC_EXTPERIPH2, CLOCK_TYPE_ASPTE),
202 TYPE(PERIPHC_EXTPERIPH3, CLOCK_TYPE_ASPTE),
Tom Warren795f9d72013-01-23 14:01:01 -0700203 TYPE(PERIPHC_NANDSPEED, CLOCK_TYPE_PCMT),
204 TYPE(PERIPHC_I2CSLOW, CLOCK_TYPE_PCST), /* MASK 31:30 */
205 TYPE(PERIPHC_SYS, CLOCK_TYPE_NONE),
206 TYPE(PERIPHC_SPEEDO, CLOCK_TYPE_PCMT),
207 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
208 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000209
210 /* 0x50 */
Tom Warren795f9d72013-01-23 14:01:01 -0700211 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
212 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
213 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
214 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
215 TYPE(PERIPHC_SATAOOB, CLOCK_TYPE_PCMT), /* offset 0x420h */
216 TYPE(PERIPHC_SATA, CLOCK_TYPE_PCMT),
217 TYPE(PERIPHC_HDA, CLOCK_TYPE_PCMT),
Tom Warren61c6d0e2012-12-11 13:34:15 +0000218};
219
220/*
221 * This array translates a periph_id to a periphc_internal_id
222 *
223 * Not present/matched up:
224 * uint vi_sensor; _VI_SENSOR_0, 0x1A8
225 * SPDIF - which is both 0x08 and 0x0c
226 *
227 */
228#define NONE(name) (-1)
229#define OFFSET(name, value) PERIPHC_ ## name
230static s8 periph_id_to_internal_id[PERIPH_ID_COUNT] = {
231 /* Low word: 31:0 */
232 NONE(CPU),
233 NONE(COP),
234 NONE(TRIGSYS),
235 NONE(RESERVED3),
236 NONE(RESERVED4),
237 NONE(TMR),
238 PERIPHC_UART1,
Tom Warren795f9d72013-01-23 14:01:01 -0700239 PERIPHC_UART2, /* and vfir 0x68 */
Tom Warren61c6d0e2012-12-11 13:34:15 +0000240
241 /* 8 */
242 NONE(GPIO),
243 PERIPHC_SDMMC2,
Tom Warren795f9d72013-01-23 14:01:01 -0700244 NONE(SPDIF), /* 0x08 and 0x0c, unclear which to use */
Tom Warren61c6d0e2012-12-11 13:34:15 +0000245 PERIPHC_I2S1,
246 PERIPHC_I2C1,
247 PERIPHC_NDFLASH,
248 PERIPHC_SDMMC1,
249 PERIPHC_SDMMC4,
250
251 /* 16 */
252 NONE(RESERVED16),
253 PERIPHC_PWM,
254 PERIPHC_I2S2,
255 PERIPHC_EPP,
256 PERIPHC_VI,
257 PERIPHC_G2D,
258 NONE(USBD),
259 NONE(ISP),
260
261 /* 24 */
262 PERIPHC_G3D,
263 NONE(RESERVED25),
264 PERIPHC_DISP2,
265 PERIPHC_DISP1,
266 PERIPHC_HOST1X,
267 NONE(VCP),
268 PERIPHC_I2S0,
269 NONE(CACHE2),
270
271 /* Middle word: 63:32 */
272 NONE(MEM),
273 NONE(AHBDMA),
274 NONE(APBDMA),
275 NONE(RESERVED35),
276 NONE(RESERVED36),
277 NONE(STAT_MON),
278 NONE(RESERVED38),
279 NONE(RESERVED39),
280
281 /* 40 */
282 NONE(KFUSE),
Allen Martin3f419f82013-01-29 13:51:25 +0000283 PERIPHC_SBC1,
Tom Warren61c6d0e2012-12-11 13:34:15 +0000284 PERIPHC_NOR,
285 NONE(RESERVED43),
286 PERIPHC_SBC2,
287 NONE(RESERVED45),
288 PERIPHC_SBC3,
289 PERIPHC_DVC_I2C,
290
291 /* 48 */
292 NONE(DSI),
Tom Warren795f9d72013-01-23 14:01:01 -0700293 PERIPHC_TVO, /* also CVE 0x40 */
Tom Warren61c6d0e2012-12-11 13:34:15 +0000294 PERIPHC_MIPI,
295 PERIPHC_HDMI,
296 NONE(CSI),
297 PERIPHC_TVDAC,
298 PERIPHC_I2C2,
299 PERIPHC_UART3,
300
301 /* 56 */
302 NONE(RESERVED56),
303 PERIPHC_EMC,
304 NONE(USB2),
305 NONE(USB3),
306 PERIPHC_MPE,
307 PERIPHC_VDE,
308 NONE(BSEA),
309 NONE(BSEV),
310
311 /* Upper word 95:64 */
312 PERIPHC_SPEEDO,
313 PERIPHC_UART4,
314 PERIPHC_UART5,
315 PERIPHC_I2C3,
316 PERIPHC_SBC4,
317 PERIPHC_SDMMC3,
318 NONE(PCIE),
319 PERIPHC_OWR,
320
321 /* 72 */
322 NONE(AFI),
323 PERIPHC_CSITE,
324 NONE(PCIEXCLK),
325 NONE(AVPUCQ),
326 NONE(RESERVED76),
327 NONE(RESERVED77),
328 NONE(RESERVED78),
329 NONE(DTV),
330
331 /* 80 */
332 PERIPHC_NANDSPEED,
333 PERIPHC_I2CSLOW,
334 NONE(DSIB),
335 NONE(RESERVED83),
336 NONE(IRAMA),
337 NONE(IRAMB),
338 NONE(IRAMC),
339 NONE(IRAMD),
340
341 /* 88 */
342 NONE(CRAM2),
343 NONE(RESERVED89),
344 NONE(MDOUBLER),
345 NONE(RESERVED91),
346 NONE(SUSOUT),
347 NONE(RESERVED93),
348 NONE(RESERVED94),
349 NONE(RESERVED95),
350
351 /* V word: 31:0 */
352 NONE(CPUG),
353 NONE(CPULP),
354 PERIPHC_G3D2,
355 PERIPHC_MSELECT,
356 PERIPHC_TSENSOR,
357 PERIPHC_I2S3,
358 PERIPHC_I2S4,
359 PERIPHC_I2C4,
360
361 /* 08 */
362 PERIPHC_SBC5,
363 PERIPHC_SBC6,
364 PERIPHC_AUDIO,
365 NONE(APBIF),
366 PERIPHC_DAM0,
367 PERIPHC_DAM1,
368 PERIPHC_DAM2,
369 PERIPHC_HDA2CODEC2X,
370
371 /* 16 */
372 NONE(ATOMICS),
373 NONE(RESERVED17),
374 NONE(RESERVED18),
375 NONE(RESERVED19),
376 NONE(RESERVED20),
377 NONE(RESERVED21),
378 NONE(RESERVED22),
379 PERIPHC_ACTMON,
380
381 /* 24 */
Svyatoslav Ryheld956f352023-02-14 19:35:23 +0200382 PERIPHC_EXTPERIPH1,
383 PERIPHC_EXTPERIPH2,
384 PERIPHC_EXTPERIPH3,
Tom Warren61c6d0e2012-12-11 13:34:15 +0000385 NONE(RESERVED27),
386 PERIPHC_SATA,
387 PERIPHC_HDA,
388 NONE(RESERVED30),
389 NONE(RESERVED31),
390
391 /* W word: 31:0 */
392 NONE(HDA2HDMICODEC),
393 NONE(SATACOLD),
394 NONE(RESERVED0_PCIERX0),
395 NONE(RESERVED1_PCIERX1),
396 NONE(RESERVED2_PCIERX2),
397 NONE(RESERVED3_PCIERX3),
398 NONE(RESERVED4_PCIERX4),
399 NONE(RESERVED5_PCIERX5),
400
401 /* 40 */
402 NONE(CEC),
403 NONE(RESERVED6_PCIE2),
404 NONE(RESERVED7_EMC),
405 NONE(RESERVED8_HDMI),
406 NONE(RESERVED9_SATA),
407 NONE(RESERVED10_MIPI),
408 NONE(EX_RESERVED46),
409 NONE(EX_RESERVED47),
410};
411
412/*
Tom Warrena8480ef2015-06-25 09:50:44 -0700413 * PLL divider shift/mask tables for all PLL IDs.
414 */
415struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT] = {
416 /*
417 * T30: some deviations from T2x.
418 * NOTE: If kcp_mask/kvco_mask == 0, they're not used in that PLL (PLLX, etc.)
419 * If lock_ena or lock_det are >31, they're not used in that PLL.
420 */
421
422 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x0F,
423 .lock_ena = 24, .lock_det = 27, .kcp_shift = 28, .kcp_mask = 3, .kvco_shift = 27, .kvco_mask = 1 }, /* PLLC */
424 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 0, .p_mask = 0,
425 .lock_ena = 0, .lock_det = 27, .kcp_shift = 1, .kcp_mask = 3, .kvco_shift = 0, .kvco_mask = 1 }, /* PLLM */
426 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
427 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLP */
428 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
429 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLA */
430 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x01,
431 .lock_ena = 22, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLU */
432 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
433 .lock_ena = 22, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLD */
434 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0xFF, .p_shift = 20, .p_mask = 0x0F,
435 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 0, .kvco_mask = 0 }, /* PLLX */
436 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0xFF, .p_shift = 0, .p_mask = 0,
437 .lock_ena = 9, .lock_det = 11, .kcp_shift = 6, .kcp_mask = 3, .kvco_shift = 0, .kvco_mask = 1 }, /* PLLE */
438 { .m_shift = 0, .m_mask = 0x0F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
439 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLS (RESERVED) */
440};
441
442/*
Tom Warren61c6d0e2012-12-11 13:34:15 +0000443 * Get the oscillator frequency, from the corresponding hardware configuration
Svyatoslav Ryhel7f4ab332023-02-01 10:53:01 +0200444 * field. Note that T30+ supports 3 new higher freqs.
Tom Warren61c6d0e2012-12-11 13:34:15 +0000445 */
446enum clock_osc_freq clock_get_osc_freq(void)
447{
448 struct clk_rst_ctlr *clkrst =
449 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
450 u32 reg;
451
452 reg = readl(&clkrst->crc_osc_ctrl);
Svyatoslav Ryhel7f4ab332023-02-01 10:53:01 +0200453 return (reg & OSC_FREQ_MASK) >> OSC_FREQ_SHIFT;
Tom Warren61c6d0e2012-12-11 13:34:15 +0000454}
455
456/* Returns a pointer to the clock source register for a peripheral */
Tom Warren795f9d72013-01-23 14:01:01 -0700457u32 *get_periph_source_reg(enum periph_id periph_id)
Tom Warren61c6d0e2012-12-11 13:34:15 +0000458{
459 struct clk_rst_ctlr *clkrst =
Tom Warren795f9d72013-01-23 14:01:01 -0700460 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
Tom Warren61c6d0e2012-12-11 13:34:15 +0000461 enum periphc_internal_id internal_id;
462
463 /* Coresight is a special case */
464 if (periph_id == PERIPH_ID_CSI)
465 return &clkrst->crc_clk_src[PERIPH_ID_CSI+1];
466
467 assert(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT);
468 internal_id = periph_id_to_internal_id[periph_id];
469 assert(internal_id != -1);
470 if (internal_id >= PERIPHC_VW_FIRST) {
471 internal_id -= PERIPHC_VW_FIRST;
472 return &clkrst->crc_clk_src_vw[internal_id];
473 } else
474 return &clkrst->crc_clk_src[internal_id];
475}
476
Stephen Warren532543c2016-09-13 10:45:56 -0600477int get_periph_clock_info(enum periph_id periph_id, int *mux_bits,
478 int *divider_bits, int *type)
479{
480 enum periphc_internal_id internal_id;
481
482 if (!clock_periph_id_isvalid(periph_id))
483 return -1;
484
485 internal_id = periph_id_to_internal_id[periph_id];
486 if (!periphc_internal_id_isvalid(internal_id))
487 return -1;
488
489 *type = clock_periph_type[internal_id];
490 if (!clock_type_id_isvalid(*type))
491 return -1;
492
493 *mux_bits = clock_source[*type][CLOCK_MAX_MUX];
494
495 if (*type == CLOCK_TYPE_PCMT16)
496 *divider_bits = 16;
497 else
498 *divider_bits = 8;
499
500 return 0;
501}
502
503enum clock_id get_periph_clock_id(enum periph_id periph_id, int source)
504{
505 enum periphc_internal_id internal_id;
506 int type;
507
508 if (!clock_periph_id_isvalid(periph_id))
509 return CLOCK_ID_NONE;
510
511 internal_id = periph_id_to_internal_id[periph_id];
512 if (!periphc_internal_id_isvalid(internal_id))
513 return CLOCK_ID_NONE;
514
515 type = clock_periph_type[internal_id];
516 if (!clock_type_id_isvalid(type))
517 return CLOCK_ID_NONE;
518
519 return clock_source[type][source];
520}
521
Tom Warren61c6d0e2012-12-11 13:34:15 +0000522/**
523 * Given a peripheral ID and the required source clock, this returns which
524 * value should be programmed into the source mux for that peripheral.
525 *
526 * There is special code here to handle the one source type with 5 sources.
527 *
528 * @param periph_id peripheral to start
529 * @param source PLL id of required parent clock
530 * @param mux_bits Set to number of bits in mux register: 2 or 4
Tom Warren795f9d72013-01-23 14:01:01 -0700531 * @param divider_bits Set to number of divider bits (8 or 16)
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100532 * Return: mux value (0-4, or -1 if not found)
Tom Warren61c6d0e2012-12-11 13:34:15 +0000533 */
Tom Warren795f9d72013-01-23 14:01:01 -0700534int get_periph_clock_source(enum periph_id periph_id,
535 enum clock_id parent, int *mux_bits, int *divider_bits)
Tom Warren61c6d0e2012-12-11 13:34:15 +0000536{
537 enum clock_type_id type;
Stephen Warren532543c2016-09-13 10:45:56 -0600538 int mux, err;
Tom Warren61c6d0e2012-12-11 13:34:15 +0000539
Stephen Warren532543c2016-09-13 10:45:56 -0600540 err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type);
541 assert(!err);
Tom Warrenea226042012-12-21 15:02:45 -0700542
Tom Warren61c6d0e2012-12-11 13:34:15 +0000543 for (mux = 0; mux < CLOCK_MAX_MUX; mux++)
544 if (clock_source[type][mux] == parent)
545 return mux;
546
547 /* if we get here, either us or the caller has made a mistake */
548 printf("Caller requested bad clock: periph=%d, parent=%d\n", periph_id,
549 parent);
550 return -1;
551}
552
Tom Warren61c6d0e2012-12-11 13:34:15 +0000553void clock_set_enable(enum periph_id periph_id, int enable)
554{
555 struct clk_rst_ctlr *clkrst =
556 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
557 u32 *clk;
558 u32 reg;
559
560 /* Enable/disable the clock to this peripheral */
561 assert(clock_periph_id_isvalid(periph_id));
562 if ((int)periph_id < (int)PERIPH_ID_VW_FIRST)
563 clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)];
564 else
565 clk = &clkrst->crc_clk_out_enb_vw[PERIPH_REG(periph_id)];
566 reg = readl(clk);
567 if (enable)
568 reg |= PERIPH_MASK(periph_id);
569 else
570 reg &= ~PERIPH_MASK(periph_id);
571 writel(reg, clk);
572}
573
Tom Warren61c6d0e2012-12-11 13:34:15 +0000574void reset_set_enable(enum periph_id periph_id, int enable)
575{
576 struct clk_rst_ctlr *clkrst =
577 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
578 u32 *reset;
579 u32 reg;
580
581 /* Enable/disable reset to the peripheral */
582 assert(clock_periph_id_isvalid(periph_id));
583 if (periph_id < PERIPH_ID_VW_FIRST)
584 reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)];
585 else
586 reset = &clkrst->crc_rst_dev_vw[PERIPH_REG(periph_id)];
587 reg = readl(reset);
588 if (enable)
589 reg |= PERIPH_MASK(periph_id);
590 else
591 reg &= ~PERIPH_MASK(periph_id);
592 writel(reg, reset);
593}
594
Masahiro Yamada366b24f2015-08-12 07:31:55 +0900595#if CONFIG_IS_ENABLED(OF_CONTROL)
Tom Warren61c6d0e2012-12-11 13:34:15 +0000596/*
597 * Convert a device tree clock ID to our peripheral ID. They are mostly
598 * the same but we are very cautious so we check that a valid clock ID is
599 * provided.
600 *
Tom Warrenea226042012-12-21 15:02:45 -0700601 * @param clk_id Clock ID according to tegra30 device tree binding
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100602 * Return: peripheral ID, or PERIPH_ID_NONE if the clock ID is invalid
Tom Warren61c6d0e2012-12-11 13:34:15 +0000603 */
Tom Warren795f9d72013-01-23 14:01:01 -0700604enum periph_id clk_id_to_periph_id(int clk_id)
Tom Warren61c6d0e2012-12-11 13:34:15 +0000605{
Tom Warrenea226042012-12-21 15:02:45 -0700606 if (clk_id > PERIPH_ID_COUNT)
Tom Warren61c6d0e2012-12-11 13:34:15 +0000607 return PERIPH_ID_NONE;
608
609 switch (clk_id) {
Tom Warrenea226042012-12-21 15:02:45 -0700610 case PERIPH_ID_RESERVED3:
611 case PERIPH_ID_RESERVED4:
612 case PERIPH_ID_RESERVED16:
613 case PERIPH_ID_RESERVED24:
614 case PERIPH_ID_RESERVED35:
615 case PERIPH_ID_RESERVED43:
616 case PERIPH_ID_RESERVED45:
617 case PERIPH_ID_RESERVED56:
Thierry Reding289fc682014-12-09 22:25:07 -0700618 case PERIPH_ID_PCIEXCLK:
Tom Warrenea226042012-12-21 15:02:45 -0700619 case PERIPH_ID_RESERVED76:
620 case PERIPH_ID_RESERVED77:
621 case PERIPH_ID_RESERVED78:
622 case PERIPH_ID_RESERVED83:
623 case PERIPH_ID_RESERVED89:
624 case PERIPH_ID_RESERVED91:
625 case PERIPH_ID_RESERVED93:
626 case PERIPH_ID_RESERVED94:
627 case PERIPH_ID_RESERVED95:
Tom Warren61c6d0e2012-12-11 13:34:15 +0000628 return PERIPH_ID_NONE;
629 default:
630 return clk_id;
631 }
632}
Svyatoslav Ryhel19a5b032023-02-14 19:35:25 +0200633
634/*
635 * Convert a device tree clock ID to our PLL ID.
636 *
637 * @param clk_id Clock ID according to tegra30 device tree binding
638 * Return: clock ID, or CLOCK_ID_NONE if the clock ID is invalid
639 */
640enum clock_id clk_id_to_pll_id(int clk_id)
641{
642 switch (clk_id) {
643 case TEGRA30_CLK_PLL_C:
644 return CLOCK_ID_CGENERAL;
645 case TEGRA30_CLK_PLL_M:
646 return CLOCK_ID_MEMORY;
647 case TEGRA30_CLK_PLL_P:
648 return CLOCK_ID_PERIPH;
649 case TEGRA30_CLK_PLL_A:
650 return CLOCK_ID_AUDIO;
651 case TEGRA30_CLK_PLL_U:
652 return CLOCK_ID_USB;
653 case TEGRA30_CLK_PLL_D:
654 case TEGRA30_CLK_PLL_D_OUT0:
655 return CLOCK_ID_DISPLAY;
656 case TEGRA30_CLK_PLL_X:
657 return CLOCK_ID_XCPU;
658 case TEGRA30_CLK_PLL_E:
659 return CLOCK_ID_EPCI;
660 case TEGRA30_CLK_CLK_32K:
661 return CLOCK_ID_32KHZ;
662 case TEGRA30_CLK_CLK_M:
663 return CLOCK_ID_CLK_M;
664 default:
665 return CLOCK_ID_NONE;
666 }
667}
Masahiro Yamada366b24f2015-08-12 07:31:55 +0900668#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
Tom Warren61c6d0e2012-12-11 13:34:15 +0000669
Tom Warren61c6d0e2012-12-11 13:34:15 +0000670void clock_early_init(void)
671{
Jimmy Zhang2a544db2014-01-24 10:37:36 -0700672 tegra30_set_up_pllp();
Tom Warren61c6d0e2012-12-11 13:34:15 +0000673}
Tom Warrenfbef3552013-04-01 15:48:54 -0700674
675void arch_timer_init(void)
676{
677}
Thierry Reding4bf98692014-12-09 22:25:06 -0700678
679#define PMC_SATA_PWRGT 0x1ac
680#define PMC_SATA_PWRGT_PLLE_IDDQ_OVERRIDE (1 << 5)
681#define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL (1 << 4)
682
683#define PLLE_SS_CNTL 0x68
684#define PLLE_SS_CNTL_SSCINCINTRV(x) (((x) & 0x3f) << 24)
685#define PLLE_SS_CNTL_SSCINC(x) (((x) & 0xff) << 16)
686#define PLLE_SS_CNTL_SSCBYP (1 << 12)
687#define PLLE_SS_CNTL_INTERP_RESET (1 << 11)
688#define PLLE_SS_CNTL_BYPASS_SS (1 << 10)
689#define PLLE_SS_CNTL_SSCMAX(x) (((x) & 0x1ff) << 0)
690
691#define PLLE_BASE 0x0e8
692#define PLLE_BASE_ENABLE_CML (1 << 31)
693#define PLLE_BASE_ENABLE (1 << 30)
694#define PLLE_BASE_PLDIV_CML(x) (((x) & 0xf) << 24)
695#define PLLE_BASE_PLDIV(x) (((x) & 0x3f) << 16)
696#define PLLE_BASE_NDIV(x) (((x) & 0xff) << 8)
697#define PLLE_BASE_MDIV(x) (((x) & 0xff) << 0)
698
699#define PLLE_MISC 0x0ec
700#define PLLE_MISC_SETUP_BASE(x) (((x) & 0xffff) << 16)
701#define PLLE_MISC_PLL_READY (1 << 15)
702#define PLLE_MISC_LOCK (1 << 11)
703#define PLLE_MISC_LOCK_ENABLE (1 << 9)
704#define PLLE_MISC_SETUP_EXT(x) (((x) & 0x3) << 2)
705
706static int tegra_plle_train(void)
707{
708 unsigned int timeout = 2000;
709 unsigned long value;
710
711 value = readl(NV_PA_PMC_BASE + PMC_SATA_PWRGT);
712 value |= PMC_SATA_PWRGT_PLLE_IDDQ_OVERRIDE;
713 writel(value, NV_PA_PMC_BASE + PMC_SATA_PWRGT);
714
715 value = readl(NV_PA_PMC_BASE + PMC_SATA_PWRGT);
716 value |= PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL;
717 writel(value, NV_PA_PMC_BASE + PMC_SATA_PWRGT);
718
719 value = readl(NV_PA_PMC_BASE + PMC_SATA_PWRGT);
720 value &= ~PMC_SATA_PWRGT_PLLE_IDDQ_OVERRIDE;
721 writel(value, NV_PA_PMC_BASE + PMC_SATA_PWRGT);
722
723 do {
724 value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
725 if (value & PLLE_MISC_PLL_READY)
726 break;
727
728 udelay(100);
729 } while (--timeout);
730
731 if (timeout == 0) {
Masahiro Yamada81e10422017-09-16 14:10:41 +0900732 pr_err("timeout waiting for PLLE to become ready");
Thierry Reding4bf98692014-12-09 22:25:06 -0700733 return -ETIMEDOUT;
734 }
735
736 return 0;
737}
738
739int tegra_plle_enable(void)
740{
741 unsigned int cpcon = 11, p = 18, n = 150, m = 1, timeout = 1000;
742 u32 value;
743 int err;
744
745 /* disable PLLE clock */
746 value = readl(NV_PA_CLK_RST_BASE + PLLE_BASE);
747 value &= ~PLLE_BASE_ENABLE_CML;
748 value &= ~PLLE_BASE_ENABLE;
749 writel(value, NV_PA_CLK_RST_BASE + PLLE_BASE);
750
751 /* clear lock enable and setup field */
752 value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
753 value &= ~PLLE_MISC_LOCK_ENABLE;
754 value &= ~PLLE_MISC_SETUP_BASE(0xffff);
755 value &= ~PLLE_MISC_SETUP_EXT(0x3);
756 writel(value, NV_PA_CLK_RST_BASE + PLLE_MISC);
757
758 value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
759 if ((value & PLLE_MISC_PLL_READY) == 0) {
760 err = tegra_plle_train();
761 if (err < 0) {
Masahiro Yamada81e10422017-09-16 14:10:41 +0900762 pr_err("failed to train PLLE: %d", err);
Thierry Reding4bf98692014-12-09 22:25:06 -0700763 return err;
764 }
765 }
766
767 /* configure PLLE */
768 value = readl(NV_PA_CLK_RST_BASE + PLLE_BASE);
769
770 value &= ~PLLE_BASE_PLDIV_CML(0x0f);
771 value |= PLLE_BASE_PLDIV_CML(cpcon);
772
773 value &= ~PLLE_BASE_PLDIV(0x3f);
774 value |= PLLE_BASE_PLDIV(p);
775
776 value &= ~PLLE_BASE_NDIV(0xff);
777 value |= PLLE_BASE_NDIV(n);
778
779 value &= ~PLLE_BASE_MDIV(0xff);
780 value |= PLLE_BASE_MDIV(m);
781
782 writel(value, NV_PA_CLK_RST_BASE + PLLE_BASE);
783
784 value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
785 value |= PLLE_MISC_SETUP_BASE(0x7);
786 value |= PLLE_MISC_LOCK_ENABLE;
787 value |= PLLE_MISC_SETUP_EXT(0);
788 writel(value, NV_PA_CLK_RST_BASE + PLLE_MISC);
789
790 value = readl(NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
791 value |= PLLE_SS_CNTL_SSCBYP | PLLE_SS_CNTL_INTERP_RESET |
792 PLLE_SS_CNTL_BYPASS_SS;
793 writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
794
795 value = readl(NV_PA_CLK_RST_BASE + PLLE_BASE);
796 value |= PLLE_BASE_ENABLE_CML | PLLE_BASE_ENABLE;
797 writel(value, NV_PA_CLK_RST_BASE + PLLE_BASE);
798
799 do {
800 value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
801 if (value & PLLE_MISC_LOCK)
802 break;
803
804 udelay(2);
805 } while (--timeout);
806
807 if (timeout == 0) {
Masahiro Yamada81e10422017-09-16 14:10:41 +0900808 pr_err("timeout waiting for PLLE to lock");
Thierry Reding4bf98692014-12-09 22:25:06 -0700809 return -ETIMEDOUT;
810 }
811
812 udelay(50);
813
814 value = readl(NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
815 value &= ~PLLE_SS_CNTL_SSCINCINTRV(0x3f);
816 value |= PLLE_SS_CNTL_SSCINCINTRV(0x18);
817
818 value &= ~PLLE_SS_CNTL_SSCINC(0xff);
819 value |= PLLE_SS_CNTL_SSCINC(0x01);
820
821 value &= ~PLLE_SS_CNTL_SSCBYP;
822 value &= ~PLLE_SS_CNTL_INTERP_RESET;
823 value &= ~PLLE_SS_CNTL_BYPASS_SS;
824
825 value &= ~PLLE_SS_CNTL_SSCMAX(0x1ff);
826 value |= PLLE_SS_CNTL_SSCMAX(0x24);
827 writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
828
829 return 0;
830}
Stephen Warren1453d102016-09-13 10:45:55 -0600831
832struct periph_clk_init periph_clk_init_table[] = {
833 { PERIPH_ID_SBC1, CLOCK_ID_PERIPH },
834 { PERIPH_ID_SBC2, CLOCK_ID_PERIPH },
835 { PERIPH_ID_SBC3, CLOCK_ID_PERIPH },
836 { PERIPH_ID_SBC4, CLOCK_ID_PERIPH },
837 { PERIPH_ID_SBC5, CLOCK_ID_PERIPH },
838 { PERIPH_ID_SBC6, CLOCK_ID_PERIPH },
Svyatoslav Ryhel932ec722023-02-14 19:35:24 +0200839 { PERIPH_ID_HOST1X, CLOCK_ID_CGENERAL },
840 { PERIPH_ID_DISP1, CLOCK_ID_PERIPH },
Stephen Warren1453d102016-09-13 10:45:55 -0600841 { PERIPH_ID_NDFLASH, CLOCK_ID_PERIPH },
842 { PERIPH_ID_SDMMC1, CLOCK_ID_PERIPH },
843 { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH },
844 { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH },
845 { PERIPH_ID_SDMMC4, CLOCK_ID_PERIPH },
846 { PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ },
847 { PERIPH_ID_DVC_I2C, CLOCK_ID_PERIPH },
848 { PERIPH_ID_I2C1, CLOCK_ID_PERIPH },
849 { PERIPH_ID_I2C2, CLOCK_ID_PERIPH },
850 { PERIPH_ID_I2C3, CLOCK_ID_PERIPH },
851 { PERIPH_ID_I2C4, CLOCK_ID_PERIPH },
852 { -1, },
853};