Referring to Table 12-4 at page 2419, "Interrupt Mapping to the MPU
Subsystem", it says IRQ 29 is mapped to GPIO module 1; since the user
button stays in GPIO module 1, and that's how I got 29.
So my questions are:
1. What number should I put in the first argument? or which portion of
the technical reference should I refer to? I've been re-reading the
"Interrupt Controller" and "General-Purpose Interface" a few times,
but it doesn't seem to help...
2. Is there any examples out there for using interrupt on beagleboard-
I read the LDD3, and The Linux Kernel Module Programming Guide, I
understand the main flow of requesting interrupt, handling interrupt,
and scheduling the bottom halves, but they don't teach about how to
find the irq number...
What number should I put in the first argument? or which portion of
the technical reference should I refer to? I’ve been re-reading the
“Interrupt Controller” and “General-Purpose Interface” a few times,
but it doesn’t seem to help…
For omap platform code use OMAP_GPIO_IRQ() from arch/arm/plat-omap/include/plat/gpio.h
For platform independent code, use gpio_to_irq() from drivers/gpio/gpiolib.c
You can look at the code for OMAP_GPIO_IRQ to learn the details of how it all correlates to the TRM.
Is there any examples out there for using interrupt on beagleboard-
Yeah, try looking at the board-*.c files under arch/arm/mach-omap2, something similar such as board-omap3evm.c might be a good place to start.
After you get the system booted up, do cat /proc/interrupts and you see your interrupt there. The number will be the value from OMAP_GPIO_IRQ/gpio_to_irq and your string should match exactly.
Also, make sure you configure the pin you’re trying to use as a GPIO (aka MUXMODE_4). I also typically also do a gpio_request() to prevent userspace from mucking with the gpio. If you request the gpio, then you can view it via the gpio debugfs interface (make sure it’s compiled in to your kernel). Then mount (mount -t debugfs debugfs /sys/kernel/debug) it anywhere and then cat /sys/kernel/debug/gpio and you should see the direction (should be input for IRQs…), the value, and the IRQ details of that particular gpio. Also wrt debugfs, /sys/kernel/debug/omap_mux might be handy if you have OMAP_MUX_DEBUG compiled in to your kernel