aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2011-03-07 02:42:28 -0500
committerGreg Ungerer <gerg@uclinux.org>2011-03-15 07:01:55 -0400
commit6d0f33fa80ed530168161fd2f226a3e5cf27cf81 (patch)
tree487daf5e2d049608ece6291bfd2dc594e0ef9e28 /arch/m68knommu
parent49bc6deace5a0a774678212097474b27b27e44fb (diff)
m68knommu: move some init code out of unmask routine for ColdFire intc-2
Use a proper irq_startup() routine to intialize the interrupt priority and level register in the ColdFire intc-2 controller code. We shouldn't be checking if the priority/level has been set on every unmask operation. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/platform/coldfire/intc-2.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/arch/m68knommu/platform/coldfire/intc-2.c b/arch/m68knommu/platform/coldfire/intc-2.c
index 4d172a7a6fbc..66d4e47dd8d0 100644
--- a/arch/m68knommu/platform/coldfire/intc-2.c
+++ b/arch/m68knommu/platform/coldfire/intc-2.c
@@ -30,13 +30,6 @@
30#define MCFSIM_ICR_LEVEL(l) ((l)<<3) /* Level l intr */ 30#define MCFSIM_ICR_LEVEL(l) ((l)<<3) /* Level l intr */
31#define MCFSIM_ICR_PRI(p) (p) /* Priority p intr */ 31#define MCFSIM_ICR_PRI(p) (p) /* Priority p intr */
32 32
33/*
34 * Each vector needs a unique priority and level associated with it.
35 * We don't really care so much what they are, we don't rely on the
36 * traditional priority interrupt scheme of the m68k/ColdFire.
37 */
38static u8 intc_intpri = MCFSIM_ICR_LEVEL(6) | MCFSIM_ICR_PRI(6);
39
40#ifdef MCFICM_INTC1 33#ifdef MCFICM_INTC1
41#define NR_VECS 128 34#define NR_VECS 128
42#else 35#else
@@ -64,25 +57,21 @@ static void intc_irq_mask(struct irq_data *d)
64static void intc_irq_unmask(struct irq_data *d) 57static void intc_irq_unmask(struct irq_data *d)
65{ 58{
66 unsigned int irq = d->irq - MCFINT_VECBASE; 59 unsigned int irq = d->irq - MCFINT_VECBASE;
67 unsigned long intaddr, imraddr, icraddr; 60 unsigned long imraddr;
68 u32 val, imrbit; 61 u32 val, imrbit;
69 62
70#ifdef MCFICM_INTC1 63#ifdef MCFICM_INTC1
71 intaddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; 64 imraddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0;
72#else 65#else
73 intaddr = MCFICM_INTC0; 66 imraddr = MCFICM_INTC0;
74#endif 67#endif
75 imraddr = intaddr + ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL); 68 imraddr += ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL);
76 icraddr = intaddr + MCFINTC_ICR0 + (irq & 0x3f);
77 imrbit = 0x1 << (irq & 0x1f); 69 imrbit = 0x1 << (irq & 0x1f);
78 70
79 /* Don't set the "maskall" bit! */ 71 /* Don't set the "maskall" bit! */
80 if ((irq & 0x20) == 0) 72 if ((irq & 0x20) == 0)
81 imrbit |= 0x1; 73 imrbit |= 0x1;
82 74
83 if (__raw_readb(icraddr) == 0)
84 __raw_writeb(intc_intpri--, icraddr);
85
86 val = __raw_readl(imraddr); 75 val = __raw_readl(imraddr);
87 __raw_writel(val & ~imrbit, imraddr); 76 __raw_writel(val & ~imrbit, imraddr);
88} 77}
@@ -92,8 +81,36 @@ static int intc_irq_set_type(struct irq_data *d, unsigned int type)
92 return 0; 81 return 0;
93} 82}
94 83
84/*
85 * Each vector needs a unique priority and level associated with it.
86 * We don't really care so much what they are, we don't rely on the
87 * traditional priority interrupt scheme of the m68k/ColdFire. This
88 * only needs to be set once for an interrupt, and we will never change
89 * these values once we have set them.
90 */
91static u8 intc_intpri = MCFSIM_ICR_LEVEL(6) | MCFSIM_ICR_PRI(6);
92
93static unsigned int intc_irq_startup(struct irq_data *d)
94{
95 unsigned int irq = d->irq - MCFINT_VECBASE;
96 unsigned long icraddr;
97
98#ifdef MCFICM_INTC1
99 icraddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0;
100#else
101 icraddr = MCFICM_INTC0;
102#endif
103 icraddr += MCFINTC_ICR0 + (irq & 0x3f);
104 if (__raw_readb(icraddr) == 0)
105 __raw_writeb(intc_intpri--, icraddr);
106
107 intc_irq_unmask(d);
108 return 0;
109}
110
95static struct irq_chip intc_irq_chip = { 111static struct irq_chip intc_irq_chip = {
96 .name = "CF-INTC", 112 .name = "CF-INTC",
113 .irq_startup = intc_irq_startup,
97 .irq_mask = intc_irq_mask, 114 .irq_mask = intc_irq_mask,
98 .irq_unmask = intc_irq_unmask, 115 .irq_unmask = intc_irq_unmask,
99 .irq_set_type = intc_irq_set_type, 116 .irq_set_type = intc_irq_set_type,