aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2014-11-28 09:57:32 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-12-03 11:07:34 -0500
commit1eeec6af0dbb978743de7ffd7224dfe9a695699f (patch)
tree08bc8cc0914f81f84ef993abed859dc45770cab2 /arch/arm/mach-sa1100
parent0ebd465f3713504ad5292cc65f53f95511ff1dcb (diff)
ARM: 8233/1: sa1100: switch to hwirq usage
Switch internally to using hardware irq numbers (hwirq). In case of GPIO interrupts, hwirq is equal to GPIO number. In case of system interrupts, hwirq is equal to interrupt number in the interrupt controller. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/irq.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 14a7633e3cbe..981db9878b27 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -35,20 +35,11 @@ static int GPIO_IRQ_rising_edge;
35static int GPIO_IRQ_falling_edge; 35static int GPIO_IRQ_falling_edge;
36static int GPIO_IRQ_mask = (1 << 11) - 1; 36static int GPIO_IRQ_mask = (1 << 11) - 1;
37 37
38/*
39 * To get the GPIO number from an IRQ number
40 */
41#define GPIO_11_27_IRQ(i) ((i) + 11 - IRQ_GPIO11)
42#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq))
43
44static int sa1100_gpio_type(struct irq_data *d, unsigned int type) 38static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
45{ 39{
46 unsigned int mask; 40 unsigned int mask;
47 41
48 if (d->irq <= IRQ_GPIO10) 42 mask = BIT(d->hwirq);
49 mask = 1 << d->irq;
50 else
51 mask = GPIO11_27_MASK(d->irq);
52 43
53 if (type == IRQ_TYPE_PROBE) { 44 if (type == IRQ_TYPE_PROBE) {
54 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask) 45 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
@@ -76,25 +67,25 @@ static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
76 */ 67 */
77static void sa1100_low_gpio_ack(struct irq_data *d) 68static void sa1100_low_gpio_ack(struct irq_data *d)
78{ 69{
79 GEDR = (1 << d->irq); 70 GEDR = BIT(d->hwirq);
80} 71}
81 72
82static void sa1100_low_gpio_mask(struct irq_data *d) 73static void sa1100_low_gpio_mask(struct irq_data *d)
83{ 74{
84 ICMR &= ~(1 << d->irq); 75 ICMR &= ~BIT(d->hwirq);
85} 76}
86 77
87static void sa1100_low_gpio_unmask(struct irq_data *d) 78static void sa1100_low_gpio_unmask(struct irq_data *d)
88{ 79{
89 ICMR |= 1 << d->irq; 80 ICMR |= BIT(d->hwirq);
90} 81}
91 82
92static int sa1100_low_gpio_wake(struct irq_data *d, unsigned int on) 83static int sa1100_low_gpio_wake(struct irq_data *d, unsigned int on)
93{ 84{
94 if (on) 85 if (on)
95 PWER |= 1 << d->irq; 86 PWER |= BIT(d->hwirq);
96 else 87 else
97 PWER &= ~(1 << d->irq); 88 PWER &= ~BIT(d->hwirq);
98 return 0; 89 return 0;
99} 90}
100 91
@@ -162,14 +153,14 @@ sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)
162 */ 153 */
163static void sa1100_high_gpio_ack(struct irq_data *d) 154static void sa1100_high_gpio_ack(struct irq_data *d)
164{ 155{
165 unsigned int mask = GPIO11_27_MASK(d->irq); 156 unsigned int mask = BIT(d->hwirq);
166 157
167 GEDR = mask; 158 GEDR = mask;
168} 159}
169 160
170static void sa1100_high_gpio_mask(struct irq_data *d) 161static void sa1100_high_gpio_mask(struct irq_data *d)
171{ 162{
172 unsigned int mask = GPIO11_27_MASK(d->irq); 163 unsigned int mask = BIT(d->hwirq);
173 164
174 GPIO_IRQ_mask &= ~mask; 165 GPIO_IRQ_mask &= ~mask;
175 166
@@ -179,7 +170,7 @@ static void sa1100_high_gpio_mask(struct irq_data *d)
179 170
180static void sa1100_high_gpio_unmask(struct irq_data *d) 171static void sa1100_high_gpio_unmask(struct irq_data *d)
181{ 172{
182 unsigned int mask = GPIO11_27_MASK(d->irq); 173 unsigned int mask = BIT(d->hwirq);
183 174
184 GPIO_IRQ_mask |= mask; 175 GPIO_IRQ_mask |= mask;
185 176
@@ -190,9 +181,9 @@ static void sa1100_high_gpio_unmask(struct irq_data *d)
190static int sa1100_high_gpio_wake(struct irq_data *d, unsigned int on) 181static int sa1100_high_gpio_wake(struct irq_data *d, unsigned int on)
191{ 182{
192 if (on) 183 if (on)
193 PWER |= GPIO11_27_MASK(d->irq); 184 PWER |= BIT(d->hwirq);
194 else 185 else
195 PWER &= ~GPIO11_27_MASK(d->irq); 186 PWER &= ~BIT(d->hwirq);
196 return 0; 187 return 0;
197} 188}
198 189
@@ -228,12 +219,12 @@ static struct irq_domain *sa1100_high_gpio_irqdomain;
228 */ 219 */
229static void sa1100_mask_irq(struct irq_data *d) 220static void sa1100_mask_irq(struct irq_data *d)
230{ 221{
231 ICMR &= ~(1 << d->irq); 222 ICMR &= ~BIT(d->hwirq);
232} 223}
233 224
234static void sa1100_unmask_irq(struct irq_data *d) 225static void sa1100_unmask_irq(struct irq_data *d)
235{ 226{
236 ICMR |= (1 << d->irq); 227 ICMR |= BIT(d->hwirq);
237} 228}
238 229
239/* 230/*
@@ -241,7 +232,7 @@ static void sa1100_unmask_irq(struct irq_data *d)
241 */ 232 */
242static int sa1100_set_wake(struct irq_data *d, unsigned int on) 233static int sa1100_set_wake(struct irq_data *d, unsigned int on)
243{ 234{
244 if (d->irq == IRQ_RTCAlrm) { 235 if (BIT(d->hwirq) == IC_RTCAlrm) {
245 if (on) 236 if (on)
246 PWER |= PWER_RTC; 237 PWER |= PWER_RTC;
247 else 238 else