Forum Discussion
Altera_Forum
Honored Contributor
12 years agoGHRD interrupts
I would like to use the standard GHRD design to handle interrupt. It looks like the pushbutton interrupts are enabled in the Qsys design. I have no idea how to register a callback in Linux cod...
Altera_Forum
Honored Contributor
12 years agoI have the Arrow SoCkit, and I have been struggling with this for a while. I'm digging into the device tree for the arrow board posted on rocketboards, and I found an entry for the gpio's.
agpio0: gpio@0xc0000000 { compatible = "altr,pio-1.0"; /* Register base 0xff200000 is for a light-weight bridge */ reg = <0xff200000 0x10>; width = <32>; /* There are 64 interrupts from the FPGA start at 72, so 45 has to be wrong */ interrupts = <0 45 4>; interrupt-controller; # interrupt-cells = <1>; gpio-controller; # gpio-cells = <2>; level_trigger = <0>; I verified this is what the Linux kernel sees by looking in the folder at /proc/device-tree/soc/gpio@0xc0000000 I'm worried about the comment : /* There are 64 interrupts from the FPGA start at 72, so 45 has to be wrong */ I wonder why that has to be wrong? This looks different from the Altera boards device tree entry, which is: button_pio: gpio@0x100c0 { compatible = "ALTR,pio-13.0.1", "ALTR,pio-1.0", "altr,pio-1.0"; reg = < 0x000100C0 0x00000010 >; interrupt-parent = < &hps_0_arm_gic_0 >; interrupts = < 0 41 1 >; width = < 2 >; /* width type NUMBER */ resetvalue = < 0 >; /* resetValue type NUMBER */ level_trigger = < 0 >; /* embeddedsw.dts.params.level_trigger type NUMBER */ # gpio-cells = < 2 >; gpio-controller; }; //end gpio@0x100c0 (button_pio) This entry has quite few differences from the arrow version. I have tried following the example here: C:\altera\13.0sp1\embedded\examples\software\Altera-SoCFPGA-Push-Button-Linux-GNU.tar.gz I was able to build the gpio-interrupt driver in the example. I used the yocto project kernel headers for the altera board to build against. (Not sure if this was the right way to do this.) For the arrow board, when I insert the altera-gpio.ko kernel module, ( with 'modprobe gpio_altera'), I find gpiochip224 in /sys/class/gpio. The next step I did was insert the gpio-interrupt kernel module I built from the example with the command 'modprobe gpio_interrupt gpio_number=224' So I look at /proc/interrupts and I see this: CPU0 CPU1 525: 123056 121886 GIC twd 648: 1 0 GIC eth0 656: 1 0 GIC dwc_otg, dwc_otg_pcd, d 667: 2280 0 GIC dw-mci 679: 0 0 GIC ff705000.spi 682: 0 0 GIC dw_spi0 684: 0 0 GIC dw_spi1 686: 0 0 GIC ffc04000.i2c 687: 0 0 GIC ffc05000.i2c 690: 6879 0 GIC serial 697: 9 0 GIC timer2 752: 0 0 altera-gpio (null) IPI0: 0 0 CPU wakeup interrupts IPI1: 0 0 Timer broadcast interrupts IPI2: 1127 1196 Rescheduling interrupts IPI3: 0 0 Function call interrupts IPI4: 1 2 Single function call interrupts IPI5: 0 0 CPU stop interrupts Err: 0 There is an entry for the altera-gpio interrupt, but it does respond when I push the button (No updating /proc/interrupts, and no message in 'dmesg') The '(null)' after the interrupt is concerning. Any help is appreciated. Thanks.