Problem in using external interrupt in MPC 8323 RDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem in using external interrupt in MPC 8323 RDB

1,001 Views
gangadharrao
Contributor II

we are using MPC 8323 RDB board and loaded with Linux 2.6. Can anyone please verify the attached code and suggest what is going wrong with the code. 

Original Attachment has been moved to: led_mod.c.zip

0 Kudos
Reply
1 Reply

851 Views
Pavel
NXP Employee
NXP Employee

I can see the following interrupts on the MPC8323RDB board:

~ # cat /proc/interrupts

           CPU0

 16:        165   IPIC   Level     serial

 18:          0   IPIC   Level     i2c-mpc

 19:          0   IPIC   Level     ehci_hcd:usb1, ohci_hcd:usb2

 20:      13837   QEIC   Level     tdm

 21:          0   QEIC   Level     UCC Geth

 22:          0   QEIC   Level     mpc83xx_spi

 34:          0   QEIC   Level     UCC Geth

 

Look at recommendations below for the MPC823x_RDB LTIB Linux BSP.

Linux makes no difference between external and internal interrupts. All interrupts in the system are handled by the same Linux API. If this API didn't work, no driver in the system would be able to operate, not just your customer's module.

 

The customer is attempting to request an IRQ by the resource number which is generally incorrect. The resource number is an index to irq_desc table.

This index is generally _not_equal to the hardware IRQ line number. See Documentation/IRQ.txt for explanation.

To request an IRQ line in a proper way, the customer should:

 

  1. Declare the IRQ properly in the DTS. Refer to /Documentation/powerpc/booting-without-of.txt for details. The value of the "interrupt"

property is calculated by the following

   formula:

  

   [DTS_interrupt_number] = ([EIVPR/IIVPR_addr] - [Interrupt_Source_Configuration_Registers_Base]) / 0x20

 

                where [EIVPR/IIVPR_addr] is the address of the interrupt configuration registers

                of the IRQ being declared, [Interrupt_Source_Configuration_Registers_Base]

                is 0x50000 for P1010

  

  1. Request the interrupt property from the Open Firmware in the driver.

 

  1. Map the interrupt to the resource ID. This can be done by of_irq_to_resource() or by irq_of_parse_and_map().

  

  1. Request the interrupt by the resource number.

 

All steps above are performed by _any_ device driver in the system. Just look how it is done in e.g. drivers/net/gianfar.c or  drivers/spi/fsl_espi.c

and do the same in your code.

 

Look at also attached file. It is common method for interrupt handling under Linux.

Check your code using this document.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply