Trenz Electronic GmbH Support Forum

Trenz Electronic Products => Trenz Electronic FPGA Modules => Topic started by: jmccabe on November 11, 2019, 06:20:55 PM

Title: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 11, 2019, 06:20:55 PM
Hi,

Sorry for what is probably yet another noob question, but can someone give some advice or pointers or links on how to setup the device tree for the TE0720 board?

In the u-boot configuration (on Petalinux 2018.3) I haven't changed anything related to the device tree but it's got CONFIG_OF_CONTROL set ON and CONFIG_DEFAULT_DEVICE_TREE set to zynq-zc702.

I've got a PL design that has a Xilinx AXI Quad SPI IP block in it to control some additional SPI Flash devices but there doesn't seem to be any sign of it in u-boot, which is presumably due to the default device tree being one that doesn't seem to have much to do with the TE0720.

Any suggestions very gratefully appreciated.
John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: JH on November 12, 2019, 06:40:54 AM
Hi,
it doesn't exist a default device tree. device tree depends on your configuration. Parts of the device tree will generated automatically with your HDF import, parts must be modified by user.
I would recommend to start with our reference  design (includes also prebuilt Boot.bin and image.ub to start up the HW directly):
https://wiki.trenz-electronic.de/display/PD/TE0720+Test+Board
When this is running you add your changes.
We have an petalinux template design included and also documented all changes we  have done manually:
https://wiki.trenz-electronic.de/display/PD/TE0720+Test+Board#TE0720TestBoard-SoftwareDesign-PetaLinux

Why did you need the Xilinx AXI Quad SPI IP on the Zynq?

Here are some documents which maybe help:
General references to petalinux and device tree documentation:
    https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart#PetaLinuxKICKstart-References
Zynq TRM (to see how Zynq works):
    https://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf
Zynq drivers:
   https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841873/Linux+Drivers
   https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841745/Baremetal+Drivers+and+Libraries

br
John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 12, 2019, 08:59:35 AM
John,

First of all, thanks for your reply.

Quote from: JH on November 12, 2019, 06:40:54 AM
Hi,
it doesn't exist a default device tree. device tree depends on your configuration. Parts of the device tree will generated automatically with your HDF import, parts must be modified by user.
I would recommend to start with our reference  design (includes also prebuilt Boot.bin and image.ub to start up the HW directly):
https://wiki.trenz-electronic.de/display/PD/TE0720+Test+Board
When this is running you add your changes.
We have an petalinux template design included and also documented all changes we  have done manually:
https://wiki.trenz-electronic.de/display/PD/TE0720+Test+Board#TE0720TestBoard-SoftwareDesign-PetaLinux

One thing I noticed that I may not have made clear is that I'm specifically interested in the device tree for u-boot; I've already got all of the above (reference design starting with the pre-built stuff, going on to building it myself, modifying the design etc) working (with your help) in Linux, but I also need the additions to the PL to be accessible in u-boot.

Quote from: JH on November 12, 2019, 06:40:54 AM
Why did you need the Xilinx AXI Quad SPI IP on the Zynq?

We have some persistent data that may need to be erased very quickly. The 8MiB devices we're hanging off that IP have a typical chip erase time of 35ms (c.f. other, similar SPI NOR devices that are can be erased in ~17000ms).

Quote from: JH on November 12, 2019, 06:40:54 AM
Here are some documents which maybe help:
General references to petalinux and device tree documentation:
    https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart#PetaLinuxKICKstart-References
Zynq TRM (to see how Zynq works):
    https://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf
Zynq drivers:
   https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841873/Linux+Drivers
   https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841745/Baremetal+Drivers+and+Libraries

Thanks for those. Unfortunately I've been through most of them numerous times and they haven't helped me get much further with the u-boot side. I'll take another look at the Zynq TRM but the gist of it is that I'd like to use the same device tree in u-boot that I have working in Linux, but I'm confused about how to achieve that.

John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: JH on November 12, 2019, 09:25:14 AM
Hi,
which uboot configuration comes from device tree and which one from the config files depends a little bit on the uboot version and build environment you used.
I know, with petalinux you can modify uboot settings with
petalinux-config
petalinux-config -c u-boot
and on: recipes-bsp/u-boot/files/platform-top.h   --> in this case check also: platform-auto.h which included setup, which is generated automatically with the both config menu

--> At the end you must try out, check the uboot sources from Xilinx who it's implemented in uboot.

In case you didn't find a solution, you can also get low level reset with memory access. --> your IP is mapped in the ps memory space (see Vivado memory mapping (or BSP which is generated  your HDF) to get the correct offset). Control register on of your AXI IP are described in the IP documentation. Or you try to implement a baremetall access and add this code to the FSBL hooks (but pay attention, FSBL is starts in the OCM of the Zynq, so size for FSBL is limited).



PS: Also your FSBL must be know the AXI interfaces and PS-PL CLK setup you has used. --> so this must be also regenerated, when you has connect your IP to the PS-PL Axi interface.

br
John

Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 19, 2019, 03:34:58 PM
John

Thank you for your reply.

For what it's worth, I was having trouble understanding how the device tree was shared between Linux and u-boot; the configuration settings for u-boot seem to suggest they're not shared but your reply, and other comments I've now found appear to say that they are shared when built with Petalinux.

While this is probably true, it means there must be a different reason why I don't seem to be able to probe anything through the AXI Quad SPI IP!   :(

Thanks
John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: JH on November 19, 2019, 04:04:44 PM
Hi,
you must check uboot source code to know where it's come. --> depends a little bit from the xilinx implementation.
On petalinux part are used from the hdf import:
--> petalinux-config --get-hw-description   --> later only start with petalinux-config
--> platform-top.h --> user changes
--> petalinux-config -c u-boot  --> user changes
--> and as I know it can also happens that he use information from device tree during uboot generation step (not later).

and check also that you use correct fsbl and bitstream.
br
John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 19, 2019, 04:35:24 PM
It all works fine in Linux booted via the same FSBL -> u-boot and same bitstream.
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: JH on November 19, 2019, 04:41:57 PM
Hi,
check: --> petalinux-config -c u-boot
Normally QSPI on Zynq is used with PS QSPI controller, so it can happens that other option will not selected automatically. Or it's bug of the current uboot...
Maybe you should also try to write to Xilinx forum, it looks like a more general problem.

br
John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 19, 2019, 04:54:33 PM
Thanks for that suggestion; I have already posted on the Xilinx forum, but the response has not been very useful.

As for the "petalinux-config -c u-boot" suggestion, I've been through that multiple times and haven't managed to do anything different. There are a couple of combinations that I thought sounded like they might be useful, but they managed to stop u-boot from building.
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: JH on November 19, 2019, 04:58:52 PM
Hi,
maybe one last idea:
Disable QSPI interface on PS and generate hdf again. use this hdf for your petalinux project (maybe make a new clean project to be on the save side that petalinux use all your new configuration)
Maybe you can than select your AXI QSPI instead of PS QSPI.
br
John
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 19, 2019, 06:00:09 PM
That's a thought. It may be worth a try, but I need to be able to use both in the long run...
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: jmccabe on November 19, 2019, 06:10:07 PM
Here's where I asked about it in Xilinx's forums.

https://forums.xilinx.com/t5/Embedded-Linux/Is-there-an-AXI-Quad-SPI-IP-driver-in-u-boot/m-p/1038889
Title: Re: Need help configuring TE0720 U-Boot Device Tree
Post by: JH on November 20, 2019, 11:02:31 AM
Hi,
is it an option to for you to get access to your QSPI over FSBL? --> FSBL size is limited --> run on OCM  but maybe it's enough for your purpose.

or you do somthing like this:
https://forums.xilinx.com/t5/Processor-System-Design/Running-multiple-application-files-elf-from-single-boot-bin-on/td-p/773558
try to start 2 applications. one with barematel access to your QSPI on PL and the second one with uboot, which starts linux. --> reserve a little bit memory for your barmetal app to avoid conflicts
br
John