Jump to content
  • 0

How to register my device as UIO on PetaLinux


izumitomonori

Question

Dear Experts,

Please let me ask for help about PetaLinux on ZYBO.

I tried to register my device as UIO at /sys/class/uio/uio* but failed. The procedure I did is in the followings. My HW module works fine via /dev/mem. But I can't find /sys/class/uio/uio*.

It would be much appreciated if you would give me any advices, comments and/or pointers.

Thanks in advance.

Best regards,
Tom IZUMI

----------------------------------------------------------------
[Board]
    Digilent ZYBO

[Design]
    ARM processor
      + Xilinx GPIO IP connected via AXIGP
      + my own module as user IP connected via AXIGP
    * LEDs, SWs, BTNs, simple counter, UART display for debugging
    * loopback connection via for test of my own module

[Tools]
    Vivado & SDK 2015.4 on Windows 10 Pro
    PetaLinux v2015.4 final on Ubuntu 14.04.4 LTS

----------------------------------------------------------------
1. Procedure with Vivado and SDK on Win10

On Vivado, I have integrated IPs including ARM, GPIO, my module and others by IP integrator. They are compiled with the top module and debugging peripherals to be a bitstream. The HW platform is imported in SDK. It seems to work fine with a test program in the 'standalone' mode. I also build the FSBL with the template in the 'standalone' mode.

I export the HW platform to Ubuntu PC equipped with PetaLinux.

----------------------------------------------------------------
2. Procedure with PetaLinux builder on Ubuntu14

% petalinux-create --type project --template zynq --name plhw2

    (cd Vivado's plhw2prj/plhw2prj.sdk/ZYBO_top_hw_platform_0/ including
        ZYBO_top.bit    ps7_init.c  ps7_init.html  ps7_init_gpl.c  system.hdf
        Zynq_PS_bd.tcl  ps7_init.h  ps7_init.tcl   ps7_init_gpl.h)
  
% petalinux-config --get-hw-description -p /home/izumi/pltest/plhw2/
    (proceed with default values)

    (cd petalinux project top plhw2/)
    (modify my module in ./subsystems/linux/configs/device-tree/pl.dtsi
    from

        rizm_axilite_fifo_0: rizm_axilite_fifo@43c00000 {
            compatible = "rizm_axilite_fifo";
            reg = <0x43c00000 0x10000>;
        };
    to
        rizm_axilite_fifo_0: rizm_axilite_fifo@43c00000 {
            compatible = "generic-uio";
            reg = <0x43c00000 0x10000>;
        };
    )

% petalinux-config -c kernel
    (set [Device Drivers] -> [Userspace I/O drivers] to <M>)
    (select [Userspace I/O platform driver with generic IRQ handling])

% petalinux-config -c rootfs
    (add some apps in [Filesystem Package] and [Apps] menu)

% petalinux-build

% petalinux-package --boot --fsbl ../plhw2prj/plhw2prj.sdk/fsbl/Debug/fsbl.elf --fpga ../plhw2prj/plhw2prj.sdk/ZYBO_top_hw_platform_0/ZYBO_top.bit --uboot
    (copy images/linux/{BOOT.BIN,image.ub} to microSD card)

----------------------------------------------------------------
3. Procedure on ZYBO with the above microSD

(Bootup PetaLinux and login as root)

root@plhw2:~# ls /sys/class/gpio/
export       gpiochip842  gpiochip874  gpiochip906  unexport
root@plhw2:~# gpio-demo -g 842 -o 0xaa
      :
(GPIOs seem to work fine with my debugging peripherals)

root@plhw2:~# ls /sys/class/uio
ls: /sys/class/uio: No such file or directory
root@plhw2:~# modprobe uio
root@plhw2:~# ls /sys/class/uio
(empty)
root@plhw2:~# lsmod
    Not tainted
uio 6934 0 - Live 0xbf058000
ipv6 256764 12 [permanent], Live 0xbf000000
root@plhw2:~# modprobe uio_pdrv_genirq
root@plhw2:~# lsmod
    Not tainted
uio_pdrv_genirq 2650 0 - Live 0xbf05e000
uio 6934 1 uio_pdrv_genirq, Live 0xbf058000
ipv6 256764 12 [permanent], Live 0xbf000000
root@plhw2:~# ls /sys/class/uio/
(empty)
root@plhw2:~# mdev -s
root@plhw2:~# ls /dev/*uio*
ls: /dev/*uio*: No such file or directory
 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

I think you need to override the petalinunx generated bootargs to include 

uio_pdrv_genirq.of_id="generic-uio"

I think you can do this from petalinux-config (with no '-c' option) in the Kernel  Bootargs menu. Make note of the auto generated bootargs, disable "generate boot args automatically", then set the "user set kernel bootargs" option to be whatever the auto generated bootargs were but with the string above appended. For my petalinux project this would make:

 console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id="generic-uio"

If that doesn't work, maybe try building the two UIO drivers into the kernel by using "y" instead of "m".

Link to comment
Share on other sites

Hi, sbobrowicz,

Thank you very much for your kind help and valuable comment.

That's it!

I have editted ./subsystems/linux/configs/device-tree/system-conf.dtsi as

    bootargs = "console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio";

and now I can control my HW module via /dev/uio0.

Best regards,
Tom IZUMI
 

Link to comment
Share on other sites

Hi @izumitomonori

  I did the same thing as you but i still can not see /dev/uio0.

After insmod i see that the probe function is called.

[  221.213493] <1>Hello module world.
[  221.216827] <1>Module parameters were (0xdeadbeef) and "default"
[  221.223040] driver-mihai 43c00000.accHW: Device Tree Probing
[  221.228672] driver-mihai 43c00000.accHW: no IRQ found
[  221.233652] driver-mihai 43c00000.accHW: driver-mihai at 0x43c00000 mapped to 0xe09a0000

Are there another changes that you have done besides bootargs = "console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio" in ./subsystems/linux/configs/device-tree/system-conf.dtsi or other file?

Regards,

Mihai

Link to comment
Share on other sites

Hi, Mihai

I think I have listed all I did in my report.

In my experience, details changes version by version.

If you would disclose the detailed versions of your PetaLinux and your environments,

some experts here may give you a hint.

Regards,

Tom IZUMI

13 hours ago, mihai5 said:

 

Link to comment
Share on other sites

Hi @izumitomonori

   I use Petalinux 2015.4 in ubuntu 16.04. One more question is that i have two interfaces in my hardware IP (one lite and one full, both memory mapped) and at probe function call i see just one conversion (phisical to virtual adresses) is shown. To see the other conversion i think that i have to add something in my probe function written in driver code, but i do not know how to get along with the other conversion. Please some advices.

Regards,

Mihai

Link to comment
Share on other sites

Hi Mihai,

Hmm, the detailed version is the same with me....

Do you mean two hardware modules for "two interfaces"?

Do you use the IP Integrator in Vivado?

If so, you should check the module name and addresses for the two in the IP Integrator tool and register both of them in pl.dtsi.

 

Regards,

Tom IZUMI

Link to comment
Share on other sites

If you have a single IP core with multiple AXI interfaces, you will need to make sure the "reg" line in your IP's device tree node declares both spaces:

reg = <addr1 size1 addr2 size2>

In newer versions of petalinux the devicetree generator automatically does this for you, so running petalinux-config --get-hw-description should automatically update pl.dtsi to include the proper reg declaration. I'm not sure if the version of the DTG in petalinux 2015.4 does this, so you might have to fix the reg line your self. 

With the proper reg line, you should see the driver get loaded for your IP core in /sys/class/uio/uio*. The multiple address spaces will show up as different maps in /sys/class/uio/uio*/maps/map*

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...