Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Ware and committed by
Kumar Gala
b22b97c1 b387dfe9

+20 -6
+20 -6
arch/powerpc/sysdev/cpm2_pic.c
··· 143 143 struct irq_desc *desc = irq_to_desc(virq); 144 144 unsigned int vold, vnew, edibit; 145 145 146 - if (flow_type == IRQ_TYPE_NONE) 147 - flow_type = IRQ_TYPE_LEVEL_LOW; 146 + /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or 147 + * IRQ_TYPE_EDGE_BOTH (default). All others are IRQ_TYPE_EDGE_FALLING 148 + * or IRQ_TYPE_LEVEL_LOW (default) 149 + */ 150 + if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) { 151 + if (flow_type == IRQ_TYPE_NONE) 152 + flow_type = IRQ_TYPE_EDGE_BOTH; 148 153 149 - if (flow_type & IRQ_TYPE_EDGE_RISING) { 150 - printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", 151 - flow_type); 152 - return -EINVAL; 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 165 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); ··· 191 181 if (vold != vnew) 192 182 out_be32(&cpm2_intctl->ic_siexr, vnew); 193 183 return 0; 184 + 185 + err_sense: 186 + pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type); 187 + return -EINVAL; 194 188 } 195 189 196 190 static struct irq_chip cpm2_pic = {