diff options
Diffstat (limited to 'arch/arm/mach-omap2')
30 files changed, 10283 insertions, 4156 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index b05b738d31e6..2feb6870b735 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -3,13 +3,15 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := irq.o id.o io.o sram-fn.o memory.o prcm.o clock.o mux.o devices.o \ | 6 | obj-y := irq.o id.o io.o sram-fn.o memory.o control.o prcm.o clock.o mux.o \ |
7 | serial.o gpmc.o | 7 | devices.o serial.o gpmc.o timer-gp.o |
8 | |||
9 | obj-$(CONFIG_OMAP_MPU_TIMER) += timer-gp.o | ||
10 | 8 | ||
11 | # Power Management | 9 | # Power Management |
12 | obj-$(CONFIG_PM) += pm.o pm-domain.o sleep.o | 10 | obj-$(CONFIG_PM) += pm.o sleep.o |
11 | |||
12 | # Clock framework | ||
13 | obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o | ||
14 | obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o | ||
13 | 15 | ||
14 | # Specific board support | 16 | # Specific board support |
15 | obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o | 17 | obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o |
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 64235dee5614..1c12d7c6c7fc 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <asm/arch/board.h> | 33 | #include <asm/arch/board.h> |
34 | #include <asm/arch/common.h> | 34 | #include <asm/arch/common.h> |
35 | #include <asm/arch/gpmc.h> | 35 | #include <asm/arch/gpmc.h> |
36 | #include "prcm-regs.h" | ||
37 | 36 | ||
38 | #include <asm/io.h> | 37 | #include <asm/io.h> |
39 | 38 | ||
@@ -125,15 +124,18 @@ static inline void __init sdp2430_init_smc91x(void) | |||
125 | int eth_cs; | 124 | int eth_cs; |
126 | unsigned long cs_mem_base; | 125 | unsigned long cs_mem_base; |
127 | unsigned int rate; | 126 | unsigned int rate; |
128 | struct clk *l3ck; | 127 | struct clk *gpmc_fck; |
129 | 128 | ||
130 | eth_cs = SDP2430_SMC91X_CS; | 129 | eth_cs = SDP2430_SMC91X_CS; |
131 | 130 | ||
132 | l3ck = clk_get(NULL, "core_l3_ck"); | 131 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ |
133 | if (IS_ERR(l3ck)) | 132 | if (IS_ERR(gpmc_fck)) { |
134 | rate = 100000000; | 133 | WARN_ON(1); |
135 | else | 134 | return; |
136 | rate = clk_get_rate(l3ck); | 135 | } |
136 | |||
137 | clk_enable(gpmc_fck); | ||
138 | rate = clk_get_rate(gpmc_fck); | ||
137 | 139 | ||
138 | /* Make sure CS1 timings are correct, for 2430 always muxed */ | 140 | /* Make sure CS1 timings are correct, for 2430 always muxed */ |
139 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); | 141 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); |
@@ -160,7 +162,7 @@ static inline void __init sdp2430_init_smc91x(void) | |||
160 | 162 | ||
161 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | 163 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { |
162 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | 164 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); |
163 | return; | 165 | goto out; |
164 | } | 166 | } |
165 | 167 | ||
166 | sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300; | 168 | sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300; |
@@ -171,10 +173,13 @@ static inline void __init sdp2430_init_smc91x(void) | |||
171 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 173 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", |
172 | OMAP24XX_ETHR_GPIO_IRQ); | 174 | OMAP24XX_ETHR_GPIO_IRQ); |
173 | gpmc_cs_free(eth_cs); | 175 | gpmc_cs_free(eth_cs); |
174 | return; | 176 | goto out; |
175 | } | 177 | } |
176 | omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1); | 178 | omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1); |
177 | 179 | ||
180 | out: | ||
181 | clk_disable(gpmc_fck); | ||
182 | clk_put(gpmc_fck); | ||
178 | } | 183 | } |
179 | 184 | ||
180 | static void __init omap_2430sdp_init_irq(void) | 185 | static void __init omap_2430sdp_init_irq(void) |
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index 7846551f0575..a1e1e6765b5b 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/leds.h> | 28 | #include <linux/leds.h> |
29 | #include <linux/err.h> | ||
30 | #include <linux/clk.h> | ||
29 | 31 | ||
30 | #include <asm/hardware.h> | 32 | #include <asm/hardware.h> |
31 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
@@ -39,7 +41,7 @@ | |||
39 | #include <asm/arch/board.h> | 41 | #include <asm/arch/board.h> |
40 | #include <asm/arch/common.h> | 42 | #include <asm/arch/common.h> |
41 | #include <asm/arch/gpmc.h> | 43 | #include <asm/arch/gpmc.h> |
42 | #include "prcm-regs.h" | 44 | #include <asm/arch/control.h> |
43 | 45 | ||
44 | /* LED & Switch macros */ | 46 | /* LED & Switch macros */ |
45 | #define LED0_GPIO13 13 | 47 | #define LED0_GPIO13 13 |
@@ -187,17 +189,47 @@ static inline void __init apollon_init_smc91x(void) | |||
187 | { | 189 | { |
188 | unsigned long base; | 190 | unsigned long base; |
189 | 191 | ||
192 | unsigned int rate; | ||
193 | struct clk *gpmc_fck; | ||
194 | int eth_cs; | ||
195 | |||
196 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | ||
197 | if (IS_ERR(gpmc_fck)) { | ||
198 | WARN_ON(1); | ||
199 | return; | ||
200 | } | ||
201 | |||
202 | clk_enable(gpmc_fck); | ||
203 | rate = clk_get_rate(gpmc_fck); | ||
204 | |||
205 | eth_cs = APOLLON_ETH_CS; | ||
206 | |||
190 | /* Make sure CS1 timings are correct */ | 207 | /* Make sure CS1 timings are correct */ |
191 | GPMC_CONFIG1_1 = 0x00011203; | 208 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); |
192 | GPMC_CONFIG2_1 = 0x001f1f01; | 209 | |
193 | GPMC_CONFIG3_1 = 0x00080803; | 210 | if (rate >= 160000000) { |
194 | GPMC_CONFIG4_1 = 0x1c091c09; | 211 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); |
195 | GPMC_CONFIG5_1 = 0x041f1f1f; | 212 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); |
196 | GPMC_CONFIG6_1 = 0x000004c4; | 213 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); |
214 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
215 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
216 | } else if (rate >= 130000000) { | ||
217 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
218 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
219 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
220 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
221 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
222 | } else {/* rate = 100000000 */ | ||
223 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
224 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
225 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
226 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
227 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
228 | } | ||
197 | 229 | ||
198 | if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { | 230 | if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { |
199 | printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); | 231 | printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); |
200 | return; | 232 | goto out; |
201 | } | 233 | } |
202 | apollon_smc91x_resources[0].start = base + 0x300; | 234 | apollon_smc91x_resources[0].start = base + 0x300; |
203 | apollon_smc91x_resources[0].end = base + 0x30f; | 235 | apollon_smc91x_resources[0].end = base + 0x30f; |
@@ -208,9 +240,13 @@ static inline void __init apollon_init_smc91x(void) | |||
208 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 240 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", |
209 | APOLLON_ETHR_GPIO_IRQ); | 241 | APOLLON_ETHR_GPIO_IRQ); |
210 | gpmc_cs_free(APOLLON_ETH_CS); | 242 | gpmc_cs_free(APOLLON_ETH_CS); |
211 | return; | 243 | goto out; |
212 | } | 244 | } |
213 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); | 245 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); |
246 | |||
247 | out: | ||
248 | clk_disable(gpmc_fck); | ||
249 | clk_put(gpmc_fck); | ||
214 | } | 250 | } |
215 | 251 | ||
216 | static void __init omap_apollon_init_irq(void) | 252 | static void __init omap_apollon_init_irq(void) |
@@ -330,6 +366,8 @@ static void __init apollon_usb_init(void) | |||
330 | 366 | ||
331 | static void __init omap_apollon_init(void) | 367 | static void __init omap_apollon_init(void) |
332 | { | 368 | { |
369 | u32 v; | ||
370 | |||
333 | apollon_led_init(); | 371 | apollon_led_init(); |
334 | apollon_sw_init(); | 372 | apollon_sw_init(); |
335 | apollon_flash_init(); | 373 | apollon_flash_init(); |
@@ -339,7 +377,9 @@ static void __init omap_apollon_init(void) | |||
339 | omap_cfg_reg(W19_24XX_SYS_NIRQ); | 377 | omap_cfg_reg(W19_24XX_SYS_NIRQ); |
340 | 378 | ||
341 | /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */ | 379 | /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */ |
342 | CONTROL_DEVCONF |= (1 << 24); | 380 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
381 | v |= (1 << 24); | ||
382 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
343 | 383 | ||
344 | /* | 384 | /* |
345 | * Make sure the serial ports are muxed on at this point. | 385 | * Make sure the serial ports are muxed on at this point. |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index f125f432cc3e..d1915f99a5fa 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/workqueue.h> | 20 | #include <linux/workqueue.h> |
21 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/err.h> | ||
23 | #include <linux/clk.h> | ||
22 | 24 | ||
23 | #include <asm/hardware.h> | 25 | #include <asm/hardware.h> |
24 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
@@ -26,6 +28,7 @@ | |||
26 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
27 | #include <asm/mach/flash.h> | 29 | #include <asm/mach/flash.h> |
28 | 30 | ||
31 | #include <asm/arch/control.h> | ||
29 | #include <asm/arch/gpio.h> | 32 | #include <asm/arch/gpio.h> |
30 | #include <asm/arch/gpioexpander.h> | 33 | #include <asm/arch/gpioexpander.h> |
31 | #include <asm/arch/mux.h> | 34 | #include <asm/arch/mux.h> |
@@ -36,10 +39,13 @@ | |||
36 | #include <asm/arch/keypad.h> | 39 | #include <asm/arch/keypad.h> |
37 | #include <asm/arch/menelaus.h> | 40 | #include <asm/arch/menelaus.h> |
38 | #include <asm/arch/dma.h> | 41 | #include <asm/arch/dma.h> |
39 | #include "prcm-regs.h" | 42 | #include <asm/arch/gpmc.h> |
40 | 43 | ||
41 | #include <asm/io.h> | 44 | #include <asm/io.h> |
42 | 45 | ||
46 | #define H4_FLASH_CS 0 | ||
47 | #define H4_SMC91X_CS 1 | ||
48 | |||
43 | static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; | 49 | static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; |
44 | static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; | 50 | static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; |
45 | 51 | ||
@@ -116,8 +122,6 @@ static struct flash_platform_data h4_flash_data = { | |||
116 | }; | 122 | }; |
117 | 123 | ||
118 | static struct resource h4_flash_resource = { | 124 | static struct resource h4_flash_resource = { |
119 | .start = H4_CS0_BASE, | ||
120 | .end = H4_CS0_BASE + SZ_64M - 1, | ||
121 | .flags = IORESOURCE_MEM, | 125 | .flags = IORESOURCE_MEM, |
122 | }; | 126 | }; |
123 | 127 | ||
@@ -253,21 +257,107 @@ static struct platform_device *h4_devices[] __initdata = { | |||
253 | &h4_lcd_device, | 257 | &h4_lcd_device, |
254 | }; | 258 | }; |
255 | 259 | ||
260 | /* 2420 Sysboot setup (2430 is different) */ | ||
261 | static u32 get_sysboot_value(void) | ||
262 | { | ||
263 | return (omap_ctrl_readl(OMAP24XX_CONTROL_STATUS) & | ||
264 | (OMAP2_SYSBOOT_5_MASK | OMAP2_SYSBOOT_4_MASK | | ||
265 | OMAP2_SYSBOOT_3_MASK | OMAP2_SYSBOOT_2_MASK | | ||
266 | OMAP2_SYSBOOT_1_MASK | OMAP2_SYSBOOT_0_MASK)); | ||
267 | } | ||
268 | |||
269 | /* H4-2420's always used muxed mode, H4-2422's always use non-muxed | ||
270 | * | ||
271 | * Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423 | ||
272 | * correctly. The macro needs to look at production_id not just hawkeye. | ||
273 | */ | ||
274 | static u32 is_gpmc_muxed(void) | ||
275 | { | ||
276 | u32 mux; | ||
277 | mux = get_sysboot_value(); | ||
278 | if ((mux & 0xF) == 0xd) | ||
279 | return 1; /* NAND config (could be either) */ | ||
280 | if (mux & 0x2) /* if mux'ed */ | ||
281 | return 1; | ||
282 | else | ||
283 | return 0; | ||
284 | } | ||
285 | |||
256 | static inline void __init h4_init_debug(void) | 286 | static inline void __init h4_init_debug(void) |
257 | { | 287 | { |
288 | int eth_cs; | ||
289 | unsigned long cs_mem_base; | ||
290 | unsigned int muxed, rate; | ||
291 | struct clk *gpmc_fck; | ||
292 | |||
293 | eth_cs = H4_SMC91X_CS; | ||
294 | |||
295 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | ||
296 | if (IS_ERR(gpmc_fck)) { | ||
297 | WARN_ON(1); | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | clk_enable(gpmc_fck); | ||
302 | rate = clk_get_rate(gpmc_fck); | ||
303 | clk_disable(gpmc_fck); | ||
304 | clk_put(gpmc_fck); | ||
305 | |||
306 | if (is_gpmc_muxed()) | ||
307 | muxed = 0x200; | ||
308 | else | ||
309 | muxed = 0; | ||
310 | |||
258 | /* Make sure CS1 timings are correct */ | 311 | /* Make sure CS1 timings are correct */ |
259 | GPMC_CONFIG1_1 = 0x00011200; | 312 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, |
260 | GPMC_CONFIG2_1 = 0x001f1f01; | 313 | 0x00011000 | muxed); |
261 | GPMC_CONFIG3_1 = 0x00080803; | 314 | |
262 | GPMC_CONFIG4_1 = 0x1c091c09; | 315 | if (rate >= 160000000) { |
263 | GPMC_CONFIG5_1 = 0x041f1f1f; | 316 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); |
264 | GPMC_CONFIG6_1 = 0x000004c4; | 317 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); |
265 | GPMC_CONFIG7_1 = 0x00000f40 | (0x08000000 >> 24); | 318 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); |
319 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
320 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
321 | } else if (rate >= 130000000) { | ||
322 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
323 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
324 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
325 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
326 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
327 | } else {/* rate = 100000000 */ | ||
328 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
329 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
330 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
331 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
332 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
333 | } | ||
334 | |||
335 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
336 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
337 | goto out; | ||
338 | } | ||
339 | |||
266 | udelay(100); | 340 | udelay(100); |
267 | 341 | ||
268 | omap_cfg_reg(M15_24XX_GPIO92); | 342 | omap_cfg_reg(M15_24XX_GPIO92); |
269 | if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0) | 343 | if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0) |
270 | gpmc_cs_free(eth_cs); | 344 | gpmc_cs_free(eth_cs); |
345 | |||
346 | out: | ||
347 | clk_disable(gpmc_fck); | ||
348 | clk_put(gpmc_fck); | ||
349 | } | ||
350 | |||
351 | static void __init h4_init_flash(void) | ||
352 | { | ||
353 | unsigned long base; | ||
354 | |||
355 | if (gpmc_cs_request(H4_FLASH_CS, SZ_64M, &base) < 0) { | ||
356 | printk("Can't request GPMC CS for flash\n"); | ||
357 | return; | ||
358 | } | ||
359 | h4_flash_resource.start = base; | ||
360 | h4_flash_resource.end = base + SZ_64M - 1; | ||
271 | } | 361 | } |
272 | 362 | ||
273 | static void __init omap_h4_init_irq(void) | 363 | static void __init omap_h4_init_irq(void) |
@@ -275,6 +365,7 @@ static void __init omap_h4_init_irq(void) | |||
275 | omap2_init_common_hw(); | 365 | omap2_init_common_hw(); |
276 | omap_init_irq(); | 366 | omap_init_irq(); |
277 | omap_gpio_init(); | 367 | omap_gpio_init(); |
368 | h4_init_flash(); | ||
278 | } | 369 | } |
279 | 370 | ||
280 | static struct omap_uart_config h4_uart_config __initdata = { | 371 | static struct omap_uart_config h4_uart_config __initdata = { |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index e6e85b7b097b..b57ffb5a22a5 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -1,20 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-omap2/clock.c | 2 | * linux/arch/arm/mach-omap2/clock.c |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Texas Instruments Inc. | 4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. |
5 | * Richard Woodruff <r-woodruff2@ti.com> | 5 | * Copyright (C) 2004-2008 Nokia Corporation |
6 | * Created for OMAP2. | ||
7 | * | ||
8 | * Cleaned up and modified to use omap shared clock framework by | ||
9 | * Tony Lindgren <tony@atomide.com> | ||
10 | * | 6 | * |
11 | * Based on omap1 clock.c, Copyright (C) 2004 - 2005 Nokia corporation | 7 | * Contacts: |
12 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | 8 | * Richard Woodruff <r-woodruff2@ti.com> |
9 | * Paul Walmsley | ||
13 | * | 10 | * |
14 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
16 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
17 | */ | 14 | */ |
15 | #undef DEBUG | ||
16 | |||
18 | #include <linux/module.h> | 17 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
20 | #include <linux/device.h> | 19 | #include <linux/device.h> |
@@ -22,176 +21,227 @@ | |||
22 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
23 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
24 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <asm/bitops.h> | ||
25 | 25 | ||
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | 27 | ||
28 | #include <asm/arch/clock.h> | 28 | #include <asm/arch/clock.h> |
29 | #include <asm/arch/sram.h> | 29 | #include <asm/arch/sram.h> |
30 | #include <asm/arch/cpu.h> | ||
30 | #include <asm/div64.h> | 31 | #include <asm/div64.h> |
31 | 32 | ||
32 | #include "prcm-regs.h" | ||
33 | #include "memory.h" | 33 | #include "memory.h" |
34 | #include "sdrc.h" | ||
34 | #include "clock.h" | 35 | #include "clock.h" |
36 | #include "prm.h" | ||
37 | #include "prm-regbits-24xx.h" | ||
38 | #include "cm.h" | ||
39 | #include "cm-regbits-24xx.h" | ||
40 | #include "cm-regbits-34xx.h" | ||
35 | 41 | ||
36 | #undef DEBUG | 42 | #define MAX_CLOCK_ENABLE_WAIT 100000 |
37 | |||
38 | //#define DOWN_VARIABLE_DPLL 1 /* Experimental */ | ||
39 | 43 | ||
40 | static struct prcm_config *curr_prcm_set; | 44 | u8 cpu_mask; |
41 | static u32 curr_perf_level = PRCM_FULL_SPEED; | ||
42 | static struct clk *vclk; | ||
43 | static struct clk *sclk; | ||
44 | 45 | ||
45 | /*------------------------------------------------------------------------- | 46 | /*------------------------------------------------------------------------- |
46 | * Omap2 specific clock functions | 47 | * Omap2 specific clock functions |
47 | *-------------------------------------------------------------------------*/ | 48 | *-------------------------------------------------------------------------*/ |
48 | 49 | ||
49 | /* Recalculate SYST_CLK */ | 50 | /** |
50 | static void omap2_sys_clk_recalc(struct clk * clk) | 51 | * omap2_init_clksel_parent - set a clksel clk's parent field from the hardware |
52 | * @clk: OMAP clock struct ptr to use | ||
53 | * | ||
54 | * Given a pointer to a source-selectable struct clk, read the hardware | ||
55 | * register and determine what its parent is currently set to. Update the | ||
56 | * clk->parent field with the appropriate clk ptr. | ||
57 | */ | ||
58 | void omap2_init_clksel_parent(struct clk *clk) | ||
51 | { | 59 | { |
52 | u32 div = PRCM_CLKSRC_CTRL; | 60 | const struct clksel *clks; |
53 | div &= (1 << 7) | (1 << 6); /* Test if ext clk divided by 1 or 2 */ | 61 | const struct clksel_rate *clkr; |
54 | div >>= clk->rate_offset; | 62 | u32 r, found = 0; |
55 | clk->rate = (clk->parent->rate / div); | 63 | |
56 | propagate_rate(clk); | 64 | if (!clk->clksel) |
65 | return; | ||
66 | |||
67 | r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; | ||
68 | r >>= __ffs(clk->clksel_mask); | ||
69 | |||
70 | for (clks = clk->clksel; clks->parent && !found; clks++) { | ||
71 | for (clkr = clks->rates; clkr->div && !found; clkr++) { | ||
72 | if ((clkr->flags & cpu_mask) && (clkr->val == r)) { | ||
73 | if (clk->parent != clks->parent) { | ||
74 | pr_debug("clock: inited %s parent " | ||
75 | "to %s (was %s)\n", | ||
76 | clk->name, clks->parent->name, | ||
77 | ((clk->parent) ? | ||
78 | clk->parent->name : "NULL")); | ||
79 | clk->parent = clks->parent; | ||
80 | }; | ||
81 | found = 1; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | if (!found) | ||
87 | printk(KERN_ERR "clock: init parent: could not find " | ||
88 | "regval %0x for clock %s\n", r, clk->name); | ||
89 | |||
90 | return; | ||
57 | } | 91 | } |
58 | 92 | ||
59 | static u32 omap2_get_dpll_rate(struct clk * tclk) | 93 | /* Returns the DPLL rate */ |
94 | u32 omap2_get_dpll_rate(struct clk *clk) | ||
60 | { | 95 | { |
61 | long long dpll_clk; | 96 | long long dpll_clk; |
62 | int dpll_mult, dpll_div, amult; | 97 | u32 dpll_mult, dpll_div, dpll; |
98 | const struct dpll_data *dd; | ||
99 | |||
100 | dd = clk->dpll_data; | ||
101 | /* REVISIT: What do we return on error? */ | ||
102 | if (!dd) | ||
103 | return 0; | ||
104 | |||
105 | dpll = __raw_readl(dd->mult_div1_reg); | ||
106 | dpll_mult = dpll & dd->mult_mask; | ||
107 | dpll_mult >>= __ffs(dd->mult_mask); | ||
108 | dpll_div = dpll & dd->div1_mask; | ||
109 | dpll_div >>= __ffs(dd->div1_mask); | ||
63 | 110 | ||
64 | dpll_mult = (CM_CLKSEL1_PLL >> 12) & 0x03ff; /* 10 bits */ | 111 | dpll_clk = (long long)clk->parent->rate * dpll_mult; |
65 | dpll_div = (CM_CLKSEL1_PLL >> 8) & 0x0f; /* 4 bits */ | ||
66 | dpll_clk = (long long)tclk->parent->rate * dpll_mult; | ||
67 | do_div(dpll_clk, dpll_div + 1); | 112 | do_div(dpll_clk, dpll_div + 1); |
68 | amult = CM_CLKSEL2_PLL & 0x3; | ||
69 | dpll_clk *= amult; | ||
70 | 113 | ||
71 | return dpll_clk; | 114 | return dpll_clk; |
72 | } | 115 | } |
73 | 116 | ||
74 | static void omap2_followparent_recalc(struct clk *clk) | 117 | /* |
75 | { | 118 | * Used for clocks that have the same value as the parent clock, |
76 | followparent_recalc(clk); | 119 | * divided by some factor |
77 | } | 120 | */ |
78 | 121 | void omap2_fixed_divisor_recalc(struct clk *clk) | |
79 | static void omap2_propagate_rate(struct clk * clk) | ||
80 | { | 122 | { |
81 | if (!(clk->flags & RATE_FIXED)) | 123 | WARN_ON(!clk->fixed_div); |
82 | clk->rate = clk->parent->rate; | ||
83 | 124 | ||
84 | propagate_rate(clk); | 125 | clk->rate = clk->parent->rate / clk->fixed_div; |
85 | } | ||
86 | 126 | ||
87 | static void omap2_set_osc_ck(int enable) | 127 | if (clk->flags & RATE_PROPAGATES) |
88 | { | 128 | propagate_rate(clk); |
89 | if (enable) | ||
90 | PRCM_CLKSRC_CTRL &= ~(0x3 << 3); | ||
91 | else | ||
92 | PRCM_CLKSRC_CTRL |= 0x3 << 3; | ||
93 | } | 129 | } |
94 | 130 | ||
95 | /* Enable an APLL if off */ | 131 | /** |
96 | static void omap2_clk_fixed_enable(struct clk *clk) | 132 | * omap2_wait_clock_ready - wait for clock to enable |
133 | * @reg: physical address of clock IDLEST register | ||
134 | * @mask: value to mask against to determine if the clock is active | ||
135 | * @name: name of the clock (for printk) | ||
136 | * | ||
137 | * Returns 1 if the clock enabled in time, or 0 if it failed to enable | ||
138 | * in roughly MAX_CLOCK_ENABLE_WAIT microseconds. | ||
139 | */ | ||
140 | int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name) | ||
97 | { | 141 | { |
98 | u32 cval, i=0; | 142 | int i = 0; |
143 | int ena = 0; | ||
99 | 144 | ||
100 | if (clk->enable_bit == 0xff) /* Parent will do it */ | 145 | /* |
101 | return; | 146 | * 24xx uses 0 to indicate not ready, and 1 to indicate ready. |
147 | * 34xx reverses this, just to keep us on our toes | ||
148 | */ | ||
149 | if (cpu_mask & (RATE_IN_242X | RATE_IN_243X)) { | ||
150 | ena = mask; | ||
151 | } else if (cpu_mask & RATE_IN_343X) { | ||
152 | ena = 0; | ||
153 | } | ||
102 | 154 | ||
103 | cval = CM_CLKEN_PLL; | 155 | /* Wait for lock */ |
156 | while (((__raw_readl(reg) & mask) != ena) && | ||
157 | (i++ < MAX_CLOCK_ENABLE_WAIT)) { | ||
158 | udelay(1); | ||
159 | } | ||
104 | 160 | ||
105 | if ((cval & (0x3 << clk->enable_bit)) == (0x3 << clk->enable_bit)) | 161 | if (i < MAX_CLOCK_ENABLE_WAIT) |
106 | return; | 162 | pr_debug("Clock %s stable after %d loops\n", name, i); |
163 | else | ||
164 | printk(KERN_ERR "Clock %s didn't enable in %d tries\n", | ||
165 | name, MAX_CLOCK_ENABLE_WAIT); | ||
107 | 166 | ||
108 | cval &= ~(0x3 << clk->enable_bit); | ||
109 | cval |= (0x3 << clk->enable_bit); | ||
110 | CM_CLKEN_PLL = cval; | ||
111 | 167 | ||
112 | if (clk == &apll96_ck) | 168 | return (i < MAX_CLOCK_ENABLE_WAIT) ? 1 : 0; |
113 | cval = (1 << 8); | 169 | }; |
114 | else if (clk == &apll54_ck) | ||
115 | cval = (1 << 6); | ||
116 | 170 | ||
117 | while (!(CM_IDLEST_CKGEN & cval)) { /* Wait for lock */ | ||
118 | ++i; | ||
119 | udelay(1); | ||
120 | if (i == 100000) { | ||
121 | printk(KERN_ERR "Clock %s didn't lock\n", clk->name); | ||
122 | break; | ||
123 | } | ||
124 | } | ||
125 | } | ||
126 | 171 | ||
172 | /* | ||
173 | * Note: We don't need special code here for INVERT_ENABLE | ||
174 | * for the time being since INVERT_ENABLE only applies to clocks enabled by | ||
175 | * CM_CLKEN_PLL | ||
176 | */ | ||
127 | static void omap2_clk_wait_ready(struct clk *clk) | 177 | static void omap2_clk_wait_ready(struct clk *clk) |
128 | { | 178 | { |
129 | unsigned long reg, other_reg, st_reg; | 179 | void __iomem *reg, *other_reg, *st_reg; |
130 | u32 bit; | 180 | u32 bit; |
131 | int i; | 181 | |
132 | 182 | /* | |
133 | reg = (unsigned long) clk->enable_reg; | 183 | * REVISIT: This code is pretty ugly. It would be nice to generalize |
134 | if (reg == (unsigned long) &CM_FCLKEN1_CORE || | 184 | * it and pull it into struct clk itself somehow. |
135 | reg == (unsigned long) &CM_FCLKEN2_CORE) | 185 | */ |
136 | other_reg = (reg & ~0xf0) | 0x10; | 186 | reg = clk->enable_reg; |
137 | else if (reg == (unsigned long) &CM_ICLKEN1_CORE || | 187 | if ((((u32)reg & 0xff) >= CM_FCLKEN1) && |
138 | reg == (unsigned long) &CM_ICLKEN2_CORE) | 188 | (((u32)reg & 0xff) <= OMAP24XX_CM_FCLKEN2)) |
139 | other_reg = (reg & ~0xf0) | 0x00; | 189 | other_reg = (void __iomem *)(((u32)reg & ~0xf0) | 0x10); /* CM_ICLKEN* */ |
190 | else if ((((u32)reg & 0xff) >= CM_ICLKEN1) && | ||
191 | (((u32)reg & 0xff) <= OMAP24XX_CM_ICLKEN4)) | ||
192 | other_reg = (void __iomem *)(((u32)reg & ~0xf0) | 0x00); /* CM_FCLKEN* */ | ||
140 | else | 193 | else |
141 | return; | 194 | return; |
142 | 195 | ||
196 | /* REVISIT: What are the appropriate exclusions for 34XX? */ | ||
143 | /* No check for DSS or cam clocks */ | 197 | /* No check for DSS or cam clocks */ |
144 | if ((reg & 0x0f) == 0) { | 198 | if (cpu_is_omap24xx() && ((u32)reg & 0x0f) == 0) { /* CM_{F,I}CLKEN1 */ |
145 | if (clk->enable_bit <= 1 || clk->enable_bit == 31) | 199 | if (clk->enable_bit == OMAP24XX_EN_DSS2_SHIFT || |
200 | clk->enable_bit == OMAP24XX_EN_DSS1_SHIFT || | ||
201 | clk->enable_bit == OMAP24XX_EN_CAM_SHIFT) | ||
146 | return; | 202 | return; |
147 | } | 203 | } |
148 | 204 | ||
205 | /* REVISIT: What are the appropriate exclusions for 34XX? */ | ||
206 | /* OMAP3: ignore DSS-mod clocks */ | ||
207 | if (cpu_is_omap34xx() && | ||
208 | (((u32)reg & ~0xff) == (u32)OMAP_CM_REGADDR(OMAP3430_DSS_MOD, 0))) | ||
209 | return; | ||
210 | |||
149 | /* Check if both functional and interface clocks | 211 | /* Check if both functional and interface clocks |
150 | * are running. */ | 212 | * are running. */ |
151 | bit = 1 << clk->enable_bit; | 213 | bit = 1 << clk->enable_bit; |
152 | if (!(__raw_readl(other_reg) & bit)) | 214 | if (!(__raw_readl(other_reg) & bit)) |
153 | return; | 215 | return; |
154 | st_reg = (other_reg & ~0xf0) | 0x20; | 216 | st_reg = (void __iomem *)(((u32)other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */ |
155 | i = 0; | 217 | |
156 | while (!(__raw_readl(st_reg) & bit)) { | 218 | omap2_wait_clock_ready(st_reg, bit, clk->name); |
157 | i++; | ||
158 | if (i == 100000) { | ||
159 | printk(KERN_ERR "Timeout enabling clock %s\n", clk->name); | ||
160 | break; | ||
161 | } | ||
162 | } | ||
163 | if (i) | ||
164 | pr_debug("Clock %s stable after %d loops\n", clk->name, i); | ||
165 | } | 219 | } |
166 | 220 | ||
167 | /* Enables clock without considering parent dependencies or use count | 221 | /* Enables clock without considering parent dependencies or use count |
168 | * REVISIT: Maybe change this to use clk->enable like on omap1? | 222 | * REVISIT: Maybe change this to use clk->enable like on omap1? |
169 | */ | 223 | */ |
170 | static int _omap2_clk_enable(struct clk * clk) | 224 | int _omap2_clk_enable(struct clk *clk) |
171 | { | 225 | { |
172 | u32 regval32; | 226 | u32 regval32; |
173 | 227 | ||
174 | if (clk->flags & ALWAYS_ENABLED) | 228 | if (clk->flags & (ALWAYS_ENABLED | PARENT_CONTROLS_CLOCK)) |
175 | return 0; | 229 | return 0; |
176 | 230 | ||
177 | if (unlikely(clk == &osc_ck)) { | 231 | if (clk->enable) |
178 | omap2_set_osc_ck(1); | 232 | return clk->enable(clk); |
179 | return 0; | ||
180 | } | ||
181 | 233 | ||
182 | if (unlikely(clk->enable_reg == 0)) { | 234 | if (unlikely(clk->enable_reg == 0)) { |
183 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", | 235 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", |
184 | clk->name); | 236 | clk->name); |
185 | return 0; | 237 | return 0; /* REVISIT: -EINVAL */ |
186 | } | ||
187 | |||
188 | if (clk->enable_reg == (void __iomem *)&CM_CLKEN_PLL) { | ||
189 | omap2_clk_fixed_enable(clk); | ||
190 | return 0; | ||
191 | } | 238 | } |
192 | 239 | ||
193 | regval32 = __raw_readl(clk->enable_reg); | 240 | regval32 = __raw_readl(clk->enable_reg); |
194 | regval32 |= (1 << clk->enable_bit); | 241 | if (clk->flags & INVERT_ENABLE) |
242 | regval32 &= ~(1 << clk->enable_bit); | ||
243 | else | ||
244 | regval32 |= (1 << clk->enable_bit); | ||
195 | __raw_writel(regval32, clk->enable_reg); | 245 | __raw_writel(regval32, clk->enable_reg); |
196 | wmb(); | 246 | wmb(); |
197 | 247 | ||
@@ -200,44 +250,48 @@ static int _omap2_clk_enable(struct clk * clk) | |||
200 | return 0; | 250 | return 0; |
201 | } | 251 | } |
202 | 252 | ||
203 | /* Stop APLL */ | ||
204 | static void omap2_clk_fixed_disable(struct clk *clk) | ||
205 | { | ||
206 | u32 cval; | ||
207 | |||
208 | if(clk->enable_bit == 0xff) /* let parent off do it */ | ||
209 | return; | ||
210 | |||
211 | cval = CM_CLKEN_PLL; | ||
212 | cval &= ~(0x3 << clk->enable_bit); | ||
213 | CM_CLKEN_PLL = cval; | ||
214 | } | ||
215 | |||
216 | /* Disables clock without considering parent dependencies or use count */ | 253 | /* Disables clock without considering parent dependencies or use count */ |
217 | static void _omap2_clk_disable(struct clk *clk) | 254 | void _omap2_clk_disable(struct clk *clk) |
218 | { | 255 | { |
219 | u32 regval32; | 256 | u32 regval32; |
220 | 257 | ||
221 | if (unlikely(clk == &osc_ck)) { | 258 | if (clk->flags & (ALWAYS_ENABLED | PARENT_CONTROLS_CLOCK)) |
222 | omap2_set_osc_ck(0); | ||
223 | return; | 259 | return; |
224 | } | ||
225 | 260 | ||
226 | if (clk->enable_reg == 0) | 261 | if (clk->disable) { |
262 | clk->disable(clk); | ||
227 | return; | 263 | return; |
264 | } | ||
228 | 265 | ||
229 | if (clk->enable_reg == (void __iomem *)&CM_CLKEN_PLL) { | 266 | if (clk->enable_reg == 0) { |
230 | omap2_clk_fixed_disable(clk); | 267 | /* |
268 | * 'Independent' here refers to a clock which is not | ||
269 | * controlled by its parent. | ||
270 | */ | ||
271 | printk(KERN_ERR "clock: clk_disable called on independent " | ||
272 | "clock %s which has no enable_reg\n", clk->name); | ||
231 | return; | 273 | return; |
232 | } | 274 | } |
233 | 275 | ||
234 | regval32 = __raw_readl(clk->enable_reg); | 276 | regval32 = __raw_readl(clk->enable_reg); |
235 | regval32 &= ~(1 << clk->enable_bit); | 277 | if (clk->flags & INVERT_ENABLE) |
278 | regval32 |= (1 << clk->enable_bit); | ||
279 | else | ||
280 | regval32 &= ~(1 << clk->enable_bit); | ||
236 | __raw_writel(regval32, clk->enable_reg); | 281 | __raw_writel(regval32, clk->enable_reg); |
237 | wmb(); | 282 | wmb(); |
238 | } | 283 | } |
239 | 284 | ||
240 | static int omap2_clk_enable(struct clk *clk) | 285 | void omap2_clk_disable(struct clk *clk) |
286 | { | ||
287 | if (clk->usecount > 0 && !(--clk->usecount)) { | ||
288 | _omap2_clk_disable(clk); | ||
289 | if (likely((u32)clk->parent)) | ||
290 | omap2_clk_disable(clk->parent); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | int omap2_clk_enable(struct clk *clk) | ||
241 | { | 295 | { |
242 | int ret = 0; | 296 | int ret = 0; |
243 | 297 | ||
@@ -261,519 +315,314 @@ static int omap2_clk_enable(struct clk *clk) | |||
261 | return ret; | 315 | return ret; |
262 | } | 316 | } |
263 | 317 | ||
264 | static void omap2_clk_disable(struct clk *clk) | ||
265 | { | ||
266 | if (clk->usecount > 0 && !(--clk->usecount)) { | ||
267 | _omap2_clk_disable(clk); | ||
268 | if (likely((u32)clk->parent)) | ||
269 | omap2_clk_disable(clk->parent); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * Uses the current prcm set to tell if a rate is valid. | ||
275 | * You can go slower, but not faster within a given rate set. | ||
276 | */ | ||
277 | static u32 omap2_dpll_round_rate(unsigned long target_rate) | ||
278 | { | ||
279 | u32 high, low; | ||
280 | |||
281 | if ((CM_CLKSEL2_PLL & 0x3) == 1) { /* DPLL clockout */ | ||
282 | high = curr_prcm_set->dpll_speed * 2; | ||
283 | low = curr_prcm_set->dpll_speed; | ||
284 | } else { /* DPLL clockout x 2 */ | ||
285 | high = curr_prcm_set->dpll_speed; | ||
286 | low = curr_prcm_set->dpll_speed / 2; | ||
287 | } | ||
288 | |||
289 | #ifdef DOWN_VARIABLE_DPLL | ||
290 | if (target_rate > high) | ||
291 | return high; | ||
292 | else | ||
293 | return target_rate; | ||
294 | #else | ||
295 | if (target_rate > low) | ||
296 | return high; | ||
297 | else | ||
298 | return low; | ||
299 | #endif | ||
300 | |||
301 | } | ||
302 | |||
303 | /* | 318 | /* |
304 | * Used for clocks that are part of CLKSEL_xyz governed clocks. | 319 | * Used for clocks that are part of CLKSEL_xyz governed clocks. |
305 | * REVISIT: Maybe change to use clk->enable() functions like on omap1? | 320 | * REVISIT: Maybe change to use clk->enable() functions like on omap1? |
306 | */ | 321 | */ |
307 | static void omap2_clksel_recalc(struct clk * clk) | 322 | void omap2_clksel_recalc(struct clk *clk) |
308 | { | 323 | { |
309 | u32 fixed = 0, div = 0; | 324 | u32 div = 0; |
310 | 325 | ||
311 | if (clk == &dpll_ck) { | 326 | pr_debug("clock: recalc'ing clksel clk %s\n", clk->name); |
312 | clk->rate = omap2_get_dpll_rate(clk); | ||
313 | fixed = 1; | ||
314 | div = 0; | ||
315 | } | ||
316 | 327 | ||
317 | if (clk == &iva1_mpu_int_ifck) { | 328 | div = omap2_clksel_get_divisor(clk); |
318 | div = 2; | 329 | if (div == 0) |
319 | fixed = 1; | ||
320 | } | ||
321 | |||
322 | if ((clk == &dss1_fck) && ((CM_CLKSEL1_CORE & (0x1f << 8)) == 0)) { | ||
323 | clk->rate = sys_ck.rate; | ||
324 | return; | 330 | return; |
325 | } | ||
326 | 331 | ||
327 | if (!fixed) { | 332 | if (unlikely(clk->rate == clk->parent->rate / div)) |
328 | div = omap2_clksel_get_divisor(clk); | 333 | return; |
329 | if (div == 0) | 334 | clk->rate = clk->parent->rate / div; |
330 | return; | ||
331 | } | ||
332 | 335 | ||
333 | if (div != 0) { | 336 | pr_debug("clock: new clock rate is %ld (div %d)\n", clk->rate, div); |
334 | if (unlikely(clk->rate == clk->parent->rate / div)) | ||
335 | return; | ||
336 | clk->rate = clk->parent->rate / div; | ||
337 | } | ||
338 | 337 | ||
339 | if (unlikely(clk->flags & RATE_PROPAGATES)) | 338 | if (unlikely(clk->flags & RATE_PROPAGATES)) |
340 | propagate_rate(clk); | 339 | propagate_rate(clk); |
341 | } | 340 | } |
342 | 341 | ||
343 | /* | 342 | /** |
344 | * Finds best divider value in an array based on the source and target | 343 | * omap2_get_clksel_by_parent - return clksel struct for a given clk & parent |
345 | * rates. The divider array must be sorted with smallest divider first. | 344 | * @clk: OMAP struct clk ptr to inspect |
345 | * @src_clk: OMAP struct clk ptr of the parent clk to search for | ||
346 | * | ||
347 | * Scan the struct clksel array associated with the clock to find | ||
348 | * the element associated with the supplied parent clock address. | ||
349 | * Returns a pointer to the struct clksel on success or NULL on error. | ||
346 | */ | 350 | */ |
347 | static inline u32 omap2_divider_from_table(u32 size, u32 *div_array, | 351 | const struct clksel *omap2_get_clksel_by_parent(struct clk *clk, |
348 | u32 src_rate, u32 tgt_rate) | 352 | struct clk *src_clk) |
349 | { | 353 | { |
350 | int i, test_rate; | 354 | const struct clksel *clks; |
351 | 355 | ||
352 | if (div_array == NULL) | 356 | if (!clk->clksel) |
353 | return ~1; | 357 | return NULL; |
354 | 358 | ||
355 | for (i=0; i < size; i++) { | 359 | for (clks = clk->clksel; clks->parent; clks++) { |
356 | test_rate = src_rate / *div_array; | 360 | if (clks->parent == src_clk) |
357 | if (test_rate <= tgt_rate) | 361 | break; /* Found the requested parent */ |
358 | return *div_array; | ||
359 | ++div_array; | ||
360 | } | 362 | } |
361 | 363 | ||
362 | return ~0; /* No acceptable divider */ | 364 | if (!clks->parent) { |
365 | printk(KERN_ERR "clock: Could not find parent clock %s in " | ||
366 | "clksel array of clock %s\n", src_clk->name, | ||
367 | clk->name); | ||
368 | return NULL; | ||
369 | } | ||
370 | |||
371 | return clks; | ||
363 | } | 372 | } |
364 | 373 | ||
365 | /* | 374 | /** |
366 | * Find divisor for the given clock and target rate. | 375 | * omap2_clksel_round_rate_div - find divisor for the given clock and rate |
376 | * @clk: OMAP struct clk to use | ||
377 | * @target_rate: desired clock rate | ||
378 | * @new_div: ptr to where we should store the divisor | ||
367 | * | 379 | * |
380 | * Finds 'best' divider value in an array based on the source and target | ||
381 | * rates. The divider array must be sorted with smallest divider first. | ||
368 | * Note that this will not work for clocks which are part of CONFIG_PARTICIPANT, | 382 | * Note that this will not work for clocks which are part of CONFIG_PARTICIPANT, |
369 | * they are only settable as part of virtual_prcm set. | 383 | * they are only settable as part of virtual_prcm set. |
384 | * | ||
385 | * Returns the rounded clock rate or returns 0xffffffff on error. | ||
370 | */ | 386 | */ |
371 | static u32 omap2_clksel_round_rate(struct clk *tclk, u32 target_rate, | 387 | u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, |
372 | u32 *new_div) | 388 | u32 *new_div) |
373 | { | 389 | { |
374 | u32 gfx_div[] = {2, 3, 4}; | 390 | unsigned long test_rate; |
375 | u32 sysclkout_div[] = {1, 2, 4, 8, 16}; | 391 | const struct clksel *clks; |
376 | u32 dss1_div[] = {1, 2, 3, 4, 5, 6, 8, 9, 12, 16}; | 392 | const struct clksel_rate *clkr; |
377 | u32 vylnq_div[] = {1, 2, 3, 4, 6, 8, 9, 12, 16, 18}; | 393 | u32 last_div = 0; |
378 | u32 best_div = ~0, asize = 0; | 394 | |
379 | u32 *div_array = NULL; | 395 | printk(KERN_INFO "clock: clksel_round_rate_div: %s target_rate %ld\n", |
380 | 396 | clk->name, target_rate); | |
381 | switch (tclk->flags & SRC_RATE_SEL_MASK) { | 397 | |
382 | case CM_GFX_SEL1: | 398 | *new_div = 1; |
383 | asize = 3; | 399 | |
384 | div_array = gfx_div; | 400 | clks = omap2_get_clksel_by_parent(clk, clk->parent); |
385 | break; | 401 | if (clks == NULL) |
386 | case CM_PLL_SEL1: | 402 | return ~0; |
387 | return omap2_dpll_round_rate(target_rate); | 403 | |
388 | case CM_SYSCLKOUT_SEL1: | 404 | for (clkr = clks->rates; clkr->div; clkr++) { |
389 | asize = 5; | 405 | if (!(clkr->flags & cpu_mask)) |
390 | div_array = sysclkout_div; | 406 | continue; |
391 | break; | 407 | |
392 | case CM_CORE_SEL1: | 408 | /* Sanity check */ |
393 | if(tclk == &dss1_fck){ | 409 | if (clkr->div <= last_div) |
394 | if(tclk->parent == &core_ck){ | 410 | printk(KERN_ERR "clock: clksel_rate table not sorted " |
395 | asize = 10; | 411 | "for clock %s", clk->name); |
396 | div_array = dss1_div; | 412 | |
397 | } else { | 413 | last_div = clkr->div; |
398 | *new_div = 0; /* fixed clk */ | 414 | |
399 | return(tclk->parent->rate); | 415 | test_rate = clk->parent->rate / clkr->div; |
400 | } | 416 | |
401 | } else if((tclk == &vlynq_fck) && cpu_is_omap2420()){ | 417 | if (test_rate <= target_rate) |
402 | if(tclk->parent == &core_ck){ | 418 | break; /* found it */ |
403 | asize = 10; | ||
404 | div_array = vylnq_div; | ||
405 | } else { | ||
406 | *new_div = 0; /* fixed clk */ | ||
407 | return(tclk->parent->rate); | ||
408 | } | ||
409 | } | ||
410 | break; | ||
411 | } | 419 | } |
412 | 420 | ||
413 | best_div = omap2_divider_from_table(asize, div_array, | 421 | if (!clkr->div) { |
414 | tclk->parent->rate, target_rate); | 422 | printk(KERN_ERR "clock: Could not find divisor for target " |
415 | if (best_div == ~0){ | 423 | "rate %ld for clock %s parent %s\n", target_rate, |
416 | *new_div = 1; | 424 | clk->name, clk->parent->name); |
417 | return best_div; /* signal error */ | 425 | return ~0; |
418 | } | 426 | } |
419 | 427 | ||
420 | *new_div = best_div; | 428 | *new_div = clkr->div; |
421 | return (tclk->parent->rate / best_div); | 429 | |
430 | printk(KERN_INFO "clock: new_div = %d, new_rate = %ld\n", *new_div, | ||
431 | (clk->parent->rate / clkr->div)); | ||
432 | |||
433 | return (clk->parent->rate / clkr->div); | ||
422 | } | 434 | } |
423 | 435 | ||
424 | /* Given a clock and a rate apply a clock specific rounding function */ | 436 | /** |
425 | static long omap2_clk_round_rate(struct clk *clk, unsigned long rate) | 437 | * omap2_clksel_round_rate - find rounded rate for the given clock and rate |
438 | * @clk: OMAP struct clk to use | ||
439 | * @target_rate: desired clock rate | ||
440 | * | ||
441 | * Compatibility wrapper for OMAP clock framework | ||
442 | * Finds best target rate based on the source clock and possible dividers. | ||
443 | * rates. The divider array must be sorted with smallest divider first. | ||
444 | * Note that this will not work for clocks which are part of CONFIG_PARTICIPANT, | ||
445 | * they are only settable as part of virtual_prcm set. | ||
446 | * | ||
447 | * Returns the rounded clock rate or returns 0xffffffff on error. | ||
448 | */ | ||
449 | long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate) | ||
426 | { | 450 | { |
427 | u32 new_div = 0; | 451 | u32 new_div; |
428 | int valid_rate; | ||
429 | 452 | ||
430 | if (clk->flags & RATE_FIXED) | 453 | return omap2_clksel_round_rate_div(clk, target_rate, &new_div); |
431 | return clk->rate; | 454 | } |
432 | 455 | ||
433 | if (clk->flags & RATE_CKCTL) { | ||
434 | valid_rate = omap2_clksel_round_rate(clk, rate, &new_div); | ||
435 | return valid_rate; | ||
436 | } | ||
437 | 456 | ||
457 | /* Given a clock and a rate apply a clock specific rounding function */ | ||
458 | long omap2_clk_round_rate(struct clk *clk, unsigned long rate) | ||
459 | { | ||
438 | if (clk->round_rate != 0) | 460 | if (clk->round_rate != 0) |
439 | return clk->round_rate(clk, rate); | 461 | return clk->round_rate(clk, rate); |
440 | 462 | ||
463 | if (clk->flags & RATE_FIXED) | ||
464 | printk(KERN_ERR "clock: generic omap2_clk_round_rate called " | ||
465 | "on fixed-rate clock %s\n", clk->name); | ||
466 | |||
441 | return clk->rate; | 467 | return clk->rate; |
442 | } | 468 | } |
443 | 469 | ||
444 | /* | 470 | /** |
445 | * Check the DLL lock state, and return tue if running in unlock mode. | 471 | * omap2_clksel_to_divisor() - turn clksel field value into integer divider |
446 | * This is needed to compensate for the shifted DLL value in unlock mode. | 472 | * @clk: OMAP struct clk to use |
473 | * @field_val: register field value to find | ||
474 | * | ||
475 | * Given a struct clk of a rate-selectable clksel clock, and a register field | ||
476 | * value to search for, find the corresponding clock divisor. The register | ||
477 | * field value should be pre-masked and shifted down so the LSB is at bit 0 | ||
478 | * before calling. Returns 0 on error | ||
447 | */ | 479 | */ |
448 | static u32 omap2_dll_force_needed(void) | 480 | u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val) |
449 | { | 481 | { |
450 | u32 dll_state = SDRC_DLLA_CTRL; /* dlla and dllb are a set */ | 482 | const struct clksel *clks; |
483 | const struct clksel_rate *clkr; | ||
451 | 484 | ||
452 | if ((dll_state & (1 << 2)) == (1 << 2)) | 485 | clks = omap2_get_clksel_by_parent(clk, clk->parent); |
453 | return 1; | 486 | if (clks == NULL) |
454 | else | ||
455 | return 0; | 487 | return 0; |
456 | } | ||
457 | 488 | ||
458 | static u32 omap2_reprogram_sdrc(u32 level, u32 force) | 489 | for (clkr = clks->rates; clkr->div; clkr++) { |
459 | { | 490 | if ((clkr->flags & cpu_mask) && (clkr->val == field_val)) |
460 | u32 slow_dll_ctrl, fast_dll_ctrl, m_type; | 491 | break; |
461 | u32 prev = curr_perf_level, flags; | ||
462 | |||
463 | if ((curr_perf_level == level) && !force) | ||
464 | return prev; | ||
465 | |||
466 | m_type = omap2_memory_get_type(); | ||
467 | slow_dll_ctrl = omap2_memory_get_slow_dll_ctrl(); | ||
468 | fast_dll_ctrl = omap2_memory_get_fast_dll_ctrl(); | ||
469 | |||
470 | if (level == PRCM_HALF_SPEED) { | ||
471 | local_irq_save(flags); | ||
472 | PRCM_VOLTSETUP = 0xffff; | ||
473 | omap2_sram_reprogram_sdrc(PRCM_HALF_SPEED, | ||
474 | slow_dll_ctrl, m_type); | ||
475 | curr_perf_level = PRCM_HALF_SPEED; | ||
476 | local_irq_restore(flags); | ||
477 | } | 492 | } |
478 | if (level == PRCM_FULL_SPEED) { | 493 | |
479 | local_irq_save(flags); | 494 | if (!clkr->div) { |
480 | PRCM_VOLTSETUP = 0xffff; | 495 | printk(KERN_ERR "clock: Could not find fieldval %d for " |
481 | omap2_sram_reprogram_sdrc(PRCM_FULL_SPEED, | 496 | "clock %s parent %s\n", field_val, clk->name, |
482 | fast_dll_ctrl, m_type); | 497 | clk->parent->name); |
483 | curr_perf_level = PRCM_FULL_SPEED; | 498 | return 0; |
484 | local_irq_restore(flags); | ||
485 | } | 499 | } |
486 | 500 | ||
487 | return prev; | 501 | return clkr->div; |
488 | } | 502 | } |
489 | 503 | ||
490 | static int omap2_reprogram_dpll(struct clk * clk, unsigned long rate) | 504 | /** |
505 | * omap2_divisor_to_clksel() - turn clksel integer divisor into a field value | ||
506 | * @clk: OMAP struct clk to use | ||
507 | * @div: integer divisor to search for | ||
508 | * | ||
509 | * Given a struct clk of a rate-selectable clksel clock, and a clock divisor, | ||
510 | * find the corresponding register field value. The return register value is | ||
511 | * the value before left-shifting. Returns 0xffffffff on error | ||
512 | */ | ||
513 | u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) | ||
491 | { | 514 | { |
492 | u32 flags, cur_rate, low, mult, div, valid_rate, done_rate; | 515 | const struct clksel *clks; |
493 | u32 bypass = 0; | 516 | const struct clksel_rate *clkr; |
494 | struct prcm_config tmpset; | ||
495 | int ret = -EINVAL; | ||
496 | 517 | ||
497 | local_irq_save(flags); | 518 | /* should never happen */ |
498 | cur_rate = omap2_get_dpll_rate(&dpll_ck); | 519 | WARN_ON(div == 0); |
499 | mult = CM_CLKSEL2_PLL & 0x3; | ||
500 | |||
501 | if ((rate == (cur_rate / 2)) && (mult == 2)) { | ||
502 | omap2_reprogram_sdrc(PRCM_HALF_SPEED, 1); | ||
503 | } else if ((rate == (cur_rate * 2)) && (mult == 1)) { | ||
504 | omap2_reprogram_sdrc(PRCM_FULL_SPEED, 1); | ||
505 | } else if (rate != cur_rate) { | ||
506 | valid_rate = omap2_dpll_round_rate(rate); | ||
507 | if (valid_rate != rate) | ||
508 | goto dpll_exit; | ||
509 | |||
510 | if ((CM_CLKSEL2_PLL & 0x3) == 1) | ||
511 | low = curr_prcm_set->dpll_speed; | ||
512 | else | ||
513 | low = curr_prcm_set->dpll_speed / 2; | ||
514 | |||
515 | tmpset.cm_clksel1_pll = CM_CLKSEL1_PLL; | ||
516 | tmpset.cm_clksel1_pll &= ~(0x3FFF << 8); | ||
517 | div = ((curr_prcm_set->xtal_speed / 1000000) - 1); | ||
518 | tmpset.cm_clksel2_pll = CM_CLKSEL2_PLL; | ||
519 | tmpset.cm_clksel2_pll &= ~0x3; | ||
520 | if (rate > low) { | ||
521 | tmpset.cm_clksel2_pll |= 0x2; | ||
522 | mult = ((rate / 2) / 1000000); | ||
523 | done_rate = PRCM_FULL_SPEED; | ||
524 | } else { | ||
525 | tmpset.cm_clksel2_pll |= 0x1; | ||
526 | mult = (rate / 1000000); | ||
527 | done_rate = PRCM_HALF_SPEED; | ||
528 | } | ||
529 | tmpset.cm_clksel1_pll |= ((div << 8) | (mult << 12)); | ||
530 | |||
531 | /* Worst case */ | ||
532 | tmpset.base_sdrc_rfr = V24XX_SDRC_RFR_CTRL_BYPASS; | ||
533 | |||
534 | if (rate == curr_prcm_set->xtal_speed) /* If asking for 1-1 */ | ||
535 | bypass = 1; | ||
536 | 520 | ||
537 | omap2_reprogram_sdrc(PRCM_FULL_SPEED, 1); /* For init_mem */ | 521 | clks = omap2_get_clksel_by_parent(clk, clk->parent); |
538 | 522 | if (clks == NULL) | |
539 | /* Force dll lock mode */ | 523 | return 0; |
540 | omap2_set_prcm(tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr, | ||
541 | bypass); | ||
542 | 524 | ||
543 | /* Errata: ret dll entry state */ | 525 | for (clkr = clks->rates; clkr->div; clkr++) { |
544 | omap2_init_memory_params(omap2_dll_force_needed()); | 526 | if ((clkr->flags & cpu_mask) && (clkr->div == div)) |
545 | omap2_reprogram_sdrc(done_rate, 0); | 527 | break; |
546 | } | 528 | } |
547 | omap2_clksel_recalc(&dpll_ck); | ||
548 | ret = 0; | ||
549 | 529 | ||
550 | dpll_exit: | 530 | if (!clkr->div) { |
551 | local_irq_restore(flags); | 531 | printk(KERN_ERR "clock: Could not find divisor %d for " |
552 | return(ret); | 532 | "clock %s parent %s\n", div, clk->name, |
553 | } | 533 | clk->parent->name); |
534 | return 0; | ||
535 | } | ||
554 | 536 | ||
555 | /* Just return the MPU speed */ | 537 | return clkr->val; |
556 | static void omap2_mpu_recalc(struct clk * clk) | ||
557 | { | ||
558 | clk->rate = curr_prcm_set->mpu_speed; | ||
559 | } | 538 | } |
560 | 539 | ||
561 | /* | 540 | /** |
562 | * Look for a rate equal or less than the target rate given a configuration set. | 541 | * omap2_get_clksel - find clksel register addr & field mask for a clk |
542 | * @clk: struct clk to use | ||
543 | * @field_mask: ptr to u32 to store the register field mask | ||
563 | * | 544 | * |
564 | * What's not entirely clear is "which" field represents the key field. | 545 | * Returns the address of the clksel register upon success or NULL on error. |
565 | * Some might argue L3-DDR, others ARM, others IVA. This code is simple and | ||
566 | * just uses the ARM rates. | ||
567 | */ | 546 | */ |
568 | static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate) | 547 | void __iomem *omap2_get_clksel(struct clk *clk, u32 *field_mask) |
569 | { | 548 | { |
570 | struct prcm_config * ptr; | 549 | if (unlikely((clk->clksel_reg == 0) || (clk->clksel_mask == 0))) |
571 | long highest_rate; | 550 | return NULL; |
572 | |||
573 | if (clk != &virt_prcm_set) | ||
574 | return -EINVAL; | ||
575 | |||
576 | highest_rate = -EINVAL; | ||
577 | |||
578 | for (ptr = rate_table; ptr->mpu_speed; ptr++) { | ||
579 | if (ptr->xtal_speed != sys_ck.rate) | ||
580 | continue; | ||
581 | 551 | ||
582 | highest_rate = ptr->mpu_speed; | 552 | *field_mask = clk->clksel_mask; |
583 | 553 | ||
584 | /* Can check only after xtal frequency check */ | 554 | return clk->clksel_reg; |
585 | if (ptr->mpu_speed <= rate) | ||
586 | break; | ||
587 | } | ||
588 | return highest_rate; | ||
589 | } | 555 | } |
590 | 556 | ||
591 | /* | 557 | /** |
592 | * omap2_convert_field_to_div() - turn field value into integer divider | 558 | * omap2_clksel_get_divisor - get current divider applied to parent clock. |
559 | * @clk: OMAP struct clk to use. | ||
560 | * | ||
561 | * Returns the integer divisor upon success or 0 on error. | ||
593 | */ | 562 | */ |
594 | static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val) | 563 | u32 omap2_clksel_get_divisor(struct clk *clk) |
595 | { | 564 | { |
596 | u32 i; | 565 | u32 field_mask, field_val; |
597 | u32 clkout_array[] = {1, 2, 4, 8, 16}; | 566 | void __iomem *div_addr; |
598 | 567 | ||
599 | if ((div_sel & SRC_RATE_SEL_MASK) == CM_SYSCLKOUT_SEL1) { | 568 | div_addr = omap2_get_clksel(clk, &field_mask); |
600 | for (i = 0; i < 5; i++) { | 569 | if (div_addr == 0) |
601 | if (field_val == i) | 570 | return 0; |
602 | return clkout_array[i]; | 571 | |
603 | } | 572 | field_val = __raw_readl(div_addr) & field_mask; |
604 | return ~0; | 573 | field_val >>= __ffs(field_mask); |
605 | } else | 574 | |
606 | return field_val; | 575 | return omap2_clksel_to_divisor(clk, field_val); |
607 | } | 576 | } |
608 | 577 | ||
609 | /* | 578 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) |
610 | * Returns the CLKSEL divider register value | ||
611 | * REVISIT: This should be cleaned up to work nicely with void __iomem * | ||
612 | */ | ||
613 | static u32 omap2_get_clksel(u32 *div_sel, u32 *field_mask, | ||
614 | struct clk *clk) | ||
615 | { | 579 | { |
616 | int ret = ~0; | 580 | u32 field_mask, field_val, reg_val, validrate, new_div = 0; |
617 | u32 reg_val, div_off; | 581 | void __iomem *div_addr; |
618 | u32 div_addr = 0; | ||
619 | u32 mask = ~0; | ||
620 | |||
621 | div_off = clk->rate_offset; | ||
622 | |||
623 | switch ((*div_sel & SRC_RATE_SEL_MASK)) { | ||
624 | case CM_MPU_SEL1: | ||
625 | div_addr = (u32)&CM_CLKSEL_MPU; | ||
626 | mask = 0x1f; | ||
627 | break; | ||
628 | case CM_DSP_SEL1: | ||
629 | div_addr = (u32)&CM_CLKSEL_DSP; | ||
630 | if (cpu_is_omap2420()) { | ||
631 | if ((div_off == 0) || (div_off == 8)) | ||
632 | mask = 0x1f; | ||
633 | else if (div_off == 5) | ||
634 | mask = 0x3; | ||
635 | } else if (cpu_is_omap2430()) { | ||
636 | if (div_off == 0) | ||
637 | mask = 0x1f; | ||
638 | else if (div_off == 5) | ||
639 | mask = 0x3; | ||
640 | } | ||
641 | break; | ||
642 | case CM_GFX_SEL1: | ||
643 | div_addr = (u32)&CM_CLKSEL_GFX; | ||
644 | if (div_off == 0) | ||
645 | mask = 0x7; | ||
646 | break; | ||
647 | case CM_MODEM_SEL1: | ||
648 | div_addr = (u32)&CM_CLKSEL_MDM; | ||
649 | if (div_off == 0) | ||
650 | mask = 0xf; | ||
651 | break; | ||
652 | case CM_SYSCLKOUT_SEL1: | ||
653 | div_addr = (u32)&PRCM_CLKOUT_CTRL; | ||
654 | if ((div_off == 3) || (div_off == 11)) | ||
655 | mask= 0x3; | ||
656 | break; | ||
657 | case CM_CORE_SEL1: | ||
658 | div_addr = (u32)&CM_CLKSEL1_CORE; | ||
659 | switch (div_off) { | ||
660 | case 0: /* l3 */ | ||
661 | case 8: /* dss1 */ | ||
662 | case 15: /* vylnc-2420 */ | ||
663 | case 20: /* ssi */ | ||
664 | mask = 0x1f; break; | ||
665 | case 5: /* l4 */ | ||
666 | mask = 0x3; break; | ||
667 | case 13: /* dss2 */ | ||
668 | mask = 0x1; break; | ||
669 | case 25: /* usb */ | ||
670 | mask = 0x7; break; | ||
671 | } | ||
672 | } | ||
673 | 582 | ||
674 | *field_mask = mask; | 583 | validrate = omap2_clksel_round_rate_div(clk, rate, &new_div); |
584 | if (validrate != rate) | ||
585 | return -EINVAL; | ||
675 | 586 | ||
676 | if (unlikely(mask == ~0)) | 587 | div_addr = omap2_get_clksel(clk, &field_mask); |
677 | div_addr = 0; | 588 | if (div_addr == 0) |
589 | return -EINVAL; | ||
678 | 590 | ||
679 | *div_sel = div_addr; | 591 | field_val = omap2_divisor_to_clksel(clk, new_div); |
592 | if (field_val == ~0) | ||
593 | return -EINVAL; | ||
680 | 594 | ||
681 | if (unlikely(div_addr == 0)) | 595 | reg_val = __raw_readl(div_addr); |
682 | return ret; | 596 | reg_val &= ~field_mask; |
597 | reg_val |= (field_val << __ffs(field_mask)); | ||
598 | __raw_writel(reg_val, div_addr); | ||
599 | wmb(); | ||
683 | 600 | ||
684 | /* Isolate field */ | 601 | clk->rate = clk->parent->rate / new_div; |
685 | reg_val = __raw_readl((void __iomem *)div_addr) & (mask << div_off); | ||
686 | 602 | ||
687 | /* Normalize back to divider value */ | 603 | if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) { |
688 | reg_val >>= div_off; | 604 | __raw_writel(OMAP24XX_VALID_CONFIG, OMAP24XX_PRCM_CLKCFG_CTRL); |
605 | wmb(); | ||
606 | } | ||
689 | 607 | ||
690 | return reg_val; | 608 | return 0; |
691 | } | 609 | } |
692 | 610 | ||
693 | /* | ||
694 | * Return divider to be applied to parent clock. | ||
695 | * Return 0 on error. | ||
696 | */ | ||
697 | static u32 omap2_clksel_get_divisor(struct clk *clk) | ||
698 | { | ||
699 | int ret = 0; | ||
700 | u32 div, div_sel, div_off, field_mask, field_val; | ||
701 | |||
702 | /* isolate control register */ | ||
703 | div_sel = (SRC_RATE_SEL_MASK & clk->flags); | ||
704 | |||
705 | div_off = clk->rate_offset; | ||
706 | field_val = omap2_get_clksel(&div_sel, &field_mask, clk); | ||
707 | if (div_sel == 0) | ||
708 | return ret; | ||
709 | |||
710 | div_sel = (SRC_RATE_SEL_MASK & clk->flags); | ||
711 | div = omap2_clksel_to_divisor(div_sel, field_val); | ||
712 | |||
713 | return div; | ||
714 | } | ||
715 | 611 | ||
716 | /* Set the clock rate for a clock source */ | 612 | /* Set the clock rate for a clock source */ |
717 | static int omap2_clk_set_rate(struct clk *clk, unsigned long rate) | 613 | int omap2_clk_set_rate(struct clk *clk, unsigned long rate) |
718 | |||
719 | { | 614 | { |
720 | int ret = -EINVAL; | 615 | int ret = -EINVAL; |
721 | void __iomem * reg; | ||
722 | u32 div_sel, div_off, field_mask, field_val, reg_val, validrate; | ||
723 | u32 new_div = 0; | ||
724 | |||
725 | if (!(clk->flags & CONFIG_PARTICIPANT) && (clk->flags & RATE_CKCTL)) { | ||
726 | if (clk == &dpll_ck) | ||
727 | return omap2_reprogram_dpll(clk, rate); | ||
728 | |||
729 | /* Isolate control register */ | ||
730 | div_sel = (SRC_RATE_SEL_MASK & clk->flags); | ||
731 | div_off = clk->rate_offset; | ||
732 | |||
733 | validrate = omap2_clksel_round_rate(clk, rate, &new_div); | ||
734 | if (validrate != rate) | ||
735 | return(ret); | ||
736 | 616 | ||
737 | field_val = omap2_get_clksel(&div_sel, &field_mask, clk); | 617 | pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate); |
738 | if (div_sel == 0) | ||
739 | return ret; | ||
740 | |||
741 | if (clk->flags & CM_SYSCLKOUT_SEL1) { | ||
742 | switch (new_div) { | ||
743 | case 16: | ||
744 | field_val = 4; | ||
745 | break; | ||
746 | case 8: | ||
747 | field_val = 3; | ||
748 | break; | ||
749 | case 4: | ||
750 | field_val = 2; | ||
751 | break; | ||
752 | case 2: | ||
753 | field_val = 1; | ||
754 | break; | ||
755 | case 1: | ||
756 | field_val = 0; | ||
757 | break; | ||
758 | } | ||
759 | } else | ||
760 | field_val = new_div; | ||
761 | 618 | ||
762 | reg = (void __iomem *)div_sel; | 619 | /* CONFIG_PARTICIPANT clocks are changed only in sets via the |
763 | 620 | rate table mechanism, driven by mpu_speed */ | |
764 | reg_val = __raw_readl(reg); | 621 | if (clk->flags & CONFIG_PARTICIPANT) |
765 | reg_val &= ~(field_mask << div_off); | 622 | return -EINVAL; |
766 | reg_val |= (field_val << div_off); | ||
767 | __raw_writel(reg_val, reg); | ||
768 | wmb(); | ||
769 | clk->rate = clk->parent->rate / field_val; | ||
770 | 623 | ||
771 | if (clk->flags & DELAYED_APP) { | 624 | /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ |
772 | __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL); | 625 | if (clk->set_rate != 0) |
773 | wmb(); | ||
774 | } | ||
775 | ret = 0; | ||
776 | } else if (clk->set_rate != 0) | ||
777 | ret = clk->set_rate(clk, rate); | 626 | ret = clk->set_rate(clk, rate); |
778 | 627 | ||
779 | if (unlikely(ret == 0 && (clk->flags & RATE_PROPAGATES))) | 628 | if (unlikely(ret == 0 && (clk->flags & RATE_PROPAGATES))) |
@@ -782,242 +631,92 @@ static int omap2_clk_set_rate(struct clk *clk, unsigned long rate) | |||
782 | return ret; | 631 | return ret; |
783 | } | 632 | } |
784 | 633 | ||
785 | /* Converts encoded control register address into a full address */ | 634 | /* |
786 | static u32 omap2_get_src_field(u32 *type_to_addr, u32 reg_offset, | 635 | * Converts encoded control register address into a full address |
787 | struct clk *src_clk, u32 *field_mask) | 636 | * On error, *src_addr will be returned as 0. |
788 | { | 637 | */ |
789 | u32 val = ~0, src_reg_addr = 0, mask = 0; | 638 | static u32 omap2_clksel_get_src_field(void __iomem **src_addr, |
790 | 639 | struct clk *src_clk, u32 *field_mask, | |
791 | /* Find target control register.*/ | 640 | struct clk *clk, u32 *parent_div) |
792 | switch ((*type_to_addr & SRC_RATE_SEL_MASK)) { | ||
793 | case CM_CORE_SEL1: | ||
794 | src_reg_addr = (u32)&CM_CLKSEL1_CORE; | ||
795 | if (reg_offset == 13) { /* DSS2_fclk */ | ||
796 | mask = 0x1; | ||
797 | if (src_clk == &sys_ck) | ||
798 | val = 0; | ||
799 | if (src_clk == &func_48m_ck) | ||
800 | val = 1; | ||
801 | } else if (reg_offset == 8) { /* DSS1_fclk */ | ||
802 | mask = 0x1f; | ||
803 | if (src_clk == &sys_ck) | ||
804 | val = 0; | ||
805 | else if (src_clk == &core_ck) /* divided clock */ | ||
806 | val = 0x10; /* rate needs fixing */ | ||
807 | } else if ((reg_offset == 15) && cpu_is_omap2420()){ /*vlnyq*/ | ||
808 | mask = 0x1F; | ||
809 | if(src_clk == &func_96m_ck) | ||
810 | val = 0; | ||
811 | else if (src_clk == &core_ck) | ||
812 | val = 0x10; | ||
813 | } | ||
814 | break; | ||
815 | case CM_CORE_SEL2: | ||
816 | src_reg_addr = (u32)&CM_CLKSEL2_CORE; | ||
817 | mask = 0x3; | ||
818 | if (src_clk == &func_32k_ck) | ||
819 | val = 0x0; | ||
820 | if (src_clk == &sys_ck) | ||
821 | val = 0x1; | ||
822 | if (src_clk == &alt_ck) | ||
823 | val = 0x2; | ||
824 | break; | ||
825 | case CM_WKUP_SEL1: | ||
826 | src_reg_addr = (u32)&CM_CLKSEL_WKUP; | ||
827 | mask = 0x3; | ||
828 | if (src_clk == &func_32k_ck) | ||
829 | val = 0x0; | ||
830 | if (src_clk == &sys_ck) | ||
831 | val = 0x1; | ||
832 | if (src_clk == &alt_ck) | ||
833 | val = 0x2; | ||
834 | break; | ||
835 | case CM_PLL_SEL1: | ||
836 | src_reg_addr = (u32)&CM_CLKSEL1_PLL; | ||
837 | mask = 0x1; | ||
838 | if (reg_offset == 0x3) { | ||
839 | if (src_clk == &apll96_ck) | ||
840 | val = 0; | ||
841 | if (src_clk == &alt_ck) | ||
842 | val = 1; | ||
843 | } | ||
844 | else if (reg_offset == 0x5) { | ||
845 | if (src_clk == &apll54_ck) | ||
846 | val = 0; | ||
847 | if (src_clk == &alt_ck) | ||
848 | val = 1; | ||
849 | } | ||
850 | break; | ||
851 | case CM_PLL_SEL2: | ||
852 | src_reg_addr = (u32)&CM_CLKSEL2_PLL; | ||
853 | mask = 0x3; | ||
854 | if (src_clk == &func_32k_ck) | ||
855 | val = 0x0; | ||
856 | if (src_clk == &dpll_ck) | ||
857 | val = 0x2; | ||
858 | break; | ||
859 | case CM_SYSCLKOUT_SEL1: | ||
860 | src_reg_addr = (u32)&PRCM_CLKOUT_CTRL; | ||
861 | mask = 0x3; | ||
862 | if (src_clk == &dpll_ck) | ||
863 | val = 0; | ||
864 | if (src_clk == &sys_ck) | ||
865 | val = 1; | ||
866 | if (src_clk == &func_96m_ck) | ||
867 | val = 2; | ||
868 | if (src_clk == &func_54m_ck) | ||
869 | val = 3; | ||
870 | break; | ||
871 | } | ||
872 | |||
873 | if (val == ~0) /* Catch errors in offset */ | ||
874 | *type_to_addr = 0; | ||
875 | else | ||
876 | *type_to_addr = src_reg_addr; | ||
877 | *field_mask = mask; | ||
878 | |||
879 | return val; | ||
880 | } | ||
881 | |||
882 | static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) | ||
883 | { | 641 | { |
884 | void __iomem * reg; | 642 | const struct clksel *clks; |
885 | u32 src_sel, src_off, field_val, field_mask, reg_val, rate; | 643 | const struct clksel_rate *clkr; |
886 | int ret = -EINVAL; | ||
887 | |||
888 | if (unlikely(clk->flags & CONFIG_PARTICIPANT)) | ||
889 | return ret; | ||
890 | |||
891 | if (clk->flags & SRC_SEL_MASK) { /* On-chip SEL collection */ | ||
892 | src_sel = (SRC_RATE_SEL_MASK & clk->flags); | ||
893 | src_off = clk->src_offset; | ||
894 | |||
895 | if (src_sel == 0) | ||
896 | goto set_parent_error; | ||
897 | |||
898 | field_val = omap2_get_src_field(&src_sel, src_off, new_parent, | ||
899 | &field_mask); | ||
900 | |||
901 | reg = (void __iomem *)src_sel; | ||
902 | |||
903 | if (clk->usecount > 0) | ||
904 | _omap2_clk_disable(clk); | ||
905 | |||
906 | /* Set new source value (previous dividers if any in effect) */ | ||
907 | reg_val = __raw_readl(reg) & ~(field_mask << src_off); | ||
908 | reg_val |= (field_val << src_off); | ||
909 | __raw_writel(reg_val, reg); | ||
910 | wmb(); | ||
911 | 644 | ||
912 | if (clk->flags & DELAYED_APP) { | 645 | *parent_div = 0; |
913 | __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL); | 646 | *src_addr = 0; |
914 | wmb(); | ||
915 | } | ||
916 | if (clk->usecount > 0) | ||
917 | _omap2_clk_enable(clk); | ||
918 | |||
919 | clk->parent = new_parent; | ||
920 | 647 | ||
921 | /* SRC_RATE_SEL_MASK clocks follow their parents rates.*/ | 648 | clks = omap2_get_clksel_by_parent(clk, src_clk); |
922 | if ((new_parent == &core_ck) && (clk == &dss1_fck)) | 649 | if (clks == NULL) |
923 | clk->rate = new_parent->rate / 0x10; | 650 | return 0; |
924 | else | ||
925 | clk->rate = new_parent->rate; | ||
926 | 651 | ||
927 | if (unlikely(clk->flags & RATE_PROPAGATES)) | 652 | for (clkr = clks->rates; clkr->div; clkr++) { |
928 | propagate_rate(clk); | 653 | if (clkr->flags & (cpu_mask | DEFAULT_RATE)) |
654 | break; /* Found the default rate for this platform */ | ||
655 | } | ||
929 | 656 | ||
657 | if (!clkr->div) { | ||
658 | printk(KERN_ERR "clock: Could not find default rate for " | ||
659 | "clock %s parent %s\n", clk->name, | ||
660 | src_clk->parent->name); | ||
930 | return 0; | 661 | return 0; |
931 | } else { | ||
932 | clk->parent = new_parent; | ||
933 | rate = new_parent->rate; | ||
934 | omap2_clk_set_rate(clk, rate); | ||
935 | ret = 0; | ||
936 | } | 662 | } |
937 | 663 | ||
938 | set_parent_error: | 664 | /* Should never happen. Add a clksel mask to the struct clk. */ |
939 | return ret; | 665 | WARN_ON(clk->clksel_mask == 0); |
666 | |||
667 | *field_mask = clk->clksel_mask; | ||
668 | *src_addr = clk->clksel_reg; | ||
669 | *parent_div = clkr->div; | ||
670 | |||
671 | return clkr->val; | ||
940 | } | 672 | } |
941 | 673 | ||
942 | /* Sets basic clocks based on the specified rate */ | 674 | int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) |
943 | static int omap2_select_table_rate(struct clk * clk, unsigned long rate) | ||
944 | { | 675 | { |
945 | u32 flags, cur_rate, done_rate, bypass = 0; | 676 | void __iomem *src_addr; |
946 | u8 cpu_mask = 0; | 677 | u32 field_val, field_mask, reg_val, parent_div; |
947 | struct prcm_config *prcm; | ||
948 | unsigned long found_speed = 0; | ||
949 | 678 | ||
950 | if (clk != &virt_prcm_set) | 679 | if (unlikely(clk->flags & CONFIG_PARTICIPANT)) |
951 | return -EINVAL; | 680 | return -EINVAL; |
952 | 681 | ||
953 | /* FIXME: Change cpu_is_omap2420() to cpu_is_omap242x() */ | 682 | if (!clk->clksel) |
954 | if (cpu_is_omap2420()) | ||
955 | cpu_mask = RATE_IN_242X; | ||
956 | else if (cpu_is_omap2430()) | ||
957 | cpu_mask = RATE_IN_243X; | ||
958 | |||
959 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
960 | if (!(prcm->flags & cpu_mask)) | ||
961 | continue; | ||
962 | |||
963 | if (prcm->xtal_speed != sys_ck.rate) | ||
964 | continue; | ||
965 | |||
966 | if (prcm->mpu_speed <= rate) { | ||
967 | found_speed = prcm->mpu_speed; | ||
968 | break; | ||
969 | } | ||
970 | } | ||
971 | |||
972 | if (!found_speed) { | ||
973 | printk(KERN_INFO "Could not set MPU rate to %luMHz\n", | ||
974 | rate / 1000000); | ||
975 | return -EINVAL; | 683 | return -EINVAL; |
976 | } | ||
977 | |||
978 | curr_prcm_set = prcm; | ||
979 | cur_rate = omap2_get_dpll_rate(&dpll_ck); | ||
980 | |||
981 | if (prcm->dpll_speed == cur_rate / 2) { | ||
982 | omap2_reprogram_sdrc(PRCM_HALF_SPEED, 1); | ||
983 | } else if (prcm->dpll_speed == cur_rate * 2) { | ||
984 | omap2_reprogram_sdrc(PRCM_FULL_SPEED, 1); | ||
985 | } else if (prcm->dpll_speed != cur_rate) { | ||
986 | local_irq_save(flags); | ||
987 | 684 | ||
988 | if (prcm->dpll_speed == prcm->xtal_speed) | 685 | field_val = omap2_clksel_get_src_field(&src_addr, new_parent, |
989 | bypass = 1; | 686 | &field_mask, clk, &parent_div); |
687 | if (src_addr == 0) | ||
688 | return -EINVAL; | ||
990 | 689 | ||
991 | if ((prcm->cm_clksel2_pll & 0x3) == 2) | 690 | if (clk->usecount > 0) |
992 | done_rate = PRCM_FULL_SPEED; | 691 | _omap2_clk_disable(clk); |
993 | else | ||
994 | done_rate = PRCM_HALF_SPEED; | ||
995 | 692 | ||
996 | /* MPU divider */ | 693 | /* Set new source value (previous dividers if any in effect) */ |
997 | CM_CLKSEL_MPU = prcm->cm_clksel_mpu; | 694 | reg_val = __raw_readl(src_addr) & ~field_mask; |
695 | reg_val |= (field_val << __ffs(field_mask)); | ||
696 | __raw_writel(reg_val, src_addr); | ||
697 | wmb(); | ||
998 | 698 | ||
999 | /* dsp + iva1 div(2420), iva2.1(2430) */ | 699 | if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) { |
1000 | CM_CLKSEL_DSP = prcm->cm_clksel_dsp; | 700 | __raw_writel(OMAP24XX_VALID_CONFIG, OMAP24XX_PRCM_CLKCFG_CTRL); |
701 | wmb(); | ||
702 | } | ||
1001 | 703 | ||
1002 | CM_CLKSEL_GFX = prcm->cm_clksel_gfx; | 704 | if (clk->usecount > 0) |
705 | _omap2_clk_enable(clk); | ||
1003 | 706 | ||
1004 | /* Major subsystem dividers */ | 707 | clk->parent = new_parent; |
1005 | CM_CLKSEL1_CORE = prcm->cm_clksel1_core; | ||
1006 | if (cpu_is_omap2430()) | ||
1007 | CM_CLKSEL_MDM = prcm->cm_clksel_mdm; | ||
1008 | 708 | ||
1009 | /* x2 to enter init_mem */ | 709 | /* CLKSEL clocks follow their parents' rates, divided by a divisor */ |
1010 | omap2_reprogram_sdrc(PRCM_FULL_SPEED, 1); | 710 | clk->rate = new_parent->rate; |
1011 | 711 | ||
1012 | omap2_set_prcm(prcm->cm_clksel1_pll, prcm->base_sdrc_rfr, | 712 | if (parent_div > 0) |
1013 | bypass); | 713 | clk->rate /= parent_div; |
1014 | 714 | ||
1015 | omap2_init_memory_params(omap2_dll_force_needed()); | 715 | pr_debug("clock: set parent of %s to %s (new rate %ld)\n", |
1016 | omap2_reprogram_sdrc(done_rate, 0); | 716 | clk->name, clk->parent->name, clk->rate); |
1017 | 717 | ||
1018 | local_irq_restore(flags); | 718 | if (unlikely(clk->flags & RATE_PROPAGATES)) |
1019 | } | 719 | propagate_rate(clk); |
1020 | omap2_clksel_recalc(&dpll_ck); | ||
1021 | 720 | ||
1022 | return 0; | 721 | return 0; |
1023 | } | 722 | } |
@@ -1027,150 +726,17 @@ static int omap2_select_table_rate(struct clk * clk, unsigned long rate) | |||
1027 | *-------------------------------------------------------------------------*/ | 726 | *-------------------------------------------------------------------------*/ |
1028 | 727 | ||
1029 | #ifdef CONFIG_OMAP_RESET_CLOCKS | 728 | #ifdef CONFIG_OMAP_RESET_CLOCKS |
1030 | static void __init omap2_clk_disable_unused(struct clk *clk) | 729 | void omap2_clk_disable_unused(struct clk *clk) |
1031 | { | 730 | { |
1032 | u32 regval32; | 731 | u32 regval32, v; |
732 | |||
733 | v = (clk->flags & INVERT_ENABLE) ? (1 << clk->enable_bit) : 0; | ||
1033 | 734 | ||
1034 | regval32 = __raw_readl(clk->enable_reg); | 735 | regval32 = __raw_readl(clk->enable_reg); |
1035 | if ((regval32 & (1 << clk->enable_bit)) == 0) | 736 | if ((regval32 & (1 << clk->enable_bit)) == v) |
1036 | return; | 737 | return; |
1037 | 738 | ||
1038 | printk(KERN_INFO "Disabling unused clock \"%s\"\n", clk->name); | 739 | printk(KERN_INFO "Disabling unused clock \"%s\"\n", clk->name); |
1039 | _omap2_clk_disable(clk); | 740 | _omap2_clk_disable(clk); |
1040 | } | 741 | } |
1041 | #else | ||
1042 | #define omap2_clk_disable_unused NULL | ||
1043 | #endif | 742 | #endif |
1044 | |||
1045 | static struct clk_functions omap2_clk_functions = { | ||
1046 | .clk_enable = omap2_clk_enable, | ||
1047 | .clk_disable = omap2_clk_disable, | ||
1048 | .clk_round_rate = omap2_clk_round_rate, | ||
1049 | .clk_set_rate = omap2_clk_set_rate, | ||
1050 | .clk_set_parent = omap2_clk_set_parent, | ||
1051 | .clk_disable_unused = omap2_clk_disable_unused, | ||
1052 | }; | ||
1053 | |||
1054 | static void __init omap2_get_crystal_rate(struct clk *osc, struct clk *sys) | ||
1055 | { | ||
1056 | u32 div, aplls, sclk = 13000000; | ||
1057 | |||
1058 | aplls = CM_CLKSEL1_PLL; | ||
1059 | aplls &= ((1 << 23) | (1 << 24) | (1 << 25)); | ||
1060 | aplls >>= 23; /* Isolate field, 0,2,3 */ | ||
1061 | |||
1062 | if (aplls == 0) | ||
1063 | sclk = 19200000; | ||
1064 | else if (aplls == 2) | ||
1065 | sclk = 13000000; | ||
1066 | else if (aplls == 3) | ||
1067 | sclk = 12000000; | ||
1068 | |||
1069 | div = PRCM_CLKSRC_CTRL; | ||
1070 | div &= ((1 << 7) | (1 << 6)); | ||
1071 | div >>= sys->rate_offset; | ||
1072 | |||
1073 | osc->rate = sclk * div; | ||
1074 | sys->rate = sclk; | ||
1075 | } | ||
1076 | |||
1077 | /* | ||
1078 | * Set clocks for bypass mode for reboot to work. | ||
1079 | */ | ||
1080 | void omap2_clk_prepare_for_reboot(void) | ||
1081 | { | ||
1082 | u32 rate; | ||
1083 | |||
1084 | if (vclk == NULL || sclk == NULL) | ||
1085 | return; | ||
1086 | |||
1087 | rate = clk_get_rate(sclk); | ||
1088 | clk_set_rate(vclk, rate); | ||
1089 | } | ||
1090 | |||
1091 | /* | ||
1092 | * Switch the MPU rate if specified on cmdline. | ||
1093 | * We cannot do this early until cmdline is parsed. | ||
1094 | */ | ||
1095 | static int __init omap2_clk_arch_init(void) | ||
1096 | { | ||
1097 | if (!mpurate) | ||
1098 | return -EINVAL; | ||
1099 | |||
1100 | if (omap2_select_table_rate(&virt_prcm_set, mpurate)) | ||
1101 | printk(KERN_ERR "Could not find matching MPU rate\n"); | ||
1102 | |||
1103 | propagate_rate(&osc_ck); /* update main root fast */ | ||
1104 | propagate_rate(&func_32k_ck); /* update main root slow */ | ||
1105 | |||
1106 | printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL/MPU): " | ||
1107 | "%ld.%01ld/%ld/%ld MHz\n", | ||
1108 | (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10, | ||
1109 | (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ; | ||
1110 | |||
1111 | return 0; | ||
1112 | } | ||
1113 | arch_initcall(omap2_clk_arch_init); | ||
1114 | |||
1115 | int __init omap2_clk_init(void) | ||
1116 | { | ||
1117 | struct prcm_config *prcm; | ||
1118 | struct clk ** clkp; | ||
1119 | u32 clkrate; | ||
1120 | |||
1121 | clk_init(&omap2_clk_functions); | ||
1122 | omap2_get_crystal_rate(&osc_ck, &sys_ck); | ||
1123 | |||
1124 | for (clkp = onchip_clks; clkp < onchip_clks + ARRAY_SIZE(onchip_clks); | ||
1125 | clkp++) { | ||
1126 | |||
1127 | if ((*clkp)->flags & CLOCK_IN_OMAP242X && cpu_is_omap2420()) { | ||
1128 | clk_register(*clkp); | ||
1129 | continue; | ||
1130 | } | ||
1131 | |||
1132 | if ((*clkp)->flags & CLOCK_IN_OMAP243X && cpu_is_omap2430()) { | ||
1133 | clk_register(*clkp); | ||
1134 | continue; | ||
1135 | } | ||
1136 | } | ||
1137 | |||
1138 | /* Check the MPU rate set by bootloader */ | ||
1139 | clkrate = omap2_get_dpll_rate(&dpll_ck); | ||
1140 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
1141 | if (prcm->xtal_speed != sys_ck.rate) | ||
1142 | continue; | ||
1143 | if (prcm->dpll_speed <= clkrate) | ||
1144 | break; | ||
1145 | } | ||
1146 | curr_prcm_set = prcm; | ||
1147 | |||
1148 | propagate_rate(&osc_ck); /* update main root fast */ | ||
1149 | propagate_rate(&func_32k_ck); /* update main root slow */ | ||
1150 | |||
1151 | printk(KERN_INFO "Clocking rate (Crystal/DPLL/MPU): " | ||
1152 | "%ld.%01ld/%ld/%ld MHz\n", | ||
1153 | (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10, | ||
1154 | (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ; | ||
1155 | |||
1156 | /* | ||
1157 | * Only enable those clocks we will need, let the drivers | ||
1158 | * enable other clocks as necessary | ||
1159 | */ | ||
1160 | clk_enable(&sync_32k_ick); | ||
1161 | clk_enable(&omapctrl_ick); | ||
1162 | |||
1163 | /* Force the APLLs always active. The clocks are idled | ||
1164 | * automatically by hardware. */ | ||
1165 | clk_enable(&apll96_ck); | ||
1166 | clk_enable(&apll54_ck); | ||
1167 | |||
1168 | if (cpu_is_omap2430()) | ||
1169 | clk_enable(&sdrc_ick); | ||
1170 | |||
1171 | /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */ | ||
1172 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
1173 | sclk = clk_get(NULL, "sys_ck"); | ||
1174 | |||
1175 | return 0; | ||
1176 | } | ||
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 4f791866b910..d5980a9e09a4 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -1,13 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-omap24xx/clock.h | 2 | * linux/arch/arm/mach-omap2/clock.h |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Texas Instruments Inc. | 4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. |
5 | * Richard Woodruff <r-woodruff2@ti.com> | 5 | * Copyright (C) 2004-2008 Nokia Corporation |
6 | * Created for OMAP2. | ||
7 | * | 6 | * |
8 | * Copyright (C) 2004 Nokia corporation | 7 | * Contacts: |
9 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | 8 | * Richard Woodruff <r-woodruff2@ti.com> |
10 | * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc | 9 | * Paul Walmsley |
11 | * | 10 | * |
12 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
@@ -17,2095 +16,53 @@ | |||
17 | #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H | 16 | #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H |
18 | #define __ARCH_ARM_MACH_OMAP2_CLOCK_H | 17 | #define __ARCH_ARM_MACH_OMAP2_CLOCK_H |
19 | 18 | ||
20 | static void omap2_sys_clk_recalc(struct clk * clk); | 19 | #include <asm/arch/clock.h> |
21 | static void omap2_clksel_recalc(struct clk * clk); | ||
22 | static void omap2_followparent_recalc(struct clk * clk); | ||
23 | static void omap2_propagate_rate(struct clk * clk); | ||
24 | static void omap2_mpu_recalc(struct clk * clk); | ||
25 | static int omap2_select_table_rate(struct clk * clk, unsigned long rate); | ||
26 | static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate); | ||
27 | static void omap2_clk_disable(struct clk *clk); | ||
28 | static void omap2_sys_clk_recalc(struct clk * clk); | ||
29 | static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val); | ||
30 | static u32 omap2_clksel_get_divisor(struct clk *clk); | ||
31 | |||
32 | |||
33 | #define RATE_IN_242X (1 << 0) | ||
34 | #define RATE_IN_243X (1 << 1) | ||
35 | |||
36 | /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | ||
37 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP | ||
38 | * CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL CM_CLKSEL2_PLL, CM_CLKSEL_MDM | ||
39 | */ | ||
40 | struct prcm_config { | ||
41 | unsigned long xtal_speed; /* crystal rate */ | ||
42 | unsigned long dpll_speed; /* dpll: out*xtal*M/(N-1)table_recalc */ | ||
43 | unsigned long mpu_speed; /* speed of MPU */ | ||
44 | unsigned long cm_clksel_mpu; /* mpu divider */ | ||
45 | unsigned long cm_clksel_dsp; /* dsp+iva1 div(2420), iva2.1(2430) */ | ||
46 | unsigned long cm_clksel_gfx; /* gfx dividers */ | ||
47 | unsigned long cm_clksel1_core; /* major subsystem dividers */ | ||
48 | unsigned long cm_clksel1_pll; /* m,n */ | ||
49 | unsigned long cm_clksel2_pll; /* dpllx1 or x2 out */ | ||
50 | unsigned long cm_clksel_mdm; /* modem dividers 2430 only */ | ||
51 | unsigned long base_sdrc_rfr; /* base refresh timing for a set */ | ||
52 | unsigned char flags; | ||
53 | }; | ||
54 | |||
55 | /* Mask for clksel which support parent settign in set_rate */ | ||
56 | #define SRC_SEL_MASK (CM_CORE_SEL1 | CM_CORE_SEL2 | CM_WKUP_SEL1 | \ | ||
57 | CM_PLL_SEL1 | CM_PLL_SEL2 | CM_SYSCLKOUT_SEL1) | ||
58 | |||
59 | /* Mask for clksel regs which support rate operations */ | ||
60 | #define SRC_RATE_SEL_MASK (CM_MPU_SEL1 | CM_DSP_SEL1 | CM_GFX_SEL1 | \ | ||
61 | CM_MODEM_SEL1 | CM_CORE_SEL1 | CM_CORE_SEL2 | \ | ||
62 | CM_WKUP_SEL1 | CM_PLL_SEL1 | CM_PLL_SEL2 | \ | ||
63 | CM_SYSCLKOUT_SEL1) | ||
64 | |||
65 | /* | ||
66 | * The OMAP2 processor can be run at several discrete 'PRCM configurations'. | ||
67 | * These configurations are characterized by voltage and speed for clocks. | ||
68 | * The device is only validated for certain combinations. One way to express | ||
69 | * these combinations is via the 'ratio's' which the clocks operate with | ||
70 | * respect to each other. These ratio sets are for a given voltage/DPLL | ||
71 | * setting. All configurations can be described by a DPLL setting and a ratio | ||
72 | * There are 3 ratio sets for the 2430 and X ratio sets for 2420. | ||
73 | * | ||
74 | * 2430 differs from 2420 in that there are no more phase synchronizers used. | ||
75 | * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs | ||
76 | * 2430 (iva2.1, NOdsp, mdm) | ||
77 | */ | ||
78 | |||
79 | /* Core fields for cm_clksel, not ratio governed */ | ||
80 | #define RX_CLKSEL_DSS1 (0x10 << 8) | ||
81 | #define RX_CLKSEL_DSS2 (0x0 << 13) | ||
82 | #define RX_CLKSEL_SSI (0x5 << 20) | ||
83 | |||
84 | /*------------------------------------------------------------------------- | ||
85 | * Voltage/DPLL ratios | ||
86 | *-------------------------------------------------------------------------*/ | ||
87 | |||
88 | /* 2430 Ratio's, 2430-Ratio Config 1 */ | ||
89 | #define R1_CLKSEL_L3 (4 << 0) | ||
90 | #define R1_CLKSEL_L4 (2 << 5) | ||
91 | #define R1_CLKSEL_USB (4 << 25) | ||
92 | #define R1_CM_CLKSEL1_CORE_VAL R1_CLKSEL_USB | RX_CLKSEL_SSI | \ | ||
93 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
94 | R1_CLKSEL_L4 | R1_CLKSEL_L3 | ||
95 | #define R1_CLKSEL_MPU (2 << 0) | ||
96 | #define R1_CM_CLKSEL_MPU_VAL R1_CLKSEL_MPU | ||
97 | #define R1_CLKSEL_DSP (2 << 0) | ||
98 | #define R1_CLKSEL_DSP_IF (2 << 5) | ||
99 | #define R1_CM_CLKSEL_DSP_VAL R1_CLKSEL_DSP | R1_CLKSEL_DSP_IF | ||
100 | #define R1_CLKSEL_GFX (2 << 0) | ||
101 | #define R1_CM_CLKSEL_GFX_VAL R1_CLKSEL_GFX | ||
102 | #define R1_CLKSEL_MDM (4 << 0) | ||
103 | #define R1_CM_CLKSEL_MDM_VAL R1_CLKSEL_MDM | ||
104 | |||
105 | /* 2430-Ratio Config 2 */ | ||
106 | #define R2_CLKSEL_L3 (6 << 0) | ||
107 | #define R2_CLKSEL_L4 (2 << 5) | ||
108 | #define R2_CLKSEL_USB (2 << 25) | ||
109 | #define R2_CM_CLKSEL1_CORE_VAL R2_CLKSEL_USB | RX_CLKSEL_SSI | \ | ||
110 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
111 | R2_CLKSEL_L4 | R2_CLKSEL_L3 | ||
112 | #define R2_CLKSEL_MPU (2 << 0) | ||
113 | #define R2_CM_CLKSEL_MPU_VAL R2_CLKSEL_MPU | ||
114 | #define R2_CLKSEL_DSP (2 << 0) | ||
115 | #define R2_CLKSEL_DSP_IF (3 << 5) | ||
116 | #define R2_CM_CLKSEL_DSP_VAL R2_CLKSEL_DSP | R2_CLKSEL_DSP_IF | ||
117 | #define R2_CLKSEL_GFX (2 << 0) | ||
118 | #define R2_CM_CLKSEL_GFX_VAL R2_CLKSEL_GFX | ||
119 | #define R2_CLKSEL_MDM (6 << 0) | ||
120 | #define R2_CM_CLKSEL_MDM_VAL R2_CLKSEL_MDM | ||
121 | |||
122 | /* 2430-Ratio Bootm (BYPASS) */ | ||
123 | #define RB_CLKSEL_L3 (1 << 0) | ||
124 | #define RB_CLKSEL_L4 (1 << 5) | ||
125 | #define RB_CLKSEL_USB (1 << 25) | ||
126 | #define RB_CM_CLKSEL1_CORE_VAL RB_CLKSEL_USB | RX_CLKSEL_SSI | \ | ||
127 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
128 | RB_CLKSEL_L4 | RB_CLKSEL_L3 | ||
129 | #define RB_CLKSEL_MPU (1 << 0) | ||
130 | #define RB_CM_CLKSEL_MPU_VAL RB_CLKSEL_MPU | ||
131 | #define RB_CLKSEL_DSP (1 << 0) | ||
132 | #define RB_CLKSEL_DSP_IF (1 << 5) | ||
133 | #define RB_CM_CLKSEL_DSP_VAL RB_CLKSEL_DSP | RB_CLKSEL_DSP_IF | ||
134 | #define RB_CLKSEL_GFX (1 << 0) | ||
135 | #define RB_CM_CLKSEL_GFX_VAL RB_CLKSEL_GFX | ||
136 | #define RB_CLKSEL_MDM (1 << 0) | ||
137 | #define RB_CM_CLKSEL_MDM_VAL RB_CLKSEL_MDM | ||
138 | |||
139 | /* 2420 Ratio Equivalents */ | ||
140 | #define RXX_CLKSEL_VLYNQ (0x12 << 15) | ||
141 | #define RXX_CLKSEL_SSI (0x8 << 20) | ||
142 | |||
143 | /* 2420-PRCM III 532MHz core */ | ||
144 | #define RIII_CLKSEL_L3 (4 << 0) /* 133MHz */ | ||
145 | #define RIII_CLKSEL_L4 (2 << 5) /* 66.5MHz */ | ||
146 | #define RIII_CLKSEL_USB (4 << 25) /* 33.25MHz */ | ||
147 | #define RIII_CM_CLKSEL1_CORE_VAL RIII_CLKSEL_USB | RXX_CLKSEL_SSI | \ | ||
148 | RXX_CLKSEL_VLYNQ | RX_CLKSEL_DSS2 | \ | ||
149 | RX_CLKSEL_DSS1 | RIII_CLKSEL_L4 | \ | ||
150 | RIII_CLKSEL_L3 | ||
151 | #define RIII_CLKSEL_MPU (2 << 0) /* 266MHz */ | ||
152 | #define RIII_CM_CLKSEL_MPU_VAL RIII_CLKSEL_MPU | ||
153 | #define RIII_CLKSEL_DSP (3 << 0) /* c5x - 177.3MHz */ | ||
154 | #define RIII_CLKSEL_DSP_IF (2 << 5) /* c5x - 88.67MHz */ | ||
155 | #define RIII_SYNC_DSP (1 << 7) /* Enable sync */ | ||
156 | #define RIII_CLKSEL_IVA (6 << 8) /* iva1 - 88.67MHz */ | ||
157 | #define RIII_SYNC_IVA (1 << 13) /* Enable sync */ | ||
158 | #define RIII_CM_CLKSEL_DSP_VAL RIII_SYNC_IVA | RIII_CLKSEL_IVA | \ | ||
159 | RIII_SYNC_DSP | RIII_CLKSEL_DSP_IF | \ | ||
160 | RIII_CLKSEL_DSP | ||
161 | #define RIII_CLKSEL_GFX (2 << 0) /* 66.5MHz */ | ||
162 | #define RIII_CM_CLKSEL_GFX_VAL RIII_CLKSEL_GFX | ||
163 | |||
164 | /* 2420-PRCM II 600MHz core */ | ||
165 | #define RII_CLKSEL_L3 (6 << 0) /* 100MHz */ | ||
166 | #define RII_CLKSEL_L4 (2 << 5) /* 50MHz */ | ||
167 | #define RII_CLKSEL_USB (2 << 25) /* 50MHz */ | ||
168 | #define RII_CM_CLKSEL1_CORE_VAL RII_CLKSEL_USB | \ | ||
169 | RXX_CLKSEL_SSI | RXX_CLKSEL_VLYNQ | \ | ||
170 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
171 | RII_CLKSEL_L4 | RII_CLKSEL_L3 | ||
172 | #define RII_CLKSEL_MPU (2 << 0) /* 300MHz */ | ||
173 | #define RII_CM_CLKSEL_MPU_VAL RII_CLKSEL_MPU | ||
174 | #define RII_CLKSEL_DSP (3 << 0) /* c5x - 200MHz */ | ||
175 | #define RII_CLKSEL_DSP_IF (2 << 5) /* c5x - 100MHz */ | ||
176 | #define RII_SYNC_DSP (0 << 7) /* Bypass sync */ | ||
177 | #define RII_CLKSEL_IVA (6 << 8) /* iva1 - 200MHz */ | ||
178 | #define RII_SYNC_IVA (0 << 13) /* Bypass sync */ | ||
179 | #define RII_CM_CLKSEL_DSP_VAL RII_SYNC_IVA | RII_CLKSEL_IVA | \ | ||
180 | RII_SYNC_DSP | RII_CLKSEL_DSP_IF | \ | ||
181 | RII_CLKSEL_DSP | ||
182 | #define RII_CLKSEL_GFX (2 << 0) /* 50MHz */ | ||
183 | #define RII_CM_CLKSEL_GFX_VAL RII_CLKSEL_GFX | ||
184 | |||
185 | /* 2420-PRCM VII (boot) */ | ||
186 | #define RVII_CLKSEL_L3 (1 << 0) | ||
187 | #define RVII_CLKSEL_L4 (1 << 5) | ||
188 | #define RVII_CLKSEL_DSS1 (1 << 8) | ||
189 | #define RVII_CLKSEL_DSS2 (0 << 13) | ||
190 | #define RVII_CLKSEL_VLYNQ (1 << 15) | ||
191 | #define RVII_CLKSEL_SSI (1 << 20) | ||
192 | #define RVII_CLKSEL_USB (1 << 25) | ||
193 | |||
194 | #define RVII_CM_CLKSEL1_CORE_VAL RVII_CLKSEL_USB | RVII_CLKSEL_SSI | \ | ||
195 | RVII_CLKSEL_VLYNQ | RVII_CLKSEL_DSS2 | \ | ||
196 | RVII_CLKSEL_DSS1 | RVII_CLKSEL_L4 | RVII_CLKSEL_L3 | ||
197 | |||
198 | #define RVII_CLKSEL_MPU (1 << 0) /* all divide by 1 */ | ||
199 | #define RVII_CM_CLKSEL_MPU_VAL RVII_CLKSEL_MPU | ||
200 | 20 | ||
201 | #define RVII_CLKSEL_DSP (1 << 0) | 21 | int omap2_clk_enable(struct clk *clk); |
202 | #define RVII_CLKSEL_DSP_IF (1 << 5) | 22 | void omap2_clk_disable(struct clk *clk); |
203 | #define RVII_SYNC_DSP (0 << 7) | 23 | long omap2_clk_round_rate(struct clk *clk, unsigned long rate); |
204 | #define RVII_CLKSEL_IVA (1 << 8) | 24 | int omap2_clk_set_rate(struct clk *clk, unsigned long rate); |
205 | #define RVII_SYNC_IVA (0 << 13) | 25 | int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); |
206 | #define RVII_CM_CLKSEL_DSP_VAL RVII_SYNC_IVA | RVII_CLKSEL_IVA | RVII_SYNC_DSP | \ | ||
207 | RVII_CLKSEL_DSP_IF | RVII_CLKSEL_DSP | ||
208 | |||
209 | #define RVII_CLKSEL_GFX (1 << 0) | ||
210 | #define RVII_CM_CLKSEL_GFX_VAL RVII_CLKSEL_GFX | ||
211 | |||
212 | /*------------------------------------------------------------------------- | ||
213 | * 2430 Target modes: Along with each configuration the CPU has several | ||
214 | * modes which goes along with them. Modes mainly are the addition of | ||
215 | * describe DPLL combinations to go along with a ratio. | ||
216 | *-------------------------------------------------------------------------*/ | ||
217 | |||
218 | /* Hardware governed */ | ||
219 | #define MX_48M_SRC (0 << 3) | ||
220 | #define MX_54M_SRC (0 << 5) | ||
221 | #define MX_APLLS_CLIKIN_12 (3 << 23) | ||
222 | #define MX_APLLS_CLIKIN_13 (2 << 23) | ||
223 | #define MX_APLLS_CLIKIN_19_2 (0 << 23) | ||
224 | |||
225 | /* | ||
226 | * 2430 - standalone, 2*ref*M/(n+1), M/N is for exactness not relock speed | ||
227 | * #2 (ratio1) baseport-target | ||
228 | * #5a (ratio1) baseport-target, target DPLL = 266*2 = 532MHz | ||
229 | */ | ||
230 | #define M5A_DPLL_MULT_12 (133 << 12) | ||
231 | #define M5A_DPLL_DIV_12 (5 << 8) | ||
232 | #define M5A_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
233 | M5A_DPLL_DIV_12 | M5A_DPLL_MULT_12 | \ | ||
234 | MX_APLLS_CLIKIN_12 | ||
235 | #define M5A_DPLL_MULT_13 (266 << 12) | ||
236 | #define M5A_DPLL_DIV_13 (12 << 8) | ||
237 | #define M5A_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
238 | M5A_DPLL_DIV_13 | M5A_DPLL_MULT_13 | \ | ||
239 | MX_APLLS_CLIKIN_13 | ||
240 | #define M5A_DPLL_MULT_19 (180 << 12) | ||
241 | #define M5A_DPLL_DIV_19 (12 << 8) | ||
242 | #define M5A_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
243 | M5A_DPLL_DIV_19 | M5A_DPLL_MULT_19 | \ | ||
244 | MX_APLLS_CLIKIN_19_2 | ||
245 | /* #5b (ratio1) target DPLL = 200*2 = 400MHz */ | ||
246 | #define M5B_DPLL_MULT_12 (50 << 12) | ||
247 | #define M5B_DPLL_DIV_12 (2 << 8) | ||
248 | #define M5B_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
249 | M5B_DPLL_DIV_12 | M5B_DPLL_MULT_12 | \ | ||
250 | MX_APLLS_CLIKIN_12 | ||
251 | #define M5B_DPLL_MULT_13 (200 << 12) | ||
252 | #define M5B_DPLL_DIV_13 (12 << 8) | ||
253 | |||
254 | #define M5B_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
255 | M5B_DPLL_DIV_13 | M5B_DPLL_MULT_13 | \ | ||
256 | MX_APLLS_CLIKIN_13 | ||
257 | #define M5B_DPLL_MULT_19 (125 << 12) | ||
258 | #define M5B_DPLL_DIV_19 (31 << 8) | ||
259 | #define M5B_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
260 | M5B_DPLL_DIV_19 | M5B_DPLL_MULT_19 | \ | ||
261 | MX_APLLS_CLIKIN_19_2 | ||
262 | /* | ||
263 | * #4 (ratio2) | ||
264 | * #3 (ratio2) baseport-target, target DPLL = 330*2 = 660MHz | ||
265 | */ | ||
266 | #define M3_DPLL_MULT_12 (55 << 12) | ||
267 | #define M3_DPLL_DIV_12 (1 << 8) | ||
268 | #define M3_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
269 | M3_DPLL_DIV_12 | M3_DPLL_MULT_12 | \ | ||
270 | MX_APLLS_CLIKIN_12 | ||
271 | #define M3_DPLL_MULT_13 (330 << 12) | ||
272 | #define M3_DPLL_DIV_13 (12 << 8) | ||
273 | #define M3_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
274 | M3_DPLL_DIV_13 | M3_DPLL_MULT_13 | \ | ||
275 | MX_APLLS_CLIKIN_13 | ||
276 | #define M3_DPLL_MULT_19 (275 << 12) | ||
277 | #define M3_DPLL_DIV_19 (15 << 8) | ||
278 | #define M3_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
279 | M3_DPLL_DIV_19 | M3_DPLL_MULT_19 | \ | ||
280 | MX_APLLS_CLIKIN_19_2 | ||
281 | /* boot (boot) */ | ||
282 | #define MB_DPLL_MULT (1 << 12) | ||
283 | #define MB_DPLL_DIV (0 << 8) | ||
284 | #define MB_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\ | ||
285 | MB_DPLL_MULT | MX_APLLS_CLIKIN_12 | ||
286 | |||
287 | #define MB_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\ | ||
288 | MB_DPLL_MULT | MX_APLLS_CLIKIN_13 | ||
289 | |||
290 | #define MB_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\ | ||
291 | MB_DPLL_MULT | MX_APLLS_CLIKIN_19 | ||
292 | |||
293 | /* | ||
294 | * 2430 - chassis (sedna) | ||
295 | * 165 (ratio1) same as above #2 | ||
296 | * 150 (ratio1) | ||
297 | * 133 (ratio2) same as above #4 | ||
298 | * 110 (ratio2) same as above #3 | ||
299 | * 104 (ratio2) | ||
300 | * boot (boot) | ||
301 | */ | ||
302 | |||
303 | /* | ||
304 | * 2420 Equivalent - mode registers | ||
305 | * PRCM II , target DPLL = 2*300MHz = 600MHz | ||
306 | */ | ||
307 | #define MII_DPLL_MULT_12 (50 << 12) | ||
308 | #define MII_DPLL_DIV_12 (1 << 8) | ||
309 | #define MII_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
310 | MII_DPLL_DIV_12 | MII_DPLL_MULT_12 | \ | ||
311 | MX_APLLS_CLIKIN_12 | ||
312 | #define MII_DPLL_MULT_13 (300 << 12) | ||
313 | #define MII_DPLL_DIV_13 (12 << 8) | ||
314 | #define MII_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
315 | MII_DPLL_DIV_13 | MII_DPLL_MULT_13 | \ | ||
316 | MX_APLLS_CLIKIN_13 | ||
317 | |||
318 | /* PRCM III target DPLL = 2*266 = 532MHz*/ | ||
319 | #define MIII_DPLL_MULT_12 (133 << 12) | ||
320 | #define MIII_DPLL_DIV_12 (5 << 8) | ||
321 | #define MIII_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
322 | MIII_DPLL_DIV_12 | MIII_DPLL_MULT_12 | \ | ||
323 | MX_APLLS_CLIKIN_12 | ||
324 | #define MIII_DPLL_MULT_13 (266 << 12) | ||
325 | #define MIII_DPLL_DIV_13 (12 << 8) | ||
326 | #define MIII_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
327 | MIII_DPLL_DIV_13 | MIII_DPLL_MULT_13 | \ | ||
328 | MX_APLLS_CLIKIN_13 | ||
329 | |||
330 | /* PRCM VII (boot bypass) */ | ||
331 | #define MVII_CM_CLKSEL1_PLL_12_VAL MB_CM_CLKSEL1_PLL_12_VAL | ||
332 | #define MVII_CM_CLKSEL1_PLL_13_VAL MB_CM_CLKSEL1_PLL_13_VAL | ||
333 | |||
334 | /* High and low operation value */ | ||
335 | #define MX_CLKSEL2_PLL_2x_VAL (2 << 0) | ||
336 | #define MX_CLKSEL2_PLL_1x_VAL (1 << 0) | ||
337 | |||
338 | /* | ||
339 | * These represent optimal values for common parts, it won't work for all. | ||
340 | * As long as you scale down, most parameters are still work, they just | ||
341 | * become sub-optimal. The RFR value goes in the opposite direction. If you | ||
342 | * don't adjust it down as your clock period increases the refresh interval | ||
343 | * will not be met. Setting all parameters for complete worst case may work, | ||
344 | * but may cut memory performance by 2x. Due to errata the DLLs need to be | ||
345 | * unlocked and their value needs run time calibration. A dynamic call is | ||
346 | * need for that as no single right value exists acorss production samples. | ||
347 | * | ||
348 | * Only the FULL speed values are given. Current code is such that rate | ||
349 | * changes must be made at DPLLoutx2. The actual value adjustment for low | ||
350 | * frequency operation will be handled by omap_set_performance() | ||
351 | * | ||
352 | * By having the boot loader boot up in the fastest L4 speed available likely | ||
353 | * will result in something which you can switch between. | ||
354 | */ | ||
355 | #define V24XX_SDRC_RFR_CTRL_133MHz (0x0003de00 | 1) | ||
356 | #define V24XX_SDRC_RFR_CTRL_100MHz (0x0002da01 | 1) | ||
357 | #define V24XX_SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */ | ||
358 | #define V24XX_SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */ | ||
359 | |||
360 | /* MPU speed defines */ | ||
361 | #define S12M 12000000 | ||
362 | #define S13M 13000000 | ||
363 | #define S19M 19200000 | ||
364 | #define S26M 26000000 | ||
365 | #define S100M 100000000 | ||
366 | #define S133M 133000000 | ||
367 | #define S150M 150000000 | ||
368 | #define S165M 165000000 | ||
369 | #define S200M 200000000 | ||
370 | #define S266M 266000000 | ||
371 | #define S300M 300000000 | ||
372 | #define S330M 330000000 | ||
373 | #define S400M 400000000 | ||
374 | #define S532M 532000000 | ||
375 | #define S600M 600000000 | ||
376 | #define S660M 660000000 | ||
377 | |||
378 | /*------------------------------------------------------------------------- | ||
379 | * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | ||
380 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, | ||
381 | * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, | ||
382 | * CM_CLKSEL2_PLL, CM_CLKSEL_MDM | ||
383 | * | ||
384 | * Filling in table based on H4 boards and 2430-SDPs variants available. | ||
385 | * There are quite a few more rates combinations which could be defined. | ||
386 | * | ||
387 | * When multiple values are defined the start up will try and choose the | ||
388 | * fastest one. If a 'fast' value is defined, then automatically, the /2 | ||
389 | * one should be included as it can be used. Generally having more that | ||
390 | * one fast set does not make sense, as static timings need to be changed | ||
391 | * to change the set. The exception is the bypass setting which is | ||
392 | * availble for low power bypass. | ||
393 | * | ||
394 | * Note: This table needs to be sorted, fastest to slowest. | ||
395 | *-------------------------------------------------------------------------*/ | ||
396 | static struct prcm_config rate_table[] = { | ||
397 | /* PRCM II - FAST */ | ||
398 | {S12M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */ | ||
399 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
400 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL, | ||
401 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_100MHz, | ||
402 | RATE_IN_242X}, | ||
403 | |||
404 | {S13M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */ | ||
405 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
406 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL, | ||
407 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_100MHz, | ||
408 | RATE_IN_242X}, | ||
409 | |||
410 | /* PRCM III - FAST */ | ||
411 | {S12M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */ | ||
412 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
413 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL, | ||
414 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_133MHz, | ||
415 | RATE_IN_242X}, | ||
416 | |||
417 | {S13M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */ | ||
418 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
419 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL, | ||
420 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_133MHz, | ||
421 | RATE_IN_242X}, | ||
422 | |||
423 | /* PRCM II - SLOW */ | ||
424 | {S12M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */ | ||
425 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
426 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL, | ||
427 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_100MHz, | ||
428 | RATE_IN_242X}, | ||
429 | |||
430 | {S13M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */ | ||
431 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
432 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL, | ||
433 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_100MHz, | ||
434 | RATE_IN_242X}, | ||
435 | |||
436 | /* PRCM III - SLOW */ | ||
437 | {S12M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */ | ||
438 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
439 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL, | ||
440 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_133MHz, | ||
441 | RATE_IN_242X}, | ||
442 | |||
443 | {S13M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */ | ||
444 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
445 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL, | ||
446 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_133MHz, | ||
447 | RATE_IN_242X}, | ||
448 | |||
449 | /* PRCM-VII (boot-bypass) */ | ||
450 | {S12M, S12M, S12M, RVII_CM_CLKSEL_MPU_VAL, /* 12MHz ARM*/ | ||
451 | RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL, | ||
452 | RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_12_VAL, | ||
453 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_BYPASS, | ||
454 | RATE_IN_242X}, | ||
455 | |||
456 | /* PRCM-VII (boot-bypass) */ | ||
457 | {S13M, S13M, S13M, RVII_CM_CLKSEL_MPU_VAL, /* 13MHz ARM */ | ||
458 | RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL, | ||
459 | RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_13_VAL, | ||
460 | MX_CLKSEL2_PLL_2x_VAL, 0, V24XX_SDRC_RFR_CTRL_BYPASS, | ||
461 | RATE_IN_242X}, | ||
462 | |||
463 | /* PRCM #3 - ratio2 (ES2) - FAST */ | ||
464 | {S13M, S660M, S330M, R2_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */ | ||
465 | R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL, | ||
466 | R2_CM_CLKSEL1_CORE_VAL, M3_CM_CLKSEL1_PLL_13_VAL, | ||
467 | MX_CLKSEL2_PLL_2x_VAL, R2_CM_CLKSEL_MDM_VAL, | ||
468 | V24XX_SDRC_RFR_CTRL_110MHz, | ||
469 | RATE_IN_243X}, | ||
470 | |||
471 | /* PRCM #5a - ratio1 - FAST */ | ||
472 | {S13M, S532M, S266M, R1_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */ | ||
473 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
474 | R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL, | ||
475 | MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
476 | V24XX_SDRC_RFR_CTRL_133MHz, | ||
477 | RATE_IN_243X}, | ||
478 | |||
479 | /* PRCM #5b - ratio1 - FAST */ | ||
480 | {S13M, S400M, S200M, R1_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */ | ||
481 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
482 | R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL, | ||
483 | MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
484 | V24XX_SDRC_RFR_CTRL_100MHz, | ||
485 | RATE_IN_243X}, | ||
486 | |||
487 | /* PRCM #3 - ratio2 (ES2) - SLOW */ | ||
488 | {S13M, S330M, S165M, R2_CM_CLKSEL_MPU_VAL, /* 165MHz ARM */ | ||
489 | R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL, | ||
490 | R2_CM_CLKSEL1_CORE_VAL, M3_CM_CLKSEL1_PLL_13_VAL, | ||
491 | MX_CLKSEL2_PLL_1x_VAL, R2_CM_CLKSEL_MDM_VAL, | ||
492 | V24XX_SDRC_RFR_CTRL_110MHz, | ||
493 | RATE_IN_243X}, | ||
494 | |||
495 | /* PRCM #5a - ratio1 - SLOW */ | ||
496 | {S13M, S266M, S133M, R1_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */ | ||
497 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
498 | R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL, | ||
499 | MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
500 | V24XX_SDRC_RFR_CTRL_133MHz, | ||
501 | RATE_IN_243X}, | ||
502 | |||
503 | /* PRCM #5b - ratio1 - SLOW*/ | ||
504 | {S13M, S200M, S100M, R1_CM_CLKSEL_MPU_VAL, /* 100MHz ARM */ | ||
505 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
506 | R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL, | ||
507 | MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
508 | V24XX_SDRC_RFR_CTRL_100MHz, | ||
509 | RATE_IN_243X}, | ||
510 | |||
511 | /* PRCM-boot/bypass */ | ||
512 | {S13M, S13M, S13M, RB_CM_CLKSEL_MPU_VAL, /* 13Mhz */ | ||
513 | RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL, | ||
514 | RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_13_VAL, | ||
515 | MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL, | ||
516 | V24XX_SDRC_RFR_CTRL_BYPASS, | ||
517 | RATE_IN_243X}, | ||
518 | |||
519 | /* PRCM-boot/bypass */ | ||
520 | {S12M, S12M, S12M, RB_CM_CLKSEL_MPU_VAL, /* 12Mhz */ | ||
521 | RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL, | ||
522 | RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_12_VAL, | ||
523 | MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL, | ||
524 | V24XX_SDRC_RFR_CTRL_BYPASS, | ||
525 | RATE_IN_243X}, | ||
526 | |||
527 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | ||
528 | }; | ||
529 | |||
530 | /*------------------------------------------------------------------------- | ||
531 | * 24xx clock tree. | ||
532 | * | ||
533 | * NOTE:In many cases here we are assigning a 'default' parent. In many | ||
534 | * cases the parent is selectable. The get/set parent calls will also | ||
535 | * switch sources. | ||
536 | * | ||
537 | * Many some clocks say always_enabled, but they can be auto idled for | ||
538 | * power savings. They will always be available upon clock request. | ||
539 | * | ||
540 | * Several sources are given initial rates which may be wrong, this will | ||
541 | * be fixed up in the init func. | ||
542 | * | ||
543 | * Things are broadly separated below by clock domains. It is | ||
544 | * noteworthy that most periferals have dependencies on multiple clock | ||
545 | * domains. Many get their interface clocks from the L4 domain, but get | ||
546 | * functional clocks from fixed sources or other core domain derived | ||
547 | * clocks. | ||
548 | *-------------------------------------------------------------------------*/ | ||
549 | |||
550 | /* Base external input clocks */ | ||
551 | static struct clk func_32k_ck = { | ||
552 | .name = "func_32k_ck", | ||
553 | .rate = 32000, | ||
554 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
555 | RATE_FIXED | ALWAYS_ENABLED, | ||
556 | }; | ||
557 | |||
558 | /* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ | ||
559 | static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ | ||
560 | .name = "osc_ck", | ||
561 | .rate = 26000000, /* fixed up in clock init */ | ||
562 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
563 | RATE_FIXED | RATE_PROPAGATES, | ||
564 | }; | ||
565 | |||
566 | /* With out modem likely 12MHz, with modem likely 13MHz */ | ||
567 | static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */ | ||
568 | .name = "sys_ck", /* ~ ref_clk also */ | ||
569 | .parent = &osc_ck, | ||
570 | .rate = 13000000, | ||
571 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
572 | RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
573 | .rate_offset = 6, /* sysclkdiv 1 or 2, already handled or no boot */ | ||
574 | .recalc = &omap2_sys_clk_recalc, | ||
575 | }; | ||
576 | |||
577 | static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ | ||
578 | .name = "alt_ck", | ||
579 | .rate = 54000000, | ||
580 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
581 | RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
582 | .recalc = &omap2_propagate_rate, | ||
583 | }; | ||
584 | |||
585 | /* | ||
586 | * Analog domain root source clocks | ||
587 | */ | ||
588 | |||
589 | /* dpll_ck, is broken out in to special cases through clksel */ | ||
590 | static struct clk dpll_ck = { | ||
591 | .name = "dpll_ck", | ||
592 | .parent = &sys_ck, /* Can be func_32k also */ | ||
593 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
594 | RATE_PROPAGATES | RATE_CKCTL | CM_PLL_SEL1, | ||
595 | .recalc = &omap2_clksel_recalc, | ||
596 | }; | ||
597 | |||
598 | static struct clk apll96_ck = { | ||
599 | .name = "apll96_ck", | ||
600 | .parent = &sys_ck, | ||
601 | .rate = 96000000, | ||
602 | .flags = CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | | ||
603 | RATE_FIXED | RATE_PROPAGATES, | ||
604 | .enable_reg = (void __iomem *)&CM_CLKEN_PLL, | ||
605 | .enable_bit = 0x2, | ||
606 | .recalc = &omap2_propagate_rate, | ||
607 | }; | ||
608 | |||
609 | static struct clk apll54_ck = { | ||
610 | .name = "apll54_ck", | ||
611 | .parent = &sys_ck, | ||
612 | .rate = 54000000, | ||
613 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
614 | RATE_FIXED | RATE_PROPAGATES, | ||
615 | .enable_reg = (void __iomem *)&CM_CLKEN_PLL, | ||
616 | .enable_bit = 0x6, | ||
617 | .recalc = &omap2_propagate_rate, | ||
618 | }; | ||
619 | 26 | ||
620 | /* | 27 | #ifdef CONFIG_OMAP_RESET_CLOCKS |
621 | * PRCM digital base sources | 28 | void omap2_clk_disable_unused(struct clk *clk); |
622 | */ | 29 | #else |
623 | static struct clk func_54m_ck = { | 30 | #define omap2_clk_disable_unused NULL |
624 | .name = "func_54m_ck", | 31 | #endif |
625 | .parent = &apll54_ck, /* can also be alt_clk */ | ||
626 | .rate = 54000000, | ||
627 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
628 | RATE_FIXED | CM_PLL_SEL1 | RATE_PROPAGATES, | ||
629 | .src_offset = 5, | ||
630 | .enable_reg = (void __iomem *)&CM_CLKEN_PLL, | ||
631 | .enable_bit = 0xff, | ||
632 | .recalc = &omap2_propagate_rate, | ||
633 | }; | ||
634 | |||
635 | static struct clk core_ck = { | ||
636 | .name = "core_ck", | ||
637 | .parent = &dpll_ck, /* can also be 32k */ | ||
638 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
639 | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
640 | .recalc = &omap2_propagate_rate, | ||
641 | }; | ||
642 | |||
643 | static struct clk sleep_ck = { /* sys_clk or 32k */ | ||
644 | .name = "sleep_ck", | ||
645 | .parent = &func_32k_ck, | ||
646 | .rate = 32000, | ||
647 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
648 | .recalc = &omap2_propagate_rate, | ||
649 | }; | ||
650 | |||
651 | static struct clk func_96m_ck = { | ||
652 | .name = "func_96m_ck", | ||
653 | .parent = &apll96_ck, | ||
654 | .rate = 96000000, | ||
655 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
656 | RATE_FIXED | RATE_PROPAGATES, | ||
657 | .enable_reg = (void __iomem *)&CM_CLKEN_PLL, | ||
658 | .enable_bit = 0xff, | ||
659 | .recalc = &omap2_propagate_rate, | ||
660 | }; | ||
661 | |||
662 | static struct clk func_48m_ck = { | ||
663 | .name = "func_48m_ck", | ||
664 | .parent = &apll96_ck, /* 96M or Alt */ | ||
665 | .rate = 48000000, | ||
666 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
667 | RATE_FIXED | CM_PLL_SEL1 | RATE_PROPAGATES, | ||
668 | .src_offset = 3, | ||
669 | .enable_reg = (void __iomem *)&CM_CLKEN_PLL, | ||
670 | .enable_bit = 0xff, | ||
671 | .recalc = &omap2_propagate_rate, | ||
672 | }; | ||
673 | |||
674 | static struct clk func_12m_ck = { | ||
675 | .name = "func_12m_ck", | ||
676 | .parent = &func_48m_ck, | ||
677 | .rate = 12000000, | ||
678 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
679 | RATE_FIXED | RATE_PROPAGATES, | ||
680 | .recalc = &omap2_propagate_rate, | ||
681 | .enable_reg = (void __iomem *)&CM_CLKEN_PLL, | ||
682 | .enable_bit = 0xff, | ||
683 | }; | ||
684 | |||
685 | /* Secure timer, only available in secure mode */ | ||
686 | static struct clk wdt1_osc_ck = { | ||
687 | .name = "ck_wdt1_osc", | ||
688 | .parent = &osc_ck, | ||
689 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
690 | .recalc = &omap2_followparent_recalc, | ||
691 | }; | ||
692 | |||
693 | static struct clk sys_clkout = { | ||
694 | .name = "sys_clkout", | ||
695 | .parent = &func_54m_ck, | ||
696 | .rate = 54000000, | ||
697 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
698 | CM_SYSCLKOUT_SEL1 | RATE_CKCTL, | ||
699 | .src_offset = 0, | ||
700 | .enable_reg = (void __iomem *)&PRCM_CLKOUT_CTRL, | ||
701 | .enable_bit = 7, | ||
702 | .rate_offset = 3, | ||
703 | .recalc = &omap2_clksel_recalc, | ||
704 | }; | ||
705 | |||
706 | /* In 2430, new in 2420 ES2 */ | ||
707 | static struct clk sys_clkout2 = { | ||
708 | .name = "sys_clkout2", | ||
709 | .parent = &func_54m_ck, | ||
710 | .rate = 54000000, | ||
711 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
712 | CM_SYSCLKOUT_SEL1 | RATE_CKCTL, | ||
713 | .src_offset = 8, | ||
714 | .enable_reg = (void __iomem *)&PRCM_CLKOUT_CTRL, | ||
715 | .enable_bit = 15, | ||
716 | .rate_offset = 11, | ||
717 | .recalc = &omap2_clksel_recalc, | ||
718 | }; | ||
719 | |||
720 | static struct clk emul_ck = { | ||
721 | .name = "emul_ck", | ||
722 | .parent = &func_54m_ck, | ||
723 | .flags = CLOCK_IN_OMAP242X, | ||
724 | .enable_reg = (void __iomem *)&PRCM_CLKEMUL_CTRL, | ||
725 | .enable_bit = 0, | ||
726 | .recalc = &omap2_propagate_rate, | ||
727 | |||
728 | }; | ||
729 | |||
730 | /* | ||
731 | * MPU clock domain | ||
732 | * Clocks: | ||
733 | * MPU_FCLK, MPU_ICLK | ||
734 | * INT_M_FCLK, INT_M_I_CLK | ||
735 | * | ||
736 | * - Individual clocks are hardware managed. | ||
737 | * - Base divider comes from: CM_CLKSEL_MPU | ||
738 | * | ||
739 | */ | ||
740 | static struct clk mpu_ck = { /* Control cpu */ | ||
741 | .name = "mpu_ck", | ||
742 | .parent = &core_ck, | ||
743 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_CKCTL | | ||
744 | ALWAYS_ENABLED | CM_MPU_SEL1 | DELAYED_APP | | ||
745 | CONFIG_PARTICIPANT | RATE_PROPAGATES, | ||
746 | .rate_offset = 0, /* bits 0-4 */ | ||
747 | .recalc = &omap2_clksel_recalc, | ||
748 | }; | ||
749 | |||
750 | /* | ||
751 | * DSP (2430-IVA2.1) (2420-UMA+IVA1) clock domain | ||
752 | * Clocks: | ||
753 | * 2430: IVA2.1_FCLK, IVA2.1_ICLK | ||
754 | * 2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP | ||
755 | */ | ||
756 | static struct clk iva2_1_fck = { | ||
757 | .name = "iva2_1_fck", | ||
758 | .parent = &core_ck, | ||
759 | .flags = CLOCK_IN_OMAP243X | RATE_CKCTL | CM_DSP_SEL1 | | ||
760 | DELAYED_APP | RATE_PROPAGATES | | ||
761 | CONFIG_PARTICIPANT, | ||
762 | .rate_offset = 0, | ||
763 | .enable_reg = (void __iomem *)&CM_FCLKEN_DSP, | ||
764 | .enable_bit = 0, | ||
765 | .recalc = &omap2_clksel_recalc, | ||
766 | }; | ||
767 | |||
768 | static struct clk iva2_1_ick = { | ||
769 | .name = "iva2_1_ick", | ||
770 | .parent = &iva2_1_fck, | ||
771 | .flags = CLOCK_IN_OMAP243X | RATE_CKCTL | CM_DSP_SEL1 | | ||
772 | DELAYED_APP | CONFIG_PARTICIPANT, | ||
773 | .rate_offset = 5, | ||
774 | .recalc = &omap2_clksel_recalc, | ||
775 | }; | ||
776 | |||
777 | /* | ||
778 | * Won't be too specific here. The core clock comes into this block | ||
779 | * it is divided then tee'ed. One branch goes directly to xyz enable | ||
780 | * controls. The other branch gets further divided by 2 then possibly | ||
781 | * routed into a synchronizer and out of clocks abc. | ||
782 | */ | ||
783 | static struct clk dsp_fck = { | ||
784 | .name = "dsp_fck", | ||
785 | .parent = &core_ck, | ||
786 | .flags = CLOCK_IN_OMAP242X | RATE_CKCTL | CM_DSP_SEL1 | | ||
787 | DELAYED_APP | CONFIG_PARTICIPANT | RATE_PROPAGATES, | ||
788 | .rate_offset = 0, | ||
789 | .enable_reg = (void __iomem *)&CM_FCLKEN_DSP, | ||
790 | .enable_bit = 0, | ||
791 | .recalc = &omap2_clksel_recalc, | ||
792 | }; | ||
793 | |||
794 | static struct clk dsp_ick = { | ||
795 | .name = "dsp_ick", /* apparently ipi and isp */ | ||
796 | .parent = &dsp_fck, | ||
797 | .flags = CLOCK_IN_OMAP242X | RATE_CKCTL | CM_DSP_SEL1 | | ||
798 | DELAYED_APP | CONFIG_PARTICIPANT, | ||
799 | .rate_offset = 5, | ||
800 | .enable_reg = (void __iomem *)&CM_ICLKEN_DSP, | ||
801 | .enable_bit = 1, /* for ipi */ | ||
802 | .recalc = &omap2_clksel_recalc, | ||
803 | }; | ||
804 | |||
805 | static struct clk iva1_ifck = { | ||
806 | .name = "iva1_ifck", | ||
807 | .parent = &core_ck, | ||
808 | .flags = CLOCK_IN_OMAP242X | CM_DSP_SEL1 | RATE_CKCTL | | ||
809 | CONFIG_PARTICIPANT | RATE_PROPAGATES | DELAYED_APP, | ||
810 | .rate_offset= 8, | ||
811 | .enable_reg = (void __iomem *)&CM_FCLKEN_DSP, | ||
812 | .enable_bit = 10, | ||
813 | .recalc = &omap2_clksel_recalc, | ||
814 | }; | ||
815 | |||
816 | /* IVA1 mpu/int/i/f clocks are /2 of parent */ | ||
817 | static struct clk iva1_mpu_int_ifck = { | ||
818 | .name = "iva1_mpu_int_ifck", | ||
819 | .parent = &iva1_ifck, | ||
820 | .flags = CLOCK_IN_OMAP242X | RATE_CKCTL | CM_DSP_SEL1, | ||
821 | .enable_reg = (void __iomem *)&CM_FCLKEN_DSP, | ||
822 | .enable_bit = 8, | ||
823 | .recalc = &omap2_clksel_recalc, | ||
824 | }; | ||
825 | |||
826 | /* | ||
827 | * L3 clock domain | ||
828 | * L3 clocks are used for both interface and functional clocks to | ||
829 | * multiple entities. Some of these clocks are completely managed | ||
830 | * by hardware, and some others allow software control. Hardware | ||
831 | * managed ones general are based on directly CLK_REQ signals and | ||
832 | * various auto idle settings. The functional spec sets many of these | ||
833 | * as 'tie-high' for their enables. | ||
834 | * | ||
835 | * I-CLOCKS: | ||
836 | * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA | ||
837 | * CAM, HS-USB. | ||
838 | * F-CLOCK | ||
839 | * SSI. | ||
840 | * | ||
841 | * GPMC memories and SDRC have timing and clock sensitive registers which | ||
842 | * may very well need notification when the clock changes. Currently for low | ||
843 | * operating points, these are taken care of in sleep.S. | ||
844 | */ | ||
845 | static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */ | ||
846 | .name = "core_l3_ck", | ||
847 | .parent = &core_ck, | ||
848 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
849 | RATE_CKCTL | ALWAYS_ENABLED | CM_CORE_SEL1 | | ||
850 | DELAYED_APP | CONFIG_PARTICIPANT | | ||
851 | RATE_PROPAGATES, | ||
852 | .rate_offset = 0, | ||
853 | .recalc = &omap2_clksel_recalc, | ||
854 | }; | ||
855 | |||
856 | static struct clk usb_l4_ick = { /* FS-USB interface clock */ | ||
857 | .name = "usb_l4_ick", | ||
858 | .parent = &core_l3_ck, | ||
859 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
860 | RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP | | ||
861 | CONFIG_PARTICIPANT, | ||
862 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
863 | .enable_bit = 0, | ||
864 | .rate_offset = 25, | ||
865 | .recalc = &omap2_clksel_recalc, | ||
866 | }; | ||
867 | |||
868 | /* | ||
869 | * SSI is in L3 management domain, its direct parent is core not l3, | ||
870 | * many core power domain entities are grouped into the L3 clock | ||
871 | * domain. | ||
872 | * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_CLIK | ||
873 | * | ||
874 | * ssr = core/1/2/3/4/5, sst = 1/2 ssr. | ||
875 | */ | ||
876 | static struct clk ssi_ssr_sst_fck = { | ||
877 | .name = "ssi_fck", | ||
878 | .parent = &core_ck, | ||
879 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
880 | RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP, | ||
881 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, /* bit 1 */ | ||
882 | .enable_bit = 1, | ||
883 | .rate_offset = 20, | ||
884 | .recalc = &omap2_clksel_recalc, | ||
885 | }; | ||
886 | |||
887 | /* | ||
888 | * GFX clock domain | ||
889 | * Clocks: | ||
890 | * GFX_FCLK, GFX_ICLK | ||
891 | * GFX_CG1(2d), GFX_CG2(3d) | ||
892 | * | ||
893 | * GFX_FCLK runs from L3, and is divided by (1,2,3,4) | ||
894 | * The 2d and 3d clocks run at a hardware determined | ||
895 | * divided value of fclk. | ||
896 | * | ||
897 | */ | ||
898 | static struct clk gfx_3d_fck = { | ||
899 | .name = "gfx_3d_fck", | ||
900 | .parent = &core_l3_ck, | ||
901 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
902 | RATE_CKCTL | CM_GFX_SEL1, | ||
903 | .enable_reg = (void __iomem *)&CM_FCLKEN_GFX, | ||
904 | .enable_bit = 2, | ||
905 | .rate_offset= 0, | ||
906 | .recalc = &omap2_clksel_recalc, | ||
907 | }; | ||
908 | |||
909 | static struct clk gfx_2d_fck = { | ||
910 | .name = "gfx_2d_fck", | ||
911 | .parent = &core_l3_ck, | ||
912 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
913 | RATE_CKCTL | CM_GFX_SEL1, | ||
914 | .enable_reg = (void __iomem *)&CM_FCLKEN_GFX, | ||
915 | .enable_bit = 1, | ||
916 | .rate_offset= 0, | ||
917 | .recalc = &omap2_clksel_recalc, | ||
918 | }; | ||
919 | |||
920 | static struct clk gfx_ick = { | ||
921 | .name = "gfx_ick", /* From l3 */ | ||
922 | .parent = &core_l3_ck, | ||
923 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
924 | RATE_CKCTL, | ||
925 | .enable_reg = (void __iomem *)&CM_ICLKEN_GFX, /* bit 0 */ | ||
926 | .enable_bit = 0, | ||
927 | .recalc = &omap2_followparent_recalc, | ||
928 | }; | ||
929 | |||
930 | /* | ||
931 | * Modem clock domain (2430) | ||
932 | * CLOCKS: | ||
933 | * MDM_OSC_CLK | ||
934 | * MDM_ICLK | ||
935 | */ | ||
936 | static struct clk mdm_ick = { /* used both as a ick and fck */ | ||
937 | .name = "mdm_ick", | ||
938 | .parent = &core_ck, | ||
939 | .flags = CLOCK_IN_OMAP243X | RATE_CKCTL | CM_MODEM_SEL1 | | ||
940 | DELAYED_APP | CONFIG_PARTICIPANT, | ||
941 | .rate_offset = 0, | ||
942 | .enable_reg = (void __iomem *)&CM_ICLKEN_MDM, | ||
943 | .enable_bit = 0, | ||
944 | .recalc = &omap2_clksel_recalc, | ||
945 | }; | ||
946 | |||
947 | static struct clk mdm_osc_ck = { | ||
948 | .name = "mdm_osc_ck", | ||
949 | .rate = 26000000, | ||
950 | .parent = &osc_ck, | ||
951 | .flags = CLOCK_IN_OMAP243X | RATE_FIXED, | ||
952 | .enable_reg = (void __iomem *)&CM_FCLKEN_MDM, | ||
953 | .enable_bit = 1, | ||
954 | .recalc = &omap2_followparent_recalc, | ||
955 | }; | ||
956 | |||
957 | /* | ||
958 | * L4 clock management domain | ||
959 | * | ||
960 | * This domain contains lots of interface clocks from the L4 interface, some | ||
961 | * functional clocks. Fixed APLL functional source clocks are managed in | ||
962 | * this domain. | ||
963 | */ | ||
964 | static struct clk l4_ck = { /* used both as an ick and fck */ | ||
965 | .name = "l4_ck", | ||
966 | .parent = &core_l3_ck, | ||
967 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
968 | RATE_CKCTL | ALWAYS_ENABLED | CM_CORE_SEL1 | | ||
969 | DELAYED_APP | RATE_PROPAGATES, | ||
970 | .rate_offset = 5, | ||
971 | .recalc = &omap2_clksel_recalc, | ||
972 | }; | ||
973 | |||
974 | static struct clk ssi_l4_ick = { | ||
975 | .name = "ssi_l4_ick", | ||
976 | .parent = &l4_ck, | ||
977 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_CKCTL, | ||
978 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, /* bit 1 */ | ||
979 | .enable_bit = 1, | ||
980 | .recalc = &omap2_followparent_recalc, | ||
981 | }; | ||
982 | |||
983 | /* | ||
984 | * DSS clock domain | ||
985 | * CLOCKs: | ||
986 | * DSS_L4_ICLK, DSS_L3_ICLK, | ||
987 | * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK | ||
988 | * | ||
989 | * DSS is both initiator and target. | ||
990 | */ | ||
991 | static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ | ||
992 | .name = "dss_ick", | ||
993 | .parent = &l4_ck, /* really both l3 and l4 */ | ||
994 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_CKCTL, | ||
995 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
996 | .enable_bit = 0, | ||
997 | .recalc = &omap2_followparent_recalc, | ||
998 | }; | ||
999 | |||
1000 | static struct clk dss1_fck = { | ||
1001 | .name = "dss1_fck", | ||
1002 | .parent = &core_ck, /* Core or sys */ | ||
1003 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1004 | RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP, | ||
1005 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1006 | .enable_bit = 0, | ||
1007 | .rate_offset = 8, | ||
1008 | .src_offset = 8, | ||
1009 | .recalc = &omap2_clksel_recalc, | ||
1010 | }; | ||
1011 | |||
1012 | static struct clk dss2_fck = { /* Alt clk used in power management */ | ||
1013 | .name = "dss2_fck", | ||
1014 | .parent = &sys_ck, /* fixed at sys_ck or 48MHz */ | ||
1015 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1016 | RATE_CKCTL | CM_CORE_SEL1 | RATE_FIXED | | ||
1017 | DELAYED_APP, | ||
1018 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1019 | .enable_bit = 1, | ||
1020 | .src_offset = 13, | ||
1021 | .recalc = &omap2_followparent_recalc, | ||
1022 | }; | ||
1023 | |||
1024 | static struct clk dss_54m_fck = { /* Alt clk used in power management */ | ||
1025 | .name = "dss_54m_fck", /* 54m tv clk */ | ||
1026 | .parent = &func_54m_ck, | ||
1027 | .rate = 54000000, | ||
1028 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1029 | RATE_FIXED | RATE_PROPAGATES, | ||
1030 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1031 | .enable_bit = 2, | ||
1032 | .recalc = &omap2_propagate_rate, | ||
1033 | }; | ||
1034 | |||
1035 | /* | ||
1036 | * CORE power domain ICLK & FCLK defines. | ||
1037 | * Many of the these can have more than one possible parent. Entries | ||
1038 | * here will likely have an L4 interface parent, and may have multiple | ||
1039 | * functional clock parents. | ||
1040 | */ | ||
1041 | static struct clk gpt1_ick = { | ||
1042 | .name = "gpt1_ick", | ||
1043 | .parent = &l4_ck, | ||
1044 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1045 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit0 */ | ||
1046 | .enable_bit = 0, | ||
1047 | .recalc = &omap2_followparent_recalc, | ||
1048 | }; | ||
1049 | |||
1050 | static struct clk gpt1_fck = { | ||
1051 | .name = "gpt1_fck", | ||
1052 | .parent = &func_32k_ck, | ||
1053 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1054 | CM_WKUP_SEL1, | ||
1055 | .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, /* Bit0 */ | ||
1056 | .enable_bit = 0, | ||
1057 | .src_offset = 0, | ||
1058 | .recalc = &omap2_followparent_recalc, | ||
1059 | }; | ||
1060 | |||
1061 | static struct clk gpt2_ick = { | ||
1062 | .name = "gpt2_ick", | ||
1063 | .parent = &l4_ck, | ||
1064 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1065 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit4 */ | ||
1066 | .enable_bit = 4, | ||
1067 | .recalc = &omap2_followparent_recalc, | ||
1068 | }; | ||
1069 | |||
1070 | static struct clk gpt2_fck = { | ||
1071 | .name = "gpt2_fck", | ||
1072 | .parent = &func_32k_ck, | ||
1073 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1074 | CM_CORE_SEL2, | ||
1075 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1076 | .enable_bit = 4, | ||
1077 | .src_offset = 2, | ||
1078 | .recalc = &omap2_followparent_recalc, | ||
1079 | }; | ||
1080 | |||
1081 | static struct clk gpt3_ick = { | ||
1082 | .name = "gpt3_ick", | ||
1083 | .parent = &l4_ck, | ||
1084 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1085 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit5 */ | ||
1086 | .enable_bit = 5, | ||
1087 | .recalc = &omap2_followparent_recalc, | ||
1088 | }; | ||
1089 | |||
1090 | static struct clk gpt3_fck = { | ||
1091 | .name = "gpt3_fck", | ||
1092 | .parent = &func_32k_ck, | ||
1093 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1094 | CM_CORE_SEL2, | ||
1095 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1096 | .enable_bit = 5, | ||
1097 | .src_offset = 4, | ||
1098 | .recalc = &omap2_followparent_recalc, | ||
1099 | }; | ||
1100 | |||
1101 | static struct clk gpt4_ick = { | ||
1102 | .name = "gpt4_ick", | ||
1103 | .parent = &l4_ck, | ||
1104 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1105 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit6 */ | ||
1106 | .enable_bit = 6, | ||
1107 | .recalc = &omap2_followparent_recalc, | ||
1108 | }; | ||
1109 | |||
1110 | static struct clk gpt4_fck = { | ||
1111 | .name = "gpt4_fck", | ||
1112 | .parent = &func_32k_ck, | ||
1113 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1114 | CM_CORE_SEL2, | ||
1115 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1116 | .enable_bit = 6, | ||
1117 | .src_offset = 6, | ||
1118 | .recalc = &omap2_followparent_recalc, | ||
1119 | }; | ||
1120 | |||
1121 | static struct clk gpt5_ick = { | ||
1122 | .name = "gpt5_ick", | ||
1123 | .parent = &l4_ck, | ||
1124 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1125 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit7 */ | ||
1126 | .enable_bit = 7, | ||
1127 | .recalc = &omap2_followparent_recalc, | ||
1128 | }; | ||
1129 | |||
1130 | static struct clk gpt5_fck = { | ||
1131 | .name = "gpt5_fck", | ||
1132 | .parent = &func_32k_ck, | ||
1133 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1134 | CM_CORE_SEL2, | ||
1135 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1136 | .enable_bit = 7, | ||
1137 | .src_offset = 8, | ||
1138 | .recalc = &omap2_followparent_recalc, | ||
1139 | }; | ||
1140 | |||
1141 | static struct clk gpt6_ick = { | ||
1142 | .name = "gpt6_ick", | ||
1143 | .parent = &l4_ck, | ||
1144 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1145 | .enable_bit = 8, | ||
1146 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit8 */ | ||
1147 | .recalc = &omap2_followparent_recalc, | ||
1148 | }; | ||
1149 | |||
1150 | static struct clk gpt6_fck = { | ||
1151 | .name = "gpt6_fck", | ||
1152 | .parent = &func_32k_ck, | ||
1153 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1154 | CM_CORE_SEL2, | ||
1155 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1156 | .enable_bit = 8, | ||
1157 | .src_offset = 10, | ||
1158 | .recalc = &omap2_followparent_recalc, | ||
1159 | }; | ||
1160 | |||
1161 | static struct clk gpt7_ick = { | ||
1162 | .name = "gpt7_ick", | ||
1163 | .parent = &l4_ck, | ||
1164 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1165 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit9 */ | ||
1166 | .enable_bit = 9, | ||
1167 | .recalc = &omap2_followparent_recalc, | ||
1168 | }; | ||
1169 | |||
1170 | static struct clk gpt7_fck = { | ||
1171 | .name = "gpt7_fck", | ||
1172 | .parent = &func_32k_ck, | ||
1173 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1174 | CM_CORE_SEL2, | ||
1175 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1176 | .enable_bit = 9, | ||
1177 | .src_offset = 12, | ||
1178 | .recalc = &omap2_followparent_recalc, | ||
1179 | }; | ||
1180 | |||
1181 | static struct clk gpt8_ick = { | ||
1182 | .name = "gpt8_ick", | ||
1183 | .parent = &l4_ck, | ||
1184 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1185 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit10 */ | ||
1186 | .enable_bit = 10, | ||
1187 | .recalc = &omap2_followparent_recalc, | ||
1188 | }; | ||
1189 | |||
1190 | static struct clk gpt8_fck = { | ||
1191 | .name = "gpt8_fck", | ||
1192 | .parent = &func_32k_ck, | ||
1193 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1194 | CM_CORE_SEL2, | ||
1195 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1196 | .enable_bit = 10, | ||
1197 | .src_offset = 14, | ||
1198 | .recalc = &omap2_followparent_recalc, | ||
1199 | }; | ||
1200 | |||
1201 | static struct clk gpt9_ick = { | ||
1202 | .name = "gpt9_ick", | ||
1203 | .parent = &l4_ck, | ||
1204 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1205 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1206 | .enable_bit = 11, | ||
1207 | .recalc = &omap2_followparent_recalc, | ||
1208 | }; | ||
1209 | |||
1210 | static struct clk gpt9_fck = { | ||
1211 | .name = "gpt9_fck", | ||
1212 | .parent = &func_32k_ck, | ||
1213 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1214 | CM_CORE_SEL2, | ||
1215 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1216 | .enable_bit = 11, | ||
1217 | .src_offset = 16, | ||
1218 | .recalc = &omap2_followparent_recalc, | ||
1219 | }; | ||
1220 | |||
1221 | static struct clk gpt10_ick = { | ||
1222 | .name = "gpt10_ick", | ||
1223 | .parent = &l4_ck, | ||
1224 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1225 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1226 | .enable_bit = 12, | ||
1227 | .recalc = &omap2_followparent_recalc, | ||
1228 | }; | ||
1229 | |||
1230 | static struct clk gpt10_fck = { | ||
1231 | .name = "gpt10_fck", | ||
1232 | .parent = &func_32k_ck, | ||
1233 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1234 | CM_CORE_SEL2, | ||
1235 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1236 | .enable_bit = 12, | ||
1237 | .src_offset = 18, | ||
1238 | .recalc = &omap2_followparent_recalc, | ||
1239 | }; | ||
1240 | |||
1241 | static struct clk gpt11_ick = { | ||
1242 | .name = "gpt11_ick", | ||
1243 | .parent = &l4_ck, | ||
1244 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1245 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1246 | .enable_bit = 13, | ||
1247 | .recalc = &omap2_followparent_recalc, | ||
1248 | }; | ||
1249 | |||
1250 | static struct clk gpt11_fck = { | ||
1251 | .name = "gpt11_fck", | ||
1252 | .parent = &func_32k_ck, | ||
1253 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1254 | CM_CORE_SEL2, | ||
1255 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1256 | .enable_bit = 13, | ||
1257 | .src_offset = 20, | ||
1258 | .recalc = &omap2_followparent_recalc, | ||
1259 | }; | ||
1260 | |||
1261 | static struct clk gpt12_ick = { | ||
1262 | .name = "gpt12_ick", | ||
1263 | .parent = &l4_ck, | ||
1264 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1265 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit14 */ | ||
1266 | .enable_bit = 14, | ||
1267 | .recalc = &omap2_followparent_recalc, | ||
1268 | }; | ||
1269 | |||
1270 | static struct clk gpt12_fck = { | ||
1271 | .name = "gpt12_fck", | ||
1272 | .parent = &func_32k_ck, | ||
1273 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1274 | CM_CORE_SEL2, | ||
1275 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1276 | .enable_bit = 14, | ||
1277 | .src_offset = 22, | ||
1278 | .recalc = &omap2_followparent_recalc, | ||
1279 | }; | ||
1280 | |||
1281 | static struct clk mcbsp1_ick = { | ||
1282 | .name = "mcbsp1_ick", | ||
1283 | .parent = &l4_ck, | ||
1284 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1285 | .enable_bit = 15, | ||
1286 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit16 */ | ||
1287 | .recalc = &omap2_followparent_recalc, | ||
1288 | }; | ||
1289 | |||
1290 | static struct clk mcbsp1_fck = { | ||
1291 | .name = "mcbsp1_fck", | ||
1292 | .parent = &func_96m_ck, | ||
1293 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1294 | .enable_bit = 15, | ||
1295 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1296 | .recalc = &omap2_followparent_recalc, | ||
1297 | }; | ||
1298 | |||
1299 | static struct clk mcbsp2_ick = { | ||
1300 | .name = "mcbsp2_ick", | ||
1301 | .parent = &l4_ck, | ||
1302 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1303 | .enable_bit = 16, | ||
1304 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1305 | .recalc = &omap2_followparent_recalc, | ||
1306 | }; | ||
1307 | |||
1308 | static struct clk mcbsp2_fck = { | ||
1309 | .name = "mcbsp2_fck", | ||
1310 | .parent = &func_96m_ck, | ||
1311 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1312 | .enable_bit = 16, | ||
1313 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1314 | .recalc = &omap2_followparent_recalc, | ||
1315 | }; | ||
1316 | |||
1317 | static struct clk mcbsp3_ick = { | ||
1318 | .name = "mcbsp3_ick", | ||
1319 | .parent = &l4_ck, | ||
1320 | .flags = CLOCK_IN_OMAP243X, | ||
1321 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1322 | .enable_bit = 3, | ||
1323 | .recalc = &omap2_followparent_recalc, | ||
1324 | }; | ||
1325 | |||
1326 | static struct clk mcbsp3_fck = { | ||
1327 | .name = "mcbsp3_fck", | ||
1328 | .parent = &func_96m_ck, | ||
1329 | .flags = CLOCK_IN_OMAP243X, | ||
1330 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1331 | .enable_bit = 3, | ||
1332 | .recalc = &omap2_followparent_recalc, | ||
1333 | }; | ||
1334 | |||
1335 | static struct clk mcbsp4_ick = { | ||
1336 | .name = "mcbsp4_ick", | ||
1337 | .parent = &l4_ck, | ||
1338 | .flags = CLOCK_IN_OMAP243X, | ||
1339 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1340 | .enable_bit = 4, | ||
1341 | .recalc = &omap2_followparent_recalc, | ||
1342 | }; | ||
1343 | |||
1344 | static struct clk mcbsp4_fck = { | ||
1345 | .name = "mcbsp4_fck", | ||
1346 | .parent = &func_96m_ck, | ||
1347 | .flags = CLOCK_IN_OMAP243X, | ||
1348 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1349 | .enable_bit = 4, | ||
1350 | .recalc = &omap2_followparent_recalc, | ||
1351 | }; | ||
1352 | |||
1353 | static struct clk mcbsp5_ick = { | ||
1354 | .name = "mcbsp5_ick", | ||
1355 | .parent = &l4_ck, | ||
1356 | .flags = CLOCK_IN_OMAP243X, | ||
1357 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1358 | .enable_bit = 5, | ||
1359 | .recalc = &omap2_followparent_recalc, | ||
1360 | }; | ||
1361 | |||
1362 | static struct clk mcbsp5_fck = { | ||
1363 | .name = "mcbsp5_fck", | ||
1364 | .parent = &func_96m_ck, | ||
1365 | .flags = CLOCK_IN_OMAP243X, | ||
1366 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1367 | .enable_bit = 5, | ||
1368 | .recalc = &omap2_followparent_recalc, | ||
1369 | }; | ||
1370 | |||
1371 | static struct clk mcspi1_ick = { | ||
1372 | .name = "mcspi_ick", | ||
1373 | .id = 1, | ||
1374 | .parent = &l4_ck, | ||
1375 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1376 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1377 | .enable_bit = 17, | ||
1378 | .recalc = &omap2_followparent_recalc, | ||
1379 | }; | ||
1380 | |||
1381 | static struct clk mcspi1_fck = { | ||
1382 | .name = "mcspi_fck", | ||
1383 | .id = 1, | ||
1384 | .parent = &func_48m_ck, | ||
1385 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1386 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1387 | .enable_bit = 17, | ||
1388 | .recalc = &omap2_followparent_recalc, | ||
1389 | }; | ||
1390 | |||
1391 | static struct clk mcspi2_ick = { | ||
1392 | .name = "mcspi_ick", | ||
1393 | .id = 2, | ||
1394 | .parent = &l4_ck, | ||
1395 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1396 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1397 | .enable_bit = 18, | ||
1398 | .recalc = &omap2_followparent_recalc, | ||
1399 | }; | ||
1400 | |||
1401 | static struct clk mcspi2_fck = { | ||
1402 | .name = "mcspi_fck", | ||
1403 | .id = 2, | ||
1404 | .parent = &func_48m_ck, | ||
1405 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1406 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1407 | .enable_bit = 18, | ||
1408 | .recalc = &omap2_followparent_recalc, | ||
1409 | }; | ||
1410 | |||
1411 | static struct clk mcspi3_ick = { | ||
1412 | .name = "mcspi_ick", | ||
1413 | .id = 3, | ||
1414 | .parent = &l4_ck, | ||
1415 | .flags = CLOCK_IN_OMAP243X, | ||
1416 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1417 | .enable_bit = 9, | ||
1418 | .recalc = &omap2_followparent_recalc, | ||
1419 | }; | ||
1420 | |||
1421 | static struct clk mcspi3_fck = { | ||
1422 | .name = "mcspi_fck", | ||
1423 | .id = 3, | ||
1424 | .parent = &func_48m_ck, | ||
1425 | .flags = CLOCK_IN_OMAP243X, | ||
1426 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1427 | .enable_bit = 9, | ||
1428 | .recalc = &omap2_followparent_recalc, | ||
1429 | }; | ||
1430 | |||
1431 | static struct clk uart1_ick = { | ||
1432 | .name = "uart1_ick", | ||
1433 | .parent = &l4_ck, | ||
1434 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1435 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1436 | .enable_bit = 21, | ||
1437 | .recalc = &omap2_followparent_recalc, | ||
1438 | }; | ||
1439 | |||
1440 | static struct clk uart1_fck = { | ||
1441 | .name = "uart1_fck", | ||
1442 | .parent = &func_48m_ck, | ||
1443 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1444 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1445 | .enable_bit = 21, | ||
1446 | .recalc = &omap2_followparent_recalc, | ||
1447 | }; | ||
1448 | |||
1449 | static struct clk uart2_ick = { | ||
1450 | .name = "uart2_ick", | ||
1451 | .parent = &l4_ck, | ||
1452 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1453 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1454 | .enable_bit = 22, | ||
1455 | .recalc = &omap2_followparent_recalc, | ||
1456 | }; | ||
1457 | |||
1458 | static struct clk uart2_fck = { | ||
1459 | .name = "uart2_fck", | ||
1460 | .parent = &func_48m_ck, | ||
1461 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1462 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1463 | .enable_bit = 22, | ||
1464 | .recalc = &omap2_followparent_recalc, | ||
1465 | }; | ||
1466 | |||
1467 | static struct clk uart3_ick = { | ||
1468 | .name = "uart3_ick", | ||
1469 | .parent = &l4_ck, | ||
1470 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1471 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1472 | .enable_bit = 2, | ||
1473 | .recalc = &omap2_followparent_recalc, | ||
1474 | }; | ||
1475 | |||
1476 | static struct clk uart3_fck = { | ||
1477 | .name = "uart3_fck", | ||
1478 | .parent = &func_48m_ck, | ||
1479 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1480 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1481 | .enable_bit = 2, | ||
1482 | .recalc = &omap2_followparent_recalc, | ||
1483 | }; | ||
1484 | |||
1485 | static struct clk gpios_ick = { | ||
1486 | .name = "gpios_ick", | ||
1487 | .parent = &l4_ck, | ||
1488 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1489 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, | ||
1490 | .enable_bit = 2, | ||
1491 | .recalc = &omap2_followparent_recalc, | ||
1492 | }; | ||
1493 | |||
1494 | static struct clk gpios_fck = { | ||
1495 | .name = "gpios_fck", | ||
1496 | .parent = &func_32k_ck, | ||
1497 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1498 | .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, | ||
1499 | .enable_bit = 2, | ||
1500 | .recalc = &omap2_followparent_recalc, | ||
1501 | }; | ||
1502 | |||
1503 | static struct clk mpu_wdt_ick = { | ||
1504 | .name = "mpu_wdt_ick", | ||
1505 | .parent = &l4_ck, | ||
1506 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1507 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, | ||
1508 | .enable_bit = 3, | ||
1509 | .recalc = &omap2_followparent_recalc, | ||
1510 | }; | ||
1511 | |||
1512 | static struct clk mpu_wdt_fck = { | ||
1513 | .name = "mpu_wdt_fck", | ||
1514 | .parent = &func_32k_ck, | ||
1515 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1516 | .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, | ||
1517 | .enable_bit = 3, | ||
1518 | .recalc = &omap2_followparent_recalc, | ||
1519 | }; | ||
1520 | |||
1521 | static struct clk sync_32k_ick = { | ||
1522 | .name = "sync_32k_ick", | ||
1523 | .parent = &l4_ck, | ||
1524 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1525 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, | ||
1526 | .enable_bit = 1, | ||
1527 | .recalc = &omap2_followparent_recalc, | ||
1528 | }; | ||
1529 | static struct clk wdt1_ick = { | ||
1530 | .name = "wdt1_ick", | ||
1531 | .parent = &l4_ck, | ||
1532 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1533 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, | ||
1534 | .enable_bit = 4, | ||
1535 | .recalc = &omap2_followparent_recalc, | ||
1536 | }; | ||
1537 | static struct clk omapctrl_ick = { | ||
1538 | .name = "omapctrl_ick", | ||
1539 | .parent = &l4_ck, | ||
1540 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1541 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, | ||
1542 | .enable_bit = 5, | ||
1543 | .recalc = &omap2_followparent_recalc, | ||
1544 | }; | ||
1545 | static struct clk icr_ick = { | ||
1546 | .name = "icr_ick", | ||
1547 | .parent = &l4_ck, | ||
1548 | .flags = CLOCK_IN_OMAP243X, | ||
1549 | .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, | ||
1550 | .enable_bit = 6, | ||
1551 | .recalc = &omap2_followparent_recalc, | ||
1552 | }; | ||
1553 | |||
1554 | static struct clk cam_ick = { | ||
1555 | .name = "cam_ick", | ||
1556 | .parent = &l4_ck, | ||
1557 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1558 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1559 | .enable_bit = 31, | ||
1560 | .recalc = &omap2_followparent_recalc, | ||
1561 | }; | ||
1562 | |||
1563 | static struct clk cam_fck = { | ||
1564 | .name = "cam_fck", | ||
1565 | .parent = &func_96m_ck, | ||
1566 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1567 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1568 | .enable_bit = 31, | ||
1569 | .recalc = &omap2_followparent_recalc, | ||
1570 | }; | ||
1571 | |||
1572 | static struct clk mailboxes_ick = { | ||
1573 | .name = "mailboxes_ick", | ||
1574 | .parent = &l4_ck, | ||
1575 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1576 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1577 | .enable_bit = 30, | ||
1578 | .recalc = &omap2_followparent_recalc, | ||
1579 | }; | ||
1580 | |||
1581 | static struct clk wdt4_ick = { | ||
1582 | .name = "wdt4_ick", | ||
1583 | .parent = &l4_ck, | ||
1584 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1585 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1586 | .enable_bit = 29, | ||
1587 | .recalc = &omap2_followparent_recalc, | ||
1588 | }; | ||
1589 | |||
1590 | static struct clk wdt4_fck = { | ||
1591 | .name = "wdt4_fck", | ||
1592 | .parent = &func_32k_ck, | ||
1593 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1594 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1595 | .enable_bit = 29, | ||
1596 | .recalc = &omap2_followparent_recalc, | ||
1597 | }; | ||
1598 | |||
1599 | static struct clk wdt3_ick = { | ||
1600 | .name = "wdt3_ick", | ||
1601 | .parent = &l4_ck, | ||
1602 | .flags = CLOCK_IN_OMAP242X, | ||
1603 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1604 | .enable_bit = 28, | ||
1605 | .recalc = &omap2_followparent_recalc, | ||
1606 | }; | ||
1607 | |||
1608 | static struct clk wdt3_fck = { | ||
1609 | .name = "wdt3_fck", | ||
1610 | .parent = &func_32k_ck, | ||
1611 | .flags = CLOCK_IN_OMAP242X, | ||
1612 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1613 | .enable_bit = 28, | ||
1614 | .recalc = &omap2_followparent_recalc, | ||
1615 | }; | ||
1616 | |||
1617 | static struct clk mspro_ick = { | ||
1618 | .name = "mspro_ick", | ||
1619 | .parent = &l4_ck, | ||
1620 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1621 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1622 | .enable_bit = 27, | ||
1623 | .recalc = &omap2_followparent_recalc, | ||
1624 | }; | ||
1625 | |||
1626 | static struct clk mspro_fck = { | ||
1627 | .name = "mspro_fck", | ||
1628 | .parent = &func_96m_ck, | ||
1629 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1630 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1631 | .enable_bit = 27, | ||
1632 | .recalc = &omap2_followparent_recalc, | ||
1633 | }; | ||
1634 | |||
1635 | static struct clk mmc_ick = { | ||
1636 | .name = "mmc_ick", | ||
1637 | .parent = &l4_ck, | ||
1638 | .flags = CLOCK_IN_OMAP242X, | ||
1639 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1640 | .enable_bit = 26, | ||
1641 | .recalc = &omap2_followparent_recalc, | ||
1642 | }; | ||
1643 | |||
1644 | static struct clk mmc_fck = { | ||
1645 | .name = "mmc_fck", | ||
1646 | .parent = &func_96m_ck, | ||
1647 | .flags = CLOCK_IN_OMAP242X, | ||
1648 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1649 | .enable_bit = 26, | ||
1650 | .recalc = &omap2_followparent_recalc, | ||
1651 | }; | ||
1652 | |||
1653 | static struct clk fac_ick = { | ||
1654 | .name = "fac_ick", | ||
1655 | .parent = &l4_ck, | ||
1656 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1657 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1658 | .enable_bit = 25, | ||
1659 | .recalc = &omap2_followparent_recalc, | ||
1660 | }; | ||
1661 | |||
1662 | static struct clk fac_fck = { | ||
1663 | .name = "fac_fck", | ||
1664 | .parent = &func_12m_ck, | ||
1665 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1666 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1667 | .enable_bit = 25, | ||
1668 | .recalc = &omap2_followparent_recalc, | ||
1669 | }; | ||
1670 | |||
1671 | static struct clk eac_ick = { | ||
1672 | .name = "eac_ick", | ||
1673 | .parent = &l4_ck, | ||
1674 | .flags = CLOCK_IN_OMAP242X, | ||
1675 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1676 | .enable_bit = 24, | ||
1677 | .recalc = &omap2_followparent_recalc, | ||
1678 | }; | ||
1679 | |||
1680 | static struct clk eac_fck = { | ||
1681 | .name = "eac_fck", | ||
1682 | .parent = &func_96m_ck, | ||
1683 | .flags = CLOCK_IN_OMAP242X, | ||
1684 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1685 | .enable_bit = 24, | ||
1686 | .recalc = &omap2_followparent_recalc, | ||
1687 | }; | ||
1688 | |||
1689 | static struct clk hdq_ick = { | ||
1690 | .name = "hdq_ick", | ||
1691 | .parent = &l4_ck, | ||
1692 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1693 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1694 | .enable_bit = 23, | ||
1695 | .recalc = &omap2_followparent_recalc, | ||
1696 | }; | ||
1697 | |||
1698 | static struct clk hdq_fck = { | ||
1699 | .name = "hdq_fck", | ||
1700 | .parent = &func_12m_ck, | ||
1701 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1702 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1703 | .enable_bit = 23, | ||
1704 | .recalc = &omap2_followparent_recalc, | ||
1705 | }; | ||
1706 | |||
1707 | static struct clk i2c2_ick = { | ||
1708 | .name = "i2c_ick", | ||
1709 | .id = 2, | ||
1710 | .parent = &l4_ck, | ||
1711 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1712 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1713 | .enable_bit = 20, | ||
1714 | .recalc = &omap2_followparent_recalc, | ||
1715 | }; | ||
1716 | |||
1717 | static struct clk i2c2_fck = { | ||
1718 | .name = "i2c_fck", | ||
1719 | .id = 2, | ||
1720 | .parent = &func_12m_ck, | ||
1721 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1722 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1723 | .enable_bit = 20, | ||
1724 | .recalc = &omap2_followparent_recalc, | ||
1725 | }; | ||
1726 | |||
1727 | static struct clk i2chs2_fck = { | ||
1728 | .name = "i2chs2_fck", | ||
1729 | .parent = &func_96m_ck, | ||
1730 | .flags = CLOCK_IN_OMAP243X, | ||
1731 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1732 | .enable_bit = 20, | ||
1733 | .recalc = &omap2_followparent_recalc, | ||
1734 | }; | ||
1735 | |||
1736 | static struct clk i2c1_ick = { | ||
1737 | .name = "i2c_ick", | ||
1738 | .id = 1, | ||
1739 | .parent = &l4_ck, | ||
1740 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1741 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1742 | .enable_bit = 19, | ||
1743 | .recalc = &omap2_followparent_recalc, | ||
1744 | }; | ||
1745 | |||
1746 | static struct clk i2c1_fck = { | ||
1747 | .name = "i2c_fck", | ||
1748 | .id = 1, | ||
1749 | .parent = &func_12m_ck, | ||
1750 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1751 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1752 | .enable_bit = 19, | ||
1753 | .recalc = &omap2_followparent_recalc, | ||
1754 | }; | ||
1755 | |||
1756 | static struct clk i2chs1_fck = { | ||
1757 | .name = "i2chs1_fck", | ||
1758 | .parent = &func_96m_ck, | ||
1759 | .flags = CLOCK_IN_OMAP243X, | ||
1760 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1761 | .enable_bit = 19, | ||
1762 | .recalc = &omap2_followparent_recalc, | ||
1763 | }; | ||
1764 | |||
1765 | static struct clk vlynq_ick = { | ||
1766 | .name = "vlynq_ick", | ||
1767 | .parent = &core_l3_ck, | ||
1768 | .flags = CLOCK_IN_OMAP242X, | ||
1769 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | ||
1770 | .enable_bit = 3, | ||
1771 | .recalc = &omap2_followparent_recalc, | ||
1772 | }; | ||
1773 | |||
1774 | static struct clk vlynq_fck = { | ||
1775 | .name = "vlynq_fck", | ||
1776 | .parent = &func_96m_ck, | ||
1777 | .flags = CLOCK_IN_OMAP242X | RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP, | ||
1778 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | ||
1779 | .enable_bit = 3, | ||
1780 | .src_offset = 15, | ||
1781 | .recalc = &omap2_followparent_recalc, | ||
1782 | }; | ||
1783 | |||
1784 | static struct clk sdrc_ick = { | ||
1785 | .name = "sdrc_ick", | ||
1786 | .parent = &l4_ck, | ||
1787 | .flags = CLOCK_IN_OMAP243X, | ||
1788 | .enable_reg = (void __iomem *)&CM_ICLKEN3_CORE, | ||
1789 | .enable_bit = 2, | ||
1790 | .recalc = &omap2_followparent_recalc, | ||
1791 | }; | ||
1792 | |||
1793 | static struct clk des_ick = { | ||
1794 | .name = "des_ick", | ||
1795 | .parent = &l4_ck, | ||
1796 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
1797 | .enable_reg = (void __iomem *)&CM_ICLKEN4_CORE, | ||
1798 | .enable_bit = 0, | ||
1799 | .recalc = &omap2_followparent_recalc, | ||
1800 | }; | ||
1801 | |||
1802 | static struct clk sha_ick = { | ||
1803 | .name = "sha_ick", | ||
1804 | .parent = &l4_ck, | ||
1805 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
1806 | .enable_reg = (void __iomem *)&CM_ICLKEN4_CORE, | ||
1807 | .enable_bit = 1, | ||
1808 | .recalc = &omap2_followparent_recalc, | ||
1809 | }; | ||
1810 | |||
1811 | static struct clk rng_ick = { | ||
1812 | .name = "rng_ick", | ||
1813 | .parent = &l4_ck, | ||
1814 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
1815 | .enable_reg = (void __iomem *)&CM_ICLKEN4_CORE, | ||
1816 | .enable_bit = 2, | ||
1817 | .recalc = &omap2_followparent_recalc, | ||
1818 | }; | ||
1819 | |||
1820 | static struct clk aes_ick = { | ||
1821 | .name = "aes_ick", | ||
1822 | .parent = &l4_ck, | ||
1823 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
1824 | .enable_reg = (void __iomem *)&CM_ICLKEN4_CORE, | ||
1825 | .enable_bit = 3, | ||
1826 | .recalc = &omap2_followparent_recalc, | ||
1827 | }; | ||
1828 | |||
1829 | static struct clk pka_ick = { | ||
1830 | .name = "pka_ick", | ||
1831 | .parent = &l4_ck, | ||
1832 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
1833 | .enable_reg = (void __iomem *)&CM_ICLKEN4_CORE, | ||
1834 | .enable_bit = 4, | ||
1835 | .recalc = &omap2_followparent_recalc, | ||
1836 | }; | ||
1837 | |||
1838 | static struct clk usb_fck = { | ||
1839 | .name = "usb_fck", | ||
1840 | .parent = &func_48m_ck, | ||
1841 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
1842 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1843 | .enable_bit = 0, | ||
1844 | .recalc = &omap2_followparent_recalc, | ||
1845 | }; | ||
1846 | |||
1847 | static struct clk usbhs_ick = { | ||
1848 | .name = "usbhs_ick", | ||
1849 | .parent = &core_l3_ck, | ||
1850 | .flags = CLOCK_IN_OMAP243X, | ||
1851 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1852 | .enable_bit = 6, | ||
1853 | .recalc = &omap2_followparent_recalc, | ||
1854 | }; | ||
1855 | |||
1856 | static struct clk mmchs1_ick = { | ||
1857 | .name = "mmchs1_ick", | ||
1858 | .parent = &l4_ck, | ||
1859 | .flags = CLOCK_IN_OMAP243X, | ||
1860 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1861 | .enable_bit = 7, | ||
1862 | .recalc = &omap2_followparent_recalc, | ||
1863 | }; | ||
1864 | |||
1865 | static struct clk mmchs1_fck = { | ||
1866 | .name = "mmchs1_fck", | ||
1867 | .parent = &func_96m_ck, | ||
1868 | .flags = CLOCK_IN_OMAP243X, | ||
1869 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1870 | .enable_bit = 7, | ||
1871 | .recalc = &omap2_followparent_recalc, | ||
1872 | }; | ||
1873 | |||
1874 | static struct clk mmchs2_ick = { | ||
1875 | .name = "mmchs2_ick", | ||
1876 | .parent = &l4_ck, | ||
1877 | .flags = CLOCK_IN_OMAP243X, | ||
1878 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1879 | .enable_bit = 8, | ||
1880 | .recalc = &omap2_followparent_recalc, | ||
1881 | }; | ||
1882 | |||
1883 | static struct clk mmchs2_fck = { | ||
1884 | .name = "mmchs2_fck", | ||
1885 | .parent = &func_96m_ck, | ||
1886 | .flags = CLOCK_IN_OMAP243X, | ||
1887 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1888 | .enable_bit = 8, | ||
1889 | .recalc = &omap2_followparent_recalc, | ||
1890 | }; | ||
1891 | 32 | ||
1892 | static struct clk gpio5_ick = { | 33 | void omap2_clksel_recalc(struct clk *clk); |
1893 | .name = "gpio5_ick", | 34 | void omap2_init_clksel_parent(struct clk *clk); |
1894 | .parent = &l4_ck, | 35 | u32 omap2_clksel_get_divisor(struct clk *clk); |
1895 | .flags = CLOCK_IN_OMAP243X, | 36 | u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, |
1896 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | 37 | u32 *new_div); |
1897 | .enable_bit = 10, | 38 | u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val); |
1898 | .recalc = &omap2_followparent_recalc, | 39 | u32 omap2_divisor_to_clksel(struct clk *clk, u32 div); |
1899 | }; | 40 | void omap2_fixed_divisor_recalc(struct clk *clk); |
41 | long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); | ||
42 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); | ||
43 | u32 omap2_get_dpll_rate(struct clk *clk); | ||
44 | int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); | ||
1900 | 45 | ||
1901 | static struct clk gpio5_fck = { | 46 | extern u8 cpu_mask; |
1902 | .name = "gpio5_fck", | ||
1903 | .parent = &func_32k_ck, | ||
1904 | .flags = CLOCK_IN_OMAP243X, | ||
1905 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1906 | .enable_bit = 10, | ||
1907 | .recalc = &omap2_followparent_recalc, | ||
1908 | }; | ||
1909 | 47 | ||
1910 | static struct clk mdm_intc_ick = { | 48 | /* clksel_rate data common to 24xx/343x */ |
1911 | .name = "mdm_intc_ick", | 49 | static const struct clksel_rate gpt_32k_rates[] = { |
1912 | .parent = &l4_ck, | 50 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE }, |
1913 | .flags = CLOCK_IN_OMAP243X, | 51 | { .div = 0 } |
1914 | .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, | ||
1915 | .enable_bit = 11, | ||
1916 | .recalc = &omap2_followparent_recalc, | ||
1917 | }; | 52 | }; |
1918 | 53 | ||
1919 | static struct clk mmchsdb1_fck = { | 54 | static const struct clksel_rate gpt_sys_rates[] = { |
1920 | .name = "mmchsdb1_fck", | 55 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE }, |
1921 | .parent = &func_32k_ck, | 56 | { .div = 0 } |
1922 | .flags = CLOCK_IN_OMAP243X, | ||
1923 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | ||
1924 | .enable_bit = 16, | ||
1925 | .recalc = &omap2_followparent_recalc, | ||
1926 | }; | 57 | }; |
1927 | 58 | ||
1928 | static struct clk mmchsdb2_fck = { | 59 | static const struct clksel_rate gfx_l3_rates[] = { |
1929 | .name = "mmchsdb2_fck", | 60 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X }, |
1930 | .parent = &func_32k_ck, | 61 | { .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE }, |
1931 | .flags = CLOCK_IN_OMAP243X, | 62 | { .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X }, |
1932 | .enable_reg = (void __iomem *)&CM_FCLKEN2_CORE, | 63 | { .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X }, |
1933 | .enable_bit = 17, | 64 | { .div = 0 } |
1934 | .recalc = &omap2_followparent_recalc, | ||
1935 | }; | 65 | }; |
1936 | 66 | ||
1937 | /* | ||
1938 | * This clock is a composite clock which does entire set changes then | ||
1939 | * forces a rebalance. It keys on the MPU speed, but it really could | ||
1940 | * be any key speed part of a set in the rate table. | ||
1941 | * | ||
1942 | * to really change a set, you need memory table sets which get changed | ||
1943 | * in sram, pre-notifiers & post notifiers, changing the top set, without | ||
1944 | * having low level display recalc's won't work... this is why dpm notifiers | ||
1945 | * work, isr's off, walk a list of clocks already _off_ and not messing with | ||
1946 | * the bus. | ||
1947 | * | ||
1948 | * This clock should have no parent. It embodies the entire upper level | ||
1949 | * active set. A parent will mess up some of the init also. | ||
1950 | */ | ||
1951 | static struct clk virt_prcm_set = { | ||
1952 | .name = "virt_prcm_set", | ||
1953 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1954 | VIRTUAL_CLOCK | ALWAYS_ENABLED | DELAYED_APP, | ||
1955 | .parent = &mpu_ck, /* Indexed by mpu speed, no parent */ | ||
1956 | .recalc = &omap2_mpu_recalc, /* sets are keyed on mpu rate */ | ||
1957 | .set_rate = &omap2_select_table_rate, | ||
1958 | .round_rate = &omap2_round_to_table_rate, | ||
1959 | }; | ||
1960 | |||
1961 | static struct clk *onchip_clks[] = { | ||
1962 | /* external root sources */ | ||
1963 | &func_32k_ck, | ||
1964 | &osc_ck, | ||
1965 | &sys_ck, | ||
1966 | &alt_ck, | ||
1967 | /* internal analog sources */ | ||
1968 | &dpll_ck, | ||
1969 | &apll96_ck, | ||
1970 | &apll54_ck, | ||
1971 | /* internal prcm root sources */ | ||
1972 | &func_54m_ck, | ||
1973 | &core_ck, | ||
1974 | &sleep_ck, | ||
1975 | &func_96m_ck, | ||
1976 | &func_48m_ck, | ||
1977 | &func_12m_ck, | ||
1978 | &wdt1_osc_ck, | ||
1979 | &sys_clkout, | ||
1980 | &sys_clkout2, | ||
1981 | &emul_ck, | ||
1982 | /* mpu domain clocks */ | ||
1983 | &mpu_ck, | ||
1984 | /* dsp domain clocks */ | ||
1985 | &iva2_1_fck, /* 2430 */ | ||
1986 | &iva2_1_ick, | ||
1987 | &dsp_ick, /* 2420 */ | ||
1988 | &dsp_fck, | ||
1989 | &iva1_ifck, | ||
1990 | &iva1_mpu_int_ifck, | ||
1991 | /* GFX domain clocks */ | ||
1992 | &gfx_3d_fck, | ||
1993 | &gfx_2d_fck, | ||
1994 | &gfx_ick, | ||
1995 | /* Modem domain clocks */ | ||
1996 | &mdm_ick, | ||
1997 | &mdm_osc_ck, | ||
1998 | /* DSS domain clocks */ | ||
1999 | &dss_ick, | ||
2000 | &dss1_fck, | ||
2001 | &dss2_fck, | ||
2002 | &dss_54m_fck, | ||
2003 | /* L3 domain clocks */ | ||
2004 | &core_l3_ck, | ||
2005 | &ssi_ssr_sst_fck, | ||
2006 | &usb_l4_ick, | ||
2007 | /* L4 domain clocks */ | ||
2008 | &l4_ck, /* used as both core_l4 and wu_l4 */ | ||
2009 | &ssi_l4_ick, | ||
2010 | /* virtual meta-group clock */ | ||
2011 | &virt_prcm_set, | ||
2012 | /* general l4 interface ck, multi-parent functional clk */ | ||
2013 | &gpt1_ick, | ||
2014 | &gpt1_fck, | ||
2015 | &gpt2_ick, | ||
2016 | &gpt2_fck, | ||
2017 | &gpt3_ick, | ||
2018 | &gpt3_fck, | ||
2019 | &gpt4_ick, | ||
2020 | &gpt4_fck, | ||
2021 | &gpt5_ick, | ||
2022 | &gpt5_fck, | ||
2023 | &gpt6_ick, | ||
2024 | &gpt6_fck, | ||
2025 | &gpt7_ick, | ||
2026 | &gpt7_fck, | ||
2027 | &gpt8_ick, | ||
2028 | &gpt8_fck, | ||
2029 | &gpt9_ick, | ||
2030 | &gpt9_fck, | ||
2031 | &gpt10_ick, | ||
2032 | &gpt10_fck, | ||
2033 | &gpt11_ick, | ||
2034 | &gpt11_fck, | ||
2035 | &gpt12_ick, | ||
2036 | &gpt12_fck, | ||
2037 | &mcbsp1_ick, | ||
2038 | &mcbsp1_fck, | ||
2039 | &mcbsp2_ick, | ||
2040 | &mcbsp2_fck, | ||
2041 | &mcbsp3_ick, | ||
2042 | &mcbsp3_fck, | ||
2043 | &mcbsp4_ick, | ||
2044 | &mcbsp4_fck, | ||
2045 | &mcbsp5_ick, | ||
2046 | &mcbsp5_fck, | ||
2047 | &mcspi1_ick, | ||
2048 | &mcspi1_fck, | ||
2049 | &mcspi2_ick, | ||
2050 | &mcspi2_fck, | ||
2051 | &mcspi3_ick, | ||
2052 | &mcspi3_fck, | ||
2053 | &uart1_ick, | ||
2054 | &uart1_fck, | ||
2055 | &uart2_ick, | ||
2056 | &uart2_fck, | ||
2057 | &uart3_ick, | ||
2058 | &uart3_fck, | ||
2059 | &gpios_ick, | ||
2060 | &gpios_fck, | ||
2061 | &mpu_wdt_ick, | ||
2062 | &mpu_wdt_fck, | ||
2063 | &sync_32k_ick, | ||
2064 | &wdt1_ick, | ||
2065 | &omapctrl_ick, | ||
2066 | &icr_ick, | ||
2067 | &cam_fck, | ||
2068 | &cam_ick, | ||
2069 | &mailboxes_ick, | ||
2070 | &wdt4_ick, | ||
2071 | &wdt4_fck, | ||
2072 | &wdt3_ick, | ||
2073 | &wdt3_fck, | ||
2074 | &mspro_ick, | ||
2075 | &mspro_fck, | ||
2076 | &mmc_ick, | ||
2077 | &mmc_fck, | ||
2078 | &fac_ick, | ||
2079 | &fac_fck, | ||
2080 | &eac_ick, | ||
2081 | &eac_fck, | ||
2082 | &hdq_ick, | ||
2083 | &hdq_fck, | ||
2084 | &i2c1_ick, | ||
2085 | &i2c1_fck, | ||
2086 | &i2chs1_fck, | ||
2087 | &i2c2_ick, | ||
2088 | &i2c2_fck, | ||
2089 | &i2chs2_fck, | ||
2090 | &vlynq_ick, | ||
2091 | &vlynq_fck, | ||
2092 | &sdrc_ick, | ||
2093 | &des_ick, | ||
2094 | &sha_ick, | ||
2095 | &rng_ick, | ||
2096 | &aes_ick, | ||
2097 | &pka_ick, | ||
2098 | &usb_fck, | ||
2099 | &usbhs_ick, | ||
2100 | &mmchs1_ick, | ||
2101 | &mmchs1_fck, | ||
2102 | &mmchs2_ick, | ||
2103 | &mmchs2_fck, | ||
2104 | &gpio5_ick, | ||
2105 | &gpio5_fck, | ||
2106 | &mdm_intc_ick, | ||
2107 | &mmchsdb1_fck, | ||
2108 | &mmchsdb2_fck, | ||
2109 | }; | ||
2110 | 67 | ||
2111 | #endif | 68 | #endif |
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c new file mode 100644 index 000000000000..ece32d8acba4 --- /dev/null +++ b/arch/arm/mach-omap2/clock24xx.c | |||
@@ -0,0 +1,539 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap2/clock.c | ||
3 | * | ||
4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2004-2008 Nokia Corporation | ||
6 | * | ||
7 | * Contacts: | ||
8 | * Richard Woodruff <r-woodruff2@ti.com> | ||
9 | * Paul Walmsley | ||
10 | * | ||
11 | * Based on earlier work by Tuukka Tikkanen, Tony Lindgren, | ||
12 | * Gordon McNutt and RidgeRun, Inc. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | */ | ||
18 | #undef DEBUG | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/list.h> | ||
24 | #include <linux/errno.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/clk.h> | ||
27 | |||
28 | #include <linux/io.h> | ||
29 | #include <linux/cpufreq.h> | ||
30 | |||
31 | #include <asm/arch/clock.h> | ||
32 | #include <asm/arch/sram.h> | ||
33 | #include <asm/div64.h> | ||
34 | #include <asm/bitops.h> | ||
35 | |||
36 | #include "memory.h" | ||
37 | #include "clock.h" | ||
38 | #include "clock24xx.h" | ||
39 | #include "prm.h" | ||
40 | #include "prm-regbits-24xx.h" | ||
41 | #include "cm.h" | ||
42 | #include "cm-regbits-24xx.h" | ||
43 | |||
44 | /* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ | ||
45 | #define EN_APLL_STOPPED 0 | ||
46 | #define EN_APLL_LOCKED 3 | ||
47 | |||
48 | /* CM_CLKSEL1_PLL.APLLS_CLKIN options (24XX) */ | ||
49 | #define APLLS_CLKIN_19_2MHZ 0 | ||
50 | #define APLLS_CLKIN_13MHZ 2 | ||
51 | #define APLLS_CLKIN_12MHZ 3 | ||
52 | |||
53 | /* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ | ||
54 | |||
55 | static struct prcm_config *curr_prcm_set; | ||
56 | static struct clk *vclk; | ||
57 | static struct clk *sclk; | ||
58 | |||
59 | /*------------------------------------------------------------------------- | ||
60 | * Omap24xx specific clock functions | ||
61 | *-------------------------------------------------------------------------*/ | ||
62 | |||
63 | /* This actually returns the rate of core_ck, not dpll_ck. */ | ||
64 | static u32 omap2_get_dpll_rate_24xx(struct clk *tclk) | ||
65 | { | ||
66 | long long dpll_clk; | ||
67 | u8 amult; | ||
68 | |||
69 | dpll_clk = omap2_get_dpll_rate(tclk); | ||
70 | |||
71 | amult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); | ||
72 | amult &= OMAP24XX_CORE_CLK_SRC_MASK; | ||
73 | dpll_clk *= amult; | ||
74 | |||
75 | return dpll_clk; | ||
76 | } | ||
77 | |||
78 | static int omap2_enable_osc_ck(struct clk *clk) | ||
79 | { | ||
80 | u32 pcc; | ||
81 | |||
82 | pcc = __raw_readl(OMAP24XX_PRCM_CLKSRC_CTRL); | ||
83 | |||
84 | __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, | ||
85 | OMAP24XX_PRCM_CLKSRC_CTRL); | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static void omap2_disable_osc_ck(struct clk *clk) | ||
91 | { | ||
92 | u32 pcc; | ||
93 | |||
94 | pcc = __raw_readl(OMAP24XX_PRCM_CLKSRC_CTRL); | ||
95 | |||
96 | __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, | ||
97 | OMAP24XX_PRCM_CLKSRC_CTRL); | ||
98 | } | ||
99 | |||
100 | #ifdef OLD_CK | ||
101 | /* Recalculate SYST_CLK */ | ||
102 | static void omap2_sys_clk_recalc(struct clk * clk) | ||
103 | { | ||
104 | u32 div = PRCM_CLKSRC_CTRL; | ||
105 | div &= (1 << 7) | (1 << 6); /* Test if ext clk divided by 1 or 2 */ | ||
106 | div >>= clk->rate_offset; | ||
107 | clk->rate = (clk->parent->rate / div); | ||
108 | propagate_rate(clk); | ||
109 | } | ||
110 | #endif /* OLD_CK */ | ||
111 | |||
112 | /* Enable an APLL if off */ | ||
113 | static int omap2_clk_fixed_enable(struct clk *clk) | ||
114 | { | ||
115 | u32 cval, apll_mask; | ||
116 | |||
117 | apll_mask = EN_APLL_LOCKED << clk->enable_bit; | ||
118 | |||
119 | cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN); | ||
120 | |||
121 | if ((cval & apll_mask) == apll_mask) | ||
122 | return 0; /* apll already enabled */ | ||
123 | |||
124 | cval &= ~apll_mask; | ||
125 | cval |= apll_mask; | ||
126 | cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); | ||
127 | |||
128 | if (clk == &apll96_ck) | ||
129 | cval = OMAP24XX_ST_96M_APLL; | ||
130 | else if (clk == &apll54_ck) | ||
131 | cval = OMAP24XX_ST_54M_APLL; | ||
132 | |||
133 | omap2_wait_clock_ready(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval, | ||
134 | clk->name); | ||
135 | |||
136 | /* | ||
137 | * REVISIT: Should we return an error code if omap2_wait_clock_ready() | ||
138 | * fails? | ||
139 | */ | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | /* Stop APLL */ | ||
144 | static void omap2_clk_fixed_disable(struct clk *clk) | ||
145 | { | ||
146 | u32 cval; | ||
147 | |||
148 | cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN); | ||
149 | cval &= ~(EN_APLL_LOCKED << clk->enable_bit); | ||
150 | cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | * Uses the current prcm set to tell if a rate is valid. | ||
155 | * You can go slower, but not faster within a given rate set. | ||
156 | */ | ||
157 | static u32 omap2_dpll_round_rate(unsigned long target_rate) | ||
158 | { | ||
159 | u32 high, low, core_clk_src; | ||
160 | |||
161 | core_clk_src = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); | ||
162 | core_clk_src &= OMAP24XX_CORE_CLK_SRC_MASK; | ||
163 | |||
164 | if (core_clk_src == CORE_CLK_SRC_DPLL) { /* DPLL clockout */ | ||
165 | high = curr_prcm_set->dpll_speed * 2; | ||
166 | low = curr_prcm_set->dpll_speed; | ||
167 | } else { /* DPLL clockout x 2 */ | ||
168 | high = curr_prcm_set->dpll_speed; | ||
169 | low = curr_prcm_set->dpll_speed / 2; | ||
170 | } | ||
171 | |||
172 | #ifdef DOWN_VARIABLE_DPLL | ||
173 | if (target_rate > high) | ||
174 | return high; | ||
175 | else | ||
176 | return target_rate; | ||
177 | #else | ||
178 | if (target_rate > low) | ||
179 | return high; | ||
180 | else | ||
181 | return low; | ||
182 | #endif | ||
183 | |||
184 | } | ||
185 | |||
186 | static void omap2_dpll_recalc(struct clk *clk) | ||
187 | { | ||
188 | clk->rate = omap2_get_dpll_rate_24xx(clk); | ||
189 | |||
190 | propagate_rate(clk); | ||
191 | } | ||
192 | |||
193 | static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate) | ||
194 | { | ||
195 | u32 cur_rate, low, mult, div, valid_rate, done_rate; | ||
196 | u32 bypass = 0; | ||
197 | struct prcm_config tmpset; | ||
198 | const struct dpll_data *dd; | ||
199 | unsigned long flags; | ||
200 | int ret = -EINVAL; | ||
201 | |||
202 | local_irq_save(flags); | ||
203 | cur_rate = omap2_get_dpll_rate_24xx(&dpll_ck); | ||
204 | mult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); | ||
205 | mult &= OMAP24XX_CORE_CLK_SRC_MASK; | ||
206 | |||
207 | if ((rate == (cur_rate / 2)) && (mult == 2)) { | ||
208 | omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL, 1); | ||
209 | } else if ((rate == (cur_rate * 2)) && (mult == 1)) { | ||
210 | omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); | ||
211 | } else if (rate != cur_rate) { | ||
212 | valid_rate = omap2_dpll_round_rate(rate); | ||
213 | if (valid_rate != rate) | ||
214 | goto dpll_exit; | ||
215 | |||
216 | if (mult == 1) | ||
217 | low = curr_prcm_set->dpll_speed; | ||
218 | else | ||
219 | low = curr_prcm_set->dpll_speed / 2; | ||
220 | |||
221 | dd = clk->dpll_data; | ||
222 | if (!dd) | ||
223 | goto dpll_exit; | ||
224 | |||
225 | tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg); | ||
226 | tmpset.cm_clksel1_pll &= ~(dd->mult_mask | | ||
227 | dd->div1_mask); | ||
228 | div = ((curr_prcm_set->xtal_speed / 1000000) - 1); | ||
229 | tmpset.cm_clksel2_pll = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); | ||
230 | tmpset.cm_clksel2_pll &= ~OMAP24XX_CORE_CLK_SRC_MASK; | ||
231 | if (rate > low) { | ||
232 | tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL_X2; | ||
233 | mult = ((rate / 2) / 1000000); | ||
234 | done_rate = CORE_CLK_SRC_DPLL_X2; | ||
235 | } else { | ||
236 | tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL; | ||
237 | mult = (rate / 1000000); | ||
238 | done_rate = CORE_CLK_SRC_DPLL; | ||
239 | } | ||
240 | tmpset.cm_clksel1_pll |= (div << __ffs(dd->mult_mask)); | ||
241 | tmpset.cm_clksel1_pll |= (mult << __ffs(dd->div1_mask)); | ||
242 | |||
243 | /* Worst case */ | ||
244 | tmpset.base_sdrc_rfr = SDRC_RFR_CTRL_BYPASS; | ||
245 | |||
246 | if (rate == curr_prcm_set->xtal_speed) /* If asking for 1-1 */ | ||
247 | bypass = 1; | ||
248 | |||
249 | omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); /* For init_mem */ | ||
250 | |||
251 | /* Force dll lock mode */ | ||
252 | omap2_set_prcm(tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr, | ||
253 | bypass); | ||
254 | |||
255 | /* Errata: ret dll entry state */ | ||
256 | omap2_init_memory_params(omap2_dll_force_needed()); | ||
257 | omap2_reprogram_sdrc(done_rate, 0); | ||
258 | } | ||
259 | omap2_dpll_recalc(&dpll_ck); | ||
260 | ret = 0; | ||
261 | |||
262 | dpll_exit: | ||
263 | local_irq_restore(flags); | ||
264 | return(ret); | ||
265 | } | ||
266 | |||
267 | /** | ||
268 | * omap2_table_mpu_recalc - just return the MPU speed | ||
269 | * @clk: virt_prcm_set struct clk | ||
270 | * | ||
271 | * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. | ||
272 | */ | ||
273 | static void omap2_table_mpu_recalc(struct clk *clk) | ||
274 | { | ||
275 | clk->rate = curr_prcm_set->mpu_speed; | ||
276 | } | ||
277 | |||
278 | /* | ||
279 | * Look for a rate equal or less than the target rate given a configuration set. | ||
280 | * | ||
281 | * What's not entirely clear is "which" field represents the key field. | ||
282 | * Some might argue L3-DDR, others ARM, others IVA. This code is simple and | ||
283 | * just uses the ARM rates. | ||
284 | */ | ||
285 | static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) | ||
286 | { | ||
287 | struct prcm_config *ptr; | ||
288 | long highest_rate; | ||
289 | |||
290 | if (clk != &virt_prcm_set) | ||
291 | return -EINVAL; | ||
292 | |||
293 | highest_rate = -EINVAL; | ||
294 | |||
295 | for (ptr = rate_table; ptr->mpu_speed; ptr++) { | ||
296 | if (!(ptr->flags & cpu_mask)) | ||
297 | continue; | ||
298 | if (ptr->xtal_speed != sys_ck.rate) | ||
299 | continue; | ||
300 | |||
301 | highest_rate = ptr->mpu_speed; | ||
302 | |||
303 | /* Can check only after xtal frequency check */ | ||
304 | if (ptr->mpu_speed <= rate) | ||
305 | break; | ||
306 | } | ||
307 | return highest_rate; | ||
308 | } | ||
309 | |||
310 | /* Sets basic clocks based on the specified rate */ | ||
311 | static int omap2_select_table_rate(struct clk *clk, unsigned long rate) | ||
312 | { | ||
313 | u32 cur_rate, done_rate, bypass = 0, tmp; | ||
314 | struct prcm_config *prcm; | ||
315 | unsigned long found_speed = 0; | ||
316 | unsigned long flags; | ||
317 | |||
318 | if (clk != &virt_prcm_set) | ||
319 | return -EINVAL; | ||
320 | |||
321 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
322 | if (!(prcm->flags & cpu_mask)) | ||
323 | continue; | ||
324 | |||
325 | if (prcm->xtal_speed != sys_ck.rate) | ||
326 | continue; | ||
327 | |||
328 | if (prcm->mpu_speed <= rate) { | ||
329 | found_speed = prcm->mpu_speed; | ||
330 | break; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | if (!found_speed) { | ||
335 | printk(KERN_INFO "Could not set MPU rate to %luMHz\n", | ||
336 | rate / 1000000); | ||
337 | return -EINVAL; | ||
338 | } | ||
339 | |||
340 | curr_prcm_set = prcm; | ||
341 | cur_rate = omap2_get_dpll_rate_24xx(&dpll_ck); | ||
342 | |||
343 | if (prcm->dpll_speed == cur_rate / 2) { | ||
344 | omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL, 1); | ||
345 | } else if (prcm->dpll_speed == cur_rate * 2) { | ||
346 | omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); | ||
347 | } else if (prcm->dpll_speed != cur_rate) { | ||
348 | local_irq_save(flags); | ||
349 | |||
350 | if (prcm->dpll_speed == prcm->xtal_speed) | ||
351 | bypass = 1; | ||
352 | |||
353 | if ((prcm->cm_clksel2_pll & OMAP24XX_CORE_CLK_SRC_MASK) == | ||
354 | CORE_CLK_SRC_DPLL_X2) | ||
355 | done_rate = CORE_CLK_SRC_DPLL_X2; | ||
356 | else | ||
357 | done_rate = CORE_CLK_SRC_DPLL; | ||
358 | |||
359 | /* MPU divider */ | ||
360 | cm_write_mod_reg(prcm->cm_clksel_mpu, MPU_MOD, CM_CLKSEL); | ||
361 | |||
362 | /* dsp + iva1 div(2420), iva2.1(2430) */ | ||
363 | cm_write_mod_reg(prcm->cm_clksel_dsp, | ||
364 | OMAP24XX_DSP_MOD, CM_CLKSEL); | ||
365 | |||
366 | cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL); | ||
367 | |||
368 | /* Major subsystem dividers */ | ||
369 | tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK; | ||
370 | cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD, CM_CLKSEL1); | ||
371 | if (cpu_is_omap2430()) | ||
372 | cm_write_mod_reg(prcm->cm_clksel_mdm, | ||
373 | OMAP2430_MDM_MOD, CM_CLKSEL); | ||
374 | |||
375 | /* x2 to enter init_mem */ | ||
376 | omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); | ||
377 | |||
378 | omap2_set_prcm(prcm->cm_clksel1_pll, prcm->base_sdrc_rfr, | ||
379 | bypass); | ||
380 | |||
381 | omap2_init_memory_params(omap2_dll_force_needed()); | ||
382 | omap2_reprogram_sdrc(done_rate, 0); | ||
383 | |||
384 | local_irq_restore(flags); | ||
385 | } | ||
386 | omap2_dpll_recalc(&dpll_ck); | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static struct clk_functions omap2_clk_functions = { | ||
392 | .clk_enable = omap2_clk_enable, | ||
393 | .clk_disable = omap2_clk_disable, | ||
394 | .clk_round_rate = omap2_clk_round_rate, | ||
395 | .clk_set_rate = omap2_clk_set_rate, | ||
396 | .clk_set_parent = omap2_clk_set_parent, | ||
397 | .clk_disable_unused = omap2_clk_disable_unused, | ||
398 | }; | ||
399 | |||
400 | static u32 omap2_get_apll_clkin(void) | ||
401 | { | ||
402 | u32 aplls, sclk = 0; | ||
403 | |||
404 | aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1); | ||
405 | aplls &= OMAP24XX_APLLS_CLKIN_MASK; | ||
406 | aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT; | ||
407 | |||
408 | if (aplls == APLLS_CLKIN_19_2MHZ) | ||
409 | sclk = 19200000; | ||
410 | else if (aplls == APLLS_CLKIN_13MHZ) | ||
411 | sclk = 13000000; | ||
412 | else if (aplls == APLLS_CLKIN_12MHZ) | ||
413 | sclk = 12000000; | ||
414 | |||
415 | return sclk; | ||
416 | } | ||
417 | |||
418 | static u32 omap2_get_sysclkdiv(void) | ||
419 | { | ||
420 | u32 div; | ||
421 | |||
422 | div = __raw_readl(OMAP24XX_PRCM_CLKSRC_CTRL); | ||
423 | div &= OMAP_SYSCLKDIV_MASK; | ||
424 | div >>= OMAP_SYSCLKDIV_SHIFT; | ||
425 | |||
426 | return div; | ||
427 | } | ||
428 | |||
429 | static void omap2_osc_clk_recalc(struct clk *clk) | ||
430 | { | ||
431 | clk->rate = omap2_get_apll_clkin() * omap2_get_sysclkdiv(); | ||
432 | propagate_rate(clk); | ||
433 | } | ||
434 | |||
435 | static void omap2_sys_clk_recalc(struct clk *clk) | ||
436 | { | ||
437 | clk->rate = clk->parent->rate / omap2_get_sysclkdiv(); | ||
438 | propagate_rate(clk); | ||
439 | } | ||
440 | |||
441 | /* | ||
442 | * Set clocks for bypass mode for reboot to work. | ||
443 | */ | ||
444 | void omap2_clk_prepare_for_reboot(void) | ||
445 | { | ||
446 | u32 rate; | ||
447 | |||
448 | if (vclk == NULL || sclk == NULL) | ||
449 | return; | ||
450 | |||
451 | rate = clk_get_rate(sclk); | ||
452 | clk_set_rate(vclk, rate); | ||
453 | } | ||
454 | |||
455 | /* | ||
456 | * Switch the MPU rate if specified on cmdline. | ||
457 | * We cannot do this early until cmdline is parsed. | ||
458 | */ | ||
459 | static int __init omap2_clk_arch_init(void) | ||
460 | { | ||
461 | if (!mpurate) | ||
462 | return -EINVAL; | ||
463 | |||
464 | if (omap2_select_table_rate(&virt_prcm_set, mpurate)) | ||
465 | printk(KERN_ERR "Could not find matching MPU rate\n"); | ||
466 | |||
467 | recalculate_root_clocks(); | ||
468 | |||
469 | printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL/MPU): " | ||
470 | "%ld.%01ld/%ld/%ld MHz\n", | ||
471 | (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10, | ||
472 | (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ; | ||
473 | |||
474 | return 0; | ||
475 | } | ||
476 | arch_initcall(omap2_clk_arch_init); | ||
477 | |||
478 | int __init omap2_clk_init(void) | ||
479 | { | ||
480 | struct prcm_config *prcm; | ||
481 | struct clk **clkp; | ||
482 | u32 clkrate; | ||
483 | |||
484 | if (cpu_is_omap242x()) | ||
485 | cpu_mask = RATE_IN_242X; | ||
486 | else if (cpu_is_omap2430()) | ||
487 | cpu_mask = RATE_IN_243X; | ||
488 | |||
489 | clk_init(&omap2_clk_functions); | ||
490 | |||
491 | omap2_osc_clk_recalc(&osc_ck); | ||
492 | omap2_sys_clk_recalc(&sys_ck); | ||
493 | |||
494 | for (clkp = onchip_24xx_clks; | ||
495 | clkp < onchip_24xx_clks + ARRAY_SIZE(onchip_24xx_clks); | ||
496 | clkp++) { | ||
497 | |||
498 | if ((*clkp)->flags & CLOCK_IN_OMAP242X && cpu_is_omap2420()) { | ||
499 | clk_register(*clkp); | ||
500 | continue; | ||
501 | } | ||
502 | |||
503 | if ((*clkp)->flags & CLOCK_IN_OMAP243X && cpu_is_omap2430()) { | ||
504 | clk_register(*clkp); | ||
505 | continue; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | /* Check the MPU rate set by bootloader */ | ||
510 | clkrate = omap2_get_dpll_rate_24xx(&dpll_ck); | ||
511 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
512 | if (!(prcm->flags & cpu_mask)) | ||
513 | continue; | ||
514 | if (prcm->xtal_speed != sys_ck.rate) | ||
515 | continue; | ||
516 | if (prcm->dpll_speed <= clkrate) | ||
517 | break; | ||
518 | } | ||
519 | curr_prcm_set = prcm; | ||
520 | |||
521 | recalculate_root_clocks(); | ||
522 | |||
523 | printk(KERN_INFO "Clocking rate (Crystal/DPLL/MPU): " | ||
524 | "%ld.%01ld/%ld/%ld MHz\n", | ||
525 | (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10, | ||
526 | (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ; | ||
527 | |||
528 | /* | ||
529 | * Only enable those clocks we will need, let the drivers | ||
530 | * enable other clocks as necessary | ||
531 | */ | ||
532 | clk_enable_init_clocks(); | ||
533 | |||
534 | /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */ | ||
535 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
536 | sclk = clk_get(NULL, "sys_ck"); | ||
537 | |||
538 | return 0; | ||
539 | } | ||
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h new file mode 100644 index 000000000000..88081ed13f96 --- /dev/null +++ b/arch/arm/mach-omap2/clock24xx.h | |||
@@ -0,0 +1,2643 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap2/clock24xx.h | ||
3 | * | ||
4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2004-2008 Nokia Corporation | ||
6 | * | ||
7 | * Contacts: | ||
8 | * Richard Woodruff <r-woodruff2@ti.com> | ||
9 | * Paul Walmsley | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK24XX_H | ||
17 | #define __ARCH_ARM_MACH_OMAP2_CLOCK24XX_H | ||
18 | |||
19 | #include "clock.h" | ||
20 | |||
21 | #include "prm.h" | ||
22 | #include "cm.h" | ||
23 | #include "prm-regbits-24xx.h" | ||
24 | #include "cm-regbits-24xx.h" | ||
25 | #include "sdrc.h" | ||
26 | |||
27 | static void omap2_table_mpu_recalc(struct clk *clk); | ||
28 | static int omap2_select_table_rate(struct clk *clk, unsigned long rate); | ||
29 | static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate); | ||
30 | static void omap2_sys_clk_recalc(struct clk *clk); | ||
31 | static void omap2_osc_clk_recalc(struct clk *clk); | ||
32 | static void omap2_sys_clk_recalc(struct clk *clk); | ||
33 | static void omap2_dpll_recalc(struct clk *clk); | ||
34 | static int omap2_clk_fixed_enable(struct clk *clk); | ||
35 | static void omap2_clk_fixed_disable(struct clk *clk); | ||
36 | static int omap2_enable_osc_ck(struct clk *clk); | ||
37 | static void omap2_disable_osc_ck(struct clk *clk); | ||
38 | static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate); | ||
39 | |||
40 | /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | ||
41 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP | ||
42 | * CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL CM_CLKSEL2_PLL, CM_CLKSEL_MDM | ||
43 | */ | ||
44 | struct prcm_config { | ||
45 | unsigned long xtal_speed; /* crystal rate */ | ||
46 | unsigned long dpll_speed; /* dpll: out*xtal*M/(N-1)table_recalc */ | ||
47 | unsigned long mpu_speed; /* speed of MPU */ | ||
48 | unsigned long cm_clksel_mpu; /* mpu divider */ | ||
49 | unsigned long cm_clksel_dsp; /* dsp+iva1 div(2420), iva2.1(2430) */ | ||
50 | unsigned long cm_clksel_gfx; /* gfx dividers */ | ||
51 | unsigned long cm_clksel1_core; /* major subsystem dividers */ | ||
52 | unsigned long cm_clksel1_pll; /* m,n */ | ||
53 | unsigned long cm_clksel2_pll; /* dpllx1 or x2 out */ | ||
54 | unsigned long cm_clksel_mdm; /* modem dividers 2430 only */ | ||
55 | unsigned long base_sdrc_rfr; /* base refresh timing for a set */ | ||
56 | unsigned char flags; | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * The OMAP2 processor can be run at several discrete 'PRCM configurations'. | ||
61 | * These configurations are characterized by voltage and speed for clocks. | ||
62 | * The device is only validated for certain combinations. One way to express | ||
63 | * these combinations is via the 'ratio's' which the clocks operate with | ||
64 | * respect to each other. These ratio sets are for a given voltage/DPLL | ||
65 | * setting. All configurations can be described by a DPLL setting and a ratio | ||
66 | * There are 3 ratio sets for the 2430 and X ratio sets for 2420. | ||
67 | * | ||
68 | * 2430 differs from 2420 in that there are no more phase synchronizers used. | ||
69 | * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs | ||
70 | * 2430 (iva2.1, NOdsp, mdm) | ||
71 | */ | ||
72 | |||
73 | /* Core fields for cm_clksel, not ratio governed */ | ||
74 | #define RX_CLKSEL_DSS1 (0x10 << 8) | ||
75 | #define RX_CLKSEL_DSS2 (0x0 << 13) | ||
76 | #define RX_CLKSEL_SSI (0x5 << 20) | ||
77 | |||
78 | /*------------------------------------------------------------------------- | ||
79 | * Voltage/DPLL ratios | ||
80 | *-------------------------------------------------------------------------*/ | ||
81 | |||
82 | /* 2430 Ratio's, 2430-Ratio Config 1 */ | ||
83 | #define R1_CLKSEL_L3 (4 << 0) | ||
84 | #define R1_CLKSEL_L4 (2 << 5) | ||
85 | #define R1_CLKSEL_USB (4 << 25) | ||
86 | #define R1_CM_CLKSEL1_CORE_VAL R1_CLKSEL_USB | RX_CLKSEL_SSI | \ | ||
87 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
88 | R1_CLKSEL_L4 | R1_CLKSEL_L3 | ||
89 | #define R1_CLKSEL_MPU (2 << 0) | ||
90 | #define R1_CM_CLKSEL_MPU_VAL R1_CLKSEL_MPU | ||
91 | #define R1_CLKSEL_DSP (2 << 0) | ||
92 | #define R1_CLKSEL_DSP_IF (2 << 5) | ||
93 | #define R1_CM_CLKSEL_DSP_VAL R1_CLKSEL_DSP | R1_CLKSEL_DSP_IF | ||
94 | #define R1_CLKSEL_GFX (2 << 0) | ||
95 | #define R1_CM_CLKSEL_GFX_VAL R1_CLKSEL_GFX | ||
96 | #define R1_CLKSEL_MDM (4 << 0) | ||
97 | #define R1_CM_CLKSEL_MDM_VAL R1_CLKSEL_MDM | ||
98 | |||
99 | /* 2430-Ratio Config 2 */ | ||
100 | #define R2_CLKSEL_L3 (6 << 0) | ||
101 | #define R2_CLKSEL_L4 (2 << 5) | ||
102 | #define R2_CLKSEL_USB (2 << 25) | ||
103 | #define R2_CM_CLKSEL1_CORE_VAL R2_CLKSEL_USB | RX_CLKSEL_SSI | \ | ||
104 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
105 | R2_CLKSEL_L4 | R2_CLKSEL_L3 | ||
106 | #define R2_CLKSEL_MPU (2 << 0) | ||
107 | #define R2_CM_CLKSEL_MPU_VAL R2_CLKSEL_MPU | ||
108 | #define R2_CLKSEL_DSP (2 << 0) | ||
109 | #define R2_CLKSEL_DSP_IF (3 << 5) | ||
110 | #define R2_CM_CLKSEL_DSP_VAL R2_CLKSEL_DSP | R2_CLKSEL_DSP_IF | ||
111 | #define R2_CLKSEL_GFX (2 << 0) | ||
112 | #define R2_CM_CLKSEL_GFX_VAL R2_CLKSEL_GFX | ||
113 | #define R2_CLKSEL_MDM (6 << 0) | ||
114 | #define R2_CM_CLKSEL_MDM_VAL R2_CLKSEL_MDM | ||
115 | |||
116 | /* 2430-Ratio Bootm (BYPASS) */ | ||
117 | #define RB_CLKSEL_L3 (1 << 0) | ||
118 | #define RB_CLKSEL_L4 (1 << 5) | ||
119 | #define RB_CLKSEL_USB (1 << 25) | ||
120 | #define RB_CM_CLKSEL1_CORE_VAL RB_CLKSEL_USB | RX_CLKSEL_SSI | \ | ||
121 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
122 | RB_CLKSEL_L4 | RB_CLKSEL_L3 | ||
123 | #define RB_CLKSEL_MPU (1 << 0) | ||
124 | #define RB_CM_CLKSEL_MPU_VAL RB_CLKSEL_MPU | ||
125 | #define RB_CLKSEL_DSP (1 << 0) | ||
126 | #define RB_CLKSEL_DSP_IF (1 << 5) | ||
127 | #define RB_CM_CLKSEL_DSP_VAL RB_CLKSEL_DSP | RB_CLKSEL_DSP_IF | ||
128 | #define RB_CLKSEL_GFX (1 << 0) | ||
129 | #define RB_CM_CLKSEL_GFX_VAL RB_CLKSEL_GFX | ||
130 | #define RB_CLKSEL_MDM (1 << 0) | ||
131 | #define RB_CM_CLKSEL_MDM_VAL RB_CLKSEL_MDM | ||
132 | |||
133 | /* 2420 Ratio Equivalents */ | ||
134 | #define RXX_CLKSEL_VLYNQ (0x12 << 15) | ||
135 | #define RXX_CLKSEL_SSI (0x8 << 20) | ||
136 | |||
137 | /* 2420-PRCM III 532MHz core */ | ||
138 | #define RIII_CLKSEL_L3 (4 << 0) /* 133MHz */ | ||
139 | #define RIII_CLKSEL_L4 (2 << 5) /* 66.5MHz */ | ||
140 | #define RIII_CLKSEL_USB (4 << 25) /* 33.25MHz */ | ||
141 | #define RIII_CM_CLKSEL1_CORE_VAL RIII_CLKSEL_USB | RXX_CLKSEL_SSI | \ | ||
142 | RXX_CLKSEL_VLYNQ | RX_CLKSEL_DSS2 | \ | ||
143 | RX_CLKSEL_DSS1 | RIII_CLKSEL_L4 | \ | ||
144 | RIII_CLKSEL_L3 | ||
145 | #define RIII_CLKSEL_MPU (2 << 0) /* 266MHz */ | ||
146 | #define RIII_CM_CLKSEL_MPU_VAL RIII_CLKSEL_MPU | ||
147 | #define RIII_CLKSEL_DSP (3 << 0) /* c5x - 177.3MHz */ | ||
148 | #define RIII_CLKSEL_DSP_IF (2 << 5) /* c5x - 88.67MHz */ | ||
149 | #define RIII_SYNC_DSP (1 << 7) /* Enable sync */ | ||
150 | #define RIII_CLKSEL_IVA (6 << 8) /* iva1 - 88.67MHz */ | ||
151 | #define RIII_SYNC_IVA (1 << 13) /* Enable sync */ | ||
152 | #define RIII_CM_CLKSEL_DSP_VAL RIII_SYNC_IVA | RIII_CLKSEL_IVA | \ | ||
153 | RIII_SYNC_DSP | RIII_CLKSEL_DSP_IF | \ | ||
154 | RIII_CLKSEL_DSP | ||
155 | #define RIII_CLKSEL_GFX (2 << 0) /* 66.5MHz */ | ||
156 | #define RIII_CM_CLKSEL_GFX_VAL RIII_CLKSEL_GFX | ||
157 | |||
158 | /* 2420-PRCM II 600MHz core */ | ||
159 | #define RII_CLKSEL_L3 (6 << 0) /* 100MHz */ | ||
160 | #define RII_CLKSEL_L4 (2 << 5) /* 50MHz */ | ||
161 | #define RII_CLKSEL_USB (2 << 25) /* 50MHz */ | ||
162 | #define RII_CM_CLKSEL1_CORE_VAL RII_CLKSEL_USB | \ | ||
163 | RXX_CLKSEL_SSI | RXX_CLKSEL_VLYNQ | \ | ||
164 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
165 | RII_CLKSEL_L4 | RII_CLKSEL_L3 | ||
166 | #define RII_CLKSEL_MPU (2 << 0) /* 300MHz */ | ||
167 | #define RII_CM_CLKSEL_MPU_VAL RII_CLKSEL_MPU | ||
168 | #define RII_CLKSEL_DSP (3 << 0) /* c5x - 200MHz */ | ||
169 | #define RII_CLKSEL_DSP_IF (2 << 5) /* c5x - 100MHz */ | ||
170 | #define RII_SYNC_DSP (0 << 7) /* Bypass sync */ | ||
171 | #define RII_CLKSEL_IVA (3 << 8) /* iva1 - 200MHz */ | ||
172 | #define RII_SYNC_IVA (0 << 13) /* Bypass sync */ | ||
173 | #define RII_CM_CLKSEL_DSP_VAL RII_SYNC_IVA | RII_CLKSEL_IVA | \ | ||
174 | RII_SYNC_DSP | RII_CLKSEL_DSP_IF | \ | ||
175 | RII_CLKSEL_DSP | ||
176 | #define RII_CLKSEL_GFX (2 << 0) /* 50MHz */ | ||
177 | #define RII_CM_CLKSEL_GFX_VAL RII_CLKSEL_GFX | ||
178 | |||
179 | /* 2420-PRCM I 660MHz core */ | ||
180 | #define RI_CLKSEL_L3 (4 << 0) /* 165MHz */ | ||
181 | #define RI_CLKSEL_L4 (2 << 5) /* 82.5MHz */ | ||
182 | #define RI_CLKSEL_USB (4 << 25) /* 41.25MHz */ | ||
183 | #define RI_CM_CLKSEL1_CORE_VAL RI_CLKSEL_USB | \ | ||
184 | RXX_CLKSEL_SSI | RXX_CLKSEL_VLYNQ | \ | ||
185 | RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \ | ||
186 | RI_CLKSEL_L4 | RI_CLKSEL_L3 | ||
187 | #define RI_CLKSEL_MPU (2 << 0) /* 330MHz */ | ||
188 | #define RI_CM_CLKSEL_MPU_VAL RI_CLKSEL_MPU | ||
189 | #define RI_CLKSEL_DSP (3 << 0) /* c5x - 220MHz */ | ||
190 | #define RI_CLKSEL_DSP_IF (2 << 5) /* c5x - 110MHz */ | ||
191 | #define RI_SYNC_DSP (1 << 7) /* Activate sync */ | ||
192 | #define RI_CLKSEL_IVA (4 << 8) /* iva1 - 165MHz */ | ||
193 | #define RI_SYNC_IVA (0 << 13) /* Bypass sync */ | ||
194 | #define RI_CM_CLKSEL_DSP_VAL RI_SYNC_IVA | RI_CLKSEL_IVA | \ | ||
195 | RI_SYNC_DSP | RI_CLKSEL_DSP_IF | \ | ||
196 | RI_CLKSEL_DSP | ||
197 | #define RI_CLKSEL_GFX (1 << 0) /* 165MHz */ | ||
198 | #define RI_CM_CLKSEL_GFX_VAL RI_CLKSEL_GFX | ||
199 | |||
200 | /* 2420-PRCM VII (boot) */ | ||
201 | #define RVII_CLKSEL_L3 (1 << 0) | ||
202 | #define RVII_CLKSEL_L4 (1 << 5) | ||
203 | #define RVII_CLKSEL_DSS1 (1 << 8) | ||
204 | #define RVII_CLKSEL_DSS2 (0 << 13) | ||
205 | #define RVII_CLKSEL_VLYNQ (1 << 15) | ||
206 | #define RVII_CLKSEL_SSI (1 << 20) | ||
207 | #define RVII_CLKSEL_USB (1 << 25) | ||
208 | |||
209 | #define RVII_CM_CLKSEL1_CORE_VAL RVII_CLKSEL_USB | RVII_CLKSEL_SSI | \ | ||
210 | RVII_CLKSEL_VLYNQ | RVII_CLKSEL_DSS2 | \ | ||
211 | RVII_CLKSEL_DSS1 | RVII_CLKSEL_L4 | RVII_CLKSEL_L3 | ||
212 | |||
213 | #define RVII_CLKSEL_MPU (1 << 0) /* all divide by 1 */ | ||
214 | #define RVII_CM_CLKSEL_MPU_VAL RVII_CLKSEL_MPU | ||
215 | |||
216 | #define RVII_CLKSEL_DSP (1 << 0) | ||
217 | #define RVII_CLKSEL_DSP_IF (1 << 5) | ||
218 | #define RVII_SYNC_DSP (0 << 7) | ||
219 | #define RVII_CLKSEL_IVA (1 << 8) | ||
220 | #define RVII_SYNC_IVA (0 << 13) | ||
221 | #define RVII_CM_CLKSEL_DSP_VAL RVII_SYNC_IVA | RVII_CLKSEL_IVA | RVII_SYNC_DSP | \ | ||
222 | RVII_CLKSEL_DSP_IF | RVII_CLKSEL_DSP | ||
223 | |||
224 | #define RVII_CLKSEL_GFX (1 << 0) | ||
225 | #define RVII_CM_CLKSEL_GFX_VAL RVII_CLKSEL_GFX | ||
226 | |||
227 | /*------------------------------------------------------------------------- | ||
228 | * 2430 Target modes: Along with each configuration the CPU has several | ||
229 | * modes which goes along with them. Modes mainly are the addition of | ||
230 | * describe DPLL combinations to go along with a ratio. | ||
231 | *-------------------------------------------------------------------------*/ | ||
232 | |||
233 | /* Hardware governed */ | ||
234 | #define MX_48M_SRC (0 << 3) | ||
235 | #define MX_54M_SRC (0 << 5) | ||
236 | #define MX_APLLS_CLIKIN_12 (3 << 23) | ||
237 | #define MX_APLLS_CLIKIN_13 (2 << 23) | ||
238 | #define MX_APLLS_CLIKIN_19_2 (0 << 23) | ||
239 | |||
240 | /* | ||
241 | * 2430 - standalone, 2*ref*M/(n+1), M/N is for exactness not relock speed | ||
242 | * #5a (ratio1) baseport-target, target DPLL = 266*2 = 532MHz | ||
243 | */ | ||
244 | #define M5A_DPLL_MULT_12 (133 << 12) | ||
245 | #define M5A_DPLL_DIV_12 (5 << 8) | ||
246 | #define M5A_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
247 | M5A_DPLL_DIV_12 | M5A_DPLL_MULT_12 | \ | ||
248 | MX_APLLS_CLIKIN_12 | ||
249 | #define M5A_DPLL_MULT_13 (61 << 12) | ||
250 | #define M5A_DPLL_DIV_13 (2 << 8) | ||
251 | #define M5A_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
252 | M5A_DPLL_DIV_13 | M5A_DPLL_MULT_13 | \ | ||
253 | MX_APLLS_CLIKIN_13 | ||
254 | #define M5A_DPLL_MULT_19 (55 << 12) | ||
255 | #define M5A_DPLL_DIV_19 (3 << 8) | ||
256 | #define M5A_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
257 | M5A_DPLL_DIV_19 | M5A_DPLL_MULT_19 | \ | ||
258 | MX_APLLS_CLIKIN_19_2 | ||
259 | /* #5b (ratio1) target DPLL = 200*2 = 400MHz */ | ||
260 | #define M5B_DPLL_MULT_12 (50 << 12) | ||
261 | #define M5B_DPLL_DIV_12 (2 << 8) | ||
262 | #define M5B_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
263 | M5B_DPLL_DIV_12 | M5B_DPLL_MULT_12 | \ | ||
264 | MX_APLLS_CLIKIN_12 | ||
265 | #define M5B_DPLL_MULT_13 (200 << 12) | ||
266 | #define M5B_DPLL_DIV_13 (12 << 8) | ||
267 | |||
268 | #define M5B_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
269 | M5B_DPLL_DIV_13 | M5B_DPLL_MULT_13 | \ | ||
270 | MX_APLLS_CLIKIN_13 | ||
271 | #define M5B_DPLL_MULT_19 (125 << 12) | ||
272 | #define M5B_DPLL_DIV_19 (31 << 8) | ||
273 | #define M5B_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
274 | M5B_DPLL_DIV_19 | M5B_DPLL_MULT_19 | \ | ||
275 | MX_APLLS_CLIKIN_19_2 | ||
276 | /* | ||
277 | * #4 (ratio2), DPLL = 399*2 = 798MHz, L3=133MHz | ||
278 | */ | ||
279 | #define M4_DPLL_MULT_12 (133 << 12) | ||
280 | #define M4_DPLL_DIV_12 (3 << 8) | ||
281 | #define M4_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
282 | M4_DPLL_DIV_12 | M4_DPLL_MULT_12 | \ | ||
283 | MX_APLLS_CLIKIN_12 | ||
284 | |||
285 | #define M4_DPLL_MULT_13 (399 << 12) | ||
286 | #define M4_DPLL_DIV_13 (12 << 8) | ||
287 | #define M4_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
288 | M4_DPLL_DIV_13 | M4_DPLL_MULT_13 | \ | ||
289 | MX_APLLS_CLIKIN_13 | ||
290 | |||
291 | #define M4_DPLL_MULT_19 (145 << 12) | ||
292 | #define M4_DPLL_DIV_19 (6 << 8) | ||
293 | #define M4_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
294 | M4_DPLL_DIV_19 | M4_DPLL_MULT_19 | \ | ||
295 | MX_APLLS_CLIKIN_19_2 | ||
296 | |||
297 | /* | ||
298 | * #3 (ratio2) baseport-target, target DPLL = 330*2 = 660MHz | ||
299 | */ | ||
300 | #define M3_DPLL_MULT_12 (55 << 12) | ||
301 | #define M3_DPLL_DIV_12 (1 << 8) | ||
302 | #define M3_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
303 | M3_DPLL_DIV_12 | M3_DPLL_MULT_12 | \ | ||
304 | MX_APLLS_CLIKIN_12 | ||
305 | #define M3_DPLL_MULT_13 (76 << 12) | ||
306 | #define M3_DPLL_DIV_13 (2 << 8) | ||
307 | #define M3_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
308 | M3_DPLL_DIV_13 | M3_DPLL_MULT_13 | \ | ||
309 | MX_APLLS_CLIKIN_13 | ||
310 | #define M3_DPLL_MULT_19 (17 << 12) | ||
311 | #define M3_DPLL_DIV_19 (0 << 8) | ||
312 | #define M3_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
313 | M3_DPLL_DIV_19 | M3_DPLL_MULT_19 | \ | ||
314 | MX_APLLS_CLIKIN_19_2 | ||
315 | |||
316 | /* | ||
317 | * #2 (ratio1) DPLL = 330*2 = 660MHz, L3=165MHz | ||
318 | */ | ||
319 | #define M2_DPLL_MULT_12 (55 << 12) | ||
320 | #define M2_DPLL_DIV_12 (1 << 8) | ||
321 | #define M2_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
322 | M2_DPLL_DIV_12 | M2_DPLL_MULT_12 | \ | ||
323 | MX_APLLS_CLIKIN_12 | ||
324 | |||
325 | /* Speed changes - Used 658.7MHz instead of 660MHz for LP-Refresh M=76 N=2, | ||
326 | * relock time issue */ | ||
327 | /* Core frequency changed from 330/165 to 329/164 MHz*/ | ||
328 | #define M2_DPLL_MULT_13 (76 << 12) | ||
329 | #define M2_DPLL_DIV_13 (2 << 8) | ||
330 | #define M2_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
331 | M2_DPLL_DIV_13 | M2_DPLL_MULT_13 | \ | ||
332 | MX_APLLS_CLIKIN_13 | ||
333 | |||
334 | #define M2_DPLL_MULT_19 (17 << 12) | ||
335 | #define M2_DPLL_DIV_19 (0 << 8) | ||
336 | #define M2_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
337 | M2_DPLL_DIV_19 | M2_DPLL_MULT_19 | \ | ||
338 | MX_APLLS_CLIKIN_19_2 | ||
339 | |||
340 | /* boot (boot) */ | ||
341 | #define MB_DPLL_MULT (1 << 12) | ||
342 | #define MB_DPLL_DIV (0 << 8) | ||
343 | #define MB_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\ | ||
344 | MB_DPLL_MULT | MX_APLLS_CLIKIN_12 | ||
345 | |||
346 | #define MB_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\ | ||
347 | MB_DPLL_MULT | MX_APLLS_CLIKIN_13 | ||
348 | |||
349 | #define MB_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\ | ||
350 | MB_DPLL_MULT | MX_APLLS_CLIKIN_19 | ||
351 | |||
352 | /* | ||
353 | * 2430 - chassis (sedna) | ||
354 | * 165 (ratio1) same as above #2 | ||
355 | * 150 (ratio1) | ||
356 | * 133 (ratio2) same as above #4 | ||
357 | * 110 (ratio2) same as above #3 | ||
358 | * 104 (ratio2) | ||
359 | * boot (boot) | ||
360 | */ | ||
361 | |||
362 | /* PRCM I target DPLL = 2*330MHz = 660MHz */ | ||
363 | #define MI_DPLL_MULT_12 (55 << 12) | ||
364 | #define MI_DPLL_DIV_12 (1 << 8) | ||
365 | #define MI_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
366 | MI_DPLL_DIV_12 | MI_DPLL_MULT_12 | \ | ||
367 | MX_APLLS_CLIKIN_12 | ||
368 | |||
369 | /* | ||
370 | * 2420 Equivalent - mode registers | ||
371 | * PRCM II , target DPLL = 2*300MHz = 600MHz | ||
372 | */ | ||
373 | #define MII_DPLL_MULT_12 (50 << 12) | ||
374 | #define MII_DPLL_DIV_12 (1 << 8) | ||
375 | #define MII_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
376 | MII_DPLL_DIV_12 | MII_DPLL_MULT_12 | \ | ||
377 | MX_APLLS_CLIKIN_12 | ||
378 | #define MII_DPLL_MULT_13 (300 << 12) | ||
379 | #define MII_DPLL_DIV_13 (12 << 8) | ||
380 | #define MII_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
381 | MII_DPLL_DIV_13 | MII_DPLL_MULT_13 | \ | ||
382 | MX_APLLS_CLIKIN_13 | ||
383 | |||
384 | /* PRCM III target DPLL = 2*266 = 532MHz*/ | ||
385 | #define MIII_DPLL_MULT_12 (133 << 12) | ||
386 | #define MIII_DPLL_DIV_12 (5 << 8) | ||
387 | #define MIII_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
388 | MIII_DPLL_DIV_12 | MIII_DPLL_MULT_12 | \ | ||
389 | MX_APLLS_CLIKIN_12 | ||
390 | #define MIII_DPLL_MULT_13 (266 << 12) | ||
391 | #define MIII_DPLL_DIV_13 (12 << 8) | ||
392 | #define MIII_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \ | ||
393 | MIII_DPLL_DIV_13 | MIII_DPLL_MULT_13 | \ | ||
394 | MX_APLLS_CLIKIN_13 | ||
395 | |||
396 | /* PRCM VII (boot bypass) */ | ||
397 | #define MVII_CM_CLKSEL1_PLL_12_VAL MB_CM_CLKSEL1_PLL_12_VAL | ||
398 | #define MVII_CM_CLKSEL1_PLL_13_VAL MB_CM_CLKSEL1_PLL_13_VAL | ||
399 | |||
400 | /* High and low operation value */ | ||
401 | #define MX_CLKSEL2_PLL_2x_VAL (2 << 0) | ||
402 | #define MX_CLKSEL2_PLL_1x_VAL (1 << 0) | ||
403 | |||
404 | /* MPU speed defines */ | ||
405 | #define S12M 12000000 | ||
406 | #define S13M 13000000 | ||
407 | #define S19M 19200000 | ||
408 | #define S26M 26000000 | ||
409 | #define S100M 100000000 | ||
410 | #define S133M 133000000 | ||
411 | #define S150M 150000000 | ||
412 | #define S164M 164000000 | ||
413 | #define S165M 165000000 | ||
414 | #define S199M 199000000 | ||
415 | #define S200M 200000000 | ||
416 | #define S266M 266000000 | ||
417 | #define S300M 300000000 | ||
418 | #define S329M 329000000 | ||
419 | #define S330M 330000000 | ||
420 | #define S399M 399000000 | ||
421 | #define S400M 400000000 | ||
422 | #define S532M 532000000 | ||
423 | #define S600M 600000000 | ||
424 | #define S658M 658000000 | ||
425 | #define S660M 660000000 | ||
426 | #define S798M 798000000 | ||
427 | |||
428 | /*------------------------------------------------------------------------- | ||
429 | * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | ||
430 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, | ||
431 | * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, | ||
432 | * CM_CLKSEL2_PLL, CM_CLKSEL_MDM | ||
433 | * | ||
434 | * Filling in table based on H4 boards and 2430-SDPs variants available. | ||
435 | * There are quite a few more rates combinations which could be defined. | ||
436 | * | ||
437 | * When multiple values are defined the start up will try and choose the | ||
438 | * fastest one. If a 'fast' value is defined, then automatically, the /2 | ||
439 | * one should be included as it can be used. Generally having more that | ||
440 | * one fast set does not make sense, as static timings need to be changed | ||
441 | * to change the set. The exception is the bypass setting which is | ||
442 | * availble for low power bypass. | ||
443 | * | ||
444 | * Note: This table needs to be sorted, fastest to slowest. | ||
445 | *-------------------------------------------------------------------------*/ | ||
446 | static struct prcm_config rate_table[] = { | ||
447 | /* PRCM I - FAST */ | ||
448 | {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */ | ||
449 | RI_CM_CLKSEL_DSP_VAL, RI_CM_CLKSEL_GFX_VAL, | ||
450 | RI_CM_CLKSEL1_CORE_VAL, MI_CM_CLKSEL1_PLL_12_VAL, | ||
451 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_165MHz, | ||
452 | RATE_IN_242X}, | ||
453 | |||
454 | /* PRCM II - FAST */ | ||
455 | {S12M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */ | ||
456 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
457 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL, | ||
458 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz, | ||
459 | RATE_IN_242X}, | ||
460 | |||
461 | {S13M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */ | ||
462 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
463 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL, | ||
464 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz, | ||
465 | RATE_IN_242X}, | ||
466 | |||
467 | /* PRCM III - FAST */ | ||
468 | {S12M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */ | ||
469 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
470 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL, | ||
471 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz, | ||
472 | RATE_IN_242X}, | ||
473 | |||
474 | {S13M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */ | ||
475 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
476 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL, | ||
477 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz, | ||
478 | RATE_IN_242X}, | ||
479 | |||
480 | /* PRCM II - SLOW */ | ||
481 | {S12M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */ | ||
482 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
483 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL, | ||
484 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz, | ||
485 | RATE_IN_242X}, | ||
486 | |||
487 | {S13M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */ | ||
488 | RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL, | ||
489 | RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL, | ||
490 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz, | ||
491 | RATE_IN_242X}, | ||
492 | |||
493 | /* PRCM III - SLOW */ | ||
494 | {S12M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */ | ||
495 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
496 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL, | ||
497 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz, | ||
498 | RATE_IN_242X}, | ||
499 | |||
500 | {S13M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */ | ||
501 | RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL, | ||
502 | RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL, | ||
503 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz, | ||
504 | RATE_IN_242X}, | ||
505 | |||
506 | /* PRCM-VII (boot-bypass) */ | ||
507 | {S12M, S12M, S12M, RVII_CM_CLKSEL_MPU_VAL, /* 12MHz ARM*/ | ||
508 | RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL, | ||
509 | RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_12_VAL, | ||
510 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS, | ||
511 | RATE_IN_242X}, | ||
512 | |||
513 | /* PRCM-VII (boot-bypass) */ | ||
514 | {S13M, S13M, S13M, RVII_CM_CLKSEL_MPU_VAL, /* 13MHz ARM */ | ||
515 | RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL, | ||
516 | RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_13_VAL, | ||
517 | MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS, | ||
518 | RATE_IN_242X}, | ||
519 | |||
520 | /* PRCM #4 - ratio2 (ES2.1) - FAST */ | ||
521 | {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */ | ||
522 | R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL, | ||
523 | R2_CM_CLKSEL1_CORE_VAL, M4_CM_CLKSEL1_PLL_13_VAL, | ||
524 | MX_CLKSEL2_PLL_2x_VAL, R2_CM_CLKSEL_MDM_VAL, | ||
525 | SDRC_RFR_CTRL_133MHz, | ||
526 | RATE_IN_243X}, | ||
527 | |||
528 | /* PRCM #2 - ratio1 (ES2) - FAST */ | ||
529 | {S13M, S658M, S329M, R1_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */ | ||
530 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
531 | R1_CM_CLKSEL1_CORE_VAL, M2_CM_CLKSEL1_PLL_13_VAL, | ||
532 | MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
533 | SDRC_RFR_CTRL_165MHz, | ||
534 | RATE_IN_243X}, | ||
535 | |||
536 | /* PRCM #5a - ratio1 - FAST */ | ||
537 | {S13M, S532M, S266M, R1_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */ | ||
538 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
539 | R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL, | ||
540 | MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
541 | SDRC_RFR_CTRL_133MHz, | ||
542 | RATE_IN_243X}, | ||
543 | |||
544 | /* PRCM #5b - ratio1 - FAST */ | ||
545 | {S13M, S400M, S200M, R1_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */ | ||
546 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
547 | R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL, | ||
548 | MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
549 | SDRC_RFR_CTRL_100MHz, | ||
550 | RATE_IN_243X}, | ||
551 | |||
552 | /* PRCM #4 - ratio1 (ES2.1) - SLOW */ | ||
553 | {S13M, S399M, S199M, R2_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */ | ||
554 | R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL, | ||
555 | R2_CM_CLKSEL1_CORE_VAL, M4_CM_CLKSEL1_PLL_13_VAL, | ||
556 | MX_CLKSEL2_PLL_1x_VAL, R2_CM_CLKSEL_MDM_VAL, | ||
557 | SDRC_RFR_CTRL_133MHz, | ||
558 | RATE_IN_243X}, | ||
559 | |||
560 | /* PRCM #2 - ratio1 (ES2) - SLOW */ | ||
561 | {S13M, S329M, S164M, R1_CM_CLKSEL_MPU_VAL, /* 165MHz ARM */ | ||
562 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
563 | R1_CM_CLKSEL1_CORE_VAL, M2_CM_CLKSEL1_PLL_13_VAL, | ||
564 | MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
565 | SDRC_RFR_CTRL_165MHz, | ||
566 | RATE_IN_243X}, | ||
567 | |||
568 | /* PRCM #5a - ratio1 - SLOW */ | ||
569 | {S13M, S266M, S133M, R1_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */ | ||
570 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
571 | R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL, | ||
572 | MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
573 | SDRC_RFR_CTRL_133MHz, | ||
574 | RATE_IN_243X}, | ||
575 | |||
576 | /* PRCM #5b - ratio1 - SLOW*/ | ||
577 | {S13M, S200M, S100M, R1_CM_CLKSEL_MPU_VAL, /* 100MHz ARM */ | ||
578 | R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL, | ||
579 | R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL, | ||
580 | MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL, | ||
581 | SDRC_RFR_CTRL_100MHz, | ||
582 | RATE_IN_243X}, | ||
583 | |||
584 | /* PRCM-boot/bypass */ | ||
585 | {S13M, S13M, S13M, RB_CM_CLKSEL_MPU_VAL, /* 13Mhz */ | ||
586 | RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL, | ||
587 | RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_13_VAL, | ||
588 | MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL, | ||
589 | SDRC_RFR_CTRL_BYPASS, | ||
590 | RATE_IN_243X}, | ||
591 | |||
592 | /* PRCM-boot/bypass */ | ||
593 | {S12M, S12M, S12M, RB_CM_CLKSEL_MPU_VAL, /* 12Mhz */ | ||
594 | RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL, | ||
595 | RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_12_VAL, | ||
596 | MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL, | ||
597 | SDRC_RFR_CTRL_BYPASS, | ||
598 | RATE_IN_243X}, | ||
599 | |||
600 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | ||
601 | }; | ||
602 | |||
603 | /*------------------------------------------------------------------------- | ||
604 | * 24xx clock tree. | ||
605 | * | ||
606 | * NOTE:In many cases here we are assigning a 'default' parent. In many | ||
607 | * cases the parent is selectable. The get/set parent calls will also | ||
608 | * switch sources. | ||
609 | * | ||
610 | * Many some clocks say always_enabled, but they can be auto idled for | ||
611 | * power savings. They will always be available upon clock request. | ||
612 | * | ||
613 | * Several sources are given initial rates which may be wrong, this will | ||
614 | * be fixed up in the init func. | ||
615 | * | ||
616 | * Things are broadly separated below by clock domains. It is | ||
617 | * noteworthy that most periferals have dependencies on multiple clock | ||
618 | * domains. Many get their interface clocks from the L4 domain, but get | ||
619 | * functional clocks from fixed sources or other core domain derived | ||
620 | * clocks. | ||
621 | *-------------------------------------------------------------------------*/ | ||
622 | |||
623 | /* Base external input clocks */ | ||
624 | static struct clk func_32k_ck = { | ||
625 | .name = "func_32k_ck", | ||
626 | .rate = 32000, | ||
627 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
628 | RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
629 | .recalc = &propagate_rate, | ||
630 | }; | ||
631 | |||
632 | /* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ | ||
633 | static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ | ||
634 | .name = "osc_ck", | ||
635 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
636 | RATE_PROPAGATES, | ||
637 | .enable = &omap2_enable_osc_ck, | ||
638 | .disable = &omap2_disable_osc_ck, | ||
639 | .recalc = &omap2_osc_clk_recalc, | ||
640 | }; | ||
641 | |||
642 | /* With out modem likely 12MHz, with modem likely 13MHz */ | ||
643 | static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */ | ||
644 | .name = "sys_ck", /* ~ ref_clk also */ | ||
645 | .parent = &osc_ck, | ||
646 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
647 | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
648 | .recalc = &omap2_sys_clk_recalc, | ||
649 | }; | ||
650 | |||
651 | static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ | ||
652 | .name = "alt_ck", | ||
653 | .rate = 54000000, | ||
654 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
655 | RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
656 | .recalc = &propagate_rate, | ||
657 | }; | ||
658 | |||
659 | /* | ||
660 | * Analog domain root source clocks | ||
661 | */ | ||
662 | |||
663 | /* dpll_ck, is broken out in to special cases through clksel */ | ||
664 | /* REVISIT: Rate changes on dpll_ck trigger a full set change. ... | ||
665 | * deal with this | ||
666 | */ | ||
667 | |||
668 | static const struct dpll_data dpll_dd = { | ||
669 | .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
670 | .mult_mask = OMAP24XX_DPLL_MULT_MASK, | ||
671 | .div1_mask = OMAP24XX_DPLL_DIV_MASK, | ||
672 | }; | ||
673 | |||
674 | static struct clk dpll_ck = { | ||
675 | .name = "dpll_ck", | ||
676 | .parent = &sys_ck, /* Can be func_32k also */ | ||
677 | .dpll_data = &dpll_dd, | ||
678 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
679 | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
680 | .recalc = &omap2_dpll_recalc, | ||
681 | .set_rate = &omap2_reprogram_dpll, | ||
682 | }; | ||
683 | |||
684 | static struct clk apll96_ck = { | ||
685 | .name = "apll96_ck", | ||
686 | .parent = &sys_ck, | ||
687 | .rate = 96000000, | ||
688 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
689 | RATE_FIXED | RATE_PROPAGATES | ENABLE_ON_INIT, | ||
690 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
691 | .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT, | ||
692 | .enable = &omap2_clk_fixed_enable, | ||
693 | .disable = &omap2_clk_fixed_disable, | ||
694 | .recalc = &propagate_rate, | ||
695 | }; | ||
696 | |||
697 | static struct clk apll54_ck = { | ||
698 | .name = "apll54_ck", | ||
699 | .parent = &sys_ck, | ||
700 | .rate = 54000000, | ||
701 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
702 | RATE_FIXED | RATE_PROPAGATES | ENABLE_ON_INIT, | ||
703 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
704 | .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT, | ||
705 | .enable = &omap2_clk_fixed_enable, | ||
706 | .disable = &omap2_clk_fixed_disable, | ||
707 | .recalc = &propagate_rate, | ||
708 | }; | ||
709 | |||
710 | /* | ||
711 | * PRCM digital base sources | ||
712 | */ | ||
713 | |||
714 | /* func_54m_ck */ | ||
715 | |||
716 | static const struct clksel_rate func_54m_apll54_rates[] = { | ||
717 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
718 | { .div = 0 }, | ||
719 | }; | ||
720 | |||
721 | static const struct clksel_rate func_54m_alt_rates[] = { | ||
722 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
723 | { .div = 0 }, | ||
724 | }; | ||
725 | |||
726 | static const struct clksel func_54m_clksel[] = { | ||
727 | { .parent = &apll54_ck, .rates = func_54m_apll54_rates, }, | ||
728 | { .parent = &alt_ck, .rates = func_54m_alt_rates, }, | ||
729 | { .parent = NULL }, | ||
730 | }; | ||
731 | |||
732 | static struct clk func_54m_ck = { | ||
733 | .name = "func_54m_ck", | ||
734 | .parent = &apll54_ck, /* can also be alt_clk */ | ||
735 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
736 | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, | ||
737 | .init = &omap2_init_clksel_parent, | ||
738 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
739 | .clksel_mask = OMAP24XX_54M_SOURCE, | ||
740 | .clksel = func_54m_clksel, | ||
741 | .recalc = &omap2_clksel_recalc, | ||
742 | }; | ||
743 | |||
744 | static struct clk core_ck = { | ||
745 | .name = "core_ck", | ||
746 | .parent = &dpll_ck, /* can also be 32k */ | ||
747 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
748 | ALWAYS_ENABLED | RATE_PROPAGATES, | ||
749 | .recalc = &followparent_recalc, | ||
750 | }; | ||
751 | |||
752 | /* func_96m_ck */ | ||
753 | static const struct clksel_rate func_96m_apll96_rates[] = { | ||
754 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
755 | { .div = 0 }, | ||
756 | }; | ||
757 | |||
758 | static const struct clksel_rate func_96m_alt_rates[] = { | ||
759 | { .div = 1, .val = 1, .flags = RATE_IN_243X | DEFAULT_RATE }, | ||
760 | { .div = 0 }, | ||
761 | }; | ||
762 | |||
763 | static const struct clksel func_96m_clksel[] = { | ||
764 | { .parent = &apll96_ck, .rates = func_96m_apll96_rates }, | ||
765 | { .parent = &alt_ck, .rates = func_96m_alt_rates }, | ||
766 | { .parent = NULL } | ||
767 | }; | ||
768 | |||
769 | /* The parent of this clock is not selectable on 2420. */ | ||
770 | static struct clk func_96m_ck = { | ||
771 | .name = "func_96m_ck", | ||
772 | .parent = &apll96_ck, | ||
773 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
774 | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, | ||
775 | .init = &omap2_init_clksel_parent, | ||
776 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
777 | .clksel_mask = OMAP2430_96M_SOURCE, | ||
778 | .clksel = func_96m_clksel, | ||
779 | .recalc = &omap2_clksel_recalc, | ||
780 | .round_rate = &omap2_clksel_round_rate, | ||
781 | .set_rate = &omap2_clksel_set_rate | ||
782 | }; | ||
783 | |||
784 | /* func_48m_ck */ | ||
785 | |||
786 | static const struct clksel_rate func_48m_apll96_rates[] = { | ||
787 | { .div = 2, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
788 | { .div = 0 }, | ||
789 | }; | ||
790 | |||
791 | static const struct clksel_rate func_48m_alt_rates[] = { | ||
792 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
793 | { .div = 0 }, | ||
794 | }; | ||
795 | |||
796 | static const struct clksel func_48m_clksel[] = { | ||
797 | { .parent = &apll96_ck, .rates = func_48m_apll96_rates }, | ||
798 | { .parent = &alt_ck, .rates = func_48m_alt_rates }, | ||
799 | { .parent = NULL } | ||
800 | }; | ||
801 | |||
802 | static struct clk func_48m_ck = { | ||
803 | .name = "func_48m_ck", | ||
804 | .parent = &apll96_ck, /* 96M or Alt */ | ||
805 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
806 | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, | ||
807 | .init = &omap2_init_clksel_parent, | ||
808 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
809 | .clksel_mask = OMAP24XX_48M_SOURCE, | ||
810 | .clksel = func_48m_clksel, | ||
811 | .recalc = &omap2_clksel_recalc, | ||
812 | .round_rate = &omap2_clksel_round_rate, | ||
813 | .set_rate = &omap2_clksel_set_rate | ||
814 | }; | ||
815 | |||
816 | static struct clk func_12m_ck = { | ||
817 | .name = "func_12m_ck", | ||
818 | .parent = &func_48m_ck, | ||
819 | .fixed_div = 4, | ||
820 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
821 | RATE_PROPAGATES | PARENT_CONTROLS_CLOCK, | ||
822 | .recalc = &omap2_fixed_divisor_recalc, | ||
823 | }; | ||
824 | |||
825 | /* Secure timer, only available in secure mode */ | ||
826 | static struct clk wdt1_osc_ck = { | ||
827 | .name = "ck_wdt1_osc", | ||
828 | .parent = &osc_ck, | ||
829 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
830 | .recalc = &followparent_recalc, | ||
831 | }; | ||
832 | |||
833 | /* | ||
834 | * The common_clkout* clksel_rate structs are common to | ||
835 | * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src. | ||
836 | * sys_clkout2_* are 2420-only, so the | ||
837 | * clksel_rate flags fields are inaccurate for those clocks. This is | ||
838 | * harmless since access to those clocks are gated by the struct clk | ||
839 | * flags fields, which mark them as 2420-only. | ||
840 | */ | ||
841 | static const struct clksel_rate common_clkout_src_core_rates[] = { | ||
842 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
843 | { .div = 0 } | ||
844 | }; | ||
845 | |||
846 | static const struct clksel_rate common_clkout_src_sys_rates[] = { | ||
847 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
848 | { .div = 0 } | ||
849 | }; | ||
850 | |||
851 | static const struct clksel_rate common_clkout_src_96m_rates[] = { | ||
852 | { .div = 1, .val = 2, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
853 | { .div = 0 } | ||
854 | }; | ||
855 | |||
856 | static const struct clksel_rate common_clkout_src_54m_rates[] = { | ||
857 | { .div = 1, .val = 3, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
858 | { .div = 0 } | ||
859 | }; | ||
860 | |||
861 | static const struct clksel common_clkout_src_clksel[] = { | ||
862 | { .parent = &core_ck, .rates = common_clkout_src_core_rates }, | ||
863 | { .parent = &sys_ck, .rates = common_clkout_src_sys_rates }, | ||
864 | { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates }, | ||
865 | { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates }, | ||
866 | { .parent = NULL } | ||
867 | }; | ||
868 | |||
869 | static struct clk sys_clkout_src = { | ||
870 | .name = "sys_clkout_src", | ||
871 | .parent = &func_54m_ck, | ||
872 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
873 | RATE_PROPAGATES, | ||
874 | .enable_reg = OMAP24XX_PRCM_CLKOUT_CTRL, | ||
875 | .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT, | ||
876 | .init = &omap2_init_clksel_parent, | ||
877 | .clksel_reg = OMAP24XX_PRCM_CLKOUT_CTRL, | ||
878 | .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK, | ||
879 | .clksel = common_clkout_src_clksel, | ||
880 | .recalc = &omap2_clksel_recalc, | ||
881 | .round_rate = &omap2_clksel_round_rate, | ||
882 | .set_rate = &omap2_clksel_set_rate | ||
883 | }; | ||
884 | |||
885 | static const struct clksel_rate common_clkout_rates[] = { | ||
886 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
887 | { .div = 2, .val = 1, .flags = RATE_IN_24XX }, | ||
888 | { .div = 4, .val = 2, .flags = RATE_IN_24XX }, | ||
889 | { .div = 8, .val = 3, .flags = RATE_IN_24XX }, | ||
890 | { .div = 16, .val = 4, .flags = RATE_IN_24XX }, | ||
891 | { .div = 0 }, | ||
892 | }; | ||
893 | |||
894 | static const struct clksel sys_clkout_clksel[] = { | ||
895 | { .parent = &sys_clkout_src, .rates = common_clkout_rates }, | ||
896 | { .parent = NULL } | ||
897 | }; | ||
898 | |||
899 | static struct clk sys_clkout = { | ||
900 | .name = "sys_clkout", | ||
901 | .parent = &sys_clkout_src, | ||
902 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
903 | PARENT_CONTROLS_CLOCK, | ||
904 | .clksel_reg = OMAP24XX_PRCM_CLKOUT_CTRL, | ||
905 | .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK, | ||
906 | .clksel = sys_clkout_clksel, | ||
907 | .recalc = &omap2_clksel_recalc, | ||
908 | .round_rate = &omap2_clksel_round_rate, | ||
909 | .set_rate = &omap2_clksel_set_rate | ||
910 | }; | ||
911 | |||
912 | /* In 2430, new in 2420 ES2 */ | ||
913 | static struct clk sys_clkout2_src = { | ||
914 | .name = "sys_clkout2_src", | ||
915 | .parent = &func_54m_ck, | ||
916 | .flags = CLOCK_IN_OMAP242X | RATE_PROPAGATES, | ||
917 | .enable_reg = OMAP24XX_PRCM_CLKOUT_CTRL, | ||
918 | .enable_bit = OMAP2420_CLKOUT2_EN_SHIFT, | ||
919 | .init = &omap2_init_clksel_parent, | ||
920 | .clksel_reg = OMAP24XX_PRCM_CLKOUT_CTRL, | ||
921 | .clksel_mask = OMAP2420_CLKOUT2_SOURCE_MASK, | ||
922 | .clksel = common_clkout_src_clksel, | ||
923 | .recalc = &omap2_clksel_recalc, | ||
924 | .round_rate = &omap2_clksel_round_rate, | ||
925 | .set_rate = &omap2_clksel_set_rate | ||
926 | }; | ||
927 | |||
928 | static const struct clksel sys_clkout2_clksel[] = { | ||
929 | { .parent = &sys_clkout2_src, .rates = common_clkout_rates }, | ||
930 | { .parent = NULL } | ||
931 | }; | ||
932 | |||
933 | /* In 2430, new in 2420 ES2 */ | ||
934 | static struct clk sys_clkout2 = { | ||
935 | .name = "sys_clkout2", | ||
936 | .parent = &sys_clkout2_src, | ||
937 | .flags = CLOCK_IN_OMAP242X | PARENT_CONTROLS_CLOCK, | ||
938 | .clksel_reg = OMAP24XX_PRCM_CLKOUT_CTRL, | ||
939 | .clksel_mask = OMAP2420_CLKOUT2_DIV_MASK, | ||
940 | .clksel = sys_clkout2_clksel, | ||
941 | .recalc = &omap2_clksel_recalc, | ||
942 | .round_rate = &omap2_clksel_round_rate, | ||
943 | .set_rate = &omap2_clksel_set_rate | ||
944 | }; | ||
945 | |||
946 | static struct clk emul_ck = { | ||
947 | .name = "emul_ck", | ||
948 | .parent = &func_54m_ck, | ||
949 | .flags = CLOCK_IN_OMAP242X, | ||
950 | .enable_reg = OMAP24XX_PRCM_CLKEMUL_CTRL, | ||
951 | .enable_bit = OMAP24XX_EMULATION_EN_SHIFT, | ||
952 | .recalc = &followparent_recalc, | ||
953 | |||
954 | }; | ||
955 | |||
956 | /* | ||
957 | * MPU clock domain | ||
958 | * Clocks: | ||
959 | * MPU_FCLK, MPU_ICLK | ||
960 | * INT_M_FCLK, INT_M_I_CLK | ||
961 | * | ||
962 | * - Individual clocks are hardware managed. | ||
963 | * - Base divider comes from: CM_CLKSEL_MPU | ||
964 | * | ||
965 | */ | ||
966 | static const struct clksel_rate mpu_core_rates[] = { | ||
967 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
968 | { .div = 2, .val = 2, .flags = RATE_IN_24XX }, | ||
969 | { .div = 4, .val = 4, .flags = RATE_IN_242X }, | ||
970 | { .div = 6, .val = 6, .flags = RATE_IN_242X }, | ||
971 | { .div = 8, .val = 8, .flags = RATE_IN_242X }, | ||
972 | { .div = 0 }, | ||
973 | }; | ||
974 | |||
975 | static const struct clksel mpu_clksel[] = { | ||
976 | { .parent = &core_ck, .rates = mpu_core_rates }, | ||
977 | { .parent = NULL } | ||
978 | }; | ||
979 | |||
980 | static struct clk mpu_ck = { /* Control cpu */ | ||
981 | .name = "mpu_ck", | ||
982 | .parent = &core_ck, | ||
983 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
984 | ALWAYS_ENABLED | DELAYED_APP | | ||
985 | CONFIG_PARTICIPANT | RATE_PROPAGATES, | ||
986 | .init = &omap2_init_clksel_parent, | ||
987 | .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL), | ||
988 | .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK, | ||
989 | .clksel = mpu_clksel, | ||
990 | .recalc = &omap2_clksel_recalc, | ||
991 | .round_rate = &omap2_clksel_round_rate, | ||
992 | .set_rate = &omap2_clksel_set_rate | ||
993 | }; | ||
994 | |||
995 | /* | ||
996 | * DSP (2430-IVA2.1) (2420-UMA+IVA1) clock domain | ||
997 | * Clocks: | ||
998 | * 2430: IVA2.1_FCLK (really just DSP_FCLK), IVA2.1_ICLK | ||
999 | * 2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP | ||
1000 | * | ||
1001 | * Won't be too specific here. The core clock comes into this block | ||
1002 | * it is divided then tee'ed. One branch goes directly to xyz enable | ||
1003 | * controls. The other branch gets further divided by 2 then possibly | ||
1004 | * routed into a synchronizer and out of clocks abc. | ||
1005 | */ | ||
1006 | static const struct clksel_rate dsp_fck_core_rates[] = { | ||
1007 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1008 | { .div = 2, .val = 2, .flags = RATE_IN_24XX }, | ||
1009 | { .div = 3, .val = 3, .flags = RATE_IN_24XX }, | ||
1010 | { .div = 4, .val = 4, .flags = RATE_IN_24XX }, | ||
1011 | { .div = 6, .val = 6, .flags = RATE_IN_242X }, | ||
1012 | { .div = 8, .val = 8, .flags = RATE_IN_242X }, | ||
1013 | { .div = 12, .val = 12, .flags = RATE_IN_242X }, | ||
1014 | { .div = 0 }, | ||
1015 | }; | ||
1016 | |||
1017 | static const struct clksel dsp_fck_clksel[] = { | ||
1018 | { .parent = &core_ck, .rates = dsp_fck_core_rates }, | ||
1019 | { .parent = NULL } | ||
1020 | }; | ||
1021 | |||
1022 | static struct clk dsp_fck = { | ||
1023 | .name = "dsp_fck", | ||
1024 | .parent = &core_ck, | ||
1025 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | DELAYED_APP | | ||
1026 | CONFIG_PARTICIPANT | RATE_PROPAGATES, | ||
1027 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), | ||
1028 | .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, | ||
1029 | .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL), | ||
1030 | .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK, | ||
1031 | .clksel = dsp_fck_clksel, | ||
1032 | .recalc = &omap2_clksel_recalc, | ||
1033 | .round_rate = &omap2_clksel_round_rate, | ||
1034 | .set_rate = &omap2_clksel_set_rate | ||
1035 | }; | ||
1036 | |||
1037 | /* DSP interface clock */ | ||
1038 | static const struct clksel_rate dsp_irate_ick_rates[] = { | ||
1039 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1040 | { .div = 2, .val = 2, .flags = RATE_IN_24XX }, | ||
1041 | { .div = 3, .val = 3, .flags = RATE_IN_243X }, | ||
1042 | { .div = 0 }, | ||
1043 | }; | ||
1044 | |||
1045 | static const struct clksel dsp_irate_ick_clksel[] = { | ||
1046 | { .parent = &dsp_fck, .rates = dsp_irate_ick_rates }, | ||
1047 | { .parent = NULL } | ||
1048 | }; | ||
1049 | |||
1050 | /* | ||
1051 | * This clock does not exist as such in the TRM, but is added to | ||
1052 | * separate source selection from XXX | ||
1053 | */ | ||
1054 | static struct clk dsp_irate_ick = { | ||
1055 | .name = "dsp_irate_ick", | ||
1056 | .parent = &dsp_fck, | ||
1057 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | DELAYED_APP | | ||
1058 | CONFIG_PARTICIPANT | PARENT_CONTROLS_CLOCK, | ||
1059 | .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL), | ||
1060 | .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK, | ||
1061 | .clksel = dsp_irate_ick_clksel, | ||
1062 | .recalc = &omap2_clksel_recalc, | ||
1063 | .round_rate = &omap2_clksel_round_rate, | ||
1064 | .set_rate = &omap2_clksel_set_rate | ||
1065 | }; | ||
1066 | |||
1067 | /* 2420 only */ | ||
1068 | static struct clk dsp_ick = { | ||
1069 | .name = "dsp_ick", /* apparently ipi and isp */ | ||
1070 | .parent = &dsp_irate_ick, | ||
1071 | .flags = CLOCK_IN_OMAP242X | DELAYED_APP | CONFIG_PARTICIPANT, | ||
1072 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN), | ||
1073 | .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */ | ||
1074 | }; | ||
1075 | |||
1076 | /* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */ | ||
1077 | static struct clk iva2_1_ick = { | ||
1078 | .name = "iva2_1_ick", | ||
1079 | .parent = &dsp_irate_ick, | ||
1080 | .flags = CLOCK_IN_OMAP243X | DELAYED_APP | CONFIG_PARTICIPANT, | ||
1081 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), | ||
1082 | .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, | ||
1083 | }; | ||
1084 | |||
1085 | static struct clk iva1_ifck = { | ||
1086 | .name = "iva1_ifck", | ||
1087 | .parent = &core_ck, | ||
1088 | .flags = CLOCK_IN_OMAP242X | CONFIG_PARTICIPANT | | ||
1089 | RATE_PROPAGATES | DELAYED_APP, | ||
1090 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), | ||
1091 | .enable_bit = OMAP2420_EN_IVA_COP_SHIFT, | ||
1092 | .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL), | ||
1093 | .clksel_mask = OMAP2420_CLKSEL_IVA_MASK, | ||
1094 | .clksel = dsp_fck_clksel, | ||
1095 | .recalc = &omap2_clksel_recalc, | ||
1096 | .round_rate = &omap2_clksel_round_rate, | ||
1097 | .set_rate = &omap2_clksel_set_rate | ||
1098 | }; | ||
1099 | |||
1100 | /* IVA1 mpu/int/i/f clocks are /2 of parent */ | ||
1101 | static struct clk iva1_mpu_int_ifck = { | ||
1102 | .name = "iva1_mpu_int_ifck", | ||
1103 | .parent = &iva1_ifck, | ||
1104 | .flags = CLOCK_IN_OMAP242X, | ||
1105 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), | ||
1106 | .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT, | ||
1107 | .fixed_div = 2, | ||
1108 | .recalc = &omap2_fixed_divisor_recalc, | ||
1109 | }; | ||
1110 | |||
1111 | /* | ||
1112 | * L3 clock domain | ||
1113 | * L3 clocks are used for both interface and functional clocks to | ||
1114 | * multiple entities. Some of these clocks are completely managed | ||
1115 | * by hardware, and some others allow software control. Hardware | ||
1116 | * managed ones general are based on directly CLK_REQ signals and | ||
1117 | * various auto idle settings. The functional spec sets many of these | ||
1118 | * as 'tie-high' for their enables. | ||
1119 | * | ||
1120 | * I-CLOCKS: | ||
1121 | * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA | ||
1122 | * CAM, HS-USB. | ||
1123 | * F-CLOCK | ||
1124 | * SSI. | ||
1125 | * | ||
1126 | * GPMC memories and SDRC have timing and clock sensitive registers which | ||
1127 | * may very well need notification when the clock changes. Currently for low | ||
1128 | * operating points, these are taken care of in sleep.S. | ||
1129 | */ | ||
1130 | static const struct clksel_rate core_l3_core_rates[] = { | ||
1131 | { .div = 1, .val = 1, .flags = RATE_IN_24XX }, | ||
1132 | { .div = 2, .val = 2, .flags = RATE_IN_242X }, | ||
1133 | { .div = 4, .val = 4, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1134 | { .div = 6, .val = 6, .flags = RATE_IN_24XX }, | ||
1135 | { .div = 8, .val = 8, .flags = RATE_IN_242X }, | ||
1136 | { .div = 12, .val = 12, .flags = RATE_IN_242X }, | ||
1137 | { .div = 16, .val = 16, .flags = RATE_IN_242X }, | ||
1138 | { .div = 0 } | ||
1139 | }; | ||
1140 | |||
1141 | static const struct clksel core_l3_clksel[] = { | ||
1142 | { .parent = &core_ck, .rates = core_l3_core_rates }, | ||
1143 | { .parent = NULL } | ||
1144 | }; | ||
1145 | |||
1146 | static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */ | ||
1147 | .name = "core_l3_ck", | ||
1148 | .parent = &core_ck, | ||
1149 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1150 | ALWAYS_ENABLED | DELAYED_APP | | ||
1151 | CONFIG_PARTICIPANT | RATE_PROPAGATES, | ||
1152 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
1153 | .clksel_mask = OMAP24XX_CLKSEL_L3_MASK, | ||
1154 | .clksel = core_l3_clksel, | ||
1155 | .recalc = &omap2_clksel_recalc, | ||
1156 | .round_rate = &omap2_clksel_round_rate, | ||
1157 | .set_rate = &omap2_clksel_set_rate | ||
1158 | }; | ||
1159 | |||
1160 | /* usb_l4_ick */ | ||
1161 | static const struct clksel_rate usb_l4_ick_core_l3_rates[] = { | ||
1162 | { .div = 1, .val = 1, .flags = RATE_IN_24XX }, | ||
1163 | { .div = 2, .val = 2, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1164 | { .div = 4, .val = 4, .flags = RATE_IN_24XX }, | ||
1165 | { .div = 0 } | ||
1166 | }; | ||
1167 | |||
1168 | static const struct clksel usb_l4_ick_clksel[] = { | ||
1169 | { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates }, | ||
1170 | { .parent = NULL }, | ||
1171 | }; | ||
1172 | |||
1173 | static struct clk usb_l4_ick = { /* FS-USB interface clock */ | ||
1174 | .name = "usb_l4_ick", | ||
1175 | .parent = &core_l3_ck, | ||
1176 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1177 | DELAYED_APP | CONFIG_PARTICIPANT, | ||
1178 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1179 | .enable_bit = OMAP24XX_EN_USB_SHIFT, | ||
1180 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
1181 | .clksel_mask = OMAP24XX_CLKSEL_USB_MASK, | ||
1182 | .clksel = usb_l4_ick_clksel, | ||
1183 | .recalc = &omap2_clksel_recalc, | ||
1184 | .round_rate = &omap2_clksel_round_rate, | ||
1185 | .set_rate = &omap2_clksel_set_rate | ||
1186 | }; | ||
1187 | |||
1188 | /* | ||
1189 | * SSI is in L3 management domain, its direct parent is core not l3, | ||
1190 | * many core power domain entities are grouped into the L3 clock | ||
1191 | * domain. | ||
1192 | * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_CLIK | ||
1193 | * | ||
1194 | * ssr = core/1/2/3/4/5, sst = 1/2 ssr. | ||
1195 | */ | ||
1196 | static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = { | ||
1197 | { .div = 1, .val = 1, .flags = RATE_IN_24XX }, | ||
1198 | { .div = 2, .val = 2, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1199 | { .div = 3, .val = 3, .flags = RATE_IN_24XX }, | ||
1200 | { .div = 4, .val = 4, .flags = RATE_IN_24XX }, | ||
1201 | { .div = 5, .val = 5, .flags = RATE_IN_243X }, | ||
1202 | { .div = 6, .val = 6, .flags = RATE_IN_242X }, | ||
1203 | { .div = 8, .val = 8, .flags = RATE_IN_242X }, | ||
1204 | { .div = 0 } | ||
1205 | }; | ||
1206 | |||
1207 | static const struct clksel ssi_ssr_sst_fck_clksel[] = { | ||
1208 | { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates }, | ||
1209 | { .parent = NULL } | ||
1210 | }; | ||
1211 | |||
1212 | static struct clk ssi_ssr_sst_fck = { | ||
1213 | .name = "ssi_fck", | ||
1214 | .parent = &core_ck, | ||
1215 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1216 | DELAYED_APP, | ||
1217 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
1218 | .enable_bit = OMAP24XX_EN_SSI_SHIFT, | ||
1219 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
1220 | .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK, | ||
1221 | .clksel = ssi_ssr_sst_fck_clksel, | ||
1222 | .recalc = &omap2_clksel_recalc, | ||
1223 | .round_rate = &omap2_clksel_round_rate, | ||
1224 | .set_rate = &omap2_clksel_set_rate | ||
1225 | }; | ||
1226 | |||
1227 | /* | ||
1228 | * GFX clock domain | ||
1229 | * Clocks: | ||
1230 | * GFX_FCLK, GFX_ICLK | ||
1231 | * GFX_CG1(2d), GFX_CG2(3d) | ||
1232 | * | ||
1233 | * GFX_FCLK runs from L3, and is divided by (1,2,3,4) | ||
1234 | * The 2d and 3d clocks run at a hardware determined | ||
1235 | * divided value of fclk. | ||
1236 | * | ||
1237 | */ | ||
1238 | /* XXX REVISIT: GFX clock is part of CONFIG_PARTICIPANT, no? doublecheck. */ | ||
1239 | |||
1240 | /* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */ | ||
1241 | static const struct clksel gfx_fck_clksel[] = { | ||
1242 | { .parent = &core_l3_ck, .rates = gfx_l3_rates }, | ||
1243 | { .parent = NULL }, | ||
1244 | }; | ||
1245 | |||
1246 | static struct clk gfx_3d_fck = { | ||
1247 | .name = "gfx_3d_fck", | ||
1248 | .parent = &core_l3_ck, | ||
1249 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1250 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), | ||
1251 | .enable_bit = OMAP24XX_EN_3D_SHIFT, | ||
1252 | .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL), | ||
1253 | .clksel_mask = OMAP_CLKSEL_GFX_MASK, | ||
1254 | .clksel = gfx_fck_clksel, | ||
1255 | .recalc = &omap2_clksel_recalc, | ||
1256 | .round_rate = &omap2_clksel_round_rate, | ||
1257 | .set_rate = &omap2_clksel_set_rate | ||
1258 | }; | ||
1259 | |||
1260 | static struct clk gfx_2d_fck = { | ||
1261 | .name = "gfx_2d_fck", | ||
1262 | .parent = &core_l3_ck, | ||
1263 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1264 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), | ||
1265 | .enable_bit = OMAP24XX_EN_2D_SHIFT, | ||
1266 | .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL), | ||
1267 | .clksel_mask = OMAP_CLKSEL_GFX_MASK, | ||
1268 | .clksel = gfx_fck_clksel, | ||
1269 | .recalc = &omap2_clksel_recalc, | ||
1270 | .round_rate = &omap2_clksel_round_rate, | ||
1271 | .set_rate = &omap2_clksel_set_rate | ||
1272 | }; | ||
1273 | |||
1274 | static struct clk gfx_ick = { | ||
1275 | .name = "gfx_ick", /* From l3 */ | ||
1276 | .parent = &core_l3_ck, | ||
1277 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1278 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN), | ||
1279 | .enable_bit = OMAP_EN_GFX_SHIFT, | ||
1280 | .recalc = &followparent_recalc, | ||
1281 | }; | ||
1282 | |||
1283 | /* | ||
1284 | * Modem clock domain (2430) | ||
1285 | * CLOCKS: | ||
1286 | * MDM_OSC_CLK | ||
1287 | * MDM_ICLK | ||
1288 | * These clocks are usable in chassis mode only. | ||
1289 | */ | ||
1290 | static const struct clksel_rate mdm_ick_core_rates[] = { | ||
1291 | { .div = 1, .val = 1, .flags = RATE_IN_243X }, | ||
1292 | { .div = 4, .val = 4, .flags = RATE_IN_243X | DEFAULT_RATE }, | ||
1293 | { .div = 6, .val = 6, .flags = RATE_IN_243X }, | ||
1294 | { .div = 9, .val = 9, .flags = RATE_IN_243X }, | ||
1295 | { .div = 0 } | ||
1296 | }; | ||
1297 | |||
1298 | static const struct clksel mdm_ick_clksel[] = { | ||
1299 | { .parent = &core_ck, .rates = mdm_ick_core_rates }, | ||
1300 | { .parent = NULL } | ||
1301 | }; | ||
1302 | |||
1303 | static struct clk mdm_ick = { /* used both as a ick and fck */ | ||
1304 | .name = "mdm_ick", | ||
1305 | .parent = &core_ck, | ||
1306 | .flags = CLOCK_IN_OMAP243X | DELAYED_APP | CONFIG_PARTICIPANT, | ||
1307 | .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN), | ||
1308 | .enable_bit = OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT, | ||
1309 | .clksel_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL), | ||
1310 | .clksel_mask = OMAP2430_CLKSEL_MDM_MASK, | ||
1311 | .clksel = mdm_ick_clksel, | ||
1312 | .recalc = &omap2_clksel_recalc, | ||
1313 | .round_rate = &omap2_clksel_round_rate, | ||
1314 | .set_rate = &omap2_clksel_set_rate | ||
1315 | }; | ||
1316 | |||
1317 | static struct clk mdm_osc_ck = { | ||
1318 | .name = "mdm_osc_ck", | ||
1319 | .parent = &osc_ck, | ||
1320 | .flags = CLOCK_IN_OMAP243X, | ||
1321 | .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN), | ||
1322 | .enable_bit = OMAP2430_EN_OSC_SHIFT, | ||
1323 | .recalc = &followparent_recalc, | ||
1324 | }; | ||
1325 | |||
1326 | /* | ||
1327 | * L4 clock management domain | ||
1328 | * | ||
1329 | * This domain contains lots of interface clocks from the L4 interface, some | ||
1330 | * functional clocks. Fixed APLL functional source clocks are managed in | ||
1331 | * this domain. | ||
1332 | */ | ||
1333 | static const struct clksel_rate l4_core_l3_rates[] = { | ||
1334 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1335 | { .div = 2, .val = 2, .flags = RATE_IN_24XX }, | ||
1336 | { .div = 0 } | ||
1337 | }; | ||
1338 | |||
1339 | static const struct clksel l4_clksel[] = { | ||
1340 | { .parent = &core_l3_ck, .rates = l4_core_l3_rates }, | ||
1341 | { .parent = NULL } | ||
1342 | }; | ||
1343 | |||
1344 | static struct clk l4_ck = { /* used both as an ick and fck */ | ||
1345 | .name = "l4_ck", | ||
1346 | .parent = &core_l3_ck, | ||
1347 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1348 | ALWAYS_ENABLED | DELAYED_APP | RATE_PROPAGATES, | ||
1349 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
1350 | .clksel_mask = OMAP24XX_CLKSEL_L4_MASK, | ||
1351 | .clksel = l4_clksel, | ||
1352 | .recalc = &omap2_clksel_recalc, | ||
1353 | .round_rate = &omap2_clksel_round_rate, | ||
1354 | .set_rate = &omap2_clksel_set_rate | ||
1355 | }; | ||
1356 | |||
1357 | static struct clk ssi_l4_ick = { | ||
1358 | .name = "ssi_l4_ick", | ||
1359 | .parent = &l4_ck, | ||
1360 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1361 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1362 | .enable_bit = OMAP24XX_EN_SSI_SHIFT, | ||
1363 | .recalc = &followparent_recalc, | ||
1364 | }; | ||
1365 | |||
1366 | /* | ||
1367 | * DSS clock domain | ||
1368 | * CLOCKs: | ||
1369 | * DSS_L4_ICLK, DSS_L3_ICLK, | ||
1370 | * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK | ||
1371 | * | ||
1372 | * DSS is both initiator and target. | ||
1373 | */ | ||
1374 | /* XXX Add RATE_NOT_VALIDATED */ | ||
1375 | |||
1376 | static const struct clksel_rate dss1_fck_sys_rates[] = { | ||
1377 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1378 | { .div = 0 } | ||
1379 | }; | ||
1380 | |||
1381 | static const struct clksel_rate dss1_fck_core_rates[] = { | ||
1382 | { .div = 1, .val = 1, .flags = RATE_IN_24XX }, | ||
1383 | { .div = 2, .val = 2, .flags = RATE_IN_24XX }, | ||
1384 | { .div = 3, .val = 3, .flags = RATE_IN_24XX }, | ||
1385 | { .div = 4, .val = 4, .flags = RATE_IN_24XX }, | ||
1386 | { .div = 5, .val = 5, .flags = RATE_IN_24XX }, | ||
1387 | { .div = 6, .val = 6, .flags = RATE_IN_24XX }, | ||
1388 | { .div = 8, .val = 8, .flags = RATE_IN_24XX }, | ||
1389 | { .div = 9, .val = 9, .flags = RATE_IN_24XX }, | ||
1390 | { .div = 12, .val = 12, .flags = RATE_IN_24XX }, | ||
1391 | { .div = 16, .val = 16, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1392 | { .div = 0 } | ||
1393 | }; | ||
1394 | |||
1395 | static const struct clksel dss1_fck_clksel[] = { | ||
1396 | { .parent = &sys_ck, .rates = dss1_fck_sys_rates }, | ||
1397 | { .parent = &core_ck, .rates = dss1_fck_core_rates }, | ||
1398 | { .parent = NULL }, | ||
1399 | }; | ||
1400 | |||
1401 | static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ | ||
1402 | .name = "dss_ick", | ||
1403 | .parent = &l4_ck, /* really both l3 and l4 */ | ||
1404 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1405 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1406 | .enable_bit = OMAP24XX_EN_DSS1_SHIFT, | ||
1407 | .recalc = &followparent_recalc, | ||
1408 | }; | ||
1409 | |||
1410 | static struct clk dss1_fck = { | ||
1411 | .name = "dss1_fck", | ||
1412 | .parent = &core_ck, /* Core or sys */ | ||
1413 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1414 | DELAYED_APP, | ||
1415 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1416 | .enable_bit = OMAP24XX_EN_DSS1_SHIFT, | ||
1417 | .init = &omap2_init_clksel_parent, | ||
1418 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
1419 | .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK, | ||
1420 | .clksel = dss1_fck_clksel, | ||
1421 | .recalc = &omap2_clksel_recalc, | ||
1422 | .round_rate = &omap2_clksel_round_rate, | ||
1423 | .set_rate = &omap2_clksel_set_rate | ||
1424 | }; | ||
1425 | |||
1426 | static const struct clksel_rate dss2_fck_sys_rates[] = { | ||
1427 | { .div = 1, .val = 0, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1428 | { .div = 0 } | ||
1429 | }; | ||
1430 | |||
1431 | static const struct clksel_rate dss2_fck_48m_rates[] = { | ||
1432 | { .div = 1, .val = 1, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1433 | { .div = 0 } | ||
1434 | }; | ||
1435 | |||
1436 | static const struct clksel dss2_fck_clksel[] = { | ||
1437 | { .parent = &sys_ck, .rates = dss2_fck_sys_rates }, | ||
1438 | { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates }, | ||
1439 | { .parent = NULL } | ||
1440 | }; | ||
1441 | |||
1442 | static struct clk dss2_fck = { /* Alt clk used in power management */ | ||
1443 | .name = "dss2_fck", | ||
1444 | .parent = &sys_ck, /* fixed at sys_ck or 48MHz */ | ||
1445 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
1446 | DELAYED_APP, | ||
1447 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1448 | .enable_bit = OMAP24XX_EN_DSS2_SHIFT, | ||
1449 | .init = &omap2_init_clksel_parent, | ||
1450 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
1451 | .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK, | ||
1452 | .clksel = dss2_fck_clksel, | ||
1453 | .recalc = &followparent_recalc, | ||
1454 | }; | ||
1455 | |||
1456 | static struct clk dss_54m_fck = { /* Alt clk used in power management */ | ||
1457 | .name = "dss_54m_fck", /* 54m tv clk */ | ||
1458 | .parent = &func_54m_ck, | ||
1459 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1460 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1461 | .enable_bit = OMAP24XX_EN_TV_SHIFT, | ||
1462 | .recalc = &followparent_recalc, | ||
1463 | }; | ||
1464 | |||
1465 | /* | ||
1466 | * CORE power domain ICLK & FCLK defines. | ||
1467 | * Many of the these can have more than one possible parent. Entries | ||
1468 | * here will likely have an L4 interface parent, and may have multiple | ||
1469 | * functional clock parents. | ||
1470 | */ | ||
1471 | static const struct clksel_rate gpt_alt_rates[] = { | ||
1472 | { .div = 1, .val = 2, .flags = RATE_IN_24XX | DEFAULT_RATE }, | ||
1473 | { .div = 0 } | ||
1474 | }; | ||
1475 | |||
1476 | static const struct clksel omap24xx_gpt_clksel[] = { | ||
1477 | { .parent = &func_32k_ck, .rates = gpt_32k_rates }, | ||
1478 | { .parent = &sys_ck, .rates = gpt_sys_rates }, | ||
1479 | { .parent = &alt_ck, .rates = gpt_alt_rates }, | ||
1480 | { .parent = NULL }, | ||
1481 | }; | ||
1482 | |||
1483 | static struct clk gpt1_ick = { | ||
1484 | .name = "gpt1_ick", | ||
1485 | .parent = &l4_ck, | ||
1486 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1487 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
1488 | .enable_bit = OMAP24XX_EN_GPT1_SHIFT, | ||
1489 | .recalc = &followparent_recalc, | ||
1490 | }; | ||
1491 | |||
1492 | static struct clk gpt1_fck = { | ||
1493 | .name = "gpt1_fck", | ||
1494 | .parent = &func_32k_ck, | ||
1495 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1496 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
1497 | .enable_bit = OMAP24XX_EN_GPT1_SHIFT, | ||
1498 | .init = &omap2_init_clksel_parent, | ||
1499 | .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1), | ||
1500 | .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK, | ||
1501 | .clksel = omap24xx_gpt_clksel, | ||
1502 | .recalc = &omap2_clksel_recalc, | ||
1503 | .round_rate = &omap2_clksel_round_rate, | ||
1504 | .set_rate = &omap2_clksel_set_rate | ||
1505 | }; | ||
1506 | |||
1507 | static struct clk gpt2_ick = { | ||
1508 | .name = "gpt2_ick", | ||
1509 | .parent = &l4_ck, | ||
1510 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1511 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1512 | .enable_bit = OMAP24XX_EN_GPT2_SHIFT, | ||
1513 | .recalc = &followparent_recalc, | ||
1514 | }; | ||
1515 | |||
1516 | static struct clk gpt2_fck = { | ||
1517 | .name = "gpt2_fck", | ||
1518 | .parent = &func_32k_ck, | ||
1519 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1520 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1521 | .enable_bit = OMAP24XX_EN_GPT2_SHIFT, | ||
1522 | .init = &omap2_init_clksel_parent, | ||
1523 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1524 | .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK, | ||
1525 | .clksel = omap24xx_gpt_clksel, | ||
1526 | .recalc = &omap2_clksel_recalc, | ||
1527 | }; | ||
1528 | |||
1529 | static struct clk gpt3_ick = { | ||
1530 | .name = "gpt3_ick", | ||
1531 | .parent = &l4_ck, | ||
1532 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1533 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1534 | .enable_bit = OMAP24XX_EN_GPT3_SHIFT, | ||
1535 | .recalc = &followparent_recalc, | ||
1536 | }; | ||
1537 | |||
1538 | static struct clk gpt3_fck = { | ||
1539 | .name = "gpt3_fck", | ||
1540 | .parent = &func_32k_ck, | ||
1541 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1542 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1543 | .enable_bit = OMAP24XX_EN_GPT3_SHIFT, | ||
1544 | .init = &omap2_init_clksel_parent, | ||
1545 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1546 | .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK, | ||
1547 | .clksel = omap24xx_gpt_clksel, | ||
1548 | .recalc = &omap2_clksel_recalc, | ||
1549 | }; | ||
1550 | |||
1551 | static struct clk gpt4_ick = { | ||
1552 | .name = "gpt4_ick", | ||
1553 | .parent = &l4_ck, | ||
1554 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1555 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1556 | .enable_bit = OMAP24XX_EN_GPT4_SHIFT, | ||
1557 | .recalc = &followparent_recalc, | ||
1558 | }; | ||
1559 | |||
1560 | static struct clk gpt4_fck = { | ||
1561 | .name = "gpt4_fck", | ||
1562 | .parent = &func_32k_ck, | ||
1563 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1564 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1565 | .enable_bit = OMAP24XX_EN_GPT4_SHIFT, | ||
1566 | .init = &omap2_init_clksel_parent, | ||
1567 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1568 | .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK, | ||
1569 | .clksel = omap24xx_gpt_clksel, | ||
1570 | .recalc = &omap2_clksel_recalc, | ||
1571 | }; | ||
1572 | |||
1573 | static struct clk gpt5_ick = { | ||
1574 | .name = "gpt5_ick", | ||
1575 | .parent = &l4_ck, | ||
1576 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1577 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1578 | .enable_bit = OMAP24XX_EN_GPT5_SHIFT, | ||
1579 | .recalc = &followparent_recalc, | ||
1580 | }; | ||
1581 | |||
1582 | static struct clk gpt5_fck = { | ||
1583 | .name = "gpt5_fck", | ||
1584 | .parent = &func_32k_ck, | ||
1585 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1586 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1587 | .enable_bit = OMAP24XX_EN_GPT5_SHIFT, | ||
1588 | .init = &omap2_init_clksel_parent, | ||
1589 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1590 | .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK, | ||
1591 | .clksel = omap24xx_gpt_clksel, | ||
1592 | .recalc = &omap2_clksel_recalc, | ||
1593 | }; | ||
1594 | |||
1595 | static struct clk gpt6_ick = { | ||
1596 | .name = "gpt6_ick", | ||
1597 | .parent = &l4_ck, | ||
1598 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1599 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1600 | .enable_bit = OMAP24XX_EN_GPT6_SHIFT, | ||
1601 | .recalc = &followparent_recalc, | ||
1602 | }; | ||
1603 | |||
1604 | static struct clk gpt6_fck = { | ||
1605 | .name = "gpt6_fck", | ||
1606 | .parent = &func_32k_ck, | ||
1607 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1608 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1609 | .enable_bit = OMAP24XX_EN_GPT6_SHIFT, | ||
1610 | .init = &omap2_init_clksel_parent, | ||
1611 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1612 | .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK, | ||
1613 | .clksel = omap24xx_gpt_clksel, | ||
1614 | .recalc = &omap2_clksel_recalc, | ||
1615 | }; | ||
1616 | |||
1617 | static struct clk gpt7_ick = { | ||
1618 | .name = "gpt7_ick", | ||
1619 | .parent = &l4_ck, | ||
1620 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1621 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1622 | .enable_bit = OMAP24XX_EN_GPT7_SHIFT, | ||
1623 | .recalc = &followparent_recalc, | ||
1624 | }; | ||
1625 | |||
1626 | static struct clk gpt7_fck = { | ||
1627 | .name = "gpt7_fck", | ||
1628 | .parent = &func_32k_ck, | ||
1629 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1630 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1631 | .enable_bit = OMAP24XX_EN_GPT7_SHIFT, | ||
1632 | .init = &omap2_init_clksel_parent, | ||
1633 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1634 | .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK, | ||
1635 | .clksel = omap24xx_gpt_clksel, | ||
1636 | .recalc = &omap2_clksel_recalc, | ||
1637 | }; | ||
1638 | |||
1639 | static struct clk gpt8_ick = { | ||
1640 | .name = "gpt8_ick", | ||
1641 | .parent = &l4_ck, | ||
1642 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1643 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1644 | .enable_bit = OMAP24XX_EN_GPT8_SHIFT, | ||
1645 | .recalc = &followparent_recalc, | ||
1646 | }; | ||
1647 | |||
1648 | static struct clk gpt8_fck = { | ||
1649 | .name = "gpt8_fck", | ||
1650 | .parent = &func_32k_ck, | ||
1651 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1652 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1653 | .enable_bit = OMAP24XX_EN_GPT8_SHIFT, | ||
1654 | .init = &omap2_init_clksel_parent, | ||
1655 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1656 | .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK, | ||
1657 | .clksel = omap24xx_gpt_clksel, | ||
1658 | .recalc = &omap2_clksel_recalc, | ||
1659 | }; | ||
1660 | |||
1661 | static struct clk gpt9_ick = { | ||
1662 | .name = "gpt9_ick", | ||
1663 | .parent = &l4_ck, | ||
1664 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1665 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1666 | .enable_bit = OMAP24XX_EN_GPT9_SHIFT, | ||
1667 | .recalc = &followparent_recalc, | ||
1668 | }; | ||
1669 | |||
1670 | static struct clk gpt9_fck = { | ||
1671 | .name = "gpt9_fck", | ||
1672 | .parent = &func_32k_ck, | ||
1673 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1674 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1675 | .enable_bit = OMAP24XX_EN_GPT9_SHIFT, | ||
1676 | .init = &omap2_init_clksel_parent, | ||
1677 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1678 | .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK, | ||
1679 | .clksel = omap24xx_gpt_clksel, | ||
1680 | .recalc = &omap2_clksel_recalc, | ||
1681 | }; | ||
1682 | |||
1683 | static struct clk gpt10_ick = { | ||
1684 | .name = "gpt10_ick", | ||
1685 | .parent = &l4_ck, | ||
1686 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1687 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1688 | .enable_bit = OMAP24XX_EN_GPT10_SHIFT, | ||
1689 | .recalc = &followparent_recalc, | ||
1690 | }; | ||
1691 | |||
1692 | static struct clk gpt10_fck = { | ||
1693 | .name = "gpt10_fck", | ||
1694 | .parent = &func_32k_ck, | ||
1695 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1696 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1697 | .enable_bit = OMAP24XX_EN_GPT10_SHIFT, | ||
1698 | .init = &omap2_init_clksel_parent, | ||
1699 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1700 | .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK, | ||
1701 | .clksel = omap24xx_gpt_clksel, | ||
1702 | .recalc = &omap2_clksel_recalc, | ||
1703 | }; | ||
1704 | |||
1705 | static struct clk gpt11_ick = { | ||
1706 | .name = "gpt11_ick", | ||
1707 | .parent = &l4_ck, | ||
1708 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1709 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1710 | .enable_bit = OMAP24XX_EN_GPT11_SHIFT, | ||
1711 | .recalc = &followparent_recalc, | ||
1712 | }; | ||
1713 | |||
1714 | static struct clk gpt11_fck = { | ||
1715 | .name = "gpt11_fck", | ||
1716 | .parent = &func_32k_ck, | ||
1717 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1718 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1719 | .enable_bit = OMAP24XX_EN_GPT11_SHIFT, | ||
1720 | .init = &omap2_init_clksel_parent, | ||
1721 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1722 | .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK, | ||
1723 | .clksel = omap24xx_gpt_clksel, | ||
1724 | .recalc = &omap2_clksel_recalc, | ||
1725 | }; | ||
1726 | |||
1727 | static struct clk gpt12_ick = { | ||
1728 | .name = "gpt12_ick", | ||
1729 | .parent = &l4_ck, | ||
1730 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1731 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1732 | .enable_bit = OMAP24XX_EN_GPT12_SHIFT, | ||
1733 | .recalc = &followparent_recalc, | ||
1734 | }; | ||
1735 | |||
1736 | static struct clk gpt12_fck = { | ||
1737 | .name = "gpt12_fck", | ||
1738 | .parent = &func_32k_ck, | ||
1739 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1740 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1741 | .enable_bit = OMAP24XX_EN_GPT12_SHIFT, | ||
1742 | .init = &omap2_init_clksel_parent, | ||
1743 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), | ||
1744 | .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK, | ||
1745 | .clksel = omap24xx_gpt_clksel, | ||
1746 | .recalc = &omap2_clksel_recalc, | ||
1747 | }; | ||
1748 | |||
1749 | static struct clk mcbsp1_ick = { | ||
1750 | .name = "mcbsp1_ick", | ||
1751 | .parent = &l4_ck, | ||
1752 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1753 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1754 | .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, | ||
1755 | .recalc = &followparent_recalc, | ||
1756 | }; | ||
1757 | |||
1758 | static struct clk mcbsp1_fck = { | ||
1759 | .name = "mcbsp1_fck", | ||
1760 | .parent = &func_96m_ck, | ||
1761 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1762 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1763 | .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, | ||
1764 | .recalc = &followparent_recalc, | ||
1765 | }; | ||
1766 | |||
1767 | static struct clk mcbsp2_ick = { | ||
1768 | .name = "mcbsp2_ick", | ||
1769 | .parent = &l4_ck, | ||
1770 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1771 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1772 | .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, | ||
1773 | .recalc = &followparent_recalc, | ||
1774 | }; | ||
1775 | |||
1776 | static struct clk mcbsp2_fck = { | ||
1777 | .name = "mcbsp2_fck", | ||
1778 | .parent = &func_96m_ck, | ||
1779 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1780 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1781 | .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, | ||
1782 | .recalc = &followparent_recalc, | ||
1783 | }; | ||
1784 | |||
1785 | static struct clk mcbsp3_ick = { | ||
1786 | .name = "mcbsp3_ick", | ||
1787 | .parent = &l4_ck, | ||
1788 | .flags = CLOCK_IN_OMAP243X, | ||
1789 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1790 | .enable_bit = OMAP2430_EN_MCBSP3_SHIFT, | ||
1791 | .recalc = &followparent_recalc, | ||
1792 | }; | ||
1793 | |||
1794 | static struct clk mcbsp3_fck = { | ||
1795 | .name = "mcbsp3_fck", | ||
1796 | .parent = &func_96m_ck, | ||
1797 | .flags = CLOCK_IN_OMAP243X, | ||
1798 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
1799 | .enable_bit = OMAP2430_EN_MCBSP3_SHIFT, | ||
1800 | .recalc = &followparent_recalc, | ||
1801 | }; | ||
1802 | |||
1803 | static struct clk mcbsp4_ick = { | ||
1804 | .name = "mcbsp4_ick", | ||
1805 | .parent = &l4_ck, | ||
1806 | .flags = CLOCK_IN_OMAP243X, | ||
1807 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1808 | .enable_bit = OMAP2430_EN_MCBSP4_SHIFT, | ||
1809 | .recalc = &followparent_recalc, | ||
1810 | }; | ||
1811 | |||
1812 | static struct clk mcbsp4_fck = { | ||
1813 | .name = "mcbsp4_fck", | ||
1814 | .parent = &func_96m_ck, | ||
1815 | .flags = CLOCK_IN_OMAP243X, | ||
1816 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
1817 | .enable_bit = OMAP2430_EN_MCBSP4_SHIFT, | ||
1818 | .recalc = &followparent_recalc, | ||
1819 | }; | ||
1820 | |||
1821 | static struct clk mcbsp5_ick = { | ||
1822 | .name = "mcbsp5_ick", | ||
1823 | .parent = &l4_ck, | ||
1824 | .flags = CLOCK_IN_OMAP243X, | ||
1825 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1826 | .enable_bit = OMAP2430_EN_MCBSP5_SHIFT, | ||
1827 | .recalc = &followparent_recalc, | ||
1828 | }; | ||
1829 | |||
1830 | static struct clk mcbsp5_fck = { | ||
1831 | .name = "mcbsp5_fck", | ||
1832 | .parent = &func_96m_ck, | ||
1833 | .flags = CLOCK_IN_OMAP243X, | ||
1834 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
1835 | .enable_bit = OMAP2430_EN_MCBSP5_SHIFT, | ||
1836 | .recalc = &followparent_recalc, | ||
1837 | }; | ||
1838 | |||
1839 | static struct clk mcspi1_ick = { | ||
1840 | .name = "mcspi_ick", | ||
1841 | .id = 1, | ||
1842 | .parent = &l4_ck, | ||
1843 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1844 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1845 | .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT, | ||
1846 | .recalc = &followparent_recalc, | ||
1847 | }; | ||
1848 | |||
1849 | static struct clk mcspi1_fck = { | ||
1850 | .name = "mcspi_fck", | ||
1851 | .id = 1, | ||
1852 | .parent = &func_48m_ck, | ||
1853 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1854 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1855 | .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT, | ||
1856 | .recalc = &followparent_recalc, | ||
1857 | }; | ||
1858 | |||
1859 | static struct clk mcspi2_ick = { | ||
1860 | .name = "mcspi_ick", | ||
1861 | .id = 2, | ||
1862 | .parent = &l4_ck, | ||
1863 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1864 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1865 | .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT, | ||
1866 | .recalc = &followparent_recalc, | ||
1867 | }; | ||
1868 | |||
1869 | static struct clk mcspi2_fck = { | ||
1870 | .name = "mcspi_fck", | ||
1871 | .id = 2, | ||
1872 | .parent = &func_48m_ck, | ||
1873 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1874 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1875 | .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT, | ||
1876 | .recalc = &followparent_recalc, | ||
1877 | }; | ||
1878 | |||
1879 | static struct clk mcspi3_ick = { | ||
1880 | .name = "mcspi_ick", | ||
1881 | .id = 3, | ||
1882 | .parent = &l4_ck, | ||
1883 | .flags = CLOCK_IN_OMAP243X, | ||
1884 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1885 | .enable_bit = OMAP2430_EN_MCSPI3_SHIFT, | ||
1886 | .recalc = &followparent_recalc, | ||
1887 | }; | ||
1888 | |||
1889 | static struct clk mcspi3_fck = { | ||
1890 | .name = "mcspi_fck", | ||
1891 | .id = 3, | ||
1892 | .parent = &func_48m_ck, | ||
1893 | .flags = CLOCK_IN_OMAP243X, | ||
1894 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
1895 | .enable_bit = OMAP2430_EN_MCSPI3_SHIFT, | ||
1896 | .recalc = &followparent_recalc, | ||
1897 | }; | ||
1898 | |||
1899 | static struct clk uart1_ick = { | ||
1900 | .name = "uart1_ick", | ||
1901 | .parent = &l4_ck, | ||
1902 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1903 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1904 | .enable_bit = OMAP24XX_EN_UART1_SHIFT, | ||
1905 | .recalc = &followparent_recalc, | ||
1906 | }; | ||
1907 | |||
1908 | static struct clk uart1_fck = { | ||
1909 | .name = "uart1_fck", | ||
1910 | .parent = &func_48m_ck, | ||
1911 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1912 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1913 | .enable_bit = OMAP24XX_EN_UART1_SHIFT, | ||
1914 | .recalc = &followparent_recalc, | ||
1915 | }; | ||
1916 | |||
1917 | static struct clk uart2_ick = { | ||
1918 | .name = "uart2_ick", | ||
1919 | .parent = &l4_ck, | ||
1920 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1921 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1922 | .enable_bit = OMAP24XX_EN_UART2_SHIFT, | ||
1923 | .recalc = &followparent_recalc, | ||
1924 | }; | ||
1925 | |||
1926 | static struct clk uart2_fck = { | ||
1927 | .name = "uart2_fck", | ||
1928 | .parent = &func_48m_ck, | ||
1929 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1930 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1931 | .enable_bit = OMAP24XX_EN_UART2_SHIFT, | ||
1932 | .recalc = &followparent_recalc, | ||
1933 | }; | ||
1934 | |||
1935 | static struct clk uart3_ick = { | ||
1936 | .name = "uart3_ick", | ||
1937 | .parent = &l4_ck, | ||
1938 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1939 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1940 | .enable_bit = OMAP24XX_EN_UART3_SHIFT, | ||
1941 | .recalc = &followparent_recalc, | ||
1942 | }; | ||
1943 | |||
1944 | static struct clk uart3_fck = { | ||
1945 | .name = "uart3_fck", | ||
1946 | .parent = &func_48m_ck, | ||
1947 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1948 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
1949 | .enable_bit = OMAP24XX_EN_UART3_SHIFT, | ||
1950 | .recalc = &followparent_recalc, | ||
1951 | }; | ||
1952 | |||
1953 | static struct clk gpios_ick = { | ||
1954 | .name = "gpios_ick", | ||
1955 | .parent = &l4_ck, | ||
1956 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1957 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
1958 | .enable_bit = OMAP24XX_EN_GPIOS_SHIFT, | ||
1959 | .recalc = &followparent_recalc, | ||
1960 | }; | ||
1961 | |||
1962 | static struct clk gpios_fck = { | ||
1963 | .name = "gpios_fck", | ||
1964 | .parent = &func_32k_ck, | ||
1965 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1966 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
1967 | .enable_bit = OMAP24XX_EN_GPIOS_SHIFT, | ||
1968 | .recalc = &followparent_recalc, | ||
1969 | }; | ||
1970 | |||
1971 | static struct clk mpu_wdt_ick = { | ||
1972 | .name = "mpu_wdt_ick", | ||
1973 | .parent = &l4_ck, | ||
1974 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1975 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
1976 | .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT, | ||
1977 | .recalc = &followparent_recalc, | ||
1978 | }; | ||
1979 | |||
1980 | static struct clk mpu_wdt_fck = { | ||
1981 | .name = "mpu_wdt_fck", | ||
1982 | .parent = &func_32k_ck, | ||
1983 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
1984 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
1985 | .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT, | ||
1986 | .recalc = &followparent_recalc, | ||
1987 | }; | ||
1988 | |||
1989 | static struct clk sync_32k_ick = { | ||
1990 | .name = "sync_32k_ick", | ||
1991 | .parent = &l4_ck, | ||
1992 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ENABLE_ON_INIT, | ||
1993 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
1994 | .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT, | ||
1995 | .recalc = &followparent_recalc, | ||
1996 | }; | ||
1997 | static struct clk wdt1_ick = { | ||
1998 | .name = "wdt1_ick", | ||
1999 | .parent = &l4_ck, | ||
2000 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2001 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2002 | .enable_bit = OMAP24XX_EN_WDT1_SHIFT, | ||
2003 | .recalc = &followparent_recalc, | ||
2004 | }; | ||
2005 | static struct clk omapctrl_ick = { | ||
2006 | .name = "omapctrl_ick", | ||
2007 | .parent = &l4_ck, | ||
2008 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ENABLE_ON_INIT, | ||
2009 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2010 | .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT, | ||
2011 | .recalc = &followparent_recalc, | ||
2012 | }; | ||
2013 | static struct clk icr_ick = { | ||
2014 | .name = "icr_ick", | ||
2015 | .parent = &l4_ck, | ||
2016 | .flags = CLOCK_IN_OMAP243X, | ||
2017 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2018 | .enable_bit = OMAP2430_EN_ICR_SHIFT, | ||
2019 | .recalc = &followparent_recalc, | ||
2020 | }; | ||
2021 | |||
2022 | static struct clk cam_ick = { | ||
2023 | .name = "cam_ick", | ||
2024 | .parent = &l4_ck, | ||
2025 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2026 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2027 | .enable_bit = OMAP24XX_EN_CAM_SHIFT, | ||
2028 | .recalc = &followparent_recalc, | ||
2029 | }; | ||
2030 | |||
2031 | static struct clk cam_fck = { | ||
2032 | .name = "cam_fck", | ||
2033 | .parent = &func_96m_ck, | ||
2034 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2035 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2036 | .enable_bit = OMAP24XX_EN_CAM_SHIFT, | ||
2037 | .recalc = &followparent_recalc, | ||
2038 | }; | ||
2039 | |||
2040 | static struct clk mailboxes_ick = { | ||
2041 | .name = "mailboxes_ick", | ||
2042 | .parent = &l4_ck, | ||
2043 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2044 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2045 | .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT, | ||
2046 | .recalc = &followparent_recalc, | ||
2047 | }; | ||
2048 | |||
2049 | static struct clk wdt4_ick = { | ||
2050 | .name = "wdt4_ick", | ||
2051 | .parent = &l4_ck, | ||
2052 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2053 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2054 | .enable_bit = OMAP24XX_EN_WDT4_SHIFT, | ||
2055 | .recalc = &followparent_recalc, | ||
2056 | }; | ||
2057 | |||
2058 | static struct clk wdt4_fck = { | ||
2059 | .name = "wdt4_fck", | ||
2060 | .parent = &func_32k_ck, | ||
2061 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2062 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2063 | .enable_bit = OMAP24XX_EN_WDT4_SHIFT, | ||
2064 | .recalc = &followparent_recalc, | ||
2065 | }; | ||
2066 | |||
2067 | static struct clk wdt3_ick = { | ||
2068 | .name = "wdt3_ick", | ||
2069 | .parent = &l4_ck, | ||
2070 | .flags = CLOCK_IN_OMAP242X, | ||
2071 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2072 | .enable_bit = OMAP2420_EN_WDT3_SHIFT, | ||
2073 | .recalc = &followparent_recalc, | ||
2074 | }; | ||
2075 | |||
2076 | static struct clk wdt3_fck = { | ||
2077 | .name = "wdt3_fck", | ||
2078 | .parent = &func_32k_ck, | ||
2079 | .flags = CLOCK_IN_OMAP242X, | ||
2080 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2081 | .enable_bit = OMAP2420_EN_WDT3_SHIFT, | ||
2082 | .recalc = &followparent_recalc, | ||
2083 | }; | ||
2084 | |||
2085 | static struct clk mspro_ick = { | ||
2086 | .name = "mspro_ick", | ||
2087 | .parent = &l4_ck, | ||
2088 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2089 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2090 | .enable_bit = OMAP24XX_EN_MSPRO_SHIFT, | ||
2091 | .recalc = &followparent_recalc, | ||
2092 | }; | ||
2093 | |||
2094 | static struct clk mspro_fck = { | ||
2095 | .name = "mspro_fck", | ||
2096 | .parent = &func_96m_ck, | ||
2097 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2098 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2099 | .enable_bit = OMAP24XX_EN_MSPRO_SHIFT, | ||
2100 | .recalc = &followparent_recalc, | ||
2101 | }; | ||
2102 | |||
2103 | static struct clk mmc_ick = { | ||
2104 | .name = "mmc_ick", | ||
2105 | .parent = &l4_ck, | ||
2106 | .flags = CLOCK_IN_OMAP242X, | ||
2107 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2108 | .enable_bit = OMAP2420_EN_MMC_SHIFT, | ||
2109 | .recalc = &followparent_recalc, | ||
2110 | }; | ||
2111 | |||
2112 | static struct clk mmc_fck = { | ||
2113 | .name = "mmc_fck", | ||
2114 | .parent = &func_96m_ck, | ||
2115 | .flags = CLOCK_IN_OMAP242X, | ||
2116 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2117 | .enable_bit = OMAP2420_EN_MMC_SHIFT, | ||
2118 | .recalc = &followparent_recalc, | ||
2119 | }; | ||
2120 | |||
2121 | static struct clk fac_ick = { | ||
2122 | .name = "fac_ick", | ||
2123 | .parent = &l4_ck, | ||
2124 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2125 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2126 | .enable_bit = OMAP24XX_EN_FAC_SHIFT, | ||
2127 | .recalc = &followparent_recalc, | ||
2128 | }; | ||
2129 | |||
2130 | static struct clk fac_fck = { | ||
2131 | .name = "fac_fck", | ||
2132 | .parent = &func_12m_ck, | ||
2133 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2134 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2135 | .enable_bit = OMAP24XX_EN_FAC_SHIFT, | ||
2136 | .recalc = &followparent_recalc, | ||
2137 | }; | ||
2138 | |||
2139 | static struct clk eac_ick = { | ||
2140 | .name = "eac_ick", | ||
2141 | .parent = &l4_ck, | ||
2142 | .flags = CLOCK_IN_OMAP242X, | ||
2143 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2144 | .enable_bit = OMAP2420_EN_EAC_SHIFT, | ||
2145 | .recalc = &followparent_recalc, | ||
2146 | }; | ||
2147 | |||
2148 | static struct clk eac_fck = { | ||
2149 | .name = "eac_fck", | ||
2150 | .parent = &func_96m_ck, | ||
2151 | .flags = CLOCK_IN_OMAP242X, | ||
2152 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2153 | .enable_bit = OMAP2420_EN_EAC_SHIFT, | ||
2154 | .recalc = &followparent_recalc, | ||
2155 | }; | ||
2156 | |||
2157 | static struct clk hdq_ick = { | ||
2158 | .name = "hdq_ick", | ||
2159 | .parent = &l4_ck, | ||
2160 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2161 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2162 | .enable_bit = OMAP24XX_EN_HDQ_SHIFT, | ||
2163 | .recalc = &followparent_recalc, | ||
2164 | }; | ||
2165 | |||
2166 | static struct clk hdq_fck = { | ||
2167 | .name = "hdq_fck", | ||
2168 | .parent = &func_12m_ck, | ||
2169 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2170 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2171 | .enable_bit = OMAP24XX_EN_HDQ_SHIFT, | ||
2172 | .recalc = &followparent_recalc, | ||
2173 | }; | ||
2174 | |||
2175 | static struct clk i2c2_ick = { | ||
2176 | .name = "i2c_ick", | ||
2177 | .id = 2, | ||
2178 | .parent = &l4_ck, | ||
2179 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2180 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2181 | .enable_bit = OMAP2420_EN_I2C2_SHIFT, | ||
2182 | .recalc = &followparent_recalc, | ||
2183 | }; | ||
2184 | |||
2185 | static struct clk i2c2_fck = { | ||
2186 | .name = "i2c_fck", | ||
2187 | .id = 2, | ||
2188 | .parent = &func_12m_ck, | ||
2189 | .flags = CLOCK_IN_OMAP242X, | ||
2190 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2191 | .enable_bit = OMAP2420_EN_I2C2_SHIFT, | ||
2192 | .recalc = &followparent_recalc, | ||
2193 | }; | ||
2194 | |||
2195 | static struct clk i2chs2_fck = { | ||
2196 | .name = "i2chs_fck", | ||
2197 | .id = 2, | ||
2198 | .parent = &func_96m_ck, | ||
2199 | .flags = CLOCK_IN_OMAP243X, | ||
2200 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2201 | .enable_bit = OMAP2430_EN_I2CHS2_SHIFT, | ||
2202 | .recalc = &followparent_recalc, | ||
2203 | }; | ||
2204 | |||
2205 | static struct clk i2c1_ick = { | ||
2206 | .name = "i2c_ick", | ||
2207 | .id = 1, | ||
2208 | .parent = &l4_ck, | ||
2209 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2210 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2211 | .enable_bit = OMAP2420_EN_I2C1_SHIFT, | ||
2212 | .recalc = &followparent_recalc, | ||
2213 | }; | ||
2214 | |||
2215 | static struct clk i2c1_fck = { | ||
2216 | .name = "i2c_fck", | ||
2217 | .id = 1, | ||
2218 | .parent = &func_12m_ck, | ||
2219 | .flags = CLOCK_IN_OMAP242X, | ||
2220 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2221 | .enable_bit = OMAP2420_EN_I2C1_SHIFT, | ||
2222 | .recalc = &followparent_recalc, | ||
2223 | }; | ||
2224 | |||
2225 | static struct clk i2chs1_fck = { | ||
2226 | .name = "i2chs_fck", | ||
2227 | .id = 1, | ||
2228 | .parent = &func_96m_ck, | ||
2229 | .flags = CLOCK_IN_OMAP243X, | ||
2230 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2231 | .enable_bit = OMAP2430_EN_I2CHS1_SHIFT, | ||
2232 | .recalc = &followparent_recalc, | ||
2233 | }; | ||
2234 | |||
2235 | static struct clk gpmc_fck = { | ||
2236 | .name = "gpmc_fck", | ||
2237 | .parent = &core_l3_ck, | ||
2238 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ENABLE_ON_INIT, | ||
2239 | .recalc = &followparent_recalc, | ||
2240 | }; | ||
2241 | |||
2242 | static struct clk sdma_fck = { | ||
2243 | .name = "sdma_fck", | ||
2244 | .parent = &core_l3_ck, | ||
2245 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2246 | .recalc = &followparent_recalc, | ||
2247 | }; | ||
2248 | |||
2249 | static struct clk sdma_ick = { | ||
2250 | .name = "sdma_ick", | ||
2251 | .parent = &l4_ck, | ||
2252 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | ||
2253 | .recalc = &followparent_recalc, | ||
2254 | }; | ||
2255 | |||
2256 | static struct clk vlynq_ick = { | ||
2257 | .name = "vlynq_ick", | ||
2258 | .parent = &core_l3_ck, | ||
2259 | .flags = CLOCK_IN_OMAP242X, | ||
2260 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
2261 | .enable_bit = OMAP2420_EN_VLYNQ_SHIFT, | ||
2262 | .recalc = &followparent_recalc, | ||
2263 | }; | ||
2264 | |||
2265 | static const struct clksel_rate vlynq_fck_96m_rates[] = { | ||
2266 | { .div = 1, .val = 0, .flags = RATE_IN_242X | DEFAULT_RATE }, | ||
2267 | { .div = 0 } | ||
2268 | }; | ||
2269 | |||
2270 | static const struct clksel_rate vlynq_fck_core_rates[] = { | ||
2271 | { .div = 1, .val = 1, .flags = RATE_IN_242X }, | ||
2272 | { .div = 2, .val = 2, .flags = RATE_IN_242X }, | ||
2273 | { .div = 3, .val = 3, .flags = RATE_IN_242X }, | ||
2274 | { .div = 4, .val = 4, .flags = RATE_IN_242X }, | ||
2275 | { .div = 6, .val = 6, .flags = RATE_IN_242X }, | ||
2276 | { .div = 8, .val = 8, .flags = RATE_IN_242X }, | ||
2277 | { .div = 9, .val = 9, .flags = RATE_IN_242X }, | ||
2278 | { .div = 12, .val = 12, .flags = RATE_IN_242X }, | ||
2279 | { .div = 16, .val = 16, .flags = RATE_IN_242X | DEFAULT_RATE }, | ||
2280 | { .div = 18, .val = 18, .flags = RATE_IN_242X }, | ||
2281 | { .div = 0 } | ||
2282 | }; | ||
2283 | |||
2284 | static const struct clksel vlynq_fck_clksel[] = { | ||
2285 | { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates }, | ||
2286 | { .parent = &core_ck, .rates = vlynq_fck_core_rates }, | ||
2287 | { .parent = NULL } | ||
2288 | }; | ||
2289 | |||
2290 | static struct clk vlynq_fck = { | ||
2291 | .name = "vlynq_fck", | ||
2292 | .parent = &func_96m_ck, | ||
2293 | .flags = CLOCK_IN_OMAP242X | DELAYED_APP, | ||
2294 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
2295 | .enable_bit = OMAP2420_EN_VLYNQ_SHIFT, | ||
2296 | .init = &omap2_init_clksel_parent, | ||
2297 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), | ||
2298 | .clksel_mask = OMAP2420_CLKSEL_VLYNQ_MASK, | ||
2299 | .clksel = vlynq_fck_clksel, | ||
2300 | .recalc = &omap2_clksel_recalc, | ||
2301 | .round_rate = &omap2_clksel_round_rate, | ||
2302 | .set_rate = &omap2_clksel_set_rate | ||
2303 | }; | ||
2304 | |||
2305 | static struct clk sdrc_ick = { | ||
2306 | .name = "sdrc_ick", | ||
2307 | .parent = &l4_ck, | ||
2308 | .flags = CLOCK_IN_OMAP243X | ENABLE_ON_INIT, | ||
2309 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), | ||
2310 | .enable_bit = OMAP2430_EN_SDRC_SHIFT, | ||
2311 | .recalc = &followparent_recalc, | ||
2312 | }; | ||
2313 | |||
2314 | static struct clk des_ick = { | ||
2315 | .name = "des_ick", | ||
2316 | .parent = &l4_ck, | ||
2317 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
2318 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), | ||
2319 | .enable_bit = OMAP24XX_EN_DES_SHIFT, | ||
2320 | .recalc = &followparent_recalc, | ||
2321 | }; | ||
2322 | |||
2323 | static struct clk sha_ick = { | ||
2324 | .name = "sha_ick", | ||
2325 | .parent = &l4_ck, | ||
2326 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
2327 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), | ||
2328 | .enable_bit = OMAP24XX_EN_SHA_SHIFT, | ||
2329 | .recalc = &followparent_recalc, | ||
2330 | }; | ||
2331 | |||
2332 | static struct clk rng_ick = { | ||
2333 | .name = "rng_ick", | ||
2334 | .parent = &l4_ck, | ||
2335 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
2336 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), | ||
2337 | .enable_bit = OMAP24XX_EN_RNG_SHIFT, | ||
2338 | .recalc = &followparent_recalc, | ||
2339 | }; | ||
2340 | |||
2341 | static struct clk aes_ick = { | ||
2342 | .name = "aes_ick", | ||
2343 | .parent = &l4_ck, | ||
2344 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
2345 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), | ||
2346 | .enable_bit = OMAP24XX_EN_AES_SHIFT, | ||
2347 | .recalc = &followparent_recalc, | ||
2348 | }; | ||
2349 | |||
2350 | static struct clk pka_ick = { | ||
2351 | .name = "pka_ick", | ||
2352 | .parent = &l4_ck, | ||
2353 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
2354 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), | ||
2355 | .enable_bit = OMAP24XX_EN_PKA_SHIFT, | ||
2356 | .recalc = &followparent_recalc, | ||
2357 | }; | ||
2358 | |||
2359 | static struct clk usb_fck = { | ||
2360 | .name = "usb_fck", | ||
2361 | .parent = &func_48m_ck, | ||
2362 | .flags = CLOCK_IN_OMAP243X | CLOCK_IN_OMAP242X, | ||
2363 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2364 | .enable_bit = OMAP24XX_EN_USB_SHIFT, | ||
2365 | .recalc = &followparent_recalc, | ||
2366 | }; | ||
2367 | |||
2368 | static struct clk usbhs_ick = { | ||
2369 | .name = "usbhs_ick", | ||
2370 | .parent = &core_l3_ck, | ||
2371 | .flags = CLOCK_IN_OMAP243X, | ||
2372 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
2373 | .enable_bit = OMAP2430_EN_USBHS_SHIFT, | ||
2374 | .recalc = &followparent_recalc, | ||
2375 | }; | ||
2376 | |||
2377 | static struct clk mmchs1_ick = { | ||
2378 | .name = "mmchs_ick", | ||
2379 | .id = 1, | ||
2380 | .parent = &l4_ck, | ||
2381 | .flags = CLOCK_IN_OMAP243X, | ||
2382 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
2383 | .enable_bit = OMAP2430_EN_MMCHS1_SHIFT, | ||
2384 | .recalc = &followparent_recalc, | ||
2385 | }; | ||
2386 | |||
2387 | static struct clk mmchs1_fck = { | ||
2388 | .name = "mmchs_fck", | ||
2389 | .id = 1, | ||
2390 | .parent = &func_96m_ck, | ||
2391 | .flags = CLOCK_IN_OMAP243X, | ||
2392 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2393 | .enable_bit = OMAP2430_EN_MMCHS1_SHIFT, | ||
2394 | .recalc = &followparent_recalc, | ||
2395 | }; | ||
2396 | |||
2397 | static struct clk mmchs2_ick = { | ||
2398 | .name = "mmchs_ick", | ||
2399 | .id = 2, | ||
2400 | .parent = &l4_ck, | ||
2401 | .flags = CLOCK_IN_OMAP243X, | ||
2402 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
2403 | .enable_bit = OMAP2430_EN_MMCHS2_SHIFT, | ||
2404 | .recalc = &followparent_recalc, | ||
2405 | }; | ||
2406 | |||
2407 | static struct clk mmchs2_fck = { | ||
2408 | .name = "mmchs_fck", | ||
2409 | .id = 2, | ||
2410 | .parent = &func_96m_ck, | ||
2411 | .flags = CLOCK_IN_OMAP243X, | ||
2412 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2413 | .enable_bit = OMAP2430_EN_MMCHS2_SHIFT, | ||
2414 | .recalc = &followparent_recalc, | ||
2415 | }; | ||
2416 | |||
2417 | static struct clk gpio5_ick = { | ||
2418 | .name = "gpio5_ick", | ||
2419 | .parent = &l4_ck, | ||
2420 | .flags = CLOCK_IN_OMAP243X, | ||
2421 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
2422 | .enable_bit = OMAP2430_EN_GPIO5_SHIFT, | ||
2423 | .recalc = &followparent_recalc, | ||
2424 | }; | ||
2425 | |||
2426 | static struct clk gpio5_fck = { | ||
2427 | .name = "gpio5_fck", | ||
2428 | .parent = &func_32k_ck, | ||
2429 | .flags = CLOCK_IN_OMAP243X, | ||
2430 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2431 | .enable_bit = OMAP2430_EN_GPIO5_SHIFT, | ||
2432 | .recalc = &followparent_recalc, | ||
2433 | }; | ||
2434 | |||
2435 | static struct clk mdm_intc_ick = { | ||
2436 | .name = "mdm_intc_ick", | ||
2437 | .parent = &l4_ck, | ||
2438 | .flags = CLOCK_IN_OMAP243X, | ||
2439 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
2440 | .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT, | ||
2441 | .recalc = &followparent_recalc, | ||
2442 | }; | ||
2443 | |||
2444 | static struct clk mmchsdb1_fck = { | ||
2445 | .name = "mmchsdb_fck", | ||
2446 | .id = 1, | ||
2447 | .parent = &func_32k_ck, | ||
2448 | .flags = CLOCK_IN_OMAP243X, | ||
2449 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2450 | .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT, | ||
2451 | .recalc = &followparent_recalc, | ||
2452 | }; | ||
2453 | |||
2454 | static struct clk mmchsdb2_fck = { | ||
2455 | .name = "mmchsdb_fck", | ||
2456 | .id = 2, | ||
2457 | .parent = &func_32k_ck, | ||
2458 | .flags = CLOCK_IN_OMAP243X, | ||
2459 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | ||
2460 | .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT, | ||
2461 | .recalc = &followparent_recalc, | ||
2462 | }; | ||
2463 | |||
2464 | /* | ||
2465 | * This clock is a composite clock which does entire set changes then | ||
2466 | * forces a rebalance. It keys on the MPU speed, but it really could | ||
2467 | * be any key speed part of a set in the rate table. | ||
2468 | * | ||
2469 | * to really change a set, you need memory table sets which get changed | ||
2470 | * in sram, pre-notifiers & post notifiers, changing the top set, without | ||
2471 | * having low level display recalc's won't work... this is why dpm notifiers | ||
2472 | * work, isr's off, walk a list of clocks already _off_ and not messing with | ||
2473 | * the bus. | ||
2474 | * | ||
2475 | * This clock should have no parent. It embodies the entire upper level | ||
2476 | * active set. A parent will mess up some of the init also. | ||
2477 | */ | ||
2478 | static struct clk virt_prcm_set = { | ||
2479 | .name = "virt_prcm_set", | ||
2480 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | | ||
2481 | VIRTUAL_CLOCK | ALWAYS_ENABLED | DELAYED_APP, | ||
2482 | .parent = &mpu_ck, /* Indexed by mpu speed, no parent */ | ||
2483 | .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */ | ||
2484 | .set_rate = &omap2_select_table_rate, | ||
2485 | .round_rate = &omap2_round_to_table_rate, | ||
2486 | }; | ||
2487 | |||
2488 | static struct clk *onchip_24xx_clks[] __initdata = { | ||
2489 | /* external root sources */ | ||
2490 | &func_32k_ck, | ||
2491 | &osc_ck, | ||
2492 | &sys_ck, | ||
2493 | &alt_ck, | ||
2494 | /* internal analog sources */ | ||
2495 | &dpll_ck, | ||
2496 | &apll96_ck, | ||
2497 | &apll54_ck, | ||
2498 | /* internal prcm root sources */ | ||
2499 | &func_54m_ck, | ||
2500 | &core_ck, | ||
2501 | &func_96m_ck, | ||
2502 | &func_48m_ck, | ||
2503 | &func_12m_ck, | ||
2504 | &wdt1_osc_ck, | ||
2505 | &sys_clkout_src, | ||
2506 | &sys_clkout, | ||
2507 | &sys_clkout2_src, | ||
2508 | &sys_clkout2, | ||
2509 | &emul_ck, | ||
2510 | /* mpu domain clocks */ | ||
2511 | &mpu_ck, | ||
2512 | /* dsp domain clocks */ | ||
2513 | &dsp_fck, | ||
2514 | &dsp_irate_ick, | ||
2515 | &dsp_ick, /* 242x */ | ||
2516 | &iva2_1_ick, /* 243x */ | ||
2517 | &iva1_ifck, /* 242x */ | ||
2518 | &iva1_mpu_int_ifck, /* 242x */ | ||
2519 | /* GFX domain clocks */ | ||
2520 | &gfx_3d_fck, | ||
2521 | &gfx_2d_fck, | ||
2522 | &gfx_ick, | ||
2523 | /* Modem domain clocks */ | ||
2524 | &mdm_ick, | ||
2525 | &mdm_osc_ck, | ||
2526 | /* DSS domain clocks */ | ||
2527 | &dss_ick, | ||
2528 | &dss1_fck, | ||
2529 | &dss2_fck, | ||
2530 | &dss_54m_fck, | ||
2531 | /* L3 domain clocks */ | ||
2532 | &core_l3_ck, | ||
2533 | &ssi_ssr_sst_fck, | ||
2534 | &usb_l4_ick, | ||
2535 | /* L4 domain clocks */ | ||
2536 | &l4_ck, /* used as both core_l4 and wu_l4 */ | ||
2537 | &ssi_l4_ick, | ||
2538 | /* virtual meta-group clock */ | ||
2539 | &virt_prcm_set, | ||
2540 | /* general l4 interface ck, multi-parent functional clk */ | ||
2541 | &gpt1_ick, | ||
2542 | &gpt1_fck, | ||
2543 | &gpt2_ick, | ||
2544 | &gpt2_fck, | ||
2545 | &gpt3_ick, | ||
2546 | &gpt3_fck, | ||
2547 | &gpt4_ick, | ||
2548 | &gpt4_fck, | ||
2549 | &gpt5_ick, | ||
2550 | &gpt5_fck, | ||
2551 | &gpt6_ick, | ||
2552 | &gpt6_fck, | ||
2553 | &gpt7_ick, | ||
2554 | &gpt7_fck, | ||
2555 | &gpt8_ick, | ||
2556 | &gpt8_fck, | ||
2557 | &gpt9_ick, | ||
2558 | &gpt9_fck, | ||
2559 | &gpt10_ick, | ||
2560 | &gpt10_fck, | ||
2561 | &gpt11_ick, | ||
2562 | &gpt11_fck, | ||
2563 | &gpt12_ick, | ||
2564 | &gpt12_fck, | ||
2565 | &mcbsp1_ick, | ||
2566 | &mcbsp1_fck, | ||
2567 | &mcbsp2_ick, | ||
2568 | &mcbsp2_fck, | ||
2569 | &mcbsp3_ick, | ||
2570 | &mcbsp3_fck, | ||
2571 | &mcbsp4_ick, | ||
2572 | &mcbsp4_fck, | ||
2573 | &mcbsp5_ick, | ||
2574 | &mcbsp5_fck, | ||
2575 | &mcspi1_ick, | ||
2576 | &mcspi1_fck, | ||
2577 | &mcspi2_ick, | ||
2578 | &mcspi2_fck, | ||
2579 | &mcspi3_ick, | ||
2580 | &mcspi3_fck, | ||
2581 | &uart1_ick, | ||
2582 | &uart1_fck, | ||
2583 | &uart2_ick, | ||
2584 | &uart2_fck, | ||
2585 | &uart3_ick, | ||
2586 | &uart3_fck, | ||
2587 | &gpios_ick, | ||
2588 | &gpios_fck, | ||
2589 | &mpu_wdt_ick, | ||
2590 | &mpu_wdt_fck, | ||
2591 | &sync_32k_ick, | ||
2592 | &wdt1_ick, | ||
2593 | &omapctrl_ick, | ||
2594 | &icr_ick, | ||
2595 | &cam_fck, | ||
2596 | &cam_ick, | ||
2597 | &mailboxes_ick, | ||
2598 | &wdt4_ick, | ||
2599 | &wdt4_fck, | ||
2600 | &wdt3_ick, | ||
2601 | &wdt3_fck, | ||
2602 | &mspro_ick, | ||
2603 | &mspro_fck, | ||
2604 | &mmc_ick, | ||
2605 | &mmc_fck, | ||
2606 | &fac_ick, | ||
2607 | &fac_fck, | ||
2608 | &eac_ick, | ||
2609 | &eac_fck, | ||
2610 | &hdq_ick, | ||
2611 | &hdq_fck, | ||
2612 | &i2c1_ick, | ||
2613 | &i2c1_fck, | ||
2614 | &i2chs1_fck, | ||
2615 | &i2c2_ick, | ||
2616 | &i2c2_fck, | ||
2617 | &i2chs2_fck, | ||
2618 | &gpmc_fck, | ||
2619 | &sdma_fck, | ||
2620 | &sdma_ick, | ||
2621 | &vlynq_ick, | ||
2622 | &vlynq_fck, | ||
2623 | &sdrc_ick, | ||
2624 | &des_ick, | ||
2625 | &sha_ick, | ||
2626 | &rng_ick, | ||
2627 | &aes_ick, | ||
2628 | &pka_ick, | ||
2629 | &usb_fck, | ||
2630 | &usbhs_ick, | ||
2631 | &mmchs1_ick, | ||
2632 | &mmchs1_fck, | ||
2633 | &mmchs2_ick, | ||
2634 | &mmchs2_fck, | ||
2635 | &gpio5_ick, | ||
2636 | &gpio5_fck, | ||
2637 | &mdm_intc_ick, | ||
2638 | &mmchsdb1_fck, | ||
2639 | &mmchsdb2_fck, | ||
2640 | }; | ||
2641 | |||
2642 | #endif | ||
2643 | |||
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c new file mode 100644 index 000000000000..b42bdd6079a5 --- /dev/null +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -0,0 +1,235 @@ | |||
1 | /* | ||
2 | * OMAP3-specific clock framework functions | ||
3 | * | ||
4 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2007 Nokia Corporation | ||
6 | * | ||
7 | * Written by Paul Walmsley | ||
8 | * | ||
9 | * Parts of this code are based on code written by | ||
10 | * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | #undef DEBUG | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/clk.h> | ||
25 | #include <linux/io.h> | ||
26 | |||
27 | #include <asm/arch/clock.h> | ||
28 | #include <asm/arch/sram.h> | ||
29 | #include <asm/div64.h> | ||
30 | #include <asm/bitops.h> | ||
31 | |||
32 | #include "memory.h" | ||
33 | #include "clock.h" | ||
34 | #include "clock34xx.h" | ||
35 | #include "prm.h" | ||
36 | #include "prm-regbits-34xx.h" | ||
37 | #include "cm.h" | ||
38 | #include "cm-regbits-34xx.h" | ||
39 | |||
40 | /* CM_CLKEN_PLL*.EN* bit values */ | ||
41 | #define DPLL_LOCKED 0x7 | ||
42 | |||
43 | /** | ||
44 | * omap3_dpll_recalc - recalculate DPLL rate | ||
45 | * @clk: DPLL struct clk | ||
46 | * | ||
47 | * Recalculate and propagate the DPLL rate. | ||
48 | */ | ||
49 | static void omap3_dpll_recalc(struct clk *clk) | ||
50 | { | ||
51 | clk->rate = omap2_get_dpll_rate(clk); | ||
52 | |||
53 | propagate_rate(clk); | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate | ||
58 | * @clk: DPLL output struct clk | ||
59 | * | ||
60 | * Using parent clock DPLL data, look up DPLL state. If locked, set our | ||
61 | * rate to the dpll_clk * 2; otherwise, just use dpll_clk. | ||
62 | */ | ||
63 | static void omap3_clkoutx2_recalc(struct clk *clk) | ||
64 | { | ||
65 | const struct dpll_data *dd; | ||
66 | u32 v; | ||
67 | struct clk *pclk; | ||
68 | |||
69 | /* Walk up the parents of clk, looking for a DPLL */ | ||
70 | pclk = clk->parent; | ||
71 | while (pclk && !pclk->dpll_data) | ||
72 | pclk = pclk->parent; | ||
73 | |||
74 | /* clk does not have a DPLL as a parent? */ | ||
75 | WARN_ON(!pclk); | ||
76 | |||
77 | dd = pclk->dpll_data; | ||
78 | |||
79 | WARN_ON(!dd->control_reg || !dd->enable_mask); | ||
80 | |||
81 | v = __raw_readl(dd->control_reg) & dd->enable_mask; | ||
82 | v >>= __ffs(dd->enable_mask); | ||
83 | if (v != DPLL_LOCKED) | ||
84 | clk->rate = clk->parent->rate; | ||
85 | else | ||
86 | clk->rate = clk->parent->rate * 2; | ||
87 | |||
88 | if (clk->flags & RATE_PROPAGATES) | ||
89 | propagate_rate(clk); | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * As it is structured now, this will prevent an OMAP2/3 multiboot | ||
94 | * kernel from compiling. This will need further attention. | ||
95 | */ | ||
96 | #if defined(CONFIG_ARCH_OMAP3) | ||
97 | |||
98 | static struct clk_functions omap2_clk_functions = { | ||
99 | .clk_enable = omap2_clk_enable, | ||
100 | .clk_disable = omap2_clk_disable, | ||
101 | .clk_round_rate = omap2_clk_round_rate, | ||
102 | .clk_set_rate = omap2_clk_set_rate, | ||
103 | .clk_set_parent = omap2_clk_set_parent, | ||
104 | .clk_disable_unused = omap2_clk_disable_unused, | ||
105 | }; | ||
106 | |||
107 | /* | ||
108 | * Set clocks for bypass mode for reboot to work. | ||
109 | */ | ||
110 | void omap2_clk_prepare_for_reboot(void) | ||
111 | { | ||
112 | /* REVISIT: Not ready for 343x */ | ||
113 | #if 0 | ||
114 | u32 rate; | ||
115 | |||
116 | if (vclk == NULL || sclk == NULL) | ||
117 | return; | ||
118 | |||
119 | rate = clk_get_rate(sclk); | ||
120 | clk_set_rate(vclk, rate); | ||
121 | #endif | ||
122 | } | ||
123 | |||
124 | /* REVISIT: Move this init stuff out into clock.c */ | ||
125 | |||
126 | /* | ||
127 | * Switch the MPU rate if specified on cmdline. | ||
128 | * We cannot do this early until cmdline is parsed. | ||
129 | */ | ||
130 | static int __init omap2_clk_arch_init(void) | ||
131 | { | ||
132 | if (!mpurate) | ||
133 | return -EINVAL; | ||
134 | |||
135 | /* REVISIT: not yet ready for 343x */ | ||
136 | #if 0 | ||
137 | if (omap2_select_table_rate(&virt_prcm_set, mpurate)) | ||
138 | printk(KERN_ERR "Could not find matching MPU rate\n"); | ||
139 | #endif | ||
140 | |||
141 | recalculate_root_clocks(); | ||
142 | |||
143 | printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL3/MPU): " | ||
144 | "%ld.%01ld/%ld/%ld MHz\n", | ||
145 | (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10, | ||
146 | (core_ck.rate / 1000000), (dpll1_fck.rate / 1000000)) ; | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | arch_initcall(omap2_clk_arch_init); | ||
151 | |||
152 | int __init omap2_clk_init(void) | ||
153 | { | ||
154 | /* struct prcm_config *prcm; */ | ||
155 | struct clk **clkp; | ||
156 | /* u32 clkrate; */ | ||
157 | u32 cpu_clkflg; | ||
158 | |||
159 | /* REVISIT: Ultimately this will be used for multiboot */ | ||
160 | #if 0 | ||
161 | if (cpu_is_omap242x()) { | ||
162 | cpu_mask = RATE_IN_242X; | ||
163 | cpu_clkflg = CLOCK_IN_OMAP242X; | ||
164 | clkp = onchip_24xx_clks; | ||
165 | } else if (cpu_is_omap2430()) { | ||
166 | cpu_mask = RATE_IN_243X; | ||
167 | cpu_clkflg = CLOCK_IN_OMAP243X; | ||
168 | clkp = onchip_24xx_clks; | ||
169 | } | ||
170 | #endif | ||
171 | if (cpu_is_omap34xx()) { | ||
172 | cpu_mask = RATE_IN_343X; | ||
173 | cpu_clkflg = CLOCK_IN_OMAP343X; | ||
174 | clkp = onchip_34xx_clks; | ||
175 | |||
176 | /* | ||
177 | * Update this if there are further clock changes between ES2 | ||
178 | * and production parts | ||
179 | */ | ||
180 | if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0)) { | ||
181 | /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */ | ||
182 | cpu_clkflg |= CLOCK_IN_OMAP3430ES1; | ||
183 | } else { | ||
184 | cpu_mask |= RATE_IN_3430ES2; | ||
185 | cpu_clkflg |= CLOCK_IN_OMAP3430ES2; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | clk_init(&omap2_clk_functions); | ||
190 | |||
191 | for (clkp = onchip_34xx_clks; | ||
192 | clkp < onchip_34xx_clks + ARRAY_SIZE(onchip_34xx_clks); | ||
193 | clkp++) { | ||
194 | if ((*clkp)->flags & cpu_clkflg) | ||
195 | clk_register(*clkp); | ||
196 | } | ||
197 | |||
198 | /* REVISIT: Not yet ready for OMAP3 */ | ||
199 | #if 0 | ||
200 | /* Check the MPU rate set by bootloader */ | ||
201 | clkrate = omap2_get_dpll_rate_24xx(&dpll_ck); | ||
202 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
203 | if (!(prcm->flags & cpu_mask)) | ||
204 | continue; | ||
205 | if (prcm->xtal_speed != sys_ck.rate) | ||
206 | continue; | ||
207 | if (prcm->dpll_speed <= clkrate) | ||
208 | break; | ||
209 | } | ||
210 | curr_prcm_set = prcm; | ||
211 | #endif | ||
212 | |||
213 | recalculate_root_clocks(); | ||
214 | |||
215 | printk(KERN_INFO "Clocking rate (Crystal/DPLL/ARM core): " | ||
216 | "%ld.%01ld/%ld/%ld MHz\n", | ||
217 | (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10, | ||
218 | (core_ck.rate / 1000000), (arm_fck.rate / 1000000)); | ||
219 | |||
220 | /* | ||
221 | * Only enable those clocks we will need, let the drivers | ||
222 | * enable other clocks as necessary | ||
223 | */ | ||
224 | clk_enable_init_clocks(); | ||
225 | |||
226 | /* Avoid sleeping during omap2_clk_prepare_for_reboot() */ | ||
227 | /* REVISIT: not yet ready for 343x */ | ||
228 | #if 0 | ||
229 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
230 | sclk = clk_get(NULL, "sys_ck"); | ||
231 | #endif | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | #endif | ||
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h new file mode 100644 index 000000000000..cf4644a94b9b --- /dev/null +++ b/arch/arm/mach-omap2/clock34xx.h | |||
@@ -0,0 +1,3009 @@ | |||
1 | /* | ||
2 | * OMAP3 clock framework | ||
3 | * | ||
4 | * Virtual clocks are introduced as a convenient tools. | ||
5 | * They are sources for other clocks and not supposed | ||
6 | * to be requested from drivers directly. | ||
7 | * | ||
8 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
9 | * Copyright (C) 2007-2008 Nokia Corporation | ||
10 | * | ||
11 | * Written by Paul Walmsley | ||
12 | */ | ||
13 | |||
14 | #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H | ||
15 | #define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H | ||
16 | |||
17 | #include <asm/arch/control.h> | ||
18 | |||
19 | #include "clock.h" | ||
20 | #include "cm.h" | ||
21 | #include "cm-regbits-34xx.h" | ||
22 | #include "prm.h" | ||
23 | #include "prm-regbits-34xx.h" | ||
24 | |||
25 | static void omap3_dpll_recalc(struct clk *clk); | ||
26 | static void omap3_clkoutx2_recalc(struct clk *clk); | ||
27 | |||
28 | /* | ||
29 | * DPLL1 supplies clock to the MPU. | ||
30 | * DPLL2 supplies clock to the IVA2. | ||
31 | * DPLL3 supplies CORE domain clocks. | ||
32 | * DPLL4 supplies peripheral clocks. | ||
33 | * DPLL5 supplies other peripheral clocks (USBHOST, USIM). | ||
34 | */ | ||
35 | |||
36 | /* PRM CLOCKS */ | ||
37 | |||
38 | /* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */ | ||
39 | static struct clk omap_32k_fck = { | ||
40 | .name = "omap_32k_fck", | ||
41 | .rate = 32768, | ||
42 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
43 | ALWAYS_ENABLED, | ||
44 | .recalc = &propagate_rate, | ||
45 | }; | ||
46 | |||
47 | static struct clk secure_32k_fck = { | ||
48 | .name = "secure_32k_fck", | ||
49 | .rate = 32768, | ||
50 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
51 | ALWAYS_ENABLED, | ||
52 | .recalc = &propagate_rate, | ||
53 | }; | ||
54 | |||
55 | /* Virtual source clocks for osc_sys_ck */ | ||
56 | static struct clk virt_12m_ck = { | ||
57 | .name = "virt_12m_ck", | ||
58 | .rate = 12000000, | ||
59 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
60 | ALWAYS_ENABLED, | ||
61 | .recalc = &propagate_rate, | ||
62 | }; | ||
63 | |||
64 | static struct clk virt_13m_ck = { | ||
65 | .name = "virt_13m_ck", | ||
66 | .rate = 13000000, | ||
67 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
68 | ALWAYS_ENABLED, | ||
69 | .recalc = &propagate_rate, | ||
70 | }; | ||
71 | |||
72 | static struct clk virt_16_8m_ck = { | ||
73 | .name = "virt_16_8m_ck", | ||
74 | .rate = 16800000, | ||
75 | .flags = CLOCK_IN_OMAP3430ES2 | RATE_FIXED | RATE_PROPAGATES | | ||
76 | ALWAYS_ENABLED, | ||
77 | .recalc = &propagate_rate, | ||
78 | }; | ||
79 | |||
80 | static struct clk virt_19_2m_ck = { | ||
81 | .name = "virt_19_2m_ck", | ||
82 | .rate = 19200000, | ||
83 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
84 | ALWAYS_ENABLED, | ||
85 | .recalc = &propagate_rate, | ||
86 | }; | ||
87 | |||
88 | static struct clk virt_26m_ck = { | ||
89 | .name = "virt_26m_ck", | ||
90 | .rate = 26000000, | ||
91 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
92 | ALWAYS_ENABLED, | ||
93 | .recalc = &propagate_rate, | ||
94 | }; | ||
95 | |||
96 | static struct clk virt_38_4m_ck = { | ||
97 | .name = "virt_38_4m_ck", | ||
98 | .rate = 38400000, | ||
99 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
100 | ALWAYS_ENABLED, | ||
101 | .recalc = &propagate_rate, | ||
102 | }; | ||
103 | |||
104 | static const struct clksel_rate osc_sys_12m_rates[] = { | ||
105 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
106 | { .div = 0 } | ||
107 | }; | ||
108 | |||
109 | static const struct clksel_rate osc_sys_13m_rates[] = { | ||
110 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
111 | { .div = 0 } | ||
112 | }; | ||
113 | |||
114 | static const struct clksel_rate osc_sys_16_8m_rates[] = { | ||
115 | { .div = 1, .val = 5, .flags = RATE_IN_3430ES2 | DEFAULT_RATE }, | ||
116 | { .div = 0 } | ||
117 | }; | ||
118 | |||
119 | static const struct clksel_rate osc_sys_19_2m_rates[] = { | ||
120 | { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
121 | { .div = 0 } | ||
122 | }; | ||
123 | |||
124 | static const struct clksel_rate osc_sys_26m_rates[] = { | ||
125 | { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
126 | { .div = 0 } | ||
127 | }; | ||
128 | |||
129 | static const struct clksel_rate osc_sys_38_4m_rates[] = { | ||
130 | { .div = 1, .val = 4, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
131 | { .div = 0 } | ||
132 | }; | ||
133 | |||
134 | static const struct clksel osc_sys_clksel[] = { | ||
135 | { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates }, | ||
136 | { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates }, | ||
137 | { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates }, | ||
138 | { .parent = &virt_19_2m_ck, .rates = osc_sys_19_2m_rates }, | ||
139 | { .parent = &virt_26m_ck, .rates = osc_sys_26m_rates }, | ||
140 | { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates }, | ||
141 | { .parent = NULL }, | ||
142 | }; | ||
143 | |||
144 | /* Oscillator clock */ | ||
145 | /* 12, 13, 16.8, 19.2, 26, or 38.4 MHz */ | ||
146 | static struct clk osc_sys_ck = { | ||
147 | .name = "osc_sys_ck", | ||
148 | .init = &omap2_init_clksel_parent, | ||
149 | .clksel_reg = OMAP3430_PRM_CLKSEL, | ||
150 | .clksel_mask = OMAP3430_SYS_CLKIN_SEL_MASK, | ||
151 | .clksel = osc_sys_clksel, | ||
152 | /* REVISIT: deal with autoextclkmode? */ | ||
153 | .flags = CLOCK_IN_OMAP343X | RATE_FIXED | RATE_PROPAGATES | | ||
154 | ALWAYS_ENABLED, | ||
155 | .recalc = &omap2_clksel_recalc, | ||
156 | }; | ||
157 | |||
158 | static const struct clksel_rate div2_rates[] = { | ||
159 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
160 | { .div = 2, .val = 2, .flags = RATE_IN_343X }, | ||
161 | { .div = 0 } | ||
162 | }; | ||
163 | |||
164 | static const struct clksel sys_clksel[] = { | ||
165 | { .parent = &osc_sys_ck, .rates = div2_rates }, | ||
166 | { .parent = NULL } | ||
167 | }; | ||
168 | |||
169 | /* Latency: this clock is only enabled after PRM_CLKSETUP.SETUP_TIME */ | ||
170 | /* Feeds DPLLs - divided first by PRM_CLKSRC_CTRL.SYSCLKDIV? */ | ||
171 | static struct clk sys_ck = { | ||
172 | .name = "sys_ck", | ||
173 | .parent = &osc_sys_ck, | ||
174 | .init = &omap2_init_clksel_parent, | ||
175 | .clksel_reg = OMAP3430_PRM_CLKSRC_CTRL, | ||
176 | .clksel_mask = OMAP_SYSCLKDIV_MASK, | ||
177 | .clksel = sys_clksel, | ||
178 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
179 | .recalc = &omap2_clksel_recalc, | ||
180 | }; | ||
181 | |||
182 | static struct clk sys_altclk = { | ||
183 | .name = "sys_altclk", | ||
184 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
185 | .recalc = &propagate_rate, | ||
186 | }; | ||
187 | |||
188 | /* Optional external clock input for some McBSPs */ | ||
189 | static struct clk mcbsp_clks = { | ||
190 | .name = "mcbsp_clks", | ||
191 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
192 | .recalc = &propagate_rate, | ||
193 | }; | ||
194 | |||
195 | /* PRM EXTERNAL CLOCK OUTPUT */ | ||
196 | |||
197 | static struct clk sys_clkout1 = { | ||
198 | .name = "sys_clkout1", | ||
199 | .parent = &osc_sys_ck, | ||
200 | .enable_reg = OMAP3430_PRM_CLKOUT_CTRL, | ||
201 | .enable_bit = OMAP3430_CLKOUT_EN_SHIFT, | ||
202 | .flags = CLOCK_IN_OMAP343X, | ||
203 | .recalc = &followparent_recalc, | ||
204 | }; | ||
205 | |||
206 | /* DPLLS */ | ||
207 | |||
208 | /* CM CLOCKS */ | ||
209 | |||
210 | static const struct clksel_rate dpll_bypass_rates[] = { | ||
211 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
212 | { .div = 0 } | ||
213 | }; | ||
214 | |||
215 | static const struct clksel_rate dpll_locked_rates[] = { | ||
216 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
217 | { .div = 0 } | ||
218 | }; | ||
219 | |||
220 | static const struct clksel_rate div16_dpll_rates[] = { | ||
221 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
222 | { .div = 2, .val = 2, .flags = RATE_IN_343X }, | ||
223 | { .div = 3, .val = 3, .flags = RATE_IN_343X }, | ||
224 | { .div = 4, .val = 4, .flags = RATE_IN_343X }, | ||
225 | { .div = 5, .val = 5, .flags = RATE_IN_343X }, | ||
226 | { .div = 6, .val = 6, .flags = RATE_IN_343X }, | ||
227 | { .div = 7, .val = 7, .flags = RATE_IN_343X }, | ||
228 | { .div = 8, .val = 8, .flags = RATE_IN_343X }, | ||
229 | { .div = 9, .val = 9, .flags = RATE_IN_343X }, | ||
230 | { .div = 10, .val = 10, .flags = RATE_IN_343X }, | ||
231 | { .div = 11, .val = 11, .flags = RATE_IN_343X }, | ||
232 | { .div = 12, .val = 12, .flags = RATE_IN_343X }, | ||
233 | { .div = 13, .val = 13, .flags = RATE_IN_343X }, | ||
234 | { .div = 14, .val = 14, .flags = RATE_IN_343X }, | ||
235 | { .div = 15, .val = 15, .flags = RATE_IN_343X }, | ||
236 | { .div = 16, .val = 16, .flags = RATE_IN_343X }, | ||
237 | { .div = 0 } | ||
238 | }; | ||
239 | |||
240 | /* DPLL1 */ | ||
241 | /* MPU clock source */ | ||
242 | /* Type: DPLL */ | ||
243 | static const struct dpll_data dpll1_dd = { | ||
244 | .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), | ||
245 | .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK, | ||
246 | .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK, | ||
247 | .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL), | ||
248 | .enable_mask = OMAP3430_EN_MPU_DPLL_MASK, | ||
249 | .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT, | ||
250 | .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT, | ||
251 | .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT, | ||
252 | }; | ||
253 | |||
254 | static struct clk dpll1_ck = { | ||
255 | .name = "dpll1_ck", | ||
256 | .parent = &sys_ck, | ||
257 | .dpll_data = &dpll1_dd, | ||
258 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
259 | .recalc = &omap3_dpll_recalc, | ||
260 | }; | ||
261 | |||
262 | /* | ||
263 | * This virtual clock provides the CLKOUTX2 output from the DPLL if the | ||
264 | * DPLL isn't bypassed. | ||
265 | */ | ||
266 | static struct clk dpll1_x2_ck = { | ||
267 | .name = "dpll1_x2_ck", | ||
268 | .parent = &dpll1_ck, | ||
269 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
270 | PARENT_CONTROLS_CLOCK, | ||
271 | .recalc = &omap3_clkoutx2_recalc, | ||
272 | }; | ||
273 | |||
274 | /* On DPLL1, unlike other DPLLs, the divider is downstream from CLKOUTX2 */ | ||
275 | static const struct clksel div16_dpll1_x2m2_clksel[] = { | ||
276 | { .parent = &dpll1_x2_ck, .rates = div16_dpll_rates }, | ||
277 | { .parent = NULL } | ||
278 | }; | ||
279 | |||
280 | /* | ||
281 | * Does not exist in the TRM - needed to separate the M2 divider from | ||
282 | * bypass selection in mpu_ck | ||
283 | */ | ||
284 | static struct clk dpll1_x2m2_ck = { | ||
285 | .name = "dpll1_x2m2_ck", | ||
286 | .parent = &dpll1_x2_ck, | ||
287 | .init = &omap2_init_clksel_parent, | ||
288 | .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL), | ||
289 | .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK, | ||
290 | .clksel = div16_dpll1_x2m2_clksel, | ||
291 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
292 | PARENT_CONTROLS_CLOCK, | ||
293 | .recalc = &omap2_clksel_recalc, | ||
294 | }; | ||
295 | |||
296 | /* DPLL2 */ | ||
297 | /* IVA2 clock source */ | ||
298 | /* Type: DPLL */ | ||
299 | |||
300 | static const struct dpll_data dpll2_dd = { | ||
301 | .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), | ||
302 | .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK, | ||
303 | .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK, | ||
304 | .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL), | ||
305 | .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK, | ||
306 | .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT, | ||
307 | .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT, | ||
308 | .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT, | ||
309 | }; | ||
310 | |||
311 | static struct clk dpll2_ck = { | ||
312 | .name = "dpll2_ck", | ||
313 | .parent = &sys_ck, | ||
314 | .dpll_data = &dpll2_dd, | ||
315 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
316 | .recalc = &omap3_dpll_recalc, | ||
317 | }; | ||
318 | |||
319 | static const struct clksel div16_dpll2_m2x2_clksel[] = { | ||
320 | { .parent = &dpll2_ck, .rates = div16_dpll_rates }, | ||
321 | { .parent = NULL } | ||
322 | }; | ||
323 | |||
324 | /* | ||
325 | * The TRM is conflicted on whether IVA2 clock comes from DPLL2 CLKOUT | ||
326 | * or CLKOUTX2. CLKOUT seems most plausible. | ||
327 | */ | ||
328 | static struct clk dpll2_m2_ck = { | ||
329 | .name = "dpll2_m2_ck", | ||
330 | .parent = &dpll2_ck, | ||
331 | .init = &omap2_init_clksel_parent, | ||
332 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, | ||
333 | OMAP3430_CM_CLKSEL2_PLL), | ||
334 | .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK, | ||
335 | .clksel = div16_dpll2_m2x2_clksel, | ||
336 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
337 | PARENT_CONTROLS_CLOCK, | ||
338 | .recalc = &omap2_clksel_recalc, | ||
339 | }; | ||
340 | |||
341 | /* DPLL3 */ | ||
342 | /* Source clock for all interfaces and for some device fclks */ | ||
343 | /* Type: DPLL */ | ||
344 | static const struct dpll_data dpll3_dd = { | ||
345 | .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
346 | .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK, | ||
347 | .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK, | ||
348 | .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
349 | .enable_mask = OMAP3430_EN_CORE_DPLL_MASK, | ||
350 | .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT, | ||
351 | .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT, | ||
352 | .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT, | ||
353 | }; | ||
354 | |||
355 | static struct clk dpll3_ck = { | ||
356 | .name = "dpll3_ck", | ||
357 | .parent = &sys_ck, | ||
358 | .dpll_data = &dpll3_dd, | ||
359 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
360 | .recalc = &omap3_dpll_recalc, | ||
361 | }; | ||
362 | |||
363 | /* | ||
364 | * This virtual clock provides the CLKOUTX2 output from the DPLL if the | ||
365 | * DPLL isn't bypassed | ||
366 | */ | ||
367 | static struct clk dpll3_x2_ck = { | ||
368 | .name = "dpll3_x2_ck", | ||
369 | .parent = &dpll3_ck, | ||
370 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
371 | PARENT_CONTROLS_CLOCK, | ||
372 | .recalc = &omap3_clkoutx2_recalc, | ||
373 | }; | ||
374 | |||
375 | static const struct clksel_rate div31_dpll3_rates[] = { | ||
376 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
377 | { .div = 2, .val = 2, .flags = RATE_IN_343X }, | ||
378 | { .div = 3, .val = 3, .flags = RATE_IN_3430ES2 }, | ||
379 | { .div = 4, .val = 4, .flags = RATE_IN_3430ES2 }, | ||
380 | { .div = 5, .val = 5, .flags = RATE_IN_3430ES2 }, | ||
381 | { .div = 6, .val = 6, .flags = RATE_IN_3430ES2 }, | ||
382 | { .div = 7, .val = 7, .flags = RATE_IN_3430ES2 }, | ||
383 | { .div = 8, .val = 8, .flags = RATE_IN_3430ES2 }, | ||
384 | { .div = 9, .val = 9, .flags = RATE_IN_3430ES2 }, | ||
385 | { .div = 10, .val = 10, .flags = RATE_IN_3430ES2 }, | ||
386 | { .div = 11, .val = 11, .flags = RATE_IN_3430ES2 }, | ||
387 | { .div = 12, .val = 12, .flags = RATE_IN_3430ES2 }, | ||
388 | { .div = 13, .val = 13, .flags = RATE_IN_3430ES2 }, | ||
389 | { .div = 14, .val = 14, .flags = RATE_IN_3430ES2 }, | ||
390 | { .div = 15, .val = 15, .flags = RATE_IN_3430ES2 }, | ||
391 | { .div = 16, .val = 16, .flags = RATE_IN_3430ES2 }, | ||
392 | { .div = 17, .val = 17, .flags = RATE_IN_3430ES2 }, | ||
393 | { .div = 18, .val = 18, .flags = RATE_IN_3430ES2 }, | ||
394 | { .div = 19, .val = 19, .flags = RATE_IN_3430ES2 }, | ||
395 | { .div = 20, .val = 20, .flags = RATE_IN_3430ES2 }, | ||
396 | { .div = 21, .val = 21, .flags = RATE_IN_3430ES2 }, | ||
397 | { .div = 22, .val = 22, .flags = RATE_IN_3430ES2 }, | ||
398 | { .div = 23, .val = 23, .flags = RATE_IN_3430ES2 }, | ||
399 | { .div = 24, .val = 24, .flags = RATE_IN_3430ES2 }, | ||
400 | { .div = 25, .val = 25, .flags = RATE_IN_3430ES2 }, | ||
401 | { .div = 26, .val = 26, .flags = RATE_IN_3430ES2 }, | ||
402 | { .div = 27, .val = 27, .flags = RATE_IN_3430ES2 }, | ||
403 | { .div = 28, .val = 28, .flags = RATE_IN_3430ES2 }, | ||
404 | { .div = 29, .val = 29, .flags = RATE_IN_3430ES2 }, | ||
405 | { .div = 30, .val = 30, .flags = RATE_IN_3430ES2 }, | ||
406 | { .div = 31, .val = 31, .flags = RATE_IN_3430ES2 }, | ||
407 | { .div = 0 }, | ||
408 | }; | ||
409 | |||
410 | static const struct clksel div31_dpll3m2_clksel[] = { | ||
411 | { .parent = &dpll3_ck, .rates = div31_dpll3_rates }, | ||
412 | { .parent = NULL } | ||
413 | }; | ||
414 | |||
415 | /* | ||
416 | * DPLL3 output M2 | ||
417 | * REVISIT: This DPLL output divider must be changed in SRAM, so until | ||
418 | * that code is ready, this should remain a 'read-only' clksel clock. | ||
419 | */ | ||
420 | static struct clk dpll3_m2_ck = { | ||
421 | .name = "dpll3_m2_ck", | ||
422 | .parent = &dpll3_ck, | ||
423 | .init = &omap2_init_clksel_parent, | ||
424 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
425 | .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK, | ||
426 | .clksel = div31_dpll3m2_clksel, | ||
427 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
428 | PARENT_CONTROLS_CLOCK, | ||
429 | .recalc = &omap2_clksel_recalc, | ||
430 | }; | ||
431 | |||
432 | static const struct clksel core_ck_clksel[] = { | ||
433 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
434 | { .parent = &dpll3_m2_ck, .rates = dpll_locked_rates }, | ||
435 | { .parent = NULL } | ||
436 | }; | ||
437 | |||
438 | static struct clk core_ck = { | ||
439 | .name = "core_ck", | ||
440 | .init = &omap2_init_clksel_parent, | ||
441 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
442 | .clksel_mask = OMAP3430_ST_CORE_CLK, | ||
443 | .clksel = core_ck_clksel, | ||
444 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
445 | PARENT_CONTROLS_CLOCK, | ||
446 | .recalc = &omap2_clksel_recalc, | ||
447 | }; | ||
448 | |||
449 | static const struct clksel dpll3_m2x2_ck_clksel[] = { | ||
450 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
451 | { .parent = &dpll3_x2_ck, .rates = dpll_locked_rates }, | ||
452 | { .parent = NULL } | ||
453 | }; | ||
454 | |||
455 | static struct clk dpll3_m2x2_ck = { | ||
456 | .name = "dpll3_m2x2_ck", | ||
457 | .init = &omap2_init_clksel_parent, | ||
458 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
459 | .clksel_mask = OMAP3430_ST_CORE_CLK, | ||
460 | .clksel = dpll3_m2x2_ck_clksel, | ||
461 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
462 | PARENT_CONTROLS_CLOCK, | ||
463 | .recalc = &omap2_clksel_recalc, | ||
464 | }; | ||
465 | |||
466 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
467 | static const struct clksel div16_dpll3_clksel[] = { | ||
468 | { .parent = &dpll3_ck, .rates = div16_dpll_rates }, | ||
469 | { .parent = NULL } | ||
470 | }; | ||
471 | |||
472 | /* This virtual clock is the source for dpll3_m3x2_ck */ | ||
473 | static struct clk dpll3_m3_ck = { | ||
474 | .name = "dpll3_m3_ck", | ||
475 | .parent = &dpll3_ck, | ||
476 | .init = &omap2_init_clksel_parent, | ||
477 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
478 | .clksel_mask = OMAP3430_DIV_DPLL3_MASK, | ||
479 | .clksel = div16_dpll3_clksel, | ||
480 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
481 | PARENT_CONTROLS_CLOCK, | ||
482 | .recalc = &omap2_clksel_recalc, | ||
483 | }; | ||
484 | |||
485 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
486 | static struct clk dpll3_m3x2_ck = { | ||
487 | .name = "dpll3_m3x2_ck", | ||
488 | .parent = &dpll3_m3_ck, | ||
489 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
490 | .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT, | ||
491 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, | ||
492 | .recalc = &omap3_clkoutx2_recalc, | ||
493 | }; | ||
494 | |||
495 | static const struct clksel emu_core_alwon_ck_clksel[] = { | ||
496 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
497 | { .parent = &dpll3_m3x2_ck, .rates = dpll_locked_rates }, | ||
498 | { .parent = NULL } | ||
499 | }; | ||
500 | |||
501 | static struct clk emu_core_alwon_ck = { | ||
502 | .name = "emu_core_alwon_ck", | ||
503 | .parent = &dpll3_m3x2_ck, | ||
504 | .init = &omap2_init_clksel_parent, | ||
505 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
506 | .clksel_mask = OMAP3430_ST_CORE_CLK, | ||
507 | .clksel = emu_core_alwon_ck_clksel, | ||
508 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
509 | PARENT_CONTROLS_CLOCK, | ||
510 | .recalc = &omap2_clksel_recalc, | ||
511 | }; | ||
512 | |||
513 | /* DPLL4 */ | ||
514 | /* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */ | ||
515 | /* Type: DPLL */ | ||
516 | static const struct dpll_data dpll4_dd = { | ||
517 | .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2), | ||
518 | .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK, | ||
519 | .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK, | ||
520 | .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
521 | .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK, | ||
522 | .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT, | ||
523 | .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT, | ||
524 | .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT, | ||
525 | }; | ||
526 | |||
527 | static struct clk dpll4_ck = { | ||
528 | .name = "dpll4_ck", | ||
529 | .parent = &sys_ck, | ||
530 | .dpll_data = &dpll4_dd, | ||
531 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
532 | .recalc = &omap3_dpll_recalc, | ||
533 | }; | ||
534 | |||
535 | /* | ||
536 | * This virtual clock provides the CLKOUTX2 output from the DPLL if the | ||
537 | * DPLL isn't bypassed -- | ||
538 | * XXX does this serve any downstream clocks? | ||
539 | */ | ||
540 | static struct clk dpll4_x2_ck = { | ||
541 | .name = "dpll4_x2_ck", | ||
542 | .parent = &dpll4_ck, | ||
543 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
544 | PARENT_CONTROLS_CLOCK, | ||
545 | .recalc = &omap3_clkoutx2_recalc, | ||
546 | }; | ||
547 | |||
548 | static const struct clksel div16_dpll4_clksel[] = { | ||
549 | { .parent = &dpll4_ck, .rates = div16_dpll_rates }, | ||
550 | { .parent = NULL } | ||
551 | }; | ||
552 | |||
553 | /* This virtual clock is the source for dpll4_m2x2_ck */ | ||
554 | static struct clk dpll4_m2_ck = { | ||
555 | .name = "dpll4_m2_ck", | ||
556 | .parent = &dpll4_ck, | ||
557 | .init = &omap2_init_clksel_parent, | ||
558 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3), | ||
559 | .clksel_mask = OMAP3430_DIV_96M_MASK, | ||
560 | .clksel = div16_dpll4_clksel, | ||
561 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
562 | PARENT_CONTROLS_CLOCK, | ||
563 | .recalc = &omap2_clksel_recalc, | ||
564 | }; | ||
565 | |||
566 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
567 | static struct clk dpll4_m2x2_ck = { | ||
568 | .name = "dpll4_m2x2_ck", | ||
569 | .parent = &dpll4_m2_ck, | ||
570 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
571 | .enable_bit = OMAP3430_PWRDN_96M_SHIFT, | ||
572 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, | ||
573 | .recalc = &omap3_clkoutx2_recalc, | ||
574 | }; | ||
575 | |||
576 | static const struct clksel omap_96m_alwon_fck_clksel[] = { | ||
577 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
578 | { .parent = &dpll4_m2x2_ck, .rates = dpll_locked_rates }, | ||
579 | { .parent = NULL } | ||
580 | }; | ||
581 | |||
582 | static struct clk omap_96m_alwon_fck = { | ||
583 | .name = "omap_96m_alwon_fck", | ||
584 | .parent = &dpll4_m2x2_ck, | ||
585 | .init = &omap2_init_clksel_parent, | ||
586 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
587 | .clksel_mask = OMAP3430_ST_PERIPH_CLK, | ||
588 | .clksel = omap_96m_alwon_fck_clksel, | ||
589 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
590 | PARENT_CONTROLS_CLOCK, | ||
591 | .recalc = &omap2_clksel_recalc, | ||
592 | }; | ||
593 | |||
594 | static struct clk omap_96m_fck = { | ||
595 | .name = "omap_96m_fck", | ||
596 | .parent = &omap_96m_alwon_fck, | ||
597 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
598 | PARENT_CONTROLS_CLOCK, | ||
599 | .recalc = &followparent_recalc, | ||
600 | }; | ||
601 | |||
602 | static const struct clksel cm_96m_fck_clksel[] = { | ||
603 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
604 | { .parent = &dpll4_m2x2_ck, .rates = dpll_locked_rates }, | ||
605 | { .parent = NULL } | ||
606 | }; | ||
607 | |||
608 | static struct clk cm_96m_fck = { | ||
609 | .name = "cm_96m_fck", | ||
610 | .parent = &dpll4_m2x2_ck, | ||
611 | .init = &omap2_init_clksel_parent, | ||
612 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
613 | .clksel_mask = OMAP3430_ST_PERIPH_CLK, | ||
614 | .clksel = cm_96m_fck_clksel, | ||
615 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
616 | PARENT_CONTROLS_CLOCK, | ||
617 | .recalc = &omap2_clksel_recalc, | ||
618 | }; | ||
619 | |||
620 | /* This virtual clock is the source for dpll4_m3x2_ck */ | ||
621 | static struct clk dpll4_m3_ck = { | ||
622 | .name = "dpll4_m3_ck", | ||
623 | .parent = &dpll4_ck, | ||
624 | .init = &omap2_init_clksel_parent, | ||
625 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), | ||
626 | .clksel_mask = OMAP3430_CLKSEL_TV_MASK, | ||
627 | .clksel = div16_dpll4_clksel, | ||
628 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
629 | PARENT_CONTROLS_CLOCK, | ||
630 | .recalc = &omap2_clksel_recalc, | ||
631 | }; | ||
632 | |||
633 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
634 | static struct clk dpll4_m3x2_ck = { | ||
635 | .name = "dpll4_m3x2_ck", | ||
636 | .parent = &dpll4_m3_ck, | ||
637 | .init = &omap2_init_clksel_parent, | ||
638 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
639 | .enable_bit = OMAP3430_PWRDN_TV_SHIFT, | ||
640 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, | ||
641 | .recalc = &omap3_clkoutx2_recalc, | ||
642 | }; | ||
643 | |||
644 | static const struct clksel virt_omap_54m_fck_clksel[] = { | ||
645 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
646 | { .parent = &dpll4_m3x2_ck, .rates = dpll_locked_rates }, | ||
647 | { .parent = NULL } | ||
648 | }; | ||
649 | |||
650 | static struct clk virt_omap_54m_fck = { | ||
651 | .name = "virt_omap_54m_fck", | ||
652 | .parent = &dpll4_m3x2_ck, | ||
653 | .init = &omap2_init_clksel_parent, | ||
654 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
655 | .clksel_mask = OMAP3430_ST_PERIPH_CLK, | ||
656 | .clksel = virt_omap_54m_fck_clksel, | ||
657 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
658 | PARENT_CONTROLS_CLOCK, | ||
659 | .recalc = &omap2_clksel_recalc, | ||
660 | }; | ||
661 | |||
662 | static const struct clksel_rate omap_54m_d4m3x2_rates[] = { | ||
663 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
664 | { .div = 0 } | ||
665 | }; | ||
666 | |||
667 | static const struct clksel_rate omap_54m_alt_rates[] = { | ||
668 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
669 | { .div = 0 } | ||
670 | }; | ||
671 | |||
672 | static const struct clksel omap_54m_clksel[] = { | ||
673 | { .parent = &virt_omap_54m_fck, .rates = omap_54m_d4m3x2_rates }, | ||
674 | { .parent = &sys_altclk, .rates = omap_54m_alt_rates }, | ||
675 | { .parent = NULL } | ||
676 | }; | ||
677 | |||
678 | static struct clk omap_54m_fck = { | ||
679 | .name = "omap_54m_fck", | ||
680 | .init = &omap2_init_clksel_parent, | ||
681 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
682 | .clksel_mask = OMAP3430_SOURCE_54M, | ||
683 | .clksel = omap_54m_clksel, | ||
684 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
685 | PARENT_CONTROLS_CLOCK, | ||
686 | .recalc = &omap2_clksel_recalc, | ||
687 | }; | ||
688 | |||
689 | static const struct clksel_rate omap_48m_96md2_rates[] = { | ||
690 | { .div = 2, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
691 | { .div = 0 } | ||
692 | }; | ||
693 | |||
694 | static const struct clksel_rate omap_48m_alt_rates[] = { | ||
695 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
696 | { .div = 0 } | ||
697 | }; | ||
698 | |||
699 | static const struct clksel omap_48m_clksel[] = { | ||
700 | { .parent = &cm_96m_fck, .rates = omap_48m_96md2_rates }, | ||
701 | { .parent = &sys_altclk, .rates = omap_48m_alt_rates }, | ||
702 | { .parent = NULL } | ||
703 | }; | ||
704 | |||
705 | static struct clk omap_48m_fck = { | ||
706 | .name = "omap_48m_fck", | ||
707 | .init = &omap2_init_clksel_parent, | ||
708 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), | ||
709 | .clksel_mask = OMAP3430_SOURCE_48M, | ||
710 | .clksel = omap_48m_clksel, | ||
711 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
712 | PARENT_CONTROLS_CLOCK, | ||
713 | .recalc = &omap2_clksel_recalc, | ||
714 | }; | ||
715 | |||
716 | static struct clk omap_12m_fck = { | ||
717 | .name = "omap_12m_fck", | ||
718 | .parent = &omap_48m_fck, | ||
719 | .fixed_div = 4, | ||
720 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
721 | PARENT_CONTROLS_CLOCK, | ||
722 | .recalc = &omap2_fixed_divisor_recalc, | ||
723 | }; | ||
724 | |||
725 | /* This virstual clock is the source for dpll4_m4x2_ck */ | ||
726 | static struct clk dpll4_m4_ck = { | ||
727 | .name = "dpll4_m4_ck", | ||
728 | .parent = &dpll4_ck, | ||
729 | .init = &omap2_init_clksel_parent, | ||
730 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), | ||
731 | .clksel_mask = OMAP3430_CLKSEL_DSS1_MASK, | ||
732 | .clksel = div16_dpll4_clksel, | ||
733 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
734 | PARENT_CONTROLS_CLOCK, | ||
735 | .recalc = &omap2_clksel_recalc, | ||
736 | }; | ||
737 | |||
738 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
739 | static struct clk dpll4_m4x2_ck = { | ||
740 | .name = "dpll4_m4x2_ck", | ||
741 | .parent = &dpll4_m4_ck, | ||
742 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
743 | .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, | ||
744 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, | ||
745 | .recalc = &omap3_clkoutx2_recalc, | ||
746 | }; | ||
747 | |||
748 | /* This virtual clock is the source for dpll4_m5x2_ck */ | ||
749 | static struct clk dpll4_m5_ck = { | ||
750 | .name = "dpll4_m5_ck", | ||
751 | .parent = &dpll4_ck, | ||
752 | .init = &omap2_init_clksel_parent, | ||
753 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL), | ||
754 | .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, | ||
755 | .clksel = div16_dpll4_clksel, | ||
756 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
757 | PARENT_CONTROLS_CLOCK, | ||
758 | .recalc = &omap2_clksel_recalc, | ||
759 | }; | ||
760 | |||
761 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
762 | static struct clk dpll4_m5x2_ck = { | ||
763 | .name = "dpll4_m5x2_ck", | ||
764 | .parent = &dpll4_m5_ck, | ||
765 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
766 | .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, | ||
767 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, | ||
768 | .recalc = &omap3_clkoutx2_recalc, | ||
769 | }; | ||
770 | |||
771 | /* This virtual clock is the source for dpll4_m6x2_ck */ | ||
772 | static struct clk dpll4_m6_ck = { | ||
773 | .name = "dpll4_m6_ck", | ||
774 | .parent = &dpll4_ck, | ||
775 | .init = &omap2_init_clksel_parent, | ||
776 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
777 | .clksel_mask = OMAP3430_DIV_DPLL4_MASK, | ||
778 | .clksel = div16_dpll4_clksel, | ||
779 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
780 | PARENT_CONTROLS_CLOCK, | ||
781 | .recalc = &omap2_clksel_recalc, | ||
782 | }; | ||
783 | |||
784 | /* The PWRDN bit is apparently only available on 3430ES2 and above */ | ||
785 | static struct clk dpll4_m6x2_ck = { | ||
786 | .name = "dpll4_m6x2_ck", | ||
787 | .parent = &dpll4_m6_ck, | ||
788 | .init = &omap2_init_clksel_parent, | ||
789 | .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), | ||
790 | .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT, | ||
791 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | INVERT_ENABLE, | ||
792 | .recalc = &omap3_clkoutx2_recalc, | ||
793 | }; | ||
794 | |||
795 | static struct clk emu_per_alwon_ck = { | ||
796 | .name = "emu_per_alwon_ck", | ||
797 | .parent = &dpll4_m6x2_ck, | ||
798 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
799 | PARENT_CONTROLS_CLOCK, | ||
800 | .recalc = &followparent_recalc, | ||
801 | }; | ||
802 | |||
803 | /* DPLL5 */ | ||
804 | /* Supplies 120MHz clock, USIM source clock */ | ||
805 | /* Type: DPLL */ | ||
806 | /* 3430ES2 only */ | ||
807 | static const struct dpll_data dpll5_dd = { | ||
808 | .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4), | ||
809 | .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK, | ||
810 | .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK, | ||
811 | .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2), | ||
812 | .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK, | ||
813 | .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT, | ||
814 | .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT, | ||
815 | .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT, | ||
816 | }; | ||
817 | |||
818 | static struct clk dpll5_ck = { | ||
819 | .name = "dpll5_ck", | ||
820 | .parent = &sys_ck, | ||
821 | .dpll_data = &dpll5_dd, | ||
822 | .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES | | ||
823 | ALWAYS_ENABLED, | ||
824 | .recalc = &omap3_dpll_recalc, | ||
825 | }; | ||
826 | |||
827 | static const struct clksel div16_dpll5_clksel[] = { | ||
828 | { .parent = &dpll5_ck, .rates = div16_dpll_rates }, | ||
829 | { .parent = NULL } | ||
830 | }; | ||
831 | |||
832 | static struct clk dpll5_m2_ck = { | ||
833 | .name = "dpll5_m2_ck", | ||
834 | .parent = &dpll5_ck, | ||
835 | .init = &omap2_init_clksel_parent, | ||
836 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5), | ||
837 | .clksel_mask = OMAP3430ES2_DIV_120M_MASK, | ||
838 | .clksel = div16_dpll5_clksel, | ||
839 | .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES, | ||
840 | .recalc = &omap2_clksel_recalc, | ||
841 | }; | ||
842 | |||
843 | static const struct clksel omap_120m_fck_clksel[] = { | ||
844 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
845 | { .parent = &dpll5_m2_ck, .rates = dpll_locked_rates }, | ||
846 | { .parent = NULL } | ||
847 | }; | ||
848 | |||
849 | static struct clk omap_120m_fck = { | ||
850 | .name = "omap_120m_fck", | ||
851 | .parent = &dpll5_m2_ck, | ||
852 | .init = &omap2_init_clksel_parent, | ||
853 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2), | ||
854 | .clksel_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK, | ||
855 | .clksel = omap_120m_fck_clksel, | ||
856 | .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES | | ||
857 | PARENT_CONTROLS_CLOCK, | ||
858 | .recalc = &omap2_clksel_recalc, | ||
859 | }; | ||
860 | |||
861 | /* CM EXTERNAL CLOCK OUTPUTS */ | ||
862 | |||
863 | static const struct clksel_rate clkout2_src_core_rates[] = { | ||
864 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
865 | { .div = 0 } | ||
866 | }; | ||
867 | |||
868 | static const struct clksel_rate clkout2_src_sys_rates[] = { | ||
869 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
870 | { .div = 0 } | ||
871 | }; | ||
872 | |||
873 | static const struct clksel_rate clkout2_src_96m_rates[] = { | ||
874 | { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
875 | { .div = 0 } | ||
876 | }; | ||
877 | |||
878 | static const struct clksel_rate clkout2_src_54m_rates[] = { | ||
879 | { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
880 | { .div = 0 } | ||
881 | }; | ||
882 | |||
883 | static const struct clksel clkout2_src_clksel[] = { | ||
884 | { .parent = &core_ck, .rates = clkout2_src_core_rates }, | ||
885 | { .parent = &sys_ck, .rates = clkout2_src_sys_rates }, | ||
886 | { .parent = &omap_96m_alwon_fck, .rates = clkout2_src_96m_rates }, | ||
887 | { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates }, | ||
888 | { .parent = NULL } | ||
889 | }; | ||
890 | |||
891 | static struct clk clkout2_src_ck = { | ||
892 | .name = "clkout2_src_ck", | ||
893 | .init = &omap2_init_clksel_parent, | ||
894 | .enable_reg = OMAP3430_CM_CLKOUT_CTRL, | ||
895 | .enable_bit = OMAP3430_CLKOUT2_EN_SHIFT, | ||
896 | .clksel_reg = OMAP3430_CM_CLKOUT_CTRL, | ||
897 | .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK, | ||
898 | .clksel = clkout2_src_clksel, | ||
899 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, | ||
900 | .recalc = &omap2_clksel_recalc, | ||
901 | }; | ||
902 | |||
903 | static const struct clksel_rate sys_clkout2_rates[] = { | ||
904 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
905 | { .div = 2, .val = 1, .flags = RATE_IN_343X }, | ||
906 | { .div = 4, .val = 2, .flags = RATE_IN_343X }, | ||
907 | { .div = 8, .val = 3, .flags = RATE_IN_343X }, | ||
908 | { .div = 16, .val = 4, .flags = RATE_IN_343X }, | ||
909 | { .div = 0 }, | ||
910 | }; | ||
911 | |||
912 | static const struct clksel sys_clkout2_clksel[] = { | ||
913 | { .parent = &clkout2_src_ck, .rates = sys_clkout2_rates }, | ||
914 | { .parent = NULL }, | ||
915 | }; | ||
916 | |||
917 | static struct clk sys_clkout2 = { | ||
918 | .name = "sys_clkout2", | ||
919 | .init = &omap2_init_clksel_parent, | ||
920 | .clksel_reg = OMAP3430_CM_CLKOUT_CTRL, | ||
921 | .clksel_mask = OMAP3430_CLKOUT2_DIV_MASK, | ||
922 | .clksel = sys_clkout2_clksel, | ||
923 | .flags = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK, | ||
924 | .recalc = &omap2_clksel_recalc, | ||
925 | }; | ||
926 | |||
927 | /* CM OUTPUT CLOCKS */ | ||
928 | |||
929 | static struct clk corex2_fck = { | ||
930 | .name = "corex2_fck", | ||
931 | .parent = &dpll3_m2x2_ck, | ||
932 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
933 | PARENT_CONTROLS_CLOCK, | ||
934 | .recalc = &followparent_recalc, | ||
935 | }; | ||
936 | |||
937 | /* DPLL power domain clock controls */ | ||
938 | |||
939 | static const struct clksel div2_core_clksel[] = { | ||
940 | { .parent = &core_ck, .rates = div2_rates }, | ||
941 | { .parent = NULL } | ||
942 | }; | ||
943 | |||
944 | /* | ||
945 | * REVISIT: Are these in DPLL power domain or CM power domain? docs | ||
946 | * may be inconsistent here? | ||
947 | */ | ||
948 | static struct clk dpll1_fck = { | ||
949 | .name = "dpll1_fck", | ||
950 | .parent = &core_ck, | ||
951 | .init = &omap2_init_clksel_parent, | ||
952 | .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), | ||
953 | .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK, | ||
954 | .clksel = div2_core_clksel, | ||
955 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
956 | PARENT_CONTROLS_CLOCK, | ||
957 | .recalc = &omap2_clksel_recalc, | ||
958 | }; | ||
959 | |||
960 | /* | ||
961 | * MPU clksel: | ||
962 | * If DPLL1 is locked, mpu_ck derives from DPLL1; otherwise, mpu_ck | ||
963 | * derives from the high-frequency bypass clock originating from DPLL3, | ||
964 | * called 'dpll1_fck' | ||
965 | */ | ||
966 | static const struct clksel mpu_clksel[] = { | ||
967 | { .parent = &dpll1_fck, .rates = dpll_bypass_rates }, | ||
968 | { .parent = &dpll1_x2m2_ck, .rates = dpll_locked_rates }, | ||
969 | { .parent = NULL } | ||
970 | }; | ||
971 | |||
972 | static struct clk mpu_ck = { | ||
973 | .name = "mpu_ck", | ||
974 | .parent = &dpll1_x2m2_ck, | ||
975 | .init = &omap2_init_clksel_parent, | ||
976 | .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL), | ||
977 | .clksel_mask = OMAP3430_ST_MPU_CLK_MASK, | ||
978 | .clksel = mpu_clksel, | ||
979 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
980 | PARENT_CONTROLS_CLOCK, | ||
981 | .recalc = &omap2_clksel_recalc, | ||
982 | }; | ||
983 | |||
984 | /* arm_fck is divided by two when DPLL1 locked; otherwise, passthrough mpu_ck */ | ||
985 | static const struct clksel_rate arm_fck_rates[] = { | ||
986 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
987 | { .div = 2, .val = 1, .flags = RATE_IN_343X }, | ||
988 | { .div = 0 }, | ||
989 | }; | ||
990 | |||
991 | static const struct clksel arm_fck_clksel[] = { | ||
992 | { .parent = &mpu_ck, .rates = arm_fck_rates }, | ||
993 | { .parent = NULL } | ||
994 | }; | ||
995 | |||
996 | static struct clk arm_fck = { | ||
997 | .name = "arm_fck", | ||
998 | .parent = &mpu_ck, | ||
999 | .init = &omap2_init_clksel_parent, | ||
1000 | .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL), | ||
1001 | .clksel_mask = OMAP3430_ST_MPU_CLK_MASK, | ||
1002 | .clksel = arm_fck_clksel, | ||
1003 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1004 | PARENT_CONTROLS_CLOCK, | ||
1005 | .recalc = &omap2_clksel_recalc, | ||
1006 | }; | ||
1007 | |||
1008 | /* | ||
1009 | * REVISIT: This clock is never specifically defined in the 3430 TRM, | ||
1010 | * although it is referenced - so this is a guess | ||
1011 | */ | ||
1012 | static struct clk emu_mpu_alwon_ck = { | ||
1013 | .name = "emu_mpu_alwon_ck", | ||
1014 | .parent = &mpu_ck, | ||
1015 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1016 | PARENT_CONTROLS_CLOCK, | ||
1017 | .recalc = &followparent_recalc, | ||
1018 | }; | ||
1019 | |||
1020 | static struct clk dpll2_fck = { | ||
1021 | .name = "dpll2_fck", | ||
1022 | .parent = &core_ck, | ||
1023 | .init = &omap2_init_clksel_parent, | ||
1024 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), | ||
1025 | .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK, | ||
1026 | .clksel = div2_core_clksel, | ||
1027 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1028 | PARENT_CONTROLS_CLOCK, | ||
1029 | .recalc = &omap2_clksel_recalc, | ||
1030 | }; | ||
1031 | |||
1032 | /* | ||
1033 | * IVA2 clksel: | ||
1034 | * If DPLL2 is locked, iva2_ck derives from DPLL2; otherwise, iva2_ck | ||
1035 | * derives from the high-frequency bypass clock originating from DPLL3, | ||
1036 | * called 'dpll2_fck' | ||
1037 | */ | ||
1038 | |||
1039 | static const struct clksel iva2_clksel[] = { | ||
1040 | { .parent = &dpll2_fck, .rates = dpll_bypass_rates }, | ||
1041 | { .parent = &dpll2_m2_ck, .rates = dpll_locked_rates }, | ||
1042 | { .parent = NULL } | ||
1043 | }; | ||
1044 | |||
1045 | static struct clk iva2_ck = { | ||
1046 | .name = "iva2_ck", | ||
1047 | .parent = &dpll2_m2_ck, | ||
1048 | .init = &omap2_init_clksel_parent, | ||
1049 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, | ||
1050 | OMAP3430_CM_IDLEST_PLL), | ||
1051 | .clksel_mask = OMAP3430_ST_IVA2_CLK_MASK, | ||
1052 | .clksel = iva2_clksel, | ||
1053 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1054 | PARENT_CONTROLS_CLOCK, | ||
1055 | .recalc = &omap2_clksel_recalc, | ||
1056 | }; | ||
1057 | |||
1058 | /* Common interface clocks */ | ||
1059 | |||
1060 | static struct clk l3_ick = { | ||
1061 | .name = "l3_ick", | ||
1062 | .parent = &core_ck, | ||
1063 | .init = &omap2_init_clksel_parent, | ||
1064 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1065 | .clksel_mask = OMAP3430_CLKSEL_L3_MASK, | ||
1066 | .clksel = div2_core_clksel, | ||
1067 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1068 | PARENT_CONTROLS_CLOCK, | ||
1069 | .recalc = &omap2_clksel_recalc, | ||
1070 | }; | ||
1071 | |||
1072 | static const struct clksel div2_l3_clksel[] = { | ||
1073 | { .parent = &l3_ick, .rates = div2_rates }, | ||
1074 | { .parent = NULL } | ||
1075 | }; | ||
1076 | |||
1077 | static struct clk l4_ick = { | ||
1078 | .name = "l4_ick", | ||
1079 | .parent = &l3_ick, | ||
1080 | .init = &omap2_init_clksel_parent, | ||
1081 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1082 | .clksel_mask = OMAP3430_CLKSEL_L4_MASK, | ||
1083 | .clksel = div2_l3_clksel, | ||
1084 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1085 | PARENT_CONTROLS_CLOCK, | ||
1086 | .recalc = &omap2_clksel_recalc, | ||
1087 | |||
1088 | }; | ||
1089 | |||
1090 | static const struct clksel div2_l4_clksel[] = { | ||
1091 | { .parent = &l4_ick, .rates = div2_rates }, | ||
1092 | { .parent = NULL } | ||
1093 | }; | ||
1094 | |||
1095 | static struct clk rm_ick = { | ||
1096 | .name = "rm_ick", | ||
1097 | .parent = &l4_ick, | ||
1098 | .init = &omap2_init_clksel_parent, | ||
1099 | .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL), | ||
1100 | .clksel_mask = OMAP3430_CLKSEL_RM_MASK, | ||
1101 | .clksel = div2_l4_clksel, | ||
1102 | .flags = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK, | ||
1103 | .recalc = &omap2_clksel_recalc, | ||
1104 | }; | ||
1105 | |||
1106 | /* GFX power domain */ | ||
1107 | |||
1108 | /* GFX clocks are in 3430ES1 only. 3430ES2 and later uses the SGX instead */ | ||
1109 | |||
1110 | static const struct clksel gfx_l3_clksel[] = { | ||
1111 | { .parent = &l3_ick, .rates = gfx_l3_rates }, | ||
1112 | { .parent = NULL } | ||
1113 | }; | ||
1114 | |||
1115 | static struct clk gfx_l3_fck = { | ||
1116 | .name = "gfx_l3_fck", | ||
1117 | .parent = &l3_ick, | ||
1118 | .init = &omap2_init_clksel_parent, | ||
1119 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN), | ||
1120 | .enable_bit = OMAP_EN_GFX_SHIFT, | ||
1121 | .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL), | ||
1122 | .clksel_mask = OMAP_CLKSEL_GFX_MASK, | ||
1123 | .clksel = gfx_l3_clksel, | ||
1124 | .flags = CLOCK_IN_OMAP3430ES1 | RATE_PROPAGATES, | ||
1125 | .recalc = &omap2_clksel_recalc, | ||
1126 | }; | ||
1127 | |||
1128 | static struct clk gfx_l3_ick = { | ||
1129 | .name = "gfx_l3_ick", | ||
1130 | .parent = &l3_ick, | ||
1131 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN), | ||
1132 | .enable_bit = OMAP_EN_GFX_SHIFT, | ||
1133 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1134 | .recalc = &followparent_recalc, | ||
1135 | }; | ||
1136 | |||
1137 | static struct clk gfx_cg1_ck = { | ||
1138 | .name = "gfx_cg1_ck", | ||
1139 | .parent = &gfx_l3_fck, /* REVISIT: correct? */ | ||
1140 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), | ||
1141 | .enable_bit = OMAP3430ES1_EN_2D_SHIFT, | ||
1142 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1143 | .recalc = &followparent_recalc, | ||
1144 | }; | ||
1145 | |||
1146 | static struct clk gfx_cg2_ck = { | ||
1147 | .name = "gfx_cg2_ck", | ||
1148 | .parent = &gfx_l3_fck, /* REVISIT: correct? */ | ||
1149 | .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), | ||
1150 | .enable_bit = OMAP3430ES1_EN_3D_SHIFT, | ||
1151 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1152 | .recalc = &followparent_recalc, | ||
1153 | }; | ||
1154 | |||
1155 | /* SGX power domain - 3430ES2 only */ | ||
1156 | |||
1157 | static const struct clksel_rate sgx_core_rates[] = { | ||
1158 | { .div = 3, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
1159 | { .div = 4, .val = 1, .flags = RATE_IN_343X }, | ||
1160 | { .div = 6, .val = 2, .flags = RATE_IN_343X }, | ||
1161 | { .div = 0 }, | ||
1162 | }; | ||
1163 | |||
1164 | static const struct clksel_rate sgx_96m_rates[] = { | ||
1165 | { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
1166 | { .div = 0 }, | ||
1167 | }; | ||
1168 | |||
1169 | static const struct clksel sgx_clksel[] = { | ||
1170 | { .parent = &core_ck, .rates = sgx_core_rates }, | ||
1171 | { .parent = &cm_96m_fck, .rates = sgx_96m_rates }, | ||
1172 | { .parent = NULL }, | ||
1173 | }; | ||
1174 | |||
1175 | static struct clk sgx_fck = { | ||
1176 | .name = "sgx_fck", | ||
1177 | .init = &omap2_init_clksel_parent, | ||
1178 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN), | ||
1179 | .enable_bit = OMAP3430ES2_EN_SGX_SHIFT, | ||
1180 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL), | ||
1181 | .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK, | ||
1182 | .clksel = sgx_clksel, | ||
1183 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1184 | .recalc = &omap2_clksel_recalc, | ||
1185 | }; | ||
1186 | |||
1187 | static struct clk sgx_ick = { | ||
1188 | .name = "sgx_ick", | ||
1189 | .parent = &l3_ick, | ||
1190 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN), | ||
1191 | .enable_bit = OMAP3430ES2_EN_SGX_SHIFT, | ||
1192 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1193 | .recalc = &followparent_recalc, | ||
1194 | }; | ||
1195 | |||
1196 | /* CORE power domain */ | ||
1197 | |||
1198 | static struct clk d2d_26m_fck = { | ||
1199 | .name = "d2d_26m_fck", | ||
1200 | .parent = &sys_ck, | ||
1201 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1202 | .enable_bit = OMAP3430ES1_EN_D2D_SHIFT, | ||
1203 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1204 | .recalc = &followparent_recalc, | ||
1205 | }; | ||
1206 | |||
1207 | static const struct clksel omap343x_gpt_clksel[] = { | ||
1208 | { .parent = &omap_32k_fck, .rates = gpt_32k_rates }, | ||
1209 | { .parent = &sys_ck, .rates = gpt_sys_rates }, | ||
1210 | { .parent = NULL} | ||
1211 | }; | ||
1212 | |||
1213 | static struct clk gpt10_fck = { | ||
1214 | .name = "gpt10_fck", | ||
1215 | .parent = &sys_ck, | ||
1216 | .init = &omap2_init_clksel_parent, | ||
1217 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1218 | .enable_bit = OMAP3430_EN_GPT10_SHIFT, | ||
1219 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1220 | .clksel_mask = OMAP3430_CLKSEL_GPT10_MASK, | ||
1221 | .clksel = omap343x_gpt_clksel, | ||
1222 | .flags = CLOCK_IN_OMAP343X, | ||
1223 | .recalc = &omap2_clksel_recalc, | ||
1224 | }; | ||
1225 | |||
1226 | static struct clk gpt11_fck = { | ||
1227 | .name = "gpt11_fck", | ||
1228 | .parent = &sys_ck, | ||
1229 | .init = &omap2_init_clksel_parent, | ||
1230 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1231 | .enable_bit = OMAP3430_EN_GPT11_SHIFT, | ||
1232 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1233 | .clksel_mask = OMAP3430_CLKSEL_GPT11_MASK, | ||
1234 | .clksel = omap343x_gpt_clksel, | ||
1235 | .flags = CLOCK_IN_OMAP343X, | ||
1236 | .recalc = &omap2_clksel_recalc, | ||
1237 | }; | ||
1238 | |||
1239 | static struct clk cpefuse_fck = { | ||
1240 | .name = "cpefuse_fck", | ||
1241 | .parent = &sys_ck, | ||
1242 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), | ||
1243 | .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT, | ||
1244 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1245 | .recalc = &followparent_recalc, | ||
1246 | }; | ||
1247 | |||
1248 | static struct clk ts_fck = { | ||
1249 | .name = "ts_fck", | ||
1250 | .parent = &omap_32k_fck, | ||
1251 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), | ||
1252 | .enable_bit = OMAP3430ES2_EN_TS_SHIFT, | ||
1253 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1254 | .recalc = &followparent_recalc, | ||
1255 | }; | ||
1256 | |||
1257 | static struct clk usbtll_fck = { | ||
1258 | .name = "usbtll_fck", | ||
1259 | .parent = &omap_120m_fck, | ||
1260 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), | ||
1261 | .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, | ||
1262 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1263 | .recalc = &followparent_recalc, | ||
1264 | }; | ||
1265 | |||
1266 | /* CORE 96M FCLK-derived clocks */ | ||
1267 | |||
1268 | static struct clk core_96m_fck = { | ||
1269 | .name = "core_96m_fck", | ||
1270 | .parent = &omap_96m_fck, | ||
1271 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1272 | PARENT_CONTROLS_CLOCK, | ||
1273 | .recalc = &followparent_recalc, | ||
1274 | }; | ||
1275 | |||
1276 | static struct clk mmchs3_fck = { | ||
1277 | .name = "mmchs_fck", | ||
1278 | .id = 3, | ||
1279 | .parent = &core_96m_fck, | ||
1280 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1281 | .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, | ||
1282 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1283 | .recalc = &followparent_recalc, | ||
1284 | }; | ||
1285 | |||
1286 | static struct clk mmchs2_fck = { | ||
1287 | .name = "mmchs_fck", | ||
1288 | .id = 2, | ||
1289 | .parent = &core_96m_fck, | ||
1290 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1291 | .enable_bit = OMAP3430_EN_MMC2_SHIFT, | ||
1292 | .flags = CLOCK_IN_OMAP343X, | ||
1293 | .recalc = &followparent_recalc, | ||
1294 | }; | ||
1295 | |||
1296 | static struct clk mspro_fck = { | ||
1297 | .name = "mspro_fck", | ||
1298 | .parent = &core_96m_fck, | ||
1299 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1300 | .enable_bit = OMAP3430_EN_MSPRO_SHIFT, | ||
1301 | .flags = CLOCK_IN_OMAP343X, | ||
1302 | .recalc = &followparent_recalc, | ||
1303 | }; | ||
1304 | |||
1305 | static struct clk mmchs1_fck = { | ||
1306 | .name = "mmchs_fck", | ||
1307 | .id = 1, | ||
1308 | .parent = &core_96m_fck, | ||
1309 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1310 | .enable_bit = OMAP3430_EN_MMC1_SHIFT, | ||
1311 | .flags = CLOCK_IN_OMAP343X, | ||
1312 | .recalc = &followparent_recalc, | ||
1313 | }; | ||
1314 | |||
1315 | static struct clk i2c3_fck = { | ||
1316 | .name = "i2c_fck", | ||
1317 | .id = 3, | ||
1318 | .parent = &core_96m_fck, | ||
1319 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1320 | .enable_bit = OMAP3430_EN_I2C3_SHIFT, | ||
1321 | .flags = CLOCK_IN_OMAP343X, | ||
1322 | .recalc = &followparent_recalc, | ||
1323 | }; | ||
1324 | |||
1325 | static struct clk i2c2_fck = { | ||
1326 | .name = "i2c_fck", | ||
1327 | .id = 2, | ||
1328 | .parent = &core_96m_fck, | ||
1329 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1330 | .enable_bit = OMAP3430_EN_I2C2_SHIFT, | ||
1331 | .flags = CLOCK_IN_OMAP343X, | ||
1332 | .recalc = &followparent_recalc, | ||
1333 | }; | ||
1334 | |||
1335 | static struct clk i2c1_fck = { | ||
1336 | .name = "i2c_fck", | ||
1337 | .id = 1, | ||
1338 | .parent = &core_96m_fck, | ||
1339 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1340 | .enable_bit = OMAP3430_EN_I2C1_SHIFT, | ||
1341 | .flags = CLOCK_IN_OMAP343X, | ||
1342 | .recalc = &followparent_recalc, | ||
1343 | }; | ||
1344 | |||
1345 | /* | ||
1346 | * MCBSP 1 & 5 get their 96MHz clock from core_96m_fck; | ||
1347 | * MCBSP 2, 3, 4 get their 96MHz clock from per_96m_fck. | ||
1348 | */ | ||
1349 | static const struct clksel_rate common_mcbsp_96m_rates[] = { | ||
1350 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
1351 | { .div = 0 } | ||
1352 | }; | ||
1353 | |||
1354 | static const struct clksel_rate common_mcbsp_mcbsp_rates[] = { | ||
1355 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
1356 | { .div = 0 } | ||
1357 | }; | ||
1358 | |||
1359 | static const struct clksel mcbsp_15_clksel[] = { | ||
1360 | { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates }, | ||
1361 | { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, | ||
1362 | { .parent = NULL } | ||
1363 | }; | ||
1364 | |||
1365 | static struct clk mcbsp5_fck = { | ||
1366 | .name = "mcbsp5_fck", | ||
1367 | .init = &omap2_init_clksel_parent, | ||
1368 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1369 | .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, | ||
1370 | .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1), | ||
1371 | .clksel_mask = OMAP2_MCBSP5_CLKS_MASK, | ||
1372 | .clksel = mcbsp_15_clksel, | ||
1373 | .flags = CLOCK_IN_OMAP343X, | ||
1374 | .recalc = &omap2_clksel_recalc, | ||
1375 | }; | ||
1376 | |||
1377 | static struct clk mcbsp1_fck = { | ||
1378 | .name = "mcbsp1_fck", | ||
1379 | .init = &omap2_init_clksel_parent, | ||
1380 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1381 | .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, | ||
1382 | .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), | ||
1383 | .clksel_mask = OMAP2_MCBSP1_CLKS_MASK, | ||
1384 | .clksel = mcbsp_15_clksel, | ||
1385 | .flags = CLOCK_IN_OMAP343X, | ||
1386 | .recalc = &omap2_clksel_recalc, | ||
1387 | }; | ||
1388 | |||
1389 | /* CORE_48M_FCK-derived clocks */ | ||
1390 | |||
1391 | static struct clk core_48m_fck = { | ||
1392 | .name = "core_48m_fck", | ||
1393 | .parent = &omap_48m_fck, | ||
1394 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1395 | PARENT_CONTROLS_CLOCK, | ||
1396 | .recalc = &followparent_recalc, | ||
1397 | }; | ||
1398 | |||
1399 | static struct clk mcspi4_fck = { | ||
1400 | .name = "mcspi_fck", | ||
1401 | .id = 4, | ||
1402 | .parent = &core_48m_fck, | ||
1403 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1404 | .enable_bit = OMAP3430_EN_MCSPI4_SHIFT, | ||
1405 | .flags = CLOCK_IN_OMAP343X, | ||
1406 | .recalc = &followparent_recalc, | ||
1407 | }; | ||
1408 | |||
1409 | static struct clk mcspi3_fck = { | ||
1410 | .name = "mcspi_fck", | ||
1411 | .id = 3, | ||
1412 | .parent = &core_48m_fck, | ||
1413 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1414 | .enable_bit = OMAP3430_EN_MCSPI3_SHIFT, | ||
1415 | .flags = CLOCK_IN_OMAP343X, | ||
1416 | .recalc = &followparent_recalc, | ||
1417 | }; | ||
1418 | |||
1419 | static struct clk mcspi2_fck = { | ||
1420 | .name = "mcspi_fck", | ||
1421 | .id = 2, | ||
1422 | .parent = &core_48m_fck, | ||
1423 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1424 | .enable_bit = OMAP3430_EN_MCSPI2_SHIFT, | ||
1425 | .flags = CLOCK_IN_OMAP343X, | ||
1426 | .recalc = &followparent_recalc, | ||
1427 | }; | ||
1428 | |||
1429 | static struct clk mcspi1_fck = { | ||
1430 | .name = "mcspi_fck", | ||
1431 | .id = 1, | ||
1432 | .parent = &core_48m_fck, | ||
1433 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1434 | .enable_bit = OMAP3430_EN_MCSPI1_SHIFT, | ||
1435 | .flags = CLOCK_IN_OMAP343X, | ||
1436 | .recalc = &followparent_recalc, | ||
1437 | }; | ||
1438 | |||
1439 | static struct clk uart2_fck = { | ||
1440 | .name = "uart2_fck", | ||
1441 | .parent = &core_48m_fck, | ||
1442 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1443 | .enable_bit = OMAP3430_EN_UART2_SHIFT, | ||
1444 | .flags = CLOCK_IN_OMAP343X, | ||
1445 | .recalc = &followparent_recalc, | ||
1446 | }; | ||
1447 | |||
1448 | static struct clk uart1_fck = { | ||
1449 | .name = "uart1_fck", | ||
1450 | .parent = &core_48m_fck, | ||
1451 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1452 | .enable_bit = OMAP3430_EN_UART1_SHIFT, | ||
1453 | .flags = CLOCK_IN_OMAP343X, | ||
1454 | .recalc = &followparent_recalc, | ||
1455 | }; | ||
1456 | |||
1457 | static struct clk fshostusb_fck = { | ||
1458 | .name = "fshostusb_fck", | ||
1459 | .parent = &core_48m_fck, | ||
1460 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1461 | .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT, | ||
1462 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1463 | .recalc = &followparent_recalc, | ||
1464 | }; | ||
1465 | |||
1466 | /* CORE_12M_FCK based clocks */ | ||
1467 | |||
1468 | static struct clk core_12m_fck = { | ||
1469 | .name = "core_12m_fck", | ||
1470 | .parent = &omap_12m_fck, | ||
1471 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1472 | PARENT_CONTROLS_CLOCK, | ||
1473 | .recalc = &followparent_recalc, | ||
1474 | }; | ||
1475 | |||
1476 | static struct clk hdq_fck = { | ||
1477 | .name = "hdq_fck", | ||
1478 | .parent = &core_12m_fck, | ||
1479 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1480 | .enable_bit = OMAP3430_EN_HDQ_SHIFT, | ||
1481 | .flags = CLOCK_IN_OMAP343X, | ||
1482 | .recalc = &followparent_recalc, | ||
1483 | }; | ||
1484 | |||
1485 | /* DPLL3-derived clock */ | ||
1486 | |||
1487 | static const struct clksel_rate ssi_ssr_corex2_rates[] = { | ||
1488 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
1489 | { .div = 2, .val = 2, .flags = RATE_IN_343X }, | ||
1490 | { .div = 3, .val = 3, .flags = RATE_IN_343X }, | ||
1491 | { .div = 4, .val = 4, .flags = RATE_IN_343X }, | ||
1492 | { .div = 6, .val = 6, .flags = RATE_IN_343X }, | ||
1493 | { .div = 8, .val = 8, .flags = RATE_IN_343X }, | ||
1494 | { .div = 0 } | ||
1495 | }; | ||
1496 | |||
1497 | static const struct clksel ssi_ssr_clksel[] = { | ||
1498 | { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates }, | ||
1499 | { .parent = NULL } | ||
1500 | }; | ||
1501 | |||
1502 | static struct clk ssi_ssr_fck = { | ||
1503 | .name = "ssi_ssr_fck", | ||
1504 | .init = &omap2_init_clksel_parent, | ||
1505 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1506 | .enable_bit = OMAP3430_EN_SSI_SHIFT, | ||
1507 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1508 | .clksel_mask = OMAP3430_CLKSEL_SSI_MASK, | ||
1509 | .clksel = ssi_ssr_clksel, | ||
1510 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, | ||
1511 | .recalc = &omap2_clksel_recalc, | ||
1512 | }; | ||
1513 | |||
1514 | static struct clk ssi_sst_fck = { | ||
1515 | .name = "ssi_sst_fck", | ||
1516 | .parent = &ssi_ssr_fck, | ||
1517 | .fixed_div = 2, | ||
1518 | .flags = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK, | ||
1519 | .recalc = &omap2_fixed_divisor_recalc, | ||
1520 | }; | ||
1521 | |||
1522 | |||
1523 | |||
1524 | /* CORE_L3_ICK based clocks */ | ||
1525 | |||
1526 | static struct clk core_l3_ick = { | ||
1527 | .name = "core_l3_ick", | ||
1528 | .parent = &l3_ick, | ||
1529 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1530 | PARENT_CONTROLS_CLOCK, | ||
1531 | .recalc = &followparent_recalc, | ||
1532 | }; | ||
1533 | |||
1534 | static struct clk hsotgusb_ick = { | ||
1535 | .name = "hsotgusb_ick", | ||
1536 | .parent = &core_l3_ick, | ||
1537 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1538 | .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, | ||
1539 | .flags = CLOCK_IN_OMAP343X, | ||
1540 | .recalc = &followparent_recalc, | ||
1541 | }; | ||
1542 | |||
1543 | static struct clk sdrc_ick = { | ||
1544 | .name = "sdrc_ick", | ||
1545 | .parent = &core_l3_ick, | ||
1546 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1547 | .enable_bit = OMAP3430_EN_SDRC_SHIFT, | ||
1548 | .flags = CLOCK_IN_OMAP343X | ENABLE_ON_INIT, | ||
1549 | .recalc = &followparent_recalc, | ||
1550 | }; | ||
1551 | |||
1552 | static struct clk gpmc_fck = { | ||
1553 | .name = "gpmc_fck", | ||
1554 | .parent = &core_l3_ick, | ||
1555 | .flags = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK | | ||
1556 | ENABLE_ON_INIT, | ||
1557 | .recalc = &followparent_recalc, | ||
1558 | }; | ||
1559 | |||
1560 | /* SECURITY_L3_ICK based clocks */ | ||
1561 | |||
1562 | static struct clk security_l3_ick = { | ||
1563 | .name = "security_l3_ick", | ||
1564 | .parent = &l3_ick, | ||
1565 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1566 | PARENT_CONTROLS_CLOCK, | ||
1567 | .recalc = &followparent_recalc, | ||
1568 | }; | ||
1569 | |||
1570 | static struct clk pka_ick = { | ||
1571 | .name = "pka_ick", | ||
1572 | .parent = &security_l3_ick, | ||
1573 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1574 | .enable_bit = OMAP3430_EN_PKA_SHIFT, | ||
1575 | .flags = CLOCK_IN_OMAP343X, | ||
1576 | .recalc = &followparent_recalc, | ||
1577 | }; | ||
1578 | |||
1579 | /* CORE_L4_ICK based clocks */ | ||
1580 | |||
1581 | static struct clk core_l4_ick = { | ||
1582 | .name = "core_l4_ick", | ||
1583 | .parent = &l4_ick, | ||
1584 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1585 | PARENT_CONTROLS_CLOCK, | ||
1586 | .recalc = &followparent_recalc, | ||
1587 | }; | ||
1588 | |||
1589 | static struct clk usbtll_ick = { | ||
1590 | .name = "usbtll_ick", | ||
1591 | .parent = &core_l4_ick, | ||
1592 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), | ||
1593 | .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, | ||
1594 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1595 | .recalc = &followparent_recalc, | ||
1596 | }; | ||
1597 | |||
1598 | static struct clk mmchs3_ick = { | ||
1599 | .name = "mmchs_ick", | ||
1600 | .id = 3, | ||
1601 | .parent = &core_l4_ick, | ||
1602 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1603 | .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, | ||
1604 | .flags = CLOCK_IN_OMAP3430ES2, | ||
1605 | .recalc = &followparent_recalc, | ||
1606 | }; | ||
1607 | |||
1608 | /* Intersystem Communication Registers - chassis mode only */ | ||
1609 | static struct clk icr_ick = { | ||
1610 | .name = "icr_ick", | ||
1611 | .parent = &core_l4_ick, | ||
1612 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1613 | .enable_bit = OMAP3430_EN_ICR_SHIFT, | ||
1614 | .flags = CLOCK_IN_OMAP343X, | ||
1615 | .recalc = &followparent_recalc, | ||
1616 | }; | ||
1617 | |||
1618 | static struct clk aes2_ick = { | ||
1619 | .name = "aes2_ick", | ||
1620 | .parent = &core_l4_ick, | ||
1621 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1622 | .enable_bit = OMAP3430_EN_AES2_SHIFT, | ||
1623 | .flags = CLOCK_IN_OMAP343X, | ||
1624 | .recalc = &followparent_recalc, | ||
1625 | }; | ||
1626 | |||
1627 | static struct clk sha12_ick = { | ||
1628 | .name = "sha12_ick", | ||
1629 | .parent = &core_l4_ick, | ||
1630 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1631 | .enable_bit = OMAP3430_EN_SHA12_SHIFT, | ||
1632 | .flags = CLOCK_IN_OMAP343X, | ||
1633 | .recalc = &followparent_recalc, | ||
1634 | }; | ||
1635 | |||
1636 | static struct clk des2_ick = { | ||
1637 | .name = "des2_ick", | ||
1638 | .parent = &core_l4_ick, | ||
1639 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1640 | .enable_bit = OMAP3430_EN_DES2_SHIFT, | ||
1641 | .flags = CLOCK_IN_OMAP343X, | ||
1642 | .recalc = &followparent_recalc, | ||
1643 | }; | ||
1644 | |||
1645 | static struct clk mmchs2_ick = { | ||
1646 | .name = "mmchs_ick", | ||
1647 | .id = 2, | ||
1648 | .parent = &core_l4_ick, | ||
1649 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1650 | .enable_bit = OMAP3430_EN_MMC2_SHIFT, | ||
1651 | .flags = CLOCK_IN_OMAP343X, | ||
1652 | .recalc = &followparent_recalc, | ||
1653 | }; | ||
1654 | |||
1655 | static struct clk mmchs1_ick = { | ||
1656 | .name = "mmchs_ick", | ||
1657 | .id = 1, | ||
1658 | .parent = &core_l4_ick, | ||
1659 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1660 | .enable_bit = OMAP3430_EN_MMC1_SHIFT, | ||
1661 | .flags = CLOCK_IN_OMAP343X, | ||
1662 | .recalc = &followparent_recalc, | ||
1663 | }; | ||
1664 | |||
1665 | static struct clk mspro_ick = { | ||
1666 | .name = "mspro_ick", | ||
1667 | .parent = &core_l4_ick, | ||
1668 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1669 | .enable_bit = OMAP3430_EN_MSPRO_SHIFT, | ||
1670 | .flags = CLOCK_IN_OMAP343X, | ||
1671 | .recalc = &followparent_recalc, | ||
1672 | }; | ||
1673 | |||
1674 | static struct clk hdq_ick = { | ||
1675 | .name = "hdq_ick", | ||
1676 | .parent = &core_l4_ick, | ||
1677 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1678 | .enable_bit = OMAP3430_EN_HDQ_SHIFT, | ||
1679 | .flags = CLOCK_IN_OMAP343X, | ||
1680 | .recalc = &followparent_recalc, | ||
1681 | }; | ||
1682 | |||
1683 | static struct clk mcspi4_ick = { | ||
1684 | .name = "mcspi_ick", | ||
1685 | .id = 4, | ||
1686 | .parent = &core_l4_ick, | ||
1687 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1688 | .enable_bit = OMAP3430_EN_MCSPI4_SHIFT, | ||
1689 | .flags = CLOCK_IN_OMAP343X, | ||
1690 | .recalc = &followparent_recalc, | ||
1691 | }; | ||
1692 | |||
1693 | static struct clk mcspi3_ick = { | ||
1694 | .name = "mcspi_ick", | ||
1695 | .id = 3, | ||
1696 | .parent = &core_l4_ick, | ||
1697 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1698 | .enable_bit = OMAP3430_EN_MCSPI3_SHIFT, | ||
1699 | .flags = CLOCK_IN_OMAP343X, | ||
1700 | .recalc = &followparent_recalc, | ||
1701 | }; | ||
1702 | |||
1703 | static struct clk mcspi2_ick = { | ||
1704 | .name = "mcspi_ick", | ||
1705 | .id = 2, | ||
1706 | .parent = &core_l4_ick, | ||
1707 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1708 | .enable_bit = OMAP3430_EN_MCSPI2_SHIFT, | ||
1709 | .flags = CLOCK_IN_OMAP343X, | ||
1710 | .recalc = &followparent_recalc, | ||
1711 | }; | ||
1712 | |||
1713 | static struct clk mcspi1_ick = { | ||
1714 | .name = "mcspi_ick", | ||
1715 | .id = 1, | ||
1716 | .parent = &core_l4_ick, | ||
1717 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1718 | .enable_bit = OMAP3430_EN_MCSPI1_SHIFT, | ||
1719 | .flags = CLOCK_IN_OMAP343X, | ||
1720 | .recalc = &followparent_recalc, | ||
1721 | }; | ||
1722 | |||
1723 | static struct clk i2c3_ick = { | ||
1724 | .name = "i2c_ick", | ||
1725 | .id = 3, | ||
1726 | .parent = &core_l4_ick, | ||
1727 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1728 | .enable_bit = OMAP3430_EN_I2C3_SHIFT, | ||
1729 | .flags = CLOCK_IN_OMAP343X, | ||
1730 | .recalc = &followparent_recalc, | ||
1731 | }; | ||
1732 | |||
1733 | static struct clk i2c2_ick = { | ||
1734 | .name = "i2c_ick", | ||
1735 | .id = 2, | ||
1736 | .parent = &core_l4_ick, | ||
1737 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1738 | .enable_bit = OMAP3430_EN_I2C2_SHIFT, | ||
1739 | .flags = CLOCK_IN_OMAP343X, | ||
1740 | .recalc = &followparent_recalc, | ||
1741 | }; | ||
1742 | |||
1743 | static struct clk i2c1_ick = { | ||
1744 | .name = "i2c_ick", | ||
1745 | .id = 1, | ||
1746 | .parent = &core_l4_ick, | ||
1747 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1748 | .enable_bit = OMAP3430_EN_I2C1_SHIFT, | ||
1749 | .flags = CLOCK_IN_OMAP343X, | ||
1750 | .recalc = &followparent_recalc, | ||
1751 | }; | ||
1752 | |||
1753 | static struct clk uart2_ick = { | ||
1754 | .name = "uart2_ick", | ||
1755 | .parent = &core_l4_ick, | ||
1756 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1757 | .enable_bit = OMAP3430_EN_UART2_SHIFT, | ||
1758 | .flags = CLOCK_IN_OMAP343X, | ||
1759 | .recalc = &followparent_recalc, | ||
1760 | }; | ||
1761 | |||
1762 | static struct clk uart1_ick = { | ||
1763 | .name = "uart1_ick", | ||
1764 | .parent = &core_l4_ick, | ||
1765 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1766 | .enable_bit = OMAP3430_EN_UART1_SHIFT, | ||
1767 | .flags = CLOCK_IN_OMAP343X, | ||
1768 | .recalc = &followparent_recalc, | ||
1769 | }; | ||
1770 | |||
1771 | static struct clk gpt11_ick = { | ||
1772 | .name = "gpt11_ick", | ||
1773 | .parent = &core_l4_ick, | ||
1774 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1775 | .enable_bit = OMAP3430_EN_GPT11_SHIFT, | ||
1776 | .flags = CLOCK_IN_OMAP343X, | ||
1777 | .recalc = &followparent_recalc, | ||
1778 | }; | ||
1779 | |||
1780 | static struct clk gpt10_ick = { | ||
1781 | .name = "gpt10_ick", | ||
1782 | .parent = &core_l4_ick, | ||
1783 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1784 | .enable_bit = OMAP3430_EN_GPT10_SHIFT, | ||
1785 | .flags = CLOCK_IN_OMAP343X, | ||
1786 | .recalc = &followparent_recalc, | ||
1787 | }; | ||
1788 | |||
1789 | static struct clk mcbsp5_ick = { | ||
1790 | .name = "mcbsp5_ick", | ||
1791 | .parent = &core_l4_ick, | ||
1792 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1793 | .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, | ||
1794 | .flags = CLOCK_IN_OMAP343X, | ||
1795 | .recalc = &followparent_recalc, | ||
1796 | }; | ||
1797 | |||
1798 | static struct clk mcbsp1_ick = { | ||
1799 | .name = "mcbsp1_ick", | ||
1800 | .parent = &core_l4_ick, | ||
1801 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1802 | .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, | ||
1803 | .flags = CLOCK_IN_OMAP343X, | ||
1804 | .recalc = &followparent_recalc, | ||
1805 | }; | ||
1806 | |||
1807 | static struct clk fac_ick = { | ||
1808 | .name = "fac_ick", | ||
1809 | .parent = &core_l4_ick, | ||
1810 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1811 | .enable_bit = OMAP3430ES1_EN_FAC_SHIFT, | ||
1812 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1813 | .recalc = &followparent_recalc, | ||
1814 | }; | ||
1815 | |||
1816 | static struct clk mailboxes_ick = { | ||
1817 | .name = "mailboxes_ick", | ||
1818 | .parent = &core_l4_ick, | ||
1819 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1820 | .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT, | ||
1821 | .flags = CLOCK_IN_OMAP343X, | ||
1822 | .recalc = &followparent_recalc, | ||
1823 | }; | ||
1824 | |||
1825 | static struct clk omapctrl_ick = { | ||
1826 | .name = "omapctrl_ick", | ||
1827 | .parent = &core_l4_ick, | ||
1828 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1829 | .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT, | ||
1830 | .flags = CLOCK_IN_OMAP343X | ENABLE_ON_INIT, | ||
1831 | .recalc = &followparent_recalc, | ||
1832 | }; | ||
1833 | |||
1834 | /* SSI_L4_ICK based clocks */ | ||
1835 | |||
1836 | static struct clk ssi_l4_ick = { | ||
1837 | .name = "ssi_l4_ick", | ||
1838 | .parent = &l4_ick, | ||
1839 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, | ||
1840 | .recalc = &followparent_recalc, | ||
1841 | }; | ||
1842 | |||
1843 | static struct clk ssi_ick = { | ||
1844 | .name = "ssi_ick", | ||
1845 | .parent = &ssi_l4_ick, | ||
1846 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1847 | .enable_bit = OMAP3430_EN_SSI_SHIFT, | ||
1848 | .flags = CLOCK_IN_OMAP343X, | ||
1849 | .recalc = &followparent_recalc, | ||
1850 | }; | ||
1851 | |||
1852 | /* REVISIT: Technically the TRM claims that this is CORE_CLK based, | ||
1853 | * but l4_ick makes more sense to me */ | ||
1854 | |||
1855 | static const struct clksel usb_l4_clksel[] = { | ||
1856 | { .parent = &l4_ick, .rates = div2_rates }, | ||
1857 | { .parent = NULL }, | ||
1858 | }; | ||
1859 | |||
1860 | static struct clk usb_l4_ick = { | ||
1861 | .name = "usb_l4_ick", | ||
1862 | .parent = &l4_ick, | ||
1863 | .init = &omap2_init_clksel_parent, | ||
1864 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1865 | .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT, | ||
1866 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1867 | .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK, | ||
1868 | .clksel = usb_l4_clksel, | ||
1869 | .flags = CLOCK_IN_OMAP3430ES1, | ||
1870 | .recalc = &omap2_clksel_recalc, | ||
1871 | }; | ||
1872 | |||
1873 | /* XXX MDM_INTC_ICK, SAD2D_ICK ?? */ | ||
1874 | |||
1875 | /* SECURITY_L4_ICK2 based clocks */ | ||
1876 | |||
1877 | static struct clk security_l4_ick2 = { | ||
1878 | .name = "security_l4_ick2", | ||
1879 | .parent = &l4_ick, | ||
1880 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
1881 | PARENT_CONTROLS_CLOCK, | ||
1882 | .recalc = &followparent_recalc, | ||
1883 | }; | ||
1884 | |||
1885 | static struct clk aes1_ick = { | ||
1886 | .name = "aes1_ick", | ||
1887 | .parent = &security_l4_ick2, | ||
1888 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1889 | .enable_bit = OMAP3430_EN_AES1_SHIFT, | ||
1890 | .flags = CLOCK_IN_OMAP343X, | ||
1891 | .recalc = &followparent_recalc, | ||
1892 | }; | ||
1893 | |||
1894 | static struct clk rng_ick = { | ||
1895 | .name = "rng_ick", | ||
1896 | .parent = &security_l4_ick2, | ||
1897 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1898 | .enable_bit = OMAP3430_EN_RNG_SHIFT, | ||
1899 | .flags = CLOCK_IN_OMAP343X, | ||
1900 | .recalc = &followparent_recalc, | ||
1901 | }; | ||
1902 | |||
1903 | static struct clk sha11_ick = { | ||
1904 | .name = "sha11_ick", | ||
1905 | .parent = &security_l4_ick2, | ||
1906 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1907 | .enable_bit = OMAP3430_EN_SHA11_SHIFT, | ||
1908 | .flags = CLOCK_IN_OMAP343X, | ||
1909 | .recalc = &followparent_recalc, | ||
1910 | }; | ||
1911 | |||
1912 | static struct clk des1_ick = { | ||
1913 | .name = "des1_ick", | ||
1914 | .parent = &security_l4_ick2, | ||
1915 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), | ||
1916 | .enable_bit = OMAP3430_EN_DES1_SHIFT, | ||
1917 | .flags = CLOCK_IN_OMAP343X, | ||
1918 | .recalc = &followparent_recalc, | ||
1919 | }; | ||
1920 | |||
1921 | /* DSS */ | ||
1922 | static const struct clksel dss1_alwon_fck_clksel[] = { | ||
1923 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
1924 | { .parent = &dpll4_m4x2_ck, .rates = dpll_locked_rates }, | ||
1925 | { .parent = NULL } | ||
1926 | }; | ||
1927 | |||
1928 | static struct clk dss1_alwon_fck = { | ||
1929 | .name = "dss1_alwon_fck", | ||
1930 | .parent = &dpll4_m4x2_ck, | ||
1931 | .init = &omap2_init_clksel_parent, | ||
1932 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), | ||
1933 | .enable_bit = OMAP3430_EN_DSS1_SHIFT, | ||
1934 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
1935 | .clksel_mask = OMAP3430_ST_PERIPH_CLK, | ||
1936 | .clksel = dss1_alwon_fck_clksel, | ||
1937 | .flags = CLOCK_IN_OMAP343X, | ||
1938 | .recalc = &omap2_clksel_recalc, | ||
1939 | }; | ||
1940 | |||
1941 | static struct clk dss_tv_fck = { | ||
1942 | .name = "dss_tv_fck", | ||
1943 | .parent = &omap_54m_fck, | ||
1944 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), | ||
1945 | .enable_bit = OMAP3430_EN_TV_SHIFT, | ||
1946 | .flags = CLOCK_IN_OMAP343X, | ||
1947 | .recalc = &followparent_recalc, | ||
1948 | }; | ||
1949 | |||
1950 | static struct clk dss_96m_fck = { | ||
1951 | .name = "dss_96m_fck", | ||
1952 | .parent = &omap_96m_fck, | ||
1953 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), | ||
1954 | .enable_bit = OMAP3430_EN_TV_SHIFT, | ||
1955 | .flags = CLOCK_IN_OMAP343X, | ||
1956 | .recalc = &followparent_recalc, | ||
1957 | }; | ||
1958 | |||
1959 | static struct clk dss2_alwon_fck = { | ||
1960 | .name = "dss2_alwon_fck", | ||
1961 | .parent = &sys_ck, | ||
1962 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), | ||
1963 | .enable_bit = OMAP3430_EN_DSS2_SHIFT, | ||
1964 | .flags = CLOCK_IN_OMAP343X, | ||
1965 | .recalc = &followparent_recalc, | ||
1966 | }; | ||
1967 | |||
1968 | static struct clk dss_ick = { | ||
1969 | /* Handles both L3 and L4 clocks */ | ||
1970 | .name = "dss_ick", | ||
1971 | .parent = &l4_ick, | ||
1972 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), | ||
1973 | .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT, | ||
1974 | .flags = CLOCK_IN_OMAP343X, | ||
1975 | .recalc = &followparent_recalc, | ||
1976 | }; | ||
1977 | |||
1978 | /* CAM */ | ||
1979 | |||
1980 | static const struct clksel cam_mclk_clksel[] = { | ||
1981 | { .parent = &sys_ck, .rates = dpll_bypass_rates }, | ||
1982 | { .parent = &dpll4_m5x2_ck, .rates = dpll_locked_rates }, | ||
1983 | { .parent = NULL } | ||
1984 | }; | ||
1985 | |||
1986 | static struct clk cam_mclk = { | ||
1987 | .name = "cam_mclk", | ||
1988 | .parent = &dpll4_m5x2_ck, | ||
1989 | .init = &omap2_init_clksel_parent, | ||
1990 | .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), | ||
1991 | .clksel_mask = OMAP3430_ST_PERIPH_CLK, | ||
1992 | .clksel = cam_mclk_clksel, | ||
1993 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), | ||
1994 | .enable_bit = OMAP3430_EN_CAM_SHIFT, | ||
1995 | .flags = CLOCK_IN_OMAP343X, | ||
1996 | .recalc = &omap2_clksel_recalc, | ||
1997 | }; | ||
1998 | |||
1999 | static struct clk cam_l3_ick = { | ||
2000 | .name = "cam_l3_ick", | ||
2001 | .parent = &l3_ick, | ||
2002 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), | ||
2003 | .enable_bit = OMAP3430_EN_CAM_SHIFT, | ||
2004 | .flags = CLOCK_IN_OMAP343X, | ||
2005 | .recalc = &followparent_recalc, | ||
2006 | }; | ||
2007 | |||
2008 | static struct clk cam_l4_ick = { | ||
2009 | .name = "cam_l4_ick", | ||
2010 | .parent = &l4_ick, | ||
2011 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), | ||
2012 | .enable_bit = OMAP3430_EN_CAM_SHIFT, | ||
2013 | .flags = CLOCK_IN_OMAP343X, | ||
2014 | .recalc = &followparent_recalc, | ||
2015 | }; | ||
2016 | |||
2017 | /* USBHOST - 3430ES2 only */ | ||
2018 | |||
2019 | static struct clk usbhost_120m_fck = { | ||
2020 | .name = "usbhost_120m_fck", | ||
2021 | .parent = &omap_120m_fck, | ||
2022 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), | ||
2023 | .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT, | ||
2024 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2025 | .recalc = &followparent_recalc, | ||
2026 | }; | ||
2027 | |||
2028 | static struct clk usbhost_48m_fck = { | ||
2029 | .name = "usbhost_48m_fck", | ||
2030 | .parent = &omap_48m_fck, | ||
2031 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), | ||
2032 | .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT, | ||
2033 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2034 | .recalc = &followparent_recalc, | ||
2035 | }; | ||
2036 | |||
2037 | static struct clk usbhost_l3_ick = { | ||
2038 | .name = "usbhost_l3_ick", | ||
2039 | .parent = &l3_ick, | ||
2040 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN), | ||
2041 | .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT, | ||
2042 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2043 | .recalc = &followparent_recalc, | ||
2044 | }; | ||
2045 | |||
2046 | static struct clk usbhost_l4_ick = { | ||
2047 | .name = "usbhost_l4_ick", | ||
2048 | .parent = &l4_ick, | ||
2049 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN), | ||
2050 | .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT, | ||
2051 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2052 | .recalc = &followparent_recalc, | ||
2053 | }; | ||
2054 | |||
2055 | static struct clk usbhost_sar_fck = { | ||
2056 | .name = "usbhost_sar_fck", | ||
2057 | .parent = &osc_sys_ck, | ||
2058 | .enable_reg = OMAP_PRM_REGADDR(OMAP3430ES2_USBHOST_MOD, PM_PWSTCTRL), | ||
2059 | .enable_bit = OMAP3430ES2_SAVEANDRESTORE_SHIFT, | ||
2060 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2061 | .recalc = &followparent_recalc, | ||
2062 | }; | ||
2063 | |||
2064 | /* WKUP */ | ||
2065 | |||
2066 | static const struct clksel_rate usim_96m_rates[] = { | ||
2067 | { .div = 2, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2068 | { .div = 4, .val = 4, .flags = RATE_IN_343X }, | ||
2069 | { .div = 8, .val = 5, .flags = RATE_IN_343X }, | ||
2070 | { .div = 10, .val = 6, .flags = RATE_IN_343X }, | ||
2071 | { .div = 0 }, | ||
2072 | }; | ||
2073 | |||
2074 | static const struct clksel_rate usim_120m_rates[] = { | ||
2075 | { .div = 4, .val = 7, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2076 | { .div = 8, .val = 8, .flags = RATE_IN_343X }, | ||
2077 | { .div = 16, .val = 9, .flags = RATE_IN_343X }, | ||
2078 | { .div = 20, .val = 10, .flags = RATE_IN_343X }, | ||
2079 | { .div = 0 }, | ||
2080 | }; | ||
2081 | |||
2082 | static const struct clksel usim_clksel[] = { | ||
2083 | { .parent = &omap_96m_fck, .rates = usim_96m_rates }, | ||
2084 | { .parent = &omap_120m_fck, .rates = usim_120m_rates }, | ||
2085 | { .parent = &sys_ck, .rates = div2_rates }, | ||
2086 | { .parent = NULL }, | ||
2087 | }; | ||
2088 | |||
2089 | /* 3430ES2 only */ | ||
2090 | static struct clk usim_fck = { | ||
2091 | .name = "usim_fck", | ||
2092 | .init = &omap2_init_clksel_parent, | ||
2093 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
2094 | .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT, | ||
2095 | .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL), | ||
2096 | .clksel_mask = OMAP3430ES2_CLKSEL_USIMOCP_MASK, | ||
2097 | .clksel = usim_clksel, | ||
2098 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2099 | .recalc = &omap2_clksel_recalc, | ||
2100 | }; | ||
2101 | |||
2102 | static struct clk gpt1_fck = { | ||
2103 | .name = "gpt1_fck", | ||
2104 | .init = &omap2_init_clksel_parent, | ||
2105 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
2106 | .enable_bit = OMAP3430_EN_GPT1_SHIFT, | ||
2107 | .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL), | ||
2108 | .clksel_mask = OMAP3430_CLKSEL_GPT1_MASK, | ||
2109 | .clksel = omap343x_gpt_clksel, | ||
2110 | .flags = CLOCK_IN_OMAP343X, | ||
2111 | .recalc = &omap2_clksel_recalc, | ||
2112 | }; | ||
2113 | |||
2114 | static struct clk wkup_32k_fck = { | ||
2115 | .name = "wkup_32k_fck", | ||
2116 | .parent = &omap_32k_fck, | ||
2117 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2118 | .recalc = &followparent_recalc, | ||
2119 | }; | ||
2120 | |||
2121 | static struct clk gpio1_fck = { | ||
2122 | .name = "gpio1_fck", | ||
2123 | .parent = &wkup_32k_fck, | ||
2124 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
2125 | .enable_bit = OMAP3430_EN_GPIO1_SHIFT, | ||
2126 | .flags = CLOCK_IN_OMAP343X, | ||
2127 | .recalc = &followparent_recalc, | ||
2128 | }; | ||
2129 | |||
2130 | static struct clk wdt2_fck = { | ||
2131 | .name = "wdt2_fck", | ||
2132 | .parent = &wkup_32k_fck, | ||
2133 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
2134 | .enable_bit = OMAP3430_EN_WDT2_SHIFT, | ||
2135 | .flags = CLOCK_IN_OMAP343X, | ||
2136 | .recalc = &followparent_recalc, | ||
2137 | }; | ||
2138 | |||
2139 | static struct clk wkup_l4_ick = { | ||
2140 | .name = "wkup_l4_ick", | ||
2141 | .parent = &sys_ck, | ||
2142 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2143 | .recalc = &followparent_recalc, | ||
2144 | }; | ||
2145 | |||
2146 | /* 3430ES2 only */ | ||
2147 | /* Never specifically named in the TRM, so we have to infer a likely name */ | ||
2148 | static struct clk usim_ick = { | ||
2149 | .name = "usim_ick", | ||
2150 | .parent = &wkup_l4_ick, | ||
2151 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2152 | .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT, | ||
2153 | .flags = CLOCK_IN_OMAP3430ES2, | ||
2154 | .recalc = &followparent_recalc, | ||
2155 | }; | ||
2156 | |||
2157 | static struct clk wdt2_ick = { | ||
2158 | .name = "wdt2_ick", | ||
2159 | .parent = &wkup_l4_ick, | ||
2160 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2161 | .enable_bit = OMAP3430_EN_WDT2_SHIFT, | ||
2162 | .flags = CLOCK_IN_OMAP343X, | ||
2163 | .recalc = &followparent_recalc, | ||
2164 | }; | ||
2165 | |||
2166 | static struct clk wdt1_ick = { | ||
2167 | .name = "wdt1_ick", | ||
2168 | .parent = &wkup_l4_ick, | ||
2169 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2170 | .enable_bit = OMAP3430_EN_WDT1_SHIFT, | ||
2171 | .flags = CLOCK_IN_OMAP343X, | ||
2172 | .recalc = &followparent_recalc, | ||
2173 | }; | ||
2174 | |||
2175 | static struct clk gpio1_ick = { | ||
2176 | .name = "gpio1_ick", | ||
2177 | .parent = &wkup_l4_ick, | ||
2178 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2179 | .enable_bit = OMAP3430_EN_GPIO1_SHIFT, | ||
2180 | .flags = CLOCK_IN_OMAP343X, | ||
2181 | .recalc = &followparent_recalc, | ||
2182 | }; | ||
2183 | |||
2184 | static struct clk omap_32ksync_ick = { | ||
2185 | .name = "omap_32ksync_ick", | ||
2186 | .parent = &wkup_l4_ick, | ||
2187 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2188 | .enable_bit = OMAP3430_EN_32KSYNC_SHIFT, | ||
2189 | .flags = CLOCK_IN_OMAP343X, | ||
2190 | .recalc = &followparent_recalc, | ||
2191 | }; | ||
2192 | |||
2193 | static struct clk gpt12_ick = { | ||
2194 | .name = "gpt12_ick", | ||
2195 | .parent = &wkup_l4_ick, | ||
2196 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2197 | .enable_bit = OMAP3430_EN_GPT12_SHIFT, | ||
2198 | .flags = CLOCK_IN_OMAP343X, | ||
2199 | .recalc = &followparent_recalc, | ||
2200 | }; | ||
2201 | |||
2202 | static struct clk gpt1_ick = { | ||
2203 | .name = "gpt1_ick", | ||
2204 | .parent = &wkup_l4_ick, | ||
2205 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), | ||
2206 | .enable_bit = OMAP3430_EN_GPT1_SHIFT, | ||
2207 | .flags = CLOCK_IN_OMAP343X, | ||
2208 | .recalc = &followparent_recalc, | ||
2209 | }; | ||
2210 | |||
2211 | |||
2212 | |||
2213 | /* PER clock domain */ | ||
2214 | |||
2215 | static struct clk per_96m_fck = { | ||
2216 | .name = "per_96m_fck", | ||
2217 | .parent = &omap_96m_alwon_fck, | ||
2218 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
2219 | PARENT_CONTROLS_CLOCK, | ||
2220 | .recalc = &followparent_recalc, | ||
2221 | }; | ||
2222 | |||
2223 | static struct clk per_48m_fck = { | ||
2224 | .name = "per_48m_fck", | ||
2225 | .parent = &omap_48m_fck, | ||
2226 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
2227 | PARENT_CONTROLS_CLOCK, | ||
2228 | .recalc = &followparent_recalc, | ||
2229 | }; | ||
2230 | |||
2231 | static struct clk uart3_fck = { | ||
2232 | .name = "uart3_fck", | ||
2233 | .parent = &per_48m_fck, | ||
2234 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2235 | .enable_bit = OMAP3430_EN_UART3_SHIFT, | ||
2236 | .flags = CLOCK_IN_OMAP343X, | ||
2237 | .recalc = &followparent_recalc, | ||
2238 | }; | ||
2239 | |||
2240 | static struct clk gpt2_fck = { | ||
2241 | .name = "gpt2_fck", | ||
2242 | .init = &omap2_init_clksel_parent, | ||
2243 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2244 | .enable_bit = OMAP3430_EN_GPT2_SHIFT, | ||
2245 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2246 | .clksel_mask = OMAP3430_CLKSEL_GPT2_MASK, | ||
2247 | .clksel = omap343x_gpt_clksel, | ||
2248 | .flags = CLOCK_IN_OMAP343X, | ||
2249 | .recalc = &omap2_clksel_recalc, | ||
2250 | }; | ||
2251 | |||
2252 | static struct clk gpt3_fck = { | ||
2253 | .name = "gpt3_fck", | ||
2254 | .init = &omap2_init_clksel_parent, | ||
2255 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2256 | .enable_bit = OMAP3430_EN_GPT3_SHIFT, | ||
2257 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2258 | .clksel_mask = OMAP3430_CLKSEL_GPT3_MASK, | ||
2259 | .clksel = omap343x_gpt_clksel, | ||
2260 | .flags = CLOCK_IN_OMAP343X, | ||
2261 | .recalc = &omap2_clksel_recalc, | ||
2262 | }; | ||
2263 | |||
2264 | static struct clk gpt4_fck = { | ||
2265 | .name = "gpt4_fck", | ||
2266 | .init = &omap2_init_clksel_parent, | ||
2267 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2268 | .enable_bit = OMAP3430_EN_GPT4_SHIFT, | ||
2269 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2270 | .clksel_mask = OMAP3430_CLKSEL_GPT4_MASK, | ||
2271 | .clksel = omap343x_gpt_clksel, | ||
2272 | .flags = CLOCK_IN_OMAP343X, | ||
2273 | .recalc = &omap2_clksel_recalc, | ||
2274 | }; | ||
2275 | |||
2276 | static struct clk gpt5_fck = { | ||
2277 | .name = "gpt5_fck", | ||
2278 | .init = &omap2_init_clksel_parent, | ||
2279 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2280 | .enable_bit = OMAP3430_EN_GPT5_SHIFT, | ||
2281 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2282 | .clksel_mask = OMAP3430_CLKSEL_GPT5_MASK, | ||
2283 | .clksel = omap343x_gpt_clksel, | ||
2284 | .flags = CLOCK_IN_OMAP343X, | ||
2285 | .recalc = &omap2_clksel_recalc, | ||
2286 | }; | ||
2287 | |||
2288 | static struct clk gpt6_fck = { | ||
2289 | .name = "gpt6_fck", | ||
2290 | .init = &omap2_init_clksel_parent, | ||
2291 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2292 | .enable_bit = OMAP3430_EN_GPT6_SHIFT, | ||
2293 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2294 | .clksel_mask = OMAP3430_CLKSEL_GPT6_MASK, | ||
2295 | .clksel = omap343x_gpt_clksel, | ||
2296 | .flags = CLOCK_IN_OMAP343X, | ||
2297 | .recalc = &omap2_clksel_recalc, | ||
2298 | }; | ||
2299 | |||
2300 | static struct clk gpt7_fck = { | ||
2301 | .name = "gpt7_fck", | ||
2302 | .init = &omap2_init_clksel_parent, | ||
2303 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2304 | .enable_bit = OMAP3430_EN_GPT7_SHIFT, | ||
2305 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2306 | .clksel_mask = OMAP3430_CLKSEL_GPT7_MASK, | ||
2307 | .clksel = omap343x_gpt_clksel, | ||
2308 | .flags = CLOCK_IN_OMAP343X, | ||
2309 | .recalc = &omap2_clksel_recalc, | ||
2310 | }; | ||
2311 | |||
2312 | static struct clk gpt8_fck = { | ||
2313 | .name = "gpt8_fck", | ||
2314 | .init = &omap2_init_clksel_parent, | ||
2315 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2316 | .enable_bit = OMAP3430_EN_GPT8_SHIFT, | ||
2317 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2318 | .clksel_mask = OMAP3430_CLKSEL_GPT8_MASK, | ||
2319 | .clksel = omap343x_gpt_clksel, | ||
2320 | .flags = CLOCK_IN_OMAP343X, | ||
2321 | .recalc = &omap2_clksel_recalc, | ||
2322 | }; | ||
2323 | |||
2324 | static struct clk gpt9_fck = { | ||
2325 | .name = "gpt9_fck", | ||
2326 | .init = &omap2_init_clksel_parent, | ||
2327 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2328 | .enable_bit = OMAP3430_EN_GPT9_SHIFT, | ||
2329 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), | ||
2330 | .clksel_mask = OMAP3430_CLKSEL_GPT9_MASK, | ||
2331 | .clksel = omap343x_gpt_clksel, | ||
2332 | .flags = CLOCK_IN_OMAP343X, | ||
2333 | .recalc = &omap2_clksel_recalc, | ||
2334 | }; | ||
2335 | |||
2336 | static struct clk per_32k_alwon_fck = { | ||
2337 | .name = "per_32k_alwon_fck", | ||
2338 | .parent = &omap_32k_fck, | ||
2339 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2340 | .recalc = &followparent_recalc, | ||
2341 | }; | ||
2342 | |||
2343 | static struct clk gpio6_fck = { | ||
2344 | .name = "gpio6_fck", | ||
2345 | .parent = &per_32k_alwon_fck, | ||
2346 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2347 | .enable_bit = OMAP3430_EN_GPT6_SHIFT, | ||
2348 | .flags = CLOCK_IN_OMAP343X, | ||
2349 | .recalc = &followparent_recalc, | ||
2350 | }; | ||
2351 | |||
2352 | static struct clk gpio5_fck = { | ||
2353 | .name = "gpio5_fck", | ||
2354 | .parent = &per_32k_alwon_fck, | ||
2355 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2356 | .enable_bit = OMAP3430_EN_GPT5_SHIFT, | ||
2357 | .flags = CLOCK_IN_OMAP343X, | ||
2358 | .recalc = &followparent_recalc, | ||
2359 | }; | ||
2360 | |||
2361 | static struct clk gpio4_fck = { | ||
2362 | .name = "gpio4_fck", | ||
2363 | .parent = &per_32k_alwon_fck, | ||
2364 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2365 | .enable_bit = OMAP3430_EN_GPT4_SHIFT, | ||
2366 | .flags = CLOCK_IN_OMAP343X, | ||
2367 | .recalc = &followparent_recalc, | ||
2368 | }; | ||
2369 | |||
2370 | static struct clk gpio3_fck = { | ||
2371 | .name = "gpio3_fck", | ||
2372 | .parent = &per_32k_alwon_fck, | ||
2373 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2374 | .enable_bit = OMAP3430_EN_GPT3_SHIFT, | ||
2375 | .flags = CLOCK_IN_OMAP343X, | ||
2376 | .recalc = &followparent_recalc, | ||
2377 | }; | ||
2378 | |||
2379 | static struct clk gpio2_fck = { | ||
2380 | .name = "gpio2_fck", | ||
2381 | .parent = &per_32k_alwon_fck, | ||
2382 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2383 | .enable_bit = OMAP3430_EN_GPT2_SHIFT, | ||
2384 | .flags = CLOCK_IN_OMAP343X, | ||
2385 | .recalc = &followparent_recalc, | ||
2386 | }; | ||
2387 | |||
2388 | static struct clk wdt3_fck = { | ||
2389 | .name = "wdt3_fck", | ||
2390 | .parent = &per_32k_alwon_fck, | ||
2391 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2392 | .enable_bit = OMAP3430_EN_WDT3_SHIFT, | ||
2393 | .flags = CLOCK_IN_OMAP343X, | ||
2394 | .recalc = &followparent_recalc, | ||
2395 | }; | ||
2396 | |||
2397 | static struct clk per_l4_ick = { | ||
2398 | .name = "per_l4_ick", | ||
2399 | .parent = &l4_ick, | ||
2400 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | | ||
2401 | PARENT_CONTROLS_CLOCK, | ||
2402 | .recalc = &followparent_recalc, | ||
2403 | }; | ||
2404 | |||
2405 | static struct clk gpio6_ick = { | ||
2406 | .name = "gpio6_ick", | ||
2407 | .parent = &per_l4_ick, | ||
2408 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2409 | .enable_bit = OMAP3430_EN_GPIO6_SHIFT, | ||
2410 | .flags = CLOCK_IN_OMAP343X, | ||
2411 | .recalc = &followparent_recalc, | ||
2412 | }; | ||
2413 | |||
2414 | static struct clk gpio5_ick = { | ||
2415 | .name = "gpio5_ick", | ||
2416 | .parent = &per_l4_ick, | ||
2417 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2418 | .enable_bit = OMAP3430_EN_GPIO5_SHIFT, | ||
2419 | .flags = CLOCK_IN_OMAP343X, | ||
2420 | .recalc = &followparent_recalc, | ||
2421 | }; | ||
2422 | |||
2423 | static struct clk gpio4_ick = { | ||
2424 | .name = "gpio4_ick", | ||
2425 | .parent = &per_l4_ick, | ||
2426 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2427 | .enable_bit = OMAP3430_EN_GPIO4_SHIFT, | ||
2428 | .flags = CLOCK_IN_OMAP343X, | ||
2429 | .recalc = &followparent_recalc, | ||
2430 | }; | ||
2431 | |||
2432 | static struct clk gpio3_ick = { | ||
2433 | .name = "gpio3_ick", | ||
2434 | .parent = &per_l4_ick, | ||
2435 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2436 | .enable_bit = OMAP3430_EN_GPIO3_SHIFT, | ||
2437 | .flags = CLOCK_IN_OMAP343X, | ||
2438 | .recalc = &followparent_recalc, | ||
2439 | }; | ||
2440 | |||
2441 | static struct clk gpio2_ick = { | ||
2442 | .name = "gpio2_ick", | ||
2443 | .parent = &per_l4_ick, | ||
2444 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2445 | .enable_bit = OMAP3430_EN_GPIO2_SHIFT, | ||
2446 | .flags = CLOCK_IN_OMAP343X, | ||
2447 | .recalc = &followparent_recalc, | ||
2448 | }; | ||
2449 | |||
2450 | static struct clk wdt3_ick = { | ||
2451 | .name = "wdt3_ick", | ||
2452 | .parent = &per_l4_ick, | ||
2453 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2454 | .enable_bit = OMAP3430_EN_WDT3_SHIFT, | ||
2455 | .flags = CLOCK_IN_OMAP343X, | ||
2456 | .recalc = &followparent_recalc, | ||
2457 | }; | ||
2458 | |||
2459 | static struct clk uart3_ick = { | ||
2460 | .name = "uart3_ick", | ||
2461 | .parent = &per_l4_ick, | ||
2462 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2463 | .enable_bit = OMAP3430_EN_UART3_SHIFT, | ||
2464 | .flags = CLOCK_IN_OMAP343X, | ||
2465 | .recalc = &followparent_recalc, | ||
2466 | }; | ||
2467 | |||
2468 | static struct clk gpt9_ick = { | ||
2469 | .name = "gpt9_ick", | ||
2470 | .parent = &per_l4_ick, | ||
2471 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2472 | .enable_bit = OMAP3430_EN_GPT9_SHIFT, | ||
2473 | .flags = CLOCK_IN_OMAP343X, | ||
2474 | .recalc = &followparent_recalc, | ||
2475 | }; | ||
2476 | |||
2477 | static struct clk gpt8_ick = { | ||
2478 | .name = "gpt8_ick", | ||
2479 | .parent = &per_l4_ick, | ||
2480 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2481 | .enable_bit = OMAP3430_EN_GPT8_SHIFT, | ||
2482 | .flags = CLOCK_IN_OMAP343X, | ||
2483 | .recalc = &followparent_recalc, | ||
2484 | }; | ||
2485 | |||
2486 | static struct clk gpt7_ick = { | ||
2487 | .name = "gpt7_ick", | ||
2488 | .parent = &per_l4_ick, | ||
2489 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2490 | .enable_bit = OMAP3430_EN_GPT7_SHIFT, | ||
2491 | .flags = CLOCK_IN_OMAP343X, | ||
2492 | .recalc = &followparent_recalc, | ||
2493 | }; | ||
2494 | |||
2495 | static struct clk gpt6_ick = { | ||
2496 | .name = "gpt6_ick", | ||
2497 | .parent = &per_l4_ick, | ||
2498 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2499 | .enable_bit = OMAP3430_EN_GPT6_SHIFT, | ||
2500 | .flags = CLOCK_IN_OMAP343X, | ||
2501 | .recalc = &followparent_recalc, | ||
2502 | }; | ||
2503 | |||
2504 | static struct clk gpt5_ick = { | ||
2505 | .name = "gpt5_ick", | ||
2506 | .parent = &per_l4_ick, | ||
2507 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2508 | .enable_bit = OMAP3430_EN_GPT5_SHIFT, | ||
2509 | .flags = CLOCK_IN_OMAP343X, | ||
2510 | .recalc = &followparent_recalc, | ||
2511 | }; | ||
2512 | |||
2513 | static struct clk gpt4_ick = { | ||
2514 | .name = "gpt4_ick", | ||
2515 | .parent = &per_l4_ick, | ||
2516 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2517 | .enable_bit = OMAP3430_EN_GPT4_SHIFT, | ||
2518 | .flags = CLOCK_IN_OMAP343X, | ||
2519 | .recalc = &followparent_recalc, | ||
2520 | }; | ||
2521 | |||
2522 | static struct clk gpt3_ick = { | ||
2523 | .name = "gpt3_ick", | ||
2524 | .parent = &per_l4_ick, | ||
2525 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2526 | .enable_bit = OMAP3430_EN_GPT3_SHIFT, | ||
2527 | .flags = CLOCK_IN_OMAP343X, | ||
2528 | .recalc = &followparent_recalc, | ||
2529 | }; | ||
2530 | |||
2531 | static struct clk gpt2_ick = { | ||
2532 | .name = "gpt2_ick", | ||
2533 | .parent = &per_l4_ick, | ||
2534 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2535 | .enable_bit = OMAP3430_EN_GPT2_SHIFT, | ||
2536 | .flags = CLOCK_IN_OMAP343X, | ||
2537 | .recalc = &followparent_recalc, | ||
2538 | }; | ||
2539 | |||
2540 | static struct clk mcbsp2_ick = { | ||
2541 | .name = "mcbsp2_ick", | ||
2542 | .parent = &per_l4_ick, | ||
2543 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2544 | .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, | ||
2545 | .flags = CLOCK_IN_OMAP343X, | ||
2546 | .recalc = &followparent_recalc, | ||
2547 | }; | ||
2548 | |||
2549 | static struct clk mcbsp3_ick = { | ||
2550 | .name = "mcbsp3_ick", | ||
2551 | .parent = &per_l4_ick, | ||
2552 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2553 | .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, | ||
2554 | .flags = CLOCK_IN_OMAP343X, | ||
2555 | .recalc = &followparent_recalc, | ||
2556 | }; | ||
2557 | |||
2558 | static struct clk mcbsp4_ick = { | ||
2559 | .name = "mcbsp4_ick", | ||
2560 | .parent = &per_l4_ick, | ||
2561 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), | ||
2562 | .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, | ||
2563 | .flags = CLOCK_IN_OMAP343X, | ||
2564 | .recalc = &followparent_recalc, | ||
2565 | }; | ||
2566 | |||
2567 | static const struct clksel mcbsp_234_clksel[] = { | ||
2568 | { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates }, | ||
2569 | { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, | ||
2570 | { .parent = NULL } | ||
2571 | }; | ||
2572 | |||
2573 | static struct clk mcbsp2_fck = { | ||
2574 | .name = "mcbsp2_fck", | ||
2575 | .init = &omap2_init_clksel_parent, | ||
2576 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2577 | .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, | ||
2578 | .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), | ||
2579 | .clksel_mask = OMAP2_MCBSP2_CLKS_MASK, | ||
2580 | .clksel = mcbsp_234_clksel, | ||
2581 | .flags = CLOCK_IN_OMAP343X, | ||
2582 | .recalc = &omap2_clksel_recalc, | ||
2583 | }; | ||
2584 | |||
2585 | static struct clk mcbsp3_fck = { | ||
2586 | .name = "mcbsp3_fck", | ||
2587 | .init = &omap2_init_clksel_parent, | ||
2588 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2589 | .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, | ||
2590 | .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1), | ||
2591 | .clksel_mask = OMAP2_MCBSP3_CLKS_MASK, | ||
2592 | .clksel = mcbsp_234_clksel, | ||
2593 | .flags = CLOCK_IN_OMAP343X, | ||
2594 | .recalc = &omap2_clksel_recalc, | ||
2595 | }; | ||
2596 | |||
2597 | static struct clk mcbsp4_fck = { | ||
2598 | .name = "mcbsp4_fck", | ||
2599 | .init = &omap2_init_clksel_parent, | ||
2600 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), | ||
2601 | .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, | ||
2602 | .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1), | ||
2603 | .clksel_mask = OMAP2_MCBSP4_CLKS_MASK, | ||
2604 | .clksel = mcbsp_234_clksel, | ||
2605 | .flags = CLOCK_IN_OMAP343X, | ||
2606 | .recalc = &omap2_clksel_recalc, | ||
2607 | }; | ||
2608 | |||
2609 | /* EMU clocks */ | ||
2610 | |||
2611 | /* More information: ARM Cortex-A8 Technical Reference Manual, sect 10.1 */ | ||
2612 | |||
2613 | static const struct clksel_rate emu_src_sys_rates[] = { | ||
2614 | { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2615 | { .div = 0 }, | ||
2616 | }; | ||
2617 | |||
2618 | static const struct clksel_rate emu_src_core_rates[] = { | ||
2619 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2620 | { .div = 0 }, | ||
2621 | }; | ||
2622 | |||
2623 | static const struct clksel_rate emu_src_per_rates[] = { | ||
2624 | { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2625 | { .div = 0 }, | ||
2626 | }; | ||
2627 | |||
2628 | static const struct clksel_rate emu_src_mpu_rates[] = { | ||
2629 | { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2630 | { .div = 0 }, | ||
2631 | }; | ||
2632 | |||
2633 | static const struct clksel emu_src_clksel[] = { | ||
2634 | { .parent = &sys_ck, .rates = emu_src_sys_rates }, | ||
2635 | { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates }, | ||
2636 | { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates }, | ||
2637 | { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates }, | ||
2638 | { .parent = NULL }, | ||
2639 | }; | ||
2640 | |||
2641 | /* | ||
2642 | * Like the clkout_src clocks, emu_src_clk is a virtual clock, existing only | ||
2643 | * to switch the source of some of the EMU clocks. | ||
2644 | * XXX Are there CLKEN bits for these EMU clks? | ||
2645 | */ | ||
2646 | static struct clk emu_src_ck = { | ||
2647 | .name = "emu_src_ck", | ||
2648 | .init = &omap2_init_clksel_parent, | ||
2649 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
2650 | .clksel_mask = OMAP3430_MUX_CTRL_MASK, | ||
2651 | .clksel = emu_src_clksel, | ||
2652 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2653 | .recalc = &omap2_clksel_recalc, | ||
2654 | }; | ||
2655 | |||
2656 | static const struct clksel_rate pclk_emu_rates[] = { | ||
2657 | { .div = 2, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2658 | { .div = 3, .val = 3, .flags = RATE_IN_343X }, | ||
2659 | { .div = 4, .val = 4, .flags = RATE_IN_343X }, | ||
2660 | { .div = 6, .val = 6, .flags = RATE_IN_343X }, | ||
2661 | { .div = 0 }, | ||
2662 | }; | ||
2663 | |||
2664 | static const struct clksel pclk_emu_clksel[] = { | ||
2665 | { .parent = &emu_src_ck, .rates = pclk_emu_rates }, | ||
2666 | { .parent = NULL }, | ||
2667 | }; | ||
2668 | |||
2669 | static struct clk pclk_fck = { | ||
2670 | .name = "pclk_fck", | ||
2671 | .init = &omap2_init_clksel_parent, | ||
2672 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
2673 | .clksel_mask = OMAP3430_CLKSEL_PCLK_MASK, | ||
2674 | .clksel = pclk_emu_clksel, | ||
2675 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2676 | .recalc = &omap2_clksel_recalc, | ||
2677 | }; | ||
2678 | |||
2679 | static const struct clksel_rate pclkx2_emu_rates[] = { | ||
2680 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2681 | { .div = 2, .val = 2, .flags = RATE_IN_343X }, | ||
2682 | { .div = 3, .val = 3, .flags = RATE_IN_343X }, | ||
2683 | { .div = 0 }, | ||
2684 | }; | ||
2685 | |||
2686 | static const struct clksel pclkx2_emu_clksel[] = { | ||
2687 | { .parent = &emu_src_ck, .rates = pclkx2_emu_rates }, | ||
2688 | { .parent = NULL }, | ||
2689 | }; | ||
2690 | |||
2691 | static struct clk pclkx2_fck = { | ||
2692 | .name = "pclkx2_fck", | ||
2693 | .init = &omap2_init_clksel_parent, | ||
2694 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
2695 | .clksel_mask = OMAP3430_CLKSEL_PCLKX2_MASK, | ||
2696 | .clksel = pclkx2_emu_clksel, | ||
2697 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2698 | .recalc = &omap2_clksel_recalc, | ||
2699 | }; | ||
2700 | |||
2701 | static const struct clksel atclk_emu_clksel[] = { | ||
2702 | { .parent = &emu_src_ck, .rates = div2_rates }, | ||
2703 | { .parent = NULL }, | ||
2704 | }; | ||
2705 | |||
2706 | static struct clk atclk_fck = { | ||
2707 | .name = "atclk_fck", | ||
2708 | .init = &omap2_init_clksel_parent, | ||
2709 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
2710 | .clksel_mask = OMAP3430_CLKSEL_ATCLK_MASK, | ||
2711 | .clksel = atclk_emu_clksel, | ||
2712 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2713 | .recalc = &omap2_clksel_recalc, | ||
2714 | }; | ||
2715 | |||
2716 | static struct clk traceclk_src_fck = { | ||
2717 | .name = "traceclk_src_fck", | ||
2718 | .init = &omap2_init_clksel_parent, | ||
2719 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
2720 | .clksel_mask = OMAP3430_TRACE_MUX_CTRL_MASK, | ||
2721 | .clksel = emu_src_clksel, | ||
2722 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, | ||
2723 | .recalc = &omap2_clksel_recalc, | ||
2724 | }; | ||
2725 | |||
2726 | static const struct clksel_rate traceclk_rates[] = { | ||
2727 | { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE }, | ||
2728 | { .div = 2, .val = 2, .flags = RATE_IN_343X }, | ||
2729 | { .div = 4, .val = 4, .flags = RATE_IN_343X }, | ||
2730 | { .div = 0 }, | ||
2731 | }; | ||
2732 | |||
2733 | static const struct clksel traceclk_clksel[] = { | ||
2734 | { .parent = &traceclk_src_fck, .rates = traceclk_rates }, | ||
2735 | { .parent = NULL }, | ||
2736 | }; | ||
2737 | |||
2738 | static struct clk traceclk_fck = { | ||
2739 | .name = "traceclk_fck", | ||
2740 | .init = &omap2_init_clksel_parent, | ||
2741 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | ||
2742 | .clksel_mask = OMAP3430_CLKSEL_TRACECLK_MASK, | ||
2743 | .clksel = traceclk_clksel, | ||
2744 | .flags = CLOCK_IN_OMAP343X | ALWAYS_ENABLED, | ||
2745 | .recalc = &omap2_clksel_recalc, | ||
2746 | }; | ||
2747 | |||
2748 | /* SR clocks */ | ||
2749 | |||
2750 | /* SmartReflex fclk (VDD1) */ | ||
2751 | static struct clk sr1_fck = { | ||
2752 | .name = "sr1_fck", | ||
2753 | .parent = &sys_ck, | ||
2754 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
2755 | .enable_bit = OMAP3430_EN_SR1_SHIFT, | ||
2756 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, | ||
2757 | .recalc = &followparent_recalc, | ||
2758 | }; | ||
2759 | |||
2760 | /* SmartReflex fclk (VDD2) */ | ||
2761 | static struct clk sr2_fck = { | ||
2762 | .name = "sr2_fck", | ||
2763 | .parent = &sys_ck, | ||
2764 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | ||
2765 | .enable_bit = OMAP3430_EN_SR2_SHIFT, | ||
2766 | .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES, | ||
2767 | .recalc = &followparent_recalc, | ||
2768 | }; | ||
2769 | |||
2770 | static struct clk sr_l4_ick = { | ||
2771 | .name = "sr_l4_ick", | ||
2772 | .parent = &l4_ick, | ||
2773 | .flags = CLOCK_IN_OMAP343X, | ||
2774 | .recalc = &followparent_recalc, | ||
2775 | }; | ||
2776 | |||
2777 | /* SECURE_32K_FCK clocks */ | ||
2778 | |||
2779 | static struct clk gpt12_fck = { | ||
2780 | .name = "gpt12_fck", | ||
2781 | .parent = &secure_32k_fck, | ||
2782 | .flags = CLOCK_IN_OMAP343X | ALWAYS_ENABLED, | ||
2783 | .recalc = &followparent_recalc, | ||
2784 | }; | ||
2785 | |||
2786 | static struct clk wdt1_fck = { | ||
2787 | .name = "wdt1_fck", | ||
2788 | .parent = &secure_32k_fck, | ||
2789 | .flags = CLOCK_IN_OMAP343X | ALWAYS_ENABLED, | ||
2790 | .recalc = &followparent_recalc, | ||
2791 | }; | ||
2792 | |||
2793 | static struct clk *onchip_34xx_clks[] __initdata = { | ||
2794 | &omap_32k_fck, | ||
2795 | &virt_12m_ck, | ||
2796 | &virt_13m_ck, | ||
2797 | &virt_16_8m_ck, | ||
2798 | &virt_19_2m_ck, | ||
2799 | &virt_26m_ck, | ||
2800 | &virt_38_4m_ck, | ||
2801 | &osc_sys_ck, | ||
2802 | &sys_ck, | ||
2803 | &sys_altclk, | ||
2804 | &mcbsp_clks, | ||
2805 | &sys_clkout1, | ||
2806 | &dpll1_ck, | ||
2807 | &dpll1_x2_ck, | ||
2808 | &dpll1_x2m2_ck, | ||
2809 | &dpll2_ck, | ||
2810 | &dpll2_m2_ck, | ||
2811 | &dpll3_ck, | ||
2812 | &core_ck, | ||
2813 | &dpll3_x2_ck, | ||
2814 | &dpll3_m2_ck, | ||
2815 | &dpll3_m2x2_ck, | ||
2816 | &dpll3_m3_ck, | ||
2817 | &dpll3_m3x2_ck, | ||
2818 | &emu_core_alwon_ck, | ||
2819 | &dpll4_ck, | ||
2820 | &dpll4_x2_ck, | ||
2821 | &omap_96m_alwon_fck, | ||
2822 | &omap_96m_fck, | ||
2823 | &cm_96m_fck, | ||
2824 | &virt_omap_54m_fck, | ||
2825 | &omap_54m_fck, | ||
2826 | &omap_48m_fck, | ||
2827 | &omap_12m_fck, | ||
2828 | &dpll4_m2_ck, | ||
2829 | &dpll4_m2x2_ck, | ||
2830 | &dpll4_m3_ck, | ||
2831 | &dpll4_m3x2_ck, | ||
2832 | &dpll4_m4_ck, | ||
2833 | &dpll4_m4x2_ck, | ||
2834 | &dpll4_m5_ck, | ||
2835 | &dpll4_m5x2_ck, | ||
2836 | &dpll4_m6_ck, | ||
2837 | &dpll4_m6x2_ck, | ||
2838 | &emu_per_alwon_ck, | ||
2839 | &dpll5_ck, | ||
2840 | &dpll5_m2_ck, | ||
2841 | &omap_120m_fck, | ||
2842 | &clkout2_src_ck, | ||
2843 | &sys_clkout2, | ||
2844 | &corex2_fck, | ||
2845 | &dpll1_fck, | ||
2846 | &mpu_ck, | ||
2847 | &arm_fck, | ||
2848 | &emu_mpu_alwon_ck, | ||
2849 | &dpll2_fck, | ||
2850 | &iva2_ck, | ||
2851 | &l3_ick, | ||
2852 | &l4_ick, | ||
2853 | &rm_ick, | ||
2854 | &gfx_l3_fck, | ||
2855 | &gfx_l3_ick, | ||
2856 | &gfx_cg1_ck, | ||
2857 | &gfx_cg2_ck, | ||
2858 | &sgx_fck, | ||
2859 | &sgx_ick, | ||
2860 | &d2d_26m_fck, | ||
2861 | &gpt10_fck, | ||
2862 | &gpt11_fck, | ||
2863 | &cpefuse_fck, | ||
2864 | &ts_fck, | ||
2865 | &usbtll_fck, | ||
2866 | &core_96m_fck, | ||
2867 | &mmchs3_fck, | ||
2868 | &mmchs2_fck, | ||
2869 | &mspro_fck, | ||
2870 | &mmchs1_fck, | ||
2871 | &i2c3_fck, | ||
2872 | &i2c2_fck, | ||
2873 | &i2c1_fck, | ||
2874 | &mcbsp5_fck, | ||
2875 | &mcbsp1_fck, | ||
2876 | &core_48m_fck, | ||
2877 | &mcspi4_fck, | ||
2878 | &mcspi3_fck, | ||
2879 | &mcspi2_fck, | ||
2880 | &mcspi1_fck, | ||
2881 | &uart2_fck, | ||
2882 | &uart1_fck, | ||
2883 | &fshostusb_fck, | ||
2884 | &core_12m_fck, | ||
2885 | &hdq_fck, | ||
2886 | &ssi_ssr_fck, | ||
2887 | &ssi_sst_fck, | ||
2888 | &core_l3_ick, | ||
2889 | &hsotgusb_ick, | ||
2890 | &sdrc_ick, | ||
2891 | &gpmc_fck, | ||
2892 | &security_l3_ick, | ||
2893 | &pka_ick, | ||
2894 | &core_l4_ick, | ||
2895 | &usbtll_ick, | ||
2896 | &mmchs3_ick, | ||
2897 | &icr_ick, | ||
2898 | &aes2_ick, | ||
2899 | &sha12_ick, | ||
2900 | &des2_ick, | ||
2901 | &mmchs2_ick, | ||
2902 | &mmchs1_ick, | ||
2903 | &mspro_ick, | ||
2904 | &hdq_ick, | ||
2905 | &mcspi4_ick, | ||
2906 | &mcspi3_ick, | ||
2907 | &mcspi2_ick, | ||
2908 | &mcspi1_ick, | ||
2909 | &i2c3_ick, | ||
2910 | &i2c2_ick, | ||
2911 | &i2c1_ick, | ||
2912 | &uart2_ick, | ||
2913 | &uart1_ick, | ||
2914 | &gpt11_ick, | ||
2915 | &gpt10_ick, | ||
2916 | &mcbsp5_ick, | ||
2917 | &mcbsp1_ick, | ||
2918 | &fac_ick, | ||
2919 | &mailboxes_ick, | ||
2920 | &omapctrl_ick, | ||
2921 | &ssi_l4_ick, | ||
2922 | &ssi_ick, | ||
2923 | &usb_l4_ick, | ||
2924 | &security_l4_ick2, | ||
2925 | &aes1_ick, | ||
2926 | &rng_ick, | ||
2927 | &sha11_ick, | ||
2928 | &des1_ick, | ||
2929 | &dss1_alwon_fck, | ||
2930 | &dss_tv_fck, | ||
2931 | &dss_96m_fck, | ||
2932 | &dss2_alwon_fck, | ||
2933 | &dss_ick, | ||
2934 | &cam_mclk, | ||
2935 | &cam_l3_ick, | ||
2936 | &cam_l4_ick, | ||
2937 | &usbhost_120m_fck, | ||
2938 | &usbhost_48m_fck, | ||
2939 | &usbhost_l3_ick, | ||
2940 | &usbhost_l4_ick, | ||
2941 | &usbhost_sar_fck, | ||
2942 | &usim_fck, | ||
2943 | &gpt1_fck, | ||
2944 | &wkup_32k_fck, | ||
2945 | &gpio1_fck, | ||
2946 | &wdt2_fck, | ||
2947 | &wkup_l4_ick, | ||
2948 | &usim_ick, | ||
2949 | &wdt2_ick, | ||
2950 | &wdt1_ick, | ||
2951 | &gpio1_ick, | ||
2952 | &omap_32ksync_ick, | ||
2953 | &gpt12_ick, | ||
2954 | &gpt1_ick, | ||
2955 | &per_96m_fck, | ||
2956 | &per_48m_fck, | ||
2957 | &uart3_fck, | ||
2958 | &gpt2_fck, | ||
2959 | &gpt3_fck, | ||
2960 | &gpt4_fck, | ||
2961 | &gpt5_fck, | ||
2962 | &gpt6_fck, | ||
2963 | &gpt7_fck, | ||
2964 | &gpt8_fck, | ||
2965 | &gpt9_fck, | ||
2966 | &per_32k_alwon_fck, | ||
2967 | &gpio6_fck, | ||
2968 | &gpio5_fck, | ||
2969 | &gpio4_fck, | ||
2970 | &gpio3_fck, | ||
2971 | &gpio2_fck, | ||
2972 | &wdt3_fck, | ||
2973 | &per_l4_ick, | ||
2974 | &gpio6_ick, | ||
2975 | &gpio5_ick, | ||
2976 | &gpio4_ick, | ||
2977 | &gpio3_ick, | ||
2978 | &gpio2_ick, | ||
2979 | &wdt3_ick, | ||
2980 | &uart3_ick, | ||
2981 | &gpt9_ick, | ||
2982 | &gpt8_ick, | ||
2983 | &gpt7_ick, | ||
2984 | &gpt6_ick, | ||
2985 | &gpt5_ick, | ||
2986 | &gpt4_ick, | ||
2987 | &gpt3_ick, | ||
2988 | &gpt2_ick, | ||
2989 | &mcbsp2_ick, | ||
2990 | &mcbsp3_ick, | ||
2991 | &mcbsp4_ick, | ||
2992 | &mcbsp2_fck, | ||
2993 | &mcbsp3_fck, | ||
2994 | &mcbsp4_fck, | ||
2995 | &emu_src_ck, | ||
2996 | &pclk_fck, | ||
2997 | &pclkx2_fck, | ||
2998 | &atclk_fck, | ||
2999 | &traceclk_src_fck, | ||
3000 | &traceclk_fck, | ||
3001 | &sr1_fck, | ||
3002 | &sr2_fck, | ||
3003 | &sr_l4_ick, | ||
3004 | &secure_32k_fck, | ||
3005 | &gpt12_fck, | ||
3006 | &wdt1_fck, | ||
3007 | }; | ||
3008 | |||
3009 | #endif | ||
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h new file mode 100644 index 000000000000..20ac38100678 --- /dev/null +++ b/arch/arm/mach-omap2/cm-regbits-24xx.h | |||
@@ -0,0 +1,401 @@ | |||
1 | #ifndef __ARCH_ARM_MACH_OMAP2_CM_REGBITS_24XX_H | ||
2 | #define __ARCH_ARM_MACH_OMAP2_CM_REGBITS_24XX_H | ||
3 | |||
4 | /* | ||
5 | * OMAP24XX Clock Management register bits | ||
6 | * | ||
7 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include "cm.h" | ||
18 | |||
19 | /* Bits shared between registers */ | ||
20 | |||
21 | /* CM_FCLKEN1_CORE and CM_ICLKEN1_CORE shared bits */ | ||
22 | #define OMAP24XX_EN_CAM_SHIFT 31 | ||
23 | #define OMAP24XX_EN_CAM (1 << 31) | ||
24 | #define OMAP24XX_EN_WDT4_SHIFT 29 | ||
25 | #define OMAP24XX_EN_WDT4 (1 << 29) | ||
26 | #define OMAP2420_EN_WDT3_SHIFT 28 | ||
27 | #define OMAP2420_EN_WDT3 (1 << 28) | ||
28 | #define OMAP24XX_EN_MSPRO_SHIFT 27 | ||
29 | #define OMAP24XX_EN_MSPRO (1 << 27) | ||
30 | #define OMAP24XX_EN_FAC_SHIFT 25 | ||
31 | #define OMAP24XX_EN_FAC (1 << 25) | ||
32 | #define OMAP2420_EN_EAC_SHIFT 24 | ||
33 | #define OMAP2420_EN_EAC (1 << 24) | ||
34 | #define OMAP24XX_EN_HDQ_SHIFT 23 | ||
35 | #define OMAP24XX_EN_HDQ (1 << 23) | ||
36 | #define OMAP2420_EN_I2C2_SHIFT 20 | ||
37 | #define OMAP2420_EN_I2C2 (1 << 20) | ||
38 | #define OMAP2420_EN_I2C1_SHIFT 19 | ||
39 | #define OMAP2420_EN_I2C1 (1 << 19) | ||
40 | |||
41 | /* CM_FCLKEN2_CORE and CM_ICLKEN2_CORE shared bits */ | ||
42 | #define OMAP2430_EN_MCBSP5_SHIFT 5 | ||
43 | #define OMAP2430_EN_MCBSP5 (1 << 5) | ||
44 | #define OMAP2430_EN_MCBSP4_SHIFT 4 | ||
45 | #define OMAP2430_EN_MCBSP4 (1 << 4) | ||
46 | #define OMAP2430_EN_MCBSP3_SHIFT 3 | ||
47 | #define OMAP2430_EN_MCBSP3 (1 << 3) | ||
48 | #define OMAP24XX_EN_SSI_SHIFT 1 | ||
49 | #define OMAP24XX_EN_SSI (1 << 1) | ||
50 | |||
51 | /* CM_FCLKEN_WKUP and CM_ICLKEN_WKUP shared bits */ | ||
52 | #define OMAP24XX_EN_MPU_WDT_SHIFT 3 | ||
53 | #define OMAP24XX_EN_MPU_WDT (1 << 3) | ||
54 | |||
55 | /* Bits specific to each register */ | ||
56 | |||
57 | /* CM_IDLEST_MPU */ | ||
58 | /* 2430 only */ | ||
59 | #define OMAP2430_ST_MPU (1 << 0) | ||
60 | |||
61 | /* CM_CLKSEL_MPU */ | ||
62 | #define OMAP24XX_CLKSEL_MPU_SHIFT 0 | ||
63 | #define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0) | ||
64 | |||
65 | /* CM_CLKSTCTRL_MPU */ | ||
66 | #define OMAP24XX_AUTOSTATE_MPU (1 << 0) | ||
67 | |||
68 | /* CM_FCLKEN1_CORE specific bits*/ | ||
69 | #define OMAP24XX_EN_TV_SHIFT 2 | ||
70 | #define OMAP24XX_EN_TV (1 << 2) | ||
71 | #define OMAP24XX_EN_DSS2_SHIFT 1 | ||
72 | #define OMAP24XX_EN_DSS2 (1 << 1) | ||
73 | #define OMAP24XX_EN_DSS1_SHIFT 0 | ||
74 | #define OMAP24XX_EN_DSS1 (1 << 0) | ||
75 | |||
76 | /* CM_FCLKEN2_CORE specific bits */ | ||
77 | #define OMAP2430_EN_I2CHS2_SHIFT 20 | ||
78 | #define OMAP2430_EN_I2CHS2 (1 << 20) | ||
79 | #define OMAP2430_EN_I2CHS1_SHIFT 19 | ||
80 | #define OMAP2430_EN_I2CHS1 (1 << 19) | ||
81 | #define OMAP2430_EN_MMCHSDB2_SHIFT 17 | ||
82 | #define OMAP2430_EN_MMCHSDB2 (1 << 17) | ||
83 | #define OMAP2430_EN_MMCHSDB1_SHIFT 16 | ||
84 | #define OMAP2430_EN_MMCHSDB1 (1 << 16) | ||
85 | |||
86 | /* CM_ICLKEN1_CORE specific bits */ | ||
87 | #define OMAP24XX_EN_MAILBOXES_SHIFT 30 | ||
88 | #define OMAP24XX_EN_MAILBOXES (1 << 30) | ||
89 | #define OMAP24XX_EN_DSS_SHIFT 0 | ||
90 | #define OMAP24XX_EN_DSS (1 << 0) | ||
91 | |||
92 | /* CM_ICLKEN2_CORE specific bits */ | ||
93 | |||
94 | /* CM_ICLKEN3_CORE */ | ||
95 | /* 2430 only */ | ||
96 | #define OMAP2430_EN_SDRC_SHIFT 2 | ||
97 | #define OMAP2430_EN_SDRC (1 << 2) | ||
98 | |||
99 | /* CM_ICLKEN4_CORE */ | ||
100 | #define OMAP24XX_EN_PKA_SHIFT 4 | ||
101 | #define OMAP24XX_EN_PKA (1 << 4) | ||
102 | #define OMAP24XX_EN_AES_SHIFT 3 | ||
103 | #define OMAP24XX_EN_AES (1 << 3) | ||
104 | #define OMAP24XX_EN_RNG_SHIFT 2 | ||
105 | #define OMAP24XX_EN_RNG (1 << 2) | ||
106 | #define OMAP24XX_EN_SHA_SHIFT 1 | ||
107 | #define OMAP24XX_EN_SHA (1 << 1) | ||
108 | #define OMAP24XX_EN_DES_SHIFT 0 | ||
109 | #define OMAP24XX_EN_DES (1 << 0) | ||
110 | |||
111 | /* CM_IDLEST1_CORE specific bits */ | ||
112 | #define OMAP24XX_ST_MAILBOXES (1 << 30) | ||
113 | #define OMAP24XX_ST_WDT4 (1 << 29) | ||
114 | #define OMAP2420_ST_WDT3 (1 << 28) | ||
115 | #define OMAP24XX_ST_MSPRO (1 << 27) | ||
116 | #define OMAP24XX_ST_FAC (1 << 25) | ||
117 | #define OMAP2420_ST_EAC (1 << 24) | ||
118 | #define OMAP24XX_ST_HDQ (1 << 23) | ||
119 | #define OMAP24XX_ST_I2C2 (1 << 20) | ||
120 | #define OMAP24XX_ST_I2C1 (1 << 19) | ||
121 | #define OMAP24XX_ST_MCBSP2 (1 << 16) | ||
122 | #define OMAP24XX_ST_MCBSP1 (1 << 15) | ||
123 | #define OMAP24XX_ST_DSS (1 << 0) | ||
124 | |||
125 | /* CM_IDLEST2_CORE */ | ||
126 | #define OMAP2430_ST_MCBSP5 (1 << 5) | ||
127 | #define OMAP2430_ST_MCBSP4 (1 << 4) | ||
128 | #define OMAP2430_ST_MCBSP3 (1 << 3) | ||
129 | #define OMAP24XX_ST_SSI (1 << 1) | ||
130 | |||
131 | /* CM_IDLEST3_CORE */ | ||
132 | /* 2430 only */ | ||
133 | #define OMAP2430_ST_SDRC (1 << 2) | ||
134 | |||
135 | /* CM_IDLEST4_CORE */ | ||
136 | #define OMAP24XX_ST_PKA (1 << 4) | ||
137 | #define OMAP24XX_ST_AES (1 << 3) | ||
138 | #define OMAP24XX_ST_RNG (1 << 2) | ||
139 | #define OMAP24XX_ST_SHA (1 << 1) | ||
140 | #define OMAP24XX_ST_DES (1 << 0) | ||
141 | |||
142 | /* CM_AUTOIDLE1_CORE */ | ||
143 | #define OMAP24XX_AUTO_CAM (1 << 31) | ||
144 | #define OMAP24XX_AUTO_MAILBOXES (1 << 30) | ||
145 | #define OMAP24XX_AUTO_WDT4 (1 << 29) | ||
146 | #define OMAP2420_AUTO_WDT3 (1 << 28) | ||
147 | #define OMAP24XX_AUTO_MSPRO (1 << 27) | ||
148 | #define OMAP2420_AUTO_MMC (1 << 26) | ||
149 | #define OMAP24XX_AUTO_FAC (1 << 25) | ||
150 | #define OMAP2420_AUTO_EAC (1 << 24) | ||
151 | #define OMAP24XX_AUTO_HDQ (1 << 23) | ||
152 | #define OMAP24XX_AUTO_UART2 (1 << 22) | ||
153 | #define OMAP24XX_AUTO_UART1 (1 << 21) | ||
154 | #define OMAP24XX_AUTO_I2C2 (1 << 20) | ||
155 | #define OMAP24XX_AUTO_I2C1 (1 << 19) | ||
156 | #define OMAP24XX_AUTO_MCSPI2 (1 << 18) | ||
157 | #define OMAP24XX_AUTO_MCSPI1 (1 << 17) | ||
158 | #define OMAP24XX_AUTO_MCBSP2 (1 << 16) | ||
159 | #define OMAP24XX_AUTO_MCBSP1 (1 << 15) | ||
160 | #define OMAP24XX_AUTO_GPT12 (1 << 14) | ||
161 | #define OMAP24XX_AUTO_GPT11 (1 << 13) | ||
162 | #define OMAP24XX_AUTO_GPT10 (1 << 12) | ||
163 | #define OMAP24XX_AUTO_GPT9 (1 << 11) | ||
164 | #define OMAP24XX_AUTO_GPT8 (1 << 10) | ||
165 | #define OMAP24XX_AUTO_GPT7 (1 << 9) | ||
166 | #define OMAP24XX_AUTO_GPT6 (1 << 8) | ||
167 | #define OMAP24XX_AUTO_GPT5 (1 << 7) | ||
168 | #define OMAP24XX_AUTO_GPT4 (1 << 6) | ||
169 | #define OMAP24XX_AUTO_GPT3 (1 << 5) | ||
170 | #define OMAP24XX_AUTO_GPT2 (1 << 4) | ||
171 | #define OMAP2420_AUTO_VLYNQ (1 << 3) | ||
172 | #define OMAP24XX_AUTO_DSS (1 << 0) | ||
173 | |||
174 | /* CM_AUTOIDLE2_CORE */ | ||
175 | #define OMAP2430_AUTO_MDM_INTC (1 << 11) | ||
176 | #define OMAP2430_AUTO_GPIO5 (1 << 10) | ||
177 | #define OMAP2430_AUTO_MCSPI3 (1 << 9) | ||
178 | #define OMAP2430_AUTO_MMCHS2 (1 << 8) | ||
179 | #define OMAP2430_AUTO_MMCHS1 (1 << 7) | ||
180 | #define OMAP2430_AUTO_USBHS (1 << 6) | ||
181 | #define OMAP2430_AUTO_MCBSP5 (1 << 5) | ||
182 | #define OMAP2430_AUTO_MCBSP4 (1 << 4) | ||
183 | #define OMAP2430_AUTO_MCBSP3 (1 << 3) | ||
184 | #define OMAP24XX_AUTO_UART3 (1 << 2) | ||
185 | #define OMAP24XX_AUTO_SSI (1 << 1) | ||
186 | #define OMAP24XX_AUTO_USB (1 << 0) | ||
187 | |||
188 | /* CM_AUTOIDLE3_CORE */ | ||
189 | #define OMAP24XX_AUTO_SDRC (1 << 2) | ||
190 | #define OMAP24XX_AUTO_GPMC (1 << 1) | ||
191 | #define OMAP24XX_AUTO_SDMA (1 << 0) | ||
192 | |||
193 | /* CM_AUTOIDLE4_CORE */ | ||
194 | #define OMAP24XX_AUTO_PKA (1 << 4) | ||
195 | #define OMAP24XX_AUTO_AES (1 << 3) | ||
196 | #define OMAP24XX_AUTO_RNG (1 << 2) | ||
197 | #define OMAP24XX_AUTO_SHA (1 << 1) | ||
198 | #define OMAP24XX_AUTO_DES (1 << 0) | ||
199 | |||
200 | /* CM_CLKSEL1_CORE */ | ||
201 | #define OMAP24XX_CLKSEL_USB_SHIFT 25 | ||
202 | #define OMAP24XX_CLKSEL_USB_MASK (0x7 << 25) | ||
203 | #define OMAP24XX_CLKSEL_SSI_SHIFT 20 | ||
204 | #define OMAP24XX_CLKSEL_SSI_MASK (0x1f << 20) | ||
205 | #define OMAP2420_CLKSEL_VLYNQ_SHIFT 15 | ||
206 | #define OMAP2420_CLKSEL_VLYNQ_MASK (0x1f << 15) | ||
207 | #define OMAP24XX_CLKSEL_DSS2_SHIFT 13 | ||
208 | #define OMAP24XX_CLKSEL_DSS2_MASK (0x1 << 13) | ||
209 | #define OMAP24XX_CLKSEL_DSS1_SHIFT 8 | ||
210 | #define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8) | ||
211 | #define OMAP24XX_CLKSEL_L4_SHIFT 5 | ||
212 | #define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5) | ||
213 | #define OMAP24XX_CLKSEL_L3_SHIFT 0 | ||
214 | #define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0) | ||
215 | |||
216 | /* CM_CLKSEL2_CORE */ | ||
217 | #define OMAP24XX_CLKSEL_GPT12_SHIFT 22 | ||
218 | #define OMAP24XX_CLKSEL_GPT12_MASK (0x3 << 22) | ||
219 | #define OMAP24XX_CLKSEL_GPT11_SHIFT 20 | ||
220 | #define OMAP24XX_CLKSEL_GPT11_MASK (0x3 << 20) | ||
221 | #define OMAP24XX_CLKSEL_GPT10_SHIFT 18 | ||
222 | #define OMAP24XX_CLKSEL_GPT10_MASK (0x3 << 18) | ||
223 | #define OMAP24XX_CLKSEL_GPT9_SHIFT 16 | ||
224 | #define OMAP24XX_CLKSEL_GPT9_MASK (0x3 << 16) | ||
225 | #define OMAP24XX_CLKSEL_GPT8_SHIFT 14 | ||
226 | #define OMAP24XX_CLKSEL_GPT8_MASK (0x3 << 14) | ||
227 | #define OMAP24XX_CLKSEL_GPT7_SHIFT 12 | ||
228 | #define OMAP24XX_CLKSEL_GPT7_MASK (0x3 << 12) | ||
229 | #define OMAP24XX_CLKSEL_GPT6_SHIFT 10 | ||
230 | #define OMAP24XX_CLKSEL_GPT6_MASK (0x3 << 10) | ||
231 | #define OMAP24XX_CLKSEL_GPT5_SHIFT 8 | ||
232 | #define OMAP24XX_CLKSEL_GPT5_MASK (0x3 << 8) | ||
233 | #define OMAP24XX_CLKSEL_GPT4_SHIFT 6 | ||
234 | #define OMAP24XX_CLKSEL_GPT4_MASK (0x3 << 6) | ||
235 | #define OMAP24XX_CLKSEL_GPT3_SHIFT 4 | ||
236 | #define OMAP24XX_CLKSEL_GPT3_MASK (0x3 << 4) | ||
237 | #define OMAP24XX_CLKSEL_GPT2_SHIFT 2 | ||
238 | #define OMAP24XX_CLKSEL_GPT2_MASK (0x3 << 2) | ||
239 | |||
240 | /* CM_CLKSTCTRL_CORE */ | ||
241 | #define OMAP24XX_AUTOSTATE_DSS (1 << 2) | ||
242 | #define OMAP24XX_AUTOSTATE_L4 (1 << 1) | ||
243 | #define OMAP24XX_AUTOSTATE_L3 (1 << 0) | ||
244 | |||
245 | /* CM_FCLKEN_GFX */ | ||
246 | #define OMAP24XX_EN_3D_SHIFT 2 | ||
247 | #define OMAP24XX_EN_3D (1 << 2) | ||
248 | #define OMAP24XX_EN_2D_SHIFT 1 | ||
249 | #define OMAP24XX_EN_2D (1 << 1) | ||
250 | |||
251 | /* CM_ICLKEN_GFX specific bits */ | ||
252 | |||
253 | /* CM_IDLEST_GFX specific bits */ | ||
254 | |||
255 | /* CM_CLKSEL_GFX specific bits */ | ||
256 | |||
257 | /* CM_CLKSTCTRL_GFX */ | ||
258 | #define OMAP24XX_AUTOSTATE_GFX (1 << 0) | ||
259 | |||
260 | /* CM_FCLKEN_WKUP specific bits */ | ||
261 | |||
262 | /* CM_ICLKEN_WKUP specific bits */ | ||
263 | #define OMAP2430_EN_ICR_SHIFT 6 | ||
264 | #define OMAP2430_EN_ICR (1 << 6) | ||
265 | #define OMAP24XX_EN_OMAPCTRL_SHIFT 5 | ||
266 | #define OMAP24XX_EN_OMAPCTRL (1 << 5) | ||
267 | #define OMAP24XX_EN_WDT1_SHIFT 4 | ||
268 | #define OMAP24XX_EN_WDT1 (1 << 4) | ||
269 | #define OMAP24XX_EN_32KSYNC_SHIFT 1 | ||
270 | #define OMAP24XX_EN_32KSYNC (1 << 1) | ||
271 | |||
272 | /* CM_IDLEST_WKUP specific bits */ | ||
273 | #define OMAP2430_ST_ICR (1 << 6) | ||
274 | #define OMAP24XX_ST_OMAPCTRL (1 << 5) | ||
275 | #define OMAP24XX_ST_WDT1 (1 << 4) | ||
276 | #define OMAP24XX_ST_MPU_WDT (1 << 3) | ||
277 | #define OMAP24XX_ST_32KSYNC (1 << 1) | ||
278 | |||
279 | /* CM_AUTOIDLE_WKUP */ | ||
280 | #define OMAP24XX_AUTO_OMAPCTRL (1 << 5) | ||
281 | #define OMAP24XX_AUTO_WDT1 (1 << 4) | ||
282 | #define OMAP24XX_AUTO_MPU_WDT (1 << 3) | ||
283 | #define OMAP24XX_AUTO_GPIOS (1 << 2) | ||
284 | #define OMAP24XX_AUTO_32KSYNC (1 << 1) | ||
285 | #define OMAP24XX_AUTO_GPT1 (1 << 0) | ||
286 | |||
287 | /* CM_CLKSEL_WKUP */ | ||
288 | #define OMAP24XX_CLKSEL_GPT1_SHIFT 0 | ||
289 | #define OMAP24XX_CLKSEL_GPT1_MASK (0x3 << 0) | ||
290 | |||
291 | /* CM_CLKEN_PLL */ | ||
292 | #define OMAP24XX_EN_54M_PLL_SHIFT 6 | ||
293 | #define OMAP24XX_EN_54M_PLL_MASK (0x3 << 6) | ||
294 | #define OMAP24XX_EN_96M_PLL_SHIFT 2 | ||
295 | #define OMAP24XX_EN_96M_PLL_MASK (0x3 << 2) | ||
296 | #define OMAP24XX_EN_DPLL_SHIFT 0 | ||
297 | #define OMAP24XX_EN_DPLL_MASK (0x3 << 0) | ||
298 | |||
299 | /* CM_IDLEST_CKGEN */ | ||
300 | #define OMAP24XX_ST_54M_APLL (1 << 9) | ||
301 | #define OMAP24XX_ST_96M_APLL (1 << 8) | ||
302 | #define OMAP24XX_ST_54M_CLK (1 << 6) | ||
303 | #define OMAP24XX_ST_12M_CLK (1 << 5) | ||
304 | #define OMAP24XX_ST_48M_CLK (1 << 4) | ||
305 | #define OMAP24XX_ST_96M_CLK (1 << 2) | ||
306 | #define OMAP24XX_ST_CORE_CLK_SHIFT 0 | ||
307 | #define OMAP24XX_ST_CORE_CLK_MASK (0x3 << 0) | ||
308 | |||
309 | /* CM_AUTOIDLE_PLL */ | ||
310 | #define OMAP24XX_AUTO_54M_SHIFT 6 | ||
311 | #define OMAP24XX_AUTO_54M_MASK (0x3 << 6) | ||
312 | #define OMAP24XX_AUTO_96M_SHIFT 2 | ||
313 | #define OMAP24XX_AUTO_96M_MASK (0x3 << 2) | ||
314 | #define OMAP24XX_AUTO_DPLL_SHIFT 0 | ||
315 | #define OMAP24XX_AUTO_DPLL_MASK (0x3 << 0) | ||
316 | |||
317 | /* CM_CLKSEL1_PLL */ | ||
318 | #define OMAP2430_MAXDPLLFASTLOCK_SHIFT 28 | ||
319 | #define OMAP2430_MAXDPLLFASTLOCK_MASK (0x7 << 28) | ||
320 | #define OMAP24XX_APLLS_CLKIN_SHIFT 23 | ||
321 | #define OMAP24XX_APLLS_CLKIN_MASK (0x7 << 23) | ||
322 | #define OMAP24XX_DPLL_MULT_SHIFT 12 | ||
323 | #define OMAP24XX_DPLL_MULT_MASK (0x3ff << 12) | ||
324 | #define OMAP24XX_DPLL_DIV_SHIFT 8 | ||
325 | #define OMAP24XX_DPLL_DIV_MASK (0xf << 8) | ||
326 | #define OMAP24XX_54M_SOURCE_SHIFT 5 | ||
327 | #define OMAP24XX_54M_SOURCE (1 << 5) | ||
328 | #define OMAP2430_96M_SOURCE_SHIFT 4 | ||
329 | #define OMAP2430_96M_SOURCE (1 << 4) | ||
330 | #define OMAP24XX_48M_SOURCE_SHIFT 3 | ||
331 | #define OMAP24XX_48M_SOURCE (1 << 3) | ||
332 | #define OMAP2430_ALTCLK_SOURCE_SHIFT 0 | ||
333 | #define OMAP2430_ALTCLK_SOURCE_MASK (0x7 << 0) | ||
334 | |||
335 | /* CM_CLKSEL2_PLL */ | ||
336 | #define OMAP24XX_CORE_CLK_SRC_SHIFT 0 | ||
337 | #define OMAP24XX_CORE_CLK_SRC_MASK (0x3 << 0) | ||
338 | |||
339 | /* CM_FCLKEN_DSP */ | ||
340 | #define OMAP2420_EN_IVA_COP_SHIFT 10 | ||
341 | #define OMAP2420_EN_IVA_COP (1 << 10) | ||
342 | #define OMAP2420_EN_IVA_MPU_SHIFT 8 | ||
343 | #define OMAP2420_EN_IVA_MPU (1 << 8) | ||
344 | #define OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT 0 | ||
345 | #define OMAP24XX_CM_FCLKEN_DSP_EN_DSP (1 << 0) | ||
346 | |||
347 | /* CM_ICLKEN_DSP */ | ||
348 | #define OMAP2420_EN_DSP_IPI_SHIFT 1 | ||
349 | #define OMAP2420_EN_DSP_IPI (1 << 1) | ||
350 | |||
351 | /* CM_IDLEST_DSP */ | ||
352 | #define OMAP2420_ST_IVA (1 << 8) | ||
353 | #define OMAP2420_ST_IPI (1 << 1) | ||
354 | #define OMAP24XX_ST_DSP (1 << 0) | ||
355 | |||
356 | /* CM_AUTOIDLE_DSP */ | ||
357 | #define OMAP2420_AUTO_DSP_IPI (1 << 1) | ||
358 | |||
359 | /* CM_CLKSEL_DSP */ | ||
360 | #define OMAP2420_SYNC_IVA (1 << 13) | ||
361 | #define OMAP2420_CLKSEL_IVA_SHIFT 8 | ||
362 | #define OMAP2420_CLKSEL_IVA_MASK (0x1f << 8) | ||
363 | #define OMAP24XX_SYNC_DSP (1 << 7) | ||
364 | #define OMAP24XX_CLKSEL_DSP_IF_SHIFT 5 | ||
365 | #define OMAP24XX_CLKSEL_DSP_IF_MASK (0x3 << 5) | ||
366 | #define OMAP24XX_CLKSEL_DSP_SHIFT 0 | ||
367 | #define OMAP24XX_CLKSEL_DSP_MASK (0x1f << 0) | ||
368 | |||
369 | /* CM_CLKSTCTRL_DSP */ | ||
370 | #define OMAP2420_AUTOSTATE_IVA (1 << 8) | ||
371 | #define OMAP24XX_AUTOSTATE_DSP (1 << 0) | ||
372 | |||
373 | /* CM_FCLKEN_MDM */ | ||
374 | /* 2430 only */ | ||
375 | #define OMAP2430_EN_OSC_SHIFT 1 | ||
376 | #define OMAP2430_EN_OSC (1 << 1) | ||
377 | |||
378 | /* CM_ICLKEN_MDM */ | ||
379 | /* 2430 only */ | ||
380 | #define OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT 0 | ||
381 | #define OMAP2430_CM_ICLKEN_MDM_EN_MDM (1 << 0) | ||
382 | |||
383 | /* CM_IDLEST_MDM specific bits */ | ||
384 | /* 2430 only */ | ||
385 | |||
386 | /* CM_AUTOIDLE_MDM */ | ||
387 | /* 2430 only */ | ||
388 | #define OMAP2430_AUTO_OSC (1 << 1) | ||
389 | #define OMAP2430_AUTO_MDM (1 << 0) | ||
390 | |||
391 | /* CM_CLKSEL_MDM */ | ||
392 | /* 2430 only */ | ||
393 | #define OMAP2430_SYNC_MDM (1 << 4) | ||
394 | #define OMAP2430_CLKSEL_MDM_SHIFT 0 | ||
395 | #define OMAP2430_CLKSEL_MDM_MASK (0xf << 0) | ||
396 | |||
397 | /* CM_CLKSTCTRL_MDM */ | ||
398 | /* 2430 only */ | ||
399 | #define OMAP2430_AUTOSTATE_MDM (1 << 0) | ||
400 | |||
401 | #endif | ||
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h new file mode 100644 index 000000000000..9249129a5f46 --- /dev/null +++ b/arch/arm/mach-omap2/cm-regbits-34xx.h | |||
@@ -0,0 +1,673 @@ | |||
1 | #ifndef __ARCH_ARM_MACH_OMAP2_CM_REGBITS_34XX_H | ||
2 | #define __ARCH_ARM_MACH_OMAP2_CM_REGBITS_34XX_H | ||
3 | |||
4 | /* | ||
5 | * OMAP3430 Clock Management register bits | ||
6 | * | ||
7 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007-2008 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include "cm.h" | ||
18 | |||
19 | /* Bits shared between registers */ | ||
20 | |||
21 | /* CM_FCLKEN1_CORE and CM_ICLKEN1_CORE shared bits */ | ||
22 | #define OMAP3430ES2_EN_MMC3_MASK (1 << 30) | ||
23 | #define OMAP3430ES2_EN_MMC3_SHIFT 30 | ||
24 | #define OMAP3430_EN_MSPRO (1 << 23) | ||
25 | #define OMAP3430_EN_MSPRO_SHIFT 23 | ||
26 | #define OMAP3430_EN_HDQ (1 << 22) | ||
27 | #define OMAP3430_EN_HDQ_SHIFT 22 | ||
28 | #define OMAP3430ES1_EN_FSHOSTUSB (1 << 5) | ||
29 | #define OMAP3430ES1_EN_FSHOSTUSB_SHIFT 5 | ||
30 | #define OMAP3430ES1_EN_D2D (1 << 3) | ||
31 | #define OMAP3430ES1_EN_D2D_SHIFT 3 | ||
32 | #define OMAP3430_EN_SSI (1 << 0) | ||
33 | #define OMAP3430_EN_SSI_SHIFT 0 | ||
34 | |||
35 | /* CM_FCLKEN3_CORE and CM_ICLKEN3_CORE shared bits */ | ||
36 | #define OMAP3430ES2_EN_USBTLL_SHIFT 2 | ||
37 | #define OMAP3430ES2_EN_USBTLL_MASK (1 << 2) | ||
38 | |||
39 | /* CM_FCLKEN_WKUP and CM_ICLKEN_WKUP shared bits */ | ||
40 | #define OMAP3430_EN_WDT2 (1 << 5) | ||
41 | #define OMAP3430_EN_WDT2_SHIFT 5 | ||
42 | |||
43 | /* CM_ICLKEN_CAM, CM_FCLKEN_CAM shared bits */ | ||
44 | #define OMAP3430_EN_CAM (1 << 0) | ||
45 | #define OMAP3430_EN_CAM_SHIFT 0 | ||
46 | |||
47 | /* CM_FCLKEN_PER, CM_ICLKEN_PER shared bits */ | ||
48 | #define OMAP3430_EN_WDT3 (1 << 12) | ||
49 | #define OMAP3430_EN_WDT3_SHIFT 12 | ||
50 | |||
51 | /* CM_CLKSEL2_EMU, CM_CLKSEL3_EMU shared bits */ | ||
52 | #define OMAP3430_OVERRIDE_ENABLE (1 << 19) | ||
53 | |||
54 | |||
55 | /* Bits specific to each register */ | ||
56 | |||
57 | /* CM_FCLKEN_IVA2 */ | ||
58 | #define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2 (1 << 0) | ||
59 | |||
60 | /* CM_CLKEN_PLL_IVA2 */ | ||
61 | #define OMAP3430_IVA2_DPLL_RAMPTIME_SHIFT 8 | ||
62 | #define OMAP3430_IVA2_DPLL_RAMPTIME_MASK (0x3 << 8) | ||
63 | #define OMAP3430_IVA2_DPLL_FREQSEL_SHIFT 4 | ||
64 | #define OMAP3430_IVA2_DPLL_FREQSEL_MASK (0xf << 4) | ||
65 | #define OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT 3 | ||
66 | #define OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_MASK (1 << 3) | ||
67 | #define OMAP3430_EN_IVA2_DPLL_SHIFT 0 | ||
68 | #define OMAP3430_EN_IVA2_DPLL_MASK (0x7 << 0) | ||
69 | |||
70 | /* CM_IDLEST_IVA2 */ | ||
71 | #define OMAP3430_ST_IVA2 (1 << 0) | ||
72 | |||
73 | /* CM_IDLEST_PLL_IVA2 */ | ||
74 | #define OMAP3430_ST_IVA2_CLK (1 << 0) | ||
75 | |||
76 | /* CM_AUTOIDLE_PLL_IVA2 */ | ||
77 | #define OMAP3430_AUTO_IVA2_DPLL_SHIFT 0 | ||
78 | #define OMAP3430_AUTO_IVA2_DPLL_MASK (0x7 << 0) | ||
79 | |||
80 | /* CM_CLKSEL1_PLL_IVA2 */ | ||
81 | #define OMAP3430_IVA2_CLK_SRC_SHIFT 19 | ||
82 | #define OMAP3430_IVA2_CLK_SRC_MASK (0x3 << 19) | ||
83 | #define OMAP3430_IVA2_DPLL_MULT_SHIFT 8 | ||
84 | #define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8) | ||
85 | #define OMAP3430_IVA2_DPLL_DIV_SHIFT 0 | ||
86 | #define OMAP3430_IVA2_DPLL_DIV_MASK (0x7f << 0) | ||
87 | |||
88 | /* CM_CLKSEL2_PLL_IVA2 */ | ||
89 | #define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0 | ||
90 | #define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0) | ||
91 | |||
92 | /* CM_CLKSTCTRL_IVA2 */ | ||
93 | #define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0 | ||
94 | #define OMAP3430_CLKTRCTRL_IVA2_MASK (0x3 << 0) | ||
95 | |||
96 | /* CM_CLKSTST_IVA2 */ | ||
97 | #define OMAP3430_CLKACTIVITY_IVA2 (1 << 0) | ||
98 | |||
99 | /* CM_REVISION specific bits */ | ||
100 | |||
101 | /* CM_SYSCONFIG specific bits */ | ||
102 | |||
103 | /* CM_CLKEN_PLL_MPU */ | ||
104 | #define OMAP3430_MPU_DPLL_RAMPTIME_SHIFT 8 | ||
105 | #define OMAP3430_MPU_DPLL_RAMPTIME_MASK (0x3 << 8) | ||
106 | #define OMAP3430_MPU_DPLL_FREQSEL_SHIFT 4 | ||
107 | #define OMAP3430_MPU_DPLL_FREQSEL_MASK (0xf << 4) | ||
108 | #define OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT 3 | ||
109 | #define OMAP3430_EN_MPU_DPLL_DRIFTGUARD_MASK (1 << 3) | ||
110 | #define OMAP3430_EN_MPU_DPLL_SHIFT 0 | ||
111 | #define OMAP3430_EN_MPU_DPLL_MASK (0x7 << 0) | ||
112 | |||
113 | /* CM_IDLEST_MPU */ | ||
114 | #define OMAP3430_ST_MPU (1 << 0) | ||
115 | |||
116 | /* CM_IDLEST_PLL_MPU */ | ||
117 | #define OMAP3430_ST_MPU_CLK (1 << 0) | ||
118 | #define OMAP3430_ST_IVA2_CLK_MASK (1 << 0) | ||
119 | |||
120 | /* CM_IDLEST_PLL_MPU */ | ||
121 | #define OMAP3430_ST_MPU_CLK_MASK (1 << 0) | ||
122 | |||
123 | /* CM_AUTOIDLE_PLL_MPU */ | ||
124 | #define OMAP3430_AUTO_MPU_DPLL_SHIFT 0 | ||
125 | #define OMAP3430_AUTO_MPU_DPLL_MASK (0x7 << 0) | ||
126 | |||
127 | /* CM_CLKSEL1_PLL_MPU */ | ||
128 | #define OMAP3430_MPU_CLK_SRC_SHIFT 19 | ||
129 | #define OMAP3430_MPU_CLK_SRC_MASK (0x3 << 19) | ||
130 | #define OMAP3430_MPU_DPLL_MULT_SHIFT 8 | ||
131 | #define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8) | ||
132 | #define OMAP3430_MPU_DPLL_DIV_SHIFT 0 | ||
133 | #define OMAP3430_MPU_DPLL_DIV_MASK (0x7f << 0) | ||
134 | |||
135 | /* CM_CLKSEL2_PLL_MPU */ | ||
136 | #define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0 | ||
137 | #define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0) | ||
138 | |||
139 | /* CM_CLKSTCTRL_MPU */ | ||
140 | #define OMAP3430_CLKTRCTRL_MPU_SHIFT 0 | ||
141 | #define OMAP3430_CLKTRCTRL_MPU_MASK (0x3 << 0) | ||
142 | |||
143 | /* CM_CLKSTST_MPU */ | ||
144 | #define OMAP3430_CLKACTIVITY_MPU (1 << 0) | ||
145 | |||
146 | /* CM_FCLKEN1_CORE specific bits */ | ||
147 | |||
148 | /* CM_ICLKEN1_CORE specific bits */ | ||
149 | #define OMAP3430_EN_ICR (1 << 29) | ||
150 | #define OMAP3430_EN_ICR_SHIFT 29 | ||
151 | #define OMAP3430_EN_AES2 (1 << 28) | ||
152 | #define OMAP3430_EN_AES2_SHIFT 28 | ||
153 | #define OMAP3430_EN_SHA12 (1 << 27) | ||
154 | #define OMAP3430_EN_SHA12_SHIFT 27 | ||
155 | #define OMAP3430_EN_DES2 (1 << 26) | ||
156 | #define OMAP3430_EN_DES2_SHIFT 26 | ||
157 | #define OMAP3430ES1_EN_FAC (1 << 8) | ||
158 | #define OMAP3430ES1_EN_FAC_SHIFT 8 | ||
159 | #define OMAP3430_EN_MAILBOXES (1 << 7) | ||
160 | #define OMAP3430_EN_MAILBOXES_SHIFT 7 | ||
161 | #define OMAP3430_EN_OMAPCTRL (1 << 6) | ||
162 | #define OMAP3430_EN_OMAPCTRL_SHIFT 6 | ||
163 | #define OMAP3430_EN_SDRC (1 << 1) | ||
164 | #define OMAP3430_EN_SDRC_SHIFT 1 | ||
165 | |||
166 | /* CM_ICLKEN2_CORE */ | ||
167 | #define OMAP3430_EN_PKA (1 << 4) | ||
168 | #define OMAP3430_EN_PKA_SHIFT 4 | ||
169 | #define OMAP3430_EN_AES1 (1 << 3) | ||
170 | #define OMAP3430_EN_AES1_SHIFT 3 | ||
171 | #define OMAP3430_EN_RNG (1 << 2) | ||
172 | #define OMAP3430_EN_RNG_SHIFT 2 | ||
173 | #define OMAP3430_EN_SHA11 (1 << 1) | ||
174 | #define OMAP3430_EN_SHA11_SHIFT 1 | ||
175 | #define OMAP3430_EN_DES1 (1 << 0) | ||
176 | #define OMAP3430_EN_DES1_SHIFT 0 | ||
177 | |||
178 | /* CM_FCLKEN3_CORE specific bits */ | ||
179 | #define OMAP3430ES2_EN_TS_SHIFT 1 | ||
180 | #define OMAP3430ES2_EN_TS_MASK (1 << 1) | ||
181 | #define OMAP3430ES2_EN_CPEFUSE_SHIFT 0 | ||
182 | #define OMAP3430ES2_EN_CPEFUSE_MASK (1 << 0) | ||
183 | |||
184 | /* CM_IDLEST1_CORE specific bits */ | ||
185 | #define OMAP3430_ST_ICR (1 << 29) | ||
186 | #define OMAP3430_ST_AES2 (1 << 28) | ||
187 | #define OMAP3430_ST_SHA12 (1 << 27) | ||
188 | #define OMAP3430_ST_DES2 (1 << 26) | ||
189 | #define OMAP3430_ST_MSPRO (1 << 23) | ||
190 | #define OMAP3430_ST_HDQ (1 << 22) | ||
191 | #define OMAP3430ES1_ST_FAC (1 << 8) | ||
192 | #define OMAP3430ES1_ST_MAILBOXES (1 << 7) | ||
193 | #define OMAP3430_ST_OMAPCTRL (1 << 6) | ||
194 | #define OMAP3430_ST_SDMA (1 << 2) | ||
195 | #define OMAP3430_ST_SDRC (1 << 1) | ||
196 | #define OMAP3430_ST_SSI (1 << 0) | ||
197 | |||
198 | /* CM_IDLEST2_CORE */ | ||
199 | #define OMAP3430_ST_PKA (1 << 4) | ||
200 | #define OMAP3430_ST_AES1 (1 << 3) | ||
201 | #define OMAP3430_ST_RNG (1 << 2) | ||
202 | #define OMAP3430_ST_SHA11 (1 << 1) | ||
203 | #define OMAP3430_ST_DES1 (1 << 0) | ||
204 | |||
205 | /* CM_IDLEST3_CORE */ | ||
206 | #define OMAP3430ES2_ST_USBTLL_SHIFT 2 | ||
207 | #define OMAP3430ES2_ST_USBTLL_MASK (1 << 2) | ||
208 | |||
209 | /* CM_AUTOIDLE1_CORE */ | ||
210 | #define OMAP3430_AUTO_AES2 (1 << 28) | ||
211 | #define OMAP3430_AUTO_AES2_SHIFT 28 | ||
212 | #define OMAP3430_AUTO_SHA12 (1 << 27) | ||
213 | #define OMAP3430_AUTO_SHA12_SHIFT 27 | ||
214 | #define OMAP3430_AUTO_DES2 (1 << 26) | ||
215 | #define OMAP3430_AUTO_DES2_SHIFT 26 | ||
216 | #define OMAP3430_AUTO_MMC2 (1 << 25) | ||
217 | #define OMAP3430_AUTO_MMC2_SHIFT 25 | ||
218 | #define OMAP3430_AUTO_MMC1 (1 << 24) | ||
219 | #define OMAP3430_AUTO_MMC1_SHIFT 24 | ||
220 | #define OMAP3430_AUTO_MSPRO (1 << 23) | ||
221 | #define OMAP3430_AUTO_MSPRO_SHIFT 23 | ||
222 | #define OMAP3430_AUTO_HDQ (1 << 22) | ||
223 | #define OMAP3430_AUTO_HDQ_SHIFT 22 | ||
224 | #define OMAP3430_AUTO_MCSPI4 (1 << 21) | ||
225 | #define OMAP3430_AUTO_MCSPI4_SHIFT 21 | ||
226 | #define OMAP3430_AUTO_MCSPI3 (1 << 20) | ||
227 | #define OMAP3430_AUTO_MCSPI3_SHIFT 20 | ||
228 | #define OMAP3430_AUTO_MCSPI2 (1 << 19) | ||
229 | #define OMAP3430_AUTO_MCSPI2_SHIFT 19 | ||
230 | #define OMAP3430_AUTO_MCSPI1 (1 << 18) | ||
231 | #define OMAP3430_AUTO_MCSPI1_SHIFT 18 | ||
232 | #define OMAP3430_AUTO_I2C3 (1 << 17) | ||
233 | #define OMAP3430_AUTO_I2C3_SHIFT 17 | ||
234 | #define OMAP3430_AUTO_I2C2 (1 << 16) | ||
235 | #define OMAP3430_AUTO_I2C2_SHIFT 16 | ||
236 | #define OMAP3430_AUTO_I2C1 (1 << 15) | ||
237 | #define OMAP3430_AUTO_I2C1_SHIFT 15 | ||
238 | #define OMAP3430_AUTO_UART2 (1 << 14) | ||
239 | #define OMAP3430_AUTO_UART2_SHIFT 14 | ||
240 | #define OMAP3430_AUTO_UART1 (1 << 13) | ||
241 | #define OMAP3430_AUTO_UART1_SHIFT 13 | ||
242 | #define OMAP3430_AUTO_GPT11 (1 << 12) | ||
243 | #define OMAP3430_AUTO_GPT11_SHIFT 12 | ||
244 | #define OMAP3430_AUTO_GPT10 (1 << 11) | ||
245 | #define OMAP3430_AUTO_GPT10_SHIFT 11 | ||
246 | #define OMAP3430_AUTO_MCBSP5 (1 << 10) | ||
247 | #define OMAP3430_AUTO_MCBSP5_SHIFT 10 | ||
248 | #define OMAP3430_AUTO_MCBSP1 (1 << 9) | ||
249 | #define OMAP3430_AUTO_MCBSP1_SHIFT 9 | ||
250 | #define OMAP3430ES1_AUTO_FAC (1 << 8) | ||
251 | #define OMAP3430ES1_AUTO_FAC_SHIFT 8 | ||
252 | #define OMAP3430_AUTO_MAILBOXES (1 << 7) | ||
253 | #define OMAP3430_AUTO_MAILBOXES_SHIFT 7 | ||
254 | #define OMAP3430_AUTO_OMAPCTRL (1 << 6) | ||
255 | #define OMAP3430_AUTO_OMAPCTRL_SHIFT 6 | ||
256 | #define OMAP3430ES1_AUTO_FSHOSTUSB (1 << 5) | ||
257 | #define OMAP3430ES1_AUTO_FSHOSTUSB_SHIFT 5 | ||
258 | #define OMAP3430_AUTO_HSOTGUSB (1 << 4) | ||
259 | #define OMAP3430_AUTO_HSOTGUSB_SHIFT 4 | ||
260 | #define OMAP3430ES1_AUTO_D2D (1 << 3) | ||
261 | #define OMAP3430ES1_AUTO_D2D_SHIFT 3 | ||
262 | #define OMAP3430_AUTO_SSI (1 << 0) | ||
263 | #define OMAP3430_AUTO_SSI_SHIFT 0 | ||
264 | |||
265 | /* CM_AUTOIDLE2_CORE */ | ||
266 | #define OMAP3430_AUTO_PKA (1 << 4) | ||
267 | #define OMAP3430_AUTO_PKA_SHIFT 4 | ||
268 | #define OMAP3430_AUTO_AES1 (1 << 3) | ||
269 | #define OMAP3430_AUTO_AES1_SHIFT 3 | ||
270 | #define OMAP3430_AUTO_RNG (1 << 2) | ||
271 | #define OMAP3430_AUTO_RNG_SHIFT 2 | ||
272 | #define OMAP3430_AUTO_SHA11 (1 << 1) | ||
273 | #define OMAP3430_AUTO_SHA11_SHIFT 1 | ||
274 | #define OMAP3430_AUTO_DES1 (1 << 0) | ||
275 | #define OMAP3430_AUTO_DES1_SHIFT 0 | ||
276 | |||
277 | /* CM_AUTOIDLE3_CORE */ | ||
278 | #define OMAP3430ES2_AUTO_USBTLL_SHIFT 2 | ||
279 | #define OMAP3430ES2_AUTO_USBTLL_MASK (1 << 2) | ||
280 | |||
281 | /* CM_CLKSEL_CORE */ | ||
282 | #define OMAP3430_CLKSEL_SSI_SHIFT 8 | ||
283 | #define OMAP3430_CLKSEL_SSI_MASK (0xf << 8) | ||
284 | #define OMAP3430_CLKSEL_GPT11_MASK (1 << 7) | ||
285 | #define OMAP3430_CLKSEL_GPT11_SHIFT 7 | ||
286 | #define OMAP3430_CLKSEL_GPT10_MASK (1 << 6) | ||
287 | #define OMAP3430_CLKSEL_GPT10_SHIFT 6 | ||
288 | #define OMAP3430ES1_CLKSEL_FSHOSTUSB_SHIFT 4 | ||
289 | #define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4) | ||
290 | #define OMAP3430_CLKSEL_L4_SHIFT 2 | ||
291 | #define OMAP3430_CLKSEL_L4_MASK (0x3 << 2) | ||
292 | #define OMAP3430_CLKSEL_L3_SHIFT 0 | ||
293 | #define OMAP3430_CLKSEL_L3_MASK (0x3 << 0) | ||
294 | |||
295 | /* CM_CLKSTCTRL_CORE */ | ||
296 | #define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4 | ||
297 | #define OMAP3430ES1_CLKTRCTRL_D2D_MASK (0x3 << 4) | ||
298 | #define OMAP3430_CLKTRCTRL_L4_SHIFT 2 | ||
299 | #define OMAP3430_CLKTRCTRL_L4_MASK (0x3 << 2) | ||
300 | #define OMAP3430_CLKTRCTRL_L3_SHIFT 0 | ||
301 | #define OMAP3430_CLKTRCTRL_L3_MASK (0x3 << 0) | ||
302 | |||
303 | /* CM_CLKSTST_CORE */ | ||
304 | #define OMAP3430ES1_CLKACTIVITY_D2D (1 << 2) | ||
305 | #define OMAP3430_CLKACTIVITY_L4 (1 << 1) | ||
306 | #define OMAP3430_CLKACTIVITY_L3 (1 << 0) | ||
307 | |||
308 | /* CM_FCLKEN_GFX */ | ||
309 | #define OMAP3430ES1_EN_3D (1 << 2) | ||
310 | #define OMAP3430ES1_EN_3D_SHIFT 2 | ||
311 | #define OMAP3430ES1_EN_2D (1 << 1) | ||
312 | #define OMAP3430ES1_EN_2D_SHIFT 1 | ||
313 | |||
314 | /* CM_ICLKEN_GFX specific bits */ | ||
315 | |||
316 | /* CM_IDLEST_GFX specific bits */ | ||
317 | |||
318 | /* CM_CLKSEL_GFX specific bits */ | ||
319 | |||
320 | /* CM_SLEEPDEP_GFX specific bits */ | ||
321 | |||
322 | /* CM_CLKSTCTRL_GFX */ | ||
323 | #define OMAP3430ES1_CLKTRCTRL_GFX_SHIFT 0 | ||
324 | #define OMAP3430ES1_CLKTRCTRL_GFX_MASK (0x3 << 0) | ||
325 | |||
326 | /* CM_CLKSTST_GFX */ | ||
327 | #define OMAP3430ES1_CLKACTIVITY_GFX (1 << 0) | ||
328 | |||
329 | /* CM_FCLKEN_SGX */ | ||
330 | #define OMAP3430ES2_EN_SGX_SHIFT 1 | ||
331 | #define OMAP3430ES2_EN_SGX_MASK (1 << 1) | ||
332 | |||
333 | /* CM_CLKSEL_SGX */ | ||
334 | #define OMAP3430ES2_CLKSEL_SGX_SHIFT 0 | ||
335 | #define OMAP3430ES2_CLKSEL_SGX_MASK (0x7 << 0) | ||
336 | |||
337 | /* CM_FCLKEN_WKUP specific bits */ | ||
338 | #define OMAP3430ES2_EN_USIMOCP_SHIFT 9 | ||
339 | |||
340 | /* CM_ICLKEN_WKUP specific bits */ | ||
341 | #define OMAP3430_EN_WDT1 (1 << 4) | ||
342 | #define OMAP3430_EN_WDT1_SHIFT 4 | ||
343 | #define OMAP3430_EN_32KSYNC (1 << 2) | ||
344 | #define OMAP3430_EN_32KSYNC_SHIFT 2 | ||
345 | |||
346 | /* CM_IDLEST_WKUP specific bits */ | ||
347 | #define OMAP3430_ST_WDT2 (1 << 5) | ||
348 | #define OMAP3430_ST_WDT1 (1 << 4) | ||
349 | #define OMAP3430_ST_32KSYNC (1 << 2) | ||
350 | |||
351 | /* CM_AUTOIDLE_WKUP */ | ||
352 | #define OMAP3430_AUTO_WDT2 (1 << 5) | ||
353 | #define OMAP3430_AUTO_WDT2_SHIFT 5 | ||
354 | #define OMAP3430_AUTO_WDT1 (1 << 4) | ||
355 | #define OMAP3430_AUTO_WDT1_SHIFT 4 | ||
356 | #define OMAP3430_AUTO_GPIO1 (1 << 3) | ||
357 | #define OMAP3430_AUTO_GPIO1_SHIFT 3 | ||
358 | #define OMAP3430_AUTO_32KSYNC (1 << 2) | ||
359 | #define OMAP3430_AUTO_32KSYNC_SHIFT 2 | ||
360 | #define OMAP3430_AUTO_GPT12 (1 << 1) | ||
361 | #define OMAP3430_AUTO_GPT12_SHIFT 1 | ||
362 | #define OMAP3430_AUTO_GPT1 (1 << 0) | ||
363 | #define OMAP3430_AUTO_GPT1_SHIFT 0 | ||
364 | |||
365 | /* CM_CLKSEL_WKUP */ | ||
366 | #define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3) | ||
367 | #define OMAP3430_CLKSEL_RM_SHIFT 1 | ||
368 | #define OMAP3430_CLKSEL_RM_MASK (0x3 << 1) | ||
369 | #define OMAP3430_CLKSEL_GPT1_SHIFT 0 | ||
370 | #define OMAP3430_CLKSEL_GPT1_MASK (1 << 0) | ||
371 | |||
372 | /* CM_CLKEN_PLL */ | ||
373 | #define OMAP3430_PWRDN_EMU_PERIPH_SHIFT 31 | ||
374 | #define OMAP3430_PWRDN_CAM_SHIFT 30 | ||
375 | #define OMAP3430_PWRDN_DSS1_SHIFT 29 | ||
376 | #define OMAP3430_PWRDN_TV_SHIFT 28 | ||
377 | #define OMAP3430_PWRDN_96M_SHIFT 27 | ||
378 | #define OMAP3430_PERIPH_DPLL_RAMPTIME_SHIFT 24 | ||
379 | #define OMAP3430_PERIPH_DPLL_RAMPTIME_MASK (0x3 << 24) | ||
380 | #define OMAP3430_PERIPH_DPLL_FREQSEL_SHIFT 20 | ||
381 | #define OMAP3430_PERIPH_DPLL_FREQSEL_MASK (0xf << 20) | ||
382 | #define OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT 19 | ||
383 | #define OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_MASK (1 << 19) | ||
384 | #define OMAP3430_EN_PERIPH_DPLL_SHIFT 16 | ||
385 | #define OMAP3430_EN_PERIPH_DPLL_MASK (0x7 << 16) | ||
386 | #define OMAP3430_PWRDN_EMU_CORE_SHIFT 12 | ||
387 | #define OMAP3430_CORE_DPLL_RAMPTIME_SHIFT 8 | ||
388 | #define OMAP3430_CORE_DPLL_RAMPTIME_MASK (0x3 << 8) | ||
389 | #define OMAP3430_CORE_DPLL_FREQSEL_SHIFT 4 | ||
390 | #define OMAP3430_CORE_DPLL_FREQSEL_MASK (0xf << 4) | ||
391 | #define OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT 3 | ||
392 | #define OMAP3430_EN_CORE_DPLL_DRIFTGUARD_MASK (1 << 3) | ||
393 | #define OMAP3430_EN_CORE_DPLL_SHIFT 0 | ||
394 | #define OMAP3430_EN_CORE_DPLL_MASK (0x7 << 0) | ||
395 | |||
396 | /* CM_CLKEN2_PLL */ | ||
397 | #define OMAP3430ES2_EN_PERIPH2_DPLL_LPMODE_SHIFT 10 | ||
398 | #define OMAP3430ES2_PERIPH2_DPLL_RAMPTIME_MASK (0x3 << 8) | ||
399 | #define OMAP3430ES2_PERIPH2_DPLL_FREQSEL_SHIFT 4 | ||
400 | #define OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK (0xf << 4) | ||
401 | #define OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT 3 | ||
402 | #define OMAP3430ES2_EN_PERIPH2_DPLL_SHIFT 0 | ||
403 | #define OMAP3430ES2_EN_PERIPH2_DPLL_MASK (0x7 << 0) | ||
404 | |||
405 | /* CM_IDLEST_CKGEN */ | ||
406 | #define OMAP3430_ST_54M_CLK (1 << 5) | ||
407 | #define OMAP3430_ST_12M_CLK (1 << 4) | ||
408 | #define OMAP3430_ST_48M_CLK (1 << 3) | ||
409 | #define OMAP3430_ST_96M_CLK (1 << 2) | ||
410 | #define OMAP3430_ST_PERIPH_CLK (1 << 1) | ||
411 | #define OMAP3430_ST_CORE_CLK (1 << 0) | ||
412 | |||
413 | /* CM_IDLEST2_CKGEN */ | ||
414 | #define OMAP3430ES2_ST_120M_CLK_SHIFT 1 | ||
415 | #define OMAP3430ES2_ST_120M_CLK_MASK (1 << 1) | ||
416 | #define OMAP3430ES2_ST_PERIPH2_CLK_SHIFT 0 | ||
417 | #define OMAP3430ES2_ST_PERIPH2_CLK_MASK (1 << 0) | ||
418 | |||
419 | /* CM_AUTOIDLE_PLL */ | ||
420 | #define OMAP3430_AUTO_PERIPH_DPLL_SHIFT 3 | ||
421 | #define OMAP3430_AUTO_PERIPH_DPLL_MASK (0x7 << 3) | ||
422 | #define OMAP3430_AUTO_CORE_DPLL_SHIFT 0 | ||
423 | #define OMAP3430_AUTO_CORE_DPLL_MASK (0x7 << 0) | ||
424 | |||
425 | /* CM_CLKSEL1_PLL */ | ||
426 | /* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ | ||
427 | #define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 | ||
428 | #define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27) | ||
429 | #define OMAP3430_CORE_DPLL_MULT_SHIFT 16 | ||
430 | #define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16) | ||
431 | #define OMAP3430_CORE_DPLL_DIV_SHIFT 8 | ||
432 | #define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8) | ||
433 | #define OMAP3430_SOURCE_54M (1 << 5) | ||
434 | #define OMAP3430_SOURCE_48M (1 << 3) | ||
435 | |||
436 | /* CM_CLKSEL2_PLL */ | ||
437 | #define OMAP3430_PERIPH_DPLL_MULT_SHIFT 8 | ||
438 | #define OMAP3430_PERIPH_DPLL_MULT_MASK (0x7ff << 8) | ||
439 | #define OMAP3430_PERIPH_DPLL_DIV_SHIFT 0 | ||
440 | #define OMAP3430_PERIPH_DPLL_DIV_MASK (0x7f << 0) | ||
441 | |||
442 | /* CM_CLKSEL3_PLL */ | ||
443 | #define OMAP3430_DIV_96M_SHIFT 0 | ||
444 | #define OMAP3430_DIV_96M_MASK (0x1f << 0) | ||
445 | |||
446 | /* CM_CLKSEL4_PLL */ | ||
447 | #define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8 | ||
448 | #define OMAP3430ES2_PERIPH2_DPLL_MULT_MASK (0x7ff << 8) | ||
449 | #define OMAP3430ES2_PERIPH2_DPLL_DIV_SHIFT 0 | ||
450 | #define OMAP3430ES2_PERIPH2_DPLL_DIV_MASK (0x7f << 0) | ||
451 | |||
452 | /* CM_CLKSEL5_PLL */ | ||
453 | #define OMAP3430ES2_DIV_120M_SHIFT 0 | ||
454 | #define OMAP3430ES2_DIV_120M_MASK (0x1f << 0) | ||
455 | |||
456 | /* CM_CLKOUT_CTRL */ | ||
457 | #define OMAP3430_CLKOUT2_EN_SHIFT 7 | ||
458 | #define OMAP3430_CLKOUT2_EN (1 << 7) | ||
459 | #define OMAP3430_CLKOUT2_DIV_SHIFT 3 | ||
460 | #define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3) | ||
461 | #define OMAP3430_CLKOUT2SOURCE_SHIFT 0 | ||
462 | #define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0) | ||
463 | |||
464 | /* CM_FCLKEN_DSS */ | ||
465 | #define OMAP3430_EN_TV (1 << 2) | ||
466 | #define OMAP3430_EN_TV_SHIFT 2 | ||
467 | #define OMAP3430_EN_DSS2 (1 << 1) | ||
468 | #define OMAP3430_EN_DSS2_SHIFT 1 | ||
469 | #define OMAP3430_EN_DSS1 (1 << 0) | ||
470 | #define OMAP3430_EN_DSS1_SHIFT 0 | ||
471 | |||
472 | /* CM_ICLKEN_DSS */ | ||
473 | #define OMAP3430_CM_ICLKEN_DSS_EN_DSS (1 << 0) | ||
474 | #define OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT 0 | ||
475 | |||
476 | /* CM_IDLEST_DSS */ | ||
477 | #define OMAP3430_ST_DSS (1 << 0) | ||
478 | |||
479 | /* CM_AUTOIDLE_DSS */ | ||
480 | #define OMAP3430_AUTO_DSS (1 << 0) | ||
481 | #define OMAP3430_AUTO_DSS_SHIFT 0 | ||
482 | |||
483 | /* CM_CLKSEL_DSS */ | ||
484 | #define OMAP3430_CLKSEL_TV_SHIFT 8 | ||
485 | #define OMAP3430_CLKSEL_TV_MASK (0x1f << 8) | ||
486 | #define OMAP3430_CLKSEL_DSS1_SHIFT 0 | ||
487 | #define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0) | ||
488 | |||
489 | /* CM_SLEEPDEP_DSS specific bits */ | ||
490 | |||
491 | /* CM_CLKSTCTRL_DSS */ | ||
492 | #define OMAP3430_CLKTRCTRL_DSS_SHIFT 0 | ||
493 | #define OMAP3430_CLKTRCTRL_DSS_MASK (0x3 << 0) | ||
494 | |||
495 | /* CM_CLKSTST_DSS */ | ||
496 | #define OMAP3430_CLKACTIVITY_DSS (1 << 0) | ||
497 | |||
498 | /* CM_FCLKEN_CAM specific bits */ | ||
499 | |||
500 | /* CM_ICLKEN_CAM specific bits */ | ||
501 | |||
502 | /* CM_IDLEST_CAM */ | ||
503 | #define OMAP3430_ST_CAM (1 << 0) | ||
504 | |||
505 | /* CM_AUTOIDLE_CAM */ | ||
506 | #define OMAP3430_AUTO_CAM (1 << 0) | ||
507 | #define OMAP3430_AUTO_CAM_SHIFT 0 | ||
508 | |||
509 | /* CM_CLKSEL_CAM */ | ||
510 | #define OMAP3430_CLKSEL_CAM_SHIFT 0 | ||
511 | #define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0) | ||
512 | |||
513 | /* CM_SLEEPDEP_CAM specific bits */ | ||
514 | |||
515 | /* CM_CLKSTCTRL_CAM */ | ||
516 | #define OMAP3430_CLKTRCTRL_CAM_SHIFT 0 | ||
517 | #define OMAP3430_CLKTRCTRL_CAM_MASK (0x3 << 0) | ||
518 | |||
519 | /* CM_CLKSTST_CAM */ | ||
520 | #define OMAP3430_CLKACTIVITY_CAM (1 << 0) | ||
521 | |||
522 | /* CM_FCLKEN_PER specific bits */ | ||
523 | |||
524 | /* CM_ICLKEN_PER specific bits */ | ||
525 | |||
526 | /* CM_IDLEST_PER */ | ||
527 | #define OMAP3430_ST_WDT3 (1 << 12) | ||
528 | #define OMAP3430_ST_MCBSP4 (1 << 2) | ||
529 | #define OMAP3430_ST_MCBSP3 (1 << 1) | ||
530 | #define OMAP3430_ST_MCBSP2 (1 << 0) | ||
531 | |||
532 | /* CM_AUTOIDLE_PER */ | ||
533 | #define OMAP3430_AUTO_GPIO6 (1 << 17) | ||
534 | #define OMAP3430_AUTO_GPIO6_SHIFT 17 | ||
535 | #define OMAP3430_AUTO_GPIO5 (1 << 16) | ||
536 | #define OMAP3430_AUTO_GPIO5_SHIFT 16 | ||
537 | #define OMAP3430_AUTO_GPIO4 (1 << 15) | ||
538 | #define OMAP3430_AUTO_GPIO4_SHIFT 15 | ||
539 | #define OMAP3430_AUTO_GPIO3 (1 << 14) | ||
540 | #define OMAP3430_AUTO_GPIO3_SHIFT 14 | ||
541 | #define OMAP3430_AUTO_GPIO2 (1 << 13) | ||
542 | #define OMAP3430_AUTO_GPIO2_SHIFT 13 | ||
543 | #define OMAP3430_AUTO_WDT3 (1 << 12) | ||
544 | #define OMAP3430_AUTO_WDT3_SHIFT 12 | ||
545 | #define OMAP3430_AUTO_UART3 (1 << 11) | ||
546 | #define OMAP3430_AUTO_UART3_SHIFT 11 | ||
547 | #define OMAP3430_AUTO_GPT9 (1 << 10) | ||
548 | #define OMAP3430_AUTO_GPT9_SHIFT 10 | ||
549 | #define OMAP3430_AUTO_GPT8 (1 << 9) | ||
550 | #define OMAP3430_AUTO_GPT8_SHIFT 9 | ||
551 | #define OMAP3430_AUTO_GPT7 (1 << 8) | ||
552 | #define OMAP3430_AUTO_GPT7_SHIFT 8 | ||
553 | #define OMAP3430_AUTO_GPT6 (1 << 7) | ||
554 | #define OMAP3430_AUTO_GPT6_SHIFT 7 | ||
555 | #define OMAP3430_AUTO_GPT5 (1 << 6) | ||
556 | #define OMAP3430_AUTO_GPT5_SHIFT 6 | ||
557 | #define OMAP3430_AUTO_GPT4 (1 << 5) | ||
558 | #define OMAP3430_AUTO_GPT4_SHIFT 5 | ||
559 | #define OMAP3430_AUTO_GPT3 (1 << 4) | ||
560 | #define OMAP3430_AUTO_GPT3_SHIFT 4 | ||
561 | #define OMAP3430_AUTO_GPT2 (1 << 3) | ||
562 | #define OMAP3430_AUTO_GPT2_SHIFT 3 | ||
563 | #define OMAP3430_AUTO_MCBSP4 (1 << 2) | ||
564 | #define OMAP3430_AUTO_MCBSP4_SHIFT 2 | ||
565 | #define OMAP3430_AUTO_MCBSP3 (1 << 1) | ||
566 | #define OMAP3430_AUTO_MCBSP3_SHIFT 1 | ||
567 | #define OMAP3430_AUTO_MCBSP2 (1 << 0) | ||
568 | #define OMAP3430_AUTO_MCBSP2_SHIFT 0 | ||
569 | |||
570 | /* CM_CLKSEL_PER */ | ||
571 | #define OMAP3430_CLKSEL_GPT9_MASK (1 << 7) | ||
572 | #define OMAP3430_CLKSEL_GPT9_SHIFT 7 | ||
573 | #define OMAP3430_CLKSEL_GPT8_MASK (1 << 6) | ||
574 | #define OMAP3430_CLKSEL_GPT8_SHIFT 6 | ||
575 | #define OMAP3430_CLKSEL_GPT7_MASK (1 << 5) | ||
576 | #define OMAP3430_CLKSEL_GPT7_SHIFT 5 | ||
577 | #define OMAP3430_CLKSEL_GPT6_MASK (1 << 4) | ||
578 | #define OMAP3430_CLKSEL_GPT6_SHIFT 4 | ||
579 | #define OMAP3430_CLKSEL_GPT5_MASK (1 << 3) | ||
580 | #define OMAP3430_CLKSEL_GPT5_SHIFT 3 | ||
581 | #define OMAP3430_CLKSEL_GPT4_MASK (1 << 2) | ||
582 | #define OMAP3430_CLKSEL_GPT4_SHIFT 2 | ||
583 | #define OMAP3430_CLKSEL_GPT3_MASK (1 << 1) | ||
584 | #define OMAP3430_CLKSEL_GPT3_SHIFT 1 | ||
585 | #define OMAP3430_CLKSEL_GPT2_MASK (1 << 0) | ||
586 | #define OMAP3430_CLKSEL_GPT2_SHIFT 0 | ||
587 | |||
588 | /* CM_SLEEPDEP_PER specific bits */ | ||
589 | #define OMAP3430_CM_SLEEPDEP_PER_EN_IVA2 (1 << 2) | ||
590 | |||
591 | /* CM_CLKSTCTRL_PER */ | ||
592 | #define OMAP3430_CLKTRCTRL_PER_SHIFT 0 | ||
593 | #define OMAP3430_CLKTRCTRL_PER_MASK (0x3 << 0) | ||
594 | |||
595 | /* CM_CLKSTST_PER */ | ||
596 | #define OMAP3430_CLKACTIVITY_PER (1 << 0) | ||
597 | |||
598 | /* CM_CLKSEL1_EMU */ | ||
599 | #define OMAP3430_DIV_DPLL4_SHIFT 24 | ||
600 | #define OMAP3430_DIV_DPLL4_MASK (0x1f << 24) | ||
601 | #define OMAP3430_DIV_DPLL3_SHIFT 16 | ||
602 | #define OMAP3430_DIV_DPLL3_MASK (0x1f << 16) | ||
603 | #define OMAP3430_CLKSEL_TRACECLK_SHIFT 11 | ||
604 | #define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11) | ||
605 | #define OMAP3430_CLKSEL_PCLK_SHIFT 8 | ||
606 | #define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8) | ||
607 | #define OMAP3430_CLKSEL_PCLKX2_SHIFT 6 | ||
608 | #define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6) | ||
609 | #define OMAP3430_CLKSEL_ATCLK_SHIFT 4 | ||
610 | #define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4) | ||
611 | #define OMAP3430_TRACE_MUX_CTRL_SHIFT 2 | ||
612 | #define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2) | ||
613 | #define OMAP3430_MUX_CTRL_SHIFT 0 | ||
614 | #define OMAP3430_MUX_CTRL_MASK (0x3 << 0) | ||
615 | |||
616 | /* CM_CLKSTCTRL_EMU */ | ||
617 | #define OMAP3430_CLKTRCTRL_EMU_SHIFT 0 | ||
618 | #define OMAP3430_CLKTRCTRL_EMU_MASK (0x3 << 0) | ||
619 | |||
620 | /* CM_CLKSTST_EMU */ | ||
621 | #define OMAP3430_CLKACTIVITY_EMU (1 << 0) | ||
622 | |||
623 | /* CM_CLKSEL2_EMU specific bits */ | ||
624 | #define OMAP3430_CORE_DPLL_EMU_MULT_SHIFT 8 | ||
625 | #define OMAP3430_CORE_DPLL_EMU_MULT_MASK (0x7ff << 8) | ||
626 | #define OMAP3430_CORE_DPLL_EMU_DIV_SHIFT 0 | ||
627 | #define OMAP3430_CORE_DPLL_EMU_DIV_MASK (0x7f << 0) | ||
628 | |||
629 | /* CM_CLKSEL3_EMU specific bits */ | ||
630 | #define OMAP3430_PERIPH_DPLL_EMU_MULT_SHIFT 8 | ||
631 | #define OMAP3430_PERIPH_DPLL_EMU_MULT_MASK (0x7ff << 8) | ||
632 | #define OMAP3430_PERIPH_DPLL_EMU_DIV_SHIFT 0 | ||
633 | #define OMAP3430_PERIPH_DPLL_EMU_DIV_MASK (0x7f << 0) | ||
634 | |||
635 | /* CM_POLCTRL */ | ||
636 | #define OMAP3430_CLKOUT2_POL (1 << 0) | ||
637 | |||
638 | /* CM_IDLEST_NEON */ | ||
639 | #define OMAP3430_ST_NEON (1 << 0) | ||
640 | |||
641 | /* CM_CLKSTCTRL_NEON */ | ||
642 | #define OMAP3430_CLKTRCTRL_NEON_SHIFT 0 | ||
643 | #define OMAP3430_CLKTRCTRL_NEON_MASK (0x3 << 0) | ||
644 | |||
645 | /* CM_FCLKEN_USBHOST */ | ||
646 | #define OMAP3430ES2_EN_USBHOST2_SHIFT 1 | ||
647 | #define OMAP3430ES2_EN_USBHOST2_MASK (1 << 1) | ||
648 | #define OMAP3430ES2_EN_USBHOST1_SHIFT 0 | ||
649 | #define OMAP3430ES2_EN_USBHOST1_MASK (1 << 0) | ||
650 | |||
651 | /* CM_ICLKEN_USBHOST */ | ||
652 | #define OMAP3430ES2_EN_USBHOST_SHIFT 0 | ||
653 | #define OMAP3430ES2_EN_USBHOST_MASK (1 << 0) | ||
654 | |||
655 | /* CM_IDLEST_USBHOST */ | ||
656 | |||
657 | /* CM_AUTOIDLE_USBHOST */ | ||
658 | #define OMAP3430ES2_AUTO_USBHOST_SHIFT 0 | ||
659 | #define OMAP3430ES2_AUTO_USBHOST_MASK (1 << 0) | ||
660 | |||
661 | /* CM_SLEEPDEP_USBHOST */ | ||
662 | #define OMAP3430ES2_EN_MPU_SHIFT 1 | ||
663 | #define OMAP3430ES2_EN_MPU_MASK (1 << 1) | ||
664 | #define OMAP3430ES2_EN_IVA2_SHIFT 2 | ||
665 | #define OMAP3430ES2_EN_IVA2_MASK (1 << 2) | ||
666 | |||
667 | /* CM_CLKSTCTRL_USBHOST */ | ||
668 | #define OMAP3430ES2_CLKTRCTRL_USBHOST_SHIFT 0 | ||
669 | #define OMAP3430ES2_CLKTRCTRL_USBHOST_MASK (3 << 0) | ||
670 | |||
671 | |||
672 | |||
673 | #endif | ||
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h new file mode 100644 index 000000000000..8489f3029fed --- /dev/null +++ b/arch/arm/mach-omap2/cm.h | |||
@@ -0,0 +1,124 @@ | |||
1 | #ifndef __ARCH_ASM_MACH_OMAP2_CM_H | ||
2 | #define __ARCH_ASM_MACH_OMAP2_CM_H | ||
3 | |||
4 | /* | ||
5 | * OMAP2/3 Clock Management (CM) register definitions | ||
6 | * | ||
7 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007-2008 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include "prcm-common.h" | ||
18 | |||
19 | #ifndef __ASSEMBLER__ | ||
20 | #define OMAP_CM_REGADDR(module, reg) \ | ||
21 | (void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg)) | ||
22 | #else | ||
23 | #define OMAP2420_CM_REGADDR(module, reg) \ | ||
24 | IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg)) | ||
25 | #define OMAP2430_CM_REGADDR(module, reg) \ | ||
26 | IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg)) | ||
27 | #define OMAP34XX_CM_REGADDR(module, reg) \ | ||
28 | IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) | ||
29 | #endif | ||
30 | |||
31 | /* | ||
32 | * Architecture-specific global CM registers | ||
33 | * Use cm_{read,write}_reg() with these registers. | ||
34 | * These registers appear once per CM module. | ||
35 | */ | ||
36 | |||
37 | #define OMAP3430_CM_REVISION OMAP_CM_REGADDR(OCP_MOD, 0x0000) | ||
38 | #define OMAP3430_CM_SYSCONFIG OMAP_CM_REGADDR(OCP_MOD, 0x0010) | ||
39 | #define OMAP3430_CM_POLCTRL OMAP_CM_REGADDR(OCP_MOD, 0x009c) | ||
40 | |||
41 | #define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | ||
42 | |||
43 | /* | ||
44 | * Module specific CM registers from CM_BASE + domain offset | ||
45 | * Use cm_{read,write}_mod_reg() with these registers. | ||
46 | * These register offsets generally appear in more than one PRCM submodule. | ||
47 | */ | ||
48 | |||
49 | /* Common between 24xx and 34xx */ | ||
50 | |||
51 | #define CM_FCLKEN 0x0000 | ||
52 | #define CM_FCLKEN1 CM_FCLKEN | ||
53 | #define CM_CLKEN CM_FCLKEN | ||
54 | #define CM_ICLKEN 0x0010 | ||
55 | #define CM_ICLKEN1 CM_ICLKEN | ||
56 | #define CM_ICLKEN2 0x0014 | ||
57 | #define CM_ICLKEN3 0x0018 | ||
58 | #define CM_IDLEST 0x0020 | ||
59 | #define CM_IDLEST1 CM_IDLEST | ||
60 | #define CM_IDLEST2 0x0024 | ||
61 | #define CM_AUTOIDLE 0x0030 | ||
62 | #define CM_AUTOIDLE1 CM_AUTOIDLE | ||
63 | #define CM_AUTOIDLE2 0x0034 | ||
64 | #define CM_AUTOIDLE3 0x0038 | ||
65 | #define CM_CLKSEL 0x0040 | ||
66 | #define CM_CLKSEL1 CM_CLKSEL | ||
67 | #define CM_CLKSEL2 0x0044 | ||
68 | #define CM_CLKSTCTRL 0x0048 | ||
69 | |||
70 | |||
71 | /* Architecture-specific registers */ | ||
72 | |||
73 | #define OMAP24XX_CM_FCLKEN2 0x0004 | ||
74 | #define OMAP24XX_CM_ICLKEN4 0x001c | ||
75 | #define OMAP24XX_CM_AUTOIDLE4 0x003c | ||
76 | |||
77 | #define OMAP2430_CM_IDLEST3 0x0028 | ||
78 | |||
79 | #define OMAP3430_CM_CLKEN_PLL 0x0004 | ||
80 | #define OMAP3430ES2_CM_CLKEN2 0x0004 | ||
81 | #define OMAP3430ES2_CM_FCLKEN3 0x0008 | ||
82 | #define OMAP3430_CM_IDLEST_PLL CM_IDLEST2 | ||
83 | #define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2 | ||
84 | #define OMAP3430_CM_CLKSEL1 CM_CLKSEL | ||
85 | #define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL | ||
86 | #define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2 | ||
87 | #define OMAP3430_CM_SLEEPDEP CM_CLKSEL2 | ||
88 | #define OMAP3430_CM_CLKSEL3 CM_CLKSTCTRL | ||
89 | #define OMAP3430_CM_CLKSTST 0x004c | ||
90 | #define OMAP3430ES2_CM_CLKSEL4 0x004c | ||
91 | #define OMAP3430ES2_CM_CLKSEL5 0x0050 | ||
92 | #define OMAP3430_CM_CLKSEL2_EMU 0x0050 | ||
93 | #define OMAP3430_CM_CLKSEL3_EMU 0x0054 | ||
94 | |||
95 | |||
96 | /* Clock management domain register get/set */ | ||
97 | |||
98 | #ifndef __ASSEMBLER__ | ||
99 | static inline void cm_write_mod_reg(u32 val, s16 module, s16 idx) | ||
100 | { | ||
101 | __raw_writel(val, OMAP_CM_REGADDR(module, idx)); | ||
102 | } | ||
103 | |||
104 | static inline u32 cm_read_mod_reg(s16 module, s16 idx) | ||
105 | { | ||
106 | return __raw_readl(OMAP_CM_REGADDR(module, idx)); | ||
107 | } | ||
108 | #endif | ||
109 | |||
110 | /* CM register bits shared between 24XX and 3430 */ | ||
111 | |||
112 | /* CM_CLKSEL_GFX */ | ||
113 | #define OMAP_CLKSEL_GFX_SHIFT 0 | ||
114 | #define OMAP_CLKSEL_GFX_MASK (0x7 << 0) | ||
115 | |||
116 | /* CM_ICLKEN_GFX */ | ||
117 | #define OMAP_EN_GFX_SHIFT 0 | ||
118 | #define OMAP_EN_GFX (1 << 0) | ||
119 | |||
120 | /* CM_IDLEST_GFX */ | ||
121 | #define OMAP_ST_GFX (1 << 0) | ||
122 | |||
123 | |||
124 | #endif | ||
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c new file mode 100644 index 000000000000..a5d86a49c213 --- /dev/null +++ b/arch/arm/mach-omap2/control.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * OMAP2/3 System Control Module register access | ||
3 | * | ||
4 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2007 Nokia Corporation | ||
6 | * | ||
7 | * Written by Paul Walmsley | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #undef DEBUG | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | |||
17 | #include <asm/io.h> | ||
18 | |||
19 | #include <asm/arch/control.h> | ||
20 | |||
21 | static u32 omap2_ctrl_base; | ||
22 | |||
23 | #define OMAP_CTRL_REGADDR(reg) (void __iomem *)IO_ADDRESS(omap2_ctrl_base \ | ||
24 | + (reg)) | ||
25 | |||
26 | void omap_ctrl_base_set(u32 base) | ||
27 | { | ||
28 | omap2_ctrl_base = base; | ||
29 | } | ||
30 | |||
31 | u32 omap_ctrl_base_get(void) | ||
32 | { | ||
33 | return omap2_ctrl_base; | ||
34 | } | ||
35 | |||
36 | u8 omap_ctrl_readb(u16 offset) | ||
37 | { | ||
38 | return __raw_readb(OMAP_CTRL_REGADDR(offset)); | ||
39 | } | ||
40 | |||
41 | u16 omap_ctrl_readw(u16 offset) | ||
42 | { | ||
43 | return __raw_readw(OMAP_CTRL_REGADDR(offset)); | ||
44 | } | ||
45 | |||
46 | u32 omap_ctrl_readl(u16 offset) | ||
47 | { | ||
48 | return __raw_readl(OMAP_CTRL_REGADDR(offset)); | ||
49 | } | ||
50 | |||
51 | void omap_ctrl_writeb(u8 val, u16 offset) | ||
52 | { | ||
53 | pr_debug("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n", val, | ||
54 | (u32)OMAP_CTRL_REGADDR(offset)); | ||
55 | |||
56 | __raw_writeb(val, OMAP_CTRL_REGADDR(offset)); | ||
57 | } | ||
58 | |||
59 | void omap_ctrl_writew(u16 val, u16 offset) | ||
60 | { | ||
61 | pr_debug("omap_ctrl_writew: writing 0x%0x to 0x%0x\n", val, | ||
62 | (u32)OMAP_CTRL_REGADDR(offset)); | ||
63 | |||
64 | __raw_writew(val, OMAP_CTRL_REGADDR(offset)); | ||
65 | } | ||
66 | |||
67 | void omap_ctrl_writel(u32 val, u16 offset) | ||
68 | { | ||
69 | pr_debug("omap_ctrl_writel: writing 0x%0x to 0x%0x\n", val, | ||
70 | (u32)OMAP_CTRL_REGADDR(offset)); | ||
71 | |||
72 | __raw_writel(val, OMAP_CTRL_REGADDR(offset)); | ||
73 | } | ||
74 | |||
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 5a4cc2076a7d..02cede295e89 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -69,7 +69,7 @@ static void __iomem *gpmc_base = | |||
69 | static void __iomem *gpmc_cs_base = | 69 | static void __iomem *gpmc_cs_base = |
70 | (void __iomem *) IO_ADDRESS(GPMC_BASE) + GPMC_CS0; | 70 | (void __iomem *) IO_ADDRESS(GPMC_BASE) + GPMC_CS0; |
71 | 71 | ||
72 | static struct clk *gpmc_l3_clk; | 72 | static struct clk *gpmc_fck; |
73 | 73 | ||
74 | static void gpmc_write_reg(int idx, u32 val) | 74 | static void gpmc_write_reg(int idx, u32 val) |
75 | { | 75 | { |
@@ -94,11 +94,10 @@ u32 gpmc_cs_read_reg(int cs, int idx) | |||
94 | return __raw_readl(gpmc_cs_base + (cs * GPMC_CS_SIZE) + idx); | 94 | return __raw_readl(gpmc_cs_base + (cs * GPMC_CS_SIZE) + idx); |
95 | } | 95 | } |
96 | 96 | ||
97 | /* TODO: Add support for gpmc_fck to clock framework and use it */ | ||
98 | unsigned long gpmc_get_fclk_period(void) | 97 | unsigned long gpmc_get_fclk_period(void) |
99 | { | 98 | { |
100 | /* In picoseconds */ | 99 | /* In picoseconds */ |
101 | return 1000000000 / ((clk_get_rate(gpmc_l3_clk)) / 1000); | 100 | return 1000000000 / ((clk_get_rate(gpmc_fck)) / 1000); |
102 | } | 101 | } |
103 | 102 | ||
104 | unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | 103 | unsigned int gpmc_ns_to_ticks(unsigned int time_ns) |
@@ -398,8 +397,11 @@ void __init gpmc_init(void) | |||
398 | { | 397 | { |
399 | u32 l; | 398 | u32 l; |
400 | 399 | ||
401 | gpmc_l3_clk = clk_get(NULL, "core_l3_ck"); | 400 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ |
402 | BUG_ON(IS_ERR(gpmc_l3_clk)); | 401 | if (IS_ERR(gpmc_fck)) |
402 | WARN_ON(1); | ||
403 | else | ||
404 | clk_enable(gpmc_fck); | ||
403 | 405 | ||
404 | l = gpmc_read_reg(GPMC_REVISION); | 406 | l = gpmc_read_reg(GPMC_REVISION); |
405 | printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f); | 407 | printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f); |
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c index 3e5d8cd4ea4f..12479081881a 100644 --- a/arch/arm/mach-omap2/memory.c +++ b/arch/arm/mach-omap2/memory.c | |||
@@ -27,11 +27,16 @@ | |||
27 | #include <asm/arch/clock.h> | 27 | #include <asm/arch/clock.h> |
28 | #include <asm/arch/sram.h> | 28 | #include <asm/arch/sram.h> |
29 | 29 | ||
30 | #include "prcm-regs.h" | 30 | #include "prm.h" |
31 | |||
31 | #include "memory.h" | 32 | #include "memory.h" |
33 | #include "sdrc.h" | ||
32 | 34 | ||
35 | unsigned long omap2_sdrc_base; | ||
36 | unsigned long omap2_sms_base; | ||
33 | 37 | ||
34 | static struct memory_timings mem_timings; | 38 | static struct memory_timings mem_timings; |
39 | static u32 curr_perf_level = CORE_CLK_SRC_DPLL_X2; | ||
35 | 40 | ||
36 | u32 omap2_memory_get_slow_dll_ctrl(void) | 41 | u32 omap2_memory_get_slow_dll_ctrl(void) |
37 | { | 42 | { |
@@ -48,12 +53,60 @@ u32 omap2_memory_get_type(void) | |||
48 | return mem_timings.m_type; | 53 | return mem_timings.m_type; |
49 | } | 54 | } |
50 | 55 | ||
56 | /* | ||
57 | * Check the DLL lock state, and return tue if running in unlock mode. | ||
58 | * This is needed to compensate for the shifted DLL value in unlock mode. | ||
59 | */ | ||
60 | u32 omap2_dll_force_needed(void) | ||
61 | { | ||
62 | /* dlla and dllb are a set */ | ||
63 | u32 dll_state = sdrc_read_reg(SDRC_DLLA_CTRL); | ||
64 | |||
65 | if ((dll_state & (1 << 2)) == (1 << 2)) | ||
66 | return 1; | ||
67 | else | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * 'level' is the value to store to CM_CLKSEL2_PLL.CORE_CLK_SRC. | ||
73 | * Practical values are CORE_CLK_SRC_DPLL (for CORE_CLK = DPLL_CLK) or | ||
74 | * CORE_CLK_SRC_DPLL_X2 (for CORE_CLK = * DPLL_CLK * 2) | ||
75 | */ | ||
76 | u32 omap2_reprogram_sdrc(u32 level, u32 force) | ||
77 | { | ||
78 | u32 dll_ctrl, m_type; | ||
79 | u32 prev = curr_perf_level; | ||
80 | unsigned long flags; | ||
81 | |||
82 | if ((curr_perf_level == level) && !force) | ||
83 | return prev; | ||
84 | |||
85 | if (level == CORE_CLK_SRC_DPLL) { | ||
86 | dll_ctrl = omap2_memory_get_slow_dll_ctrl(); | ||
87 | } else if (level == CORE_CLK_SRC_DPLL_X2) { | ||
88 | dll_ctrl = omap2_memory_get_fast_dll_ctrl(); | ||
89 | } else { | ||
90 | return prev; | ||
91 | } | ||
92 | |||
93 | m_type = omap2_memory_get_type(); | ||
94 | |||
95 | local_irq_save(flags); | ||
96 | __raw_writel(0xffff, OMAP24XX_PRCM_VOLTSETUP); | ||
97 | omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type); | ||
98 | curr_perf_level = level; | ||
99 | local_irq_restore(flags); | ||
100 | |||
101 | return prev; | ||
102 | } | ||
103 | |||
51 | void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | 104 | void omap2_init_memory_params(u32 force_lock_to_unlock_mode) |
52 | { | 105 | { |
53 | unsigned long dll_cnt; | 106 | unsigned long dll_cnt; |
54 | u32 fast_dll = 0; | 107 | u32 fast_dll = 0; |
55 | 108 | ||
56 | mem_timings.m_type = !((SDRC_MR_0 & 0x3) == 0x1); /* DDR = 1, SDR = 0 */ | 109 | mem_timings.m_type = !((sdrc_read_reg(SDRC_MR_0) & 0x3) == 0x1); /* DDR = 1, SDR = 0 */ |
57 | 110 | ||
58 | /* 2422 es2.05 and beyond has a single SIP DDR instead of 2 like others. | 111 | /* 2422 es2.05 and beyond has a single SIP DDR instead of 2 like others. |
59 | * In the case of 2422, its ok to use CS1 instead of CS0. | 112 | * In the case of 2422, its ok to use CS1 instead of CS0. |
@@ -73,11 +126,11 @@ void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | |||
73 | mem_timings.dll_mode = M_LOCK; | 126 | mem_timings.dll_mode = M_LOCK; |
74 | 127 | ||
75 | if (mem_timings.base_cs == 0) { | 128 | if (mem_timings.base_cs == 0) { |
76 | fast_dll = SDRC_DLLA_CTRL; | 129 | fast_dll = sdrc_read_reg(SDRC_DLLA_CTRL); |
77 | dll_cnt = SDRC_DLLA_STATUS & 0xff00; | 130 | dll_cnt = sdrc_read_reg(SDRC_DLLA_STATUS) & 0xff00; |
78 | } else { | 131 | } else { |
79 | fast_dll = SDRC_DLLB_CTRL; | 132 | fast_dll = sdrc_read_reg(SDRC_DLLB_CTRL); |
80 | dll_cnt = SDRC_DLLB_STATUS & 0xff00; | 133 | dll_cnt = sdrc_read_reg(SDRC_DLLB_STATUS) & 0xff00; |
81 | } | 134 | } |
82 | if (force_lock_to_unlock_mode) { | 135 | if (force_lock_to_unlock_mode) { |
83 | fast_dll &= ~0xff00; | 136 | fast_dll &= ~0xff00; |
@@ -106,14 +159,13 @@ void __init omap2_init_memory(void) | |||
106 | { | 159 | { |
107 | u32 l; | 160 | u32 l; |
108 | 161 | ||
109 | l = SMS_SYSCONFIG; | 162 | l = sms_read_reg(SMS_SYSCONFIG); |
110 | l &= ~(0x3 << 3); | 163 | l &= ~(0x3 << 3); |
111 | l |= (0x2 << 3); | 164 | l |= (0x2 << 3); |
112 | SMS_SYSCONFIG = l; | 165 | sms_write_reg(l, SMS_SYSCONFIG); |
113 | 166 | ||
114 | l = SDRC_SYSCONFIG; | 167 | l = sdrc_read_reg(SDRC_SYSCONFIG); |
115 | l &= ~(0x3 << 3); | 168 | l &= ~(0x3 << 3); |
116 | l |= (0x2 << 3); | 169 | l |= (0x2 << 3); |
117 | SDRC_SYSCONFIG = l; | 170 | sdrc_write_reg(l, SDRC_SYSCONFIG); |
118 | |||
119 | } | 171 | } |
diff --git a/arch/arm/mach-omap2/memory.h b/arch/arm/mach-omap2/memory.h index d212eea83a05..9a280b50a893 100644 --- a/arch/arm/mach-omap2/memory.h +++ b/arch/arm/mach-omap2/memory.h | |||
@@ -32,3 +32,5 @@ extern void omap2_init_memory_params(u32 force_lock_to_unlock_mode); | |||
32 | extern u32 omap2_memory_get_slow_dll_ctrl(void); | 32 | extern u32 omap2_memory_get_slow_dll_ctrl(void); |
33 | extern u32 omap2_memory_get_fast_dll_ctrl(void); | 33 | extern u32 omap2_memory_get_fast_dll_ctrl(void); |
34 | extern u32 omap2_memory_get_type(void); | 34 | extern u32 omap2_memory_get_type(void); |
35 | u32 omap2_dll_force_needed(void); | ||
36 | u32 omap2_reprogram_sdrc(u32 level, u32 force); | ||
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 05750975d746..930770012a75 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -1,11 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-omap2/mux.c | 2 | * linux/arch/arm/mach-omap2/mux.c |
3 | * | 3 | * |
4 | * OMAP1 pin multiplexing configurations | 4 | * OMAP2 pin multiplexing configurations |
5 | * | 5 | * |
6 | * Copyright (C) 2003 - 2005 Nokia Corporation | 6 | * Copyright (C) 2004 - 2008 Texas Instruments Inc. |
7 | * Copyright (C) 2003 - 2008 Nokia Corporation | ||
7 | * | 8 | * |
8 | * Written by Tony Lindgren <tony.lindgren@nokia.com> | 9 | * Written by Tony Lindgren |
9 | * | 10 | * |
10 | * This program is free software; you can redistribute it and/or modify | 11 | * 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 | * it under the terms of the GNU General Public License as published by |
@@ -28,13 +29,17 @@ | |||
28 | #include <asm/io.h> | 29 | #include <asm/io.h> |
29 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
30 | 31 | ||
32 | #include <asm/arch/control.h> | ||
31 | #include <asm/arch/mux.h> | 33 | #include <asm/arch/mux.h> |
32 | 34 | ||
33 | #ifdef CONFIG_OMAP_MUX | 35 | #ifdef CONFIG_OMAP_MUX |
34 | 36 | ||
37 | static struct omap_mux_cfg arch_mux_cfg; | ||
38 | |||
35 | /* NOTE: See mux.h for the enumeration */ | 39 | /* NOTE: See mux.h for the enumeration */ |
36 | 40 | ||
37 | struct pin_config __initdata_or_module omap24xx_pins[] = { | 41 | #ifdef CONFIG_ARCH_OMAP24XX |
42 | static struct pin_config __initdata_or_module omap24xx_pins[] = { | ||
38 | /* | 43 | /* |
39 | * description mux mux pull pull debug | 44 | * description mux mux pull pull debug |
40 | * offset mode ena type | 45 | * offset mode ena type |
@@ -77,7 +82,12 @@ MUX_CFG_24XX("AA12_242X_GPIO17", 0x0e9, 3, 0, 0, 1) | |||
77 | MUX_CFG_24XX("AA8_242X_GPIO58", 0x0ea, 3, 0, 0, 1) | 82 | MUX_CFG_24XX("AA8_242X_GPIO58", 0x0ea, 3, 0, 0, 1) |
78 | MUX_CFG_24XX("Y20_24XX_GPIO60", 0x12c, 3, 0, 0, 1) | 83 | MUX_CFG_24XX("Y20_24XX_GPIO60", 0x12c, 3, 0, 0, 1) |
79 | MUX_CFG_24XX("W4__24XX_GPIO74", 0x0f2, 3, 0, 0, 1) | 84 | MUX_CFG_24XX("W4__24XX_GPIO74", 0x0f2, 3, 0, 0, 1) |
85 | MUX_CFG_24XX("N15_24XX_GPIO85", 0x103, 3, 0, 0, 1) | ||
80 | MUX_CFG_24XX("M15_24XX_GPIO92", 0x10a, 3, 0, 0, 1) | 86 | MUX_CFG_24XX("M15_24XX_GPIO92", 0x10a, 3, 0, 0, 1) |
87 | MUX_CFG_24XX("P20_24XX_GPIO93", 0x10b, 3, 0, 0, 1) | ||
88 | MUX_CFG_24XX("P18_24XX_GPIO95", 0x10d, 3, 0, 0, 1) | ||
89 | MUX_CFG_24XX("M18_24XX_GPIO96", 0x10e, 3, 0, 0, 1) | ||
90 | MUX_CFG_24XX("L14_24XX_GPIO97", 0x10f, 3, 0, 0, 1) | ||
81 | MUX_CFG_24XX("J15_24XX_GPIO99", 0x113, 3, 1, 1, 1) | 91 | MUX_CFG_24XX("J15_24XX_GPIO99", 0x113, 3, 1, 1, 1) |
82 | MUX_CFG_24XX("V14_24XX_GPIO117", 0x128, 3, 1, 0, 1) | 92 | MUX_CFG_24XX("V14_24XX_GPIO117", 0x128, 3, 1, 0, 1) |
83 | MUX_CFG_24XX("P14_24XX_GPIO125", 0x140, 3, 1, 1, 1) | 93 | MUX_CFG_24XX("P14_24XX_GPIO125", 0x140, 3, 1, 1, 1) |
@@ -102,9 +112,6 @@ MUX_CFG_24XX("G4_242X_DMAREQ3", 0x073, 2, 0, 0, 1) | |||
102 | MUX_CFG_24XX("D3_242X_DMAREQ4", 0x072, 2, 0, 0, 1) | 112 | MUX_CFG_24XX("D3_242X_DMAREQ4", 0x072, 2, 0, 0, 1) |
103 | MUX_CFG_24XX("E3_242X_DMAREQ5", 0x071, 2, 0, 0, 1) | 113 | MUX_CFG_24XX("E3_242X_DMAREQ5", 0x071, 2, 0, 0, 1) |
104 | 114 | ||
105 | /* TSC IRQ */ | ||
106 | MUX_CFG_24XX("P20_24XX_TSC_IRQ", 0x108, 0, 0, 0, 1) | ||
107 | |||
108 | /* UART3 */ | 115 | /* UART3 */ |
109 | MUX_CFG_24XX("K15_24XX_UART3_TX", 0x118, 0, 0, 0, 1) | 116 | MUX_CFG_24XX("K15_24XX_UART3_TX", 0x118, 0, 0, 0, 1) |
110 | MUX_CFG_24XX("K14_24XX_UART3_RX", 0x119, 0, 0, 0, 1) | 117 | MUX_CFG_24XX("K14_24XX_UART3_RX", 0x119, 0, 0, 0, 1) |
@@ -167,12 +174,108 @@ MUX_CFG_24XX("B3__24XX_KBR5", 0x30, 3, 1, 1, 1) | |||
167 | MUX_CFG_24XX("AA4_24XX_KBC2", 0xe7, 3, 0, 0, 1) | 174 | MUX_CFG_24XX("AA4_24XX_KBC2", 0xe7, 3, 0, 0, 1) |
168 | MUX_CFG_24XX("B13_24XX_KBC6", 0x110, 3, 0, 0, 1) | 175 | MUX_CFG_24XX("B13_24XX_KBC6", 0x110, 3, 0, 0, 1) |
169 | 176 | ||
177 | /* 2430 USB */ | ||
178 | MUX_CFG_24XX("AD9_2430_USB0_PUEN", 0x133, 4, 0, 0, 1) | ||
179 | MUX_CFG_24XX("Y11_2430_USB0_VP", 0x134, 4, 0, 0, 1) | ||
180 | MUX_CFG_24XX("AD7_2430_USB0_VM", 0x135, 4, 0, 0, 1) | ||
181 | MUX_CFG_24XX("AE7_2430_USB0_RCV", 0x136, 4, 0, 0, 1) | ||
182 | MUX_CFG_24XX("AD4_2430_USB0_TXEN", 0x137, 4, 0, 0, 1) | ||
183 | MUX_CFG_24XX("AF9_2430_USB0_SE0", 0x138, 4, 0, 0, 1) | ||
184 | MUX_CFG_24XX("AE6_2430_USB0_DAT", 0x139, 4, 0, 0, 1) | ||
185 | MUX_CFG_24XX("AD24_2430_USB1_SE0", 0x107, 2, 0, 0, 1) | ||
186 | MUX_CFG_24XX("AB24_2430_USB1_RCV", 0x108, 2, 0, 0, 1) | ||
187 | MUX_CFG_24XX("Y25_2430_USB1_TXEN", 0x109, 2, 0, 0, 1) | ||
188 | MUX_CFG_24XX("AA26_2430_USB1_DAT", 0x10A, 2, 0, 0, 1) | ||
189 | |||
190 | /* 2430 HS-USB */ | ||
191 | MUX_CFG_24XX("AD9_2430_USB0HS_DATA3", 0x133, 0, 0, 0, 1) | ||
192 | MUX_CFG_24XX("Y11_2430_USB0HS_DATA4", 0x134, 0, 0, 0, 1) | ||
193 | MUX_CFG_24XX("AD7_2430_USB0HS_DATA5", 0x135, 0, 0, 0, 1) | ||
194 | MUX_CFG_24XX("AE7_2430_USB0HS_DATA6", 0x136, 0, 0, 0, 1) | ||
195 | MUX_CFG_24XX("AD4_2430_USB0HS_DATA2", 0x137, 0, 0, 0, 1) | ||
196 | MUX_CFG_24XX("AF9_2430_USB0HS_DATA0", 0x138, 0, 0, 0, 1) | ||
197 | MUX_CFG_24XX("AE6_2430_USB0HS_DATA1", 0x139, 0, 0, 0, 1) | ||
198 | MUX_CFG_24XX("AE8_2430_USB0HS_CLK", 0x13A, 0, 0, 0, 1) | ||
199 | MUX_CFG_24XX("AD8_2430_USB0HS_DIR", 0x13B, 0, 0, 0, 1) | ||
200 | MUX_CFG_24XX("AE5_2430_USB0HS_STP", 0x13c, 0, 1, 1, 1) | ||
201 | MUX_CFG_24XX("AE9_2430_USB0HS_NXT", 0x13D, 0, 0, 0, 1) | ||
202 | MUX_CFG_24XX("AC7_2430_USB0HS_DATA7", 0x13E, 0, 0, 0, 1) | ||
203 | |||
204 | /* 2430 McBSP */ | ||
205 | MUX_CFG_24XX("AC10_2430_MCBSP2_FSX", 0x012E, 1, 0, 0, 1) | ||
206 | MUX_CFG_24XX("AD16_2430_MCBSP2_CLX", 0x012F, 1, 0, 0, 1) | ||
207 | MUX_CFG_24XX("AE13_2430_MCBSP2_DX", 0x0130, 1, 0, 0, 1) | ||
208 | MUX_CFG_24XX("AD13_2430_MCBSP2_DR", 0x0131, 1, 0, 0, 1) | ||
209 | MUX_CFG_24XX("AC10_2430_MCBSP2_FSX_OFF",0x012E, 0, 0, 0, 1) | ||
210 | MUX_CFG_24XX("AD16_2430_MCBSP2_CLX_OFF",0x012F, 0, 0, 0, 1) | ||
211 | MUX_CFG_24XX("AE13_2430_MCBSP2_DX_OFF", 0x0130, 0, 0, 0, 1) | ||
212 | MUX_CFG_24XX("AD13_2430_MCBSP2_DR_OFF", 0x0131, 0, 0, 0, 1) | ||
170 | }; | 213 | }; |
171 | 214 | ||
172 | int __init omap2_mux_init(void) | 215 | #define OMAP24XX_PINS_SZ ARRAY_SIZE(omap24xx_pins) |
216 | |||
217 | #else | ||
218 | #define omap24xx_pins NULL | ||
219 | #define OMAP24XX_PINS_SZ 0 | ||
220 | #endif /* CONFIG_ARCH_OMAP24XX */ | ||
221 | |||
222 | #define OMAP24XX_PULL_ENA (1 << 3) | ||
223 | #define OMAP24XX_PULL_UP (1 << 4) | ||
224 | |||
225 | #if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS) | ||
226 | void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u8 reg) | ||
173 | { | 227 | { |
174 | omap_mux_register(omap24xx_pins, ARRAY_SIZE(omap24xx_pins)); | 228 | u16 orig; |
229 | u8 warn = 0, debug = 0; | ||
230 | |||
231 | orig = omap_ctrl_readb(cfg->mux_reg); | ||
232 | |||
233 | #ifdef CONFIG_OMAP_MUX_DEBUG | ||
234 | debug = cfg->debug; | ||
235 | #endif | ||
236 | warn = (orig != reg); | ||
237 | if (debug || warn) | ||
238 | printk(KERN_WARNING | ||
239 | "MUX: setup %s (0x%08x): 0x%02x -> 0x%02x\n", | ||
240 | cfg->name, omap_ctrl_base_get() + cfg->mux_reg, | ||
241 | orig, reg); | ||
242 | } | ||
243 | #else | ||
244 | #define omap2_cfg_debug(x, y) do {} while (0) | ||
245 | #endif | ||
246 | |||
247 | #ifdef CONFIG_ARCH_OMAP24XX | ||
248 | int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) | ||
249 | { | ||
250 | static DEFINE_SPINLOCK(mux_spin_lock); | ||
251 | unsigned long flags; | ||
252 | u8 reg = 0; | ||
253 | |||
254 | spin_lock_irqsave(&mux_spin_lock, flags); | ||
255 | reg |= cfg->mask & 0x7; | ||
256 | if (cfg->pull_val) | ||
257 | reg |= OMAP24XX_PULL_ENA; | ||
258 | if (cfg->pu_pd_val) | ||
259 | reg |= OMAP24XX_PULL_UP; | ||
260 | omap2_cfg_debug(cfg, reg); | ||
261 | omap_ctrl_writeb(reg, cfg->mux_reg); | ||
262 | spin_unlock_irqrestore(&mux_spin_lock, flags); | ||
263 | |||
175 | return 0; | 264 | return 0; |
176 | } | 265 | } |
266 | #else | ||
267 | #define omap24xx_cfg_reg 0 | ||
268 | #endif | ||
269 | |||
270 | int __init omap2_mux_init(void) | ||
271 | { | ||
272 | if (cpu_is_omap24xx()) { | ||
273 | arch_mux_cfg.pins = omap24xx_pins; | ||
274 | arch_mux_cfg.size = OMAP24XX_PINS_SZ; | ||
275 | arch_mux_cfg.cfg_reg = omap24xx_cfg_reg; | ||
276 | } | ||
277 | |||
278 | return omap_mux_register(&arch_mux_cfg); | ||
279 | } | ||
177 | 280 | ||
178 | #endif | 281 | #endif |
diff --git a/arch/arm/mach-omap2/pm-domain.c b/arch/arm/mach-omap2/pm-domain.c deleted file mode 100644 index 2494091a078b..000000000000 --- a/arch/arm/mach-omap2/pm-domain.c +++ /dev/null | |||
@@ -1,299 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap2/pm-domain.c | ||
3 | * | ||
4 | * Power domain functions for OMAP2 | ||
5 | * | ||
6 | * Copyright (C) 2006 Nokia Corporation | ||
7 | * Tony Lindgren <tony@atomide.com> | ||
8 | * | ||
9 | * Some code based on earlier OMAP2 sample PM code | ||
10 | * Copyright (C) 2005 Texas Instruments, Inc. | ||
11 | * Richard Woodruff <r-woodruff2@ti.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/clk.h> | ||
21 | |||
22 | #include <asm/io.h> | ||
23 | |||
24 | #include "prcm-regs.h" | ||
25 | |||
26 | /* Power domain offsets */ | ||
27 | #define PM_MPU_OFFSET 0x100 | ||
28 | #define PM_CORE_OFFSET 0x200 | ||
29 | #define PM_GFX_OFFSET 0x300 | ||
30 | #define PM_WKUP_OFFSET 0x400 /* Autoidle only */ | ||
31 | #define PM_PLL_OFFSET 0x500 /* Autoidle only */ | ||
32 | #define PM_DSP_OFFSET 0x800 | ||
33 | #define PM_MDM_OFFSET 0xc00 | ||
34 | |||
35 | /* Power domain wake-up dependency control register */ | ||
36 | #define PM_WKDEP_OFFSET 0xc8 | ||
37 | #define EN_MDM (1 << 5) | ||
38 | #define EN_WKUP (1 << 4) | ||
39 | #define EN_GFX (1 << 3) | ||
40 | #define EN_DSP (1 << 2) | ||
41 | #define EN_MPU (1 << 1) | ||
42 | #define EN_CORE (1 << 0) | ||
43 | |||
44 | /* Core power domain state transition control register */ | ||
45 | #define PM_PWSTCTRL_OFFSET 0xe0 | ||
46 | #define FORCESTATE (1 << 18) /* Only for DSP & GFX */ | ||
47 | #define MEM4RETSTATE (1 << 6) | ||
48 | #define MEM3RETSTATE (1 << 5) | ||
49 | #define MEM2RETSTATE (1 << 4) | ||
50 | #define MEM1RETSTATE (1 << 3) | ||
51 | #define LOGICRETSTATE (1 << 2) /* Logic is retained */ | ||
52 | #define POWERSTATE_OFF 0x3 | ||
53 | #define POWERSTATE_RETENTION 0x1 | ||
54 | #define POWERSTATE_ON 0x0 | ||
55 | |||
56 | /* Power domain state register */ | ||
57 | #define PM_PWSTST_OFFSET 0xe4 | ||
58 | |||
59 | /* Hardware supervised state transition control register */ | ||
60 | #define CM_CLKSTCTRL_OFFSET 0x48 | ||
61 | #define AUTOSTAT_MPU (1 << 0) /* MPU */ | ||
62 | #define AUTOSTAT_DSS (1 << 2) /* Core */ | ||
63 | #define AUTOSTAT_L4 (1 << 1) /* Core */ | ||
64 | #define AUTOSTAT_L3 (1 << 0) /* Core */ | ||
65 | #define AUTOSTAT_GFX (1 << 0) /* GFX */ | ||
66 | #define AUTOSTAT_IVA (1 << 8) /* 2420 IVA in DSP domain */ | ||
67 | #define AUTOSTAT_DSP (1 << 0) /* DSP */ | ||
68 | #define AUTOSTAT_MDM (1 << 0) /* MDM */ | ||
69 | |||
70 | /* Automatic control of interface clock idling */ | ||
71 | #define CM_AUTOIDLE1_OFFSET 0x30 | ||
72 | #define CM_AUTOIDLE2_OFFSET 0x34 /* Core only */ | ||
73 | #define CM_AUTOIDLE3_OFFSET 0x38 /* Core only */ | ||
74 | #define CM_AUTOIDLE4_OFFSET 0x3c /* Core only */ | ||
75 | #define AUTO_54M(x) (((x) & 0x3) << 6) | ||
76 | #define AUTO_96M(x) (((x) & 0x3) << 2) | ||
77 | #define AUTO_DPLL(x) (((x) & 0x3) << 0) | ||
78 | #define AUTO_STOPPED 0x3 | ||
79 | #define AUTO_BYPASS_FAST 0x2 /* DPLL only */ | ||
80 | #define AUTO_BYPASS_LOW_POWER 0x1 /* DPLL only */ | ||
81 | #define AUTO_DISABLED 0x0 | ||
82 | |||
83 | /* Voltage control PRCM_VOLTCTRL bits */ | ||
84 | #define AUTO_EXTVOLT (1 << 15) | ||
85 | #define FORCE_EXTVOLT (1 << 14) | ||
86 | #define SETOFF_LEVEL(x) (((x) & 0x3) << 12) | ||
87 | #define MEMRETCTRL (1 << 8) | ||
88 | #define SETRET_LEVEL(x) (((x) & 0x3) << 6) | ||
89 | #define VOLT_LEVEL(x) (((x) & 0x3) << 0) | ||
90 | |||
91 | #define OMAP24XX_PRCM_VBASE IO_ADDRESS(OMAP24XX_PRCM_BASE) | ||
92 | #define prcm_readl(r) __raw_readl(OMAP24XX_PRCM_VBASE + (r)) | ||
93 | #define prcm_writel(v, r) __raw_writel((v), OMAP24XX_PRCM_VBASE + (r)) | ||
94 | |||
95 | static u32 pmdomain_get_wakeup_dependencies(int domain_offset) | ||
96 | { | ||
97 | return prcm_readl(domain_offset + PM_WKDEP_OFFSET); | ||
98 | } | ||
99 | |||
100 | static void pmdomain_set_wakeup_dependencies(u32 state, int domain_offset) | ||
101 | { | ||
102 | prcm_writel(state, domain_offset + PM_WKDEP_OFFSET); | ||
103 | } | ||
104 | |||
105 | static u32 pmdomain_get_powerstate(int domain_offset) | ||
106 | { | ||
107 | return prcm_readl(domain_offset + PM_PWSTCTRL_OFFSET); | ||
108 | } | ||
109 | |||
110 | static void pmdomain_set_powerstate(u32 state, int domain_offset) | ||
111 | { | ||
112 | prcm_writel(state, domain_offset + PM_PWSTCTRL_OFFSET); | ||
113 | } | ||
114 | |||
115 | static u32 pmdomain_get_clock_autocontrol(int domain_offset) | ||
116 | { | ||
117 | return prcm_readl(domain_offset + CM_CLKSTCTRL_OFFSET); | ||
118 | } | ||
119 | |||
120 | static void pmdomain_set_clock_autocontrol(u32 state, int domain_offset) | ||
121 | { | ||
122 | prcm_writel(state, domain_offset + CM_CLKSTCTRL_OFFSET); | ||
123 | } | ||
124 | |||
125 | static u32 pmdomain_get_clock_autoidle1(int domain_offset) | ||
126 | { | ||
127 | return prcm_readl(domain_offset + CM_AUTOIDLE1_OFFSET); | ||
128 | } | ||
129 | |||
130 | /* Core domain only */ | ||
131 | static u32 pmdomain_get_clock_autoidle2(int domain_offset) | ||
132 | { | ||
133 | return prcm_readl(domain_offset + CM_AUTOIDLE2_OFFSET); | ||
134 | } | ||
135 | |||
136 | /* Core domain only */ | ||
137 | static u32 pmdomain_get_clock_autoidle3(int domain_offset) | ||
138 | { | ||
139 | return prcm_readl(domain_offset + CM_AUTOIDLE3_OFFSET); | ||
140 | } | ||
141 | |||
142 | /* Core domain only */ | ||
143 | static u32 pmdomain_get_clock_autoidle4(int domain_offset) | ||
144 | { | ||
145 | return prcm_readl(domain_offset + CM_AUTOIDLE4_OFFSET); | ||
146 | } | ||
147 | |||
148 | static void pmdomain_set_clock_autoidle1(u32 state, int domain_offset) | ||
149 | { | ||
150 | prcm_writel(state, CM_AUTOIDLE1_OFFSET + domain_offset); | ||
151 | } | ||
152 | |||
153 | /* Core domain only */ | ||
154 | static void pmdomain_set_clock_autoidle2(u32 state, int domain_offset) | ||
155 | { | ||
156 | prcm_writel(state, CM_AUTOIDLE2_OFFSET + domain_offset); | ||
157 | } | ||
158 | |||
159 | /* Core domain only */ | ||
160 | static void pmdomain_set_clock_autoidle3(u32 state, int domain_offset) | ||
161 | { | ||
162 | prcm_writel(state, CM_AUTOIDLE3_OFFSET + domain_offset); | ||
163 | } | ||
164 | |||
165 | /* Core domain only */ | ||
166 | static void pmdomain_set_clock_autoidle4(u32 state, int domain_offset) | ||
167 | { | ||
168 | prcm_writel(state, CM_AUTOIDLE4_OFFSET + domain_offset); | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * Configures power management domains to idle clocks automatically. | ||
173 | */ | ||
174 | void pmdomain_set_autoidle(void) | ||
175 | { | ||
176 | u32 val; | ||
177 | |||
178 | /* Set PLL auto stop for 54M, 96M & DPLL */ | ||
179 | pmdomain_set_clock_autoidle1(AUTO_54M(AUTO_STOPPED) | | ||
180 | AUTO_96M(AUTO_STOPPED) | | ||
181 | AUTO_DPLL(AUTO_STOPPED), PM_PLL_OFFSET); | ||
182 | |||
183 | /* External clock input control | ||
184 | * REVISIT: Should this be in clock framework? | ||
185 | */ | ||
186 | PRCM_CLKSRC_CTRL |= (0x3 << 3); | ||
187 | |||
188 | /* Configure number of 32KHz clock cycles for sys_clk */ | ||
189 | PRCM_CLKSSETUP = 0x00ff; | ||
190 | |||
191 | /* Configure automatic voltage transition */ | ||
192 | PRCM_VOLTSETUP = 0; | ||
193 | val = PRCM_VOLTCTRL; | ||
194 | val &= ~(SETOFF_LEVEL(0x3) | VOLT_LEVEL(0x3)); | ||
195 | val |= SETOFF_LEVEL(1) | VOLT_LEVEL(1) | AUTO_EXTVOLT; | ||
196 | PRCM_VOLTCTRL = val; | ||
197 | |||
198 | /* Disable emulation tools functional clock */ | ||
199 | PRCM_CLKEMUL_CTRL = 0x0; | ||
200 | |||
201 | /* Set core memory retention state */ | ||
202 | val = pmdomain_get_powerstate(PM_CORE_OFFSET); | ||
203 | if (cpu_is_omap2420()) { | ||
204 | val &= ~(0x7 << 3); | ||
205 | val |= (MEM3RETSTATE | MEM2RETSTATE | MEM1RETSTATE); | ||
206 | } else { | ||
207 | val &= ~(0xf << 3); | ||
208 | val |= (MEM4RETSTATE | MEM3RETSTATE | MEM2RETSTATE | | ||
209 | MEM1RETSTATE); | ||
210 | } | ||
211 | pmdomain_set_powerstate(val, PM_CORE_OFFSET); | ||
212 | |||
213 | /* OCP interface smart idle. REVISIT: Enable autoidle bit0 ? */ | ||
214 | val = SMS_SYSCONFIG; | ||
215 | val &= ~(0x3 << 3); | ||
216 | val |= (0x2 << 3) | (1 << 0); | ||
217 | SMS_SYSCONFIG |= val; | ||
218 | |||
219 | val = SDRC_SYSCONFIG; | ||
220 | val &= ~(0x3 << 3); | ||
221 | val |= (0x2 << 3); | ||
222 | SDRC_SYSCONFIG = val; | ||
223 | |||
224 | /* Configure L3 interface for smart idle. | ||
225 | * REVISIT: Enable autoidle bit0 ? | ||
226 | */ | ||
227 | val = GPMC_SYSCONFIG; | ||
228 | val &= ~(0x3 << 3); | ||
229 | val |= (0x2 << 3) | (1 << 0); | ||
230 | GPMC_SYSCONFIG = val; | ||
231 | |||
232 | pmdomain_set_powerstate(LOGICRETSTATE | POWERSTATE_RETENTION, | ||
233 | PM_MPU_OFFSET); | ||
234 | pmdomain_set_powerstate(POWERSTATE_RETENTION, PM_CORE_OFFSET); | ||
235 | if (!cpu_is_omap2420()) | ||
236 | pmdomain_set_powerstate(POWERSTATE_RETENTION, PM_MDM_OFFSET); | ||
237 | |||
238 | /* Assume suspend function has saved the state for DSP and GFX */ | ||
239 | pmdomain_set_powerstate(FORCESTATE | POWERSTATE_OFF, PM_DSP_OFFSET); | ||
240 | pmdomain_set_powerstate(FORCESTATE | POWERSTATE_OFF, PM_GFX_OFFSET); | ||
241 | |||
242 | #if 0 | ||
243 | /* REVISIT: Internal USB needs special handling */ | ||
244 | force_standby_usb(); | ||
245 | if (cpu_is_omap2430()) | ||
246 | force_hsmmc(); | ||
247 | sdram_self_refresh_on_idle_req(1); | ||
248 | #endif | ||
249 | |||
250 | /* Enable clock auto control for all domains. | ||
251 | * Note that CORE domain includes also DSS, L4 & L3. | ||
252 | */ | ||
253 | pmdomain_set_clock_autocontrol(AUTOSTAT_MPU, PM_MPU_OFFSET); | ||
254 | pmdomain_set_clock_autocontrol(AUTOSTAT_GFX, PM_GFX_OFFSET); | ||
255 | pmdomain_set_clock_autocontrol(AUTOSTAT_DSS | AUTOSTAT_L4 | AUTOSTAT_L3, | ||
256 | PM_CORE_OFFSET); | ||
257 | if (cpu_is_omap2420()) | ||
258 | pmdomain_set_clock_autocontrol(AUTOSTAT_IVA | AUTOSTAT_DSP, | ||
259 | PM_DSP_OFFSET); | ||
260 | else { | ||
261 | pmdomain_set_clock_autocontrol(AUTOSTAT_DSP, PM_DSP_OFFSET); | ||
262 | pmdomain_set_clock_autocontrol(AUTOSTAT_MDM, PM_MDM_OFFSET); | ||
263 | } | ||
264 | |||
265 | /* Enable clock autoidle for all domains */ | ||
266 | pmdomain_set_clock_autoidle1(0x2, PM_DSP_OFFSET); | ||
267 | if (cpu_is_omap2420()) { | ||
268 | pmdomain_set_clock_autoidle1(0xfffffff9, PM_CORE_OFFSET); | ||
269 | pmdomain_set_clock_autoidle2(0x7, PM_CORE_OFFSET); | ||
270 | pmdomain_set_clock_autoidle1(0x3f, PM_WKUP_OFFSET); | ||
271 | } else { | ||
272 | pmdomain_set_clock_autoidle1(0xeafffff1, PM_CORE_OFFSET); | ||
273 | pmdomain_set_clock_autoidle2(0xfff, PM_CORE_OFFSET); | ||
274 | pmdomain_set_clock_autoidle1(0x7f, PM_WKUP_OFFSET); | ||
275 | pmdomain_set_clock_autoidle1(0x3, PM_MDM_OFFSET); | ||
276 | } | ||
277 | pmdomain_set_clock_autoidle3(0x7, PM_CORE_OFFSET); | ||
278 | pmdomain_set_clock_autoidle4(0x1f, PM_CORE_OFFSET); | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * Initializes power domains by removing wake-up dependencies and powering | ||
283 | * down DSP and GFX. Gets called from PM init. Note that DSP and IVA code | ||
284 | * must re-enable DSP and GFX when used. | ||
285 | */ | ||
286 | void __init pmdomain_init(void) | ||
287 | { | ||
288 | /* Remove all domain wakeup dependencies */ | ||
289 | pmdomain_set_wakeup_dependencies(EN_WKUP | EN_CORE, PM_MPU_OFFSET); | ||
290 | pmdomain_set_wakeup_dependencies(0, PM_DSP_OFFSET); | ||
291 | pmdomain_set_wakeup_dependencies(0, PM_GFX_OFFSET); | ||
292 | pmdomain_set_wakeup_dependencies(EN_WKUP | EN_MPU, PM_CORE_OFFSET); | ||
293 | if (cpu_is_omap2430()) | ||
294 | pmdomain_set_wakeup_dependencies(0, PM_MDM_OFFSET); | ||
295 | |||
296 | /* Power down DSP and GFX */ | ||
297 | pmdomain_set_powerstate(POWERSTATE_OFF | FORCESTATE, PM_DSP_OFFSET); | ||
298 | pmdomain_set_powerstate(POWERSTATE_OFF | FORCESTATE, PM_GFX_OFFSET); | ||
299 | } | ||
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index baf7d82b458b..aad781dcf1b1 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/sysfs.h> | 23 | #include <linux/sysfs.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/clk.h> | ||
26 | 27 | ||
27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
28 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
@@ -36,8 +37,6 @@ | |||
36 | #include <asm/arch/sram.h> | 37 | #include <asm/arch/sram.h> |
37 | #include <asm/arch/pm.h> | 38 | #include <asm/arch/pm.h> |
38 | 39 | ||
39 | #include "prcm-regs.h" | ||
40 | |||
41 | static struct clk *vclk; | 40 | static struct clk *vclk; |
42 | static void (*omap2_sram_idle)(void); | 41 | static void (*omap2_sram_idle)(void); |
43 | static void (*omap2_sram_suspend)(int dllctrl, int cpu_rev); | 42 | static void (*omap2_sram_suspend)(int dllctrl, int cpu_rev); |
@@ -78,251 +77,8 @@ static int omap2_pm_prepare(void) | |||
78 | return 0; | 77 | return 0; |
79 | } | 78 | } |
80 | 79 | ||
81 | #define INT0_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK1) | \ | ||
82 | OMAP_IRQ_BIT(INT_24XX_GPIO_BANK2) | \ | ||
83 | OMAP_IRQ_BIT(INT_24XX_GPIO_BANK3)) | ||
84 | |||
85 | #define INT1_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK4)) | ||
86 | |||
87 | #define INT2_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_UART1_IRQ) | \ | ||
88 | OMAP_IRQ_BIT(INT_24XX_UART2_IRQ) | \ | ||
89 | OMAP_IRQ_BIT(INT_24XX_UART3_IRQ)) | ||
90 | |||
91 | #define preg(reg) printk("%s\t(0x%p):\t0x%08x\n", #reg, ®, reg); | ||
92 | |||
93 | static void omap2_pm_debug(char * desc) | ||
94 | { | ||
95 | printk("%s:\n", desc); | ||
96 | |||
97 | preg(CM_CLKSTCTRL_MPU); | ||
98 | preg(CM_CLKSTCTRL_CORE); | ||
99 | preg(CM_CLKSTCTRL_GFX); | ||
100 | preg(CM_CLKSTCTRL_DSP); | ||
101 | preg(CM_CLKSTCTRL_MDM); | ||
102 | |||
103 | preg(PM_PWSTCTRL_MPU); | ||
104 | preg(PM_PWSTCTRL_CORE); | ||
105 | preg(PM_PWSTCTRL_GFX); | ||
106 | preg(PM_PWSTCTRL_DSP); | ||
107 | preg(PM_PWSTCTRL_MDM); | ||
108 | |||
109 | preg(PM_PWSTST_MPU); | ||
110 | preg(PM_PWSTST_CORE); | ||
111 | preg(PM_PWSTST_GFX); | ||
112 | preg(PM_PWSTST_DSP); | ||
113 | preg(PM_PWSTST_MDM); | ||
114 | |||
115 | preg(CM_AUTOIDLE1_CORE); | ||
116 | preg(CM_AUTOIDLE2_CORE); | ||
117 | preg(CM_AUTOIDLE3_CORE); | ||
118 | preg(CM_AUTOIDLE4_CORE); | ||
119 | preg(CM_AUTOIDLE_WKUP); | ||
120 | preg(CM_AUTOIDLE_PLL); | ||
121 | preg(CM_AUTOIDLE_DSP); | ||
122 | preg(CM_AUTOIDLE_MDM); | ||
123 | |||
124 | preg(CM_ICLKEN1_CORE); | ||
125 | preg(CM_ICLKEN2_CORE); | ||
126 | preg(CM_ICLKEN3_CORE); | ||
127 | preg(CM_ICLKEN4_CORE); | ||
128 | preg(CM_ICLKEN_GFX); | ||
129 | preg(CM_ICLKEN_WKUP); | ||
130 | preg(CM_ICLKEN_DSP); | ||
131 | preg(CM_ICLKEN_MDM); | ||
132 | |||
133 | preg(CM_IDLEST1_CORE); | ||
134 | preg(CM_IDLEST2_CORE); | ||
135 | preg(CM_IDLEST3_CORE); | ||
136 | preg(CM_IDLEST4_CORE); | ||
137 | preg(CM_IDLEST_GFX); | ||
138 | preg(CM_IDLEST_WKUP); | ||
139 | preg(CM_IDLEST_CKGEN); | ||
140 | preg(CM_IDLEST_DSP); | ||
141 | preg(CM_IDLEST_MDM); | ||
142 | |||
143 | preg(RM_RSTST_MPU); | ||
144 | preg(RM_RSTST_GFX); | ||
145 | preg(RM_RSTST_WKUP); | ||
146 | preg(RM_RSTST_DSP); | ||
147 | preg(RM_RSTST_MDM); | ||
148 | |||
149 | preg(PM_WKDEP_MPU); | ||
150 | preg(PM_WKDEP_CORE); | ||
151 | preg(PM_WKDEP_GFX); | ||
152 | preg(PM_WKDEP_DSP); | ||
153 | preg(PM_WKDEP_MDM); | ||
154 | |||
155 | preg(CM_FCLKEN_WKUP); | ||
156 | preg(CM_ICLKEN_WKUP); | ||
157 | preg(CM_IDLEST_WKUP); | ||
158 | preg(CM_AUTOIDLE_WKUP); | ||
159 | preg(CM_CLKSEL_WKUP); | ||
160 | |||
161 | preg(PM_WKEN_WKUP); | ||
162 | preg(PM_WKST_WKUP); | ||
163 | } | ||
164 | |||
165 | static inline void omap2_pm_save_registers(void) | ||
166 | { | ||
167 | /* Save interrupt registers */ | ||
168 | OMAP24XX_SAVE(INTC_MIR0); | ||
169 | OMAP24XX_SAVE(INTC_MIR1); | ||
170 | OMAP24XX_SAVE(INTC_MIR2); | ||
171 | |||
172 | /* Save power control registers */ | ||
173 | OMAP24XX_SAVE(CM_CLKSTCTRL_MPU); | ||
174 | OMAP24XX_SAVE(CM_CLKSTCTRL_CORE); | ||
175 | OMAP24XX_SAVE(CM_CLKSTCTRL_GFX); | ||
176 | OMAP24XX_SAVE(CM_CLKSTCTRL_DSP); | ||
177 | OMAP24XX_SAVE(CM_CLKSTCTRL_MDM); | ||
178 | |||
179 | /* Save power state registers */ | ||
180 | OMAP24XX_SAVE(PM_PWSTCTRL_MPU); | ||
181 | OMAP24XX_SAVE(PM_PWSTCTRL_CORE); | ||
182 | OMAP24XX_SAVE(PM_PWSTCTRL_GFX); | ||
183 | OMAP24XX_SAVE(PM_PWSTCTRL_DSP); | ||
184 | OMAP24XX_SAVE(PM_PWSTCTRL_MDM); | ||
185 | |||
186 | /* Save autoidle registers */ | ||
187 | OMAP24XX_SAVE(CM_AUTOIDLE1_CORE); | ||
188 | OMAP24XX_SAVE(CM_AUTOIDLE2_CORE); | ||
189 | OMAP24XX_SAVE(CM_AUTOIDLE3_CORE); | ||
190 | OMAP24XX_SAVE(CM_AUTOIDLE4_CORE); | ||
191 | OMAP24XX_SAVE(CM_AUTOIDLE_WKUP); | ||
192 | OMAP24XX_SAVE(CM_AUTOIDLE_PLL); | ||
193 | OMAP24XX_SAVE(CM_AUTOIDLE_DSP); | ||
194 | OMAP24XX_SAVE(CM_AUTOIDLE_MDM); | ||
195 | |||
196 | /* Save idle state registers */ | ||
197 | OMAP24XX_SAVE(CM_IDLEST1_CORE); | ||
198 | OMAP24XX_SAVE(CM_IDLEST2_CORE); | ||
199 | OMAP24XX_SAVE(CM_IDLEST3_CORE); | ||
200 | OMAP24XX_SAVE(CM_IDLEST4_CORE); | ||
201 | OMAP24XX_SAVE(CM_IDLEST_GFX); | ||
202 | OMAP24XX_SAVE(CM_IDLEST_WKUP); | ||
203 | OMAP24XX_SAVE(CM_IDLEST_CKGEN); | ||
204 | OMAP24XX_SAVE(CM_IDLEST_DSP); | ||
205 | OMAP24XX_SAVE(CM_IDLEST_MDM); | ||
206 | |||
207 | /* Save clock registers */ | ||
208 | OMAP24XX_SAVE(CM_FCLKEN1_CORE); | ||
209 | OMAP24XX_SAVE(CM_FCLKEN2_CORE); | ||
210 | OMAP24XX_SAVE(CM_ICLKEN1_CORE); | ||
211 | OMAP24XX_SAVE(CM_ICLKEN2_CORE); | ||
212 | OMAP24XX_SAVE(CM_ICLKEN3_CORE); | ||
213 | OMAP24XX_SAVE(CM_ICLKEN4_CORE); | ||
214 | } | ||
215 | |||
216 | static inline void omap2_pm_restore_registers(void) | ||
217 | { | ||
218 | /* Restore clock state registers */ | ||
219 | OMAP24XX_RESTORE(CM_CLKSTCTRL_MPU); | ||
220 | OMAP24XX_RESTORE(CM_CLKSTCTRL_CORE); | ||
221 | OMAP24XX_RESTORE(CM_CLKSTCTRL_GFX); | ||
222 | OMAP24XX_RESTORE(CM_CLKSTCTRL_DSP); | ||
223 | OMAP24XX_RESTORE(CM_CLKSTCTRL_MDM); | ||
224 | |||
225 | /* Restore power state registers */ | ||
226 | OMAP24XX_RESTORE(PM_PWSTCTRL_MPU); | ||
227 | OMAP24XX_RESTORE(PM_PWSTCTRL_CORE); | ||
228 | OMAP24XX_RESTORE(PM_PWSTCTRL_GFX); | ||
229 | OMAP24XX_RESTORE(PM_PWSTCTRL_DSP); | ||
230 | OMAP24XX_RESTORE(PM_PWSTCTRL_MDM); | ||
231 | |||
232 | /* Restore idle state registers */ | ||
233 | OMAP24XX_RESTORE(CM_IDLEST1_CORE); | ||
234 | OMAP24XX_RESTORE(CM_IDLEST2_CORE); | ||
235 | OMAP24XX_RESTORE(CM_IDLEST3_CORE); | ||
236 | OMAP24XX_RESTORE(CM_IDLEST4_CORE); | ||
237 | OMAP24XX_RESTORE(CM_IDLEST_GFX); | ||
238 | OMAP24XX_RESTORE(CM_IDLEST_WKUP); | ||
239 | OMAP24XX_RESTORE(CM_IDLEST_CKGEN); | ||
240 | OMAP24XX_RESTORE(CM_IDLEST_DSP); | ||
241 | OMAP24XX_RESTORE(CM_IDLEST_MDM); | ||
242 | |||
243 | /* Restore autoidle registers */ | ||
244 | OMAP24XX_RESTORE(CM_AUTOIDLE1_CORE); | ||
245 | OMAP24XX_RESTORE(CM_AUTOIDLE2_CORE); | ||
246 | OMAP24XX_RESTORE(CM_AUTOIDLE3_CORE); | ||
247 | OMAP24XX_RESTORE(CM_AUTOIDLE4_CORE); | ||
248 | OMAP24XX_RESTORE(CM_AUTOIDLE_WKUP); | ||
249 | OMAP24XX_RESTORE(CM_AUTOIDLE_PLL); | ||
250 | OMAP24XX_RESTORE(CM_AUTOIDLE_DSP); | ||
251 | OMAP24XX_RESTORE(CM_AUTOIDLE_MDM); | ||
252 | |||
253 | /* Restore clock registers */ | ||
254 | OMAP24XX_RESTORE(CM_FCLKEN1_CORE); | ||
255 | OMAP24XX_RESTORE(CM_FCLKEN2_CORE); | ||
256 | OMAP24XX_RESTORE(CM_ICLKEN1_CORE); | ||
257 | OMAP24XX_RESTORE(CM_ICLKEN2_CORE); | ||
258 | OMAP24XX_RESTORE(CM_ICLKEN3_CORE); | ||
259 | OMAP24XX_RESTORE(CM_ICLKEN4_CORE); | ||
260 | |||
261 | /* REVISIT: Clear interrupts here */ | ||
262 | |||
263 | /* Restore interrupt registers */ | ||
264 | OMAP24XX_RESTORE(INTC_MIR0); | ||
265 | OMAP24XX_RESTORE(INTC_MIR1); | ||
266 | OMAP24XX_RESTORE(INTC_MIR2); | ||
267 | } | ||
268 | |||
269 | static int omap2_pm_suspend(void) | 80 | static int omap2_pm_suspend(void) |
270 | { | 81 | { |
271 | int processor_type = 0; | ||
272 | |||
273 | /* REVISIT: 0x21 or 0x26? */ | ||
274 | if (cpu_is_omap2420()) | ||
275 | processor_type = 0x21; | ||
276 | |||
277 | if (!processor_type) | ||
278 | return -ENOTSUPP; | ||
279 | |||
280 | local_irq_disable(); | ||
281 | local_fiq_disable(); | ||
282 | |||
283 | omap2_pm_save_registers(); | ||
284 | |||
285 | /* Disable interrupts except for the wake events */ | ||
286 | INTC_MIR_SET0 = 0xffffffff & ~INT0_WAKE_MASK; | ||
287 | INTC_MIR_SET1 = 0xffffffff & ~INT1_WAKE_MASK; | ||
288 | INTC_MIR_SET2 = 0xffffffff & ~INT2_WAKE_MASK; | ||
289 | |||
290 | pmdomain_set_autoidle(); | ||
291 | |||
292 | /* Clear old wake-up events */ | ||
293 | PM_WKST1_CORE = 0; | ||
294 | PM_WKST2_CORE = 0; | ||
295 | PM_WKST_WKUP = 0; | ||
296 | |||
297 | /* Enable wake-up events */ | ||
298 | PM_WKEN1_CORE = (1 << 22) | (1 << 21); /* UART1 & 2 */ | ||
299 | PM_WKEN2_CORE = (1 << 2); /* UART3 */ | ||
300 | PM_WKEN_WKUP = (1 << 2) | (1 << 0); /* GPIO & GPT1 */ | ||
301 | |||
302 | /* Disable clocks except for CM_ICLKEN2_CORE. It gets disabled | ||
303 | * in the SRAM suspend code */ | ||
304 | CM_FCLKEN1_CORE = 0; | ||
305 | CM_FCLKEN2_CORE = 0; | ||
306 | CM_ICLKEN1_CORE = 0; | ||
307 | CM_ICLKEN3_CORE = 0; | ||
308 | CM_ICLKEN4_CORE = 0; | ||
309 | |||
310 | omap2_pm_debug("Status before suspend"); | ||
311 | |||
312 | /* Must wait for serial buffers to clear */ | ||
313 | mdelay(200); | ||
314 | |||
315 | /* Jump to SRAM suspend code | ||
316 | * REVISIT: When is this SDRC_DLLB_CTRL? | ||
317 | */ | ||
318 | omap2_sram_suspend(SDRC_DLLA_CTRL, processor_type); | ||
319 | |||
320 | /* Back from sleep */ | ||
321 | omap2_pm_restore_registers(); | ||
322 | |||
323 | local_fiq_enable(); | ||
324 | local_irq_enable(); | ||
325 | |||
326 | return 0; | 82 | return 0; |
327 | } | 83 | } |
328 | 84 | ||
@@ -357,30 +113,6 @@ static struct platform_suspend_ops omap_pm_ops = { | |||
357 | 113 | ||
358 | int __init omap2_pm_init(void) | 114 | int __init omap2_pm_init(void) |
359 | { | 115 | { |
360 | printk("Power Management for TI OMAP.\n"); | ||
361 | |||
362 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
363 | if (IS_ERR(vclk)) { | ||
364 | printk(KERN_ERR "Could not get PM vclk\n"); | ||
365 | return -ENODEV; | ||
366 | } | ||
367 | |||
368 | /* | ||
369 | * We copy the assembler sleep/wakeup routines to SRAM. | ||
370 | * These routines need to be in SRAM as that's the only | ||
371 | * memory the MPU can see when it wakes up. | ||
372 | */ | ||
373 | omap2_sram_idle = omap_sram_push(omap24xx_idle_loop_suspend, | ||
374 | omap24xx_idle_loop_suspend_sz); | ||
375 | |||
376 | omap2_sram_suspend = omap_sram_push(omap24xx_cpu_suspend, | ||
377 | omap24xx_cpu_suspend_sz); | ||
378 | |||
379 | suspend_set_ops(&omap_pm_ops); | ||
380 | pm_idle = omap2_pm_idle; | ||
381 | |||
382 | pmdomain_init(); | ||
383 | |||
384 | return 0; | 116 | return 0; |
385 | } | 117 | } |
386 | 118 | ||
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h new file mode 100644 index 000000000000..cacb34086e35 --- /dev/null +++ b/arch/arm/mach-omap2/prcm-common.h | |||
@@ -0,0 +1,317 @@ | |||
1 | #ifndef __ARCH_ASM_MACH_OMAP2_PRCM_COMMON_H | ||
2 | #define __ARCH_ASM_MACH_OMAP2_PRCM_COMMON_H | ||
3 | |||
4 | /* | ||
5 | * OMAP2/3 PRCM base and module definitions | ||
6 | * | ||
7 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007-2008 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | |||
18 | /* Module offsets from both CM_BASE & PRM_BASE */ | ||
19 | |||
20 | /* | ||
21 | * Offsets that are the same on 24xx and 34xx | ||
22 | * | ||
23 | * Technically, in terms of the TRM, OCP_MOD is 34xx only; PLL_MOD is | ||
24 | * CCR_MOD on 3430; and GFX_MOD only exists < 3430ES2. | ||
25 | */ | ||
26 | #define OCP_MOD 0x000 | ||
27 | #define MPU_MOD 0x100 | ||
28 | #define CORE_MOD 0x200 | ||
29 | #define GFX_MOD 0x300 | ||
30 | #define WKUP_MOD 0x400 | ||
31 | #define PLL_MOD 0x500 | ||
32 | |||
33 | |||
34 | /* Chip-specific module offsets */ | ||
35 | #define OMAP24XX_DSP_MOD 0x800 | ||
36 | |||
37 | #define OMAP2430_MDM_MOD 0xc00 | ||
38 | |||
39 | /* IVA2 module is < base on 3430 */ | ||
40 | #define OMAP3430_IVA2_MOD -0x800 | ||
41 | #define OMAP3430ES2_SGX_MOD GFX_MOD | ||
42 | #define OMAP3430_CCR_MOD PLL_MOD | ||
43 | #define OMAP3430_DSS_MOD 0x600 | ||
44 | #define OMAP3430_CAM_MOD 0x700 | ||
45 | #define OMAP3430_PER_MOD 0x800 | ||
46 | #define OMAP3430_EMU_MOD 0x900 | ||
47 | #define OMAP3430_GR_MOD 0xa00 | ||
48 | #define OMAP3430_NEON_MOD 0xb00 | ||
49 | #define OMAP3430ES2_USBHOST_MOD 0xc00 | ||
50 | |||
51 | |||
52 | /* 24XX register bits shared between CM & PRM registers */ | ||
53 | |||
54 | /* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */ | ||
55 | #define OMAP2420_EN_MMC_SHIFT 26 | ||
56 | #define OMAP2420_EN_MMC (1 << 26) | ||
57 | #define OMAP24XX_EN_UART2_SHIFT 22 | ||
58 | #define OMAP24XX_EN_UART2 (1 << 22) | ||
59 | #define OMAP24XX_EN_UART1_SHIFT 21 | ||
60 | #define OMAP24XX_EN_UART1 (1 << 21) | ||
61 | #define OMAP24XX_EN_MCSPI2_SHIFT 18 | ||
62 | #define OMAP24XX_EN_MCSPI2 (1 << 18) | ||
63 | #define OMAP24XX_EN_MCSPI1_SHIFT 17 | ||
64 | #define OMAP24XX_EN_MCSPI1 (1 << 17) | ||
65 | #define OMAP24XX_EN_MCBSP2_SHIFT 16 | ||
66 | #define OMAP24XX_EN_MCBSP2 (1 << 16) | ||
67 | #define OMAP24XX_EN_MCBSP1_SHIFT 15 | ||
68 | #define OMAP24XX_EN_MCBSP1 (1 << 15) | ||
69 | #define OMAP24XX_EN_GPT12_SHIFT 14 | ||
70 | #define OMAP24XX_EN_GPT12 (1 << 14) | ||
71 | #define OMAP24XX_EN_GPT11_SHIFT 13 | ||
72 | #define OMAP24XX_EN_GPT11 (1 << 13) | ||
73 | #define OMAP24XX_EN_GPT10_SHIFT 12 | ||
74 | #define OMAP24XX_EN_GPT10 (1 << 12) | ||
75 | #define OMAP24XX_EN_GPT9_SHIFT 11 | ||
76 | #define OMAP24XX_EN_GPT9 (1 << 11) | ||
77 | #define OMAP24XX_EN_GPT8_SHIFT 10 | ||
78 | #define OMAP24XX_EN_GPT8 (1 << 10) | ||
79 | #define OMAP24XX_EN_GPT7_SHIFT 9 | ||
80 | #define OMAP24XX_EN_GPT7 (1 << 9) | ||
81 | #define OMAP24XX_EN_GPT6_SHIFT 8 | ||
82 | #define OMAP24XX_EN_GPT6 (1 << 8) | ||
83 | #define OMAP24XX_EN_GPT5_SHIFT 7 | ||
84 | #define OMAP24XX_EN_GPT5 (1 << 7) | ||
85 | #define OMAP24XX_EN_GPT4_SHIFT 6 | ||
86 | #define OMAP24XX_EN_GPT4 (1 << 6) | ||
87 | #define OMAP24XX_EN_GPT3_SHIFT 5 | ||
88 | #define OMAP24XX_EN_GPT3 (1 << 5) | ||
89 | #define OMAP24XX_EN_GPT2_SHIFT 4 | ||
90 | #define OMAP24XX_EN_GPT2 (1 << 4) | ||
91 | #define OMAP2420_EN_VLYNQ_SHIFT 3 | ||
92 | #define OMAP2420_EN_VLYNQ (1 << 3) | ||
93 | |||
94 | /* CM_FCLKEN2_CORE, CM_ICLKEN2_CORE, PM_WKEN2_CORE shared bits */ | ||
95 | #define OMAP2430_EN_GPIO5_SHIFT 10 | ||
96 | #define OMAP2430_EN_GPIO5 (1 << 10) | ||
97 | #define OMAP2430_EN_MCSPI3_SHIFT 9 | ||
98 | #define OMAP2430_EN_MCSPI3 (1 << 9) | ||
99 | #define OMAP2430_EN_MMCHS2_SHIFT 8 | ||
100 | #define OMAP2430_EN_MMCHS2 (1 << 8) | ||
101 | #define OMAP2430_EN_MMCHS1_SHIFT 7 | ||
102 | #define OMAP2430_EN_MMCHS1 (1 << 7) | ||
103 | #define OMAP24XX_EN_UART3_SHIFT 2 | ||
104 | #define OMAP24XX_EN_UART3 (1 << 2) | ||
105 | #define OMAP24XX_EN_USB_SHIFT 0 | ||
106 | #define OMAP24XX_EN_USB (1 << 0) | ||
107 | |||
108 | /* CM_ICLKEN2_CORE, PM_WKEN2_CORE shared bits */ | ||
109 | #define OMAP2430_EN_MDM_INTC_SHIFT 11 | ||
110 | #define OMAP2430_EN_MDM_INTC (1 << 11) | ||
111 | #define OMAP2430_EN_USBHS_SHIFT 6 | ||
112 | #define OMAP2430_EN_USBHS (1 << 6) | ||
113 | |||
114 | /* CM_IDLEST1_CORE, PM_WKST1_CORE shared bits */ | ||
115 | #define OMAP2420_ST_MMC (1 << 26) | ||
116 | #define OMAP24XX_ST_UART2 (1 << 22) | ||
117 | #define OMAP24XX_ST_UART1 (1 << 21) | ||
118 | #define OMAP24XX_ST_MCSPI2 (1 << 18) | ||
119 | #define OMAP24XX_ST_MCSPI1 (1 << 17) | ||
120 | #define OMAP24XX_ST_GPT12 (1 << 14) | ||
121 | #define OMAP24XX_ST_GPT11 (1 << 13) | ||
122 | #define OMAP24XX_ST_GPT10 (1 << 12) | ||
123 | #define OMAP24XX_ST_GPT9 (1 << 11) | ||
124 | #define OMAP24XX_ST_GPT8 (1 << 10) | ||
125 | #define OMAP24XX_ST_GPT7 (1 << 9) | ||
126 | #define OMAP24XX_ST_GPT6 (1 << 8) | ||
127 | #define OMAP24XX_ST_GPT5 (1 << 7) | ||
128 | #define OMAP24XX_ST_GPT4 (1 << 6) | ||
129 | #define OMAP24XX_ST_GPT3 (1 << 5) | ||
130 | #define OMAP24XX_ST_GPT2 (1 << 4) | ||
131 | #define OMAP2420_ST_VLYNQ (1 << 3) | ||
132 | |||
133 | /* CM_IDLEST2_CORE, PM_WKST2_CORE shared bits */ | ||
134 | #define OMAP2430_ST_MDM_INTC (1 << 11) | ||
135 | #define OMAP2430_ST_GPIO5 (1 << 10) | ||
136 | #define OMAP2430_ST_MCSPI3 (1 << 9) | ||
137 | #define OMAP2430_ST_MMCHS2 (1 << 8) | ||
138 | #define OMAP2430_ST_MMCHS1 (1 << 7) | ||
139 | #define OMAP2430_ST_USBHS (1 << 6) | ||
140 | #define OMAP24XX_ST_UART3 (1 << 2) | ||
141 | #define OMAP24XX_ST_USB (1 << 0) | ||
142 | |||
143 | /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ | ||
144 | #define OMAP24XX_EN_GPIOS_SHIFT 2 | ||
145 | #define OMAP24XX_EN_GPIOS (1 << 2) | ||
146 | #define OMAP24XX_EN_GPT1_SHIFT 0 | ||
147 | #define OMAP24XX_EN_GPT1 (1 << 0) | ||
148 | |||
149 | /* PM_WKST_WKUP, CM_IDLEST_WKUP shared bits */ | ||
150 | #define OMAP24XX_ST_GPIOS (1 << 2) | ||
151 | #define OMAP24XX_ST_GPT1 (1 << 0) | ||
152 | |||
153 | /* CM_IDLEST_MDM and PM_WKST_MDM shared bits */ | ||
154 | #define OMAP2430_ST_MDM (1 << 0) | ||
155 | |||
156 | |||
157 | /* 3430 register bits shared between CM & PRM registers */ | ||
158 | |||
159 | /* CM_REVISION, PRM_REVISION shared bits */ | ||
160 | #define OMAP3430_REV_SHIFT 0 | ||
161 | #define OMAP3430_REV_MASK (0xff << 0) | ||
162 | |||
163 | /* CM_SYSCONFIG, PRM_SYSCONFIG shared bits */ | ||
164 | #define OMAP3430_AUTOIDLE (1 << 0) | ||
165 | |||
166 | /* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */ | ||
167 | #define OMAP3430_EN_MMC2 (1 << 25) | ||
168 | #define OMAP3430_EN_MMC2_SHIFT 25 | ||
169 | #define OMAP3430_EN_MMC1 (1 << 24) | ||
170 | #define OMAP3430_EN_MMC1_SHIFT 24 | ||
171 | #define OMAP3430_EN_MCSPI4 (1 << 21) | ||
172 | #define OMAP3430_EN_MCSPI4_SHIFT 21 | ||
173 | #define OMAP3430_EN_MCSPI3 (1 << 20) | ||
174 | #define OMAP3430_EN_MCSPI3_SHIFT 20 | ||
175 | #define OMAP3430_EN_MCSPI2 (1 << 19) | ||
176 | #define OMAP3430_EN_MCSPI2_SHIFT 19 | ||
177 | #define OMAP3430_EN_MCSPI1 (1 << 18) | ||
178 | #define OMAP3430_EN_MCSPI1_SHIFT 18 | ||
179 | #define OMAP3430_EN_I2C3 (1 << 17) | ||
180 | #define OMAP3430_EN_I2C3_SHIFT 17 | ||
181 | #define OMAP3430_EN_I2C2 (1 << 16) | ||
182 | #define OMAP3430_EN_I2C2_SHIFT 16 | ||
183 | #define OMAP3430_EN_I2C1 (1 << 15) | ||
184 | #define OMAP3430_EN_I2C1_SHIFT 15 | ||
185 | #define OMAP3430_EN_UART2 (1 << 14) | ||
186 | #define OMAP3430_EN_UART2_SHIFT 14 | ||
187 | #define OMAP3430_EN_UART1 (1 << 13) | ||
188 | #define OMAP3430_EN_UART1_SHIFT 13 | ||
189 | #define OMAP3430_EN_GPT11 (1 << 12) | ||
190 | #define OMAP3430_EN_GPT11_SHIFT 12 | ||
191 | #define OMAP3430_EN_GPT10 (1 << 11) | ||
192 | #define OMAP3430_EN_GPT10_SHIFT 11 | ||
193 | #define OMAP3430_EN_MCBSP5 (1 << 10) | ||
194 | #define OMAP3430_EN_MCBSP5_SHIFT 10 | ||
195 | #define OMAP3430_EN_MCBSP1 (1 << 9) | ||
196 | #define OMAP3430_EN_MCBSP1_SHIFT 9 | ||
197 | #define OMAP3430_EN_FSHOSTUSB (1 << 5) | ||
198 | #define OMAP3430_EN_FSHOSTUSB_SHIFT 5 | ||
199 | #define OMAP3430_EN_D2D (1 << 3) | ||
200 | #define OMAP3430_EN_D2D_SHIFT 3 | ||
201 | |||
202 | /* CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */ | ||
203 | #define OMAP3430_EN_HSOTGUSB (1 << 4) | ||
204 | #define OMAP3430_EN_HSOTGUSB_SHIFT 4 | ||
205 | |||
206 | /* PM_WKST1_CORE, CM_IDLEST1_CORE shared bits */ | ||
207 | #define OMAP3430_ST_MMC2 (1 << 25) | ||
208 | #define OMAP3430_ST_MMC1 (1 << 24) | ||
209 | #define OMAP3430_ST_MCSPI4 (1 << 21) | ||
210 | #define OMAP3430_ST_MCSPI3 (1 << 20) | ||
211 | #define OMAP3430_ST_MCSPI2 (1 << 19) | ||
212 | #define OMAP3430_ST_MCSPI1 (1 << 18) | ||
213 | #define OMAP3430_ST_I2C3 (1 << 17) | ||
214 | #define OMAP3430_ST_I2C2 (1 << 16) | ||
215 | #define OMAP3430_ST_I2C1 (1 << 15) | ||
216 | #define OMAP3430_ST_UART2 (1 << 14) | ||
217 | #define OMAP3430_ST_UART1 (1 << 13) | ||
218 | #define OMAP3430_ST_GPT11 (1 << 12) | ||
219 | #define OMAP3430_ST_GPT10 (1 << 11) | ||
220 | #define OMAP3430_ST_MCBSP5 (1 << 10) | ||
221 | #define OMAP3430_ST_MCBSP1 (1 << 9) | ||
222 | #define OMAP3430_ST_FSHOSTUSB (1 << 5) | ||
223 | #define OMAP3430_ST_HSOTGUSB (1 << 4) | ||
224 | #define OMAP3430_ST_D2D (1 << 3) | ||
225 | |||
226 | /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ | ||
227 | #define OMAP3430_EN_GPIO1 (1 << 3) | ||
228 | #define OMAP3430_EN_GPIO1_SHIFT 3 | ||
229 | #define OMAP3430_EN_GPT1 (1 << 0) | ||
230 | #define OMAP3430_EN_GPT1_SHIFT 0 | ||
231 | |||
232 | /* CM_FCLKEN_WKUP, PM_WKEN_WKUP shared bits */ | ||
233 | #define OMAP3430_EN_SR2 (1 << 7) | ||
234 | #define OMAP3430_EN_SR2_SHIFT 7 | ||
235 | #define OMAP3430_EN_SR1 (1 << 6) | ||
236 | #define OMAP3430_EN_SR1_SHIFT 6 | ||
237 | |||
238 | /* CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ | ||
239 | #define OMAP3430_EN_GPT12 (1 << 1) | ||
240 | #define OMAP3430_EN_GPT12_SHIFT 1 | ||
241 | |||
242 | /* CM_IDLEST_WKUP, PM_WKST_WKUP shared bits */ | ||
243 | #define OMAP3430_ST_SR2 (1 << 7) | ||
244 | #define OMAP3430_ST_SR1 (1 << 6) | ||
245 | #define OMAP3430_ST_GPIO1 (1 << 3) | ||
246 | #define OMAP3430_ST_GPT12 (1 << 1) | ||
247 | #define OMAP3430_ST_GPT1 (1 << 0) | ||
248 | |||
249 | /* | ||
250 | * CM_SLEEPDEP_GFX, CM_SLEEPDEP_DSS, CM_SLEEPDEP_CAM, | ||
251 | * CM_SLEEPDEP_PER, PM_WKDEP_IVA2, PM_WKDEP_GFX, | ||
252 | * PM_WKDEP_DSS, PM_WKDEP_CAM, PM_WKDEP_PER, PM_WKDEP_NEON shared bits | ||
253 | */ | ||
254 | #define OMAP3430_EN_MPU (1 << 1) | ||
255 | #define OMAP3430_EN_MPU_SHIFT 1 | ||
256 | |||
257 | /* CM_FCLKEN_PER, CM_ICLKEN_PER, PM_WKEN_PER shared bits */ | ||
258 | #define OMAP3430_EN_GPIO6 (1 << 17) | ||
259 | #define OMAP3430_EN_GPIO6_SHIFT 17 | ||
260 | #define OMAP3430_EN_GPIO5 (1 << 16) | ||
261 | #define OMAP3430_EN_GPIO5_SHIFT 16 | ||
262 | #define OMAP3430_EN_GPIO4 (1 << 15) | ||
263 | #define OMAP3430_EN_GPIO4_SHIFT 15 | ||
264 | #define OMAP3430_EN_GPIO3 (1 << 14) | ||
265 | #define OMAP3430_EN_GPIO3_SHIFT 14 | ||
266 | #define OMAP3430_EN_GPIO2 (1 << 13) | ||
267 | #define OMAP3430_EN_GPIO2_SHIFT 13 | ||
268 | #define OMAP3430_EN_UART3 (1 << 11) | ||
269 | #define OMAP3430_EN_UART3_SHIFT 11 | ||
270 | #define OMAP3430_EN_GPT9 (1 << 10) | ||
271 | #define OMAP3430_EN_GPT9_SHIFT 10 | ||
272 | #define OMAP3430_EN_GPT8 (1 << 9) | ||
273 | #define OMAP3430_EN_GPT8_SHIFT 9 | ||
274 | #define OMAP3430_EN_GPT7 (1 << 8) | ||
275 | #define OMAP3430_EN_GPT7_SHIFT 8 | ||
276 | #define OMAP3430_EN_GPT6 (1 << 7) | ||
277 | #define OMAP3430_EN_GPT6_SHIFT 7 | ||
278 | #define OMAP3430_EN_GPT5 (1 << 6) | ||
279 | #define OMAP3430_EN_GPT5_SHIFT 6 | ||
280 | #define OMAP3430_EN_GPT4 (1 << 5) | ||
281 | #define OMAP3430_EN_GPT4_SHIFT 5 | ||
282 | #define OMAP3430_EN_GPT3 (1 << 4) | ||
283 | #define OMAP3430_EN_GPT3_SHIFT 4 | ||
284 | #define OMAP3430_EN_GPT2 (1 << 3) | ||
285 | #define OMAP3430_EN_GPT2_SHIFT 3 | ||
286 | |||
287 | /* CM_FCLKEN_PER, CM_ICLKEN_PER, PM_WKEN_PER, PM_WKST_PER shared bits */ | ||
288 | /* XXX Possible TI documentation bug: should the PM_WKST_PER EN_* bits | ||
289 | * be ST_* bits instead? */ | ||
290 | #define OMAP3430_EN_MCBSP4 (1 << 2) | ||
291 | #define OMAP3430_EN_MCBSP4_SHIFT 2 | ||
292 | #define OMAP3430_EN_MCBSP3 (1 << 1) | ||
293 | #define OMAP3430_EN_MCBSP3_SHIFT 1 | ||
294 | #define OMAP3430_EN_MCBSP2 (1 << 0) | ||
295 | #define OMAP3430_EN_MCBSP2_SHIFT 0 | ||
296 | |||
297 | /* CM_IDLEST_PER, PM_WKST_PER shared bits */ | ||
298 | #define OMAP3430_ST_GPIO6 (1 << 17) | ||
299 | #define OMAP3430_ST_GPIO5 (1 << 16) | ||
300 | #define OMAP3430_ST_GPIO4 (1 << 15) | ||
301 | #define OMAP3430_ST_GPIO3 (1 << 14) | ||
302 | #define OMAP3430_ST_GPIO2 (1 << 13) | ||
303 | #define OMAP3430_ST_UART3 (1 << 11) | ||
304 | #define OMAP3430_ST_GPT9 (1 << 10) | ||
305 | #define OMAP3430_ST_GPT8 (1 << 9) | ||
306 | #define OMAP3430_ST_GPT7 (1 << 8) | ||
307 | #define OMAP3430_ST_GPT6 (1 << 7) | ||
308 | #define OMAP3430_ST_GPT5 (1 << 6) | ||
309 | #define OMAP3430_ST_GPT4 (1 << 5) | ||
310 | #define OMAP3430_ST_GPT3 (1 << 4) | ||
311 | #define OMAP3430_ST_GPT2 (1 << 3) | ||
312 | |||
313 | /* CM_SLEEPDEP_PER, PM_WKDEP_IVA2, PM_WKDEP_MPU, PM_WKDEP_PER shared bits */ | ||
314 | #define OMAP3430_EN_CORE (1 << 0) | ||
315 | |||
316 | #endif | ||
317 | |||
diff --git a/arch/arm/mach-omap2/prcm-regs.h b/arch/arm/mach-omap2/prcm-regs.h deleted file mode 100644 index 5e1c4b53ee9d..000000000000 --- a/arch/arm/mach-omap2/prcm-regs.h +++ /dev/null | |||
@@ -1,483 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap2/prcm-regs.h | ||
3 | * | ||
4 | * OMAP24XX Power Reset and Clock Management (PRCM) registers | ||
5 | * | ||
6 | * Copyright (C) 2005 Texas Instruments, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __ARCH_ARM_MACH_OMAP2_PRCM_H | ||
24 | #define __ARCH_ARM_MACH_OMAP2_PRCM_H | ||
25 | |||
26 | /* SET_PERFORMANCE_LEVEL PARAMETERS */ | ||
27 | #define PRCM_HALF_SPEED 1 | ||
28 | #define PRCM_FULL_SPEED 2 | ||
29 | |||
30 | #ifndef __ASSEMBLER__ | ||
31 | |||
32 | #define PRCM_REG32(offset) __REG32(OMAP24XX_PRCM_BASE + (offset)) | ||
33 | |||
34 | #define PRCM_REVISION PRCM_REG32(0x000) | ||
35 | #define PRCM_SYSCONFIG PRCM_REG32(0x010) | ||
36 | #define PRCM_IRQSTATUS_MPU PRCM_REG32(0x018) | ||
37 | #define PRCM_IRQENABLE_MPU PRCM_REG32(0x01C) | ||
38 | #define PRCM_VOLTCTRL PRCM_REG32(0x050) | ||
39 | #define PRCM_VOLTST PRCM_REG32(0x054) | ||
40 | #define PRCM_CLKSRC_CTRL PRCM_REG32(0x060) | ||
41 | #define PRCM_CLKOUT_CTRL PRCM_REG32(0x070) | ||
42 | #define PRCM_CLKEMUL_CTRL PRCM_REG32(0x078) | ||
43 | #define PRCM_CLKCFG_CTRL PRCM_REG32(0x080) | ||
44 | #define PRCM_CLKCFG_STATUS PRCM_REG32(0x084) | ||
45 | #define PRCM_VOLTSETUP PRCM_REG32(0x090) | ||
46 | #define PRCM_CLKSSETUP PRCM_REG32(0x094) | ||
47 | #define PRCM_POLCTRL PRCM_REG32(0x098) | ||
48 | |||
49 | /* GENERAL PURPOSE */ | ||
50 | #define GENERAL_PURPOSE1 PRCM_REG32(0x0B0) | ||
51 | #define GENERAL_PURPOSE2 PRCM_REG32(0x0B4) | ||
52 | #define GENERAL_PURPOSE3 PRCM_REG32(0x0B8) | ||
53 | #define GENERAL_PURPOSE4 PRCM_REG32(0x0BC) | ||
54 | #define GENERAL_PURPOSE5 PRCM_REG32(0x0C0) | ||
55 | #define GENERAL_PURPOSE6 PRCM_REG32(0x0C4) | ||
56 | #define GENERAL_PURPOSE7 PRCM_REG32(0x0C8) | ||
57 | #define GENERAL_PURPOSE8 PRCM_REG32(0x0CC) | ||
58 | #define GENERAL_PURPOSE9 PRCM_REG32(0x0D0) | ||
59 | #define GENERAL_PURPOSE10 PRCM_REG32(0x0D4) | ||
60 | #define GENERAL_PURPOSE11 PRCM_REG32(0x0D8) | ||
61 | #define GENERAL_PURPOSE12 PRCM_REG32(0x0DC) | ||
62 | #define GENERAL_PURPOSE13 PRCM_REG32(0x0E0) | ||
63 | #define GENERAL_PURPOSE14 PRCM_REG32(0x0E4) | ||
64 | #define GENERAL_PURPOSE15 PRCM_REG32(0x0E8) | ||
65 | #define GENERAL_PURPOSE16 PRCM_REG32(0x0EC) | ||
66 | #define GENERAL_PURPOSE17 PRCM_REG32(0x0F0) | ||
67 | #define GENERAL_PURPOSE18 PRCM_REG32(0x0F4) | ||
68 | #define GENERAL_PURPOSE19 PRCM_REG32(0x0F8) | ||
69 | #define GENERAL_PURPOSE20 PRCM_REG32(0x0FC) | ||
70 | |||
71 | /* MPU */ | ||
72 | #define CM_CLKSEL_MPU PRCM_REG32(0x140) | ||
73 | #define CM_CLKSTCTRL_MPU PRCM_REG32(0x148) | ||
74 | #define RM_RSTST_MPU PRCM_REG32(0x158) | ||
75 | #define PM_WKDEP_MPU PRCM_REG32(0x1C8) | ||
76 | #define PM_EVGENCTRL_MPU PRCM_REG32(0x1D4) | ||
77 | #define PM_EVEGENONTIM_MPU PRCM_REG32(0x1D8) | ||
78 | #define PM_EVEGENOFFTIM_MPU PRCM_REG32(0x1DC) | ||
79 | #define PM_PWSTCTRL_MPU PRCM_REG32(0x1E0) | ||
80 | #define PM_PWSTST_MPU PRCM_REG32(0x1E4) | ||
81 | |||
82 | /* CORE */ | ||
83 | #define CM_FCLKEN1_CORE PRCM_REG32(0x200) | ||
84 | #define CM_FCLKEN2_CORE PRCM_REG32(0x204) | ||
85 | #define CM_FCLKEN3_CORE PRCM_REG32(0x208) | ||
86 | #define CM_ICLKEN1_CORE PRCM_REG32(0x210) | ||
87 | #define CM_ICLKEN2_CORE PRCM_REG32(0x214) | ||
88 | #define CM_ICLKEN3_CORE PRCM_REG32(0x218) | ||
89 | #define CM_ICLKEN4_CORE PRCM_REG32(0x21C) | ||
90 | #define CM_IDLEST1_CORE PRCM_REG32(0x220) | ||
91 | #define CM_IDLEST2_CORE PRCM_REG32(0x224) | ||
92 | #define CM_IDLEST3_CORE PRCM_REG32(0x228) | ||
93 | #define CM_IDLEST4_CORE PRCM_REG32(0x22C) | ||
94 | #define CM_AUTOIDLE1_CORE PRCM_REG32(0x230) | ||
95 | #define CM_AUTOIDLE2_CORE PRCM_REG32(0x234) | ||
96 | #define CM_AUTOIDLE3_CORE PRCM_REG32(0x238) | ||
97 | #define CM_AUTOIDLE4_CORE PRCM_REG32(0x23C) | ||
98 | #define CM_CLKSEL1_CORE PRCM_REG32(0x240) | ||
99 | #define CM_CLKSEL2_CORE PRCM_REG32(0x244) | ||
100 | #define CM_CLKSTCTRL_CORE PRCM_REG32(0x248) | ||
101 | #define PM_WKEN1_CORE PRCM_REG32(0x2A0) | ||
102 | #define PM_WKEN2_CORE PRCM_REG32(0x2A4) | ||
103 | #define PM_WKST1_CORE PRCM_REG32(0x2B0) | ||
104 | #define PM_WKST2_CORE PRCM_REG32(0x2B4) | ||
105 | #define PM_WKDEP_CORE PRCM_REG32(0x2C8) | ||
106 | #define PM_PWSTCTRL_CORE PRCM_REG32(0x2E0) | ||
107 | #define PM_PWSTST_CORE PRCM_REG32(0x2E4) | ||
108 | |||
109 | /* GFX */ | ||
110 | #define CM_FCLKEN_GFX PRCM_REG32(0x300) | ||
111 | #define CM_ICLKEN_GFX PRCM_REG32(0x310) | ||
112 | #define CM_IDLEST_GFX PRCM_REG32(0x320) | ||
113 | #define CM_CLKSEL_GFX PRCM_REG32(0x340) | ||
114 | #define CM_CLKSTCTRL_GFX PRCM_REG32(0x348) | ||
115 | #define RM_RSTCTRL_GFX PRCM_REG32(0x350) | ||
116 | #define RM_RSTST_GFX PRCM_REG32(0x358) | ||
117 | #define PM_WKDEP_GFX PRCM_REG32(0x3C8) | ||
118 | #define PM_PWSTCTRL_GFX PRCM_REG32(0x3E0) | ||
119 | #define PM_PWSTST_GFX PRCM_REG32(0x3E4) | ||
120 | |||
121 | /* WAKE-UP */ | ||
122 | #define CM_FCLKEN_WKUP PRCM_REG32(0x400) | ||
123 | #define CM_ICLKEN_WKUP PRCM_REG32(0x410) | ||
124 | #define CM_IDLEST_WKUP PRCM_REG32(0x420) | ||
125 | #define CM_AUTOIDLE_WKUP PRCM_REG32(0x430) | ||
126 | #define CM_CLKSEL_WKUP PRCM_REG32(0x440) | ||
127 | #define RM_RSTCTRL_WKUP PRCM_REG32(0x450) | ||
128 | #define RM_RSTTIME_WKUP PRCM_REG32(0x454) | ||
129 | #define RM_RSTST_WKUP PRCM_REG32(0x458) | ||
130 | #define PM_WKEN_WKUP PRCM_REG32(0x4A0) | ||
131 | #define PM_WKST_WKUP PRCM_REG32(0x4B0) | ||
132 | |||
133 | /* CLOCKS */ | ||
134 | #define CM_CLKEN_PLL PRCM_REG32(0x500) | ||
135 | #define CM_IDLEST_CKGEN PRCM_REG32(0x520) | ||
136 | #define CM_AUTOIDLE_PLL PRCM_REG32(0x530) | ||
137 | #define CM_CLKSEL1_PLL PRCM_REG32(0x540) | ||
138 | #define CM_CLKSEL2_PLL PRCM_REG32(0x544) | ||
139 | |||
140 | /* DSP */ | ||
141 | #define CM_FCLKEN_DSP PRCM_REG32(0x800) | ||
142 | #define CM_ICLKEN_DSP PRCM_REG32(0x810) | ||
143 | #define CM_IDLEST_DSP PRCM_REG32(0x820) | ||
144 | #define CM_AUTOIDLE_DSP PRCM_REG32(0x830) | ||
145 | #define CM_CLKSEL_DSP PRCM_REG32(0x840) | ||
146 | #define CM_CLKSTCTRL_DSP PRCM_REG32(0x848) | ||
147 | #define RM_RSTCTRL_DSP PRCM_REG32(0x850) | ||
148 | #define RM_RSTST_DSP PRCM_REG32(0x858) | ||
149 | #define PM_WKEN_DSP PRCM_REG32(0x8A0) | ||
150 | #define PM_WKDEP_DSP PRCM_REG32(0x8C8) | ||
151 | #define PM_PWSTCTRL_DSP PRCM_REG32(0x8E0) | ||
152 | #define PM_PWSTST_DSP PRCM_REG32(0x8E4) | ||
153 | #define PRCM_IRQSTATUS_DSP PRCM_REG32(0x8F0) | ||
154 | #define PRCM_IRQENABLE_DSP PRCM_REG32(0x8F4) | ||
155 | |||
156 | /* IVA */ | ||
157 | #define PRCM_IRQSTATUS_IVA PRCM_REG32(0x8F8) | ||
158 | #define PRCM_IRQENABLE_IVA PRCM_REG32(0x8FC) | ||
159 | |||
160 | /* Modem on 2430 */ | ||
161 | #define CM_FCLKEN_MDM PRCM_REG32(0xC00) | ||
162 | #define CM_ICLKEN_MDM PRCM_REG32(0xC10) | ||
163 | #define CM_IDLEST_MDM PRCM_REG32(0xC20) | ||
164 | #define CM_AUTOIDLE_MDM PRCM_REG32(0xC30) | ||
165 | #define CM_CLKSEL_MDM PRCM_REG32(0xC40) | ||
166 | #define CM_CLKSTCTRL_MDM PRCM_REG32(0xC48) | ||
167 | #define RM_RSTCTRL_MDM PRCM_REG32(0xC50) | ||
168 | #define RM_RSTST_MDM PRCM_REG32(0xC58) | ||
169 | #define PM_WKEN_MDM PRCM_REG32(0xCA0) | ||
170 | #define PM_WKST_MDM PRCM_REG32(0xCB0) | ||
171 | #define PM_WKDEP_MDM PRCM_REG32(0xCC8) | ||
172 | #define PM_PWSTCTRL_MDM PRCM_REG32(0xCE0) | ||
173 | #define PM_PWSTST_MDM PRCM_REG32(0xCE4) | ||
174 | |||
175 | #define OMAP24XX_L4_IO_BASE 0x48000000 | ||
176 | |||
177 | #define DISP_BASE (OMAP24XX_L4_IO_BASE + 0x50000) | ||
178 | #define DISP_REG32(offset) __REG32(DISP_BASE + (offset)) | ||
179 | |||
180 | #define OMAP24XX_GPMC_BASE (L3_24XX_BASE + 0xa000) | ||
181 | #define GPMC_REG32(offset) __REG32(OMAP24XX_GPMC_BASE + (offset)) | ||
182 | |||
183 | /* FIXME: Move these to timer code */ | ||
184 | #define GPT1_BASE (0x48028000) | ||
185 | #define GPT1_REG32(offset) __REG32(GPT1_BASE + (offset)) | ||
186 | |||
187 | /* Misc sysconfig */ | ||
188 | #define DISPC_SYSCONFIG DISP_REG32(0x410) | ||
189 | #define SPI_BASE (OMAP24XX_L4_IO_BASE + 0x98000) | ||
190 | #define MCSPI1_SYSCONFIG __REG32(SPI_BASE + 0x10) | ||
191 | #define MCSPI2_SYSCONFIG __REG32(SPI_BASE + 0x2000 + 0x10) | ||
192 | #define MCSPI3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0xb8010) | ||
193 | |||
194 | #define CAMERA_MMU_SYSCONFIG __REG32(DISP_BASE + 0x2C10) | ||
195 | #define CAMERA_DMA_SYSCONFIG __REG32(DISP_BASE + 0x282C) | ||
196 | #define SYSTEM_DMA_SYSCONFIG __REG32(DISP_BASE + 0x602C) | ||
197 | #define GPMC_SYSCONFIG GPMC_REG32(0x010) | ||
198 | #define MAILBOXES_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x94010) | ||
199 | #define UART1_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6A054) | ||
200 | #define UART2_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6C054) | ||
201 | #define UART3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6E054) | ||
202 | #define SDRC_SYSCONFIG __REG32(OMAP24XX_SDRC_BASE + 0x10) | ||
203 | #define OMAP24XX_SMS_BASE (L3_24XX_BASE + 0x8000) | ||
204 | #define SMS_SYSCONFIG __REG32(OMAP24XX_SMS_BASE + 0x10) | ||
205 | #define SSI_SYSCONFIG __REG32(DISP_BASE + 0x8010) | ||
206 | |||
207 | /* rkw - good cannidates for PM_ to start what nm was trying */ | ||
208 | #define OMAP24XX_GPT2 (OMAP24XX_L4_IO_BASE + 0x2A000) | ||
209 | #define OMAP24XX_GPT3 (OMAP24XX_L4_IO_BASE + 0x78000) | ||
210 | #define OMAP24XX_GPT4 (OMAP24XX_L4_IO_BASE + 0x7A000) | ||
211 | #define OMAP24XX_GPT5 (OMAP24XX_L4_IO_BASE + 0x7C000) | ||
212 | #define OMAP24XX_GPT6 (OMAP24XX_L4_IO_BASE + 0x7E000) | ||
213 | #define OMAP24XX_GPT7 (OMAP24XX_L4_IO_BASE + 0x80000) | ||
214 | #define OMAP24XX_GPT8 (OMAP24XX_L4_IO_BASE + 0x82000) | ||
215 | #define OMAP24XX_GPT9 (OMAP24XX_L4_IO_BASE + 0x84000) | ||
216 | #define OMAP24XX_GPT10 (OMAP24XX_L4_IO_BASE + 0x86000) | ||
217 | #define OMAP24XX_GPT11 (OMAP24XX_L4_IO_BASE + 0x88000) | ||
218 | #define OMAP24XX_GPT12 (OMAP24XX_L4_IO_BASE + 0x8A000) | ||
219 | |||
220 | /* FIXME: Move these to timer code */ | ||
221 | #define GPTIMER1_SYSCONFIG GPT1_REG32(0x010) | ||
222 | #define GPTIMER2_SYSCONFIG __REG32(OMAP24XX_GPT2 + 0x10) | ||
223 | #define GPTIMER3_SYSCONFIG __REG32(OMAP24XX_GPT3 + 0x10) | ||
224 | #define GPTIMER4_SYSCONFIG __REG32(OMAP24XX_GPT4 + 0x10) | ||
225 | #define GPTIMER5_SYSCONFIG __REG32(OMAP24XX_GPT5 + 0x10) | ||
226 | #define GPTIMER6_SYSCONFIG __REG32(OMAP24XX_GPT6 + 0x10) | ||
227 | #define GPTIMER7_SYSCONFIG __REG32(OMAP24XX_GPT7 + 0x10) | ||
228 | #define GPTIMER8_SYSCONFIG __REG32(OMAP24XX_GPT8 + 0x10) | ||
229 | #define GPTIMER9_SYSCONFIG __REG32(OMAP24XX_GPT9 + 0x10) | ||
230 | #define GPTIMER10_SYSCONFIG __REG32(OMAP24XX_GPT10 + 0x10) | ||
231 | #define GPTIMER11_SYSCONFIG __REG32(OMAP24XX_GPT11 + 0x10) | ||
232 | #define GPTIMER12_SYSCONFIG __REG32(OMAP24XX_GPT12 + 0x10) | ||
233 | |||
234 | /* FIXME: Move these to gpio code */ | ||
235 | #define OMAP24XX_GPIO_BASE 0x48018000 | ||
236 | #define GPIOX_BASE(X) (OMAP24XX_GPIO_BASE + (0x2000 * ((X) - 1))) | ||
237 | |||
238 | #define GPIO1_SYSCONFIG __REG32((GPIOX_BASE(1) + 0x10)) | ||
239 | #define GPIO2_SYSCONFIG __REG32((GPIOX_BASE(2) + 0x10)) | ||
240 | #define GPIO3_SYSCONFIG __REG32((GPIOX_BASE(3) + 0x10)) | ||
241 | #define GPIO4_SYSCONFIG __REG32((GPIOX_BASE(4) + 0x10)) | ||
242 | |||
243 | #if defined(CONFIG_ARCH_OMAP243X) | ||
244 | #define GPIO5_SYSCONFIG __REG32((OMAP24XX_GPIO5_BASE + 0x10)) | ||
245 | #endif | ||
246 | |||
247 | /* GP TIMER 1 */ | ||
248 | #define GPTIMER1_TISTAT GPT1_REG32(0x014) | ||
249 | #define GPTIMER1_TISR GPT1_REG32(0x018) | ||
250 | #define GPTIMER1_TIER GPT1_REG32(0x01C) | ||
251 | #define GPTIMER1_TWER GPT1_REG32(0x020) | ||
252 | #define GPTIMER1_TCLR GPT1_REG32(0x024) | ||
253 | #define GPTIMER1_TCRR GPT1_REG32(0x028) | ||
254 | #define GPTIMER1_TLDR GPT1_REG32(0x02C) | ||
255 | #define GPTIMER1_TTGR GPT1_REG32(0x030) | ||
256 | #define GPTIMER1_TWPS GPT1_REG32(0x034) | ||
257 | #define GPTIMER1_TMAR GPT1_REG32(0x038) | ||
258 | #define GPTIMER1_TCAR1 GPT1_REG32(0x03C) | ||
259 | #define GPTIMER1_TSICR GPT1_REG32(0x040) | ||
260 | #define GPTIMER1_TCAR2 GPT1_REG32(0x044) | ||
261 | |||
262 | /* rkw -- base fix up please... */ | ||
263 | #define GPTIMER3_TISR __REG32(OMAP24XX_L4_IO_BASE + 0x78018) | ||
264 | |||
265 | /* SDRC */ | ||
266 | #define SDRC_DLLA_CTRL __REG32(OMAP24XX_SDRC_BASE + 0x060) | ||
267 | #define SDRC_DLLA_STATUS __REG32(OMAP24XX_SDRC_BASE + 0x064) | ||
268 | #define SDRC_DLLB_CTRL __REG32(OMAP24XX_SDRC_BASE + 0x068) | ||
269 | #define SDRC_DLLB_STATUS __REG32(OMAP24XX_SDRC_BASE + 0x06C) | ||
270 | #define SDRC_POWER __REG32(OMAP24XX_SDRC_BASE + 0x070) | ||
271 | #define SDRC_MR_0 __REG32(OMAP24XX_SDRC_BASE + 0x084) | ||
272 | |||
273 | /* GPIO 1 */ | ||
274 | #define GPIO1_BASE GPIOX_BASE(1) | ||
275 | #define GPIO1_REG32(offset) __REG32(GPIO1_BASE + (offset)) | ||
276 | #define GPIO1_IRQENABLE1 GPIO1_REG32(0x01C) | ||
277 | #define GPIO1_IRQSTATUS1 GPIO1_REG32(0x018) | ||
278 | #define GPIO1_IRQENABLE2 GPIO1_REG32(0x02C) | ||
279 | #define GPIO1_IRQSTATUS2 GPIO1_REG32(0x028) | ||
280 | #define GPIO1_WAKEUPENABLE GPIO1_REG32(0x020) | ||
281 | #define GPIO1_RISINGDETECT GPIO1_REG32(0x048) | ||
282 | #define GPIO1_DATAIN GPIO1_REG32(0x038) | ||
283 | #define GPIO1_OE GPIO1_REG32(0x034) | ||
284 | #define GPIO1_DATAOUT GPIO1_REG32(0x03C) | ||
285 | |||
286 | /* GPIO2 */ | ||
287 | #define GPIO2_BASE GPIOX_BASE(2) | ||
288 | #define GPIO2_REG32(offset) __REG32(GPIO2_BASE + (offset)) | ||
289 | #define GPIO2_IRQENABLE1 GPIO2_REG32(0x01C) | ||
290 | #define GPIO2_IRQSTATUS1 GPIO2_REG32(0x018) | ||
291 | #define GPIO2_IRQENABLE2 GPIO2_REG32(0x02C) | ||
292 | #define GPIO2_IRQSTATUS2 GPIO2_REG32(0x028) | ||
293 | #define GPIO2_WAKEUPENABLE GPIO2_REG32(0x020) | ||
294 | #define GPIO2_RISINGDETECT GPIO2_REG32(0x048) | ||
295 | #define GPIO2_DATAIN GPIO2_REG32(0x038) | ||
296 | #define GPIO2_OE GPIO2_REG32(0x034) | ||
297 | #define GPIO2_DATAOUT GPIO2_REG32(0x03C) | ||
298 | #define GPIO2_DEBOUNCENABLE GPIO2_REG32(0x050) | ||
299 | #define GPIO2_DEBOUNCINGTIME GPIO2_REG32(0x054) | ||
300 | |||
301 | /* GPIO 3 */ | ||
302 | #define GPIO3_BASE GPIOX_BASE(3) | ||
303 | #define GPIO3_REG32(offset) __REG32(GPIO3_BASE + (offset)) | ||
304 | #define GPIO3_IRQENABLE1 GPIO3_REG32(0x01C) | ||
305 | #define GPIO3_IRQSTATUS1 GPIO3_REG32(0x018) | ||
306 | #define GPIO3_IRQENABLE2 GPIO3_REG32(0x02C) | ||
307 | #define GPIO3_IRQSTATUS2 GPIO3_REG32(0x028) | ||
308 | #define GPIO3_WAKEUPENABLE GPIO3_REG32(0x020) | ||
309 | #define GPIO3_RISINGDETECT GPIO3_REG32(0x048) | ||
310 | #define GPIO3_FALLINGDETECT GPIO3_REG32(0x04C) | ||
311 | #define GPIO3_DATAIN GPIO3_REG32(0x038) | ||
312 | #define GPIO3_OE GPIO3_REG32(0x034) | ||
313 | #define GPIO3_DATAOUT GPIO3_REG32(0x03C) | ||
314 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) | ||
315 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) | ||
316 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) | ||
317 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) | ||
318 | |||
319 | /* GPIO 4 */ | ||
320 | #define GPIO4_BASE GPIOX_BASE(4) | ||
321 | #define GPIO4_REG32(offset) __REG32(GPIO4_BASE + (offset)) | ||
322 | #define GPIO4_IRQENABLE1 GPIO4_REG32(0x01C) | ||
323 | #define GPIO4_IRQSTATUS1 GPIO4_REG32(0x018) | ||
324 | #define GPIO4_IRQENABLE2 GPIO4_REG32(0x02C) | ||
325 | #define GPIO4_IRQSTATUS2 GPIO4_REG32(0x028) | ||
326 | #define GPIO4_WAKEUPENABLE GPIO4_REG32(0x020) | ||
327 | #define GPIO4_RISINGDETECT GPIO4_REG32(0x048) | ||
328 | #define GPIO4_FALLINGDETECT GPIO4_REG32(0x04C) | ||
329 | #define GPIO4_DATAIN GPIO4_REG32(0x038) | ||
330 | #define GPIO4_OE GPIO4_REG32(0x034) | ||
331 | #define GPIO4_DATAOUT GPIO4_REG32(0x03C) | ||
332 | #define GPIO4_DEBOUNCENABLE GPIO4_REG32(0x050) | ||
333 | #define GPIO4_DEBOUNCINGTIME GPIO4_REG32(0x054) | ||
334 | |||
335 | #if defined(CONFIG_ARCH_OMAP243X) | ||
336 | /* GPIO 5 */ | ||
337 | #define GPIO5_REG32(offset) __REG32((OMAP24XX_GPIO5_BASE + (offset))) | ||
338 | #define GPIO5_IRQENABLE1 GPIO5_REG32(0x01C) | ||
339 | #define GPIO5_IRQSTATUS1 GPIO5_REG32(0x018) | ||
340 | #define GPIO5_IRQENABLE2 GPIO5_REG32(0x02C) | ||
341 | #define GPIO5_IRQSTATUS2 GPIO5_REG32(0x028) | ||
342 | #define GPIO5_WAKEUPENABLE GPIO5_REG32(0x020) | ||
343 | #define GPIO5_RISINGDETECT GPIO5_REG32(0x048) | ||
344 | #define GPIO5_FALLINGDETECT GPIO5_REG32(0x04C) | ||
345 | #define GPIO5_DATAIN GPIO5_REG32(0x038) | ||
346 | #define GPIO5_OE GPIO5_REG32(0x034) | ||
347 | #define GPIO5_DATAOUT GPIO5_REG32(0x03C) | ||
348 | #define GPIO5_DEBOUNCENABLE GPIO5_REG32(0x050) | ||
349 | #define GPIO5_DEBOUNCINGTIME GPIO5_REG32(0x054) | ||
350 | #endif | ||
351 | |||
352 | /* IO CONFIG */ | ||
353 | #define OMAP24XX_CTRL_BASE (L4_24XX_BASE) | ||
354 | #define CONTROL_REG32(offset) __REG32(OMAP24XX_CTRL_BASE + (offset)) | ||
355 | |||
356 | #define CONTROL_PADCONF_SPI1_NCS2 CONTROL_REG32(0x104) | ||
357 | #define CONTROL_PADCONF_SYS_XTALOUT CONTROL_REG32(0x134) | ||
358 | #define CONTROL_PADCONF_UART1_RX CONTROL_REG32(0x0C8) | ||
359 | #define CONTROL_PADCONF_MCBSP1_DX CONTROL_REG32(0x10C) | ||
360 | #define CONTROL_PADCONF_GPMC_NCS4 CONTROL_REG32(0x090) | ||
361 | #define CONTROL_PADCONF_DSS_D5 CONTROL_REG32(0x0B8) | ||
362 | #define CONTROL_PADCONF_DSS_D9 CONTROL_REG32(0x0BC) /* 2420 */ | ||
363 | #define CONTROL_PADCONF_DSS_D13 CONTROL_REG32(0x0C0) | ||
364 | #define CONTROL_PADCONF_DSS_VSYNC CONTROL_REG32(0x0CC) | ||
365 | #define CONTROL_PADCONF_SYS_NIRQW0 CONTROL_REG32(0x0BC) /* 2430 */ | ||
366 | #define CONTROL_PADCONF_SSI1_FLAG_TX CONTROL_REG32(0x108) /* 2430 */ | ||
367 | |||
368 | /* CONTROL */ | ||
369 | #define CONTROL_DEVCONF CONTROL_REG32(0x274) | ||
370 | #define CONTROL_DEVCONF1 CONTROL_REG32(0x2E8) | ||
371 | |||
372 | /* INTERRUPT CONTROLLER */ | ||
373 | #define INTC_BASE ((L4_24XX_BASE) + 0xfe000) | ||
374 | #define INTC_REG32(offset) __REG32(INTC_BASE + (offset)) | ||
375 | |||
376 | #define INTC1_U_BASE INTC_REG32(0x000) | ||
377 | #define INTC_MIR0 INTC_REG32(0x084) | ||
378 | #define INTC_MIR_SET0 INTC_REG32(0x08C) | ||
379 | #define INTC_MIR_CLEAR0 INTC_REG32(0x088) | ||
380 | #define INTC_ISR_CLEAR0 INTC_REG32(0x094) | ||
381 | #define INTC_MIR1 INTC_REG32(0x0A4) | ||
382 | #define INTC_MIR_SET1 INTC_REG32(0x0AC) | ||
383 | #define INTC_MIR_CLEAR1 INTC_REG32(0x0A8) | ||
384 | #define INTC_ISR_CLEAR1 INTC_REG32(0x0B4) | ||
385 | #define INTC_MIR2 INTC_REG32(0x0C4) | ||
386 | #define INTC_MIR_SET2 INTC_REG32(0x0CC) | ||
387 | #define INTC_MIR_CLEAR2 INTC_REG32(0x0C8) | ||
388 | #define INTC_ISR_CLEAR2 INTC_REG32(0x0D4) | ||
389 | #define INTC_SIR_IRQ INTC_REG32(0x040) | ||
390 | #define INTC_CONTROL INTC_REG32(0x048) | ||
391 | #define INTC_ILR11 INTC_REG32(0x12C) /* PRCM on MPU PIC */ | ||
392 | #define INTC_ILR30 INTC_REG32(0x178) | ||
393 | #define INTC_ILR31 INTC_REG32(0x17C) | ||
394 | #define INTC_ILR32 INTC_REG32(0x180) | ||
395 | #define INTC_ILR37 INTC_REG32(0x194) /* GPIO4 on MPU PIC */ | ||
396 | #define INTC_SYSCONFIG INTC_REG32(0x010) /* GPT1 on MPU PIC */ | ||
397 | |||
398 | /* RAM FIREWALL */ | ||
399 | #define RAMFW_BASE (0x68005000) | ||
400 | #define RAMFW_REG32(offset) __REG32(RAMFW_BASE + (offset)) | ||
401 | |||
402 | #define RAMFW_REQINFOPERM0 RAMFW_REG32(0x048) | ||
403 | #define RAMFW_READPERM0 RAMFW_REG32(0x050) | ||
404 | #define RAMFW_WRITEPERM0 RAMFW_REG32(0x058) | ||
405 | |||
406 | /* GPMC CS1 FPGA ON USER INTERFACE MODULE */ | ||
407 | //#define DEBUG_BOARD_LED_REGISTER 0x04000014 | ||
408 | |||
409 | /* GPMC CS0 */ | ||
410 | #define GPMC_CONFIG1_0 GPMC_REG32(0x060) | ||
411 | #define GPMC_CONFIG2_0 GPMC_REG32(0x064) | ||
412 | #define GPMC_CONFIG3_0 GPMC_REG32(0x068) | ||
413 | #define GPMC_CONFIG4_0 GPMC_REG32(0x06C) | ||
414 | #define GPMC_CONFIG5_0 GPMC_REG32(0x070) | ||
415 | #define GPMC_CONFIG6_0 GPMC_REG32(0x074) | ||
416 | #define GPMC_CONFIG7_0 GPMC_REG32(0x078) | ||
417 | |||
418 | /* GPMC CS1 */ | ||
419 | #define GPMC_CONFIG1_1 GPMC_REG32(0x090) | ||
420 | #define GPMC_CONFIG2_1 GPMC_REG32(0x094) | ||
421 | #define GPMC_CONFIG3_1 GPMC_REG32(0x098) | ||
422 | #define GPMC_CONFIG4_1 GPMC_REG32(0x09C) | ||
423 | #define GPMC_CONFIG5_1 GPMC_REG32(0x0a0) | ||
424 | #define GPMC_CONFIG6_1 GPMC_REG32(0x0a4) | ||
425 | #define GPMC_CONFIG7_1 GPMC_REG32(0x0a8) | ||
426 | |||
427 | /* GPMC CS3 */ | ||
428 | #define GPMC_CONFIG1_3 GPMC_REG32(0x0F0) | ||
429 | #define GPMC_CONFIG2_3 GPMC_REG32(0x0F4) | ||
430 | #define GPMC_CONFIG3_3 GPMC_REG32(0x0F8) | ||
431 | #define GPMC_CONFIG4_3 GPMC_REG32(0x0FC) | ||
432 | #define GPMC_CONFIG5_3 GPMC_REG32(0x100) | ||
433 | #define GPMC_CONFIG6_3 GPMC_REG32(0x104) | ||
434 | #define GPMC_CONFIG7_3 GPMC_REG32(0x108) | ||
435 | |||
436 | /* DSS */ | ||
437 | #define DSS_CONTROL DISP_REG32(0x040) | ||
438 | #define DISPC_CONTROL DISP_REG32(0x440) | ||
439 | #define DISPC_SYSSTATUS DISP_REG32(0x414) | ||
440 | #define DISPC_IRQSTATUS DISP_REG32(0x418) | ||
441 | #define DISPC_IRQENABLE DISP_REG32(0x41C) | ||
442 | #define DISPC_CONFIG DISP_REG32(0x444) | ||
443 | #define DISPC_DEFAULT_COLOR0 DISP_REG32(0x44C) | ||
444 | #define DISPC_DEFAULT_COLOR1 DISP_REG32(0x450) | ||
445 | #define DISPC_TRANS_COLOR0 DISP_REG32(0x454) | ||
446 | #define DISPC_TRANS_COLOR1 DISP_REG32(0x458) | ||
447 | #define DISPC_LINE_NUMBER DISP_REG32(0x460) | ||
448 | #define DISPC_TIMING_H DISP_REG32(0x464) | ||
449 | #define DISPC_TIMING_V DISP_REG32(0x468) | ||
450 | #define DISPC_POL_FREQ DISP_REG32(0x46C) | ||
451 | #define DISPC_DIVISOR DISP_REG32(0x470) | ||
452 | #define DISPC_SIZE_DIG DISP_REG32(0x478) | ||
453 | #define DISPC_SIZE_LCD DISP_REG32(0x47C) | ||
454 | #define DISPC_GFX_BA0 DISP_REG32(0x480) | ||
455 | #define DISPC_GFX_BA1 DISP_REG32(0x484) | ||
456 | #define DISPC_GFX_POSITION DISP_REG32(0x488) | ||
457 | #define DISPC_GFX_SIZE DISP_REG32(0x48C) | ||
458 | #define DISPC_GFX_ATTRIBUTES DISP_REG32(0x4A0) | ||
459 | #define DISPC_GFX_FIFO_THRESHOLD DISP_REG32(0x4A4) | ||
460 | #define DISPC_GFX_ROW_INC DISP_REG32(0x4AC) | ||
461 | #define DISPC_GFX_PIXEL_INC DISP_REG32(0x4B0) | ||
462 | #define DISPC_GFX_WINDOW_SKIP DISP_REG32(0x4B4) | ||
463 | #define DISPC_GFX_TABLE_BA DISP_REG32(0x4B8) | ||
464 | #define DISPC_DATA_CYCLE1 DISP_REG32(0x5D4) | ||
465 | #define DISPC_DATA_CYCLE2 DISP_REG32(0x5D8) | ||
466 | #define DISPC_DATA_CYCLE3 DISP_REG32(0x5DC) | ||
467 | |||
468 | /* HSUSB Suspend */ | ||
469 | #define HSUSB_CTRL __REG8(0x480AC001) | ||
470 | #define USBOTG_POWER __REG32(0x480AC000) | ||
471 | |||
472 | /* HS MMC */ | ||
473 | #define MMCHS1_SYSCONFIG __REG32(0x4809C010) | ||
474 | #define MMCHS2_SYSCONFIG __REG32(0x480b4010) | ||
475 | |||
476 | #endif /* __ASSEMBLER__ */ | ||
477 | |||
478 | #endif | ||
479 | |||
480 | |||
481 | |||
482 | |||
483 | |||
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index 90f530540c65..b12f423b8595 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c | |||
@@ -17,19 +17,27 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | 19 | ||
20 | #include "prcm-regs.h" | 20 | #include <asm/io.h> |
21 | |||
22 | #include "prm.h" | ||
23 | #include "prm-regbits-24xx.h" | ||
21 | 24 | ||
22 | extern void omap2_clk_prepare_for_reboot(void); | 25 | extern void omap2_clk_prepare_for_reboot(void); |
23 | 26 | ||
24 | u32 omap_prcm_get_reset_sources(void) | 27 | u32 omap_prcm_get_reset_sources(void) |
25 | { | 28 | { |
26 | return RM_RSTST_WKUP & 0x7f; | 29 | return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; |
27 | } | 30 | } |
28 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); | 31 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); |
29 | 32 | ||
30 | /* Resets clock rates and reboots the system. Only called from system.h */ | 33 | /* Resets clock rates and reboots the system. Only called from system.h */ |
31 | void omap_prcm_arch_reset(char mode) | 34 | void omap_prcm_arch_reset(char mode) |
32 | { | 35 | { |
36 | u32 wkup; | ||
33 | omap2_clk_prepare_for_reboot(); | 37 | omap2_clk_prepare_for_reboot(); |
34 | RM_RSTCTRL_WKUP |= 2; | 38 | |
39 | if (cpu_is_omap24xx()) { | ||
40 | wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; | ||
41 | prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); | ||
42 | } | ||
35 | } | 43 | } |
diff --git a/arch/arm/mach-omap2/prm-regbits-24xx.h b/arch/arm/mach-omap2/prm-regbits-24xx.h new file mode 100644 index 000000000000..c6d17a3378ec --- /dev/null +++ b/arch/arm/mach-omap2/prm-regbits-24xx.h | |||
@@ -0,0 +1,279 @@ | |||
1 | #ifndef __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_24XX_H | ||
2 | #define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_24XX_H | ||
3 | |||
4 | /* | ||
5 | * OMAP24XX Power/Reset Management register bits | ||
6 | * | ||
7 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include "prm.h" | ||
18 | |||
19 | /* Bits shared between registers */ | ||
20 | |||
21 | /* PRCM_IRQSTATUS_MPU, PM_IRQSTATUS_DSP, PRCM_IRQSTATUS_IVA shared bits */ | ||
22 | #define OMAP24XX_VOLTTRANS_ST (1 << 2) | ||
23 | #define OMAP24XX_WKUP2_ST (1 << 1) | ||
24 | #define OMAP24XX_WKUP1_ST (1 << 0) | ||
25 | |||
26 | /* PRCM_IRQENABLE_MPU, PM_IRQENABLE_DSP, PRCM_IRQENABLE_IVA shared bits */ | ||
27 | #define OMAP24XX_VOLTTRANS_EN (1 << 2) | ||
28 | #define OMAP24XX_WKUP2_EN (1 << 1) | ||
29 | #define OMAP24XX_WKUP1_EN (1 << 0) | ||
30 | |||
31 | /* PM_WKDEP_GFX, PM_WKDEP_MPU, PM_WKDEP_DSP, PM_WKDEP_MDM shared bits */ | ||
32 | #define OMAP24XX_EN_MPU (1 << 1) | ||
33 | #define OMAP24XX_EN_CORE (1 << 0) | ||
34 | |||
35 | /* | ||
36 | * PM_PWSTCTRL_MPU, PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSP, PM_PWSTCTRL_MDM | ||
37 | * shared bits | ||
38 | */ | ||
39 | #define OMAP24XX_MEMONSTATE_SHIFT 10 | ||
40 | #define OMAP24XX_MEMONSTATE_MASK (0x3 << 10) | ||
41 | #define OMAP24XX_MEMRETSTATE (1 << 3) | ||
42 | |||
43 | /* PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSP, PM_PWSTCTRL_MDM shared bits */ | ||
44 | #define OMAP24XX_FORCESTATE (1 << 18) | ||
45 | |||
46 | /* | ||
47 | * PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP, | ||
48 | * PM_PWSTST_MDM shared bits | ||
49 | */ | ||
50 | #define OMAP24XX_CLKACTIVITY (1 << 19) | ||
51 | |||
52 | /* PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_DSP shared bits */ | ||
53 | #define OMAP24XX_LASTSTATEENTERED_SHIFT 4 | ||
54 | #define OMAP24XX_LASTSTATEENTERED_MASK (0x3 << 4) | ||
55 | |||
56 | /* PM_PWSTST_MPU and PM_PWSTST_DSP shared bits */ | ||
57 | #define OMAP2430_MEMSTATEST_SHIFT 10 | ||
58 | #define OMAP2430_MEMSTATEST_MASK (0x3 << 10) | ||
59 | |||
60 | /* PM_PWSTST_GFX, PM_PWSTST_DSP, PM_PWSTST_MDM shared bits */ | ||
61 | #define OMAP24XX_POWERSTATEST_SHIFT 0 | ||
62 | #define OMAP24XX_POWERSTATEST_MASK (0x3 << 0) | ||
63 | |||
64 | |||
65 | /* Bits specific to each register */ | ||
66 | |||
67 | /* PRCM_REVISION */ | ||
68 | #define OMAP24XX_REV_SHIFT 0 | ||
69 | #define OMAP24XX_REV_MASK (0xff << 0) | ||
70 | |||
71 | /* PRCM_SYSCONFIG */ | ||
72 | #define OMAP24XX_AUTOIDLE (1 << 0) | ||
73 | |||
74 | /* PRCM_IRQSTATUS_MPU specific bits */ | ||
75 | #define OMAP2430_DPLL_RECAL_ST (1 << 6) | ||
76 | #define OMAP24XX_TRANSITION_ST (1 << 5) | ||
77 | #define OMAP24XX_EVGENOFF_ST (1 << 4) | ||
78 | #define OMAP24XX_EVGENON_ST (1 << 3) | ||
79 | |||
80 | /* PRCM_IRQENABLE_MPU specific bits */ | ||
81 | #define OMAP2430_DPLL_RECAL_EN (1 << 6) | ||
82 | #define OMAP24XX_TRANSITION_EN (1 << 5) | ||
83 | #define OMAP24XX_EVGENOFF_EN (1 << 4) | ||
84 | #define OMAP24XX_EVGENON_EN (1 << 3) | ||
85 | |||
86 | /* PRCM_VOLTCTRL */ | ||
87 | #define OMAP24XX_AUTO_EXTVOLT (1 << 15) | ||
88 | #define OMAP24XX_FORCE_EXTVOLT (1 << 14) | ||
89 | #define OMAP24XX_SETOFF_LEVEL_SHIFT 12 | ||
90 | #define OMAP24XX_SETOFF_LEVEL_MASK (0x3 << 12) | ||
91 | #define OMAP24XX_MEMRETCTRL (1 << 8) | ||
92 | #define OMAP24XX_SETRET_LEVEL_SHIFT 6 | ||
93 | #define OMAP24XX_SETRET_LEVEL_MASK (0x3 << 6) | ||
94 | #define OMAP24XX_VOLT_LEVEL_SHIFT 0 | ||
95 | #define OMAP24XX_VOLT_LEVEL_MASK (0x3 << 0) | ||
96 | |||
97 | /* PRCM_VOLTST */ | ||
98 | #define OMAP24XX_ST_VOLTLEVEL_SHIFT 0 | ||
99 | #define OMAP24XX_ST_VOLTLEVEL_MASK (0x3 << 0) | ||
100 | |||
101 | /* PRCM_CLKSRC_CTRL specific bits */ | ||
102 | |||
103 | /* PRCM_CLKOUT_CTRL */ | ||
104 | #define OMAP2420_CLKOUT2_EN_SHIFT 15 | ||
105 | #define OMAP2420_CLKOUT2_EN (1 << 15) | ||
106 | #define OMAP2420_CLKOUT2_DIV_SHIFT 11 | ||
107 | #define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11) | ||
108 | #define OMAP2420_CLKOUT2_SOURCE_SHIFT 8 | ||
109 | #define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8) | ||
110 | #define OMAP24XX_CLKOUT_EN_SHIFT 7 | ||
111 | #define OMAP24XX_CLKOUT_EN (1 << 7) | ||
112 | #define OMAP24XX_CLKOUT_DIV_SHIFT 3 | ||
113 | #define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3) | ||
114 | #define OMAP24XX_CLKOUT_SOURCE_SHIFT 0 | ||
115 | #define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0) | ||
116 | |||
117 | /* PRCM_CLKEMUL_CTRL */ | ||
118 | #define OMAP24XX_EMULATION_EN_SHIFT 0 | ||
119 | #define OMAP24XX_EMULATION_EN (1 << 0) | ||
120 | |||
121 | /* PRCM_CLKCFG_CTRL */ | ||
122 | #define OMAP24XX_VALID_CONFIG (1 << 0) | ||
123 | |||
124 | /* PRCM_CLKCFG_STATUS */ | ||
125 | #define OMAP24XX_CONFIG_STATUS (1 << 0) | ||
126 | |||
127 | /* PRCM_VOLTSETUP specific bits */ | ||
128 | |||
129 | /* PRCM_CLKSSETUP specific bits */ | ||
130 | |||
131 | /* PRCM_POLCTRL */ | ||
132 | #define OMAP2420_CLKOUT2_POL (1 << 10) | ||
133 | #define OMAP24XX_CLKOUT_POL (1 << 9) | ||
134 | #define OMAP24XX_CLKREQ_POL (1 << 8) | ||
135 | #define OMAP2430_USE_POWEROK (1 << 2) | ||
136 | #define OMAP2430_POWEROK_POL (1 << 1) | ||
137 | #define OMAP24XX_EXTVOL_POL (1 << 0) | ||
138 | |||
139 | /* RM_RSTST_MPU specific bits */ | ||
140 | /* 2430 calls GLOBALWMPU_RST "GLOBALWARM_RST" instead */ | ||
141 | |||
142 | /* PM_WKDEP_MPU specific bits */ | ||
143 | #define OMAP2430_PM_WKDEP_MPU_EN_MDM (1 << 5) | ||
144 | #define OMAP24XX_PM_WKDEP_MPU_EN_DSP (1 << 2) | ||
145 | |||
146 | /* PM_EVGENCTRL_MPU specific bits */ | ||
147 | |||
148 | /* PM_EVEGENONTIM_MPU specific bits */ | ||
149 | |||
150 | /* PM_EVEGENOFFTIM_MPU specific bits */ | ||
151 | |||
152 | /* PM_PWSTCTRL_MPU specific bits */ | ||
153 | #define OMAP2430_FORCESTATE (1 << 18) | ||
154 | |||
155 | /* PM_PWSTST_MPU specific bits */ | ||
156 | /* INTRANSITION, CLKACTIVITY, POWERSTATE, MEMSTATEST are 2430 only */ | ||
157 | |||
158 | /* PM_WKEN1_CORE specific bits */ | ||
159 | |||
160 | /* PM_WKEN2_CORE specific bits */ | ||
161 | |||
162 | /* PM_WKST1_CORE specific bits*/ | ||
163 | |||
164 | /* PM_WKST2_CORE specific bits */ | ||
165 | |||
166 | /* PM_WKDEP_CORE specific bits*/ | ||
167 | #define OMAP2430_PM_WKDEP_CORE_EN_MDM (1 << 5) | ||
168 | #define OMAP24XX_PM_WKDEP_CORE_EN_GFX (1 << 3) | ||
169 | #define OMAP24XX_PM_WKDEP_CORE_EN_DSP (1 << 2) | ||
170 | |||
171 | /* PM_PWSTCTRL_CORE specific bits */ | ||
172 | #define OMAP24XX_MEMORYCHANGE (1 << 20) | ||
173 | #define OMAP24XX_MEM3ONSTATE_SHIFT 14 | ||
174 | #define OMAP24XX_MEM3ONSTATE_MASK (0x3 << 14) | ||
175 | #define OMAP24XX_MEM2ONSTATE_SHIFT 12 | ||
176 | #define OMAP24XX_MEM2ONSTATE_MASK (0x3 << 12) | ||
177 | #define OMAP24XX_MEM1ONSTATE_SHIFT 10 | ||
178 | #define OMAP24XX_MEM1ONSTATE_MASK (0x3 << 10) | ||
179 | #define OMAP24XX_MEM3RETSTATE (1 << 5) | ||
180 | #define OMAP24XX_MEM2RETSTATE (1 << 4) | ||
181 | #define OMAP24XX_MEM1RETSTATE (1 << 3) | ||
182 | |||
183 | /* PM_PWSTST_CORE specific bits */ | ||
184 | #define OMAP24XX_MEM3STATEST_SHIFT 14 | ||
185 | #define OMAP24XX_MEM3STATEST_MASK (0x3 << 14) | ||
186 | #define OMAP24XX_MEM2STATEST_SHIFT 12 | ||
187 | #define OMAP24XX_MEM2STATEST_MASK (0x3 << 12) | ||
188 | #define OMAP24XX_MEM1STATEST_SHIFT 10 | ||
189 | #define OMAP24XX_MEM1STATEST_MASK (0x3 << 10) | ||
190 | |||
191 | /* RM_RSTCTRL_GFX */ | ||
192 | #define OMAP24XX_GFX_RST (1 << 0) | ||
193 | |||
194 | /* RM_RSTST_GFX specific bits */ | ||
195 | #define OMAP24XX_GFX_SW_RST (1 << 4) | ||
196 | |||
197 | /* PM_PWSTCTRL_GFX specific bits */ | ||
198 | |||
199 | /* PM_WKDEP_GFX specific bits */ | ||
200 | /* 2430 often calls EN_WAKEUP "EN_WKUP" */ | ||
201 | |||
202 | /* RM_RSTCTRL_WKUP specific bits */ | ||
203 | |||
204 | /* RM_RSTTIME_WKUP specific bits */ | ||
205 | |||
206 | /* RM_RSTST_WKUP specific bits */ | ||
207 | /* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */ | ||
208 | #define OMAP24XX_EXTWMPU_RST (1 << 6) | ||
209 | #define OMAP24XX_SECU_WD_RST (1 << 5) | ||
210 | #define OMAP24XX_MPU_WD_RST (1 << 4) | ||
211 | #define OMAP24XX_SECU_VIOL_RST (1 << 3) | ||
212 | |||
213 | /* PM_WKEN_WKUP specific bits */ | ||
214 | |||
215 | /* PM_WKST_WKUP specific bits */ | ||
216 | |||
217 | /* RM_RSTCTRL_DSP */ | ||
218 | #define OMAP2420_RST_IVA (1 << 8) | ||
219 | #define OMAP24XX_RST2_DSP (1 << 1) | ||
220 | #define OMAP24XX_RST1_DSP (1 << 0) | ||
221 | |||
222 | /* RM_RSTST_DSP specific bits */ | ||
223 | /* 2430 calls GLOBALWMPU_RST "GLOBALWARM_RST" */ | ||
224 | #define OMAP2420_IVA_SW_RST (1 << 8) | ||
225 | #define OMAP24XX_DSP_SW_RST2 (1 << 5) | ||
226 | #define OMAP24XX_DSP_SW_RST1 (1 << 4) | ||
227 | |||
228 | /* PM_WKDEP_DSP specific bits */ | ||
229 | |||
230 | /* PM_PWSTCTRL_DSP specific bits */ | ||
231 | /* 2430 only: MEMONSTATE, MEMRETSTATE */ | ||
232 | #define OMAP2420_MEMIONSTATE_SHIFT 12 | ||
233 | #define OMAP2420_MEMIONSTATE_MASK (0x3 << 12) | ||
234 | #define OMAP2420_MEMIRETSTATE (1 << 4) | ||
235 | |||
236 | /* PM_PWSTST_DSP specific bits */ | ||
237 | /* MEMSTATEST is 2430 only */ | ||
238 | #define OMAP2420_MEMISTATEST_SHIFT 12 | ||
239 | #define OMAP2420_MEMISTATEST_MASK (0x3 << 12) | ||
240 | |||
241 | /* PRCM_IRQSTATUS_DSP specific bits */ | ||
242 | |||
243 | /* PRCM_IRQENABLE_DSP specific bits */ | ||
244 | |||
245 | /* RM_RSTCTRL_MDM */ | ||
246 | /* 2430 only */ | ||
247 | #define OMAP2430_PWRON1_MDM (1 << 1) | ||
248 | #define OMAP2430_RST1_MDM (1 << 0) | ||
249 | |||
250 | /* RM_RSTST_MDM specific bits */ | ||
251 | /* 2430 only */ | ||
252 | #define OMAP2430_MDM_SECU_VIOL (1 << 6) | ||
253 | #define OMAP2430_MDM_SW_PWRON1 (1 << 5) | ||
254 | #define OMAP2430_MDM_SW_RST1 (1 << 4) | ||
255 | |||
256 | /* PM_WKEN_MDM */ | ||
257 | /* 2430 only */ | ||
258 | #define OMAP2430_PM_WKEN_MDM_EN_MDM (1 << 0) | ||
259 | |||
260 | /* PM_WKST_MDM specific bits */ | ||
261 | /* 2430 only */ | ||
262 | |||
263 | /* PM_WKDEP_MDM specific bits */ | ||
264 | /* 2430 only */ | ||
265 | |||
266 | /* PM_PWSTCTRL_MDM specific bits */ | ||
267 | /* 2430 only */ | ||
268 | #define OMAP2430_KILLDOMAINWKUP (1 << 19) | ||
269 | |||
270 | /* PM_PWSTST_MDM specific bits */ | ||
271 | /* 2430 only */ | ||
272 | |||
273 | /* PRCM_IRQSTATUS_IVA */ | ||
274 | /* 2420 only */ | ||
275 | |||
276 | /* PRCM_IRQENABLE_IVA */ | ||
277 | /* 2420 only */ | ||
278 | |||
279 | #endif | ||
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h new file mode 100644 index 000000000000..b4686bc345ca --- /dev/null +++ b/arch/arm/mach-omap2/prm-regbits-34xx.h | |||
@@ -0,0 +1,582 @@ | |||
1 | #ifndef __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H | ||
2 | #define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H | ||
3 | |||
4 | /* | ||
5 | * OMAP3430 Power/Reset Management register bits | ||
6 | * | ||
7 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007-2008 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include "prm.h" | ||
18 | |||
19 | /* Shared register bits */ | ||
20 | |||
21 | /* PRM_VC_CMD_VAL_0, PRM_VC_CMD_VAL_1 shared bits */ | ||
22 | #define OMAP3430_ON_SHIFT 24 | ||
23 | #define OMAP3430_ON_MASK (0xff << 24) | ||
24 | #define OMAP3430_ONLP_SHIFT 16 | ||
25 | #define OMAP3430_ONLP_MASK (0xff << 16) | ||
26 | #define OMAP3430_RET_SHIFT 8 | ||
27 | #define OMAP3430_RET_MASK (0xff << 8) | ||
28 | #define OMAP3430_OFF_SHIFT 0 | ||
29 | #define OMAP3430_OFF_MASK (0xff << 0) | ||
30 | |||
31 | /* PRM_VP1_CONFIG, PRM_VP2_CONFIG shared bits */ | ||
32 | #define OMAP3430_ERROROFFSET_SHIFT 24 | ||
33 | #define OMAP3430_ERROROFFSET_MASK (0xff << 24) | ||
34 | #define OMAP3430_ERRORGAIN_SHIFT 16 | ||
35 | #define OMAP3430_ERRORGAIN_MASK (0xff << 16) | ||
36 | #define OMAP3430_INITVOLTAGE_SHIFT 8 | ||
37 | #define OMAP3430_INITVOLTAGE_MASK (0xff << 8) | ||
38 | #define OMAP3430_TIMEOUTEN (1 << 3) | ||
39 | #define OMAP3430_INITVDD (1 << 2) | ||
40 | #define OMAP3430_FORCEUPDATE (1 << 1) | ||
41 | #define OMAP3430_VPENABLE (1 << 0) | ||
42 | |||
43 | /* PRM_VP1_VSTEPMIN, PRM_VP2_VSTEPMIN shared bits */ | ||
44 | #define OMAP3430_SMPSWAITTIMEMIN_SHIFT 8 | ||
45 | #define OMAP3430_SMPSWAITTIMEMIN_MASK (0xffff << 8) | ||
46 | #define OMAP3430_VSTEPMIN_SHIFT 0 | ||
47 | #define OMAP3430_VSTEPMIN_MASK (0xff << 0) | ||
48 | |||
49 | /* PRM_VP1_VSTEPMAX, PRM_VP2_VSTEPMAX shared bits */ | ||
50 | #define OMAP3430_SMPSWAITTIMEMAX_SHIFT 8 | ||
51 | #define OMAP3430_SMPSWAITTIMEMAX_MASK (0xffff << 8) | ||
52 | #define OMAP3430_VSTEPMAX_SHIFT 0 | ||
53 | #define OMAP3430_VSTEPMAX_MASK (0xff << 0) | ||
54 | |||
55 | /* PRM_VP1_VLIMITTO, PRM_VP2_VLIMITTO shared bits */ | ||
56 | #define OMAP3430_VDDMAX_SHIFT 24 | ||
57 | #define OMAP3430_VDDMAX_MASK (0xff << 24) | ||
58 | #define OMAP3430_VDDMIN_SHIFT 16 | ||
59 | #define OMAP3430_VDDMIN_MASK (0xff << 16) | ||
60 | #define OMAP3430_TIMEOUT_SHIFT 0 | ||
61 | #define OMAP3430_TIMEOUT_MASK (0xffff << 0) | ||
62 | |||
63 | /* PRM_VP1_VOLTAGE, PRM_VP2_VOLTAGE shared bits */ | ||
64 | #define OMAP3430_VPVOLTAGE_SHIFT 0 | ||
65 | #define OMAP3430_VPVOLTAGE_MASK (0xff << 0) | ||
66 | |||
67 | /* PRM_VP1_STATUS, PRM_VP2_STATUS shared bits */ | ||
68 | #define OMAP3430_VPINIDLE (1 << 0) | ||
69 | |||
70 | /* PM_WKDEP_IVA2, PM_WKDEP_MPU shared bits */ | ||
71 | #define OMAP3430_EN_PER (1 << 7) | ||
72 | |||
73 | /* PM_PWSTCTRL_IVA2, PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE shared bits */ | ||
74 | #define OMAP3430_MEMORYCHANGE (1 << 3) | ||
75 | |||
76 | /* PM_PWSTST_IVA2, PM_PWSTST_CORE shared bits */ | ||
77 | #define OMAP3430_LOGICSTATEST (1 << 2) | ||
78 | |||
79 | /* PM_PREPWSTST_IVA2, PM_PREPWSTST_CORE shared bits */ | ||
80 | #define OMAP3430_LASTLOGICSTATEENTERED (1 << 2) | ||
81 | |||
82 | /* | ||
83 | * PM_PREPWSTST_IVA2, PM_PREPWSTST_MPU, PM_PREPWSTST_CORE, | ||
84 | * PM_PREPWSTST_GFX, PM_PREPWSTST_DSS, PM_PREPWSTST_CAM, | ||
85 | * PM_PREPWSTST_PER, PM_PREPWSTST_NEON shared bits | ||
86 | */ | ||
87 | #define OMAP3430_LASTPOWERSTATEENTERED_SHIFT 0 | ||
88 | #define OMAP3430_LASTPOWERSTATEENTERED_MASK (0x3 << 0) | ||
89 | |||
90 | /* PRM_IRQSTATUS_IVA2, PRM_IRQSTATUS_MPU shared bits */ | ||
91 | #define OMAP3430_WKUP_ST (1 << 0) | ||
92 | |||
93 | /* PRM_IRQENABLE_IVA2, PRM_IRQENABLE_MPU shared bits */ | ||
94 | #define OMAP3430_WKUP_EN (1 << 0) | ||
95 | |||
96 | /* PM_MPUGRPSEL1_CORE, PM_IVA2GRPSEL1_CORE shared bits */ | ||
97 | #define OMAP3430_GRPSEL_MMC2 (1 << 25) | ||
98 | #define OMAP3430_GRPSEL_MMC1 (1 << 24) | ||
99 | #define OMAP3430_GRPSEL_MCSPI4 (1 << 21) | ||
100 | #define OMAP3430_GRPSEL_MCSPI3 (1 << 20) | ||
101 | #define OMAP3430_GRPSEL_MCSPI2 (1 << 19) | ||
102 | #define OMAP3430_GRPSEL_MCSPI1 (1 << 18) | ||
103 | #define OMAP3430_GRPSEL_I2C3 (1 << 17) | ||
104 | #define OMAP3430_GRPSEL_I2C2 (1 << 16) | ||
105 | #define OMAP3430_GRPSEL_I2C1 (1 << 15) | ||
106 | #define OMAP3430_GRPSEL_UART2 (1 << 14) | ||
107 | #define OMAP3430_GRPSEL_UART1 (1 << 13) | ||
108 | #define OMAP3430_GRPSEL_GPT11 (1 << 12) | ||
109 | #define OMAP3430_GRPSEL_GPT10 (1 << 11) | ||
110 | #define OMAP3430_GRPSEL_MCBSP5 (1 << 10) | ||
111 | #define OMAP3430_GRPSEL_MCBSP1 (1 << 9) | ||
112 | #define OMAP3430_GRPSEL_HSOTGUSB (1 << 4) | ||
113 | #define OMAP3430_GRPSEL_D2D (1 << 3) | ||
114 | |||
115 | /* | ||
116 | * PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSS, PM_PWSTCTRL_CAM, | ||
117 | * PM_PWSTCTRL_PER shared bits | ||
118 | */ | ||
119 | #define OMAP3430_MEMONSTATE_SHIFT 16 | ||
120 | #define OMAP3430_MEMONSTATE_MASK (0x3 << 16) | ||
121 | #define OMAP3430_MEMRETSTATE (1 << 8) | ||
122 | |||
123 | /* PM_MPUGRPSEL_PER, PM_IVA2GRPSEL_PER shared bits */ | ||
124 | #define OMAP3430_GRPSEL_GPIO6 (1 << 17) | ||
125 | #define OMAP3430_GRPSEL_GPIO5 (1 << 16) | ||
126 | #define OMAP3430_GRPSEL_GPIO4 (1 << 15) | ||
127 | #define OMAP3430_GRPSEL_GPIO3 (1 << 14) | ||
128 | #define OMAP3430_GRPSEL_GPIO2 (1 << 13) | ||
129 | #define OMAP3430_GRPSEL_UART3 (1 << 11) | ||
130 | #define OMAP3430_GRPSEL_GPT9 (1 << 10) | ||
131 | #define OMAP3430_GRPSEL_GPT8 (1 << 9) | ||
132 | #define OMAP3430_GRPSEL_GPT7 (1 << 8) | ||
133 | #define OMAP3430_GRPSEL_GPT6 (1 << 7) | ||
134 | #define OMAP3430_GRPSEL_GPT5 (1 << 6) | ||
135 | #define OMAP3430_GRPSEL_GPT4 (1 << 5) | ||
136 | #define OMAP3430_GRPSEL_GPT3 (1 << 4) | ||
137 | #define OMAP3430_GRPSEL_GPT2 (1 << 3) | ||
138 | #define OMAP3430_GRPSEL_MCBSP4 (1 << 2) | ||
139 | #define OMAP3430_GRPSEL_MCBSP3 (1 << 1) | ||
140 | #define OMAP3430_GRPSEL_MCBSP2 (1 << 0) | ||
141 | |||
142 | /* PM_MPUGRPSEL_WKUP, PM_IVA2GRPSEL_WKUP shared bits */ | ||
143 | #define OMAP3430_GRPSEL_IO (1 << 8) | ||
144 | #define OMAP3430_GRPSEL_SR2 (1 << 7) | ||
145 | #define OMAP3430_GRPSEL_SR1 (1 << 6) | ||
146 | #define OMAP3430_GRPSEL_GPIO1 (1 << 3) | ||
147 | #define OMAP3430_GRPSEL_GPT12 (1 << 1) | ||
148 | #define OMAP3430_GRPSEL_GPT1 (1 << 0) | ||
149 | |||
150 | /* Bits specific to each register */ | ||
151 | |||
152 | /* RM_RSTCTRL_IVA2 */ | ||
153 | #define OMAP3430_RST3_IVA2 (1 << 2) | ||
154 | #define OMAP3430_RST2_IVA2 (1 << 1) | ||
155 | #define OMAP3430_RST1_IVA2 (1 << 0) | ||
156 | |||
157 | /* RM_RSTST_IVA2 specific bits */ | ||
158 | #define OMAP3430_EMULATION_VSEQ_RST (1 << 13) | ||
159 | #define OMAP3430_EMULATION_VHWA_RST (1 << 12) | ||
160 | #define OMAP3430_EMULATION_IVA2_RST (1 << 11) | ||
161 | #define OMAP3430_IVA2_SW_RST3 (1 << 10) | ||
162 | #define OMAP3430_IVA2_SW_RST2 (1 << 9) | ||
163 | #define OMAP3430_IVA2_SW_RST1 (1 << 8) | ||
164 | |||
165 | /* PM_WKDEP_IVA2 specific bits */ | ||
166 | |||
167 | /* PM_PWSTCTRL_IVA2 specific bits */ | ||
168 | #define OMAP3430_L2FLATMEMONSTATE_SHIFT 22 | ||
169 | #define OMAP3430_L2FLATMEMONSTATE_MASK (0x3 << 22) | ||
170 | #define OMAP3430_SHAREDL2CACHEFLATONSTATE_SHIFT 20 | ||
171 | #define OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK (0x3 << 20) | ||
172 | #define OMAP3430_L1FLATMEMONSTATE_SHIFT 18 | ||
173 | #define OMAP3430_L1FLATMEMONSTATE_MASK (0x3 << 18) | ||
174 | #define OMAP3430_SHAREDL1CACHEFLATONSTATE_SHIFT 16 | ||
175 | #define OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK (0x3 << 16) | ||
176 | #define OMAP3430_L2FLATMEMRETSTATE (1 << 11) | ||
177 | #define OMAP3430_SHAREDL2CACHEFLATRETSTATE (1 << 10) | ||
178 | #define OMAP3430_L1FLATMEMRETSTATE (1 << 9) | ||
179 | #define OMAP3430_SHAREDL1CACHEFLATRETSTATE (1 << 8) | ||
180 | |||
181 | /* PM_PWSTST_IVA2 specific bits */ | ||
182 | #define OMAP3430_L2FLATMEMSTATEST_SHIFT 10 | ||
183 | #define OMAP3430_L2FLATMEMSTATEST_MASK (0x3 << 10) | ||
184 | #define OMAP3430_SHAREDL2CACHEFLATSTATEST_SHIFT 8 | ||
185 | #define OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK (0x3 << 8) | ||
186 | #define OMAP3430_L1FLATMEMSTATEST_SHIFT 6 | ||
187 | #define OMAP3430_L1FLATMEMSTATEST_MASK (0x3 << 6) | ||
188 | #define OMAP3430_SHAREDL1CACHEFLATSTATEST_SHIFT 4 | ||
189 | #define OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK (0x3 << 4) | ||
190 | |||
191 | /* PM_PREPWSTST_IVA2 specific bits */ | ||
192 | #define OMAP3430_LASTL2FLATMEMSTATEENTERED_SHIFT 10 | ||
193 | #define OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK (0x3 << 10) | ||
194 | #define OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_SHIFT 8 | ||
195 | #define OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK (0x3 << 8) | ||
196 | #define OMAP3430_LASTL1FLATMEMSTATEENTERED_SHIFT 6 | ||
197 | #define OMAP3430_LASTL1FLATMEMSTATEENTERED_MASK (0x3 << 6) | ||
198 | #define OMAP3430_LASTSHAREDL1CACHEFLATSTATEENTERED_SHIFT 4 | ||
199 | #define OMAP3430_LASTSHAREDL1CACHEFLATSTATEENTERED_MASK (0x3 << 4) | ||
200 | |||
201 | /* PRM_IRQSTATUS_IVA2 specific bits */ | ||
202 | #define OMAP3430_PRM_IRQSTATUS_IVA2_IVA2_DPLL_ST (1 << 2) | ||
203 | #define OMAP3430_FORCEWKUP_ST (1 << 1) | ||
204 | |||
205 | /* PRM_IRQENABLE_IVA2 specific bits */ | ||
206 | #define OMAP3430_PRM_IRQENABLE_IVA2_IVA2_DPLL_RECAL_EN (1 << 2) | ||
207 | #define OMAP3430_FORCEWKUP_EN (1 << 1) | ||
208 | |||
209 | /* PRM_REVISION specific bits */ | ||
210 | |||
211 | /* PRM_SYSCONFIG specific bits */ | ||
212 | |||
213 | /* PRM_IRQSTATUS_MPU specific bits */ | ||
214 | #define OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT 25 | ||
215 | #define OMAP3430ES2_SND_PERIPH_DPLL_ST (1 << 25) | ||
216 | #define OMAP3430_VC_TIMEOUTERR_ST (1 << 24) | ||
217 | #define OMAP3430_VC_RAERR_ST (1 << 23) | ||
218 | #define OMAP3430_VC_SAERR_ST (1 << 22) | ||
219 | #define OMAP3430_VP2_TRANXDONE_ST (1 << 21) | ||
220 | #define OMAP3430_VP2_EQVALUE_ST (1 << 20) | ||
221 | #define OMAP3430_VP2_NOSMPSACK_ST (1 << 19) | ||
222 | #define OMAP3430_VP2_MAXVDD_ST (1 << 18) | ||
223 | #define OMAP3430_VP2_MINVDD_ST (1 << 17) | ||
224 | #define OMAP3430_VP2_OPPCHANGEDONE_ST (1 << 16) | ||
225 | #define OMAP3430_VP1_TRANXDONE_ST (1 << 15) | ||
226 | #define OMAP3430_VP1_EQVALUE_ST (1 << 14) | ||
227 | #define OMAP3430_VP1_NOSMPSACK_ST (1 << 13) | ||
228 | #define OMAP3430_VP1_MAXVDD_ST (1 << 12) | ||
229 | #define OMAP3430_VP1_MINVDD_ST (1 << 11) | ||
230 | #define OMAP3430_VP1_OPPCHANGEDONE_ST (1 << 10) | ||
231 | #define OMAP3430_IO_ST (1 << 9) | ||
232 | #define OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST (1 << 8) | ||
233 | #define OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT 8 | ||
234 | #define OMAP3430_MPU_DPLL_ST (1 << 7) | ||
235 | #define OMAP3430_MPU_DPLL_ST_SHIFT 7 | ||
236 | #define OMAP3430_PERIPH_DPLL_ST (1 << 6) | ||
237 | #define OMAP3430_PERIPH_DPLL_ST_SHIFT 6 | ||
238 | #define OMAP3430_CORE_DPLL_ST (1 << 5) | ||
239 | #define OMAP3430_CORE_DPLL_ST_SHIFT 5 | ||
240 | #define OMAP3430_TRANSITION_ST (1 << 4) | ||
241 | #define OMAP3430_EVGENOFF_ST (1 << 3) | ||
242 | #define OMAP3430_EVGENON_ST (1 << 2) | ||
243 | #define OMAP3430_FS_USB_WKUP_ST (1 << 1) | ||
244 | |||
245 | /* PRM_IRQENABLE_MPU specific bits */ | ||
246 | #define OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT 25 | ||
247 | #define OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN (1 << 25) | ||
248 | #define OMAP3430_VC_TIMEOUTERR_EN (1 << 24) | ||
249 | #define OMAP3430_VC_RAERR_EN (1 << 23) | ||
250 | #define OMAP3430_VC_SAERR_EN (1 << 22) | ||
251 | #define OMAP3430_VP2_TRANXDONE_EN (1 << 21) | ||
252 | #define OMAP3430_VP2_EQVALUE_EN (1 << 20) | ||
253 | #define OMAP3430_VP2_NOSMPSACK_EN (1 << 19) | ||
254 | #define OMAP3430_VP2_MAXVDD_EN (1 << 18) | ||
255 | #define OMAP3430_VP2_MINVDD_EN (1 << 17) | ||
256 | #define OMAP3430_VP2_OPPCHANGEDONE_EN (1 << 16) | ||
257 | #define OMAP3430_VP1_TRANXDONE_EN (1 << 15) | ||
258 | #define OMAP3430_VP1_EQVALUE_EN (1 << 14) | ||
259 | #define OMAP3430_VP1_NOSMPSACK_EN (1 << 13) | ||
260 | #define OMAP3430_VP1_MAXVDD_EN (1 << 12) | ||
261 | #define OMAP3430_VP1_MINVDD_EN (1 << 11) | ||
262 | #define OMAP3430_VP1_OPPCHANGEDONE_EN (1 << 10) | ||
263 | #define OMAP3430_IO_EN (1 << 9) | ||
264 | #define OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN (1 << 8) | ||
265 | #define OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT 8 | ||
266 | #define OMAP3430_MPU_DPLL_RECAL_EN (1 << 7) | ||
267 | #define OMAP3430_MPU_DPLL_RECAL_EN_SHIFT 7 | ||
268 | #define OMAP3430_PERIPH_DPLL_RECAL_EN (1 << 6) | ||
269 | #define OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT 6 | ||
270 | #define OMAP3430_CORE_DPLL_RECAL_EN (1 << 5) | ||
271 | #define OMAP3430_CORE_DPLL_RECAL_EN_SHIFT 5 | ||
272 | #define OMAP3430_TRANSITION_EN (1 << 4) | ||
273 | #define OMAP3430_EVGENOFF_EN (1 << 3) | ||
274 | #define OMAP3430_EVGENON_EN (1 << 2) | ||
275 | #define OMAP3430_FS_USB_WKUP_EN (1 << 1) | ||
276 | |||
277 | /* RM_RSTST_MPU specific bits */ | ||
278 | #define OMAP3430_EMULATION_MPU_RST (1 << 11) | ||
279 | |||
280 | /* PM_WKDEP_MPU specific bits */ | ||
281 | #define OMAP3430_PM_WKDEP_MPU_EN_DSS (1 << 5) | ||
282 | #define OMAP3430_PM_WKDEP_MPU_EN_IVA2 (1 << 2) | ||
283 | |||
284 | /* PM_EVGENCTRL_MPU */ | ||
285 | #define OMAP3430_OFFLOADMODE_SHIFT 3 | ||
286 | #define OMAP3430_OFFLOADMODE_MASK (0x3 << 3) | ||
287 | #define OMAP3430_ONLOADMODE_SHIFT 1 | ||
288 | #define OMAP3430_ONLOADMODE_MASK (0x3 << 1) | ||
289 | #define OMAP3430_ENABLE (1 << 0) | ||
290 | |||
291 | /* PM_EVGENONTIM_MPU */ | ||
292 | #define OMAP3430_ONTIMEVAL_SHIFT 0 | ||
293 | #define OMAP3430_ONTIMEVAL_MASK (0xffffffff << 0) | ||
294 | |||
295 | /* PM_EVGENOFFTIM_MPU */ | ||
296 | #define OMAP3430_OFFTIMEVAL_SHIFT 0 | ||
297 | #define OMAP3430_OFFTIMEVAL_MASK (0xffffffff << 0) | ||
298 | |||
299 | /* PM_PWSTCTRL_MPU specific bits */ | ||
300 | #define OMAP3430_L2CACHEONSTATE_SHIFT 16 | ||
301 | #define OMAP3430_L2CACHEONSTATE_MASK (0x3 << 16) | ||
302 | #define OMAP3430_L2CACHERETSTATE (1 << 8) | ||
303 | #define OMAP3430_LOGICL1CACHERETSTATE (1 << 2) | ||
304 | |||
305 | /* PM_PWSTST_MPU specific bits */ | ||
306 | #define OMAP3430_L2CACHESTATEST_SHIFT 6 | ||
307 | #define OMAP3430_L2CACHESTATEST_MASK (0x3 << 6) | ||
308 | #define OMAP3430_LOGICL1CACHESTATEST (1 << 2) | ||
309 | |||
310 | /* PM_PREPWSTST_MPU specific bits */ | ||
311 | #define OMAP3430_LASTL2CACHESTATEENTERED_SHIFT 6 | ||
312 | #define OMAP3430_LASTL2CACHESTATEENTERED_MASK (0x3 << 6) | ||
313 | #define OMAP3430_LASTLOGICL1CACHESTATEENTERED (1 << 2) | ||
314 | |||
315 | /* RM_RSTCTRL_CORE */ | ||
316 | #define OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RSTPWRON (1 << 1) | ||
317 | #define OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RST (1 << 0) | ||
318 | |||
319 | /* RM_RSTST_CORE specific bits */ | ||
320 | #define OMAP3430_MODEM_SECURITY_VIOL_RST (1 << 10) | ||
321 | #define OMAP3430_RM_RSTST_CORE_MODEM_SW_RSTPWRON (1 << 9) | ||
322 | #define OMAP3430_RM_RSTST_CORE_MODEM_SW_RST (1 << 8) | ||
323 | |||
324 | /* PM_WKEN1_CORE specific bits */ | ||
325 | |||
326 | /* PM_MPUGRPSEL1_CORE specific bits */ | ||
327 | #define OMAP3430_GRPSEL_FSHOSTUSB (1 << 5) | ||
328 | |||
329 | /* PM_IVA2GRPSEL1_CORE specific bits */ | ||
330 | |||
331 | /* PM_WKST1_CORE specific bits */ | ||
332 | |||
333 | /* PM_PWSTCTRL_CORE specific bits */ | ||
334 | #define OMAP3430_MEM2ONSTATE_SHIFT 18 | ||
335 | #define OMAP3430_MEM2ONSTATE_MASK (0x3 << 18) | ||
336 | #define OMAP3430_MEM1ONSTATE_SHIFT 16 | ||
337 | #define OMAP3430_MEM1ONSTATE_MASK (0x3 << 16) | ||
338 | #define OMAP3430_MEM2RETSTATE (1 << 9) | ||
339 | #define OMAP3430_MEM1RETSTATE (1 << 8) | ||
340 | |||
341 | /* PM_PWSTST_CORE specific bits */ | ||
342 | #define OMAP3430_MEM2STATEST_SHIFT 6 | ||
343 | #define OMAP3430_MEM2STATEST_MASK (0x3 << 6) | ||
344 | #define OMAP3430_MEM1STATEST_SHIFT 4 | ||
345 | #define OMAP3430_MEM1STATEST_MASK (0x3 << 4) | ||
346 | |||
347 | /* PM_PREPWSTST_CORE specific bits */ | ||
348 | #define OMAP3430_LASTMEM2STATEENTERED_SHIFT 6 | ||
349 | #define OMAP3430_LASTMEM2STATEENTERED_MASK (0x3 << 6) | ||
350 | #define OMAP3430_LASTMEM1STATEENTERED_SHIFT 4 | ||
351 | #define OMAP3430_LASTMEM1STATEENTERED_MASK (0x3 << 4) | ||
352 | |||
353 | /* RM_RSTST_GFX specific bits */ | ||
354 | |||
355 | /* PM_WKDEP_GFX specific bits */ | ||
356 | #define OMAP3430_PM_WKDEP_GFX_EN_IVA2 (1 << 2) | ||
357 | |||
358 | /* PM_PWSTCTRL_GFX specific bits */ | ||
359 | |||
360 | /* PM_PWSTST_GFX specific bits */ | ||
361 | |||
362 | /* PM_PREPWSTST_GFX specific bits */ | ||
363 | |||
364 | /* PM_WKEN_WKUP specific bits */ | ||
365 | #define OMAP3430_EN_IO (1 << 8) | ||
366 | |||
367 | /* PM_MPUGRPSEL_WKUP specific bits */ | ||
368 | |||
369 | /* PM_IVA2GRPSEL_WKUP specific bits */ | ||
370 | |||
371 | /* PM_WKST_WKUP specific bits */ | ||
372 | #define OMAP3430_ST_IO (1 << 8) | ||
373 | |||
374 | /* PRM_CLKSEL */ | ||
375 | #define OMAP3430_SYS_CLKIN_SEL_SHIFT 0 | ||
376 | #define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0) | ||
377 | |||
378 | /* PRM_CLKOUT_CTRL */ | ||
379 | #define OMAP3430_CLKOUT_EN (1 << 7) | ||
380 | #define OMAP3430_CLKOUT_EN_SHIFT 7 | ||
381 | |||
382 | /* RM_RSTST_DSS specific bits */ | ||
383 | |||
384 | /* PM_WKEN_DSS */ | ||
385 | #define OMAP3430_PM_WKEN_DSS_EN_DSS (1 << 0) | ||
386 | |||
387 | /* PM_WKDEP_DSS specific bits */ | ||
388 | #define OMAP3430_PM_WKDEP_DSS_EN_IVA2 (1 << 2) | ||
389 | |||
390 | /* PM_PWSTCTRL_DSS specific bits */ | ||
391 | |||
392 | /* PM_PWSTST_DSS specific bits */ | ||
393 | |||
394 | /* PM_PREPWSTST_DSS specific bits */ | ||
395 | |||
396 | /* RM_RSTST_CAM specific bits */ | ||
397 | |||
398 | /* PM_WKDEP_CAM specific bits */ | ||
399 | #define OMAP3430_PM_WKDEP_CAM_EN_IVA2 (1 << 2) | ||
400 | |||
401 | /* PM_PWSTCTRL_CAM specific bits */ | ||
402 | |||
403 | /* PM_PWSTST_CAM specific bits */ | ||
404 | |||
405 | /* PM_PREPWSTST_CAM specific bits */ | ||
406 | |||
407 | /* PM_PWSTCTRL_USBHOST specific bits */ | ||
408 | #define OMAP3430ES2_SAVEANDRESTORE_SHIFT (1 << 4) | ||
409 | |||
410 | /* RM_RSTST_PER specific bits */ | ||
411 | |||
412 | /* PM_WKEN_PER specific bits */ | ||
413 | |||
414 | /* PM_MPUGRPSEL_PER specific bits */ | ||
415 | |||
416 | /* PM_IVA2GRPSEL_PER specific bits */ | ||
417 | |||
418 | /* PM_WKST_PER specific bits */ | ||
419 | |||
420 | /* PM_WKDEP_PER specific bits */ | ||
421 | #define OMAP3430_PM_WKDEP_PER_EN_IVA2 (1 << 2) | ||
422 | |||
423 | /* PM_PWSTCTRL_PER specific bits */ | ||
424 | |||
425 | /* PM_PWSTST_PER specific bits */ | ||
426 | |||
427 | /* PM_PREPWSTST_PER specific bits */ | ||
428 | |||
429 | /* RM_RSTST_EMU specific bits */ | ||
430 | |||
431 | /* PM_PWSTST_EMU specific bits */ | ||
432 | |||
433 | /* PRM_VC_SMPS_SA */ | ||
434 | #define OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT 16 | ||
435 | #define OMAP3430_PRM_VC_SMPS_SA_SA1_MASK (0x7f << 16) | ||
436 | #define OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT 0 | ||
437 | #define OMAP3430_PRM_VC_SMPS_SA_SA0_MASK (0x7f << 0) | ||
438 | |||
439 | /* PRM_VC_SMPS_VOL_RA */ | ||
440 | #define OMAP3430_VOLRA1_SHIFT 16 | ||
441 | #define OMAP3430_VOLRA1_MASK (0xff << 16) | ||
442 | #define OMAP3430_VOLRA0_SHIFT 0 | ||
443 | #define OMAP3430_VOLRA0_MASK (0xff << 0) | ||
444 | |||
445 | /* PRM_VC_SMPS_CMD_RA */ | ||
446 | #define OMAP3430_CMDRA1_SHIFT 16 | ||
447 | #define OMAP3430_CMDRA1_MASK (0xff << 16) | ||
448 | #define OMAP3430_CMDRA0_SHIFT 0 | ||
449 | #define OMAP3430_CMDRA0_MASK (0xff << 0) | ||
450 | |||
451 | /* PRM_VC_CMD_VAL_0 specific bits */ | ||
452 | |||
453 | /* PRM_VC_CMD_VAL_1 specific bits */ | ||
454 | |||
455 | /* PRM_VC_CH_CONF */ | ||
456 | #define OMAP3430_CMD1 (1 << 20) | ||
457 | #define OMAP3430_RACEN1 (1 << 19) | ||
458 | #define OMAP3430_RAC1 (1 << 18) | ||
459 | #define OMAP3430_RAV1 (1 << 17) | ||
460 | #define OMAP3430_PRM_VC_CH_CONF_SA1 (1 << 16) | ||
461 | #define OMAP3430_CMD0 (1 << 4) | ||
462 | #define OMAP3430_RACEN0 (1 << 3) | ||
463 | #define OMAP3430_RAC0 (1 << 2) | ||
464 | #define OMAP3430_RAV0 (1 << 1) | ||
465 | #define OMAP3430_PRM_VC_CH_CONF_SA0 (1 << 0) | ||
466 | |||
467 | /* PRM_VC_I2C_CFG */ | ||
468 | #define OMAP3430_HSMASTER (1 << 5) | ||
469 | #define OMAP3430_SREN (1 << 4) | ||
470 | #define OMAP3430_HSEN (1 << 3) | ||
471 | #define OMAP3430_MCODE_SHIFT 0 | ||
472 | #define OMAP3430_MCODE_MASK (0x7 << 0) | ||
473 | |||
474 | /* PRM_VC_BYPASS_VAL */ | ||
475 | #define OMAP3430_VALID (1 << 24) | ||
476 | #define OMAP3430_DATA_SHIFT 16 | ||
477 | #define OMAP3430_DATA_MASK (0xff << 16) | ||
478 | #define OMAP3430_REGADDR_SHIFT 8 | ||
479 | #define OMAP3430_REGADDR_MASK (0xff << 8) | ||
480 | #define OMAP3430_SLAVEADDR_SHIFT 0 | ||
481 | #define OMAP3430_SLAVEADDR_MASK (0x7f << 0) | ||
482 | |||
483 | /* PRM_RSTCTRL */ | ||
484 | #define OMAP3430_RST_DPLL3 (1 << 2) | ||
485 | #define OMAP3430_RST_GS (1 << 1) | ||
486 | |||
487 | /* PRM_RSTTIME */ | ||
488 | #define OMAP3430_RSTTIME2_SHIFT 8 | ||
489 | #define OMAP3430_RSTTIME2_MASK (0x1f << 8) | ||
490 | #define OMAP3430_RSTTIME1_SHIFT 0 | ||
491 | #define OMAP3430_RSTTIME1_MASK (0xff << 0) | ||
492 | |||
493 | /* PRM_RSTST */ | ||
494 | #define OMAP3430_ICECRUSHER_RST (1 << 10) | ||
495 | #define OMAP3430_ICEPICK_RST (1 << 9) | ||
496 | #define OMAP3430_VDD2_VOLTAGE_MANAGER_RST (1 << 8) | ||
497 | #define OMAP3430_VDD1_VOLTAGE_MANAGER_RST (1 << 7) | ||
498 | #define OMAP3430_EXTERNAL_WARM_RST (1 << 6) | ||
499 | #define OMAP3430_SECURE_WD_RST (1 << 5) | ||
500 | #define OMAP3430_MPU_WD_RST (1 << 4) | ||
501 | #define OMAP3430_SECURITY_VIOL_RST (1 << 3) | ||
502 | #define OMAP3430_GLOBAL_SW_RST (1 << 1) | ||
503 | #define OMAP3430_GLOBAL_COLD_RST (1 << 0) | ||
504 | |||
505 | /* PRM_VOLTCTRL */ | ||
506 | #define OMAP3430_SEL_VMODE (1 << 4) | ||
507 | #define OMAP3430_SEL_OFF (1 << 3) | ||
508 | #define OMAP3430_AUTO_OFF (1 << 2) | ||
509 | #define OMAP3430_AUTO_RET (1 << 1) | ||
510 | #define OMAP3430_AUTO_SLEEP (1 << 0) | ||
511 | |||
512 | /* PRM_SRAM_PCHARGE */ | ||
513 | #define OMAP3430_PCHARGE_TIME_SHIFT 0 | ||
514 | #define OMAP3430_PCHARGE_TIME_MASK (0xff << 0) | ||
515 | |||
516 | /* PRM_CLKSRC_CTRL */ | ||
517 | #define OMAP3430_SYSCLKDIV_SHIFT 6 | ||
518 | #define OMAP3430_SYSCLKDIV_MASK (0x3 << 6) | ||
519 | #define OMAP3430_AUTOEXTCLKMODE_SHIFT 3 | ||
520 | #define OMAP3430_AUTOEXTCLKMODE_MASK (0x3 << 3) | ||
521 | #define OMAP3430_SYSCLKSEL_SHIFT 0 | ||
522 | #define OMAP3430_SYSCLKSEL_MASK (0x3 << 0) | ||
523 | |||
524 | /* PRM_VOLTSETUP1 */ | ||
525 | #define OMAP3430_SETUP_TIME2_SHIFT 16 | ||
526 | #define OMAP3430_SETUP_TIME2_MASK (0xffff << 16) | ||
527 | #define OMAP3430_SETUP_TIME1_SHIFT 0 | ||
528 | #define OMAP3430_SETUP_TIME1_MASK (0xffff << 0) | ||
529 | |||
530 | /* PRM_VOLTOFFSET */ | ||
531 | #define OMAP3430_OFFSET_TIME_SHIFT 0 | ||
532 | #define OMAP3430_OFFSET_TIME_MASK (0xffff << 0) | ||
533 | |||
534 | /* PRM_CLKSETUP */ | ||
535 | #define OMAP3430_SETUP_TIME_SHIFT 0 | ||
536 | #define OMAP3430_SETUP_TIME_MASK (0xffff << 0) | ||
537 | |||
538 | /* PRM_POLCTRL */ | ||
539 | #define OMAP3430_OFFMODE_POL (1 << 3) | ||
540 | #define OMAP3430_CLKOUT_POL (1 << 2) | ||
541 | #define OMAP3430_CLKREQ_POL (1 << 1) | ||
542 | #define OMAP3430_EXTVOL_POL (1 << 0) | ||
543 | |||
544 | /* PRM_VOLTSETUP2 */ | ||
545 | #define OMAP3430_OFFMODESETUPTIME_SHIFT 0 | ||
546 | #define OMAP3430_OFFMODESETUPTIME_MASK (0xffff << 0) | ||
547 | |||
548 | /* PRM_VP1_CONFIG specific bits */ | ||
549 | |||
550 | /* PRM_VP1_VSTEPMIN specific bits */ | ||
551 | |||
552 | /* PRM_VP1_VSTEPMAX specific bits */ | ||
553 | |||
554 | /* PRM_VP1_VLIMITTO specific bits */ | ||
555 | |||
556 | /* PRM_VP1_VOLTAGE specific bits */ | ||
557 | |||
558 | /* PRM_VP1_STATUS specific bits */ | ||
559 | |||
560 | /* PRM_VP2_CONFIG specific bits */ | ||
561 | |||
562 | /* PRM_VP2_VSTEPMIN specific bits */ | ||
563 | |||
564 | /* PRM_VP2_VSTEPMAX specific bits */ | ||
565 | |||
566 | /* PRM_VP2_VLIMITTO specific bits */ | ||
567 | |||
568 | /* PRM_VP2_VOLTAGE specific bits */ | ||
569 | |||
570 | /* PRM_VP2_STATUS specific bits */ | ||
571 | |||
572 | /* RM_RSTST_NEON specific bits */ | ||
573 | |||
574 | /* PM_WKDEP_NEON specific bits */ | ||
575 | |||
576 | /* PM_PWSTCTRL_NEON specific bits */ | ||
577 | |||
578 | /* PM_PWSTST_NEON specific bits */ | ||
579 | |||
580 | /* PM_PREPWSTST_NEON specific bits */ | ||
581 | |||
582 | #endif | ||
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h new file mode 100644 index 000000000000..ab7649afd891 --- /dev/null +++ b/arch/arm/mach-omap2/prm.h | |||
@@ -0,0 +1,316 @@ | |||
1 | #ifndef __ARCH_ARM_MACH_OMAP2_PRM_H | ||
2 | #define __ARCH_ARM_MACH_OMAP2_PRM_H | ||
3 | |||
4 | /* | ||
5 | * OMAP2/3 Power/Reset Management (PRM) register definitions | ||
6 | * | ||
7 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include "prcm-common.h" | ||
18 | |||
19 | #ifndef __ASSEMBLER__ | ||
20 | #define OMAP_PRM_REGADDR(module, reg) \ | ||
21 | (void __iomem *)IO_ADDRESS(OMAP2_PRM_BASE + (module) + (reg)) | ||
22 | #else | ||
23 | #define OMAP2420_PRM_REGADDR(module, reg) \ | ||
24 | IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg)) | ||
25 | #define OMAP2430_PRM_REGADDR(module, reg) \ | ||
26 | IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg)) | ||
27 | #define OMAP34XX_PRM_REGADDR(module, reg) \ | ||
28 | IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg)) | ||
29 | #endif | ||
30 | |||
31 | /* | ||
32 | * Architecture-specific global PRM registers | ||
33 | * Use prm_{read,write}_reg() with these registers. | ||
34 | * | ||
35 | * With a few exceptions, these are the register names beginning with | ||
36 | * PRCM_* on 24xx, and PRM_* on 34xx. (The exceptions are the | ||
37 | * IRQSTATUS and IRQENABLE bits.) | ||
38 | * | ||
39 | */ | ||
40 | |||
41 | #define OMAP24XX_PRCM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0000) | ||
42 | #define OMAP24XX_PRCM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0010) | ||
43 | |||
44 | #define OMAP24XX_PRCM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018) | ||
45 | #define OMAP24XX_PRCM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c) | ||
46 | |||
47 | #define OMAP24XX_PRCM_VOLTCTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0050) | ||
48 | #define OMAP24XX_PRCM_VOLTST OMAP_PRM_REGADDR(OCP_MOD, 0x0054) | ||
49 | #define OMAP24XX_PRCM_CLKSRC_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0060) | ||
50 | #define OMAP24XX_PRCM_CLKOUT_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0070) | ||
51 | #define OMAP24XX_PRCM_CLKEMUL_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0078) | ||
52 | #define OMAP24XX_PRCM_CLKCFG_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0080) | ||
53 | #define OMAP24XX_PRCM_CLKCFG_STATUS OMAP_PRM_REGADDR(OCP_MOD, 0x0084) | ||
54 | #define OMAP24XX_PRCM_VOLTSETUP OMAP_PRM_REGADDR(OCP_MOD, 0x0090) | ||
55 | #define OMAP24XX_PRCM_CLKSSETUP OMAP_PRM_REGADDR(OCP_MOD, 0x0094) | ||
56 | #define OMAP24XX_PRCM_POLCTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0098) | ||
57 | |||
58 | #define OMAP3430_PRM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0004) | ||
59 | #define OMAP3430_PRM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0014) | ||
60 | |||
61 | #define OMAP3430_PRM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018) | ||
62 | #define OMAP3430_PRM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c) | ||
63 | |||
64 | |||
65 | #define OMAP3430_PRM_VC_SMPS_SA OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020) | ||
66 | #define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024) | ||
67 | #define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028) | ||
68 | #define OMAP3430_PRM_VC_CMD_VAL_0 OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c) | ||
69 | #define OMAP3430_PRM_VC_CMD_VAL_1 OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030) | ||
70 | #define OMAP3430_PRM_VC_CH_CONF OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034) | ||
71 | #define OMAP3430_PRM_VC_I2C_CFG OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038) | ||
72 | #define OMAP3430_PRM_VC_BYPASS_VAL OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c) | ||
73 | #define OMAP3430_PRM_RSTCTRL OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050) | ||
74 | #define OMAP3430_PRM_RSTTIME OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054) | ||
75 | #define OMAP3430_PRM_RSTST OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058) | ||
76 | #define OMAP3430_PRM_VOLTCTRL OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060) | ||
77 | #define OMAP3430_PRM_SRAM_PCHARGE OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064) | ||
78 | #define OMAP3430_PRM_CLKSRC_CTRL OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070) | ||
79 | #define OMAP3430_PRM_VOLTSETUP1 OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090) | ||
80 | #define OMAP3430_PRM_VOLTOFFSET OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094) | ||
81 | #define OMAP3430_PRM_CLKSETUP OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098) | ||
82 | #define OMAP3430_PRM_POLCTRL OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c) | ||
83 | #define OMAP3430_PRM_VOLTSETUP2 OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0) | ||
84 | #define OMAP3430_PRM_VP1_CONFIG OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0) | ||
85 | #define OMAP3430_PRM_VP1_VSTEPMIN OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4) | ||
86 | #define OMAP3430_PRM_VP1_VSTEPMAX OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8) | ||
87 | #define OMAP3430_PRM_VP1_VLIMITTO OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc) | ||
88 | #define OMAP3430_PRM_VP1_VOLTAGE OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0) | ||
89 | #define OMAP3430_PRM_VP1_STATUS OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4) | ||
90 | #define OMAP3430_PRM_VP2_CONFIG OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0) | ||
91 | #define OMAP3430_PRM_VP2_VSTEPMIN OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4) | ||
92 | #define OMAP3430_PRM_VP2_VSTEPMAX OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8) | ||
93 | #define OMAP3430_PRM_VP2_VLIMITTO OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc) | ||
94 | #define OMAP3430_PRM_VP2_VOLTAGE OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0) | ||
95 | #define OMAP3430_PRM_VP2_STATUS OMAP_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4) | ||
96 | |||
97 | #define OMAP3430_PRM_CLKSEL OMAP_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040) | ||
98 | #define OMAP3430_PRM_CLKOUT_CTRL OMAP_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | ||
99 | |||
100 | /* | ||
101 | * Module specific PRM registers from PRM_BASE + domain offset | ||
102 | * | ||
103 | * Use prm_{read,write}_mod_reg() with these registers. | ||
104 | * | ||
105 | * With a few exceptions, these are the register names beginning with | ||
106 | * {PM,RM}_* on both architectures. (The exceptions are the IRQSTATUS | ||
107 | * and IRQENABLE bits.) | ||
108 | * | ||
109 | */ | ||
110 | |||
111 | /* Registers appearing on both 24xx and 34xx */ | ||
112 | |||
113 | #define RM_RSTCTRL 0x0050 | ||
114 | #define RM_RSTTIME 0x0054 | ||
115 | #define RM_RSTST 0x0058 | ||
116 | |||
117 | #define PM_WKEN 0x00a0 | ||
118 | #define PM_WKEN1 PM_WKEN | ||
119 | #define PM_WKST 0x00b0 | ||
120 | #define PM_WKST1 PM_WKST | ||
121 | #define PM_WKDEP 0x00c8 | ||
122 | #define PM_EVGENCTRL 0x00d4 | ||
123 | #define PM_EVGENONTIM 0x00d8 | ||
124 | #define PM_EVGENOFFTIM 0x00dc | ||
125 | #define PM_PWSTCTRL 0x00e0 | ||
126 | #define PM_PWSTST 0x00e4 | ||
127 | |||
128 | #define OMAP3430_PM_MPUGRPSEL 0x00a4 | ||
129 | #define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL | ||
130 | |||
131 | #define OMAP3430_PM_IVAGRPSEL 0x00a8 | ||
132 | #define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL | ||
133 | |||
134 | #define OMAP3430_PM_PREPWSTST 0x00e8 | ||
135 | |||
136 | #define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8 | ||
137 | #define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc | ||
138 | |||
139 | |||
140 | /* Architecture-specific registers */ | ||
141 | |||
142 | #define OMAP24XX_PM_WKEN2 0x00a4 | ||
143 | #define OMAP24XX_PM_WKST2 0x00b4 | ||
144 | |||
145 | #define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */ | ||
146 | #define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */ | ||
147 | #define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8 | ||
148 | #define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc | ||
149 | |||
150 | #ifndef __ASSEMBLER__ | ||
151 | |||
152 | /* Power/reset management domain register get/set */ | ||
153 | |||
154 | static inline void prm_write_mod_reg(u32 val, s16 module, s16 idx) | ||
155 | { | ||
156 | __raw_writel(val, OMAP_PRM_REGADDR(module, idx)); | ||
157 | } | ||
158 | |||
159 | static inline u32 prm_read_mod_reg(s16 module, s16 idx) | ||
160 | { | ||
161 | return __raw_readl(OMAP_PRM_REGADDR(module, idx)); | ||
162 | } | ||
163 | |||
164 | #endif | ||
165 | |||
166 | /* | ||
167 | * Bits common to specific registers | ||
168 | * | ||
169 | * The 3430 register and bit names are generally used, | ||
170 | * since they tend to make more sense | ||
171 | */ | ||
172 | |||
173 | /* PM_EVGENONTIM_MPU */ | ||
174 | /* Named PM_EVEGENONTIM_MPU on the 24XX */ | ||
175 | #define OMAP_ONTIMEVAL_SHIFT 0 | ||
176 | #define OMAP_ONTIMEVAL_MASK (0xffffffff << 0) | ||
177 | |||
178 | /* PM_EVGENOFFTIM_MPU */ | ||
179 | /* Named PM_EVEGENOFFTIM_MPU on the 24XX */ | ||
180 | #define OMAP_OFFTIMEVAL_SHIFT 0 | ||
181 | #define OMAP_OFFTIMEVAL_MASK (0xffffffff << 0) | ||
182 | |||
183 | /* PRM_CLKSETUP and PRCM_VOLTSETUP */ | ||
184 | /* Named PRCM_CLKSSETUP on the 24XX */ | ||
185 | #define OMAP_SETUP_TIME_SHIFT 0 | ||
186 | #define OMAP_SETUP_TIME_MASK (0xffff << 0) | ||
187 | |||
188 | /* PRM_CLKSRC_CTRL */ | ||
189 | /* Named PRCM_CLKSRC_CTRL on the 24XX */ | ||
190 | #define OMAP_SYSCLKDIV_SHIFT 6 | ||
191 | #define OMAP_SYSCLKDIV_MASK (0x3 << 6) | ||
192 | #define OMAP_AUTOEXTCLKMODE_SHIFT 3 | ||
193 | #define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3) | ||
194 | #define OMAP_SYSCLKSEL_SHIFT 0 | ||
195 | #define OMAP_SYSCLKSEL_MASK (0x3 << 0) | ||
196 | |||
197 | /* PM_EVGENCTRL_MPU */ | ||
198 | #define OMAP_OFFLOADMODE_SHIFT 3 | ||
199 | #define OMAP_OFFLOADMODE_MASK (0x3 << 3) | ||
200 | #define OMAP_ONLOADMODE_SHIFT 1 | ||
201 | #define OMAP_ONLOADMODE_MASK (0x3 << 1) | ||
202 | #define OMAP_ENABLE (1 << 0) | ||
203 | |||
204 | /* PRM_RSTTIME */ | ||
205 | /* Named RM_RSTTIME_WKUP on the 24xx */ | ||
206 | #define OMAP_RSTTIME2_SHIFT 8 | ||
207 | #define OMAP_RSTTIME2_MASK (0x1f << 8) | ||
208 | #define OMAP_RSTTIME1_SHIFT 0 | ||
209 | #define OMAP_RSTTIME1_MASK (0xff << 0) | ||
210 | |||
211 | |||
212 | /* PRM_RSTCTRL */ | ||
213 | /* Named RM_RSTCTRL_WKUP on the 24xx */ | ||
214 | /* 2420 calls RST_DPLL3 'RST_DPLL' */ | ||
215 | #define OMAP_RST_DPLL3 (1 << 2) | ||
216 | #define OMAP_RST_GS (1 << 1) | ||
217 | |||
218 | |||
219 | /* | ||
220 | * Bits common to module-shared registers | ||
221 | * | ||
222 | * Not all registers of a particular type support all of these bits - | ||
223 | * check TRM if you are unsure | ||
224 | */ | ||
225 | |||
226 | /* | ||
227 | * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP | ||
228 | * | ||
229 | * 2430: PM_PWSTST_MDM | ||
230 | * | ||
231 | * 3430: PM_PWSTST_IVA2, PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_GFX, | ||
232 | * PM_PWSTST_DSS, PM_PWSTST_CAM, PM_PWSTST_PER, PM_PWSTST_EMU, | ||
233 | * PM_PWSTST_NEON | ||
234 | */ | ||
235 | #define OMAP_INTRANSITION (1 << 20) | ||
236 | |||
237 | |||
238 | /* | ||
239 | * 24XX: PM_PWSTST_GFX, PM_PWSTST_DSP | ||
240 | * | ||
241 | * 2430: PM_PWSTST_MDM | ||
242 | * | ||
243 | * 3430: PM_PWSTST_IVA2, PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_GFX, | ||
244 | * PM_PWSTST_DSS, PM_PWSTST_CAM, PM_PWSTST_PER, PM_PWSTST_EMU, | ||
245 | * PM_PWSTST_NEON | ||
246 | */ | ||
247 | #define OMAP_POWERSTATEST_SHIFT 0 | ||
248 | #define OMAP_POWERSTATEST_MASK (0x3 << 0) | ||
249 | |||
250 | /* | ||
251 | * 24XX: RM_RSTST_MPU and RM_RSTST_DSP - on 24XX, 'COREDOMAINWKUP_RST' is | ||
252 | * called 'COREWKUP_RST' | ||
253 | * | ||
254 | * 3430: RM_RSTST_IVA2, RM_RSTST_MPU, RM_RSTST_GFX, RM_RSTST_DSS, | ||
255 | * RM_RSTST_CAM, RM_RSTST_PER, RM_RSTST_NEON | ||
256 | */ | ||
257 | #define OMAP_COREDOMAINWKUP_RST (1 << 3) | ||
258 | |||
259 | /* | ||
260 | * 24XX: RM_RSTST_MPU, RM_RSTST_GFX, RM_RSTST_DSP | ||
261 | * | ||
262 | * 2430: RM_RSTST_MDM | ||
263 | * | ||
264 | * 3430: RM_RSTST_CORE, RM_RSTST_EMU | ||
265 | */ | ||
266 | #define OMAP_DOMAINWKUP_RST (1 << 2) | ||
267 | |||
268 | /* | ||
269 | * 24XX: RM_RSTST_MPU, RM_RSTST_WKUP, RM_RSTST_DSP | ||
270 | * On 24XX, 'GLOBALWARM_RST' is called 'GLOBALWMPU_RST'. | ||
271 | * | ||
272 | * 2430: RM_RSTST_MDM | ||
273 | * | ||
274 | * 3430: RM_RSTST_CORE, RM_RSTST_EMU | ||
275 | */ | ||
276 | #define OMAP_GLOBALWARM_RST (1 << 1) | ||
277 | #define OMAP_GLOBALCOLD_RST (1 << 0) | ||
278 | |||
279 | /* | ||
280 | * 24XX: PM_WKDEP_GFX, PM_WKDEP_MPU, PM_WKDEP_CORE, PM_WKDEP_DSP | ||
281 | * 2420 TRM sometimes uses "EN_WAKEUP" instead of "EN_WKUP" | ||
282 | * | ||
283 | * 2430: PM_WKDEP_MDM | ||
284 | * | ||
285 | * 3430: PM_WKDEP_IVA2, PM_WKDEP_GFX, PM_WKDEP_DSS, PM_WKDEP_CAM, | ||
286 | * PM_WKDEP_PER | ||
287 | */ | ||
288 | #define OMAP_EN_WKUP (1 << 4) | ||
289 | |||
290 | /* | ||
291 | * 24XX: PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX, | ||
292 | * PM_PWSTCTRL_DSP | ||
293 | * | ||
294 | * 2430: PM_PWSTCTRL_MDM | ||
295 | * | ||
296 | * 3430: PM_PWSTCTRL_IVA2, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX, | ||
297 | * PM_PWSTCTRL_DSS, PM_PWSTCTRL_CAM, PM_PWSTCTRL_PER, | ||
298 | * PM_PWSTCTRL_NEON | ||
299 | */ | ||
300 | #define OMAP_LOGICRETSTATE (1 << 2) | ||
301 | |||
302 | /* | ||
303 | * 24XX: PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX, | ||
304 | * PM_PWSTCTRL_DSP, PM_PWSTST_MPU | ||
305 | * | ||
306 | * 2430: PM_PWSTCTRL_MDM shared bits | ||
307 | * | ||
308 | * 3430: PM_PWSTCTRL_IVA2, PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, | ||
309 | * PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSS, PM_PWSTCTRL_CAM, PM_PWSTCTRL_PER, | ||
310 | * PM_PWSTCTRL_NEON shared bits | ||
311 | */ | ||
312 | #define OMAP_POWERSTATE_SHIFT 0 | ||
313 | #define OMAP_POWERSTATE_MASK (0x3 << 0) | ||
314 | |||
315 | |||
316 | #endif | ||
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h new file mode 100644 index 000000000000..d7f23bc9550a --- /dev/null +++ b/arch/arm/mach-omap2/sdrc.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef __ARCH_ARM_MACH_OMAP2_SDRC_H | ||
2 | #define __ARCH_ARM_MACH_OMAP2_SDRC_H | ||
3 | |||
4 | /* | ||
5 | * OMAP2 SDRC register definitions | ||
6 | * | ||
7 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
8 | * Copyright (C) 2007 Nokia Corporation | ||
9 | * | ||
10 | * Written by Paul Walmsley | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | #undef DEBUG | ||
17 | |||
18 | #include <asm/arch/sdrc.h> | ||
19 | |||
20 | #ifndef __ASSEMBLER__ | ||
21 | extern unsigned long omap2_sdrc_base; | ||
22 | extern unsigned long omap2_sms_base; | ||
23 | |||
24 | #define OMAP_SDRC_REGADDR(reg) \ | ||
25 | (void __iomem *)IO_ADDRESS(omap2_sdrc_base + (reg)) | ||
26 | #define OMAP_SMS_REGADDR(reg) \ | ||
27 | (void __iomem *)IO_ADDRESS(omap2_sms_base + (reg)) | ||
28 | |||
29 | /* SDRC global register get/set */ | ||
30 | |||
31 | static inline void sdrc_write_reg(u32 val, u16 reg) | ||
32 | { | ||
33 | __raw_writel(val, OMAP_SDRC_REGADDR(reg)); | ||
34 | } | ||
35 | |||
36 | static inline u32 sdrc_read_reg(u16 reg) | ||
37 | { | ||
38 | return __raw_readl(OMAP_SDRC_REGADDR(reg)); | ||
39 | } | ||
40 | |||
41 | /* SMS global register get/set */ | ||
42 | |||
43 | static inline void sms_write_reg(u32 val, u16 reg) | ||
44 | { | ||
45 | __raw_writel(val, OMAP_SMS_REGADDR(reg)); | ||
46 | } | ||
47 | |||
48 | static inline u32 sms_read_reg(u16 reg) | ||
49 | { | ||
50 | return __raw_readl(OMAP_SMS_REGADDR(reg)); | ||
51 | } | ||
52 | #else | ||
53 | #define OMAP242X_SDRC_REGADDR(reg) IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) | ||
54 | #define OMAP243X_SDRC_REGADDR(reg) IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) | ||
55 | #define OMAP34XX_SDRC_REGADDR(reg) IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) | ||
56 | #endif /* __ASSEMBLER__ */ | ||
57 | |||
58 | #endif | ||
diff --git a/arch/arm/mach-omap2/sleep.S b/arch/arm/mach-omap2/sleep.S index 16247d557853..46ccb9b8b583 100644 --- a/arch/arm/mach-omap2/sleep.S +++ b/arch/arm/mach-omap2/sleep.S | |||
@@ -26,19 +26,10 @@ | |||
26 | #include <asm/arch/io.h> | 26 | #include <asm/arch/io.h> |
27 | #include <asm/arch/pm.h> | 27 | #include <asm/arch/pm.h> |
28 | 28 | ||
29 | #define A_32KSYNC_CR_V IO_ADDRESS(OMAP_TIMER32K_BASE+0x10) | 29 | #include "sdrc.h" |
30 | #define A_PRCM_VOLTCTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE+0x50) | ||
31 | #define A_PRCM_CLKCFG_CTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE+0x80) | ||
32 | #define A_CM_CLKEN_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE+0x500) | ||
33 | #define A_CM_IDLEST_CKGEN_V IO_ADDRESS(OMAP24XX_PRCM_BASE+0x520) | ||
34 | #define A_CM_CLKSEL1_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE+0x540) | ||
35 | #define A_CM_CLKSEL2_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE+0x544) | ||
36 | 30 | ||
37 | #define A_SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0x60) | 31 | /* First address of reserved address space? apparently valid for OMAP2 & 3 */ |
38 | #define A_SDRC_POWER_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0x70) | ||
39 | #define A_SDRC_RFR_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0xA4) | ||
40 | #define A_SDRC0_V (0xC0000000) | 32 | #define A_SDRC0_V (0xC0000000) |
41 | #define A_SDRC_MANUAL_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0xA8) | ||
42 | 33 | ||
43 | .text | 34 | .text |
44 | 35 | ||
@@ -126,17 +117,11 @@ loop2: | |||
126 | ldmfd sp!, {r0 - r12, pc} @ restore regs and return | 117 | ldmfd sp!, {r0 - r12, pc} @ restore regs and return |
127 | 118 | ||
128 | A_SDRC_POWER: | 119 | A_SDRC_POWER: |
129 | .word A_SDRC_POWER_V | 120 | .word OMAP242X_SDRC_REGADDR(SDRC_POWER) |
130 | A_SDRC0: | 121 | A_SDRC0: |
131 | .word A_SDRC0_V | 122 | .word A_SDRC0_V |
132 | A_CM_CLKSEL2_PLL_S: | ||
133 | .word A_CM_CLKSEL2_PLL_V | ||
134 | A_CM_CLKEN_PLL: | ||
135 | .word A_CM_CLKEN_PLL_V | ||
136 | A_SDRC_DLLA_CTRL_S: | 123 | A_SDRC_DLLA_CTRL_S: |
137 | .word A_SDRC_DLLA_CTRL_V | 124 | .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) |
138 | A_SDRC_MANUAL_S: | ||
139 | .word A_SDRC_MANUAL_V | ||
140 | 125 | ||
141 | ENTRY(omap24xx_cpu_suspend_sz) | 126 | ENTRY(omap24xx_cpu_suspend_sz) |
142 | .word . - omap24xx_cpu_suspend | 127 | .word . - omap24xx_cpu_suspend |
diff --git a/arch/arm/mach-omap2/sram-fn.S b/arch/arm/mach-omap2/sram-fn.S index b27576690f8d..4a9e49140716 100644 --- a/arch/arm/mach-omap2/sram-fn.S +++ b/arch/arm/mach-omap2/sram-fn.S | |||
@@ -27,19 +27,11 @@ | |||
27 | #include <asm/arch/io.h> | 27 | #include <asm/arch/io.h> |
28 | #include <asm/hardware.h> | 28 | #include <asm/hardware.h> |
29 | 29 | ||
30 | #include "prcm-regs.h" | 30 | #include "sdrc.h" |
31 | #include "prm.h" | ||
32 | #include "cm.h" | ||
31 | 33 | ||
32 | #define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP24XX_32KSYNCT_BASE + 0x010) | 34 | #define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010) |
33 | |||
34 | #define CM_CLKSEL2_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x544) | ||
35 | #define PRCM_VOLTCTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x050) | ||
36 | #define PRCM_CLKCFG_CTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x080) | ||
37 | #define CM_CLKEN_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x500) | ||
38 | #define CM_IDLEST_CKGEN_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x520) | ||
39 | #define CM_CLKSEL1_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x540) | ||
40 | |||
41 | #define SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE + 0x060) | ||
42 | #define SDRC_RFR_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE + 0x0a4) | ||
43 | 35 | ||
44 | .text | 36 | .text |
45 | 37 | ||
@@ -131,11 +123,11 @@ volt_delay: | |||
131 | 123 | ||
132 | /* relative load constants */ | 124 | /* relative load constants */ |
133 | cm_clksel2_pll: | 125 | cm_clksel2_pll: |
134 | .word CM_CLKSEL2_PLL_V | 126 | .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) |
135 | sdrc_dlla_ctrl: | 127 | sdrc_dlla_ctrl: |
136 | .word SDRC_DLLA_CTRL_V | 128 | .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) |
137 | prcm_voltctrl: | 129 | prcm_voltctrl: |
138 | .word PRCM_VOLTCTRL_V | 130 | .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x50) |
139 | prcm_mask_val: | 131 | prcm_mask_val: |
140 | .word 0xFFFF3FFC | 132 | .word 0xFFFF3FFC |
141 | timer_32ksynct_cr: | 133 | timer_32ksynct_cr: |
@@ -225,13 +217,13 @@ volt_delay_c: | |||
225 | mov pc, lr @ back to caller | 217 | mov pc, lr @ back to caller |
226 | 218 | ||
227 | ddr_cm_clksel2_pll: | 219 | ddr_cm_clksel2_pll: |
228 | .word CM_CLKSEL2_PLL_V | 220 | .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) |
229 | ddr_sdrc_dlla_ctrl: | 221 | ddr_sdrc_dlla_ctrl: |
230 | .word SDRC_DLLA_CTRL_V | 222 | .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) |
231 | ddr_sdrc_rfr_ctrl: | 223 | ddr_sdrc_rfr_ctrl: |
232 | .word SDRC_RFR_CTRL_V | 224 | .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0) |
233 | ddr_prcm_voltctrl: | 225 | ddr_prcm_voltctrl: |
234 | .word PRCM_VOLTCTRL_V | 226 | .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x50) |
235 | ddr_prcm_mask_val: | 227 | ddr_prcm_mask_val: |
236 | .word 0xFFFF3FFC | 228 | .word 0xFFFF3FFC |
237 | ddr_timer_32ksynct: | 229 | ddr_timer_32ksynct: |
@@ -316,17 +308,17 @@ wait_dll_lock: | |||
316 | ldmfd sp!, {r0-r12, pc} @ restore regs and return | 308 | ldmfd sp!, {r0-r12, pc} @ restore regs and return |
317 | 309 | ||
318 | set_config: | 310 | set_config: |
319 | .word PRCM_CLKCFG_CTRL_V | 311 | .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x80) |
320 | pll_ctl: | 312 | pll_ctl: |
321 | .word CM_CLKEN_PLL_V | 313 | .word OMAP2420_CM_REGADDR(PLL_MOD, CM_FCLKEN1) |
322 | pll_stat: | 314 | pll_stat: |
323 | .word CM_IDLEST_CKGEN_V | 315 | .word OMAP2420_CM_REGADDR(PLL_MOD, CM_IDLEST1) |
324 | pll_div: | 316 | pll_div: |
325 | .word CM_CLKSEL1_PLL_V | 317 | .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL) |
326 | sdrc_rfr: | 318 | sdrc_rfr: |
327 | .word SDRC_RFR_CTRL_V | 319 | .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0) |
328 | dlla_ctrl: | 320 | dlla_ctrl: |
329 | .word SDRC_DLLA_CTRL_V | 321 | .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) |
330 | 322 | ||
331 | ENTRY(sram_set_prcm_sz) | 323 | ENTRY(sram_set_prcm_sz) |
332 | .word . - sram_set_prcm | 324 | .word . - sram_set_prcm |
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 3234deedb946..78d05f203fff 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * OMAP2 GP timer support. | 4 | * OMAP2 GP timer support. |
5 | * | 5 | * |
6 | * Update to use new clocksource/clockevent layers | ||
7 | * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> | ||
8 | * Copyright (C) 2007 MontaVista Software, Inc. | ||
9 | * | ||
10 | * Original driver: | ||
6 | * Copyright (C) 2005 Nokia Corporation | 11 | * Copyright (C) 2005 Nokia Corporation |
7 | * Author: Paul Mundt <paul.mundt@nokia.com> | 12 | * Author: Paul Mundt <paul.mundt@nokia.com> |
8 | * Juha Yrjölä <juha.yrjola@nokia.com> | 13 | * Juha Yrjölä <juha.yrjola@nokia.com> |
@@ -25,24 +30,23 @@ | |||
25 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
26 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
27 | #include <linux/irq.h> | 32 | #include <linux/irq.h> |
33 | #include <linux/clocksource.h> | ||
34 | #include <linux/clockchips.h> | ||
28 | 35 | ||
29 | #include <asm/mach/time.h> | 36 | #include <asm/mach/time.h> |
30 | #include <asm/arch/dmtimer.h> | 37 | #include <asm/arch/dmtimer.h> |
31 | 38 | ||
32 | static struct omap_dm_timer *gptimer; | 39 | static struct omap_dm_timer *gptimer; |
33 | 40 | static struct clock_event_device clockevent_gpt; | |
34 | static inline void omap2_gp_timer_start(unsigned long load_val) | ||
35 | { | ||
36 | omap_dm_timer_set_load(gptimer, 1, 0xffffffff - load_val); | ||
37 | omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW); | ||
38 | omap_dm_timer_start(gptimer); | ||
39 | } | ||
40 | 41 | ||
41 | static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) | 42 | static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) |
42 | { | 43 | { |
43 | omap_dm_timer_write_status(gptimer, OMAP_TIMER_INT_OVERFLOW); | 44 | struct omap_dm_timer *gpt = (struct omap_dm_timer *)dev_id; |
44 | timer_tick(); | 45 | struct clock_event_device *evt = &clockevent_gpt; |
46 | |||
47 | omap_dm_timer_write_status(gpt, OMAP_TIMER_INT_OVERFLOW); | ||
45 | 48 | ||
49 | evt->event_handler(evt); | ||
46 | return IRQ_HANDLED; | 50 | return IRQ_HANDLED; |
47 | } | 51 | } |
48 | 52 | ||
@@ -52,20 +56,138 @@ static struct irqaction omap2_gp_timer_irq = { | |||
52 | .handler = omap2_gp_timer_interrupt, | 56 | .handler = omap2_gp_timer_interrupt, |
53 | }; | 57 | }; |
54 | 58 | ||
55 | static void __init omap2_gp_timer_init(void) | 59 | static int omap2_gp_timer_set_next_event(unsigned long cycles, |
60 | struct clock_event_device *evt) | ||
56 | { | 61 | { |
57 | u32 tick_period; | 62 | omap_dm_timer_set_load(gptimer, 0, 0xffffffff - cycles); |
63 | omap_dm_timer_start(gptimer); | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static void omap2_gp_timer_set_mode(enum clock_event_mode mode, | ||
69 | struct clock_event_device *evt) | ||
70 | { | ||
71 | u32 period; | ||
72 | |||
73 | omap_dm_timer_stop(gptimer); | ||
74 | |||
75 | switch (mode) { | ||
76 | case CLOCK_EVT_MODE_PERIODIC: | ||
77 | period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; | ||
78 | period -= 1; | ||
79 | |||
80 | omap_dm_timer_set_load(gptimer, 1, 0xffffffff - period); | ||
81 | omap_dm_timer_start(gptimer); | ||
82 | break; | ||
83 | case CLOCK_EVT_MODE_ONESHOT: | ||
84 | break; | ||
85 | case CLOCK_EVT_MODE_UNUSED: | ||
86 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
87 | case CLOCK_EVT_MODE_RESUME: | ||
88 | break; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | static struct clock_event_device clockevent_gpt = { | ||
93 | .name = "gp timer", | ||
94 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
95 | .shift = 32, | ||
96 | .set_next_event = omap2_gp_timer_set_next_event, | ||
97 | .set_mode = omap2_gp_timer_set_mode, | ||
98 | }; | ||
99 | |||
100 | static void __init omap2_gp_clockevent_init(void) | ||
101 | { | ||
102 | u32 tick_rate; | ||
58 | 103 | ||
59 | omap_dm_timer_init(); | ||
60 | gptimer = omap_dm_timer_request_specific(1); | 104 | gptimer = omap_dm_timer_request_specific(1); |
61 | BUG_ON(gptimer == NULL); | 105 | BUG_ON(gptimer == NULL); |
62 | 106 | ||
107 | #if defined(CONFIG_OMAP_32K_TIMER) | ||
108 | omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_32_KHZ); | ||
109 | #else | ||
63 | omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK); | 110 | omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK); |
64 | tick_period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; | 111 | #endif |
65 | tick_period -= 1; | 112 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer)); |
66 | 113 | ||
114 | omap2_gp_timer_irq.dev_id = (void *)gptimer; | ||
67 | setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); | 115 | setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); |
68 | omap2_gp_timer_start(tick_period); | 116 | omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW); |
117 | |||
118 | clockevent_gpt.mult = div_sc(tick_rate, NSEC_PER_SEC, | ||
119 | clockevent_gpt.shift); | ||
120 | clockevent_gpt.max_delta_ns = | ||
121 | clockevent_delta2ns(0xffffffff, &clockevent_gpt); | ||
122 | clockevent_gpt.min_delta_ns = | ||
123 | clockevent_delta2ns(1, &clockevent_gpt); | ||
124 | |||
125 | clockevent_gpt.cpumask = cpumask_of_cpu(0); | ||
126 | clockevents_register_device(&clockevent_gpt); | ||
127 | } | ||
128 | |||
129 | #ifdef CONFIG_OMAP_32K_TIMER | ||
130 | /* | ||
131 | * When 32k-timer is enabled, don't use GPTimer for clocksource | ||
132 | * instead, just leave default clocksource which uses the 32k | ||
133 | * sync counter. See clocksource setup in see plat-omap/common.c. | ||
134 | */ | ||
135 | |||
136 | static inline void __init omap2_gp_clocksource_init(void) {} | ||
137 | #else | ||
138 | /* | ||
139 | * clocksource | ||
140 | */ | ||
141 | static struct omap_dm_timer *gpt_clocksource; | ||
142 | static cycle_t clocksource_read_cycles(void) | ||
143 | { | ||
144 | return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource); | ||
145 | } | ||
146 | |||
147 | static struct clocksource clocksource_gpt = { | ||
148 | .name = "gp timer", | ||
149 | .rating = 300, | ||
150 | .read = clocksource_read_cycles, | ||
151 | .mask = CLOCKSOURCE_MASK(32), | ||
152 | .shift = 24, | ||
153 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
154 | }; | ||
155 | |||
156 | /* Setup free-running counter for clocksource */ | ||
157 | static void __init omap2_gp_clocksource_init(void) | ||
158 | { | ||
159 | static struct omap_dm_timer *gpt; | ||
160 | u32 tick_rate, tick_period; | ||
161 | static char err1[] __initdata = KERN_ERR | ||
162 | "%s: failed to request dm-timer\n"; | ||
163 | static char err2[] __initdata = KERN_ERR | ||
164 | "%s: can't register clocksource!\n"; | ||
165 | |||
166 | gpt = omap_dm_timer_request(); | ||
167 | if (!gpt) | ||
168 | printk(err1, clocksource_gpt.name); | ||
169 | gpt_clocksource = gpt; | ||
170 | |||
171 | omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK); | ||
172 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt)); | ||
173 | tick_period = (tick_rate / HZ) - 1; | ||
174 | |||
175 | omap_dm_timer_set_load(gpt, 1, 0); | ||
176 | omap_dm_timer_start(gpt); | ||
177 | |||
178 | clocksource_gpt.mult = | ||
179 | clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift); | ||
180 | if (clocksource_register(&clocksource_gpt)) | ||
181 | printk(err2, clocksource_gpt.name); | ||
182 | } | ||
183 | #endif | ||
184 | |||
185 | static void __init omap2_gp_timer_init(void) | ||
186 | { | ||
187 | omap_dm_timer_init(); | ||
188 | |||
189 | omap2_gp_clockevent_init(); | ||
190 | omap2_gp_clocksource_init(); | ||
69 | } | 191 | } |
70 | 192 | ||
71 | struct sys_timer omap_timer = { | 193 | struct sys_timer omap_timer = { |