diff options
author | Mark Ware <mware@elphinstone.net> | 2009-12-10 06:14:34 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-12-10 14:48:36 -0500 |
commit | b22b97c15eed893a6768aad2f596706c56bf194e (patch) | |
tree | 2f5edbb1dd9dfe2b0066ab990a104d4f0b8c650d /arch/powerpc/sysdev | |
parent | b387dfe902c352d5be4690a135412ece4868b531 (diff) |
powerpc/cpm2_pic: Allow correct flow_types for port C interrupts
Port C interrupts can be either falling edge, or either edge.
Other external interrupts are either falling edge or active low.
Tested on a custom 8280 based board.
Signed-off-by: Mark Ware <mware@elphinstone.net>
Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/cpm2_pic.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index 971483f0dfac..1709ac5aac7c 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c | |||
@@ -143,13 +143,23 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) | |||
143 | struct irq_desc *desc = irq_to_desc(virq); | 143 | struct irq_desc *desc = irq_to_desc(virq); |
144 | unsigned int vold, vnew, edibit; | 144 | unsigned int vold, vnew, edibit; |
145 | 145 | ||
146 | if (flow_type == IRQ_TYPE_NONE) | 146 | /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or |
147 | flow_type = IRQ_TYPE_LEVEL_LOW; | 147 | * IRQ_TYPE_EDGE_BOTH (default). All others are IRQ_TYPE_EDGE_FALLING |
148 | 148 | * or IRQ_TYPE_LEVEL_LOW (default) | |
149 | if (flow_type & IRQ_TYPE_EDGE_RISING) { | 149 | */ |
150 | printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", | 150 | if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) { |
151 | flow_type); | 151 | if (flow_type == IRQ_TYPE_NONE) |
152 | return -EINVAL; | 152 | flow_type = IRQ_TYPE_EDGE_BOTH; |
153 | |||
154 | if (flow_type != IRQ_TYPE_EDGE_BOTH && | ||
155 | flow_type != IRQ_TYPE_EDGE_FALLING) | ||
156 | goto err_sense; | ||
157 | } else { | ||
158 | if (flow_type == IRQ_TYPE_NONE) | ||
159 | flow_type = IRQ_TYPE_LEVEL_LOW; | ||
160 | |||
161 | if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH)) | ||
162 | goto err_sense; | ||
153 | } | 163 | } |
154 | 164 | ||
155 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); | 165 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); |
@@ -181,6 +191,10 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) | |||
181 | if (vold != vnew) | 191 | if (vold != vnew) |
182 | out_be32(&cpm2_intctl->ic_siexr, vnew); | 192 | out_be32(&cpm2_intctl->ic_siexr, vnew); |
183 | return 0; | 193 | return 0; |
194 | |||
195 | err_sense: | ||
196 | pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type); | ||
197 | return -EINVAL; | ||
184 | } | 198 | } |
185 | 199 | ||
186 | static struct irq_chip cpm2_pic = { | 200 | static struct irq_chip cpm2_pic = { |