diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2009-12-11 04:07:15 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-01-05 04:10:06 -0500 |
commit | 5113f81520278ba17c64031fa01aeafc9a83f9d1 (patch) | |
tree | b166e2df4971781053ac6f9ed67f8937e668795d /arch/arm/mach-mx2/clock_imx21.c | |
parent | f9ffaa9ca9889f17ef30b82bc0bf954d141280f8 (diff) |
imx/mx2: fold crm_regs.h into its only consumer
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Holger Schurig <hs4233@mail.mn-solutions.de>
Cc: Rabin Vincent <rabin@rab.in>
Diffstat (limited to 'arch/arm/mach-mx2/clock_imx21.c')
-rw-r--r-- | arch/arm/mach-mx2/clock_imx21.c | 231 |
1 files changed, 230 insertions, 1 deletions
diff --git a/arch/arm/mach-mx2/clock_imx21.c b/arch/arm/mach-mx2/clock_imx21.c index 91901b5d56c2..df3ad3836576 100644 --- a/arch/arm/mach-mx2/clock_imx21.c +++ b/arch/arm/mach-mx2/clock_imx21.c | |||
@@ -23,11 +23,240 @@ | |||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | 24 | ||
25 | #include <mach/clock.h> | 25 | #include <mach/clock.h> |
26 | #include <mach/hardware.h> | ||
26 | #include <mach/common.h> | 27 | #include <mach/common.h> |
27 | #include <asm/clkdev.h> | 28 | #include <asm/clkdev.h> |
28 | #include <asm/div64.h> | 29 | #include <asm/div64.h> |
29 | 30 | ||
30 | #include "crm_regs.h" | 31 | /* Register offsets */ |
32 | #define CCM_CSCR (IO_ADDRESS(CCM_BASE_ADDR) + 0x0) | ||
33 | #define CCM_MPCTL0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x4) | ||
34 | #define CCM_MPCTL1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x8) | ||
35 | #define CCM_SPCTL0 (IO_ADDRESS(CCM_BASE_ADDR) + 0xC) | ||
36 | #define CCM_SPCTL1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x10) | ||
37 | #define CCM_OSC26MCTL (IO_ADDRESS(CCM_BASE_ADDR) + 0x14) | ||
38 | #define CCM_PCDR0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x18) | ||
39 | #define CCM_PCDR1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x1c) | ||
40 | #define CCM_PCCR0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x20) | ||
41 | #define CCM_PCCR1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x24) | ||
42 | #define CCM_CCSR (IO_ADDRESS(CCM_BASE_ADDR) + 0x28) | ||
43 | #define CCM_PMCTL (IO_ADDRESS(CCM_BASE_ADDR) + 0x2c) | ||
44 | #define CCM_PMCOUNT (IO_ADDRESS(CCM_BASE_ADDR) + 0x30) | ||
45 | #define CCM_WKGDCTL (IO_ADDRESS(CCM_BASE_ADDR) + 0x34) | ||
46 | |||
47 | #define CCM_CSCR_PRESC_OFFSET 29 | ||
48 | #define CCM_CSCR_PRESC_MASK (0x7 << CCM_CSCR_PRESC_OFFSET) | ||
49 | |||
50 | #define CCM_CSCR_USB_OFFSET 26 | ||
51 | #define CCM_CSCR_USB_MASK (0x7 << CCM_CSCR_USB_OFFSET) | ||
52 | #define CCM_CSCR_SD_OFFSET 24 | ||
53 | #define CCM_CSCR_SD_MASK (0x3 << CCM_CSCR_SD_OFFSET) | ||
54 | #define CCM_CSCR_SPLLRES (1 << 22) | ||
55 | #define CCM_CSCR_MPLLRES (1 << 21) | ||
56 | #define CCM_CSCR_SSI2_OFFSET 20 | ||
57 | #define CCM_CSCR_SSI2 (1 << CCM_CSCR_SSI2_OFFSET) | ||
58 | #define CCM_CSCR_SSI1_OFFSET 19 | ||
59 | #define CCM_CSCR_SSI1 (1 << CCM_CSCR_SSI1_OFFSET) | ||
60 | #define CCM_CSCR_FIR_OFFSET 18 | ||
61 | #define CCM_CSCR_FIR (1 << CCM_CSCR_FIR_OFFSET) | ||
62 | #define CCM_CSCR_SP (1 << 17) | ||
63 | #define CCM_CSCR_MCU (1 << 16) | ||
64 | #define CCM_CSCR_BCLK_OFFSET 10 | ||
65 | #define CCM_CSCR_BCLK_MASK (0xf << CCM_CSCR_BCLK_OFFSET) | ||
66 | #define CCM_CSCR_IPDIV_OFFSET 9 | ||
67 | #define CCM_CSCR_IPDIV (1 << CCM_CSCR_IPDIV_OFFSET) | ||
68 | |||
69 | #define CCM_CSCR_OSC26MDIV (1 << 4) | ||
70 | #define CCM_CSCR_OSC26M (1 << 3) | ||
71 | #define CCM_CSCR_FPM (1 << 2) | ||
72 | #define CCM_CSCR_SPEN (1 << 1) | ||
73 | #define CCM_CSCR_MPEN 1 | ||
74 | |||
75 | #define CCM_MPCTL0_CPLM (1 << 31) | ||
76 | #define CCM_MPCTL0_PD_OFFSET 26 | ||
77 | #define CCM_MPCTL0_PD_MASK (0xf << 26) | ||
78 | #define CCM_MPCTL0_MFD_OFFSET 16 | ||
79 | #define CCM_MPCTL0_MFD_MASK (0x3ff << 16) | ||
80 | #define CCM_MPCTL0_MFI_OFFSET 10 | ||
81 | #define CCM_MPCTL0_MFI_MASK (0xf << 10) | ||
82 | #define CCM_MPCTL0_MFN_OFFSET 0 | ||
83 | #define CCM_MPCTL0_MFN_MASK 0x3ff | ||
84 | |||
85 | #define CCM_MPCTL1_LF (1 << 15) | ||
86 | #define CCM_MPCTL1_BRMO (1 << 6) | ||
87 | |||
88 | #define CCM_SPCTL0_CPLM (1 << 31) | ||
89 | #define CCM_SPCTL0_PD_OFFSET 26 | ||
90 | #define CCM_SPCTL0_PD_MASK (0xf << 26) | ||
91 | #define CCM_SPCTL0_MFD_OFFSET 16 | ||
92 | #define CCM_SPCTL0_MFD_MASK (0x3ff << 16) | ||
93 | #define CCM_SPCTL0_MFI_OFFSET 10 | ||
94 | #define CCM_SPCTL0_MFI_MASK (0xf << 10) | ||
95 | #define CCM_SPCTL0_MFN_OFFSET 0 | ||
96 | #define CCM_SPCTL0_MFN_MASK 0x3ff | ||
97 | |||
98 | #define CCM_SPCTL1_LF (1 << 15) | ||
99 | #define CCM_SPCTL1_BRMO (1 << 6) | ||
100 | |||
101 | #define CCM_OSC26MCTL_PEAK_OFFSET 16 | ||
102 | #define CCM_OSC26MCTL_PEAK_MASK (0x3 << 16) | ||
103 | #define CCM_OSC26MCTL_AGC_OFFSET 8 | ||
104 | #define CCM_OSC26MCTL_AGC_MASK (0x3f << 8) | ||
105 | #define CCM_OSC26MCTL_ANATEST_OFFSET 0 | ||
106 | #define CCM_OSC26MCTL_ANATEST_MASK 0x3f | ||
107 | |||
108 | #define CCM_PCDR0_SSI2BAUDDIV_OFFSET 26 | ||
109 | #define CCM_PCDR0_SSI2BAUDDIV_MASK (0x3f << 26) | ||
110 | #define CCM_PCDR0_SSI1BAUDDIV_OFFSET 16 | ||
111 | #define CCM_PCDR0_SSI1BAUDDIV_MASK (0x3f << 16) | ||
112 | #define CCM_PCDR0_NFCDIV_OFFSET 12 | ||
113 | #define CCM_PCDR0_NFCDIV_MASK (0xf << 12) | ||
114 | #define CCM_PCDR0_48MDIV_OFFSET 5 | ||
115 | #define CCM_PCDR0_48MDIV_MASK (0x7 << CCM_PCDR0_48MDIV_OFFSET) | ||
116 | #define CCM_PCDR0_FIRIDIV_OFFSET 0 | ||
117 | #define CCM_PCDR0_FIRIDIV_MASK 0x1f | ||
118 | #define CCM_PCDR1_PERDIV4_OFFSET 24 | ||
119 | #define CCM_PCDR1_PERDIV4_MASK (0x3f << 24) | ||
120 | #define CCM_PCDR1_PERDIV3_OFFSET 16 | ||
121 | #define CCM_PCDR1_PERDIV3_MASK (0x3f << 16) | ||
122 | #define CCM_PCDR1_PERDIV2_OFFSET 8 | ||
123 | #define CCM_PCDR1_PERDIV2_MASK (0x3f << 8) | ||
124 | #define CCM_PCDR1_PERDIV1_OFFSET 0 | ||
125 | #define CCM_PCDR1_PERDIV1_MASK 0x3f | ||
126 | |||
127 | #define CCM_PCCR_HCLK_CSI_OFFSET 31 | ||
128 | #define CCM_PCCR_HCLK_CSI_REG CCM_PCCR0 | ||
129 | #define CCM_PCCR_HCLK_DMA_OFFSET 30 | ||
130 | #define CCM_PCCR_HCLK_DMA_REG CCM_PCCR0 | ||
131 | #define CCM_PCCR_HCLK_BROM_OFFSET 28 | ||
132 | #define CCM_PCCR_HCLK_BROM_REG CCM_PCCR0 | ||
133 | #define CCM_PCCR_HCLK_EMMA_OFFSET 27 | ||
134 | #define CCM_PCCR_HCLK_EMMA_REG CCM_PCCR0 | ||
135 | #define CCM_PCCR_HCLK_LCDC_OFFSET 26 | ||
136 | #define CCM_PCCR_HCLK_LCDC_REG CCM_PCCR0 | ||
137 | #define CCM_PCCR_HCLK_SLCDC_OFFSET 25 | ||
138 | #define CCM_PCCR_HCLK_SLCDC_REG CCM_PCCR0 | ||
139 | #define CCM_PCCR_HCLK_USBOTG_OFFSET 24 | ||
140 | #define CCM_PCCR_HCLK_USBOTG_REG CCM_PCCR0 | ||
141 | #define CCM_PCCR_HCLK_BMI_OFFSET 23 | ||
142 | #define CCM_PCCR_BMI_MASK (1 << CCM_PCCR_BMI_MASK) | ||
143 | #define CCM_PCCR_HCLK_BMI_REG CCM_PCCR0 | ||
144 | #define CCM_PCCR_PERCLK4_OFFSET 22 | ||
145 | #define CCM_PCCR_PERCLK4_REG CCM_PCCR0 | ||
146 | #define CCM_PCCR_SLCDC_OFFSET 21 | ||
147 | #define CCM_PCCR_SLCDC_REG CCM_PCCR0 | ||
148 | #define CCM_PCCR_FIRI_BAUD_OFFSET 20 | ||
149 | #define CCM_PCCR_FIRI_BAUD_MASK (1 << CCM_PCCR_FIRI_BAUD_MASK) | ||
150 | #define CCM_PCCR_FIRI_BAUD_REG CCM_PCCR0 | ||
151 | #define CCM_PCCR_NFC_OFFSET 19 | ||
152 | #define CCM_PCCR_NFC_REG CCM_PCCR0 | ||
153 | #define CCM_PCCR_LCDC_OFFSET 18 | ||
154 | #define CCM_PCCR_LCDC_REG CCM_PCCR0 | ||
155 | #define CCM_PCCR_SSI1_BAUD_OFFSET 17 | ||
156 | #define CCM_PCCR_SSI1_BAUD_REG CCM_PCCR0 | ||
157 | #define CCM_PCCR_SSI2_BAUD_OFFSET 16 | ||
158 | #define CCM_PCCR_SSI2_BAUD_REG CCM_PCCR0 | ||
159 | #define CCM_PCCR_EMMA_OFFSET 15 | ||
160 | #define CCM_PCCR_EMMA_REG CCM_PCCR0 | ||
161 | #define CCM_PCCR_USBOTG_OFFSET 14 | ||
162 | #define CCM_PCCR_USBOTG_REG CCM_PCCR0 | ||
163 | #define CCM_PCCR_DMA_OFFSET 13 | ||
164 | #define CCM_PCCR_DMA_REG CCM_PCCR0 | ||
165 | #define CCM_PCCR_I2C1_OFFSET 12 | ||
166 | #define CCM_PCCR_I2C1_REG CCM_PCCR0 | ||
167 | #define CCM_PCCR_GPIO_OFFSET 11 | ||
168 | #define CCM_PCCR_GPIO_REG CCM_PCCR0 | ||
169 | #define CCM_PCCR_SDHC2_OFFSET 10 | ||
170 | #define CCM_PCCR_SDHC2_REG CCM_PCCR0 | ||
171 | #define CCM_PCCR_SDHC1_OFFSET 9 | ||
172 | #define CCM_PCCR_SDHC1_REG CCM_PCCR0 | ||
173 | #define CCM_PCCR_FIRI_OFFSET 8 | ||
174 | #define CCM_PCCR_FIRI_MASK (1 << CCM_PCCR_BAUD_MASK) | ||
175 | #define CCM_PCCR_FIRI_REG CCM_PCCR0 | ||
176 | #define CCM_PCCR_SSI2_IPG_OFFSET 7 | ||
177 | #define CCM_PCCR_SSI2_REG CCM_PCCR0 | ||
178 | #define CCM_PCCR_SSI1_IPG_OFFSET 6 | ||
179 | #define CCM_PCCR_SSI1_REG CCM_PCCR0 | ||
180 | #define CCM_PCCR_CSPI2_OFFSET 5 | ||
181 | #define CCM_PCCR_CSPI2_REG CCM_PCCR0 | ||
182 | #define CCM_PCCR_CSPI1_OFFSET 4 | ||
183 | #define CCM_PCCR_CSPI1_REG CCM_PCCR0 | ||
184 | #define CCM_PCCR_UART4_OFFSET 3 | ||
185 | #define CCM_PCCR_UART4_REG CCM_PCCR0 | ||
186 | #define CCM_PCCR_UART3_OFFSET 2 | ||
187 | #define CCM_PCCR_UART3_REG CCM_PCCR0 | ||
188 | #define CCM_PCCR_UART2_OFFSET 1 | ||
189 | #define CCM_PCCR_UART2_REG CCM_PCCR0 | ||
190 | #define CCM_PCCR_UART1_OFFSET 0 | ||
191 | #define CCM_PCCR_UART1_REG CCM_PCCR0 | ||
192 | |||
193 | #define CCM_PCCR_OWIRE_OFFSET 31 | ||
194 | #define CCM_PCCR_OWIRE_REG CCM_PCCR1 | ||
195 | #define CCM_PCCR_KPP_OFFSET 30 | ||
196 | #define CCM_PCCR_KPP_REG CCM_PCCR1 | ||
197 | #define CCM_PCCR_RTC_OFFSET 29 | ||
198 | #define CCM_PCCR_RTC_REG CCM_PCCR1 | ||
199 | #define CCM_PCCR_PWM_OFFSET 28 | ||
200 | #define CCM_PCCR_PWM_REG CCM_PCCR1 | ||
201 | #define CCM_PCCR_GPT3_OFFSET 27 | ||
202 | #define CCM_PCCR_GPT3_REG CCM_PCCR1 | ||
203 | #define CCM_PCCR_GPT2_OFFSET 26 | ||
204 | #define CCM_PCCR_GPT2_REG CCM_PCCR1 | ||
205 | #define CCM_PCCR_GPT1_OFFSET 25 | ||
206 | #define CCM_PCCR_GPT1_REG CCM_PCCR1 | ||
207 | #define CCM_PCCR_WDT_OFFSET 24 | ||
208 | #define CCM_PCCR_WDT_REG CCM_PCCR1 | ||
209 | #define CCM_PCCR_CSPI3_OFFSET 23 | ||
210 | #define CCM_PCCR_CSPI3_REG CCM_PCCR1 | ||
211 | |||
212 | #define CCM_PCCR_CSPI1_MASK (1 << CCM_PCCR_CSPI1_OFFSET) | ||
213 | #define CCM_PCCR_CSPI2_MASK (1 << CCM_PCCR_CSPI2_OFFSET) | ||
214 | #define CCM_PCCR_CSPI3_MASK (1 << CCM_PCCR_CSPI3_OFFSET) | ||
215 | #define CCM_PCCR_DMA_MASK (1 << CCM_PCCR_DMA_OFFSET) | ||
216 | #define CCM_PCCR_EMMA_MASK (1 << CCM_PCCR_EMMA_OFFSET) | ||
217 | #define CCM_PCCR_GPIO_MASK (1 << CCM_PCCR_GPIO_OFFSET) | ||
218 | #define CCM_PCCR_GPT1_MASK (1 << CCM_PCCR_GPT1_OFFSET) | ||
219 | #define CCM_PCCR_GPT2_MASK (1 << CCM_PCCR_GPT2_OFFSET) | ||
220 | #define CCM_PCCR_GPT3_MASK (1 << CCM_PCCR_GPT3_OFFSET) | ||
221 | #define CCM_PCCR_HCLK_BROM_MASK (1 << CCM_PCCR_HCLK_BROM_OFFSET) | ||
222 | #define CCM_PCCR_HCLK_CSI_MASK (1 << CCM_PCCR_HCLK_CSI_OFFSET) | ||
223 | #define CCM_PCCR_HCLK_DMA_MASK (1 << CCM_PCCR_HCLK_DMA_OFFSET) | ||
224 | #define CCM_PCCR_HCLK_EMMA_MASK (1 << CCM_PCCR_HCLK_EMMA_OFFSET) | ||
225 | #define CCM_PCCR_HCLK_LCDC_MASK (1 << CCM_PCCR_HCLK_LCDC_OFFSET) | ||
226 | #define CCM_PCCR_HCLK_SLCDC_MASK (1 << CCM_PCCR_HCLK_SLCDC_OFFSET) | ||
227 | #define CCM_PCCR_HCLK_USBOTG_MASK (1 << CCM_PCCR_HCLK_USBOTG_OFFSET) | ||
228 | #define CCM_PCCR_I2C1_MASK (1 << CCM_PCCR_I2C1_OFFSET) | ||
229 | #define CCM_PCCR_KPP_MASK (1 << CCM_PCCR_KPP_OFFSET) | ||
230 | #define CCM_PCCR_LCDC_MASK (1 << CCM_PCCR_LCDC_OFFSET) | ||
231 | #define CCM_PCCR_NFC_MASK (1 << CCM_PCCR_NFC_OFFSET) | ||
232 | #define CCM_PCCR_OWIRE_MASK (1 << CCM_PCCR_OWIRE_OFFSET) | ||
233 | #define CCM_PCCR_PERCLK4_MASK (1 << CCM_PCCR_PERCLK4_OFFSET) | ||
234 | #define CCM_PCCR_PWM_MASK (1 << CCM_PCCR_PWM_OFFSET) | ||
235 | #define CCM_PCCR_RTC_MASK (1 << CCM_PCCR_RTC_OFFSET) | ||
236 | #define CCM_PCCR_SDHC1_MASK (1 << CCM_PCCR_SDHC1_OFFSET) | ||
237 | #define CCM_PCCR_SDHC2_MASK (1 << CCM_PCCR_SDHC2_OFFSET) | ||
238 | #define CCM_PCCR_SLCDC_MASK (1 << CCM_PCCR_SLCDC_OFFSET) | ||
239 | #define CCM_PCCR_SSI1_BAUD_MASK (1 << CCM_PCCR_SSI1_BAUD_OFFSET) | ||
240 | #define CCM_PCCR_SSI1_IPG_MASK (1 << CCM_PCCR_SSI1_IPG_OFFSET) | ||
241 | #define CCM_PCCR_SSI2_BAUD_MASK (1 << CCM_PCCR_SSI2_BAUD_OFFSET) | ||
242 | #define CCM_PCCR_SSI2_IPG_MASK (1 << CCM_PCCR_SSI2_IPG_OFFSET) | ||
243 | #define CCM_PCCR_UART1_MASK (1 << CCM_PCCR_UART1_OFFSET) | ||
244 | #define CCM_PCCR_UART2_MASK (1 << CCM_PCCR_UART2_OFFSET) | ||
245 | #define CCM_PCCR_UART3_MASK (1 << CCM_PCCR_UART3_OFFSET) | ||
246 | #define CCM_PCCR_UART4_MASK (1 << CCM_PCCR_UART4_OFFSET) | ||
247 | #define CCM_PCCR_USBOTG_MASK (1 << CCM_PCCR_USBOTG_OFFSET) | ||
248 | #define CCM_PCCR_WDT_MASK (1 << CCM_PCCR_WDT_OFFSET) | ||
249 | |||
250 | #define CCM_CCSR_32KSR (1 << 15) | ||
251 | |||
252 | #define CCM_CCSR_CLKMODE1 (1 << 9) | ||
253 | #define CCM_CCSR_CLKMODE0 (1 << 8) | ||
254 | |||
255 | #define CCM_CCSR_CLKOSEL_OFFSET 0 | ||
256 | #define CCM_CCSR_CLKOSEL_MASK 0x1f | ||
257 | |||
258 | #define SYS_FMCR 0x14 /* Functional Muxing Control Reg */ | ||
259 | #define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */ | ||
31 | 260 | ||
32 | static int _clk_enable(struct clk *clk) | 261 | static int _clk_enable(struct clk *clk) |
33 | { | 262 | { |