X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/2f13c6dc170fc5a887dcea791e73e1a695e9055d..fd883ff8b15778611731b6e7c9cdacb5470c3901:/lincan/src/can_devrtl.c diff --git a/lincan/src/can_devrtl.c b/lincan/src/can_devrtl.c index c570f1b..c7ff970 100644 --- a/lincan/src/can_devrtl.c +++ b/lincan/src/can_devrtl.c @@ -26,11 +26,12 @@ can_spinlock_t can_irq_manipulation_lock; unsigned int can_rtl_isr( unsigned int irq_num, struct pt_regs *r ) { - struct chip_t *chip; + struct canchip_t *chip; struct candevice_t *candev; int board_nr; int chip_nr; int irq2linux=0; + int ret; pthread_t thread=NULL; DEBUGMSG("can_rtl_isr invoked for irq %d\n",irq_num); @@ -44,6 +45,9 @@ unsigned int can_rtl_isr( unsigned int irq_num, struct pt_regs *r ) continue; if(chip->chip_irq!=irq_num) continue; + if(chip->chipspecops->irq_accept) + ret=chip->chipspecops->irq_accept(chip->chip_irq,chip); + set_bit(MSGOBJ_IRQ_REQUEST_b,&chip->pend_flags); set_bit(MSGOBJ_WORKER_WAKE_b,&chip->pend_flags); if(chip->flags & CHIP_IRQ_PCI) @@ -80,7 +84,7 @@ rtl_free_global_irq( irq ) void * can_chip_worker_thread(void *arg) { - struct chip_t *chip = (struct chip_t *) arg; + struct canchip_t *chip = (struct canchip_t *) arg; struct msgobj_t *obj; int ret, i; int loop_cnt; @@ -134,9 +138,20 @@ void * can_chip_worker_thread(void *arg) but it seems to not work without that */ if(chip->chip_irq>=0) { if ((chip->flags & CHIP_IRQ_VME) == 0) can_enable_irq(chip->chip_irq); - else tundra_rtl_enable_pci_irq(); + #ifdef CAN_ENABLE_VME_SUPPORT + #if 0 + else tundra_rtl_enable_pci_irq(); + #endif /* FIXME: Bad practice. Doesn't work with more - * than one card. */ + * than one card. + * + * irq_accept added to the LinCAN driver now, + * and above workaround should not be required. + * Enable rtl_hard_enable_irq() at line + * ca91c042.c:1045 + */ + #endif /*CAN_ENABLE_VME_SUPPORT*/ + } RTL_MARK_SUSPENDED(pthread_self()); @@ -151,7 +166,7 @@ void * can_chip_worker_thread(void *arg) } -int can_chip_setup_irq(struct chip_t *chip) +int can_chip_setup_irq(struct canchip_t *chip) { int ret; struct sched_param sched_param; @@ -169,7 +184,7 @@ int can_chip_setup_irq(struct chip_t *chip) attrib_p=&attrib; } - if(chip->chipspecops->irq_handler){ + if(chip->chipspecops->irq_handler && !(chip->flags & CHIP_IRQ_CUSTOM)){ int (*my_request_irq)(unsigned int vector, unsigned int (*rtl_handler)(unsigned int irq, struct pt_regs *regs)); #ifdef CAN_ENABLE_VME_SUPPORT if ((chip->flags & CHIP_IRQ_VME) != 0) @@ -192,11 +207,12 @@ int can_chip_setup_irq(struct chip_t *chip) } -void can_chip_free_irq(struct chip_t *chip) +void can_chip_free_irq(struct canchip_t *chip) { if(chip->worker_thread) pthread_delete_np(chip->worker_thread); - if((chip->flags & CHIP_IRQ_SETUP) && (chip->chip_irq>=0)) { + if((chip->flags & CHIP_IRQ_SETUP) && (chip->chip_irq>=0) + && !(chip->flags & CHIP_IRQ_CUSTOM)) { int (*my_free_irq)(unsigned int vector); #ifdef CAN_ENABLE_VME_SUPPORT if ((chip->flags & CHIP_IRQ_VME) != 0)