diff options
Diffstat (limited to 'arch/m68knommu/platform/coldfire/intc-2.c')
-rw-r--r-- | arch/m68knommu/platform/coldfire/intc-2.c | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/arch/m68knommu/platform/coldfire/intc-2.c b/arch/m68knommu/platform/coldfire/intc-2.c index 5598c8b8661f..85daa2b3001a 100644 --- a/arch/m68knommu/platform/coldfire/intc-2.c +++ b/arch/m68knommu/platform/coldfire/intc-2.c | |||
@@ -1,5 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * intc-1.c | 2 | * intc-2.c |
3 | * | ||
4 | * General interrupt controller code for the many ColdFire cores that use | ||
5 | * interrupt controllers with 63 interrupt sources, organized as 56 fully- | ||
6 | * programmable + 7 fixed-level interrupt sources. This includes the 523x | ||
7 | * family, the 5270, 5271, 5274, 5275, and the 528x family which have two such | ||
8 | * controllers, and the 547x and 548x families which have only one of them. | ||
3 | * | 9 | * |
4 | * (C) Copyright 2009, Greg Ungerer <gerg@snapgear.com> | 10 | * (C) Copyright 2009, Greg Ungerer <gerg@snapgear.com> |
5 | * | 11 | * |
@@ -19,21 +25,37 @@ | |||
19 | #include <asm/traps.h> | 25 | #include <asm/traps.h> |
20 | 26 | ||
21 | /* | 27 | /* |
22 | * Each vector needs a unique priority and level asscoiated with it. | 28 | * Bit definitions for the ICR family of registers. |
29 | */ | ||
30 | #define MCFSIM_ICR_LEVEL(l) ((l)<<3) /* Level l intr */ | ||
31 | #define MCFSIM_ICR_PRI(p) (p) /* Priority p intr */ | ||
32 | |||
33 | /* | ||
34 | * Each vector needs a unique priority and level associated with it. | ||
23 | * We don't really care so much what they are, we don't rely on the | 35 | * We don't really care so much what they are, we don't rely on the |
24 | * tranditional priority interrupt scheme of the m68k/ColdFire. | 36 | * traditional priority interrupt scheme of the m68k/ColdFire. |
25 | */ | 37 | */ |
26 | static u8 intc_intpri = 0x36; | 38 | static u8 intc_intpri = MCFSIM_ICR_LEVEL(6) | MCFSIM_ICR_PRI(6); |
39 | |||
40 | #ifdef MCFICM_INTC1 | ||
41 | #define NR_VECS 128 | ||
42 | #else | ||
43 | #define NR_VECS 64 | ||
44 | #endif | ||
27 | 45 | ||
28 | static void intc_irq_mask(unsigned int irq) | 46 | static void intc_irq_mask(unsigned int irq) |
29 | { | 47 | { |
30 | if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 128)) { | 48 | if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + NR_VECS)) { |
31 | unsigned long imraddr; | 49 | unsigned long imraddr; |
32 | u32 val, imrbit; | 50 | u32 val, imrbit; |
33 | 51 | ||
34 | irq -= MCFINT_VECBASE; | 52 | irq -= MCFINT_VECBASE; |
35 | imraddr = MCF_IPSBAR; | 53 | imraddr = MCF_IPSBAR; |
54 | #ifdef MCFICM_INTC1 | ||
36 | imraddr += (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; | 55 | imraddr += (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; |
56 | #else | ||
57 | imraddr += MCFICM_INTC0; | ||
58 | #endif | ||
37 | imraddr += (irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL; | 59 | imraddr += (irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL; |
38 | imrbit = 0x1 << (irq & 0x1f); | 60 | imrbit = 0x1 << (irq & 0x1f); |
39 | 61 | ||
@@ -44,13 +66,17 @@ static void intc_irq_mask(unsigned int irq) | |||
44 | 66 | ||
45 | static void intc_irq_unmask(unsigned int irq) | 67 | static void intc_irq_unmask(unsigned int irq) |
46 | { | 68 | { |
47 | if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 128)) { | 69 | if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + NR_VECS)) { |
48 | unsigned long intaddr, imraddr, icraddr; | 70 | unsigned long intaddr, imraddr, icraddr; |
49 | u32 val, imrbit; | 71 | u32 val, imrbit; |
50 | 72 | ||
51 | irq -= MCFINT_VECBASE; | 73 | irq -= MCFINT_VECBASE; |
52 | intaddr = MCF_IPSBAR; | 74 | intaddr = MCF_IPSBAR; |
75 | #ifdef MCFICM_INTC1 | ||
53 | intaddr += (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; | 76 | intaddr += (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; |
77 | #else | ||
78 | intaddr += MCFICM_INTC0; | ||
79 | #endif | ||
54 | imraddr = intaddr + ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL); | 80 | imraddr = intaddr + ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL); |
55 | icraddr = intaddr + MCFINTC_ICR0 + (irq & 0x3f); | 81 | icraddr = intaddr + MCFINTC_ICR0 + (irq & 0x3f); |
56 | imrbit = 0x1 << (irq & 0x1f); | 82 | imrbit = 0x1 << (irq & 0x1f); |
@@ -67,10 +93,16 @@ static void intc_irq_unmask(unsigned int irq) | |||
67 | } | 93 | } |
68 | } | 94 | } |
69 | 95 | ||
96 | static int intc_irq_set_type(unsigned int irq, unsigned int type) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | |||
70 | static struct irq_chip intc_irq_chip = { | 101 | static struct irq_chip intc_irq_chip = { |
71 | .name = "CF-INTC", | 102 | .name = "CF-INTC", |
72 | .mask = intc_irq_mask, | 103 | .mask = intc_irq_mask, |
73 | .unmask = intc_irq_unmask, | 104 | .unmask = intc_irq_unmask, |
105 | .set_type = intc_irq_set_type, | ||
74 | }; | 106 | }; |
75 | 107 | ||
76 | void __init init_IRQ(void) | 108 | void __init init_IRQ(void) |
@@ -81,13 +113,14 @@ void __init init_IRQ(void) | |||
81 | 113 | ||
82 | /* Mask all interrupt sources */ | 114 | /* Mask all interrupt sources */ |
83 | __raw_writel(0x1, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL); | 115 | __raw_writel(0x1, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL); |
116 | #ifdef MCFICM_INTC1 | ||
84 | __raw_writel(0x1, MCF_IPSBAR + MCFICM_INTC1 + MCFINTC_IMRL); | 117 | __raw_writel(0x1, MCF_IPSBAR + MCFICM_INTC1 + MCFINTC_IMRL); |
118 | #endif | ||
85 | 119 | ||
86 | for (irq = 0; (irq < NR_IRQS); irq++) { | 120 | for (irq = 0; (irq < NR_IRQS); irq++) { |
87 | irq_desc[irq].status = IRQ_DISABLED; | 121 | set_irq_chip(irq, &intc_irq_chip); |
88 | irq_desc[irq].action = NULL; | 122 | set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH); |
89 | irq_desc[irq].depth = 1; | 123 | set_irq_handler(irq, handle_level_irq); |
90 | irq_desc[irq].chip = &intc_irq_chip; | ||
91 | } | 124 | } |
92 | } | 125 | } |
93 | 126 | ||