Minor correction in PEAK PCI can support.
authorppisa <ppisa>
Tue, 7 Aug 2007 13:09:43 +0000 (13:09 +0000)
committerppisa <ppisa>
Tue, 7 Aug 2007 13:09:43 +0000 (13:09 +0000)
Some first tests worked on DigitalLogic's MSMCA104+
card clone. But interrupt handling requires
more testing. PITA documentation is unclear and real
behavior of IRQ status has to be analyzed and code
has to be adjusted accordingly.

lincan/src/pcan_pci.c

index 2a88beb..53fb133 100644 (file)
@@ -245,13 +245,18 @@ int pcan_pci_init_hw_data(struct candevice_t *candev)
        int nr_chips;
        u16 subsysid;
 
+       i = 0;
        do {
                pcidev = pci_find_device(PCAN_PCI_VENDOR_ID, PCAN_PCI_PRODUCT_ID, pcidev);
-               if(pcidev == NULL) return -ENODEV;
+               if(pcidev == NULL) {
+                       printk(KERN_ERR "No unused PCAN_PCI #%d card found\n", i);
+                       return -ENODEV;
+               }
+               i++;
        } while(can_check_dev_taken(pcidev));
 
        if (pci_enable_device (pcidev)){
-               printk(KERN_CRIT "Enable PCAN_PCI failed\n");
+               printk(KERN_ERR "Enable PCAN_PCI failed\n");
                return -EIO;
        }
        candev->sysdevptr.pcidev=pcidev;
@@ -269,7 +274,7 @@ int pcan_pci_init_hw_data(struct candevice_t *candev)
 
        for(i=0;i<2;i++){
                if(!(pci_resource_flags(pcidev,0)&IORESOURCE_MEM)){
-                       printk(KERN_CRIT "PCAN_PCI region %d is not memory\n",i);
+                       printk(KERN_ERR "PCAN_PCI region %d is not memory\n",i);
                        goto error_ret;
                }
        }
@@ -310,12 +315,13 @@ int pcan_pci_init_chip_data(struct candevice_t *candev, int chipnr)
        if(candev->sysdevptr.pcidev==NULL)
                return -ENODEV;
 
+       sja1000p_fill_chipspecops(candev->chip[chipnr]);
+
        /* special version of the IRQ handler is required for PCAN_PCI board */
        candev->chip[chipnr]->chipspecops->irq_handler=pcan_pci_irq_handler;
 
        candev->chip[chipnr]->chip_irq=candev->sysdevptr.pcidev->irq;
 
-       sja1000p_fill_chipspecops(candev->chip[chipnr]);
        candev->chip[chipnr]->chip_base_addr=
                        can_ioport2ioptr(candev->io_addr+chipnr*PCAN_PCI_BYTES_PER_CIRCUIT);
        candev->chip[chipnr]->flags = 0;