UPGRADE YOUR BROWSER
We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!
11-13-2017 12:48 AM
Hi,
I am trying to enable User space I/O driver (UIO driver) in Petalinux and access AXI GPIO from the UIO driver.
I want to know how to configure the petalinux kernel driver options for UIO and how to write the relevant device tree file.
Is there any document or guide to provide detailed procedures?
Thanks,
Regards,
Vincent
11-20-2017 05:04 PM
Hi,
Finally I figured out how to enable uio in petalinux:
kernel config:
Go to petalinux-config -c kernel
Device drivers
User space io drivers
<*> userspace io platform driver ..
check xilinx-zc706-2017.1/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user...cfg
CONFIG_UIO=y
CONFIG_UIO_PDRV=y
CONFIG_UIO_PDRV_GENIRQ=y
Device tree to override:
project-spec/meta-user/recipes-bsp/device-tree/files
add sample-user1.dtsi :
/ {
amba_pl: amba_pl {
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
ranges ;
axi_gpio_0: gpio@41200000 {
#gpio-cells = <2>;
compatible = "generic-uio";
gpio-controller ;
reg = <0x41200000 0x10000>;
xlnx,all-inputs = <0x0>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x1>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x00000000>;
xlnx,dout-default-2 = <0x00000000>;
xlnx,gpio-width = <0x4>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xFFFFFFFF>;
xlnx,tri-default-2 = <0xFFFFFFFF>;
};
};
};
11-13-2017 01:10 AM
Hi @vince2018,
the AXI GPIO has already a driver that allows you to read/write from userspace. Here is the wiki of Xilinx about it: http://www.wiki.xilinx.com/AXI+GPIO
This driver creates a device on
/sys/class/gpio
which you can read and write in order to interact with the GPIO. You can find on that website what to write in the device tree and how to configure it.
If you use UIO directly, you will have access to the registers of the GPIO from userspace, and you will have to configure it writing and reading the different registers, which is much more work and also a possible source of bugs. If you just want to control the GPIO from userspace, I recommend you to use its specific driver.
Regards,
Ignacio
11-13-2017 01:25 AM
Hi Vincent
Check to see if this link helps:-
http://svenand.blogdrive.com/archive/203.html#.WglkeVuCypo
Best Regards
Shabbir
11-13-2017 09:31 AM
11-20-2017 05:04 PM
Hi,
Finally I figured out how to enable uio in petalinux:
kernel config:
Go to petalinux-config -c kernel
Device drivers
User space io drivers
<*> userspace io platform driver ..
check xilinx-zc706-2017.1/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user...cfg
CONFIG_UIO=y
CONFIG_UIO_PDRV=y
CONFIG_UIO_PDRV_GENIRQ=y
Device tree to override:
project-spec/meta-user/recipes-bsp/device-tree/files
add sample-user1.dtsi :
/ {
amba_pl: amba_pl {
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
ranges ;
axi_gpio_0: gpio@41200000 {
#gpio-cells = <2>;
compatible = "generic-uio";
gpio-controller ;
reg = <0x41200000 0x10000>;
xlnx,all-inputs = <0x0>;
xlnx,all-inputs-2 = <0x0>;
xlnx,all-outputs = <0x1>;
xlnx,all-outputs-2 = <0x0>;
xlnx,dout-default = <0x00000000>;
xlnx,dout-default-2 = <0x00000000>;
xlnx,gpio-width = <0x4>;
xlnx,gpio2-width = <0x20>;
xlnx,interrupt-present = <0x0>;
xlnx,is-dual = <0x0>;
xlnx,tri-default = <0xFFFFFFFF>;
xlnx,tri-default-2 = <0xFFFFFFFF>;
};
};
};