From: Mark A. Greer <mgr...@mvista.com>

Integrate the Common Platform Interrupt Controller (cp_intc)
support into the low-level irq handling for davinci and similar
platforms.  Do it such that support for cp_intc and the original
aintc can coexist in the same kernel binary.

Signed-off-by: Mark A. Greer <mgr...@mvista.com>
Signed-off-by: Kevin Hilman <khil...@deeprootsystems.com>
---
 arch/arm/mach-davinci/Kconfig                    |    6 ++++++
 arch/arm/mach-davinci/Makefile                   |    6 ++++--
 arch/arm/mach-davinci/common.c                   |    2 ++
 arch/arm/mach-davinci/include/mach/common.h      |    1 +
 arch/arm/mach-davinci/include/mach/entry-macro.S |   19 +++++++++++++++++++
 5 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index d7614a0..7640867 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -1,5 +1,8 @@
 if ARCH_DAVINCI
 
+config AINTC
+       bool
+
 config CP_INTC
        bool
 
@@ -9,12 +12,15 @@ comment "DaVinci Core Type"
 
 config ARCH_DAVINCI_DM644x
        bool "DaVinci 644x based system"
+       select AINTC
 
 config ARCH_DAVINCI_DM355
         bool "DaVinci 355 based system"
+       select AINTC
 
 config ARCH_DAVINCI_DM646x
         bool "DaVinci 646x based system"
+       select AINTC
 
 comment "DaVinci Board Type"
 
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index a65d03b..5b62d8a 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -4,17 +4,19 @@
 #
 
 # Common objects
-obj-y                  := time.o irq.o clock.o serial.o io.o psc.o \
+obj-y                  := time.o clock.o serial.o io.o psc.o \
                           gpio.o devices.o dma.o usb.o common.o
 
 obj-$(CONFIG_DAVINCI_MUX)              += mux.o
-obj-$(CONFIG_CP_INTC)                  += cp_intc.o
 
 # Chip specific
 obj-$(CONFIG_ARCH_DAVINCI_DM644x)       += dm644x.o
 obj-$(CONFIG_ARCH_DAVINCI_DM355)        += dm355.o
 obj-$(CONFIG_ARCH_DAVINCI_DM646x)       += dm646x.o
 
+obj-$(CONFIG_AINTC)                    += irq.o
+obj-$(CONFIG_CP_INTC)                  += cp_intc.o
+
 # Board specific
 obj-$(CONFIG_MACH_DAVINCI_EVM)         += board-dm644x-evm.o
 obj-$(CONFIG_MACH_SFFSDR)              += board-sffsdr.o
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index db9d964..416f32d 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -23,6 +23,7 @@
 
 static struct davinci_soc_info davinci_soc_info;
 void __iomem *davinci_intc_base;
+int davinci_intc_type;
 
 void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context)
 {
@@ -107,6 +108,7 @@ void __init davinci_common_init(struct davinci_soc_info 
*soc_info)
        }
 
        davinci_intc_base = davinci_soc_info.intc_base;
+       davinci_intc_type = davinci_soc_info.intc_type;
        return;
 
 err:
diff --git a/arch/arm/mach-davinci/include/mach/common.h 
b/arch/arm/mach-davinci/include/mach/common.h
index 56d81fd..b0974ee 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -18,6 +18,7 @@ extern struct sys_timer davinci_timer;
 
 extern void davinci_irq_init(void);
 extern void __iomem *davinci_intc_base;
+extern int davinci_intc_type;
 
 /* parameters describe VBUS sourcing for host mode */
 extern void setup_usb(unsigned mA, unsigned potpgt_msec);
diff --git a/arch/arm/mach-davinci/include/mach/entry-macro.S 
b/arch/arm/mach-davinci/include/mach/entry-macro.S
index ed78851..fbdebc7 100644
--- a/arch/arm/mach-davinci/include/mach/entry-macro.S
+++ b/arch/arm/mach-davinci/include/mach/entry-macro.S
@@ -23,9 +23,28 @@
                .endm
 
                .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
+#if defined(CONFIG_AINTC) && defined(CONFIG_CP_INTC)
+               ldr \tmp, =davinci_intc_type
+               ldr \tmp, [\tmp]
+               cmp \tmp, #DAVINCI_INTC_TYPE_CP_INTC
+               beq 1001f
+#endif
+#if defined(CONFIG_AINTC)
                ldr \tmp, [\base, #0x14]
                movs \tmp, \tmp, lsr #2
                sub \irqnr, \tmp, #1
+               b 1002f
+#endif
+#if defined(CONFIG_CP_INTC)
+1001:          ldr \irqnr, [\base, #0x80] /* get irq number */
+               and \irqnr, \irqnr, #0xff  /* irq is in bits 0-9 */
+               mov \tmp, \irqnr, lsr #3
+               and \tmp, \tmp, #0xfc
+               add \tmp, \tmp, #0x280 /* get the register offset */
+               ldr \irqstat, [\base, \tmp] /* get the intc status */
+               cmp \irqstat, #0x0
+#endif
+1002:
                .endm
 
                .macro  irq_prio_table
-- 
1.6.2.2


_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to