Hi,
I am working on the fsl P1020rdb kit with the 2.6.32 linux kernel that came with the kit and I am trying to get an GPIO to trigger an interrupt. I am fairly new and have been stumbling for quite a bit with no success so I am hoping some of you experts out there can give me some pointers. **What I have tried so far**: I am implementing the interrupt setup on my custom GPIO module during its init. I started following the information available in Linux Device Drivers, Third Edition but it turns out to be out of date or incompatible with the ppc platform. (The device tree, the hwirq to virq mapping... even though the number turns out to be the same for GPIO, etc.) Initially I was only calling request_irq but I got ENOSYS. That was solved by calling irq_create_mapping but then the module init was stuck at the request_irq (with the isr continuously being called.) That was resolved when I ended up using the device tree by calling irq_of_parse_and_map and using set_irq_handler before calling request_irq. Now the module successfully init and I can see the isr entry in /proc/interrupt but when I physically toggle my GPIO pin, the handler set by set_irq_handler was being called continuously (and then crash) while the isr set by request_irq was never called. Another thing I don't understand is that the /proc/interrupt entry say the gpio interrupt is OpenPIC Level when the GPIO interrupt is suppose to be edge only (either falling only or both.) My dts interrupt entry for the GPIO is <47 2>, which should indicates edge trigger right? **My questions**: What are the relationship between set_irq_handler, set_irq_type and request_irq? Are the first two supposed to be a replacement of the 3rd or are they suppose to be used concurrently? What are the differences between the handler set by set_irq_handler and the isr set by request_irq? Which one is called first? Or should only one of them get set at all time? (I was reading http://www.kernel.org/pub/linux/kernel/people/tglx/armirq/DocBook/index. html but I am still very confused.) Which signals are those IRQ type referring to? Are they referring to the triggering signal (GPIO in my case) or the PIC signal to the cpu core? What are the things I need to do in the IRQ handler/isr to terminate an interrupt? I know I need to clear the event register (which is GPIER in my case) which I have done but that didn't stop the handler from getting call again. Must I also disable the interrupt? For the isr set by request_irq, I also return IRQ_HANDLED... is that sufficient? For the handler set by set_irq_handler, do I need to call other handler? I noticed there are generic_handle_irq and handle_(level/edge, etc)_irq... am I suppose to call those to terminate an interrupt? I also noticed there are eoi() and end() in desc->chip. (I assume those are for the PIC)... am I suppose to call those as well? As you can see... I am very much confused and have lots of questions. Any help from you folks is much appreciated. Regards, Kenny Ho
_______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev