aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-04-15 11:29:54 -0400
committerGrant Likely <grant.likely@secretlab.ca>2008-04-29 09:16:35 -0400
commitf800ab44f5cd094743dc3df371bcf986375f5774 (patch)
tree96aa4b5e6e2a080ba31cfacaf3f150830dbe69a7
parentbc775eac63c16dbcfabc4c6e949c0228edf3e11f (diff)
[POWERPC] mpc5200: add interrupt type function
Add a set_type function for external (GPIO) interrupts. Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index d0dead8b9a9..8479394e9ab 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -18,6 +18,7 @@
18 18
19#undef DEBUG 19#undef DEBUG
20 20
21#include <linux/interrupt.h>
21#include <linux/irq.h> 22#include <linux/irq.h>
22#include <linux/of.h> 23#include <linux/of.h>
23#include <asm/io.h> 24#include <asm/io.h>
@@ -109,11 +110,48 @@ static void mpc52xx_extirq_ack(unsigned int virq)
109 io_be_setbit(&intr->ctrl, 27-l2irq); 110 io_be_setbit(&intr->ctrl, 27-l2irq);
110} 111}
111 112
113static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
114{
115 u32 ctrl_reg, type;
116 int irq;
117 int l2irq;
118
119 irq = irq_map[virq].hwirq;
120 l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
121
122 pr_debug("%s: irq=%x. l2=%d flow_type=%d\n", __func__, irq, l2irq, flow_type);
123
124 switch (flow_type) {
125 case IRQF_TRIGGER_HIGH:
126 type = 0;
127 break;
128 case IRQF_TRIGGER_RISING:
129 type = 1;
130 break;
131 case IRQF_TRIGGER_FALLING:
132 type = 2;
133 break;
134 case IRQF_TRIGGER_LOW:
135 type = 3;
136 break;
137 default:
138 type = 0;
139 }
140
141 ctrl_reg = in_be32(&intr->ctrl);
142 ctrl_reg &= ~(0x3 << (22 - (l2irq * 2)));
143 ctrl_reg |= (type << (22 - (l2irq * 2)));
144 out_be32(&intr->ctrl, ctrl_reg);
145
146 return 0;
147}
148
112static struct irq_chip mpc52xx_extirq_irqchip = { 149static struct irq_chip mpc52xx_extirq_irqchip = {
113 .typename = " MPC52xx IRQ[0-3] ", 150 .typename = " MPC52xx IRQ[0-3] ",
114 .mask = mpc52xx_extirq_mask, 151 .mask = mpc52xx_extirq_mask,
115 .unmask = mpc52xx_extirq_unmask, 152 .unmask = mpc52xx_extirq_unmask,
116 .ack = mpc52xx_extirq_ack, 153 .ack = mpc52xx_extirq_ack,
154 .set_type = mpc52xx_extirq_set_type,
117}; 155};
118 156
119/* 157/*