xref: /rk3399_rockchip-uboot/arch/arm/include/asm/arch-mx5/clock.h (revision 414e1660c8e898539411d92fbacdefc3e6bfbdfb)
1ff9f475dSJason Liu /*
2ff9f475dSJason Liu  * (C) Copyright 2009
3ff9f475dSJason Liu  * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
4ff9f475dSJason Liu  *
5ff9f475dSJason Liu  * See file CREDITS for list of people who contributed to this
6ff9f475dSJason Liu  * project.
7ff9f475dSJason Liu  *
8ff9f475dSJason Liu  * This program is free software; you can redistribute it and/or
9ff9f475dSJason Liu  * modify it under the terms of the GNU General Public License as
10ff9f475dSJason Liu  * published by the Free Software Foundation; either version 2 of
11ff9f475dSJason Liu  * the License, or (at your option) any later version.
12ff9f475dSJason Liu  *
13ff9f475dSJason Liu  * This program is distributed in the hope that it will be useful,
14ff9f475dSJason Liu  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15ff9f475dSJason Liu  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16ff9f475dSJason Liu  * GNU General Public License for more details.
17ff9f475dSJason Liu  *
18ff9f475dSJason Liu  * You should have received a copy of the GNU General Public License
19ff9f475dSJason Liu  * along with this program; if not, write to the Free Software
20ff9f475dSJason Liu  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21ff9f475dSJason Liu  * MA 02111-1307 USA
22ff9f475dSJason Liu  */
23ff9f475dSJason Liu 
24ff9f475dSJason Liu #ifndef __ASM_ARCH_CLOCK_H
25ff9f475dSJason Liu #define __ASM_ARCH_CLOCK_H
26ff9f475dSJason Liu 
27833b6435SBenoît Thébaudeau #include <common.h>
28833b6435SBenoît Thébaudeau 
29833b6435SBenoît Thébaudeau #ifdef CONFIG_SYS_MX5_HCLK
30833b6435SBenoît Thébaudeau #define MXC_HCLK	CONFIG_SYS_MX5_HCLK
31833b6435SBenoît Thébaudeau #else
32833b6435SBenoît Thébaudeau #define MXC_HCLK	24000000
33833b6435SBenoît Thébaudeau #endif
34833b6435SBenoît Thébaudeau 
35833b6435SBenoît Thébaudeau #ifdef CONFIG_SYS_MX5_CLK32
36833b6435SBenoît Thébaudeau #define MXC_CLK32	CONFIG_SYS_MX5_CLK32
37833b6435SBenoît Thébaudeau #else
38833b6435SBenoît Thébaudeau #define MXC_CLK32	32768
39833b6435SBenoît Thébaudeau #endif
40833b6435SBenoît Thébaudeau 
41ff9f475dSJason Liu enum mxc_clock {
42ff9f475dSJason Liu 	MXC_ARM_CLK = 0,
43ff9f475dSJason Liu 	MXC_AHB_CLK,
44ff9f475dSJason Liu 	MXC_IPG_CLK,
45ff9f475dSJason Liu 	MXC_IPG_PERCLK,
46ff9f475dSJason Liu 	MXC_UART_CLK,
47ff9f475dSJason Liu 	MXC_CSPI_CLK,
48ff9f475dSJason Liu 	MXC_FEC_CLK,
49d87c85ceSStefano Babic 	MXC_SATA_CLK,
5070cc86a6SFabio Estevam 	MXC_DDR_CLK,
5170cc86a6SFabio Estevam 	MXC_NFC_CLK,
5270cc86a6SFabio Estevam 	MXC_PERIPH_CLK,
53e7bed5c2SMatthias Weisser 	MXC_I2C_CLK,
54ff9f475dSJason Liu };
55ff9f475dSJason Liu 
56ff9f475dSJason Liu u32 imx_get_uartclk(void);
57ff9f475dSJason Liu u32 imx_get_fecclk(void);
58ff9f475dSJason Liu unsigned int mxc_get_clock(enum mxc_clock clk);
5970cc86a6SFabio Estevam int mxc_set_clock(u32 ref, u32 freq, u32 clk_type);
60*414e1660SBenoît Thébaudeau void set_usb_phy_clk(void);
61*414e1660SBenoît Thébaudeau void enable_usb_phy1_clk(unsigned char enable);
625d2947a3SWolfgang Grandegger void enable_usb_phy2_clk(unsigned char enable);
635d2947a3SWolfgang Grandegger void set_usboh3_clk(void);
645d2947a3SWolfgang Grandegger void enable_usboh3_clk(unsigned char enable);
658c38b5d0SStefano Babic void mxc_set_sata_internal_clock(void);
66cc54a0f7STroy Kisky int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
675d2947a3SWolfgang Grandegger 
68ff9f475dSJason Liu #endif /* __ASM_ARCH_CLOCK_H */
69