xref: /rk3399_rockchip-uboot/arch/arm/include/asm/arch-tegra/clock.h (revision 000f15fa15c57d2d2f5a1a1d2ea233edbff6461e)
1150c2493STom Warren /*
2150c2493STom Warren  * Copyright (c) 2011 The Chromium OS Authors.
3150c2493STom Warren  *
41a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
5150c2493STom Warren  */
6150c2493STom Warren 
7150c2493STom Warren /* Tegra clock control functions */
8150c2493STom Warren 
9dc89ad14STom Warren #ifndef _TEGRA_CLOCK_H_
10dc89ad14STom Warren #define _TEGRA_CLOCK_H_
11150c2493STom Warren 
12150c2493STom Warren /* Set of oscillator frequencies supported in the internal API. */
13150c2493STom Warren enum clock_osc_freq {
14150c2493STom Warren 	/* All in MHz, so 13_0 is 13.0MHz */
15150c2493STom Warren 	CLOCK_OSC_FREQ_13_0,
16150c2493STom Warren 	CLOCK_OSC_FREQ_19_2,
17150c2493STom Warren 	CLOCK_OSC_FREQ_12_0,
18150c2493STom Warren 	CLOCK_OSC_FREQ_26_0,
193e8650c0STom Warren 	CLOCK_OSC_FREQ_38_4,
203e8650c0STom Warren 	CLOCK_OSC_FREQ_48_0,
21150c2493STom Warren 
22150c2493STom Warren 	CLOCK_OSC_FREQ_COUNT,
23150c2493STom Warren };
24150c2493STom Warren 
255916a36eSStephen Warren /*
265916a36eSStephen Warren  * Note that no Tegra clock register actually uses all of bits 31:28 as
275916a36eSStephen Warren  * the mux field. Rather, bits 30:28, 29:28, or 28 are used. However, in
285916a36eSStephen Warren  * those cases, nothing is stored in the bits about the mux field, so it's
295916a36eSStephen Warren  * safe to pretend that the mux field extends all the way to the end of the
305916a36eSStephen Warren  * register. As such, the U-Boot clock driver is currently a bit lazy, and
315916a36eSStephen Warren  * doesn't distinguish between 31:28, 30:28, 29:28 and 28; it just lumps
325916a36eSStephen Warren  * them all together and pretends they're all 31:28.
335916a36eSStephen Warren  */
340b01b53aSTom Warren enum {
3504b8e8e7SStephen Warren 	MASK_BITS_31_30,
360b01b53aSTom Warren 	MASK_BITS_31_29,
375916a36eSStephen Warren 	MASK_BITS_31_28,
380b01b53aSTom Warren };
390b01b53aSTom Warren 
40150c2493STom Warren #include <asm/arch/clock-tables.h>
41150c2493STom Warren /* PLL stabilization delay in usec */
42150c2493STom Warren #define CLOCK_PLL_STABLE_DELAY_US 300
43150c2493STom Warren 
44150c2493STom Warren /* return the current oscillator clock frequency */
45150c2493STom Warren enum clock_osc_freq clock_get_osc_freq(void);
46150c2493STom Warren 
47c043c025SThierry Reding /* return the clk_m frequency */
48c043c025SThierry Reding unsigned int clk_m_get_rate(unsigned int parent_rate);
49c043c025SThierry Reding 
50150c2493STom Warren /**
51150c2493STom Warren  * Start PLL using the provided configuration parameters.
52150c2493STom Warren  *
53150c2493STom Warren  * @param id	clock id
54150c2493STom Warren  * @param divm	input divider
55150c2493STom Warren  * @param divn	feedback divider
56150c2493STom Warren  * @param divp	post divider 2^n
57150c2493STom Warren  * @param cpcon	charge pump setup control
58150c2493STom Warren  * @param lfcon	loop filter setup control
59150c2493STom Warren  *
60150c2493STom Warren  * @returns monotonic time in us that the PLL will be stable
61150c2493STom Warren  */
62150c2493STom Warren unsigned long clock_start_pll(enum clock_id id, u32 divm, u32 divn,
63150c2493STom Warren 		u32 divp, u32 cpcon, u32 lfcon);
64150c2493STom Warren 
65150c2493STom Warren /**
6665530a84SLucas Stach  * Set PLL output frequency
6765530a84SLucas Stach  *
6865530a84SLucas Stach  * @param clkid	clock id
6965530a84SLucas Stach  * @param pllout	pll output id
7065530a84SLucas Stach  * @param rate		desired output rate
7165530a84SLucas Stach  *
7265530a84SLucas Stach  * @return 0 if ok, -1 on error (invalid clock id or no suitable divider)
7365530a84SLucas Stach  */
7465530a84SLucas Stach int clock_set_pllout(enum clock_id clkid, enum pll_out_id pllout,
7565530a84SLucas Stach 		unsigned rate);
7665530a84SLucas Stach 
7765530a84SLucas Stach /**
78150c2493STom Warren  * Read low-level parameters of a PLL.
79150c2493STom Warren  *
80150c2493STom Warren  * @param id	clock id to read (note: USB is not supported)
81150c2493STom Warren  * @param divm	returns input divider
82150c2493STom Warren  * @param divn	returns feedback divider
83150c2493STom Warren  * @param divp	returns post divider 2^n
84150c2493STom Warren  * @param cpcon	returns charge pump setup control
85150c2493STom Warren  * @param lfcon	returns loop filter setup control
86150c2493STom Warren  *
87150c2493STom Warren  * @returns 0 if ok, -1 on error (invalid clock id)
88150c2493STom Warren  */
89150c2493STom Warren int clock_ll_read_pll(enum clock_id clkid, u32 *divm, u32 *divn,
90150c2493STom Warren 		u32 *divp, u32 *cpcon, u32 *lfcon);
91150c2493STom Warren 
92150c2493STom Warren /*
93150c2493STom Warren  * Enable a clock
94150c2493STom Warren  *
95150c2493STom Warren  * @param id	clock id
96150c2493STom Warren  */
97150c2493STom Warren void clock_enable(enum periph_id clkid);
98150c2493STom Warren 
99150c2493STom Warren /*
100150c2493STom Warren  * Disable a clock
101150c2493STom Warren  *
102150c2493STom Warren  * @param id	clock id
103150c2493STom Warren  */
104150c2493STom Warren void clock_disable(enum periph_id clkid);
105150c2493STom Warren 
106150c2493STom Warren /*
107150c2493STom Warren  * Set whether a clock is enabled or disabled.
108150c2493STom Warren  *
109150c2493STom Warren  * @param id		clock id
110150c2493STom Warren  * @param enable	1 to enable, 0 to disable
111150c2493STom Warren  */
112150c2493STom Warren void clock_set_enable(enum periph_id clkid, int enable);
113150c2493STom Warren 
114150c2493STom Warren /**
115150c2493STom Warren  * Reset a peripheral. This puts it in reset, waits for a delay, then takes
116150c2493STom Warren  * it out of reset and waits for th delay again.
117150c2493STom Warren  *
118150c2493STom Warren  * @param periph_id	peripheral to reset
119150c2493STom Warren  * @param us_delay	time to delay in microseconds
120150c2493STom Warren  */
121150c2493STom Warren void reset_periph(enum periph_id periph_id, int us_delay);
122150c2493STom Warren 
123150c2493STom Warren /**
124150c2493STom Warren  * Put a peripheral into or out of reset.
125150c2493STom Warren  *
126150c2493STom Warren  * @param periph_id	peripheral to reset
127150c2493STom Warren  * @param enable	1 to put into reset, 0 to take out of reset
128150c2493STom Warren  */
129150c2493STom Warren void reset_set_enable(enum periph_id periph_id, int enable);
130150c2493STom Warren 
131150c2493STom Warren 
132150c2493STom Warren /* CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET/CLR_0 */
133150c2493STom Warren enum crc_reset_id {
134150c2493STom Warren 	/* Things we can hold in reset for each CPU */
135150c2493STom Warren 	crc_rst_cpu = 1,
136766afc3dSAlban Bedel 	crc_rst_de = 1 << 4,	/* What is de? */
137766afc3dSAlban Bedel 	crc_rst_watchdog = 1 << 8,
138766afc3dSAlban Bedel 	crc_rst_debug = 1 << 12,
139150c2493STom Warren };
140150c2493STom Warren 
141150c2493STom Warren /**
142150c2493STom Warren  * Put parts of the CPU complex into or out of reset.\
143150c2493STom Warren  *
144dc89ad14STom Warren  * @param cpu		cpu number (0 or 1 on Tegra2, 0-3 on Tegra3)
145150c2493STom Warren  * @param which		which parts of the complex to affect (OR of crc_reset_id)
146150c2493STom Warren  * @param reset		1 to assert reset, 0 to de-assert
147150c2493STom Warren  */
148150c2493STom Warren void reset_cmplx_set_enable(int cpu, int which, int reset);
149150c2493STom Warren 
150150c2493STom Warren /**
151150c2493STom Warren  * Set the source for a peripheral clock. This plus the divisor sets the
152150c2493STom Warren  * clock rate. You need to look up the datasheet to see the meaning of the
153150c2493STom Warren  * source parameter as it changes for each peripheral.
154150c2493STom Warren  *
155150c2493STom Warren  * Warning: This function is only for use pre-relocation. Please use
156150c2493STom Warren  * clock_start_periph_pll() instead.
157150c2493STom Warren  *
158150c2493STom Warren  * @param periph_id	peripheral to adjust
159150c2493STom Warren  * @param source	source clock (0, 1, 2 or 3)
160150c2493STom Warren  */
161150c2493STom Warren void clock_ll_set_source(enum periph_id periph_id, unsigned source);
162150c2493STom Warren 
163150c2493STom Warren /**
1647bb6199bSSimon Glass  * This function is similar to clock_ll_set_source() except that it can be
1657bb6199bSSimon Glass  * used for clocks with more than 2 mux bits.
1667bb6199bSSimon Glass  *
1677bb6199bSSimon Glass  * @param periph_id	peripheral to adjust
1687bb6199bSSimon Glass  * @param mux_bits	number of mux bits for the clock
1697bb6199bSSimon Glass  * @param source	source clock (0-15 depending on mux_bits)
1707bb6199bSSimon Glass  */
1717bb6199bSSimon Glass int clock_ll_set_source_bits(enum periph_id periph_id, int mux_bits,
1727bb6199bSSimon Glass 			     unsigned source);
1737bb6199bSSimon Glass 
1747bb6199bSSimon Glass /**
175150c2493STom Warren  * Set the source and divisor for a peripheral clock. This sets the
176150c2493STom Warren  * clock rate. You need to look up the datasheet to see the meaning of the
177150c2493STom Warren  * source parameter as it changes for each peripheral.
178150c2493STom Warren  *
179150c2493STom Warren  * Warning: This function is only for use pre-relocation. Please use
180150c2493STom Warren  * clock_start_periph_pll() instead.
181150c2493STom Warren  *
182150c2493STom Warren  * @param periph_id	peripheral to adjust
183150c2493STom Warren  * @param source	source clock (0, 1, 2 or 3)
184150c2493STom Warren  * @param divisor	divisor value to use
185150c2493STom Warren  */
186150c2493STom Warren void clock_ll_set_source_divisor(enum periph_id periph_id, unsigned source,
187150c2493STom Warren 		unsigned divisor);
188150c2493STom Warren 
189150c2493STom Warren /**
190d0ad8a5cSStephen Warren  * Returns the current parent clock ID of a given peripheral. This can be
191d0ad8a5cSStephen Warren  * useful in order to call clock_*_periph_*() from generic code that has no
192d0ad8a5cSStephen Warren  * specific knowledge of system-level clock tree structure.
193d0ad8a5cSStephen Warren  *
194d0ad8a5cSStephen Warren  * @param periph_id	peripheral to query
195d0ad8a5cSStephen Warren  * @return clock ID of the peripheral's current parent clock
196d0ad8a5cSStephen Warren  */
197d0ad8a5cSStephen Warren enum clock_id clock_get_periph_parent(enum periph_id periph_id);
198d0ad8a5cSStephen Warren 
199d0ad8a5cSStephen Warren /**
200150c2493STom Warren  * Start a peripheral PLL clock at the given rate. This also resets the
201150c2493STom Warren  * peripheral.
202150c2493STom Warren  *
203150c2493STom Warren  * @param periph_id	peripheral to start
204150c2493STom Warren  * @param parent	PLL id of required parent clock
205150c2493STom Warren  * @param rate		Required clock rate in Hz
206150c2493STom Warren  * @return rate selected in Hz, or -1U if something went wrong
207150c2493STom Warren  */
208150c2493STom Warren unsigned clock_start_periph_pll(enum periph_id periph_id,
209150c2493STom Warren 		enum clock_id parent, unsigned rate);
210150c2493STom Warren 
211150c2493STom Warren /**
212150c2493STom Warren  * Returns the rate of a peripheral clock in Hz. Since the caller almost
213150c2493STom Warren  * certainly knows the parent clock (having just set it) we require that
214150c2493STom Warren  * this be passed in so we don't need to work it out.
215150c2493STom Warren  *
216150c2493STom Warren  * @param periph_id	peripheral to start
217150c2493STom Warren  * @param parent	PLL id of parent clock (used to calculate rate, you
218150c2493STom Warren  *			must know this!)
219150c2493STom Warren  * @return clock rate of peripheral in Hz
220150c2493STom Warren  */
221150c2493STom Warren unsigned long clock_get_periph_rate(enum periph_id periph_id,
222150c2493STom Warren 		enum clock_id parent);
223150c2493STom Warren 
224150c2493STom Warren /**
225150c2493STom Warren  * Adjust peripheral PLL clock to the given rate. This does not reset the
226150c2493STom Warren  * peripheral. If a second stage divisor is not available, pass NULL for
227150c2493STom Warren  * extra_div. If it is available, then this parameter will return the
228150c2493STom Warren  * divisor selected (which will be a power of 2 from 1 to 256).
229150c2493STom Warren  *
230150c2493STom Warren  * @param periph_id	peripheral to start
231150c2493STom Warren  * @param parent	PLL id of required parent clock
232150c2493STom Warren  * @param rate		Required clock rate in Hz
233150c2493STom Warren  * @param extra_div	value for the second-stage divisor (NULL if one is
234150c2493STom Warren 			not available)
235150c2493STom Warren  * @return rate selected in Hz, or -1U if something went wrong
236150c2493STom Warren  */
237150c2493STom Warren unsigned clock_adjust_periph_pll_div(enum periph_id periph_id,
238150c2493STom Warren 		enum clock_id parent, unsigned rate, int *extra_div);
239150c2493STom Warren 
240150c2493STom Warren /**
241150c2493STom Warren  * Returns the clock rate of a specified clock, in Hz.
242150c2493STom Warren  *
243150c2493STom Warren  * @param parent	PLL id of clock to check
244150c2493STom Warren  * @return rate of clock in Hz
245150c2493STom Warren  */
246150c2493STom Warren unsigned clock_get_rate(enum clock_id clkid);
247150c2493STom Warren 
248150c2493STom Warren /**
249150c2493STom Warren  * Start up a UART using low-level calls
250150c2493STom Warren  *
251150c2493STom Warren  * Prior to relocation clock_start_periph_pll() cannot be called. This
252150c2493STom Warren  * function provides a way to set up a UART using low-level calls which
253150c2493STom Warren  * do not require BSS.
254150c2493STom Warren  *
255150c2493STom Warren  * @param periph_id	Peripheral ID of UART to enable (e,g, PERIPH_ID_UART1)
256150c2493STom Warren  */
257150c2493STom Warren void clock_ll_start_uart(enum periph_id periph_id);
258150c2493STom Warren 
259150c2493STom Warren /**
260150c2493STom Warren  * Decode a peripheral ID from a device tree node.
261150c2493STom Warren  *
262150c2493STom Warren  * This works by looking up the peripheral's 'clocks' node and reading out
263150c2493STom Warren  * the second cell, which is the clock number / peripheral ID.
264150c2493STom Warren  *
265150c2493STom Warren  * @param blob		FDT blob to use
266150c2493STom Warren  * @param node		Node to look at
267150c2493STom Warren  * @return peripheral ID, or PERIPH_ID_NONE if none
268150c2493STom Warren  */
269*000f15faSSimon Glass int clock_decode_periph_id(struct udevice *dev);
270150c2493STom Warren 
271150c2493STom Warren /**
272150c2493STom Warren  * Checks if the oscillator bypass is enabled (XOBP bit)
273150c2493STom Warren  *
274150c2493STom Warren  * @return 1 if bypass is enabled, 0 if not
275150c2493STom Warren  */
276150c2493STom Warren int clock_get_osc_bypass(void);
277150c2493STom Warren 
278150c2493STom Warren /*
279150c2493STom Warren  * Checks that clocks are valid and prints a warning if not
280150c2493STom Warren  *
281150c2493STom Warren  * @return 0 if ok, -1 on error
282150c2493STom Warren  */
283150c2493STom Warren int clock_verify(void);
284150c2493STom Warren 
285150c2493STom Warren /* Initialize the clocks */
286150c2493STom Warren void clock_init(void);
287150c2493STom Warren 
288150c2493STom Warren /* Initialize the PLLs */
289150c2493STom Warren void clock_early_init(void);
290150c2493STom Warren 
29146864cc8SSimon Glass /* @return true if hardware indicates that clock_early_init() was called */
29246864cc8SSimon Glass bool clock_early_init_done(void);
29346864cc8SSimon Glass 
294f29f086aSTom Warren /* Returns a pointer to the clock source register for a peripheral */
295f29f086aSTom Warren u32 *get_periph_source_reg(enum periph_id periph_id);
296f29f086aSTom Warren 
297801b05cdSSimon Glass /* Returns a pointer to the given 'simple' PLL */
298801b05cdSSimon Glass struct clk_pll_simple *clock_get_simple_pll(enum clock_id clkid);
299801b05cdSSimon Glass 
300d0ad8a5cSStephen Warren /*
301d0ad8a5cSStephen Warren  * Given a peripheral ID, determine where the mux bits are in the peripheral
302d0ad8a5cSStephen Warren  * clock's register, the number of divider bits the clock has, and the SoC-
303d0ad8a5cSStephen Warren  * specific clock type.
304d0ad8a5cSStephen Warren  *
305d0ad8a5cSStephen Warren  * This is an internal API between the core Tegra clock code and the SoC-
306d0ad8a5cSStephen Warren  * specific clock code.
307d0ad8a5cSStephen Warren  *
308d0ad8a5cSStephen Warren  * @param periph_id     peripheral to query
309d0ad8a5cSStephen Warren  * @param mux_bits      Set to number of bits in mux register
310d0ad8a5cSStephen Warren  * @param divider_bits  Set to the relevant MASK_BITS_* value
311d0ad8a5cSStephen Warren  * @param type          Set to the SoC-specific clock type
312d0ad8a5cSStephen Warren  * @return 0 on success, -1 on error
313d0ad8a5cSStephen Warren  */
314d0ad8a5cSStephen Warren int get_periph_clock_info(enum periph_id periph_id, int *mux_bits,
315d0ad8a5cSStephen Warren 			  int *divider_bits, int *type);
316d0ad8a5cSStephen Warren 
317d0ad8a5cSStephen Warren /*
318d0ad8a5cSStephen Warren  * Given a peripheral ID and clock source mux value, determine the clock_id
319d0ad8a5cSStephen Warren  * of that peripheral's parent.
320d0ad8a5cSStephen Warren  *
321d0ad8a5cSStephen Warren  * This is an internal API between the core Tegra clock code and the SoC-
322d0ad8a5cSStephen Warren  * specific clock code.
323d0ad8a5cSStephen Warren  *
324d0ad8a5cSStephen Warren  * @param periph_id     peripheral to query
325d0ad8a5cSStephen Warren  * @param source        raw clock source mux value
326d0ad8a5cSStephen Warren  * @return the CLOCK_ID_* value @source represents
327d0ad8a5cSStephen Warren  */
328d0ad8a5cSStephen Warren enum clock_id get_periph_clock_id(enum periph_id periph_id, int source);
329d0ad8a5cSStephen Warren 
330f29f086aSTom Warren /**
331f29f086aSTom Warren  * Given a peripheral ID and the required source clock, this returns which
332f29f086aSTom Warren  * value should be programmed into the source mux for that peripheral.
333f29f086aSTom Warren  *
334f29f086aSTom Warren  * There is special code here to handle the one source type with 5 sources.
335f29f086aSTom Warren  *
336f29f086aSTom Warren  * @param periph_id     peripheral to start
337f29f086aSTom Warren  * @param source        PLL id of required parent clock
338f29f086aSTom Warren  * @param mux_bits      Set to number of bits in mux register: 2 or 4
339f29f086aSTom Warren  * @param divider_bits  Set to number of divider bits (8 or 16)
340f29f086aSTom Warren  * @return mux value (0-4, or -1 if not found)
341f29f086aSTom Warren  */
342f29f086aSTom Warren int get_periph_clock_source(enum periph_id periph_id,
343f29f086aSTom Warren 		enum clock_id parent, int *mux_bits, int *divider_bits);
344f29f086aSTom Warren 
345f29f086aSTom Warren /*
346f29f086aSTom Warren  * Convert a device tree clock ID to our peripheral ID. They are mostly
347f29f086aSTom Warren  * the same but we are very cautious so we check that a valid clock ID is
348f29f086aSTom Warren  * provided.
349f29f086aSTom Warren  *
350f29f086aSTom Warren  * @param clk_id        Clock ID according to tegra30 device tree binding
351f29f086aSTom Warren  * @return peripheral ID, or PERIPH_ID_NONE if the clock ID is invalid
352f29f086aSTom Warren  */
353f29f086aSTom Warren enum periph_id clk_id_to_periph_id(int clk_id);
354f29f086aSTom Warren 
355f29f086aSTom Warren /**
356f29f086aSTom Warren  * Set the output frequency you want for each PLL clock.
357f29f086aSTom Warren  * PLL output frequencies are programmed by setting their N, M and P values.
358f29f086aSTom Warren  * The governing equations are:
359f29f086aSTom Warren  *     VCO = (Fi / m) * n, Fo = VCO / (2^p)
360f29f086aSTom Warren  *     where Fo is the output frequency from the PLL.
361f29f086aSTom Warren  * Example: Set the output frequency to 216Mhz(Fo) with 12Mhz OSC(Fi)
362f29f086aSTom Warren  *     216Mhz = ((12Mhz / m) * n) / (2^p) so n=432,m=12,p=1
363f29f086aSTom Warren  * Please see Tegra TRM section 5.3 to get the detail for PLL Programming
364f29f086aSTom Warren  *
365f29f086aSTom Warren  * @param n PLL feedback divider(DIVN)
366f29f086aSTom Warren  * @param m PLL input divider(DIVN)
367f29f086aSTom Warren  * @param p post divider(DIVP)
368f29f086aSTom Warren  * @param cpcon base PLL charge pump(CPCON)
369f29f086aSTom Warren  * @return 0 if ok, -1 on error (the requested PLL is incorrect and cannot
37062a3b7ddSRobert P. J. Day  *              be overridden), 1 if PLL is already correct
371f29f086aSTom Warren  */
372f29f086aSTom Warren int clock_set_rate(enum clock_id clkid, u32 n, u32 m, u32 p, u32 cpcon);
373f29f086aSTom Warren 
374f29f086aSTom Warren /* return 1 if a peripheral ID is in range */
375f29f086aSTom Warren #define clock_type_id_isvalid(id) ((id) >= 0 && \
376f29f086aSTom Warren 		(id) < CLOCK_TYPE_COUNT)
377f29f086aSTom Warren 
378f29f086aSTom Warren /* return 1 if a periphc_internal_id is in range */
379f29f086aSTom Warren #define periphc_internal_id_isvalid(id) ((id) >= 0 && \
380f29f086aSTom Warren 		(id) < PERIPHC_COUNT)
381f29f086aSTom Warren 
382b40f734aSTom Warren /* SoC-specific TSC init */
383b40f734aSTom Warren void arch_timer_init(void);
384b40f734aSTom Warren 
385b9dd6215SJimmy Zhang void tegra30_set_up_pllp(void);
386b9dd6215SJimmy Zhang 
387c043c025SThierry Reding /* Number of PLL-based clocks (i.e. not OSC, MCLK or 32KHz) */
388c043c025SThierry Reding #define CLOCK_ID_PLL_COUNT	(CLOCK_ID_COUNT - 3)
389722e000cSTom Warren 
390722e000cSTom Warren struct clk_pll_info {
391722e000cSTom Warren 	u32	m_shift:5;	/* DIVM_SHIFT */
392722e000cSTom Warren 	u32	n_shift:5;	/* DIVN_SHIFT */
393722e000cSTom Warren 	u32	p_shift:5;	/* DIVP_SHIFT */
394722e000cSTom Warren 	u32	kcp_shift:5;	/* KCP/cpcon SHIFT */
395722e000cSTom Warren 	u32	kvco_shift:5;	/* KVCO/lfcon SHIFT */
396722e000cSTom Warren 	u32	lock_ena:6;	/* LOCK_ENABLE/EN_LOCKDET shift */
397722e000cSTom Warren 	u32	rsvd:1;
398722e000cSTom Warren 	u32	m_mask:10;	/* DIVM_MASK */
399722e000cSTom Warren 	u32	n_mask:12;	/* DIVN_MASK */
400722e000cSTom Warren 	u32	p_mask:10;	/* DIVP_MASK or VCO_MASK */
401722e000cSTom Warren 	u32	kcp_mask:10;	/* KCP/CPCON MASK */
402722e000cSTom Warren 	u32	kvco_mask:10;	/* KVCO/LFCON MASK */
403722e000cSTom Warren 	u32	lock_det:6;	/* LOCK_DETECT/LOCKED shift */
404722e000cSTom Warren 	u32	rsvd2:6;
405722e000cSTom Warren };
406722e000cSTom Warren extern struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT];
407722e000cSTom Warren 
4086dbcc962SStephen Warren struct periph_clk_init {
4096dbcc962SStephen Warren 	enum periph_id periph_id;
4106dbcc962SStephen Warren 	enum clock_id parent_clock_id;
4116dbcc962SStephen Warren };
4126dbcc962SStephen Warren extern struct periph_clk_init periph_clk_init_table[];
4136dbcc962SStephen Warren 
414746dc76bSSimon Glass /**
415746dc76bSSimon Glass  * Enable output clock for external peripherals
416746dc76bSSimon Glass  *
417746dc76bSSimon Glass  * @param clk_id	Clock ID to output (1, 2 or 3)
418746dc76bSSimon Glass  * @return 0 if OK. -ve on error
419746dc76bSSimon Glass  */
420746dc76bSSimon Glass int clock_external_output(int clk_id);
421746dc76bSSimon Glass 
422dc89ad14STom Warren #endif  /* _TEGRA_CLOCK_H_ */
423