Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-arm/arch-s3c2410/entry-macro.S |
| 3 | * |
| 4 | * Low-level IRQ helper macros for S3C2410-based platforms |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 9 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 11 | /* We have a problem that the INTOFFSET register does not always |
| 12 | * show one interrupt. Occasionally we get two interrupts through |
| 13 | * the prioritiser, and this causes the INTOFFSET register to show |
| 14 | * what looks like the logical-or of the two interrupt numbers. |
| 15 | * |
| 16 | * Thanks to Klaus, Shannon, et al for helping to debug this problem |
| 17 | */ |
| 18 | |
| 19 | #define INTPND (0x10) |
| 20 | #define INTOFFSET (0x14) |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 21 | |
Russell King | 78ff18a | 2006-01-03 17:39:34 +0000 | [diff] [blame] | 22 | #include <asm/hardware.h> |
Arnaud Patard | 431d2cd | 2006-12-27 22:56:44 +0100 | [diff] [blame] | 23 | #include <asm/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp |
| 26 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 27 | mov \base, #S3C24XX_VA_IRQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 29 | @@ try the interrupt offset register, since it is there |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
Ben Dooks | a019f4a | 2006-06-24 21:21:37 +0100 | [diff] [blame] | 31 | ldr \irqstat, [ \base, #INTPND ] |
| 32 | teq \irqstat, #0 |
| 33 | beq 1002f |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 34 | ldr \irqnr, [ \base, #INTOFFSET ] |
| 35 | mov \tmp, #1 |
| 36 | tst \irqstat, \tmp, lsl \irqnr |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 37 | bne 1001f |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 39 | @@ the number specified is not a valid irq, so try |
| 40 | @@ and work it out for ourselves |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Ben Dooks | a019f4a | 2006-06-24 21:21:37 +0100 | [diff] [blame] | 42 | mov \irqnr, #0 @@ start here |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 44 | @@ work out which irq (if any) we got |
Ben Dooks | a019f4a | 2006-06-24 21:21:37 +0100 | [diff] [blame] | 45 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 46 | movs \tmp, \irqstat, lsl#16 |
| 47 | addeq \irqnr, \irqnr, #16 |
| 48 | moveq \irqstat, \irqstat, lsr#16 |
| 49 | tst \irqstat, #0xff |
| 50 | addeq \irqnr, \irqnr, #8 |
| 51 | moveq \irqstat, \irqstat, lsr#8 |
| 52 | tst \irqstat, #0xf |
| 53 | addeq \irqnr, \irqnr, #4 |
| 54 | moveq \irqstat, \irqstat, lsr#4 |
| 55 | tst \irqstat, #0x3 |
| 56 | addeq \irqnr, \irqnr, #2 |
| 57 | moveq \irqstat, \irqstat, lsr#2 |
| 58 | tst \irqstat, #0x1 |
| 59 | addeq \irqnr, \irqnr, #1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 61 | @@ we have the value |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | 1001: |
Ben Dooks | a019f4a | 2006-06-24 21:21:37 +0100 | [diff] [blame] | 63 | adds \irqnr, \irqnr, #IRQ_EINT0 |
| 64 | 1002: |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 65 | @@ exit here, Z flag unset if IRQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
Ben Dooks | 26f91fd | 2006-04-02 00:09:26 +0100 | [diff] [blame] | 67 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
| 69 | /* currently don't need an disable_fiq macro */ |
| 70 | |
| 71 | .macro disable_fiq |
| 72 | .endm |