Interrupt Handling

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

Interrupt Handling

1,463 Views
narreddisivapra
Contributor II

Hello,

            Can any one help in handling INTERRUPTS in MPC8323E-RDB Board.? I am using a PC with Ubuntu 8.10 with the kernel 2.6.27. I am loading a kernel image of version 2.6.20.6 into my development board. I am trying to writing a device driver for an external uart XR16L784 and able to access data read and write without IRQ Handler. Now I want to add IRQ Handler to access data in and out. I written a small piece of handler code but control is not going into IRQ Handler. Are there any settings required on either processor or external Uart side to set interrupts.? How to enable external interrupts in processor.? How to know my handler is called or not.? I already enabled interrupts in Uart control registers.

Please, respond as soon as possible.

Thanks and Regards,

Siva Prakash Reddy Narreddy

0 Kudos
3 Replies

1,070 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.

Look at also simple standalone example for external interrupt for the MPC83xx in the attached file..


Have a great day,
Pavel Chubakov

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

1,070 Views
narreddisivapra
Contributor II

Thanks for valuable reply. Can I directly edit the .dts file and how to build this modified dts file.? I am adding device driver for external device which is memory mapped to different location other than what the location mentioned in soc node in .dts file, then how can I add the node in dts file for external device.?

Please, rectify all the above mentioned doubts as soon as possible.

Thanks and Regards,

Siva Prakash Reddy Narreddy

0 Kudos

1,070 Views
narreddisivapra
Contributor II

Hello please respond as soon as possible to the above query and also this query too.

Why should I need to map IRQ num to virtual IRQ num.? All the materials I gone through, saying that use "request_irq()" directly. Can you please, explain this differentiation clearly and suggest related documents or Links.?

Please, Respond as soon as possible.

Thanks and Regards,

Siva Prakash Reddy N

0 Kudos