aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 19:00:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 19:00:54 -0500
commitdca1d9f6d7ae428c193f32bd3e9a4ca13176648b (patch)
tree02de8c3503c1c811754423d2fa3f3b4978044f6e /arch/arm/common
parent9ff99339447de403a46be5e3f23d0c794d540b06 (diff)
parent91e013827c0bcbb187ecf02213c5446b6f62d445 (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (370 commits) ARM: S3C2443: Add set_rate and round_rate calls for armdiv clock ARM: S3C2443: Remove #if 0 for clk_mpll ARM: S3C2443: Update notes on MPLLREF clock ARM: S3C2443: Further clksrc-clk conversions ARM: S3C2443: Change to using plat-samsung clksrc-clk implementation USB: Fix s3c-hsotg build following Samsung platform header moves ARM: S3C64XX: Reintroduce unconditional build of audio device ARM: 5961/1: ux500: fix CLKRST addresses ARM: 5977/1: arm: Enable backtrace printing on oops when PC is corrupted ASoC: Fix S3C64xx IIS driver for Samsung header reorg ARM: S3C2440: Fix plat-s3c24xx move of s3c2440/s3c2442 support [ARM] pxa: fix typo in mxm8x10.h [ARM] pxa/raumfeld: set GPIO drive bits for LED pins [ARM] pxa/zeus: Add support for mcp2515 CAN bus [ARM] pxa/zeus: Add support for onboard max6369 watchdog [ARM] pxa/zeus: Add Eurotech as the manufacturer [ARM] pxa/zeus: Correct the USB host initialisation flags [ARM] pxa/zeus: Allow usage of 8250-compatible UART in uncompress [ARM] pxa: refactor uncompress.h for non-PXA uarts [ARM] mmp2: fix incorrect calling of chip->mask_ack() for 2nd level cascaded IRQs ...
Diffstat (limited to 'arch/arm/common')
-rw-r--r--arch/arm/common/locomo.c362
-rw-r--r--arch/arm/common/sa1111.c112
-rw-r--r--arch/arm/common/scoop.c2
3 files changed, 120 insertions, 356 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index bd36c778c819..90ae00b631c2 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -32,6 +32,12 @@
32 32
33#include <asm/hardware/locomo.h> 33#include <asm/hardware/locomo.h>
34 34
35/* LoCoMo Interrupts */
36#define IRQ_LOCOMO_KEY (0)
37#define IRQ_LOCOMO_GPIO (1)
38#define IRQ_LOCOMO_LT (2)
39#define IRQ_LOCOMO_SPI (3)
40
35/* M62332 output channel selection */ 41/* M62332 output channel selection */
36#define M62332_EVR_CH 1 /* M62332 volume channel number */ 42#define M62332_EVR_CH 1 /* M62332 volume channel number */
37 /* 0 : CH.1 , 1 : CH. 2 */ 43 /* 0 : CH.1 , 1 : CH. 2 */
@@ -58,6 +64,7 @@ struct locomo {
58 struct device *dev; 64 struct device *dev;
59 unsigned long phys; 65 unsigned long phys;
60 unsigned int irq; 66 unsigned int irq;
67 int irq_base;
61 spinlock_t lock; 68 spinlock_t lock;
62 void __iomem *base; 69 void __iomem *base;
63#ifdef CONFIG_PM 70#ifdef CONFIG_PM
@@ -81,9 +88,7 @@ struct locomo_dev_info {
81static struct locomo_dev_info locomo_devices[] = { 88static struct locomo_dev_info locomo_devices[] = {
82 { 89 {
83 .devid = LOCOMO_DEVID_KEYBOARD, 90 .devid = LOCOMO_DEVID_KEYBOARD,
84 .irq = { 91 .irq = { IRQ_LOCOMO_KEY },
85 IRQ_LOCOMO_KEY,
86 },
87 .name = "locomo-keyboard", 92 .name = "locomo-keyboard",
88 .offset = LOCOMO_KEYBOARD, 93 .offset = LOCOMO_KEYBOARD,
89 .length = 16, 94 .length = 16,
@@ -133,53 +138,20 @@ static struct locomo_dev_info locomo_devices[] = {
133 }, 138 },
134}; 139};
135 140
136
137/** LoCoMo interrupt handling stuff.
138 * NOTE: LoCoMo has a 1 to many mapping on all of its IRQs.
139 * that is, there is only one real hardware interrupt
140 * we determine which interrupt it is by reading some IO memory.
141 * We have two levels of expansion, first in the handler for the
142 * hardware interrupt we generate an interrupt
143 * IRQ_LOCOMO_*_BASE and those handlers generate more interrupts
144 *
145 * hardware irq reads LOCOMO_ICR & 0x0f00
146 * IRQ_LOCOMO_KEY_BASE
147 * IRQ_LOCOMO_GPIO_BASE
148 * IRQ_LOCOMO_LT_BASE
149 * IRQ_LOCOMO_SPI_BASE
150 * IRQ_LOCOMO_KEY_BASE reads LOCOMO_KIC & 0x0001
151 * IRQ_LOCOMO_KEY
152 * IRQ_LOCOMO_GPIO_BASE reads LOCOMO_GIR & LOCOMO_GPD & 0xffff
153 * IRQ_LOCOMO_GPIO[0-15]
154 * IRQ_LOCOMO_LT_BASE reads LOCOMO_LTINT & 0x0001
155 * IRQ_LOCOMO_LT
156 * IRQ_LOCOMO_SPI_BASE reads LOCOMO_SPIIR & 0x000F
157 * IRQ_LOCOMO_SPI_RFR
158 * IRQ_LOCOMO_SPI_RFW
159 * IRQ_LOCOMO_SPI_OVRN
160 * IRQ_LOCOMO_SPI_TEND
161 */
162
163#define LOCOMO_IRQ_START (IRQ_LOCOMO_KEY_BASE)
164#define LOCOMO_IRQ_KEY_START (IRQ_LOCOMO_KEY)
165#define LOCOMO_IRQ_GPIO_START (IRQ_LOCOMO_GPIO0)
166#define LOCOMO_IRQ_LT_START (IRQ_LOCOMO_LT)
167#define LOCOMO_IRQ_SPI_START (IRQ_LOCOMO_SPI_RFR)
168
169static void locomo_handler(unsigned int irq, struct irq_desc *desc) 141static void locomo_handler(unsigned int irq, struct irq_desc *desc)
170{ 142{
143 struct locomo *lchip = get_irq_chip_data(irq);
171 int req, i; 144 int req, i;
172 void __iomem *mapbase = get_irq_chip_data(irq);
173 145
174 /* Acknowledge the parent IRQ */ 146 /* Acknowledge the parent IRQ */
175 desc->chip->ack(irq); 147 desc->chip->ack(irq);
176 148
177 /* check why this interrupt was generated */ 149 /* check why this interrupt was generated */
178 req = locomo_readl(mapbase + LOCOMO_ICR) & 0x0f00; 150 req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
179 151
180 if (req) { 152 if (req) {
181 /* generate the next interrupt(s) */ 153 /* generate the next interrupt(s) */
182 irq = LOCOMO_IRQ_START; 154 irq = lchip->irq_base;
183 for (i = 0; i <= 3; i++, irq++) { 155 for (i = 0; i <= 3; i++, irq++) {
184 if (req & (0x0100 << i)) { 156 if (req & (0x0100 << i)) {
185 generic_handle_irq(irq); 157 generic_handle_irq(irq);
@@ -195,20 +167,20 @@ static void locomo_ack_irq(unsigned int irq)
195 167
196static void locomo_mask_irq(unsigned int irq) 168static void locomo_mask_irq(unsigned int irq)
197{ 169{
198 void __iomem *mapbase = get_irq_chip_data(irq); 170 struct locomo *lchip = get_irq_chip_data(irq);
199 unsigned int r; 171 unsigned int r;
200 r = locomo_readl(mapbase + LOCOMO_ICR); 172 r = locomo_readl(lchip->base + LOCOMO_ICR);
201 r &= ~(0x0010 << (irq - LOCOMO_IRQ_START)); 173 r &= ~(0x0010 << (irq - lchip->irq_base));
202 locomo_writel(r, mapbase + LOCOMO_ICR); 174 locomo_writel(r, lchip->base + LOCOMO_ICR);
203} 175}
204 176
205static void locomo_unmask_irq(unsigned int irq) 177static void locomo_unmask_irq(unsigned int irq)
206{ 178{
207 void __iomem *mapbase = get_irq_chip_data(irq); 179 struct locomo *lchip = get_irq_chip_data(irq);
208 unsigned int r; 180 unsigned int r;
209 r = locomo_readl(mapbase + LOCOMO_ICR); 181 r = locomo_readl(lchip->base + LOCOMO_ICR);
210 r |= (0x0010 << (irq - LOCOMO_IRQ_START)); 182 r |= (0x0010 << (irq - lchip->irq_base));
211 locomo_writel(r, mapbase + LOCOMO_ICR); 183 locomo_writel(r, lchip->base + LOCOMO_ICR);
212} 184}
213 185
214static struct irq_chip locomo_chip = { 186static struct irq_chip locomo_chip = {
@@ -218,297 +190,22 @@ static struct irq_chip locomo_chip = {
218 .unmask = locomo_unmask_irq, 190 .unmask = locomo_unmask_irq,
219}; 191};
220 192
221static void locomo_key_handler(unsigned int irq, struct irq_desc *desc)
222{
223 void __iomem *mapbase = get_irq_chip_data(irq);
224
225 if (locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC) & 0x0001) {
226 generic_handle_irq(LOCOMO_IRQ_KEY_START);
227 }
228}
229
230static void locomo_key_ack_irq(unsigned int irq)
231{
232 void __iomem *mapbase = get_irq_chip_data(irq);
233 unsigned int r;
234 r = locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
235 r &= ~(0x0100 << (irq - LOCOMO_IRQ_KEY_START));
236 locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
237}
238
239static void locomo_key_mask_irq(unsigned int irq)
240{
241 void __iomem *mapbase = get_irq_chip_data(irq);
242 unsigned int r;
243 r = locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
244 r &= ~(0x0010 << (irq - LOCOMO_IRQ_KEY_START));
245 locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
246}
247
248static void locomo_key_unmask_irq(unsigned int irq)
249{
250 void __iomem *mapbase = get_irq_chip_data(irq);
251 unsigned int r;
252 r = locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
253 r |= (0x0010 << (irq - LOCOMO_IRQ_KEY_START));
254 locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
255}
256
257static struct irq_chip locomo_key_chip = {
258 .name = "LOCOMO-key",
259 .ack = locomo_key_ack_irq,
260 .mask = locomo_key_mask_irq,
261 .unmask = locomo_key_unmask_irq,
262};
263
264static void locomo_gpio_handler(unsigned int irq, struct irq_desc *desc)
265{
266 int req, i;
267 void __iomem *mapbase = get_irq_chip_data(irq);
268
269 req = locomo_readl(mapbase + LOCOMO_GIR) &
270 locomo_readl(mapbase + LOCOMO_GPD) &
271 0xffff;
272
273 if (req) {
274 irq = LOCOMO_IRQ_GPIO_START;
275 for (i = 0; i <= 15; i++, irq++) {
276 if (req & (0x0001 << i)) {
277 generic_handle_irq(irq);
278 }
279 }
280 }
281}
282
283static void locomo_gpio_ack_irq(unsigned int irq)
284{
285 void __iomem *mapbase = get_irq_chip_data(irq);
286 unsigned int r;
287 r = locomo_readl(mapbase + LOCOMO_GWE);
288 r |= (0x0001 << (irq - LOCOMO_IRQ_GPIO_START));
289 locomo_writel(r, mapbase + LOCOMO_GWE);
290
291 r = locomo_readl(mapbase + LOCOMO_GIS);
292 r &= ~(0x0001 << (irq - LOCOMO_IRQ_GPIO_START));
293 locomo_writel(r, mapbase + LOCOMO_GIS);
294
295 r = locomo_readl(mapbase + LOCOMO_GWE);
296 r &= ~(0x0001 << (irq - LOCOMO_IRQ_GPIO_START));
297 locomo_writel(r, mapbase + LOCOMO_GWE);
298}
299
300static void locomo_gpio_mask_irq(unsigned int irq)
301{
302 void __iomem *mapbase = get_irq_chip_data(irq);
303 unsigned int r;
304 r = locomo_readl(mapbase + LOCOMO_GIE);
305 r &= ~(0x0001 << (irq - LOCOMO_IRQ_GPIO_START));
306 locomo_writel(r, mapbase + LOCOMO_GIE);
307}
308
309static void locomo_gpio_unmask_irq(unsigned int irq)
310{
311 void __iomem *mapbase = get_irq_chip_data(irq);
312 unsigned int r;
313 r = locomo_readl(mapbase + LOCOMO_GIE);
314 r |= (0x0001 << (irq - LOCOMO_IRQ_GPIO_START));
315 locomo_writel(r, mapbase + LOCOMO_GIE);
316}
317
318static int GPIO_IRQ_rising_edge;
319static int GPIO_IRQ_falling_edge;
320
321static int locomo_gpio_type(unsigned int irq, unsigned int type)
322{
323 unsigned int mask;
324 void __iomem *mapbase = get_irq_chip_data(irq);
325
326 mask = 1 << (irq - LOCOMO_IRQ_GPIO_START);
327
328 if (type == IRQ_TYPE_PROBE) {
329 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
330 return 0;
331 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
332 }
333
334 if (type & IRQ_TYPE_EDGE_RISING)
335 GPIO_IRQ_rising_edge |= mask;
336 else
337 GPIO_IRQ_rising_edge &= ~mask;
338 if (type & IRQ_TYPE_EDGE_FALLING)
339 GPIO_IRQ_falling_edge |= mask;
340 else
341 GPIO_IRQ_falling_edge &= ~mask;
342 locomo_writel(GPIO_IRQ_rising_edge, mapbase + LOCOMO_GRIE);
343 locomo_writel(GPIO_IRQ_falling_edge, mapbase + LOCOMO_GFIE);
344
345 return 0;
346}
347
348static struct irq_chip locomo_gpio_chip = {
349 .name = "LOCOMO-gpio",
350 .ack = locomo_gpio_ack_irq,
351 .mask = locomo_gpio_mask_irq,
352 .unmask = locomo_gpio_unmask_irq,
353 .set_type = locomo_gpio_type,
354};
355
356static void locomo_lt_handler(unsigned int irq, struct irq_desc *desc)
357{
358 void __iomem *mapbase = get_irq_chip_data(irq);
359
360 if (locomo_readl(mapbase + LOCOMO_LTINT) & 0x0001) {
361 generic_handle_irq(LOCOMO_IRQ_LT_START);
362 }
363}
364
365static void locomo_lt_ack_irq(unsigned int irq)
366{
367 void __iomem *mapbase = get_irq_chip_data(irq);
368 unsigned int r;
369 r = locomo_readl(mapbase + LOCOMO_LTINT);
370 r &= ~(0x0100 << (irq - LOCOMO_IRQ_LT_START));
371 locomo_writel(r, mapbase + LOCOMO_LTINT);
372}
373
374static void locomo_lt_mask_irq(unsigned int irq)
375{
376 void __iomem *mapbase = get_irq_chip_data(irq);
377 unsigned int r;
378 r = locomo_readl(mapbase + LOCOMO_LTINT);
379 r &= ~(0x0010 << (irq - LOCOMO_IRQ_LT_START));
380 locomo_writel(r, mapbase + LOCOMO_LTINT);
381}
382
383static void locomo_lt_unmask_irq(unsigned int irq)
384{
385 void __iomem *mapbase = get_irq_chip_data(irq);
386 unsigned int r;
387 r = locomo_readl(mapbase + LOCOMO_LTINT);
388 r |= (0x0010 << (irq - LOCOMO_IRQ_LT_START));
389 locomo_writel(r, mapbase + LOCOMO_LTINT);
390}
391
392static struct irq_chip locomo_lt_chip = {
393 .name = "LOCOMO-lt",
394 .ack = locomo_lt_ack_irq,
395 .mask = locomo_lt_mask_irq,
396 .unmask = locomo_lt_unmask_irq,
397};
398
399static void locomo_spi_handler(unsigned int irq, struct irq_desc *desc)
400{
401 int req, i;
402 void __iomem *mapbase = get_irq_chip_data(irq);
403
404 req = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIR) & 0x000F;
405 if (req) {
406 irq = LOCOMO_IRQ_SPI_START;
407
408 for (i = 0; i <= 3; i++, irq++) {
409 if (req & (0x0001 << i)) {
410 generic_handle_irq(irq);
411 }
412 }
413 }
414}
415
416static void locomo_spi_ack_irq(unsigned int irq)
417{
418 void __iomem *mapbase = get_irq_chip_data(irq);
419 unsigned int r;
420 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
421 r |= (0x0001 << (irq - LOCOMO_IRQ_SPI_START));
422 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
423
424 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIS);
425 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START));
426 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIIS);
427
428 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
429 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START));
430 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
431}
432
433static void locomo_spi_mask_irq(unsigned int irq)
434{
435 void __iomem *mapbase = get_irq_chip_data(irq);
436 unsigned int r;
437 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
438 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START));
439 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
440}
441
442static void locomo_spi_unmask_irq(unsigned int irq)
443{
444 void __iomem *mapbase = get_irq_chip_data(irq);
445 unsigned int r;
446 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
447 r |= (0x0001 << (irq - LOCOMO_IRQ_SPI_START));
448 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
449}
450
451static struct irq_chip locomo_spi_chip = {
452 .name = "LOCOMO-spi",
453 .ack = locomo_spi_ack_irq,
454 .mask = locomo_spi_mask_irq,
455 .unmask = locomo_spi_unmask_irq,
456};
457
458static void locomo_setup_irq(struct locomo *lchip) 193static void locomo_setup_irq(struct locomo *lchip)
459{ 194{
460 int irq; 195 int irq = lchip->irq_base;
461 void __iomem *irqbase = lchip->base;
462 196
463 /* 197 /*
464 * Install handler for IRQ_LOCOMO_HW. 198 * Install handler for IRQ_LOCOMO_HW.
465 */ 199 */
466 set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); 200 set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);
467 set_irq_chip_data(lchip->irq, irqbase); 201 set_irq_chip_data(lchip->irq, lchip);
468 set_irq_chained_handler(lchip->irq, locomo_handler); 202 set_irq_chained_handler(lchip->irq, locomo_handler);
469 203
470 /* Install handlers for IRQ_LOCOMO_*_BASE */ 204 /* Install handlers for IRQ_LOCOMO_* */
471 set_irq_chip(IRQ_LOCOMO_KEY_BASE, &locomo_chip); 205 for ( ; irq <= lchip->irq_base + 3; irq++) {
472 set_irq_chip_data(IRQ_LOCOMO_KEY_BASE, irqbase); 206 set_irq_chip(irq, &locomo_chip);
473 set_irq_chained_handler(IRQ_LOCOMO_KEY_BASE, locomo_key_handler); 207 set_irq_chip_data(irq, lchip);
474 208 set_irq_handler(irq, handle_level_irq);
475 set_irq_chip(IRQ_LOCOMO_GPIO_BASE, &locomo_chip);
476 set_irq_chip_data(IRQ_LOCOMO_GPIO_BASE, irqbase);
477 set_irq_chained_handler(IRQ_LOCOMO_GPIO_BASE, locomo_gpio_handler);
478
479 set_irq_chip(IRQ_LOCOMO_LT_BASE, &locomo_chip);
480 set_irq_chip_data(IRQ_LOCOMO_LT_BASE, irqbase);
481 set_irq_chained_handler(IRQ_LOCOMO_LT_BASE, locomo_lt_handler);
482
483 set_irq_chip(IRQ_LOCOMO_SPI_BASE, &locomo_chip);
484 set_irq_chip_data(IRQ_LOCOMO_SPI_BASE, irqbase);
485 set_irq_chained_handler(IRQ_LOCOMO_SPI_BASE, locomo_spi_handler);
486
487 /* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */
488 set_irq_chip(LOCOMO_IRQ_KEY_START, &locomo_key_chip);
489 set_irq_chip_data(LOCOMO_IRQ_KEY_START, irqbase);
490 set_irq_handler(LOCOMO_IRQ_KEY_START, handle_edge_irq);
491 set_irq_flags(LOCOMO_IRQ_KEY_START, IRQF_VALID | IRQF_PROBE);
492
493 /* install handlers for IRQ_LOCOMO_GPIO_BASE generated interrupts */
494 for (irq = LOCOMO_IRQ_GPIO_START; irq < LOCOMO_IRQ_GPIO_START + 16; irq++) {
495 set_irq_chip(irq, &locomo_gpio_chip);
496 set_irq_chip_data(irq, irqbase);
497 set_irq_handler(irq, handle_edge_irq);
498 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
499 }
500
501 /* install handlers for IRQ_LOCOMO_LT_BASE generated interrupts */
502 set_irq_chip(LOCOMO_IRQ_LT_START, &locomo_lt_chip);
503 set_irq_chip_data(LOCOMO_IRQ_LT_START, irqbase);
504 set_irq_handler(LOCOMO_IRQ_LT_START, handle_edge_irq);
505 set_irq_flags(LOCOMO_IRQ_LT_START, IRQF_VALID | IRQF_PROBE);
506
507 /* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */
508 for (irq = LOCOMO_IRQ_SPI_START; irq < LOCOMO_IRQ_SPI_START + 4; irq++) {
509 set_irq_chip(irq, &locomo_spi_chip);
510 set_irq_chip_data(irq, irqbase);
511 set_irq_handler(irq, handle_edge_irq);
512 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 209 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
513 } 210 }
514} 211}
@@ -555,7 +252,8 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
555 dev->mapbase = 0; 252 dev->mapbase = 0;
556 dev->length = info->length; 253 dev->length = info->length;
557 254
558 memmove(dev->irq, info->irq, sizeof(dev->irq)); 255 dev->irq[0] = (lchip->irq_base == NO_IRQ) ?
256 NO_IRQ : lchip->irq_base + info->irq[0];
559 257
560 ret = device_register(&dev->dev); 258 ret = device_register(&dev->dev);
561 if (ret) { 259 if (ret) {
@@ -672,6 +370,7 @@ static int locomo_resume(struct platform_device *dev)
672static int 370static int
673__locomo_probe(struct device *me, struct resource *mem, int irq) 371__locomo_probe(struct device *me, struct resource *mem, int irq)
674{ 372{
373 struct locomo_platform_data *pdata = me->platform_data;
675 struct locomo *lchip; 374 struct locomo *lchip;
676 unsigned long r; 375 unsigned long r;
677 int i, ret = -ENODEV; 376 int i, ret = -ENODEV;
@@ -687,6 +386,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
687 386
688 lchip->phys = mem->start; 387 lchip->phys = mem->start;
689 lchip->irq = irq; 388 lchip->irq = irq;
389 lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;
690 390
691 /* 391 /*
692 * Map the whole region. This also maps the 392 * Map the whole region. This also maps the
@@ -753,7 +453,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
753 * The interrupt controller must be initialised before any 453 * The interrupt controller must be initialised before any
754 * other device to ensure that the interrupts are available. 454 * other device to ensure that the interrupts are available.
755 */ 455 */
756 if (lchip->irq != NO_IRQ) 456 if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)
757 locomo_setup_irq(lchip); 457 locomo_setup_irq(lchip);
758 458
759 for (i = 0; i < ARRAY_SIZE(locomo_devices); i++) 459 for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 8ba7044c554d..a52a27c1d9be 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -35,6 +35,58 @@
35 35
36#include <asm/hardware/sa1111.h> 36#include <asm/hardware/sa1111.h>
37 37
38/* SA1111 IRQs */
39#define IRQ_GPAIN0 (0)
40#define IRQ_GPAIN1 (1)
41#define IRQ_GPAIN2 (2)
42#define IRQ_GPAIN3 (3)
43#define IRQ_GPBIN0 (4)
44#define IRQ_GPBIN1 (5)
45#define IRQ_GPBIN2 (6)
46#define IRQ_GPBIN3 (7)
47#define IRQ_GPBIN4 (8)
48#define IRQ_GPBIN5 (9)
49#define IRQ_GPCIN0 (10)
50#define IRQ_GPCIN1 (11)
51#define IRQ_GPCIN2 (12)
52#define IRQ_GPCIN3 (13)
53#define IRQ_GPCIN4 (14)
54#define IRQ_GPCIN5 (15)
55#define IRQ_GPCIN6 (16)
56#define IRQ_GPCIN7 (17)
57#define IRQ_MSTXINT (18)
58#define IRQ_MSRXINT (19)
59#define IRQ_MSSTOPERRINT (20)
60#define IRQ_TPTXINT (21)
61#define IRQ_TPRXINT (22)
62#define IRQ_TPSTOPERRINT (23)
63#define SSPXMTINT (24)
64#define SSPRCVINT (25)
65#define SSPROR (26)
66#define AUDXMTDMADONEA (32)
67#define AUDRCVDMADONEA (33)
68#define AUDXMTDMADONEB (34)
69#define AUDRCVDMADONEB (35)
70#define AUDTFSR (36)
71#define AUDRFSR (37)
72#define AUDTUR (38)
73#define AUDROR (39)
74#define AUDDTS (40)
75#define AUDRDD (41)
76#define AUDSTO (42)
77#define IRQ_USBPWR (43)
78#define IRQ_HCIM (44)
79#define IRQ_HCIBUFFACC (45)
80#define IRQ_HCIRMTWKP (46)
81#define IRQ_NHCIMFCIR (47)
82#define IRQ_USB_PORT_RESUME (48)
83#define IRQ_S0_READY_NINT (49)
84#define IRQ_S1_READY_NINT (50)
85#define IRQ_S0_CD_VALID (51)
86#define IRQ_S1_CD_VALID (52)
87#define IRQ_S0_BVD1_STSCHG (53)
88#define IRQ_S1_BVD1_STSCHG (54)
89
38extern void __init sa1110_mb_enable(void); 90extern void __init sa1110_mb_enable(void);
39 91
40/* 92/*
@@ -49,6 +101,7 @@ struct sa1111 {
49 struct clk *clk; 101 struct clk *clk;
50 unsigned long phys; 102 unsigned long phys;
51 int irq; 103 int irq;
104 int irq_base; /* base for cascaded on-chip IRQs */
52 spinlock_t lock; 105 spinlock_t lock;
53 void __iomem *base; 106 void __iomem *base;
54#ifdef CONFIG_PM 107#ifdef CONFIG_PM
@@ -152,36 +205,37 @@ static void
152sa1111_irq_handler(unsigned int irq, struct irq_desc *desc) 205sa1111_irq_handler(unsigned int irq, struct irq_desc *desc)
153{ 206{
154 unsigned int stat0, stat1, i; 207 unsigned int stat0, stat1, i;
155 void __iomem *base = get_irq_data(irq); 208 struct sa1111 *sachip = get_irq_data(irq);
209 void __iomem *mapbase = sachip->base + SA1111_INTC;
156 210
157 stat0 = sa1111_readl(base + SA1111_INTSTATCLR0); 211 stat0 = sa1111_readl(mapbase + SA1111_INTSTATCLR0);
158 stat1 = sa1111_readl(base + SA1111_INTSTATCLR1); 212 stat1 = sa1111_readl(mapbase + SA1111_INTSTATCLR1);
159 213
160 sa1111_writel(stat0, base + SA1111_INTSTATCLR0); 214 sa1111_writel(stat0, mapbase + SA1111_INTSTATCLR0);
161 215
162 desc->chip->ack(irq); 216 desc->chip->ack(irq);
163 217
164 sa1111_writel(stat1, base + SA1111_INTSTATCLR1); 218 sa1111_writel(stat1, mapbase + SA1111_INTSTATCLR1);
165 219
166 if (stat0 == 0 && stat1 == 0) { 220 if (stat0 == 0 && stat1 == 0) {
167 do_bad_IRQ(irq, desc); 221 do_bad_IRQ(irq, desc);
168 return; 222 return;
169 } 223 }
170 224
171 for (i = IRQ_SA1111_START; stat0; i++, stat0 >>= 1) 225 for (i = 0; stat0; i++, stat0 >>= 1)
172 if (stat0 & 1) 226 if (stat0 & 1)
173 handle_edge_irq(i, irq_desc + i); 227 generic_handle_irq(i + sachip->irq_base);
174 228
175 for (i = IRQ_SA1111_START + 32; stat1; i++, stat1 >>= 1) 229 for (i = 32; stat1; i++, stat1 >>= 1)
176 if (stat1 & 1) 230 if (stat1 & 1)
177 handle_edge_irq(i, irq_desc + i); 231 generic_handle_irq(i + sachip->irq_base);
178 232
179 /* For level-based interrupts */ 233 /* For level-based interrupts */
180 desc->chip->unmask(irq); 234 desc->chip->unmask(irq);
181} 235}
182 236
183#define SA1111_IRQMASK_LO(x) (1 << (x - IRQ_SA1111_START)) 237#define SA1111_IRQMASK_LO(x) (1 << (x - sachip->irq_base))
184#define SA1111_IRQMASK_HI(x) (1 << (x - IRQ_SA1111_START - 32)) 238#define SA1111_IRQMASK_HI(x) (1 << (x - sachip->irq_base - 32))
185 239
186static void sa1111_ack_irq(unsigned int irq) 240static void sa1111_ack_irq(unsigned int irq)
187{ 241{
@@ -189,7 +243,8 @@ static void sa1111_ack_irq(unsigned int irq)
189 243
190static void sa1111_mask_lowirq(unsigned int irq) 244static void sa1111_mask_lowirq(unsigned int irq)
191{ 245{
192 void __iomem *mapbase = get_irq_chip_data(irq); 246 struct sa1111 *sachip = get_irq_chip_data(irq);
247 void __iomem *mapbase = sachip->base + SA1111_INTC;
193 unsigned long ie0; 248 unsigned long ie0;
194 249
195 ie0 = sa1111_readl(mapbase + SA1111_INTEN0); 250 ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
@@ -199,7 +254,8 @@ static void sa1111_mask_lowirq(unsigned int irq)
199 254
200static void sa1111_unmask_lowirq(unsigned int irq) 255static void sa1111_unmask_lowirq(unsigned int irq)
201{ 256{
202 void __iomem *mapbase = get_irq_chip_data(irq); 257 struct sa1111 *sachip = get_irq_chip_data(irq);
258 void __iomem *mapbase = sachip->base + SA1111_INTC;
203 unsigned long ie0; 259 unsigned long ie0;
204 260
205 ie0 = sa1111_readl(mapbase + SA1111_INTEN0); 261 ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
@@ -216,8 +272,9 @@ static void sa1111_unmask_lowirq(unsigned int irq)
216 */ 272 */
217static int sa1111_retrigger_lowirq(unsigned int irq) 273static int sa1111_retrigger_lowirq(unsigned int irq)
218{ 274{
275 struct sa1111 *sachip = get_irq_chip_data(irq);
276 void __iomem *mapbase = sachip->base + SA1111_INTC;
219 unsigned int mask = SA1111_IRQMASK_LO(irq); 277 unsigned int mask = SA1111_IRQMASK_LO(irq);
220 void __iomem *mapbase = get_irq_chip_data(irq);
221 unsigned long ip0; 278 unsigned long ip0;
222 int i; 279 int i;
223 280
@@ -237,8 +294,9 @@ static int sa1111_retrigger_lowirq(unsigned int irq)
237 294
238static int sa1111_type_lowirq(unsigned int irq, unsigned int flags) 295static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
239{ 296{
297 struct sa1111 *sachip = get_irq_chip_data(irq);
298 void __iomem *mapbase = sachip->base + SA1111_INTC;
240 unsigned int mask = SA1111_IRQMASK_LO(irq); 299 unsigned int mask = SA1111_IRQMASK_LO(irq);
241 void __iomem *mapbase = get_irq_chip_data(irq);
242 unsigned long ip0; 300 unsigned long ip0;
243 301
244 if (flags == IRQ_TYPE_PROBE) 302 if (flags == IRQ_TYPE_PROBE)
@@ -260,8 +318,9 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
260 318
261static int sa1111_wake_lowirq(unsigned int irq, unsigned int on) 319static int sa1111_wake_lowirq(unsigned int irq, unsigned int on)
262{ 320{
321 struct sa1111 *sachip = get_irq_chip_data(irq);
322 void __iomem *mapbase = sachip->base + SA1111_INTC;
263 unsigned int mask = SA1111_IRQMASK_LO(irq); 323 unsigned int mask = SA1111_IRQMASK_LO(irq);
264 void __iomem *mapbase = get_irq_chip_data(irq);
265 unsigned long we0; 324 unsigned long we0;
266 325
267 we0 = sa1111_readl(mapbase + SA1111_WAKEEN0); 326 we0 = sa1111_readl(mapbase + SA1111_WAKEEN0);
@@ -286,7 +345,8 @@ static struct irq_chip sa1111_low_chip = {
286 345
287static void sa1111_mask_highirq(unsigned int irq) 346static void sa1111_mask_highirq(unsigned int irq)
288{ 347{
289 void __iomem *mapbase = get_irq_chip_data(irq); 348 struct sa1111 *sachip = get_irq_chip_data(irq);
349 void __iomem *mapbase = sachip->base + SA1111_INTC;
290 unsigned long ie1; 350 unsigned long ie1;
291 351
292 ie1 = sa1111_readl(mapbase + SA1111_INTEN1); 352 ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
@@ -296,7 +356,8 @@ static void sa1111_mask_highirq(unsigned int irq)
296 356
297static void sa1111_unmask_highirq(unsigned int irq) 357static void sa1111_unmask_highirq(unsigned int irq)
298{ 358{
299 void __iomem *mapbase = get_irq_chip_data(irq); 359 struct sa1111 *sachip = get_irq_chip_data(irq);
360 void __iomem *mapbase = sachip->base + SA1111_INTC;
300 unsigned long ie1; 361 unsigned long ie1;
301 362
302 ie1 = sa1111_readl(mapbase + SA1111_INTEN1); 363 ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
@@ -313,8 +374,9 @@ static void sa1111_unmask_highirq(unsigned int irq)
313 */ 374 */
314static int sa1111_retrigger_highirq(unsigned int irq) 375static int sa1111_retrigger_highirq(unsigned int irq)
315{ 376{
377 struct sa1111 *sachip = get_irq_chip_data(irq);
378 void __iomem *mapbase = sachip->base + SA1111_INTC;
316 unsigned int mask = SA1111_IRQMASK_HI(irq); 379 unsigned int mask = SA1111_IRQMASK_HI(irq);
317 void __iomem *mapbase = get_irq_chip_data(irq);
318 unsigned long ip1; 380 unsigned long ip1;
319 int i; 381 int i;
320 382
@@ -334,8 +396,9 @@ static int sa1111_retrigger_highirq(unsigned int irq)
334 396
335static int sa1111_type_highirq(unsigned int irq, unsigned int flags) 397static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
336{ 398{
399 struct sa1111 *sachip = get_irq_chip_data(irq);
400 void __iomem *mapbase = sachip->base + SA1111_INTC;
337 unsigned int mask = SA1111_IRQMASK_HI(irq); 401 unsigned int mask = SA1111_IRQMASK_HI(irq);
338 void __iomem *mapbase = get_irq_chip_data(irq);
339 unsigned long ip1; 402 unsigned long ip1;
340 403
341 if (flags == IRQ_TYPE_PROBE) 404 if (flags == IRQ_TYPE_PROBE)
@@ -357,8 +420,9 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
357 420
358static int sa1111_wake_highirq(unsigned int irq, unsigned int on) 421static int sa1111_wake_highirq(unsigned int irq, unsigned int on)
359{ 422{
423 struct sa1111 *sachip = get_irq_chip_data(irq);
424 void __iomem *mapbase = sachip->base + SA1111_INTC;
360 unsigned int mask = SA1111_IRQMASK_HI(irq); 425 unsigned int mask = SA1111_IRQMASK_HI(irq);
361 void __iomem *mapbase = get_irq_chip_data(irq);
362 unsigned long we1; 426 unsigned long we1;
363 427
364 we1 = sa1111_readl(mapbase + SA1111_WAKEEN1); 428 we1 = sa1111_readl(mapbase + SA1111_WAKEEN1);
@@ -412,14 +476,14 @@ static void sa1111_setup_irq(struct sa1111 *sachip)
412 476
413 for (irq = IRQ_GPAIN0; irq <= SSPROR; irq++) { 477 for (irq = IRQ_GPAIN0; irq <= SSPROR; irq++) {
414 set_irq_chip(irq, &sa1111_low_chip); 478 set_irq_chip(irq, &sa1111_low_chip);
415 set_irq_chip_data(irq, irqbase); 479 set_irq_chip_data(irq, sachip);
416 set_irq_handler(irq, handle_edge_irq); 480 set_irq_handler(irq, handle_edge_irq);
417 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 481 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
418 } 482 }
419 483
420 for (irq = AUDXMTDMADONEA; irq <= IRQ_S1_BVD1_STSCHG; irq++) { 484 for (irq = AUDXMTDMADONEA; irq <= IRQ_S1_BVD1_STSCHG; irq++) {
421 set_irq_chip(irq, &sa1111_high_chip); 485 set_irq_chip(irq, &sa1111_high_chip);
422 set_irq_chip_data(irq, irqbase); 486 set_irq_chip_data(irq, sachip);
423 set_irq_handler(irq, handle_edge_irq); 487 set_irq_handler(irq, handle_edge_irq);
424 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 488 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
425 } 489 }
@@ -428,7 +492,7 @@ static void sa1111_setup_irq(struct sa1111 *sachip)
428 * Register SA1111 interrupt 492 * Register SA1111 interrupt
429 */ 493 */
430 set_irq_type(sachip->irq, IRQ_TYPE_EDGE_RISING); 494 set_irq_type(sachip->irq, IRQ_TYPE_EDGE_RISING);
431 set_irq_data(sachip->irq, irqbase); 495 set_irq_data(sachip->irq, sachip);
432 set_irq_chained_handler(sachip->irq, sa1111_irq_handler); 496 set_irq_chained_handler(sachip->irq, sa1111_irq_handler);
433} 497}
434 498
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 37bda5f3dde3..9012004321dd 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -140,6 +140,7 @@ EXPORT_SYMBOL(reset_scoop);
140EXPORT_SYMBOL(read_scoop_reg); 140EXPORT_SYMBOL(read_scoop_reg);
141EXPORT_SYMBOL(write_scoop_reg); 141EXPORT_SYMBOL(write_scoop_reg);
142 142
143#ifdef CONFIG_PM
143static void check_scoop_reg(struct scoop_dev *sdev) 144static void check_scoop_reg(struct scoop_dev *sdev)
144{ 145{
145 unsigned short mcr; 146 unsigned short mcr;
@@ -149,7 +150,6 @@ static void check_scoop_reg(struct scoop_dev *sdev)
149 iowrite16(0x0101, sdev->base + SCOOP_MCR); 150 iowrite16(0x0101, sdev->base + SCOOP_MCR);
150} 151}
151 152
152#ifdef CONFIG_PM
153static int scoop_suspend(struct platform_device *dev, pm_message_t state) 153static int scoop_suspend(struct platform_device *dev, pm_message_t state)
154{ 154{
155 struct scoop_dev *sdev = platform_get_drvdata(dev); 155 struct scoop_dev *sdev = platform_get_drvdata(dev);