xref: /openbmc/u-boot/arch/arm/include/asm/arch-mx25/clock.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
2819833afSPeter Tyser /*
3819833afSPeter Tyser  *
4819833afSPeter Tyser  * (c) 2009 Ilya Yanok, Emcraft Systems <yanok@emcraft.com>
5819833afSPeter Tyser  *
6819833afSPeter Tyser  * Modified for mx25 by John Rigby <jrigby@gmail.com>
7819833afSPeter Tyser  */
8819833afSPeter Tyser 
9819833afSPeter Tyser #ifndef __ASM_ARCH_CLOCK_H
10819833afSPeter Tyser #define __ASM_ARCH_CLOCK_H
11819833afSPeter Tyser 
121b2080f3SBenoît Thébaudeau #include <common.h>
131b2080f3SBenoît Thébaudeau 
141b2080f3SBenoît Thébaudeau #ifdef CONFIG_MX25_HCLK_FREQ
151b2080f3SBenoît Thébaudeau #define MXC_HCLK	CONFIG_MX25_HCLK_FREQ
161b2080f3SBenoît Thébaudeau #else
171b2080f3SBenoît Thébaudeau #define MXC_HCLK	24000000
181b2080f3SBenoît Thébaudeau #endif
191b2080f3SBenoît Thébaudeau 
201b2080f3SBenoît Thébaudeau #ifdef CONFIG_MX25_CLK32
211b2080f3SBenoît Thébaudeau #define MXC_CLK32	CONFIG_MX25_CLK32
221b2080f3SBenoît Thébaudeau #else
231b2080f3SBenoît Thébaudeau #define MXC_CLK32	32768
241b2080f3SBenoît Thébaudeau #endif
251b2080f3SBenoît Thébaudeau 
2642d25327STimo Ketola enum mxc_clock {
27c3b51890SBenoît Thébaudeau 	/* PER clocks (do not change order) */
2842d25327STimo Ketola 	MXC_CSI_CLK,
2942d25327STimo Ketola 	MXC_EPIT_CLK,
3042d25327STimo Ketola 	MXC_ESAI_CLK,
3142d25327STimo Ketola 	MXC_ESDHC1_CLK,
3242d25327STimo Ketola 	MXC_ESDHC2_CLK,
3342d25327STimo Ketola 	MXC_GPT_CLK,
3442d25327STimo Ketola 	MXC_I2C_CLK,
3542d25327STimo Ketola 	MXC_LCDC_CLK,
3642d25327STimo Ketola 	MXC_NFC_CLK,
3742d25327STimo Ketola 	MXC_OWIRE_CLK,
3842d25327STimo Ketola 	MXC_PWM_CLK,
3942d25327STimo Ketola 	MXC_SIM1_CLK,
4042d25327STimo Ketola 	MXC_SIM2_CLK,
4142d25327STimo Ketola 	MXC_SSI1_CLK,
4242d25327STimo Ketola 	MXC_SSI2_CLK,
4342d25327STimo Ketola 	MXC_UART_CLK,
44c3b51890SBenoît Thébaudeau 	/* Other clocks */
4542d25327STimo Ketola 	MXC_ARM_CLK,
46c3b51890SBenoît Thébaudeau 	MXC_AHB_CLK,
47c3b51890SBenoît Thébaudeau 	MXC_IPG_CLK,
48c3b51890SBenoît Thébaudeau 	MXC_CSPI_CLK,
4942d25327STimo Ketola 	MXC_FEC_CLK,
5042d25327STimo Ketola 	MXC_CLK_NUM
5142d25327STimo Ketola };
5242d25327STimo Ketola 
533e3aab33SBenoît Thébaudeau int imx_set_perclk(enum mxc_clock clk, bool from_upll, unsigned int freq);
5442d25327STimo Ketola unsigned int mxc_get_clock(enum mxc_clock clk);
55819833afSPeter Tyser 
569baefa46SBenoît Thébaudeau #define imx_get_uartclk()	mxc_get_clock(MXC_UART_CLK)
579baefa46SBenoît Thébaudeau #define imx_get_fecclk()	mxc_get_clock(MXC_FEC_CLK)
589baefa46SBenoît Thébaudeau 
59819833afSPeter Tyser #endif /* __ASM_ARCH_CLOCK_H */
60