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. |
| 9 | |
| 10 | * Modifications: |
| 11 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA |
| 12 | */ |
Russell King | 78ff18a | 2006-01-03 17:39:34 +0000 | [diff] [blame] | 13 | #include <asm/hardware.h> |
| 14 | #include <asm/arch/irqs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | |
| 17 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp |
| 18 | |
| 19 | mov \tmp, #S3C24XX_VA_IRQ |
| 20 | ldr \irqnr, [ \tmp, #0x14 ] @ get irq no |
| 21 | 30000: |
| 22 | teq \irqnr, #4 |
| 23 | teqne \irqnr, #5 |
| 24 | beq 1002f @ external irq reg |
| 25 | |
| 26 | @ debug check to see if interrupt reported is the same |
| 27 | @ as the offset.... |
| 28 | |
| 29 | teq \irqnr, #0 |
| 30 | beq 20002f |
| 31 | ldr \irqstat, [ \tmp, #0x10 ] @ INTPND |
| 32 | mov \irqstat, \irqstat, lsr \irqnr |
| 33 | tst \irqstat, #1 |
| 34 | bne 20002f |
| 35 | |
| 36 | /* debug/warning if we get an invalud response from the |
| 37 | * INTOFFSET register */ |
| 38 | #if 1 |
| 39 | stmfd r13!, { r0 - r4 , r8-r12, r14 } |
| 40 | ldr r1, [ \tmp, #0x14 ] @ INTOFFSET |
| 41 | ldr r2, [ \tmp, #0x10 ] @ INTPND |
| 42 | ldr r3, [ \tmp, #0x00 ] @ SRCPND |
| 43 | adr r0, 20003f |
| 44 | bl printk |
| 45 | b 20004f |
| 46 | |
| 47 | 20003: |
| 48 | .ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n" |
| 49 | .byte 0 |
| 50 | .align 4 |
| 51 | 20004: |
| 52 | mov r1, #1 |
| 53 | mov \tmp, #S3C24XX_VA_IRQ |
| 54 | ldmfd r13!, { r0 - r4 , r8-r12, r14 } |
| 55 | #endif |
| 56 | |
| 57 | @ try working out interrupt number for ourselves |
| 58 | mov \irqnr, #0 |
| 59 | ldr \irqstat, [ \tmp, #0x10 ] @ INTPND |
| 60 | 10021: |
| 61 | movs \irqstat, \irqstat, lsr#1 |
| 62 | bcs 30000b @ try and re-start the proccess |
| 63 | add \irqnr, \irqnr, #1 |
| 64 | cmp \irqnr, #32 |
| 65 | ble 10021b |
| 66 | |
| 67 | @ found no interrupt, set Z flag and leave |
| 68 | movs \irqnr, #0 |
| 69 | b 1001f |
| 70 | |
| 71 | 20005: |
| 72 | 20002: @ exit |
| 73 | @ we base the s3c2410x interrupts at 16 and above to allow |
| 74 | @ isa peripherals to have their standard interrupts, also |
| 75 | @ ensure that Z flag is un-set on exit |
| 76 | |
| 77 | @ note, we cannot be sure if we get IRQ_EINT0 (0) that |
| 78 | @ there is simply no interrupt pending, so in all other |
| 79 | @ cases we jump to say we have found something, otherwise |
| 80 | @ we check to see if the interrupt really is assrted |
| 81 | adds \irqnr, \irqnr, #IRQ_EINT0 |
| 82 | teq \irqnr, #IRQ_EINT0 |
| 83 | bne 1001f @ exit |
| 84 | ldr \irqstat, [ \tmp, #0x10 ] @ INTPND |
| 85 | teq \irqstat, #0 |
| 86 | moveq \irqnr, #0 |
| 87 | b 1001f |
| 88 | |
| 89 | @ we get here from no main or external interrupts pending |
| 90 | 1002: |
| 91 | add \tmp, \tmp, #S3C24XX_VA_GPIO - S3C24XX_VA_IRQ |
| 92 | ldr \irqstat, [ \tmp, # 0xa8 ] @ EXTINTPEND |
| 93 | ldr \irqnr, [ \tmp, # 0xa4 ] @ EXTINTMASK |
| 94 | |
| 95 | bic \irqstat, \irqstat, \irqnr @ clear masked irqs |
| 96 | |
| 97 | mov \irqnr, #IRQ_EINT4 @ start extint nos |
| 98 | mov \irqstat, \irqstat, lsr#4 @ ignore bottom 4 bits |
| 99 | 10021: |
| 100 | movs \irqstat, \irqstat, lsr#1 |
| 101 | bcs 1004f |
| 102 | add \irqnr, \irqnr, #1 |
| 103 | cmp \irqnr, #IRQ_EINT23 |
| 104 | ble 10021b |
| 105 | |
| 106 | @ found no interrupt, set Z flag and leave |
| 107 | movs \irqnr, #0 |
| 108 | |
| 109 | 1004: @ ensure Z flag clear in case our MOVS shifted out the last bit |
| 110 | teq \irqnr, #0 |
| 111 | 1001: |
| 112 | @ exit irq routine |
| 113 | .endm |
| 114 | |
| 115 | |
| 116 | /* currently don't need an disable_fiq macro */ |
| 117 | |
| 118 | .macro disable_fiq |
| 119 | .endm |
| 120 | |
| 121 | |