]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Fixed order of enabling IRQ. It must be done after board reset.
authorwentasah <wentasah>
Wed, 28 Apr 2004 16:39:05 +0000 (16:39 +0000)
committerwentasah <wentasah>
Wed, 28 Apr 2004 16:39:05 +0000 (16:39 +0000)
lincan/src/unican_vme.c

index 5075a01fe44bd5c93decb3f3b8a059b313d8e70b..d171c48aed02746714f7a21dd5a27c704d1901e0 100644 (file)
@@ -27,19 +27,24 @@ can_irqreturn_t unican_vme_irq_handler(int vmeirq, int vector, void *dev_id, str
        return  unican_irq_handler(vmeirq, chip, regs);
 }
 
        return  unican_irq_handler(vmeirq, chip, regs);
 }
 
-int unican_vme_request_io(struct candevice_t *candev)
+/**
+ * unican_program_irq - program interrupts
+ * @candev: Pointer to candevice/board structure
+ *
+ * Return value: The function returns zero on success or %-ENODEV on failure
+ * File: src/unican.c
+ */
+int unican_vme_program_irq(struct candevice_t *candev)
 {
        struct chip_t *chip = candev->chip[0];
 
 {
        struct chip_t *chip = candev->chip[0];
 
-       unican_request_io(candev);
-
        if (chip->chip_irq < 0 || chip->chip_irq >= VME_CHIPS_SIZE) {
                CANMSG("Bad irq parameter. Maximum is %d.\n", VME_CHIPS_SIZE-1);
                return -EINVAL;
        }
 
 /*     vme_chips[chip->chip_irq] = chip; */
        if (chip->chip_irq < 0 || chip->chip_irq >= VME_CHIPS_SIZE) {
                CANMSG("Bad irq parameter. Maximum is %d.\n", VME_CHIPS_SIZE-1);
                return -EINVAL;
        }
 
 /*     vme_chips[chip->chip_irq] = chip; */
-       vme_chips[0] = chip;    
+       vme_chips[0] = chip;
 
        request_vmeirq(UNICAN_VME_IRQ, unican_vme_irq_handler);
        enable_vmeirq(UNICAN_VME_IRQ);
 
        request_vmeirq(UNICAN_VME_IRQ, unican_vme_irq_handler);
        enable_vmeirq(UNICAN_VME_IRQ);
@@ -47,6 +52,13 @@ int unican_vme_request_io(struct candevice_t *candev)
        return 0;
 }
 
        return 0;
 }
 
+int unican_vme_request_io(struct candevice_t *candev)
+{
+       unican_request_io(candev);
+
+       return 0;
+}
+
 /**
  * unican_vme_release_io - free reserved io memory range
  * @candev: pointer to candevice/board which releases io
 /**
  * unican_vme_release_io - free reserved io memory range
  * @candev: pointer to candevice/board which releases io
@@ -56,10 +68,11 @@ int unican_vme_request_io(struct candevice_t *candev)
  */
 int unican_vme_release_io(struct candevice_t *candev)
 {
  */
 int unican_vme_release_io(struct candevice_t *candev)
 {
+       disable_vmeirq(UNICAN_VME_IRQ);
+       free_vmeirq(UNICAN_VME_IRQ);
+
        unican_release_io(candev);
 
        unican_release_io(candev);
 
-       free_vmeirq(UNICAN_VME_IRQ);
-       disable_vmeirq(UNICAN_VME_IRQ);
        return 0;
 }
 
        return 0;
 }
 
@@ -105,13 +118,23 @@ int unican_vme_init_chip_data(struct candevice_t *candev, int chipnr)
 }
 
 
 }
 
 
+int unican_vme_init_hw_data(struct candevice_t *candev) 
+{
+       unican_init_hw_data(candev);
+       candev->flags |= CANDEV_PROGRAMMABLE_IRQ;
+
+       return 0;
+}
+
 int unican_vme_register(struct hwspecops_t *hwspecops)
 {
        unican_register(hwspecops);
 
 int unican_vme_register(struct hwspecops_t *hwspecops)
 {
        unican_register(hwspecops);
 
+       hwspecops->init_hw_data = unican_vme_init_hw_data;
+       hwspecops->init_chip_data = unican_vme_init_chip_data;
        hwspecops->request_io = unican_vme_request_io;
        hwspecops->request_io = unican_vme_request_io;
-       hwspecops->release_io = unican_vme_release_io;
        hwspecops->reset = unican_vme_reset;
        hwspecops->reset = unican_vme_reset;
-       hwspecops->init_chip_data = unican_vme_init_chip_data;
+       hwspecops->program_irq = unican_vme_program_irq;
+       hwspecops->release_io = unican_vme_release_io;
        return 0;
 }
        return 0;
 }