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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor apacker
Visitor
906 Views
Registered: ‎01-19-2018

PetaLinux Device Tree Generation

Hello,

 

I have a design for the MicroZed-7020 board, running PetaLinux 2018.1.  One of the IP's I use in my design is a copy of the Xilinx AXI UART 16550 IP that I hacked to add RS485 support.  The IP itself is working fine, but by default it shows up in the device tree generated by PetaLinux as a bare-bones node with none of the fields that PetaLinux somehow magically gives to an axi_uart_16550 IP, like the proper compatible string, interrupts, etc.  I can add these fields manually, but this feels kind of fragile.

 

My IP has no differences from the standard axi_uart_16550 IP that Linux needs to know about.  Is there some way to tell PetaLinux to just treat my IP as if it were an axi_uart_16550 IP?  I found the file /opt/petalinux/tools/hsm/data/embeddedsw/XilinxProcessorIPLib/drivers/uartns550_v3_5/data/uartns550.mdd, which has a line specifying that it supports the axi_uart16550 device, so I tried adding my IP name there, but it didn't seem to help.  I don't understand how all the device-tree magic for standard IP's happens, so I'm not really sure where to even look for a place to hook into it.  Any guidance would be appreciated.

 

Thanks!

 

Asa

0 Kudos
6 Replies
Observer shustik
Observer
857 Views
Registered: ‎07-14-2017

Re: PetaLinux Device Tree Generation

Hi, @apacker!

Use system-user.dtsi file to add/edit driver names your IP to device-tree. It's located at <your-prjct-dir>/project-spec/meta-user/recipes-bsp/device-tree/files/

Visitor apacker
Visitor
848 Views
Registered: ‎01-19-2018

Re: PetaLinux Device Tree Generation

Thanks @shustik, sorry I should have been more clear.  When I said I was adding the fields manually, I meant in the system-user.dtsi file.

 

The file I'm wondering about is <project dir>/components/plnx_workspace/device_tree/device_tree/pl.dtsi, which automatically shows up when I build my project.  If I have, for example, an AXI UART 16550 standard IP in my PL design, then that file has a fully-populated entry for the AXI UART 16550 instance, with the right clock, interrupts, etc already set.  For my modified UART IP, a node does also show up in that file, but it doesn't have any of that stuff.  Is there a way to trick PetaLinux into populating that node like it does for the standard UART IP?

0 Kudos
Visitor apacker
Visitor
798 Views
Registered: ‎01-19-2018

Re: PetaLinux Device Tree Generation

In case it helps someone else, the way I fixed this was simply to change the name of my modified IP.  Originally I called it "axi_uart_16550_rs485" because that was more descriptive.  But when I changed it to "axi_uart_16550", then PetaLinux seems to treat it like the standard one and populate the device tree node the same.

 

Specifically, I'm talking about the Vivado Package IP window, select "Identification" in the list of Packaging Steps on the left, and then set the "Name:" field in the right-hand part of the window.  Surprisingly, it doesn't seem to matter what vendor and library you set - PetaLinux seems to go off the name alone, not the full VLNV.

 

The corollary to this is, don't name your IP the same as any standard one if you *don't* want PetaLinux to treat it like the standard one!

0 Kudos
Moderator
Moderator
788 Views
Registered: ‎09-12-2007

Re: PetaLinux Device Tree Generation

The dtg will look for your ip in its repo to create node. So unless you create this, it would know what to do with your custom node.

Visitor apacker
Visitor
782 Views
Registered: ‎01-19-2018

Re: PetaLinux Device Tree Generation

Where is the best documentation about how to create the dtg repo stuff? Thanks!
0 Kudos
Moderator
Moderator
748 Views
Registered: ‎09-12-2007

Re: PetaLinux Device Tree Generation

Im not aware of any documents for this. However, you can take an example driver (axi gpio for example), and use this as reference.

The HSI API are discussed here:

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_1/ug1138-generating-basic-software-platforms.pdf

 

 

0 Kudos