aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2010-01-06 18:59:26 -0500
committerBen Dooks <ben-linux@fluff.org>2010-01-15 03:10:14 -0500
commit5b39be4637bb795b2133dbee0eadbcc08bdd4134 (patch)
treef55baa4bf30212075ba45d89b78ccf2e265467bc
parent51022cf6591ae2945960d034788bdeffa28cde13 (diff)
ARM: Add common entry code for system with two VICs
Add a common entry-macro-vic2.S for systems where there are two VICs so that the machine or platform directories just need to setup the correct information before including <asm/entry-macro-vic2.S> into their own entry-macro.S file. Since this code is from the S3C64XX project, we update the S3C64XX machine entry code to use this new header. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r--arch/arm/include/asm/entry-macro-vic2.S57
-rw-r--r--arch/arm/mach-s3c6400/include/mach/entry-macro.S28
-rw-r--r--arch/arm/mach-s3c6400/include/mach/map.h4
-rw-r--r--arch/arm/mach-s3c6400/include/mach/tick.h2
-rw-r--r--arch/arm/plat-s3c64xx/cpu.c4
-rw-r--r--arch/arm/plat-s3c64xx/include/plat/irqs.h8
-rw-r--r--arch/arm/plat-s3c64xx/irq.c4
7 files changed, 69 insertions, 38 deletions
diff --git a/arch/arm/include/asm/entry-macro-vic2.S b/arch/arm/include/asm/entry-macro-vic2.S
new file mode 100644
index 000000000000..3ceb85e43850
--- /dev/null
+++ b/arch/arm/include/asm/entry-macro-vic2.S
@@ -0,0 +1,57 @@
1/* arch/arm/include/asm/entry-macro-vic2.S
2 *
3 * Originally arch/arm/mach-s3c6400/include/mach/entry-macro.S
4 *
5 * Copyright 2008 Openmoko, Inc.
6 * Copyright 2008 Simtec Electronics
7 * http://armlinux.simtec.co.uk/
8 * Ben Dooks <ben@simtec.co.uk>
9 *
10 * Low-level IRQ helper macros for a device with two VICs
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15*/
16
17/* This should be included from <mach/entry-macro.S> with the necessary
18 * defines for virtual addresses and IRQ bases for the two vics.
19 *
20 * The code needs the following defined:
21 * IRQ_VIC0_BASE IRQ number of VIC0's first IRQ
22 * IRQ_VIC1_BASE IRQ number of VIC1's first IRQ
23 * VA_VIC0 Virtual address of VIC0
24 * VA_VIC1 Virtual address of VIC1
25 *
26 * Note, code assumes VIC0's virtual address is an ARM immediate constant
27 * away from VIC1.
28*/
29
30#include <asm/hardware/vic.h>
31
32 .macro disable_fiq
33 .endm
34
35 .macro get_irqnr_preamble, base, tmp
36 ldr \base, =VA_VIC0
37 .endm
38
39 .macro arch_ret_to_user, tmp1, tmp2
40 .endm
41
42 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
43
44 @ check the vic0
45 mov \irqnr, #IRQ_VIC0_BASE + 31
46 ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]
47 teq \irqstat, #0
48
49 @ otherwise try vic1
50 addeq \tmp, \base, #(VA_VIC1 - VA_VIC0)
51 addeq \irqnr, \irqnr, #(IRQ_VIC1_BASE - IRQ_VIC0_BASE)
52 ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
53 teqeq \irqstat, #0
54
55 clzne \irqstat, \irqstat
56 subne \irqnr, \irqnr, \irqstat
57 .endm
diff --git a/arch/arm/mach-s3c6400/include/mach/entry-macro.S b/arch/arm/mach-s3c6400/include/mach/entry-macro.S
index fbd90d2cf355..33a8fe240882 100644
--- a/arch/arm/mach-s3c6400/include/mach/entry-macro.S
+++ b/arch/arm/mach-s3c6400/include/mach/entry-macro.S
@@ -12,33 +12,7 @@
12 * warranty of any kind, whether express or implied. 12 * warranty of any kind, whether express or implied.
13*/ 13*/
14 14
15#include <asm/hardware/vic.h>
16#include <mach/map.h> 15#include <mach/map.h>
17#include <plat/irqs.h> 16#include <plat/irqs.h>
18 17
19 .macro disable_fiq 18#include <asm/entry-macro-vic2.S>
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp
23 ldr \base, =S3C_VA_VIC0
24 .endm
25
26 .macro arch_ret_to_user, tmp1, tmp2
27 .endm
28
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30
31 @ check the vic0
32 mov \irqnr, # S3C_IRQ_OFFSET + 31
33 ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]
34 teq \irqstat, #0
35
36 @ otherwise try vic1
37 addeq \tmp, \base, #(S3C_VA_VIC1 - S3C_VA_VIC0)
38 addeq \irqnr, \irqnr, #32
39 ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
40 teqeq \irqstat, #0
41
42 clzne \irqstat, \irqstat
43 subne \irqnr, \irqnr, \irqstat
44 .endm
diff --git a/arch/arm/mach-s3c6400/include/mach/map.h b/arch/arm/mach-s3c6400/include/mach/map.h
index 106ee13581e2..d4cd3abe3cba 100644
--- a/arch/arm/mach-s3c6400/include/mach/map.h
+++ b/arch/arm/mach-s3c6400/include/mach/map.h
@@ -70,8 +70,8 @@
70#define S3C64XX_VA_USB_HSPHY S3C_ADDR_CPU(0x00200000) 70#define S3C64XX_VA_USB_HSPHY S3C_ADDR_CPU(0x00200000)
71 71
72/* place VICs close together */ 72/* place VICs close together */
73#define S3C_VA_VIC0 (S3C_VA_IRQ + 0x00) 73#define VA_VIC0 (S3C_VA_IRQ + 0x00)
74#define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000) 74#define VA_VIC1 (S3C_VA_IRQ + 0x10000)
75 75
76/* compatibiltiy defines. */ 76/* compatibiltiy defines. */
77#define S3C_PA_TIMER S3C64XX_PA_TIMER 77#define S3C_PA_TIMER S3C64XX_PA_TIMER
diff --git a/arch/arm/mach-s3c6400/include/mach/tick.h b/arch/arm/mach-s3c6400/include/mach/tick.h
index d9c0dc7014ec..ebe18a9469b8 100644
--- a/arch/arm/mach-s3c6400/include/mach/tick.h
+++ b/arch/arm/mach-s3c6400/include/mach/tick.h
@@ -20,7 +20,7 @@
20 */ 20 */
21static inline u32 s3c24xx_ostimer_pending(void) 21static inline u32 s3c24xx_ostimer_pending(void)
22{ 22{
23 u32 pend = __raw_readl(S3C_VA_VIC0 + VIC_RAW_STATUS); 23 u32 pend = __raw_readl(VA_VIC0 + VIC_RAW_STATUS);
24 return pend & 1 << (IRQ_TIMER4_VIC - S3C64XX_IRQ_VIC0(0)); 24 return pend & 1 << (IRQ_TIMER4_VIC - S3C64XX_IRQ_VIC0(0));
25} 25}
26 26
diff --git a/arch/arm/plat-s3c64xx/cpu.c b/arch/arm/plat-s3c64xx/cpu.c
index 49796d2db86d..c0e6f2a45154 100644
--- a/arch/arm/plat-s3c64xx/cpu.c
+++ b/arch/arm/plat-s3c64xx/cpu.c
@@ -78,12 +78,12 @@ static struct map_desc s3c_iodesc[] __initdata = {
78 .length = SZ_4K, 78 .length = SZ_4K,
79 .type = MT_DEVICE, 79 .type = MT_DEVICE,
80 }, { 80 }, {
81 .virtual = (unsigned long)S3C_VA_VIC0, 81 .virtual = (unsigned long)VA_VIC0,
82 .pfn = __phys_to_pfn(S3C64XX_PA_VIC0), 82 .pfn = __phys_to_pfn(S3C64XX_PA_VIC0),
83 .length = SZ_16K, 83 .length = SZ_16K,
84 .type = MT_DEVICE, 84 .type = MT_DEVICE,
85 }, { 85 }, {
86 .virtual = (unsigned long)S3C_VA_VIC1, 86 .virtual = (unsigned long)VA_VIC1,
87 .pfn = __phys_to_pfn(S3C64XX_PA_VIC1), 87 .pfn = __phys_to_pfn(S3C64XX_PA_VIC1),
88 .length = SZ_16K, 88 .length = SZ_16K,
89 .type = MT_DEVICE, 89 .type = MT_DEVICE,
diff --git a/arch/arm/plat-s3c64xx/include/plat/irqs.h b/arch/arm/plat-s3c64xx/include/plat/irqs.h
index 7956fd3bb194..176fe15a61d6 100644
--- a/arch/arm/plat-s3c64xx/include/plat/irqs.h
+++ b/arch/arm/plat-s3c64xx/include/plat/irqs.h
@@ -24,8 +24,8 @@
24 24
25#define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET) 25#define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET)
26 26
27#define S3C_VIC0_BASE S3C_IRQ(0) 27#define IRQ_VIC0_BASE S3C_IRQ(0)
28#define S3C_VIC1_BASE S3C_IRQ(32) 28#define IRQ_VIC1_BASE S3C_IRQ(32)
29 29
30/* UART interrupts, each UART has 4 intterupts per channel so 30/* UART interrupts, each UART has 4 intterupts per channel so
31 * use the space between the ISA and S3C main interrupts. Note, these 31 * use the space between the ISA and S3C main interrupts. Note, these
@@ -59,8 +59,8 @@
59 59
60/* VIC based IRQs */ 60/* VIC based IRQs */
61 61
62#define S3C64XX_IRQ_VIC0(x) (S3C_VIC0_BASE + (x)) 62#define S3C64XX_IRQ_VIC0(x) (IRQ_VIC0_BASE + (x))
63#define S3C64XX_IRQ_VIC1(x) (S3C_VIC1_BASE + (x)) 63#define S3C64XX_IRQ_VIC1(x) (IRQ_VIC1_BASE + (x))
64 64
65/* VIC0 */ 65/* VIC0 */
66 66
diff --git a/arch/arm/plat-s3c64xx/irq.c b/arch/arm/plat-s3c64xx/irq.c
index b98451e8ee24..67a145d440f3 100644
--- a/arch/arm/plat-s3c64xx/irq.c
+++ b/arch/arm/plat-s3c64xx/irq.c
@@ -54,8 +54,8 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
54 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__); 54 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
55 55
56 /* initialise the pair of VICs */ 56 /* initialise the pair of VICs */
57 vic_init(S3C_VA_VIC0, S3C_VIC0_BASE, vic0_valid, 0); 57 vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, 0);
58 vic_init(S3C_VA_VIC1, S3C_VIC1_BASE, vic1_valid, 0); 58 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, 0);
59 59
60 /* add the timer sub-irqs */ 60 /* add the timer sub-irqs */
61 61