blob: 8315b34f32ff00923738c48bf9d654a37b3c5f43 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
2 * arch/arm/mach-ks8695/include/mach/entry-macro.S
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * Low-level IRQ helper macros for KS8695
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12*/
13
14#include <mach/hardware.h>
15#include <mach/regs-irq.h>
16
Russell Kinga09e64f2008-08-05 16:14:15 +010017 .macro get_irqnr_preamble, base, tmp
18 ldr \base, =KS8695_IRQ_VA @ Base address of interrupt controller
19 .endm
20
Russell Kinga09e64f2008-08-05 16:14:15 +010021 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22 ldr \irqstat, [\base, #KS8695_INTMS] @ Mask Status register
23
24 teq \irqstat, #0
25 beq 1001f
26
27 mov \irqnr, #0
28
29 tst \irqstat, #0xff
30 moveq \irqstat, \irqstat, lsr #8
31 addeq \irqnr, \irqnr, #8
32 tsteq \irqstat, #0xff
33 moveq \irqstat, \irqstat, lsr #8
34 addeq \irqnr, \irqnr, #8
35 tsteq \irqstat, #0xff
36 moveq \irqstat, \irqstat, lsr #8
37 addeq \irqnr, \irqnr, #8
38 tst \irqstat, #0x0f
39 moveq \irqstat, \irqstat, lsr #4
40 addeq \irqnr, \irqnr, #4
41 tst \irqstat, #0x03
42 moveq \irqstat, \irqstat, lsr #2
43 addeq \irqnr, \irqnr, #2
44 tst \irqstat, #0x01
45 addeqs \irqnr, \irqnr, #1
461001:
47 .endm