I am trying some GPIO stuff on my soc board, and I found:
root@cyclone5:/sys/class/gpio# ls -l
total 0
–w------- 1 root root 4096 Jan 1 1970 export
lrwxrwxrwx 1 root root 0 Sep 1 14:32 gpiochip161 -> …/…/devices/virtual/gpio/gpiochip161
lrwxrwxrwx 1 root root 0 Sep 1 14:32 gpiochip165 -> …/…/devices/virtual/gpio/gpiochip165
lrwxrwxrwx 1 root root 0 Sep 1 14:32 gpiochip169 -> …/…/devices/virtual/gpio/gpiochip169
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip171 -> …/…/devices/sopc.0/ff70a000.gpio/gpio/gpiochip171
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip198 -> …/…/devices/sopc.0/ff709000.gpio/gpio/gpiochip198
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip227 -> …/…/devices/sopc.0/ff708000.gpio/gpio/gpiochip227
–w------- 1 root root 4096 Jan 1 1970 unexport
root@cyclone5:/sys/class/gpio# cd gpiochip161
root@cyclone5:/sys/class/gpio# ls
export gpiochip161 gpiochip165 gpiochip169 gpiochip171 gpiochip198 gpiochip227 unexport
root@cyclone5:/sys/class/gpio# cd gpiochip161
root@cyclone5:/sys/class/gpio/gpiochip161# ls
base label ngpio power subsystem uevent
root@cyclone5:/sys/class/gpio/gpiochip161# cat label
/sopc@0/bridge@0xc0000000/gpio@0x100010040
I am fine with the GPIO under HPS, but confused with the ones under FPGA:
I know the address 0x00010040 is assigned in Qsys for FPGA component, and where does the address 0x1 0000 0000 come from, and why is this value?
But in the “Lightweight HPS2FPGA Address Map” it says:
“The memory map of system peripherals in the FPGA portion of the SoC as viewed by the MPU, which starts at the lightweight HPS-to-FPGA base address 0xFF20_0000, is listed in the following table.”
The 0x1_0000_0000 is really not an address (kind of… it is an address offset with an index into the bridge number, but I’ve tried to explain below). There are ranges defined in the device tree for each soft IP core connected to the H2F and LW_H2F bridges. Here is an example device tree source snippet:
I’m struggeling with a problem with my minimal design using a pio and an uart only connected to the LW Hps2fpga.
Details of my system on alteraforum
Can i see somewhere in the linux if the ranges are correctly recognized by linux and the MMU programmed properly? Because im almost certain my design is correct, bridge handoff done properly etc. But as soon as i try to write to my mmapped() Pio the kernel just hangs.
I use a custom devicetree as the soc2fpga isnt working that great. I want to know if the kernel knows about my address space living behind the bridge
the device tree is in /proc folder
I did the example comming in the DE1-SoC documentation (called my first-hps-fpga) and it properly access FPGA peripheral using mmap. You can start from there.
Here I do mmap a memory in the address 0x00000000 of the HPS-FPGA bridge (Address 0xC0000000 for processor). You can take it as another example: https://github.com/robertofem/CycloneVSoC_Examples/tree/master/DE1-SoC/Linux_Applications/Test_DMA_PL330_LKM