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];
- 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; */
- vme_chips[0] = chip;
+ vme_chips[0] = chip;
request_vmeirq(UNICAN_VME_IRQ, unican_vme_irq_handler);
enable_vmeirq(UNICAN_VME_IRQ);
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
*/
int unican_vme_release_io(struct candevice_t *candev)
{
+ disable_vmeirq(UNICAN_VME_IRQ);
+ free_vmeirq(UNICAN_VME_IRQ);
+
unican_release_io(candev);
- free_vmeirq(UNICAN_VME_IRQ);
- disable_vmeirq(UNICAN_VME_IRQ);
return 0;
}
}
+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);
+ 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->release_io = unican_vme_release_io;
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;
}