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