aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-12-11 19:24:12 -0500
committerBen Dooks <ben-linux@fluff.org>2009-03-08 08:35:36 -0400
commit56b34426888d35b3b6367c216bbfb17b82b4f0ac (patch)
tree435ec8f8856f222a95dd7c83ace6c01806ba8e5b
parent7299a40918e15d5f9b4bc7fcb02163c335d92e43 (diff)
[ARM] S3C: Make IRQ_EINT sleep control common
Move the IRQ_EINT sleep control to be available to all s3c impelmentations. Since s3c_irqext_wake is not large, place it in arch/arm/plat-s3c/pm.c as adding it to a new file would be a waste of compile time. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r--arch/arm/mach-s3c2410/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/irqs.h2
-rw-r--r--arch/arm/plat-s3c/include/plat/pm.h2
-rw-r--r--arch/arm/plat-s3c/pm.c24
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/irq.h2
-rw-r--r--arch/arm/plat-s3c24xx/irq-pm.c23
6 files changed, 30 insertions, 25 deletions
diff --git a/arch/arm/mach-s3c2410/include/mach/irqs.h b/arch/arm/mach-s3c2410/include/mach/irqs.h
index 49efce8cd4a7..0cd89b735771 100644
--- a/arch/arm/mach-s3c2410/include/mach/irqs.h
+++ b/arch/arm/mach-s3c2410/include/mach/irqs.h
@@ -80,7 +80,7 @@
80#define IRQ_EINT22 S3C2410_IRQ(50) 80#define IRQ_EINT22 S3C2410_IRQ(50)
81#define IRQ_EINT23 S3C2410_IRQ(51) 81#define IRQ_EINT23 S3C2410_IRQ(51)
82 82
83 83#define IRQ_EINT_BIT(x) ((x) - (IRQ_EINT4 + 4))
84#define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) 84#define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x)))
85 85
86#define IRQ_LCD_FIFO S3C2410_IRQ(52) 86#define IRQ_LCD_FIFO S3C2410_IRQ(52)
diff --git a/arch/arm/mach-s3c24a0/include/mach/irqs.h b/arch/arm/mach-s3c24a0/include/mach/irqs.h
index ae8c0e359783..83ce2a7a9dae 100644
--- a/arch/arm/mach-s3c24a0/include/mach/irqs.h
+++ b/arch/arm/mach-s3c24a0/include/mach/irqs.h
@@ -70,6 +70,8 @@
70#define IRQ_EINT17 S3C2410_IRQ(49) 70#define IRQ_EINT17 S3C2410_IRQ(49)
71#define IRQ_EINT18 S3C2410_IRQ(50) 71#define IRQ_EINT18 S3C2410_IRQ(50)
72 72
73#define IRQ_EINT_BIT(x) ((x) - IRQ_EINT00)
74
73/* SUB IRQS */ 75/* SUB IRQS */
74#define IRQ_S3CUART_RX0 S3C2410_IRQ(51) /* 67 */ 76#define IRQ_S3CUART_RX0 S3C2410_IRQ(51) /* 67 */
75#define IRQ_S3CUART_TX0 S3C2410_IRQ(52) 77#define IRQ_S3CUART_TX0 S3C2410_IRQ(52)
diff --git a/arch/arm/plat-s3c/include/plat/pm.h b/arch/arm/plat-s3c/include/plat/pm.h
index 42c75e6d2ba5..5e27de955da0 100644
--- a/arch/arm/plat-s3c/include/plat/pm.h
+++ b/arch/arm/plat-s3c/include/plat/pm.h
@@ -77,9 +77,11 @@ extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
77extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); 77extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
78 78
79#ifdef CONFIG_PM 79#ifdef CONFIG_PM
80extern int s3c_irqext_wake(unsigned int irqno, unsigned int state);
80extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); 81extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
81extern int s3c24xx_irq_resume(struct sys_device *dev); 82extern int s3c24xx_irq_resume(struct sys_device *dev);
82#else 83#else
84#define s3c_irqext_wake NULL
83#define s3c24xx_irq_suspend NULL 85#define s3c24xx_irq_suspend NULL
84#define s3c24xx_irq_resume NULL 86#define s3c24xx_irq_resume NULL
85#endif 87#endif
diff --git a/arch/arm/plat-s3c/pm.c b/arch/arm/plat-s3c/pm.c
index fea58bea973d..7c736deff8ae 100644
--- a/arch/arm/plat-s3c/pm.c
+++ b/arch/arm/plat-s3c/pm.c
@@ -27,6 +27,7 @@
27#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <mach/regs-mem.h> 28#include <mach/regs-mem.h>
29#include <mach/regs-irq.h> 29#include <mach/regs-irq.h>
30#include <asm/irq.h>
30 31
31#include <plat/pm.h> 32#include <plat/pm.h>
32#include <plat/pm-core.h> 33#include <plat/pm-core.h>
@@ -100,6 +101,29 @@ static void s3c_pm_save_uart(void) { }
100static void s3c_pm_restore_uart(void) { } 101static void s3c_pm_restore_uart(void) { }
101#endif 102#endif
102 103
104/* The IRQ ext-int code goes here, it is too small to currently bother
105 * with its own file. */
106
107unsigned long s3c_irqwake_intmask = 0xffffffffL;
108unsigned long s3c_irqwake_eintmask = 0xffffffffL;
109
110int s3c_irqext_wake(unsigned int irqno, unsigned int state)
111{
112 unsigned long bit = 1L << IRQ_EINT_BIT(irqno);
113
114 if (!(s3c_irqwake_eintallow & bit))
115 return -ENOENT;
116
117 printk(KERN_INFO "wake %s for irq %d\n",
118 state ? "enabled" : "disabled", irqno);
119
120 if (!state)
121 s3c_irqwake_eintmask |= bit;
122 else
123 s3c_irqwake_eintmask &= ~bit;
124
125 return 0;
126}
103 127
104/* helper functions to save and restore register state */ 128/* helper functions to save and restore register state */
105 129
diff --git a/arch/arm/plat-s3c24xx/include/plat/irq.h b/arch/arm/plat-s3c24xx/include/plat/irq.h
index 97b6884ea0dc..69e1be8bec35 100644
--- a/arch/arm/plat-s3c24xx/include/plat/irq.h
+++ b/arch/arm/plat-s3c24xx/include/plat/irq.h
@@ -108,9 +108,7 @@ s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
108 108
109#ifdef CONFIG_PM 109#ifdef CONFIG_PM
110extern int s3c_irq_wake(unsigned int irqno, unsigned int state); 110extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
111extern int s3c_irqext_wake(unsigned int irqno, unsigned int state);
112#else 111#else
113#define s3c_irqext_wake NULL
114#define s3c_irq_wake NULL 112#define s3c_irq_wake NULL
115#endif 113#endif
116 114
diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
index 86c68804f098..b7acf1a8ecd2 100644
--- a/arch/arm/plat-s3c24xx/irq-pm.c
+++ b/arch/arm/plat-s3c24xx/irq-pm.c
@@ -28,12 +28,9 @@
28*/ 28*/
29 29
30unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL; 30unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL;
31unsigned long s3c_irqwake_intmask = 0xffffffffL;
32unsigned long s3c_irqwake_eintallow = 0x0000fff0L; 31unsigned long s3c_irqwake_eintallow = 0x0000fff0L;
33unsigned long s3c_irqwake_eintmask = 0xffffffffL;
34 32
35int 33int s3c_irq_wake(unsigned int irqno, unsigned int state)
36s3c_irq_wake(unsigned int irqno, unsigned int state)
37{ 34{
38 unsigned long irqbit = 1 << (irqno - IRQ_EINT0); 35 unsigned long irqbit = 1 << (irqno - IRQ_EINT0);
39 36
@@ -51,24 +48,6 @@ s3c_irq_wake(unsigned int irqno, unsigned int state)
51 return 0; 48 return 0;
52} 49}
53 50
54int s3c_irqext_wake(unsigned int irqno, unsigned int state)
55{
56 unsigned long bit = 1L << (irqno - EXTINT_OFF);
57
58 if (!(s3c_irqwake_eintallow & bit))
59 return -ENOENT;
60
61 printk(KERN_INFO "wake %s for irq %d\n",
62 state ? "enabled" : "disabled", irqno);
63
64 if (!state)
65 s3c_irqwake_eintmask |= bit;
66 else
67 s3c_irqwake_eintmask &= ~bit;
68
69 return 0;
70}
71
72static struct sleep_save irq_save[] = { 51static struct sleep_save irq_save[] = {
73 SAVE_ITEM(S3C2410_INTMSK), 52 SAVE_ITEM(S3C2410_INTMSK),
74 SAVE_ITEM(S3C2410_INTSUBMSK), 53 SAVE_ITEM(S3C2410_INTSUBMSK),