cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Explorer
Explorer
11,762 Views
Registered: ‎07-05-2017

How to modify device tree in petalinux 2017.3

Jump to solution

Hi,

I am trying to follow the Zynq Linux USB Device Driver at the wiki "http://www.wiki.xilinx.com/Zynq+Linux+USB+Device+Driver" and needed to modify the device driver. My project is based on the Petalinux 2017.3 and the project device tree is under:

 

<petalinux Project>/components/plnx_workspace/device-tree/device-tree-generation$

 

The files are:

system-top.dts

plnx_arm-system.dts

zynq-7000.dtsi

zedboard.dtsi

system-conf.dtsi

pl.dtsi

pcw.dtsi

 

 

The system-top.dts file looks like this:

 

/*
 * CAUTION: This file is automatically generated by Xilinx.
 * Version:  
 * Today is: Mon Apr 30 23:53:10 2018
 */


/dts-v1/;
/include/ "zynq-7000.dtsi"
/include/ "zedboard.dtsi"
/include/ "pl.dtsi"
/include/ "pcw.dtsi"
/ {
    chosen {
        bootargs = "earlycon";
        stdout-path = "serial0:115200n8";
    };
    aliases {
        ethernet0 = &gem0;
        serial0 = &uart1;
        serial1 = &axi_uart16550_0;
        spi0 = &qspi;
    };
    memory {
        device_type = "memory";
        reg = <0x0 0x20000000>;
    };
};
#include "system-user.dtsi"

 

 

 

after petalinux-build command, syestem.dtb is created under <petalinux Project>/image/linux/ directory.

 

looking at the Wiki at "http://www.wiki.xilinx.com/Zynq+Linux+USB+Device+Driver" I am not sure which device trees that I needed to modify, but I took a guess and modified

 

zedboard.dts, zynq-7000.dtsi, pcw.dtsi because all of them had usb0 definitions.  The basic modification was that I put in

for zedboard.dtsi

...

&usb0 {
    dr_mode = "peripheral";
    usb-phy = <&usb_phy0>;

 

};

 

The plnx_arm-system.dts

 

usb@e0002000 {
            compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
            status = "okay";
            clocks = <0x1 0x1c>;
            interrupt-parent = <0x4>;
            interrupts = <0x0 0x15 0x4>;
            reg = <0xe0002000 0x1000>;
            phy_type = "ulpi";
            dr_mode = "peripheral";
            usb-phy = <0x7>;
        };

 

 

The other ones I just changed the status = "okay" for the usb0 bus.

 

When I looked at the system.dtb after petalinux-build command, the dr_mode for the USB is still set to Host (dr_mode = "host";)

 

Does anyone know at what point modifying the device tree will take affect in the kernel build device tree?

 

I have attached the system.dtb and converted dts from <petalinux Project>/image/linux/ directory and the project device trees from <petalinux Project>/components/plnx_workspace/device-tree/device-tree-generation directory.

 

Thanks,

Aynilian

 

1 Solution

Accepted Solutions
Explorer
Explorer
12,195 Views
Registered: ‎07-05-2017

Hi I think I resolved this part of the puzzle.

 

The file to modify in petalinux 2017.3 project is <Petalinux Project> /project-spec/meta-user/recipes-bsp/device-tree/files/ system-usr.dtsi

 

Here is the modification:

 

/include/ "system-conf.dtsi"
/ {

usb_0: usb@e0002000 {
     compatible = "xlnx,zynq-usb-2.20.a", "chipidea,usb2";
     clocks = <0x1 0x1c>;
     interrupt-parent = <0x4>;
     interrupts = <0x0 0x15 0x4>;
     reg = <0xe0002000 0x1000>;
     phy_type = "ulpi";
    dr_mode = "peripheral";
    usb-phy = <0x7>;
        
     };
usb_phy_0: phy0 {
    compatible = "ulpi-phy";
    #phy-cells = <0>;
    reg = <0xe0002000 0x1000>;
    view-port = <0x170>;
    drv-vbus;
    linux,phandle = <0x7>;
    phandle = <0x7>;
   };
 
};

After petalinux-build command the system.dtb in <petalinux project>/image/linux/ , reflects the updated device tree.

View solution in original post

2 Replies
Explorer
Explorer
12,196 Views
Registered: ‎07-05-2017

Hi I think I resolved this part of the puzzle.

 

The file to modify in petalinux 2017.3 project is <Petalinux Project> /project-spec/meta-user/recipes-bsp/device-tree/files/ system-usr.dtsi

 

Here is the modification:

 

/include/ "system-conf.dtsi"
/ {

usb_0: usb@e0002000 {
     compatible = "xlnx,zynq-usb-2.20.a", "chipidea,usb2";
     clocks = <0x1 0x1c>;
     interrupt-parent = <0x4>;
     interrupts = <0x0 0x15 0x4>;
     reg = <0xe0002000 0x1000>;
     phy_type = "ulpi";
    dr_mode = "peripheral";
    usb-phy = <0x7>;
        
     };
usb_phy_0: phy0 {
    compatible = "ulpi-phy";
    #phy-cells = <0>;
    reg = <0xe0002000 0x1000>;
    view-port = <0x170>;
    drv-vbus;
    linux,phandle = <0x7>;
    phandle = <0x7>;
   };
 
};

After petalinux-build command the system.dtb in <petalinux project>/image/linux/ , reflects the updated device tree.

View solution in original post

Xilinx Employee
Xilinx Employee
5,688 Views
Registered: ‎11-05-2019

 

Hello,

 

This is a very easy-to-understand post.

 and this post was useful to make ZCU111's SI570 frequency the default.

 

Thank you.

0 Kudos
Reply