[x86] add rootwait option to the kernel command line (#6209)
[openwrt.git] / target / linux / s3c24xx / patches-2.6.31 / 002-s3c-pm.patch
1 diff --git a/arch/arm/plat-s3c/pm.c b/arch/arm/plat-s3c/pm.c
2 index 8d97db2..a7667d5 100644
3 --- a/arch/arm/plat-s3c/pm.c
4 +++ b/arch/arm/plat-s3c/pm.c
5 @@ -301,11 +301,14 @@ static int s3c_pm_enter(suspend_state_t state)
6  
7         s3c_pm_arch_stop_clocks();
8  
9 -       /* s3c_cpu_save will also act as our return point from when
10 -        * we resume as it saves its own register state and restores it
11 -        * during the resume.  */
12 +       /* s3c2410_cpu_save will also act as our return point from when
13 +        * we resume as it saves its own register state, so use the return
14 +        * code to differentiate return from save and return from sleep */
15  
16 -       s3c_cpu_save(regs_save);
17 +       if (s3c_cpu_save(regs_save) == 0) {
18 +               flush_cache_all();
19 +               pm_cpu_sleep();
20 +       }
21  
22         /* restore the cpu state using the kernel's cpu init code. */
23  
24 diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
25 index b7acf1a..925514e 100644
26 --- a/arch/arm/plat-s3c24xx/irq-pm.c
27 +++ b/arch/arm/plat-s3c24xx/irq-pm.c
28 @@ -15,6 +15,7 @@
29  #include <linux/module.h>
30  #include <linux/interrupt.h>
31  #include <linux/sysdev.h>
32 +#include <linux/irq.h>
33  
34  #include <plat/cpu.h>
35  #include <plat/pm.h>
36 @@ -80,7 +81,9 @@ int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
37  
38  int s3c24xx_irq_resume(struct sys_device *dev)
39  {
40 -       unsigned int i;
41 +       unsigned int i, irq;
42 +       unsigned long eintpnd;
43 +       struct irq_desc *desc;
44  
45         for (i = 0; i < ARRAY_SIZE(save_extint); i++)
46                 __raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
47 @@ -91,5 +94,25 @@ int s3c24xx_irq_resume(struct sys_device *dev)
48         s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
49         __raw_writel(save_eintmask, S3C24XX_EINTMASK);
50  
51 +       /*
52 +        * ACK those interrupts which are now masked and pending.
53 +        * Level interrupts if not ACKed here, create an interrupt storm
54 +        * because they are not handled at all.
55 +        */
56 +
57 +       eintpnd = __raw_readl(S3C24XX_EINTPEND);
58 +
59 +       eintpnd &= save_eintmask;
60 +       eintpnd &= ~0xff;       /* ignore lower irqs */
61 +
62 +       while (eintpnd) {
63 +               irq = __ffs(eintpnd);
64 +               eintpnd &= ~(1 << irq);
65 +
66 +               irq += (IRQ_EINT4 - 4);
67 +               desc = irq_to_desc(irq);
68 +               desc->chip->ack(irq);
69 +       }
70 +
71         return 0;
72  }