diff options
Diffstat (limited to 'arch/arm/mach-at91rm9200/irq.c')
-rw-r--r-- | arch/arm/mach-at91rm9200/irq.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/arch/arm/mach-at91rm9200/irq.c b/arch/arm/mach-at91rm9200/irq.c index cb62bc83a1dd..70f4d7ac1533 100644 --- a/arch/arm/mach-at91rm9200/irq.c +++ b/arch/arm/mach-at91rm9200/irq.c | |||
@@ -92,10 +92,6 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type) | |||
92 | { | 92 | { |
93 | unsigned int smr, srctype; | 93 | unsigned int smr, srctype; |
94 | 94 | ||
95 | /* change triggering only for FIQ and external IRQ0..IRQ6 */ | ||
96 | if ((irq < AT91_ID_IRQ0) && (irq != AT91_ID_FIQ)) | ||
97 | return -EINVAL; | ||
98 | |||
99 | switch (type) { | 95 | switch (type) { |
100 | case IRQT_HIGH: | 96 | case IRQT_HIGH: |
101 | srctype = AT91_AIC_SRCTYPE_HIGH; | 97 | srctype = AT91_AIC_SRCTYPE_HIGH; |
@@ -104,9 +100,13 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type) | |||
104 | srctype = AT91_AIC_SRCTYPE_RISING; | 100 | srctype = AT91_AIC_SRCTYPE_RISING; |
105 | break; | 101 | break; |
106 | case IRQT_LOW: | 102 | case IRQT_LOW: |
103 | if ((irq > AT91_ID_FIQ) && (irq < AT91_ID_IRQ0)) /* only supported on external interrupts */ | ||
104 | return -EINVAL; | ||
107 | srctype = AT91_AIC_SRCTYPE_LOW; | 105 | srctype = AT91_AIC_SRCTYPE_LOW; |
108 | break; | 106 | break; |
109 | case IRQT_FALLING: | 107 | case IRQT_FALLING: |
108 | if ((irq > AT91_ID_FIQ) && (irq < AT91_ID_IRQ0)) /* only supported on external interrupts */ | ||
109 | return -EINVAL; | ||
110 | srctype = AT91_AIC_SRCTYPE_FALLING; | 110 | srctype = AT91_AIC_SRCTYPE_FALLING; |
111 | break; | 111 | break; |
112 | default: | 112 | default: |
@@ -118,11 +118,47 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type) | |||
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | #ifdef CONFIG_PM | ||
122 | |||
123 | static u32 wakeups; | ||
124 | static u32 backups; | ||
125 | |||
126 | static int at91rm9200_irq_set_wake(unsigned irq, unsigned value) | ||
127 | { | ||
128 | if (unlikely(irq >= 32)) | ||
129 | return -EINVAL; | ||
130 | |||
131 | if (value) | ||
132 | wakeups |= (1 << irq); | ||
133 | else | ||
134 | wakeups &= ~(1 << irq); | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | void at91_irq_suspend(void) | ||
140 | { | ||
141 | backups = at91_sys_read(AT91_AIC_IMR); | ||
142 | at91_sys_write(AT91_AIC_IDCR, backups); | ||
143 | at91_sys_write(AT91_AIC_IECR, wakeups); | ||
144 | } | ||
145 | |||
146 | void at91_irq_resume(void) | ||
147 | { | ||
148 | at91_sys_write(AT91_AIC_IDCR, wakeups); | ||
149 | at91_sys_write(AT91_AIC_IECR, backups); | ||
150 | } | ||
151 | |||
152 | #else | ||
153 | #define at91rm9200_irq_set_wake NULL | ||
154 | #endif | ||
155 | |||
121 | static struct irqchip at91rm9200_irq_chip = { | 156 | static struct irqchip at91rm9200_irq_chip = { |
122 | .ack = at91rm9200_mask_irq, | 157 | .ack = at91rm9200_mask_irq, |
123 | .mask = at91rm9200_mask_irq, | 158 | .mask = at91rm9200_mask_irq, |
124 | .unmask = at91rm9200_unmask_irq, | 159 | .unmask = at91rm9200_unmask_irq, |
125 | .set_type = at91rm9200_irq_type, | 160 | .set_type = at91rm9200_irq_type, |
161 | .set_wake = at91rm9200_irq_set_wake, | ||
126 | }; | 162 | }; |
127 | 163 | ||
128 | /* | 164 | /* |