aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTero Kristo <tero.kristo@nokia.com>2009-03-05 09:32:23 -0500
committerKevin Hilman <khilman@deeprootsystems.com>2009-08-05 12:10:53 -0400
commit2466211e5debd205fc550d871fe0ab9b9a6d02ed (patch)
treec4c0c9e44a9a36c3695bf1c13444093263df2a81 /arch
parent4789998a30d845d94a7595076d1392ffd5a9d39e (diff)
OMAP3: Fixed crash bug with serial + suspend
It was possible for an unhandled interrupt to occur if there was incoming serial traffic during wakeup from suspend. This was caused by the code in arch-arm/mach-omap2/serial.c keeping interrupt enabled all the time, but not acking its interrupts. Applies on top of PM branch. Use the PM begin/end hooks to ensure that the "serial idle" interrupts are disabled during the suspend path. Also, since begin/end hooks are now used, use the suspend_state that is passed in the begin hook instead of the enter hook as per the platform_suspend_ops docs. Signed-off-by: Tero Kristo <tero.kristo@nokia.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/pm34xx.c23
-rw-r--r--arch/arm/mach-omap2/serial.c14
-rw-r--r--arch/arm/plat-omap/include/mach/serial.h1
3 files changed, 36 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 528f725722a2..b07efb26de18 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -296,6 +296,8 @@ out:
296} 296}
297 297
298#ifdef CONFIG_SUSPEND 298#ifdef CONFIG_SUSPEND
299static suspend_state_t suspend_state;
300
299static int omap3_pm_prepare(void) 301static int omap3_pm_prepare(void)
300{ 302{
301 disable_hlt(); 303 disable_hlt();
@@ -342,11 +344,11 @@ restore:
342 return ret; 344 return ret;
343} 345}
344 346
345static int omap3_pm_enter(suspend_state_t state) 347static int omap3_pm_enter(suspend_state_t unused)
346{ 348{
347 int ret = 0; 349 int ret = 0;
348 350
349 switch (state) { 351 switch (suspend_state) {
350 case PM_SUSPEND_STANDBY: 352 case PM_SUSPEND_STANDBY:
351 case PM_SUSPEND_MEM: 353 case PM_SUSPEND_MEM:
352 ret = omap3_pm_suspend(); 354 ret = omap3_pm_suspend();
@@ -363,7 +365,24 @@ static void omap3_pm_finish(void)
363 enable_hlt(); 365 enable_hlt();
364} 366}
365 367
368/* Hooks to enable / disable UART interrupts during suspend */
369static int omap3_pm_begin(suspend_state_t state)
370{
371 suspend_state = state;
372 omap_uart_enable_irqs(0);
373 return 0;
374}
375
376static void omap3_pm_end(void)
377{
378 suspend_state = PM_SUSPEND_ON;
379 omap_uart_enable_irqs(1);
380 return;
381}
382
366static struct platform_suspend_ops omap_pm_ops = { 383static struct platform_suspend_ops omap_pm_ops = {
384 .begin = omap3_pm_begin,
385 .end = omap3_pm_end,
367 .prepare = omap3_pm_prepare, 386 .prepare = omap3_pm_prepare,
368 .enter = omap3_pm_enter, 387 .enter = omap3_pm_enter,
369 .finish = omap3_pm_finish, 388 .finish = omap3_pm_finish,
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index c82ec95cd79e..5352d05b42d6 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -435,6 +435,20 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
435 WARN_ON(ret); 435 WARN_ON(ret);
436} 436}
437 437
438void omap_uart_enable_irqs(int enable)
439{
440 int ret;
441 struct omap_uart_state *uart;
442
443 list_for_each_entry(uart, &uart_list, node) {
444 if (enable)
445 ret = request_irq(uart->p->irq, omap_uart_interrupt,
446 IRQF_SHARED, "serial idle", (void *)uart);
447 else
448 free_irq(uart->p->irq, (void *)uart);
449 }
450}
451
438static ssize_t sleep_timeout_show(struct kobject *kobj, 452static ssize_t sleep_timeout_show(struct kobject *kobj,
439 struct kobj_attribute *attr, 453 struct kobj_attribute *attr,
440 char *buf) 454 char *buf)
diff --git a/arch/arm/plat-omap/include/mach/serial.h b/arch/arm/plat-omap/include/mach/serial.h
index 13abd02d1527..def0529c75eb 100644
--- a/arch/arm/plat-omap/include/mach/serial.h
+++ b/arch/arm/plat-omap/include/mach/serial.h
@@ -59,6 +59,7 @@ extern void omap_uart_check_wakeup(void);
59extern void omap_uart_prepare_suspend(void); 59extern void omap_uart_prepare_suspend(void);
60extern void omap_uart_prepare_idle(int num); 60extern void omap_uart_prepare_idle(int num);
61extern void omap_uart_resume_idle(int num); 61extern void omap_uart_resume_idle(int num);
62extern void omap_uart_enable_irqs(int enable);
62#endif 63#endif
63 64
64#endif 65#endif