cpm2_pic: Allow correct flow_types for port C interrupts
PATCH 1/1 cpm2_pic: Allow correct flow_types for port C interrupts
CPM2 Port C interrupts can be either falling edge, or either edge. Other external interrupts are either falling edge or active low.
--- arch/powerpc/sysdev/cpm2_pic.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-)
arch/powerpc/sysdev/cpm2_pic.c +22 -7
@@ -141,13 +141,28 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)struct irq_desc *desc =get_irq_desc (virq);unsigned int vold, vnew, edibit; -if (flow_type ==IRQ_TYPE_NONE ) - flow_type =IRQ_TYPE_LEVEL_LOW ; - -if (flow_type &IRQ_TYPE_EDGE_RISING ) { -printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , - flow_type); -return -EINVAL ; +/* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or +* 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_BOTH ) { +printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , + flow_type); +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 )) { +printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , + flow_type); +return -EINVAL ; + } } desc->status &= ~(IRQ_TYPE_SENSE_MASK |IRQ_LEVEL );
Signature · 1 line
1.5.6.5
Any comments/Acks/Nacks on this patch?
- Mark
Quoted 48 lines · Mark Ware
CPM2 Port C interrupts can be either falling edge, or either edge. Other external interrupts are either falling edge or active low.
Signed-off-by Mark Ware <[email protected]>--- arch/powerpc/sysdev/cpm2_pic.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-)arch/powerpc/sysdev/cpm2_pic.c +22
-7@@ -141,13 +141,28 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)struct irq_desc *desc =get_irq_desc (virq);unsigned int vold, vnew, edibit; -if (flow_type ==IRQ_TYPE_NONE ) - flow_type =IRQ_TYPE_LEVEL_LOW ; - -if (flow_type &IRQ_TYPE_EDGE_RISING ) { -printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , - flow_type); -return -EINVAL ; +/* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or +* 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_BOTH ) { +printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , + flow_type); +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 )) { +printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , + flow_type); +return -EINVAL ; + } } desc->status &= ~(IRQ_TYPE_SENSE_MASK |IRQ_LEVEL );
Quoted 3 lines · Mark Ware
Quoted 2 lines · Mark Ware
CPM2 Port C interrupts can be either falling edge, or either edge. Other external interrupts are either falling edge or active low.
[snip]
Quoted 5 lines
Quoted 5 lines
arch/powerpc/sysdev/cpm2_pic.c +5
-0+/* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or +* 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 ) {
Quoted 8 lines
arch/powerpc/sysdev/cpm2_pic.c static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) · line 156
Quoted 8 lines
arch/powerpc/sysdev/cpm2_pic.c +8
-0+if (flow_type ==IRQ_TYPE_NONE ) + flow_type =IRQ_TYPE_EDGE_BOTH ; + +if (flow_type & ~IRQ_TYPE_EDGE_BOTH ) { +printk (KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n" , + flow_type); +return -EINVAL ; + }
The above code looks like it would allow rising-only, which according to the changelog isn't supported.
-Scott
Quoted 21 lines · Scott Wood
Quoted 3 lines · Mark Ware
Quoted 2 lines · Mark Ware
CPM2 Port C interrupts can be either falling edge, or either edge. Other external interrupts are either falling edge or active low.
[snip]
Quoted 7 lines
Quoted 7 lines
(quoted diff) +2
-0+ /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or + * IRQ_TYPE_EDGE_BOTH (default). All others are
IRQ_TYPE_EDGE_FALLINGarch/powerpc/sysdev/cpm2_pic.c +4
-0+* or IRQ_TYPE_LEVEL_LOW (default) +*/ +if (src >=CPM2_IRQ_PORTC15 && src <=CPM2_IRQ_PORTC0 ) { +if (flow_type ==IRQ_TYPE_NONE )Quoted 8 lines
arch/powerpc/sysdev/cpm2_pic.c static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) · line 156
Quoted 8 lines
arch/powerpc/sysdev/cpm2_pic.c +4
-0+ flow_type =IRQ_TYPE_EDGE_BOTH ; + + if (flow_type & ~IRQ_TYPE_EDGE_BOTH) { + printk(KERN_ERR "CPM2 PIC: sense type 0x%x notsupported\n",
arch/powerpc/sysdev/cpm2_pic.c +3
-0+ flow_type); +return -EINVAL ; + }
Quoted 5 lines
The above code looks like it would allow rising-only, which according to the changelog isn't supported.
-Scott
Thanks Scott, you're right. I'll update and send v2 shortly.
- Mark