Hans J. Koch | 83ef333 | 2010-09-17 18:13:56 +0200 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-arm/arch-tcc83x/entry-macro.S |
| 3 | * |
| 4 | * Author : <linux@telechips.com> |
| 5 | * Created: June 10, 2008 |
| 6 | * Description: Low-level IRQ helper macros for Telechips-based platforms |
| 7 | * |
| 8 | * Copyright (C) 2008-2009 Telechips |
| 9 | * |
| 10 | * This file is licensed under the terms of the GNU General Public |
| 11 | * License version 2. This program is licensed "as is" without any |
| 12 | * warranty of any kind, whether express or implied. |
| 13 | */ |
| 14 | |
| 15 | #include <mach/hardware.h> |
| 16 | #include <mach/irqs.h> |
| 17 | |
| 18 | .macro disable_fiq |
| 19 | .endm |
| 20 | |
| 21 | .macro get_irqnr_preamble, base, tmp |
| 22 | .endm |
| 23 | |
| 24 | .macro arch_ret_to_user, tmp1, tmp2 |
| 25 | .endm |
| 26 | |
| 27 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp |
| 28 | |
| 29 | ldr \base, =0xF2003000 @ base address of PIC registers |
| 30 | |
| 31 | @@ read MREQ register of PIC0 |
| 32 | |
| 33 | mov \irqnr, #0 |
| 34 | ldr \irqstat, [\base, #0x00000014 ] @ lower 32 interrupts |
| 35 | cmp \irqstat, #0 |
| 36 | bne 1001f |
| 37 | |
| 38 | @@ read MREQ register of PIC1 |
| 39 | |
| 40 | ldr \irqstat, [\base, #0x00000094] @ upper 32 interrupts |
| 41 | cmp \irqstat, #0 |
| 42 | beq 1002f |
| 43 | mov \irqnr, #0x20 |
| 44 | |
| 45 | 1001: |
| 46 | movs \tmp, \irqstat, lsl #16 |
| 47 | movne \irqstat, \tmp |
| 48 | addeq \irqnr, \irqnr, #16 |
| 49 | |
| 50 | movs \tmp, \irqstat, lsl #8 |
| 51 | movne \irqstat, \tmp |
| 52 | addeq \irqnr, \irqnr, #8 |
| 53 | |
| 54 | movs \tmp, \irqstat, lsl #4 |
| 55 | movne \irqstat, \tmp |
| 56 | addeq \irqnr, \irqnr, #4 |
| 57 | |
| 58 | movs \tmp, \irqstat, lsl #2 |
| 59 | movne \irqstat, \tmp |
| 60 | addeq \irqnr, \irqnr, #2 |
| 61 | |
| 62 | movs \tmp, \irqstat, lsl #1 |
| 63 | addeq \irqnr, \irqnr, #1 |
| 64 | orrs \base, \base, #1 |
| 65 | 1002: |
| 66 | @@ exit here, Z flag unset if IRQ |
| 67 | |
| 68 | .endm |