diff options
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap1/include/mach/entry-macro.S | 13 | ||||
-rw-r--r-- | arch/arm/mach-omap1/irq.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/lcd_dma.c | 24 | ||||
-rw-r--r-- | arch/arm/mach-omap1/pm.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-omap1/sleep.S | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap1/sram.S | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap1/time.c | 100 | ||||
-rw-r--r-- | arch/arm/mach-omap1/timer32k.c | 13 |
10 files changed, 122 insertions, 45 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index 8d2f2daba0c0..e0a028161dde 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig | |||
@@ -9,6 +9,7 @@ config ARCH_OMAP730 | |||
9 | depends on ARCH_OMAP1 | 9 | depends on ARCH_OMAP1 |
10 | bool "OMAP730 Based System" | 10 | bool "OMAP730 Based System" |
11 | select CPU_ARM926T | 11 | select CPU_ARM926T |
12 | select OMAP_MPU_TIMER | ||
12 | select ARCH_OMAP_OTG | 13 | select ARCH_OMAP_OTG |
13 | 14 | ||
14 | config ARCH_OMAP850 | 15 | config ARCH_OMAP850 |
@@ -22,6 +23,7 @@ config ARCH_OMAP15XX | |||
22 | default y | 23 | default y |
23 | bool "OMAP15xx Based System" | 24 | bool "OMAP15xx Based System" |
24 | select CPU_ARM925T | 25 | select CPU_ARM925T |
26 | select OMAP_MPU_TIMER | ||
25 | 27 | ||
26 | config ARCH_OMAP16XX | 28 | config ARCH_OMAP16XX |
27 | depends on ARCH_OMAP1 | 29 | depends on ARCH_OMAP1 |
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index 6ee19504845f..ba6009f27677 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile | |||
@@ -3,12 +3,11 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := io.o id.o sram.o irq.o mux.o flash.o serial.o devices.o dma.o | 6 | obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o |
7 | obj-y += clock.o clock_data.o opp_data.o | 7 | obj-y += clock.o clock_data.o opp_data.o |
8 | 8 | ||
9 | obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o | 9 | obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o |
10 | 10 | ||
11 | obj-$(CONFIG_OMAP_MPU_TIMER) += time.o | ||
12 | obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o | 11 | obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o |
13 | 12 | ||
14 | # Power Management | 13 | # Power Management |
diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S b/arch/arm/mach-omap1/include/mach/entry-macro.S index c9be6d4d83e2..bfb4fb1d7382 100644 --- a/arch/arm/mach-omap1/include/mach/entry-macro.S +++ b/arch/arm/mach-omap1/include/mach/entry-macro.S | |||
@@ -14,19 +14,6 @@ | |||
14 | #include <mach/irqs.h> | 14 | #include <mach/irqs.h> |
15 | #include <asm/hardware/gic.h> | 15 | #include <asm/hardware/gic.h> |
16 | 16 | ||
17 | /* | ||
18 | * We use __glue to avoid errors with multiple definitions of | ||
19 | * .globl omap_irq_flags as it's included from entry-armv.S but not | ||
20 | * from entry-common.S. | ||
21 | */ | ||
22 | #ifdef __glue | ||
23 | .pushsection .data | ||
24 | .globl omap_irq_flags | ||
25 | omap_irq_flags: | ||
26 | .word 0 | ||
27 | .popsection | ||
28 | #endif | ||
29 | |||
30 | .macro disable_fiq | 17 | .macro disable_fiq |
31 | .endm | 18 | .endm |
32 | 19 | ||
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c index 47701584df35..731dd33bff51 100644 --- a/arch/arm/mach-omap1/irq.c +++ b/arch/arm/mach-omap1/irq.c | |||
@@ -57,6 +57,7 @@ struct omap_irq_bank { | |||
57 | unsigned long wake_enable; | 57 | unsigned long wake_enable; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | u32 omap_irq_flags; | ||
60 | static unsigned int irq_bank_count; | 61 | static unsigned int irq_bank_count; |
61 | static struct omap_irq_bank *irq_banks; | 62 | static struct omap_irq_bank *irq_banks; |
62 | 63 | ||
@@ -176,7 +177,6 @@ static struct irq_chip omap_irq_chip = { | |||
176 | 177 | ||
177 | void __init omap_init_irq(void) | 178 | void __init omap_init_irq(void) |
178 | { | 179 | { |
179 | extern unsigned int omap_irq_flags; | ||
180 | int i, j; | 180 | int i, j; |
181 | 181 | ||
182 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | 182 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c index c9088d85da04..453809359ba6 100644 --- a/arch/arm/mach-omap1/lcd_dma.c +++ b/arch/arm/mach-omap1/lcd_dma.c | |||
@@ -37,7 +37,7 @@ int omap_lcd_dma_running(void) | |||
37 | * On OMAP1510, internal LCD controller will start the transfer | 37 | * On OMAP1510, internal LCD controller will start the transfer |
38 | * when it gets enabled, so assume DMA running if LCD enabled. | 38 | * when it gets enabled, so assume DMA running if LCD enabled. |
39 | */ | 39 | */ |
40 | if (cpu_is_omap1510()) | 40 | if (cpu_is_omap15xx()) |
41 | if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN) | 41 | if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN) |
42 | return 1; | 42 | return 1; |
43 | 43 | ||
@@ -95,7 +95,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer); | |||
95 | 95 | ||
96 | void omap_set_lcd_dma_b1_rotation(int rotate) | 96 | void omap_set_lcd_dma_b1_rotation(int rotate) |
97 | { | 97 | { |
98 | if (cpu_is_omap1510()) { | 98 | if (cpu_is_omap15xx()) { |
99 | printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n"); | 99 | printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n"); |
100 | BUG(); | 100 | BUG(); |
101 | return; | 101 | return; |
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation); | |||
106 | 106 | ||
107 | void omap_set_lcd_dma_b1_mirror(int mirror) | 107 | void omap_set_lcd_dma_b1_mirror(int mirror) |
108 | { | 108 | { |
109 | if (cpu_is_omap1510()) { | 109 | if (cpu_is_omap15xx()) { |
110 | printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n"); | 110 | printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n"); |
111 | BUG(); | 111 | BUG(); |
112 | } | 112 | } |
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror); | |||
116 | 116 | ||
117 | void omap_set_lcd_dma_b1_vxres(unsigned long vxres) | 117 | void omap_set_lcd_dma_b1_vxres(unsigned long vxres) |
118 | { | 118 | { |
119 | if (cpu_is_omap1510()) { | 119 | if (cpu_is_omap15xx()) { |
120 | printk(KERN_ERR "DMA virtual resulotion is not supported " | 120 | printk(KERN_ERR "DMA virtual resulotion is not supported " |
121 | "in 1510 mode\n"); | 121 | "in 1510 mode\n"); |
122 | BUG(); | 122 | BUG(); |
@@ -127,7 +127,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres); | |||
127 | 127 | ||
128 | void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) | 128 | void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) |
129 | { | 129 | { |
130 | if (cpu_is_omap1510()) { | 130 | if (cpu_is_omap15xx()) { |
131 | printk(KERN_ERR "DMA scale is not supported in 1510 mode\n"); | 131 | printk(KERN_ERR "DMA scale is not supported in 1510 mode\n"); |
132 | BUG(); | 132 | BUG(); |
133 | } | 133 | } |
@@ -177,7 +177,7 @@ static void set_b1_regs(void) | |||
177 | bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1); | 177 | bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1); |
178 | /* 1510 DMA requires the bottom address to be 2 more | 178 | /* 1510 DMA requires the bottom address to be 2 more |
179 | * than the actual last memory access location. */ | 179 | * than the actual last memory access location. */ |
180 | if (cpu_is_omap1510() && | 180 | if (cpu_is_omap15xx() && |
181 | lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) | 181 | lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) |
182 | bottom += 2; | 182 | bottom += 2; |
183 | ei = PIXSTEP(0, 0, 1, 0); | 183 | ei = PIXSTEP(0, 0, 1, 0); |
@@ -241,7 +241,7 @@ static void set_b1_regs(void) | |||
241 | return; /* Suppress warning about uninitialized vars */ | 241 | return; /* Suppress warning about uninitialized vars */ |
242 | } | 242 | } |
243 | 243 | ||
244 | if (cpu_is_omap1510()) { | 244 | if (cpu_is_omap15xx()) { |
245 | omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U); | 245 | omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U); |
246 | omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L); | 246 | omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L); |
247 | omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U); | 247 | omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U); |
@@ -343,7 +343,7 @@ void omap_free_lcd_dma(void) | |||
343 | BUG(); | 343 | BUG(); |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | if (!cpu_is_omap1510()) | 346 | if (!cpu_is_omap15xx()) |
347 | omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1, | 347 | omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1, |
348 | OMAP1610_DMA_LCD_CCR); | 348 | OMAP1610_DMA_LCD_CCR); |
349 | lcd_dma.reserved = 0; | 349 | lcd_dma.reserved = 0; |
@@ -360,7 +360,7 @@ void omap_enable_lcd_dma(void) | |||
360 | * connected. Otherwise the OMAP internal controller will | 360 | * connected. Otherwise the OMAP internal controller will |
361 | * start the transfer when it gets enabled. | 361 | * start the transfer when it gets enabled. |
362 | */ | 362 | */ |
363 | if (cpu_is_omap1510() || !lcd_dma.ext_ctrl) | 363 | if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl) |
364 | return; | 364 | return; |
365 | 365 | ||
366 | w = omap_readw(OMAP1610_DMA_LCD_CTRL); | 366 | w = omap_readw(OMAP1610_DMA_LCD_CTRL); |
@@ -378,14 +378,14 @@ EXPORT_SYMBOL(omap_enable_lcd_dma); | |||
378 | void omap_setup_lcd_dma(void) | 378 | void omap_setup_lcd_dma(void) |
379 | { | 379 | { |
380 | BUG_ON(lcd_dma.active); | 380 | BUG_ON(lcd_dma.active); |
381 | if (!cpu_is_omap1510()) { | 381 | if (!cpu_is_omap15xx()) { |
382 | /* Set some reasonable defaults */ | 382 | /* Set some reasonable defaults */ |
383 | omap_writew(0x5440, OMAP1610_DMA_LCD_CCR); | 383 | omap_writew(0x5440, OMAP1610_DMA_LCD_CCR); |
384 | omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP); | 384 | omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP); |
385 | omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL); | 385 | omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL); |
386 | } | 386 | } |
387 | set_b1_regs(); | 387 | set_b1_regs(); |
388 | if (!cpu_is_omap1510()) { | 388 | if (!cpu_is_omap15xx()) { |
389 | u16 w; | 389 | u16 w; |
390 | 390 | ||
391 | w = omap_readw(OMAP1610_DMA_LCD_CCR); | 391 | w = omap_readw(OMAP1610_DMA_LCD_CCR); |
@@ -407,7 +407,7 @@ void omap_stop_lcd_dma(void) | |||
407 | u16 w; | 407 | u16 w; |
408 | 408 | ||
409 | lcd_dma.active = 0; | 409 | lcd_dma.active = 0; |
410 | if (cpu_is_omap1510() || !lcd_dma.ext_ctrl) | 410 | if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl) |
411 | return; | 411 | return; |
412 | 412 | ||
413 | w = omap_readw(OMAP1610_DMA_LCD_CCR); | 413 | w = omap_readw(OMAP1610_DMA_LCD_CCR); |
diff --git a/arch/arm/mach-omap1/pm.h b/arch/arm/mach-omap1/pm.h index 56a647986ae9..cd926dcb5e7f 100644 --- a/arch/arm/mach-omap1/pm.h +++ b/arch/arm/mach-omap1/pm.h | |||
@@ -123,9 +123,9 @@ extern void allow_idle_sleep(void); | |||
123 | extern void omap1_pm_idle(void); | 123 | extern void omap1_pm_idle(void); |
124 | extern void omap1_pm_suspend(void); | 124 | extern void omap1_pm_suspend(void); |
125 | 125 | ||
126 | extern void omap7xx_cpu_suspend(unsigned short, unsigned short); | 126 | extern void omap7xx_cpu_suspend(unsigned long, unsigned long); |
127 | extern void omap1510_cpu_suspend(unsigned short, unsigned short); | 127 | extern void omap1510_cpu_suspend(unsigned long, unsigned long); |
128 | extern void omap1610_cpu_suspend(unsigned short, unsigned short); | 128 | extern void omap1610_cpu_suspend(unsigned long, unsigned long); |
129 | extern void omap7xx_idle_loop_suspend(void); | 129 | extern void omap7xx_idle_loop_suspend(void); |
130 | extern void omap1510_idle_loop_suspend(void); | 130 | extern void omap1510_idle_loop_suspend(void); |
131 | extern void omap1610_idle_loop_suspend(void); | 131 | extern void omap1610_idle_loop_suspend(void); |
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S index ef771ce8b030..c875bdc902c5 100644 --- a/arch/arm/mach-omap1/sleep.S +++ b/arch/arm/mach-omap1/sleep.S | |||
@@ -58,6 +58,7 @@ | |||
58 | */ | 58 | */ |
59 | 59 | ||
60 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | 60 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
61 | .align 3 | ||
61 | ENTRY(omap7xx_cpu_suspend) | 62 | ENTRY(omap7xx_cpu_suspend) |
62 | 63 | ||
63 | @ save registers on stack | 64 | @ save registers on stack |
@@ -137,6 +138,7 @@ ENTRY(omap7xx_cpu_suspend_sz) | |||
137 | #endif /* CONFIG_ARCH_OMAP730 || CONFIG_ARCH_OMAP850 */ | 138 | #endif /* CONFIG_ARCH_OMAP730 || CONFIG_ARCH_OMAP850 */ |
138 | 139 | ||
139 | #ifdef CONFIG_ARCH_OMAP15XX | 140 | #ifdef CONFIG_ARCH_OMAP15XX |
141 | .align 3 | ||
140 | ENTRY(omap1510_cpu_suspend) | 142 | ENTRY(omap1510_cpu_suspend) |
141 | 143 | ||
142 | @ save registers on stack | 144 | @ save registers on stack |
@@ -211,6 +213,7 @@ ENTRY(omap1510_cpu_suspend_sz) | |||
211 | #endif /* CONFIG_ARCH_OMAP15XX */ | 213 | #endif /* CONFIG_ARCH_OMAP15XX */ |
212 | 214 | ||
213 | #if defined(CONFIG_ARCH_OMAP16XX) | 215 | #if defined(CONFIG_ARCH_OMAP16XX) |
216 | .align 3 | ||
214 | ENTRY(omap1610_cpu_suspend) | 217 | ENTRY(omap1610_cpu_suspend) |
215 | 218 | ||
216 | @ save registers on stack | 219 | @ save registers on stack |
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S index 7724e520d07c..692587d07ea5 100644 --- a/arch/arm/mach-omap1/sram.S +++ b/arch/arm/mach-omap1/sram.S | |||
@@ -18,6 +18,7 @@ | |||
18 | /* | 18 | /* |
19 | * Reprograms ULPD and CKCTL. | 19 | * Reprograms ULPD and CKCTL. |
20 | */ | 20 | */ |
21 | .align 3 | ||
21 | ENTRY(omap1_sram_reprogram_clock) | 22 | ENTRY(omap1_sram_reprogram_clock) |
22 | stmfd sp!, {r0 - r12, lr} @ save registers on stack | 23 | stmfd sp!, {r0 - r12, lr} @ save registers on stack |
23 | 24 | ||
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index ed7a61ff916a..6885d2fac183 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
@@ -49,11 +49,15 @@ | |||
49 | #include <mach/hardware.h> | 49 | #include <mach/hardware.h> |
50 | #include <asm/leds.h> | 50 | #include <asm/leds.h> |
51 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
52 | #include <asm/sched_clock.h> | ||
53 | |||
52 | #include <asm/mach/irq.h> | 54 | #include <asm/mach/irq.h> |
53 | #include <asm/mach/time.h> | 55 | #include <asm/mach/time.h> |
54 | 56 | ||
55 | #include <plat/common.h> | 57 | #include <plat/common.h> |
56 | 58 | ||
59 | #ifdef CONFIG_OMAP_MPU_TIMER | ||
60 | |||
57 | #define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE | 61 | #define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE |
58 | #define OMAP_MPU_TIMER_OFFSET 0x100 | 62 | #define OMAP_MPU_TIMER_OFFSET 0x100 |
59 | 63 | ||
@@ -67,7 +71,7 @@ typedef struct { | |||
67 | ((volatile omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE + \ | 71 | ((volatile omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE + \ |
68 | (n)*OMAP_MPU_TIMER_OFFSET)) | 72 | (n)*OMAP_MPU_TIMER_OFFSET)) |
69 | 73 | ||
70 | static inline unsigned long omap_mpu_timer_read(int nr) | 74 | static inline unsigned long notrace omap_mpu_timer_read(int nr) |
71 | { | 75 | { |
72 | volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr); | 76 | volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr); |
73 | return timer->read_tim; | 77 | return timer->read_tim; |
@@ -212,6 +216,32 @@ static struct clocksource clocksource_mpu = { | |||
212 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 216 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
213 | }; | 217 | }; |
214 | 218 | ||
219 | static DEFINE_CLOCK_DATA(cd); | ||
220 | |||
221 | static inline unsigned long long notrace _omap_mpu_sched_clock(void) | ||
222 | { | ||
223 | u32 cyc = mpu_read(&clocksource_mpu); | ||
224 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); | ||
225 | } | ||
226 | |||
227 | #ifndef CONFIG_OMAP_32K_TIMER | ||
228 | unsigned long long notrace sched_clock(void) | ||
229 | { | ||
230 | return _omap_mpu_sched_clock(); | ||
231 | } | ||
232 | #else | ||
233 | static unsigned long long notrace omap_mpu_sched_clock(void) | ||
234 | { | ||
235 | return _omap_mpu_sched_clock(); | ||
236 | } | ||
237 | #endif | ||
238 | |||
239 | static void notrace mpu_update_sched_clock(void) | ||
240 | { | ||
241 | u32 cyc = mpu_read(&clocksource_mpu); | ||
242 | update_sched_clock(&cd, cyc, (u32)~0); | ||
243 | } | ||
244 | |||
215 | static void __init omap_init_clocksource(unsigned long rate) | 245 | static void __init omap_init_clocksource(unsigned long rate) |
216 | { | 246 | { |
217 | static char err[] __initdata = KERN_ERR | 247 | static char err[] __initdata = KERN_ERR |
@@ -219,17 +249,13 @@ static void __init omap_init_clocksource(unsigned long rate) | |||
219 | 249 | ||
220 | setup_irq(INT_TIMER2, &omap_mpu_timer2_irq); | 250 | setup_irq(INT_TIMER2, &omap_mpu_timer2_irq); |
221 | omap_mpu_timer_start(1, ~0, 1); | 251 | omap_mpu_timer_start(1, ~0, 1); |
252 | init_sched_clock(&cd, mpu_update_sched_clock, 32, rate); | ||
222 | 253 | ||
223 | if (clocksource_register_hz(&clocksource_mpu, rate)) | 254 | if (clocksource_register_hz(&clocksource_mpu, rate)) |
224 | printk(err, clocksource_mpu.name); | 255 | printk(err, clocksource_mpu.name); |
225 | } | 256 | } |
226 | 257 | ||
227 | /* | 258 | static void __init omap_mpu_timer_init(void) |
228 | * --------------------------------------------------------------------------- | ||
229 | * Timer initialization | ||
230 | * --------------------------------------------------------------------------- | ||
231 | */ | ||
232 | static void __init omap_timer_init(void) | ||
233 | { | 259 | { |
234 | struct clk *ck_ref = clk_get(NULL, "ck_ref"); | 260 | struct clk *ck_ref = clk_get(NULL, "ck_ref"); |
235 | unsigned long rate; | 261 | unsigned long rate; |
@@ -246,6 +272,66 @@ static void __init omap_timer_init(void) | |||
246 | omap_init_clocksource(rate); | 272 | omap_init_clocksource(rate); |
247 | } | 273 | } |
248 | 274 | ||
275 | #else | ||
276 | static inline void omap_mpu_timer_init(void) | ||
277 | { | ||
278 | pr_err("Bogus timer, should not happen\n"); | ||
279 | } | ||
280 | #endif /* CONFIG_OMAP_MPU_TIMER */ | ||
281 | |||
282 | #if defined(CONFIG_OMAP_MPU_TIMER) && defined(CONFIG_OMAP_32K_TIMER) | ||
283 | static unsigned long long (*preferred_sched_clock)(void); | ||
284 | |||
285 | unsigned long long notrace sched_clock(void) | ||
286 | { | ||
287 | if (!preferred_sched_clock) | ||
288 | return 0; | ||
289 | |||
290 | return preferred_sched_clock(); | ||
291 | } | ||
292 | |||
293 | static inline void preferred_sched_clock_init(bool use_32k_sched_clock) | ||
294 | { | ||
295 | if (use_32k_sched_clock) | ||
296 | preferred_sched_clock = omap_32k_sched_clock; | ||
297 | else | ||
298 | preferred_sched_clock = omap_mpu_sched_clock; | ||
299 | } | ||
300 | #else | ||
301 | static inline void preferred_sched_clock_init(bool use_32k_sched_clcok) | ||
302 | { | ||
303 | } | ||
304 | #endif | ||
305 | |||
306 | static inline int omap_32k_timer_usable(void) | ||
307 | { | ||
308 | int res = false; | ||
309 | |||
310 | if (cpu_is_omap730() || cpu_is_omap15xx()) | ||
311 | return res; | ||
312 | |||
313 | #ifdef CONFIG_OMAP_32K_TIMER | ||
314 | res = omap_32k_timer_init(); | ||
315 | #endif | ||
316 | |||
317 | return res; | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | * --------------------------------------------------------------------------- | ||
322 | * Timer initialization | ||
323 | * --------------------------------------------------------------------------- | ||
324 | */ | ||
325 | static void __init omap_timer_init(void) | ||
326 | { | ||
327 | if (omap_32k_timer_usable()) { | ||
328 | preferred_sched_clock_init(1); | ||
329 | } else { | ||
330 | omap_mpu_timer_init(); | ||
331 | preferred_sched_clock_init(0); | ||
332 | } | ||
333 | } | ||
334 | |||
249 | struct sys_timer omap_timer = { | 335 | struct sys_timer omap_timer = { |
250 | .init = omap_timer_init, | 336 | .init = omap_timer_init, |
251 | }; | 337 | }; |
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index 20cfbcc6c60c..13d7b8f145bd 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c | |||
@@ -52,10 +52,9 @@ | |||
52 | #include <asm/irq.h> | 52 | #include <asm/irq.h> |
53 | #include <asm/mach/irq.h> | 53 | #include <asm/mach/irq.h> |
54 | #include <asm/mach/time.h> | 54 | #include <asm/mach/time.h> |
55 | #include <plat/common.h> | ||
55 | #include <plat/dmtimer.h> | 56 | #include <plat/dmtimer.h> |
56 | 57 | ||
57 | struct sys_timer omap_timer; | ||
58 | |||
59 | /* | 58 | /* |
60 | * --------------------------------------------------------------------------- | 59 | * --------------------------------------------------------------------------- |
61 | * 32KHz OS timer | 60 | * 32KHz OS timer |
@@ -181,14 +180,14 @@ static __init void omap_init_32k_timer(void) | |||
181 | * Timer initialization | 180 | * Timer initialization |
182 | * --------------------------------------------------------------------------- | 181 | * --------------------------------------------------------------------------- |
183 | */ | 182 | */ |
184 | static void __init omap_timer_init(void) | 183 | bool __init omap_32k_timer_init(void) |
185 | { | 184 | { |
185 | omap_init_clocksource_32k(); | ||
186 | |||
186 | #ifdef CONFIG_OMAP_DM_TIMER | 187 | #ifdef CONFIG_OMAP_DM_TIMER |
187 | omap_dm_timer_init(); | 188 | omap_dm_timer_init(); |
188 | #endif | 189 | #endif |
189 | omap_init_32k_timer(); | 190 | omap_init_32k_timer(); |
190 | } | ||
191 | 191 | ||
192 | struct sys_timer omap_timer = { | 192 | return true; |
193 | .init = omap_timer_init, | 193 | } |
194 | }; | ||