1 /*
2  * Freescale i.MX28 CLKCTRL Register Definitions
3  *
4  * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
5  * on behalf of DENX Software Engineering GmbH
6  *
7  * Based on code from LTIB:
8  * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23  *
24  */
25 
26 #ifndef __MX28_REGS_CLKCTRL_H__
27 #define __MX28_REGS_CLKCTRL_H__
28 
29 #include <asm/arch/regs-common.h>
30 
31 #ifndef	__ASSEMBLY__
32 struct mxs_clkctrl_regs {
33 	mxs_reg_32(hw_clkctrl_pll0ctrl0)	/* 0x00 */
34 	mxs_reg_32(hw_clkctrl_pll0ctrl1)	/* 0x10 */
35 	mxs_reg_32(hw_clkctrl_pll1ctrl0)	/* 0x20 */
36 	mxs_reg_32(hw_clkctrl_pll1ctrl1)	/* 0x30 */
37 	mxs_reg_32(hw_clkctrl_pll2ctrl0)	/* 0x40 */
38 	mxs_reg_32(hw_clkctrl_cpu)		/* 0x50 */
39 	mxs_reg_32(hw_clkctrl_hbus)		/* 0x60 */
40 	mxs_reg_32(hw_clkctrl_xbus)		/* 0x70 */
41 	mxs_reg_32(hw_clkctrl_xtal)		/* 0x80 */
42 	mxs_reg_32(hw_clkctrl_ssp0)		/* 0x90 */
43 	mxs_reg_32(hw_clkctrl_ssp1)		/* 0xa0 */
44 	mxs_reg_32(hw_clkctrl_ssp2)		/* 0xb0 */
45 	mxs_reg_32(hw_clkctrl_ssp3)		/* 0xc0 */
46 	mxs_reg_32(hw_clkctrl_gpmi)		/* 0xd0 */
47 	mxs_reg_32(hw_clkctrl_spdif)		/* 0xe0 */
48 	mxs_reg_32(hw_clkctrl_emi)		/* 0xf0 */
49 	mxs_reg_32(hw_clkctrl_saif0)		/* 0x100 */
50 	mxs_reg_32(hw_clkctrl_saif1)		/* 0x110 */
51 	mxs_reg_32(hw_clkctrl_lcdif)		/* 0x120 */
52 	mxs_reg_32(hw_clkctrl_etm)		/* 0x130 */
53 	mxs_reg_32(hw_clkctrl_enet)		/* 0x140 */
54 	mxs_reg_32(hw_clkctrl_hsadc)		/* 0x150 */
55 	mxs_reg_32(hw_clkctrl_flexcan)		/* 0x160 */
56 
57 	uint32_t	reserved[16];
58 
59 	mxs_reg_8(hw_clkctrl_frac0)		/* 0x1b0 */
60 	mxs_reg_8(hw_clkctrl_frac1)		/* 0x1c0 */
61 	mxs_reg_32(hw_clkctrl_clkseq)		/* 0x1d0 */
62 	mxs_reg_32(hw_clkctrl_reset)		/* 0x1e0 */
63 	mxs_reg_32(hw_clkctrl_status)		/* 0x1f0 */
64 	mxs_reg_32(hw_clkctrl_version)		/* 0x200 */
65 };
66 #endif
67 
68 #define	CLKCTRL_PLL0CTRL0_LFR_SEL_MASK		(0x3 << 28)
69 #define	CLKCTRL_PLL0CTRL0_LFR_SEL_OFFSET	28
70 #define	CLKCTRL_PLL0CTRL0_LFR_SEL_DEFAULT	(0x0 << 28)
71 #define	CLKCTRL_PLL0CTRL0_LFR_SEL_TIMES_2	(0x1 << 28)
72 #define	CLKCTRL_PLL0CTRL0_LFR_SEL_TIMES_05	(0x2 << 28)
73 #define	CLKCTRL_PLL0CTRL0_LFR_SEL_UNDEFINED	(0x3 << 28)
74 #define	CLKCTRL_PLL0CTRL0_CP_SEL_MASK		(0x3 << 24)
75 #define	CLKCTRL_PLL0CTRL0_CP_SEL_OFFSET		24
76 #define	CLKCTRL_PLL0CTRL0_CP_SEL_DEFAULT	(0x0 << 24)
77 #define	CLKCTRL_PLL0CTRL0_CP_SEL_TIMES_2	(0x1 << 24)
78 #define	CLKCTRL_PLL0CTRL0_CP_SEL_TIMES_05	(0x2 << 24)
79 #define	CLKCTRL_PLL0CTRL0_CP_SEL_UNDEFINED	(0x3 << 24)
80 #define	CLKCTRL_PLL0CTRL0_DIV_SEL_MASK		(0x3 << 20)
81 #define	CLKCTRL_PLL0CTRL0_DIV_SEL_OFFSET	20
82 #define	CLKCTRL_PLL0CTRL0_DIV_SEL_DEFAULT	(0x0 << 20)
83 #define	CLKCTRL_PLL0CTRL0_DIV_SEL_LOWER		(0x1 << 20)
84 #define	CLKCTRL_PLL0CTRL0_DIV_SEL_LOWEST	(0x2 << 20)
85 #define	CLKCTRL_PLL0CTRL0_DIV_SEL_UNDEFINED	(0x3 << 20)
86 #define	CLKCTRL_PLL0CTRL0_EN_USB_CLKS		(1 << 18)
87 #define	CLKCTRL_PLL0CTRL0_POWER			(1 << 17)
88 
89 #define	CLKCTRL_PLL0CTRL1_LOCK			(1 << 31)
90 #define	CLKCTRL_PLL0CTRL1_FORCE_LOCK		(1 << 30)
91 #define	CLKCTRL_PLL0CTRL1_LOCK_COUNT_MASK	0xffff
92 #define	CLKCTRL_PLL0CTRL1_LOCK_COUNT_OFFSET	0
93 
94 #define	CLKCTRL_PLL1CTRL0_CLKGATEEMI		(1 << 31)
95 #define	CLKCTRL_PLL1CTRL0_LFR_SEL_MASK		(0x3 << 28)
96 #define	CLKCTRL_PLL1CTRL0_LFR_SEL_OFFSET	28
97 #define	CLKCTRL_PLL1CTRL0_LFR_SEL_DEFAULT	(0x0 << 28)
98 #define	CLKCTRL_PLL1CTRL0_LFR_SEL_TIMES_2	(0x1 << 28)
99 #define	CLKCTRL_PLL1CTRL0_LFR_SEL_TIMES_05	(0x2 << 28)
100 #define	CLKCTRL_PLL1CTRL0_LFR_SEL_UNDEFINED	(0x3 << 28)
101 #define	CLKCTRL_PLL1CTRL0_CP_SEL_MASK		(0x3 << 24)
102 #define	CLKCTRL_PLL1CTRL0_CP_SEL_OFFSET		24
103 #define	CLKCTRL_PLL1CTRL0_CP_SEL_DEFAULT	(0x0 << 24)
104 #define	CLKCTRL_PLL1CTRL0_CP_SEL_TIMES_2	(0x1 << 24)
105 #define	CLKCTRL_PLL1CTRL0_CP_SEL_TIMES_05	(0x2 << 24)
106 #define	CLKCTRL_PLL1CTRL0_CP_SEL_UNDEFINED	(0x3 << 24)
107 #define	CLKCTRL_PLL1CTRL0_DIV_SEL_MASK		(0x3 << 20)
108 #define	CLKCTRL_PLL1CTRL0_DIV_SEL_OFFSET	20
109 #define	CLKCTRL_PLL1CTRL0_DIV_SEL_DEFAULT	(0x0 << 20)
110 #define	CLKCTRL_PLL1CTRL0_DIV_SEL_LOWER		(0x1 << 20)
111 #define	CLKCTRL_PLL1CTRL0_DIV_SEL_LOWEST	(0x2 << 20)
112 #define	CLKCTRL_PLL1CTRL0_DIV_SEL_UNDEFINED	(0x3 << 20)
113 #define	CLKCTRL_PLL1CTRL0_EN_USB_CLKS		(1 << 18)
114 #define	CLKCTRL_PLL1CTRL0_POWER			(1 << 17)
115 
116 #define	CLKCTRL_PLL1CTRL1_LOCK			(1 << 31)
117 #define	CLKCTRL_PLL1CTRL1_FORCE_LOCK		(1 << 30)
118 #define	CLKCTRL_PLL1CTRL1_LOCK_COUNT_MASK	0xffff
119 #define	CLKCTRL_PLL1CTRL1_LOCK_COUNT_OFFSET	0
120 
121 #define	CLKCTRL_PLL2CTRL0_CLKGATE		(1 << 31)
122 #define	CLKCTRL_PLL2CTRL0_LFR_SEL_MASK		(0x3 << 28)
123 #define	CLKCTRL_PLL2CTRL0_LFR_SEL_OFFSET	28
124 #define	CLKCTRL_PLL2CTRL0_HOLD_RING_OFF_B	(1 << 26)
125 #define	CLKCTRL_PLL2CTRL0_CP_SEL_MASK		(0x3 << 24)
126 #define	CLKCTRL_PLL2CTRL0_CP_SEL_OFFSET		24
127 #define	CLKCTRL_PLL2CTRL0_POWER			(1 << 23)
128 
129 #define	CLKCTRL_CPU_BUSY_REF_XTAL		(1 << 29)
130 #define	CLKCTRL_CPU_BUSY_REF_CPU		(1 << 28)
131 #define	CLKCTRL_CPU_DIV_XTAL_FRAC_EN		(1 << 26)
132 #define	CLKCTRL_CPU_DIV_XTAL_MASK		(0x3ff << 16)
133 #define	CLKCTRL_CPU_DIV_XTAL_OFFSET		16
134 #define	CLKCTRL_CPU_INTERRUPT_WAIT		(1 << 12)
135 #define	CLKCTRL_CPU_DIV_CPU_FRAC_EN		(1 << 10)
136 #define	CLKCTRL_CPU_DIV_CPU_MASK		0x3f
137 #define	CLKCTRL_CPU_DIV_CPU_OFFSET		0
138 
139 #define	CLKCTRL_HBUS_ASM_BUSY			(1 << 31)
140 #define	CLKCTRL_HBUS_DCP_AS_ENABLE		(1 << 30)
141 #define	CLKCTRL_HBUS_PXP_AS_ENABLE		(1 << 29)
142 #define	CLKCTRL_HBUS_ASM_EMIPORT_AS_ENABLE	(1 << 27)
143 #define	CLKCTRL_HBUS_APBHDMA_AS_ENABLE		(1 << 26)
144 #define	CLKCTRL_HBUS_APBXDMA_AS_ENABLE		(1 << 25)
145 #define	CLKCTRL_HBUS_TRAFFIC_JAM_AS_ENABLE	(1 << 24)
146 #define	CLKCTRL_HBUS_TRAFFIC_AS_ENABLE		(1 << 23)
147 #define	CLKCTRL_HBUS_CPU_DATA_AS_ENABLE		(1 << 22)
148 #define	CLKCTRL_HBUS_CPU_INSTR_AS_ENABLE	(1 << 21)
149 #define	CLKCTRL_HBUS_ASM_ENABLE			(1 << 20)
150 #define	CLKCTRL_HBUS_AUTO_CLEAR_DIV_ENABLE	(1 << 19)
151 #define	CLKCTRL_HBUS_SLOW_DIV_MASK		(0x7 << 16)
152 #define	CLKCTRL_HBUS_SLOW_DIV_OFFSET		16
153 #define	CLKCTRL_HBUS_SLOW_DIV_BY1		(0x0 << 16)
154 #define	CLKCTRL_HBUS_SLOW_DIV_BY2		(0x1 << 16)
155 #define	CLKCTRL_HBUS_SLOW_DIV_BY4		(0x2 << 16)
156 #define	CLKCTRL_HBUS_SLOW_DIV_BY8		(0x3 << 16)
157 #define	CLKCTRL_HBUS_SLOW_DIV_BY16		(0x4 << 16)
158 #define	CLKCTRL_HBUS_SLOW_DIV_BY32		(0x5 << 16)
159 #define	CLKCTRL_HBUS_DIV_FRAC_EN		(1 << 5)
160 #define	CLKCTRL_HBUS_DIV_MASK			0x1f
161 #define	CLKCTRL_HBUS_DIV_OFFSET			0
162 
163 #define	CLKCTRL_XBUS_BUSY			(1 << 31)
164 #define	CLKCTRL_XBUS_AUTO_CLEAR_DIV_ENABLE	(1 << 11)
165 #define	CLKCTRL_XBUS_DIV_FRAC_EN		(1 << 10)
166 #define	CLKCTRL_XBUS_DIV_MASK			0x3ff
167 #define	CLKCTRL_XBUS_DIV_OFFSET			0
168 
169 #define	CLKCTRL_XTAL_UART_CLK_GATE		(1 << 31)
170 #define	CLKCTRL_XTAL_PWM_CLK24M_GATE		(1 << 29)
171 #define	CLKCTRL_XTAL_TIMROT_CLK32K_GATE		(1 << 26)
172 #define	CLKCTRL_XTAL_DIV_UART_MASK		0x3
173 #define	CLKCTRL_XTAL_DIV_UART_OFFSET		0
174 
175 #define	CLKCTRL_SSP_CLKGATE			(1 << 31)
176 #define	CLKCTRL_SSP_BUSY			(1 << 29)
177 #define	CLKCTRL_SSP_DIV_FRAC_EN			(1 << 9)
178 #define	CLKCTRL_SSP_DIV_MASK			0x1ff
179 #define	CLKCTRL_SSP_DIV_OFFSET			0
180 
181 #define	CLKCTRL_GPMI_CLKGATE			(1 << 31)
182 #define	CLKCTRL_GPMI_BUSY			(1 << 29)
183 #define	CLKCTRL_GPMI_DIV_FRAC_EN		(1 << 10)
184 #define	CLKCTRL_GPMI_DIV_MASK			0x3ff
185 #define	CLKCTRL_GPMI_DIV_OFFSET			0
186 
187 #define	CLKCTRL_SPDIF_CLKGATE			(1 << 31)
188 
189 #define	CLKCTRL_EMI_CLKGATE			(1 << 31)
190 #define	CLKCTRL_EMI_SYNC_MODE_EN		(1 << 30)
191 #define	CLKCTRL_EMI_BUSY_REF_XTAL		(1 << 29)
192 #define	CLKCTRL_EMI_BUSY_REF_EMI		(1 << 28)
193 #define	CLKCTRL_EMI_BUSY_REF_CPU		(1 << 27)
194 #define	CLKCTRL_EMI_BUSY_SYNC_MODE		(1 << 26)
195 #define	CLKCTRL_EMI_BUSY_DCC_RESYNC		(1 << 17)
196 #define	CLKCTRL_EMI_DCC_RESYNC_ENABLE		(1 << 16)
197 #define	CLKCTRL_EMI_DIV_XTAL_MASK		(0xf << 8)
198 #define	CLKCTRL_EMI_DIV_XTAL_OFFSET		8
199 #define	CLKCTRL_EMI_DIV_EMI_MASK		0x3f
200 #define	CLKCTRL_EMI_DIV_EMI_OFFSET		0
201 
202 #define	CLKCTRL_SAIF0_CLKGATE			(1 << 31)
203 #define	CLKCTRL_SAIF0_BUSY			(1 << 29)
204 #define	CLKCTRL_SAIF0_DIV_FRAC_EN		(1 << 16)
205 #define	CLKCTRL_SAIF0_DIV_MASK			0xffff
206 #define	CLKCTRL_SAIF0_DIV_OFFSET		0
207 
208 #define	CLKCTRL_SAIF1_CLKGATE			(1 << 31)
209 #define	CLKCTRL_SAIF1_BUSY			(1 << 29)
210 #define	CLKCTRL_SAIF1_DIV_FRAC_EN		(1 << 16)
211 #define	CLKCTRL_SAIF1_DIV_MASK			0xffff
212 #define	CLKCTRL_SAIF1_DIV_OFFSET		0
213 
214 #define	CLKCTRL_DIS_LCDIF_CLKGATE		(1 << 31)
215 #define	CLKCTRL_DIS_LCDIF_BUSY			(1 << 29)
216 #define	CLKCTRL_DIS_LCDIF_DIV_FRAC_EN		(1 << 13)
217 #define	CLKCTRL_DIS_LCDIF_DIV_MASK		0x1fff
218 #define	CLKCTRL_DIS_LCDIF_DIV_OFFSET		0
219 
220 #define	CLKCTRL_ETM_CLKGATE			(1 << 31)
221 #define	CLKCTRL_ETM_BUSY			(1 << 29)
222 #define	CLKCTRL_ETM_DIV_FRAC_EN			(1 << 7)
223 #define	CLKCTRL_ETM_DIV_MASK			0x7f
224 #define	CLKCTRL_ETM_DIV_OFFSET			0
225 
226 #define	CLKCTRL_ENET_SLEEP			(1 << 31)
227 #define	CLKCTRL_ENET_DISABLE			(1 << 30)
228 #define	CLKCTRL_ENET_STATUS			(1 << 29)
229 #define	CLKCTRL_ENET_BUSY_TIME			(1 << 27)
230 #define	CLKCTRL_ENET_DIV_TIME_MASK		(0x3f << 21)
231 #define	CLKCTRL_ENET_DIV_TIME_OFFSET		21
232 #define	CLKCTRL_ENET_TIME_SEL_MASK		(0x3 << 19)
233 #define	CLKCTRL_ENET_TIME_SEL_OFFSET		19
234 #define	CLKCTRL_ENET_TIME_SEL_XTAL		(0x0 << 19)
235 #define	CLKCTRL_ENET_TIME_SEL_PLL		(0x1 << 19)
236 #define	CLKCTRL_ENET_TIME_SEL_RMII_CLK		(0x2 << 19)
237 #define	CLKCTRL_ENET_TIME_SEL_UNDEFINED		(0x3 << 19)
238 #define	CLKCTRL_ENET_CLK_OUT_EN			(1 << 18)
239 #define	CLKCTRL_ENET_RESET_BY_SW_CHIP		(1 << 17)
240 #define	CLKCTRL_ENET_RESET_BY_SW		(1 << 16)
241 
242 #define	CLKCTRL_HSADC_RESETB			(1 << 30)
243 #define	CLKCTRL_HSADC_FREQDIV_MASK		(0x3 << 28)
244 #define	CLKCTRL_HSADC_FREQDIV_OFFSET		28
245 
246 #define	CLKCTRL_FLEXCAN_STOP_CAN0		(1 << 30)
247 #define	CLKCTRL_FLEXCAN_CAN0_STATUS		(1 << 29)
248 #define	CLKCTRL_FLEXCAN_STOP_CAN1		(1 << 28)
249 #define	CLKCTRL_FLEXCAN_CAN1_STATUS		(1 << 27)
250 
251 #define	CLKCTRL_FRAC_CLKGATE			(1 << 7)
252 #define	CLKCTRL_FRAC_STABLE			(1 << 6)
253 #define	CLKCTRL_FRAC_FRAC_MASK			0x3f
254 #define	CLKCTRL_FRAC_FRAC_OFFSET		0
255 #define	CLKCTRL_FRAC0_CPU			0
256 #define	CLKCTRL_FRAC0_EMI			1
257 #define	CLKCTRL_FRAC0_IO1			2
258 #define	CLKCTRL_FRAC0_IO0			3
259 #define	CLKCTRL_FRAC1_PIX			0
260 #define	CLKCTRL_FRAC1_HSADC			1
261 #define	CLKCTRL_FRAC1_GPMI			2
262 
263 #define	CLKCTRL_CLKSEQ_BYPASS_CPU		(1 << 18)
264 #define	CLKCTRL_CLKSEQ_BYPASS_DIS_LCDIF		(1 << 14)
265 #define	CLKCTRL_CLKSEQ_BYPASS_DIS_LCDIF_BYPASS	(0x1 << 14)
266 #define	CLKCTRL_CLKSEQ_BYPASS_DIS_LCDIF_PFD	(0x0 << 14)
267 #define	CLKCTRL_CLKSEQ_BYPASS_ETM		(1 << 8)
268 #define	CLKCTRL_CLKSEQ_BYPASS_EMI		(1 << 7)
269 #define	CLKCTRL_CLKSEQ_BYPASS_SSP3		(1 << 6)
270 #define	CLKCTRL_CLKSEQ_BYPASS_SSP2		(1 << 5)
271 #define	CLKCTRL_CLKSEQ_BYPASS_SSP1		(1 << 4)
272 #define	CLKCTRL_CLKSEQ_BYPASS_SSP0		(1 << 3)
273 #define	CLKCTRL_CLKSEQ_BYPASS_GPMI		(1 << 2)
274 #define	CLKCTRL_CLKSEQ_BYPASS_SAIF1		(1 << 1)
275 #define	CLKCTRL_CLKSEQ_BYPASS_SAIF0		(1 << 0)
276 
277 #define	CLKCTRL_RESET_WDOG_POR_DISABLE		(1 << 5)
278 #define	CLKCTRL_RESET_EXTERNAL_RESET_ENABLE	(1 << 4)
279 #define	CLKCTRL_RESET_THERMAL_RESET_ENABLE	(1 << 3)
280 #define	CLKCTRL_RESET_THERMAL_RESET_DEFAULT	(1 << 2)
281 #define	CLKCTRL_RESET_CHIP			(1 << 1)
282 #define	CLKCTRL_RESET_DIG			(1 << 0)
283 
284 #define	CLKCTRL_STATUS_CPU_LIMIT_MASK		(0x3 << 30)
285 #define	CLKCTRL_STATUS_CPU_LIMIT_OFFSET		30
286 
287 #define	CLKCTRL_VERSION_MAJOR_MASK		(0xff << 24)
288 #define	CLKCTRL_VERSION_MAJOR_OFFSET		24
289 #define	CLKCTRL_VERSION_MINOR_MASK		(0xff << 16)
290 #define	CLKCTRL_VERSION_MINOR_OFFSET		16
291 #define	CLKCTRL_VERSION_STEP_MASK		0xffff
292 #define	CLKCTRL_VERSION_STEP_OFFSET		0
293 
294 #endif /* __MX28_REGS_CLKCTRL_H__ */
295