EMS CPC-PCI fix correcting poorly undocumented PITA2 IRQ behavior.
authorppisa <ppisa>
Fri, 16 Jul 2004 15:44:20 +0000 (15:44 +0000)
committerppisa <ppisa>
Fri, 16 Jul 2004 15:44:20 +0000 (15:44 +0000)
This workaround compiles only for 2.6.x kernels now and correct
fix compatible with 2.4 requires driver wide changes.
That is why CPC-PCI is not enabled by default.

lincan/src/Makefile.std
lincan/src/ems_cpcpci.c

index 01a6dd8..29a2b30 100644 (file)
@@ -63,7 +63,8 @@ endif
 SUPPORTED_CARDS = pip pccan smartcan nsi cc_can104 \
                  pc_i03 pcm3680 aim104 m437 pcccan ssv \
                  bfadcan pikronisa kv_pcican msmcan virtual template \
-                 unican unican_cl2 ems_cpcpci 
+                 unican unican_cl2
+#                ems_cpcpci # compiles only for 2.6 kernels now
 #                hms30c7202_can c_can c_can_irq
 
 
index 41441f3..da82fd3 100644 (file)
@@ -191,22 +191,25 @@ can_irqreturn_t ems_cpcpci_irq_handler(int irq, void *dev_id, struct pt_regs *re
        struct candevice_t *candev=chip->hostdevice;
        int i;
        unsigned long icr;
+       int test_irq_again;
 
        icr=readl(candev->dev_base_addr + PITA2_ICR);
-       if(!(icr & PITA2_ICR_INT0)) return IRQ_NONE;
+       if(!(icr & PITA2_ICR_INT0)) return CAN_IRQ_NONE;
        
        /* correct way to handle interrupts from all chips connected to the one PITA-2 */
        do {
                writel(PITA2_ICR_INT0_En | PITA2_ICR_INT0, candev->dev_base_addr + PITA2_ICR);
+               test_irq_again=0;
                for(i=0;i<candev->nr_all_chips;i++){
                        chip=candev->chip[i];
                        if(!chip || !(chip->flags&CHIP_CONFIGURED))
                                continue;
-                       sja1000p_irq_handler(irq, chip, regs);
+                       if(sja1000p_irq_handler(irq, chip, regs))
+                               test_irq_again=1;
                }
                icr=readl(candev->dev_base_addr + PITA2_ICR);
-       } while(icr & PITA2_ICR_INT0);
-       return IRQ_HANDLED;
+       } while((icr & PITA2_ICR_INT0)||test_irq_again);
+       return CAN_IRQ_HANDLED;
 }
 
 int ems_cpcpci_reset(struct candevice_t *candev)