diff options
| author | Vaibhav Hiremath <hvaibhav@ti.com> | 2012-05-09 13:07:05 -0400 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2012-05-09 13:07:05 -0400 |
| commit | 187999119d93f584209400b052cf092141a33650 (patch) | |
| tree | 8c1c90df099ef080a5913ca62b45bf65d97dc0c9 | |
| parent | bfd17879866b36e95c58721da070d9f2ac7f8901 (diff) | |
ARM: OMAP1: Add checks for possible error condition in timer_init
On OMAP1, omap_32k_timer_init() function always returns "true",
irrespective of whether error occurred while initializing 32k sync
counter as a kernel clocksource or not and execution will never
fallback to mpu_timer clocksource init code.
This patch adds check for return value from function
omap_init_clocksource_32k(), and fallback to omap_mpu_timer_init()
in case of failure/error from omap_init_clocksource_32k().
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
| -rw-r--r-- | arch/arm/mach-omap1/common.h | 9 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/time.c | 16 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/timer32k.c | 13 |
3 files changed, 18 insertions, 20 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h index af658ad338ec..1f7a4feca358 100644 --- a/arch/arm/mach-omap1/common.h +++ b/arch/arm/mach-omap1/common.h | |||
| @@ -57,7 +57,14 @@ void omap1_init_irq(void); | |||
| 57 | void omap1_restart(char, const char *); | 57 | void omap1_restart(char, const char *); |
| 58 | 58 | ||
| 59 | extern struct sys_timer omap1_timer; | 59 | extern struct sys_timer omap1_timer; |
| 60 | extern bool omap_32k_timer_init(void); | 60 | #ifdef CONFIG_OMAP_32K_TIMER |
| 61 | extern int omap_32k_timer_init(void); | ||
| 62 | #else | ||
| 63 | static inline int __init omap_32k_timer_init(void) | ||
| 64 | { | ||
| 65 | return -ENODEV; | ||
| 66 | } | ||
| 67 | #endif | ||
| 61 | extern void __init omap_init_consistent_dma_size(void); | 68 | extern void __init omap_init_consistent_dma_size(void); |
| 62 | 69 | ||
| 63 | #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ | 70 | #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ |
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index 4d8dd9a1b04c..4062480bfec7 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
| @@ -232,20 +232,6 @@ static inline void omap_mpu_timer_init(void) | |||
| 232 | } | 232 | } |
| 233 | #endif /* CONFIG_OMAP_MPU_TIMER */ | 233 | #endif /* CONFIG_OMAP_MPU_TIMER */ |
| 234 | 234 | ||
| 235 | static inline int omap_32k_timer_usable(void) | ||
| 236 | { | ||
| 237 | int res = false; | ||
| 238 | |||
| 239 | if (cpu_is_omap730() || cpu_is_omap15xx()) | ||
| 240 | return res; | ||
| 241 | |||
| 242 | #ifdef CONFIG_OMAP_32K_TIMER | ||
| 243 | res = omap_32k_timer_init(); | ||
| 244 | #endif | ||
| 245 | |||
| 246 | return res; | ||
| 247 | } | ||
| 248 | |||
| 249 | /* | 235 | /* |
| 250 | * --------------------------------------------------------------------------- | 236 | * --------------------------------------------------------------------------- |
| 251 | * Timer initialization | 237 | * Timer initialization |
| @@ -253,7 +239,7 @@ static inline int omap_32k_timer_usable(void) | |||
| 253 | */ | 239 | */ |
| 254 | static void __init omap1_timer_init(void) | 240 | static void __init omap1_timer_init(void) |
| 255 | { | 241 | { |
| 256 | if (!omap_32k_timer_usable()) | 242 | if (omap_32k_timer_init() != 0) |
| 257 | omap_mpu_timer_init(); | 243 | omap_mpu_timer_init(); |
| 258 | } | 244 | } |
| 259 | 245 | ||
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index 325b9a0aa4a0..e3613a8bcd90 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c | |||
| @@ -182,10 +182,15 @@ static __init void omap_init_32k_timer(void) | |||
| 182 | * Timer initialization | 182 | * Timer initialization |
| 183 | * --------------------------------------------------------------------------- | 183 | * --------------------------------------------------------------------------- |
| 184 | */ | 184 | */ |
| 185 | bool __init omap_32k_timer_init(void) | 185 | int __init omap_32k_timer_init(void) |
| 186 | { | 186 | { |
| 187 | omap_init_clocksource_32k(); | 187 | int ret = -ENODEV; |
| 188 | omap_init_32k_timer(); | ||
| 189 | 188 | ||
| 190 | return true; | 189 | if (cpu_is_omap16xx()) |
| 190 | ret = omap_init_clocksource_32k(); | ||
| 191 | |||
| 192 | if (!ret) | ||
| 193 | omap_init_32k_timer(); | ||
| 194 | |||
| 195 | return ret; | ||
| 191 | } | 196 | } |
