All of lore.kernel.org
 help / color / mirror / Atom feed
* Interrupts not Firing on PPC405EX
@ 2009-11-05 20:37 Jonathan Haws
  2009-11-11  2:07 ` Tonyliu
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Haws @ 2009-11-05 20:37 UTC (permalink / raw)
  To: linuxppc-dev@lists.ozlabs.org

All,

I am having some troubles getting interrupts to fire from my kernel module.=
  I have connected the ISR with a call to request_irq() and have configured=
 my device to generate interrupts.   However, my ISR is called once when I =
connect the interrupt for the first time.  After that it never is called ag=
ain.  It seems like that interrupt is getting stuck disabled, but that does=
 not make sense as to why.

The device is on the PCIE0 bus and works just fine in another OS (namely Vx=
works - that is the driver I am working on porting to Linux).

Here is how I am connecting the ISR and the ISR itself.  Am I doing somethi=
ng stupid?

Thanks for the help!

Jonathan

PS - Our hardware is a custom spun PPC405EX board based on the AMCC Kilauea=
 board and uses the kilauea.dts with no modifications.

A quick note - I realize that I am not checking if I was the one to interru=
pt the CPU.  I am not worried about that right now - especially since I kno=
w there is nothing else that will interrupt the CPU on this IRQ right now a=
nyway - it never fires.


int fpga_open(struct inode *inode, struct file *filp)
{
	int err =3D 0;

	/* Make sure we have successfully probed the device */
	if (NULL =3D=3D fpga_drv.pcidev)
	{
		return -ENODEV;
	}

	/* Only one process at a time can have access to the FPGA */
	if (0 !=3D atomic_read(&fpga_drv.openCount))
	{
		atomic_inc(&fpga_drv.openCount);
		printk(KERN_WARNING "FPGA: Could not open device: already open. \n");
		return -EBUSY;
	}

	/* If not already in use, state that we are */
	atomic_inc(&fpga_drv.openCount);

	/* Store a pointer to the PCI device structure */
	filp->private_data =3D fpga_drv.pcidev;

	/* Attach ISR to IRQ */
	if (request_irq(fpga_drv.pcidev->irq, &fpga_isr, IRQF_SHARED,
			FPGA_MODULE_NAME, fpga_drv.pcidev))
	{
		printk( KERN_ERR "FPGA: Unable to connect FPGA ISR (%d)!\n",
				fpga_drv.pcidev->irq);
		return -EPERM;
	}

	return 0;
}

/* Interrupt Service Routine */
irqreturn_t fpga_isr(int irq, void *dev_id)
{
	uint32_t status =3D 0;

	status =3D fpga_drv.cfg_ptr[FPGA_INTER_STATUS];
	printk(KERN_NOTICE "FPGA: Interrupt fired! (%#08x)\n", status);
	if (status & FPGA_INTERRUPT_SPI)
	{
		rt_sem_v(&fpga_drv.sarSem);
	}

	/* Return HANDLED */
	return (IRQ_HANDLED);}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Interrupts not Firing on PPC405EX
  2009-11-05 20:37 Interrupts not Firing on PPC405EX Jonathan Haws
@ 2009-11-11  2:07 ` Tonyliu
  0 siblings, 0 replies; 2+ messages in thread
From: Tonyliu @ 2009-11-11  2:07 UTC (permalink / raw)
  To: Jonathan Haws; +Cc: linuxppc-dev@lists.ozlabs.org

Jonathan Haws wrote:
> All,
>
> I am having some troubles getting interrupts to fire from my kernel module.  I have connected the ISR with a call to request_irq() and have configured my device to generate interrupts.   However, my ISR is called once when I connect the interrupt for the first time.  After that it never is called again.  It seems like that interrupt is getting stuck disabled, but that does not make sense as to why.
>
> The device is on the PCIE0 bus and works just fine in another OS (namely Vxworks - that is the driver I am working on porting to Linux).
>
> Here is how I am connecting the ISR and the ISR itself.  Am I doing something stupid?
>
> Thanks for the help!
>
> Jonathan
>
> PS - Our hardware is a custom spun PPC405EX board based on the AMCC Kilauea board and uses the kilauea.dts with no modifications.
>
> A quick note - I realize that I am not checking if I was the one to interrupt the CPU.  I am not worried about that right now - especially since I know there is nothing else that will interrupt the CPU on this IRQ right now anyway - it never fires.
>
>
> int fpga_open(struct inode *inode, struct file *filp)
> {
> 	int err = 0;
>
> 	/* Make sure we have successfully probed the device */
> 	if (NULL == fpga_drv.pcidev)
> 	{
> 		return -ENODEV;
> 	}
>
> 	/* Only one process at a time can have access to the FPGA */
> 	if (0 != atomic_read(&fpga_drv.openCount))
> 	{
> 		atomic_inc(&fpga_drv.openCount);
> 		printk(KERN_WARNING "FPGA: Could not open device: already open. \n");
> 		return -EBUSY;
> 	}
>
> 	/* If not already in use, state that we are */
> 	atomic_inc(&fpga_drv.openCount);
>
> 	/* Store a pointer to the PCI device structure */
> 	filp->private_data = fpga_drv.pcidev;
>
> 	/* Attach ISR to IRQ */
> 	if (request_irq(fpga_drv.pcidev->irq, &fpga_isr, IRQF_SHARED,
> 			FPGA_MODULE_NAME, fpga_drv.pcidev))
> 	{
> 		printk( KERN_ERR "FPGA: Unable to connect FPGA ISR (%d)!\n",
> 				fpga_drv.pcidev->irq);
> 		return -EPERM;
> 	}
>
> 	return 0;
> }
>
> /* Interrupt Service Routine */
> irqreturn_t fpga_isr(int irq, void *dev_id)
> {
> 	uint32_t status = 0;
>
> 	status = fpga_drv.cfg_ptr[FPGA_INTER_STATUS];
>   
> 	printk(KERN_NOTICE "FPGA: Interrupt fired! (%#08x)\n", status);
> 	if (status & FPGA_INTERRUPT_SPI)
> 	{
> 		rt_sem_v(&fpga_drv.sarSem);
> 	}
>   
Your ISR registry and handling is fine. you mentioned that the IRQ only 
be trigged once.
Are you sure that nothing is needed to reenable the HW IRQ generation 
such as clear status bit ...
Is the algorithm in linux same with it in Vxworks?

Tony
> 	/* Return HANDLED */
> 	return (IRQ_HANDLED);}
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
>   


-- 
Tony Liu | Liu Bo
-------------------------------------------------------------
WIND RIVER | China Development Center
Tel: 86-10-8477-8542 ext: 8542 |  Fax: 86-10-64790367
(M): 86-136-7117-3612
Address: 15/F, Wangjing TowerB, Chaoyang District, Beijing, P.R.China

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-11  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-05 20:37 Interrupts not Firing on PPC405EX Jonathan Haws
2009-11-11  2:07 ` Tonyliu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.