Project

General

Profile

FPGA GPIO interrupt

Added by V J almost 7 years ago

Hello
In our design we need to generate a gpio interrupt in the fpga, catch it on the Linux side and execute various SW- actions.
We have a working ‘fpga gpio interrupt kernel module’ developed for another board, and we want to port it to the MitySom eval board.
However, we have run into some problems. One problem is that it seems that we are not able to transfer the fpga gpio interrupt to the Linux domain.

To figure out what the problem is we are trying to take it step by step:
Using the eval board’s original sdcard as reference, we have done some minor changes on the vhdl code to generate FPGA GPIO interrupts:
pio_3 has been changed to input and is connected to a vhdl signal generating a 1 sec interrupt toggle signal.
We have verified with a c-program that we can read the pio signals, and the pio_3 is toggling between 0 and 1 as it is supposed to.
When we enable the pio_3 irq mask, i.e. setting (ALT_LWFPGASLVS_OFST + PIO_0_BASE + 8) = 1, this line pops up in “/proc/interrupts”:

352:          1          0  altera-gpio   0

, but the interrupt counter is not incrementing (fixed = 1). Can anyone share some insight here?
We are FPGA engineers with somewhat limited Linux kernel knowledge, so any help would be greatly appreciated.

We are using the original dtb file.
The uboot and preloader have been updated as specified on the wiki page.
BR
Vidar


Replies (2)

RE: FPGA GPIO interrupt - Added by Daniel Vincelette almost 7 years ago

Hi Vidar,

Can you please post your updated dts and the source for the gpio driver?

Dan

RE: FPGA GPIO interrupt - Added by V J almost 7 years ago

Hi Dan
I have attached the kernel module we are trying to load, fpga_uinput.ko and the Makefile.
One thing we have not figured out is how the fpga gpio interrupts are mapped into the linux interrupts.
To make this work (on our previous Terasic eval board) we have first enabled the pio_3 irq mask and then checked /proc/interrupts to get the IRQ number (I suspect there is a much more elegant way to get this irq number).
Doing this on the MitySom board:

352:          1          0  altera-gpio   0

and then use this number to compile fpga_uinput.ko. E.g. :

#define UINPUT_INT_NUM 352

When loading the kernel module on the MitySom board:

insmod fpga_uinput.ko
insmod: ERROR: could not insert module fpga_uinput.ko: Device or resource busy

We are using the dtb file that came with the original sdcard. The attached dts file is regenerated from this dtb file.
Another thing I forgot to mention in my previous post is that we have recompiled the 3.16 kernel since we got a “version magic” issue when trying to load the kernel module using the original uImage.
BR
Vidar

    (1-2/2)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)