xref: /rk3399_rockchip-uboot/arch/arm/include/asm/arch-mx25/clock.h (revision 9baefa465d213330368b5cefcda3d5926351faa4)
1819833afSPeter Tyser /*
2819833afSPeter Tyser  *
3819833afSPeter Tyser  * (c) 2009 Ilya Yanok, Emcraft Systems <yanok@emcraft.com>
4819833afSPeter Tyser  *
5819833afSPeter Tyser  * Modified for mx25 by John Rigby <jrigby@gmail.com>
6819833afSPeter Tyser  *
7819833afSPeter Tyser  * See file CREDITS for list of people who contributed to this
8819833afSPeter Tyser  * project.
9819833afSPeter Tyser  *
10819833afSPeter Tyser  * This program is free software; you can redistribute it and/or
11819833afSPeter Tyser  * modify it under the terms of the GNU General Public License as
12819833afSPeter Tyser  * published by the Free Software Foundation; either version 2 of
13819833afSPeter Tyser  * the License, or (at your option) any later version.
14819833afSPeter Tyser  *
15819833afSPeter Tyser  * This program is distributed in the hope that it will be useful,
16819833afSPeter Tyser  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17819833afSPeter Tyser  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18819833afSPeter Tyser  * GNU General Public License for more details.
19819833afSPeter Tyser  *
20819833afSPeter Tyser  * You should have received a copy of the GNU General Public License
21819833afSPeter Tyser  * along with this program; if not, write to the Free Software
22819833afSPeter Tyser  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23819833afSPeter Tyser  * MA 02111-1307 USA
24819833afSPeter Tyser  */
25819833afSPeter Tyser 
26819833afSPeter Tyser #ifndef __ASM_ARCH_CLOCK_H
27819833afSPeter Tyser #define __ASM_ARCH_CLOCK_H
28819833afSPeter Tyser 
291b2080f3SBenoît Thébaudeau #include <common.h>
301b2080f3SBenoît Thébaudeau 
311b2080f3SBenoît Thébaudeau #ifdef CONFIG_MX25_HCLK_FREQ
321b2080f3SBenoît Thébaudeau #define MXC_HCLK	CONFIG_MX25_HCLK_FREQ
331b2080f3SBenoît Thébaudeau #else
341b2080f3SBenoît Thébaudeau #define MXC_HCLK	24000000
351b2080f3SBenoît Thébaudeau #endif
361b2080f3SBenoît Thébaudeau 
371b2080f3SBenoît Thébaudeau #ifdef CONFIG_MX25_CLK32
381b2080f3SBenoît Thébaudeau #define MXC_CLK32	CONFIG_MX25_CLK32
391b2080f3SBenoît Thébaudeau #else
401b2080f3SBenoît Thébaudeau #define MXC_CLK32	32768
411b2080f3SBenoît Thébaudeau #endif
421b2080f3SBenoît Thébaudeau 
4342d25327STimo Ketola enum mxc_clock {
44c3b51890SBenoît Thébaudeau 	/* PER clocks (do not change order) */
4542d25327STimo Ketola 	MXC_CSI_CLK,
4642d25327STimo Ketola 	MXC_EPIT_CLK,
4742d25327STimo Ketola 	MXC_ESAI_CLK,
4842d25327STimo Ketola 	MXC_ESDHC1_CLK,
4942d25327STimo Ketola 	MXC_ESDHC2_CLK,
5042d25327STimo Ketola 	MXC_GPT_CLK,
5142d25327STimo Ketola 	MXC_I2C_CLK,
5242d25327STimo Ketola 	MXC_LCDC_CLK,
5342d25327STimo Ketola 	MXC_NFC_CLK,
5442d25327STimo Ketola 	MXC_OWIRE_CLK,
5542d25327STimo Ketola 	MXC_PWM_CLK,
5642d25327STimo Ketola 	MXC_SIM1_CLK,
5742d25327STimo Ketola 	MXC_SIM2_CLK,
5842d25327STimo Ketola 	MXC_SSI1_CLK,
5942d25327STimo Ketola 	MXC_SSI2_CLK,
6042d25327STimo Ketola 	MXC_UART_CLK,
61c3b51890SBenoît Thébaudeau 	/* Other clocks */
6242d25327STimo Ketola 	MXC_ARM_CLK,
63c3b51890SBenoît Thébaudeau 	MXC_AHB_CLK,
64c3b51890SBenoît Thébaudeau 	MXC_IPG_CLK,
65c3b51890SBenoît Thébaudeau 	MXC_CSPI_CLK,
6642d25327STimo Ketola 	MXC_FEC_CLK,
6742d25327STimo Ketola 	MXC_CLK_NUM
6842d25327STimo Ketola };
6942d25327STimo Ketola 
7042d25327STimo Ketola unsigned int mxc_get_clock(enum mxc_clock clk);
71819833afSPeter Tyser 
72*9baefa46SBenoît Thébaudeau #define imx_get_uartclk()	mxc_get_clock(MXC_UART_CLK)
73*9baefa46SBenoît Thébaudeau #define imx_get_fecclk()	mxc_get_clock(MXC_FEC_CLK)
74*9baefa46SBenoît Thébaudeau 
75819833afSPeter Tyser #endif /* __ASM_ARCH_CLOCK_H */
76