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: 
Participant pgielmuda
Participant
1,235 Views
Registered: ‎10-18-2017

SPI enable for remoteproc

Jump to solution

Hi,

We are currently working with OpenAMP in the configuration where two OS talk to each other (Petalinux 2017.2 and FreeRTOS on ZCU102 board). FreeRTOS works on R5 and Petalinux works on A53. We are trying to use SPI0 on FreeRTOS. Whitout Linux SPI works well. Unfortunately, we can not write to SPI control registers when we runs FreeRTOS from Linux. 

I noticed in one version of ug1186 fallowing statement:

 

By default, power management (PM) is enabled in the Linux kernel configuration, and thus Linux can suspend its devices. When RPU is used and needs to access some device, you must do one of the following:

• Use isolation configuration in Vivado to setup subsystems. Note: This doesn't cover programmable logic (PL) devices; for those used by RPU you still need to disable them manually in the DTS.

• Manually disable devices owned by the RPU in the DTS.

 

It is for 2017.1 version but I assuming that if there is no version for 2017.2 this is valid document for 2017.2 version, isn't it?

 

I tried to disable SPI0 in device tree of Petalinux. I added:

&spi0{
    status = "disabled";
}; 

on the end of system-user.dtsi. I also disable &spi1 in the same way because I noticed alias:

spi0 = &qspi; 

in system-top.dts. However both options didn't work.

My question are:
- did I make it correctly?

- what could be a reason of SPI0 not working?

 

Currently I'm trying second solution (system splitting with Vivado) based on this page. However this option is much more complicated. I consider this option as less probable to work ;). 

 

 

0 Kudos
1 Solution

Accepted Solutions
Participant pgielmuda
Participant
1,609 Views
Registered: ‎10-18-2017

Re: SPI enable for remoteproc

Jump to solution

I found the solution.

When command:
petalinux-config --get-hw-description={path-to-hdf}

is executed to configure petalinux project with Vivado hardware definition file, not all of required files are replaced in linux components. There are 2 folders where hardware definition is not copied:

- <PROJ_DIR>/components/plnx_workspace/fsbl_hwproj

- <PROJ_DIR>/components/plnx_workspace/pmu-firmware_hwproj

So default hadware configuration is used, when making fsbl and pmu-firmware. It seems that this configuration stay in chip when linux is loaded. After manually updating those two location with new hdf and rebuilding linux (from scratch!), petalinux works as expected. 

 

This applies to petalinux 2017.2. I do not know if it was already fixed in newer version but maybe it should be.

0 Kudos
3 Replies
Moderator
Moderator
1,224 Views
Registered: ‎05-10-2017

Re: SPI enable for remoteproc

Jump to solution

That is the correct way to disable it. Decompile your final system.dtb in images/linux directory and make sure that it is disabled in your device-tree. Your spi0 set up should be taken care of by your RPU application. There should be no peripheral sharing between linux and RPU.

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Participant pgielmuda
Participant
1,200 Views
Registered: ‎10-18-2017

Re: SPI enable for remoteproc

Jump to solution

Thanks for replay

I decompile dtb and I have such definition of spi:

spi@ff040000 {

compatible = "cdns,spi-r1p6";
status = "disabled";
interrupt-parent = <0x00000004>;
interrupts = <0x00000000 0x00000010 0x00000000>;
reg = <0x00000000 0x00000003 0x636c6b00 0x00000004>;
clock-names = "ref_clk", "pclk";
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
power-domains = <0x00000027>;
clocks = <0x00000003 0x00000003 0x00000003 0x00000002>;
is-decoded-cs = <0x00000000>;
num-cs = <0x00000001>;

};

 

As you can see the SPI is disabled. However to run spi from FreeRTOS I need to do a one thing in Linux manually. I need to type:
devmem 0xFF5E0238 32 0x000100B0 
This clears SPI reset flag on RST_LPD_IOU2 register

Whats more to have SPI configure properly I also need to type in Linux:
devmem 0xFF5E007C 32 0x01031900

This set up SPI frequency clock to 10MHz.

 

I suppose this two things should be taken from Vivado system setup (*.hdf file). I'm sure that the frequency was set in Vivado. I'm also sure that I configure petalinux with proper hardware definition file (I double check that). However it seems that this has no influence to Petalinux configuration. 

 

For now it would be great to have some information how to modify device tree so that this two registers (at 0xFF5E0238  and 0xFF5E007C )  have proper values from linux startup. Any idea how to do that?

0 Kudos
Participant pgielmuda
Participant
1,610 Views
Registered: ‎10-18-2017

Re: SPI enable for remoteproc

Jump to solution

I found the solution.

When command:
petalinux-config --get-hw-description={path-to-hdf}

is executed to configure petalinux project with Vivado hardware definition file, not all of required files are replaced in linux components. There are 2 folders where hardware definition is not copied:

- <PROJ_DIR>/components/plnx_workspace/fsbl_hwproj

- <PROJ_DIR>/components/plnx_workspace/pmu-firmware_hwproj

So default hadware configuration is used, when making fsbl and pmu-firmware. It seems that this configuration stay in chip when linux is loaded. After manually updating those two location with new hdf and rebuilding linux (from scratch!), petalinux works as expected. 

 

This applies to petalinux 2017.2. I do not know if it was already fixed in newer version but maybe it should be.

0 Kudos