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>
This commit is contained in:
parent
b387dfe902
commit
b22b97c15e
|
@ -143,13 +143,23 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
|
||||||
struct irq_desc *desc = irq_to_desc(virq);
|
struct irq_desc *desc = irq_to_desc(virq);
|
||||||
unsigned int vold, vnew, edibit;
|
unsigned int vold, vnew, edibit;
|
||||||
|
|
||||||
if (flow_type == IRQ_TYPE_NONE)
|
/* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or
|
||||||
flow_type = IRQ_TYPE_LEVEL_LOW;
|
* IRQ_TYPE_EDGE_BOTH (default). All others are IRQ_TYPE_EDGE_FALLING
|
||||||
|
* or IRQ_TYPE_LEVEL_LOW (default)
|
||||||
|
*/
|
||||||
|
if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) {
|
||||||
|
if (flow_type == IRQ_TYPE_NONE)
|
||||||
|
flow_type = IRQ_TYPE_EDGE_BOTH;
|
||||||
|
|
||||||
if (flow_type & IRQ_TYPE_EDGE_RISING) {
|
if (flow_type != IRQ_TYPE_EDGE_BOTH &&
|
||||||
printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n",
|
flow_type != IRQ_TYPE_EDGE_FALLING)
|
||||||
flow_type);
|
goto err_sense;
|
||||||
return -EINVAL;
|
} else {
|
||||||
|
if (flow_type == IRQ_TYPE_NONE)
|
||||||
|
flow_type = IRQ_TYPE_LEVEL_LOW;
|
||||||
|
|
||||||
|
if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH))
|
||||||
|
goto err_sense;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
|
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)
|
||||||
if (vold != vnew)
|
if (vold != vnew)
|
||||||
out_be32(&cpm2_intctl->ic_siexr, vnew);
|
out_be32(&cpm2_intctl->ic_siexr, vnew);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_sense:
|
||||||
|
pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct irq_chip cpm2_pic = {
|
static struct irq_chip cpm2_pic = {
|
||||||
|
|
Loading…
Reference in New Issue