Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Ben Dooks 5b39be46 51022cf6

+69 -38
+57
arch/arm/include/asm/entry-macro-vic2.S
··· 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
+1 -27
arch/arm/mach-s3c6400/include/mach/entry-macro.S
··· 12 12 * warranty of any kind, whether express or implied. 13 13 */ 14 14 15 - #include <asm/hardware/vic.h> 16 15 #include <mach/map.h> 17 16 #include <plat/irqs.h> 18 17 19 - .macro disable_fiq 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 18 + #include <asm/entry-macro-vic2.S>
+2 -2
arch/arm/mach-s3c6400/include/mach/map.h
··· 70 70 #define S3C64XX_VA_USB_HSPHY S3C_ADDR_CPU(0x00200000) 71 71 72 72 /* place VICs close together */ 73 - #define S3C_VA_VIC0 (S3C_VA_IRQ + 0x00) 74 - #define S3C_VA_VIC1 (S3C_VA_IRQ + 0x10000) 73 + #define VA_VIC0 (S3C_VA_IRQ + 0x00) 74 + #define VA_VIC1 (S3C_VA_IRQ + 0x10000) 75 75 76 76 /* compatibiltiy defines. */ 77 77 #define S3C_PA_TIMER S3C64XX_PA_TIMER
+1 -1
arch/arm/mach-s3c6400/include/mach/tick.h
··· 20 20 */ 21 21 static 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 24 return pend & 1 << (IRQ_TIMER4_VIC - S3C64XX_IRQ_VIC0(0)); 25 25 } 26 26
+2 -2
arch/arm/plat-s3c64xx/cpu.c
··· 78 78 .length = SZ_4K, 79 79 .type = MT_DEVICE, 80 80 }, { 81 - .virtual = (unsigned long)S3C_VA_VIC0, 81 + .virtual = (unsigned long)VA_VIC0, 82 82 .pfn = __phys_to_pfn(S3C64XX_PA_VIC0), 83 83 .length = SZ_16K, 84 84 .type = MT_DEVICE, 85 85 }, { 86 - .virtual = (unsigned long)S3C_VA_VIC1, 86 + .virtual = (unsigned long)VA_VIC1, 87 87 .pfn = __phys_to_pfn(S3C64XX_PA_VIC1), 88 88 .length = SZ_16K, 89 89 .type = MT_DEVICE,
+4 -4
arch/arm/plat-s3c64xx/include/plat/irqs.h
··· 24 24 25 25 #define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET) 26 26 27 - #define S3C_VIC0_BASE S3C_IRQ(0) 28 - #define S3C_VIC1_BASE S3C_IRQ(32) 27 + #define IRQ_VIC0_BASE S3C_IRQ(0) 28 + #define IRQ_VIC1_BASE S3C_IRQ(32) 29 29 30 30 /* UART interrupts, each UART has 4 intterupts per channel so 31 31 * use the space between the ISA and S3C main interrupts. Note, these ··· 59 59 60 60 /* VIC based IRQs */ 61 61 62 - #define S3C64XX_IRQ_VIC0(x) (S3C_VIC0_BASE + (x)) 63 - #define S3C64XX_IRQ_VIC1(x) (S3C_VIC1_BASE + (x)) 62 + #define S3C64XX_IRQ_VIC0(x) (IRQ_VIC0_BASE + (x)) 63 + #define S3C64XX_IRQ_VIC1(x) (IRQ_VIC1_BASE + (x)) 64 64 65 65 /* VIC0 */ 66 66
+2 -2
arch/arm/plat-s3c64xx/irq.c
··· 54 54 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__); 55 55 56 56 /* initialise the pair of VICs */ 57 - vic_init(S3C_VA_VIC0, S3C_VIC0_BASE, vic0_valid, 0); 58 - vic_init(S3C_VA_VIC1, S3C_VIC1_BASE, vic1_valid, 0); 57 + vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, 0); 58 + vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, 0); 59 59 60 60 /* add the timer sub-irqs */ 61 61