diff options
| -rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_pic.c | 38 |
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 d0dead8b9a95..8479394e9ab4 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 | ||
| 113 | static 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 | |||
| 112 | static struct irq_chip mpc52xx_extirq_irqchip = { | 149 | static 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 | /* |
