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!

Reply

Petalinux 2017.1 MTDUtils flashcp QSPI

Accepted Solution Solved
Highlighted
Adventurer
Posts: 73
Registered: ‎05-09-2016
Accepted Solution

Petalinux 2017.1 MTDUtils flashcp QSPI

Hi, I am hoping somebody has seen similar behaviour and has a possible solution:

I have QSPI flash attached to the Zynq from where my kernel images are booted.

 

In Petalinux 2016.4 I used the mtdutils flashcp function to program the images to the flash succesfully. Now with Petalinux2017.1 It seems the Image verification fails around the 8Mb mark for the images. (image size is ~16Mb).

 

I can program the images from U-boot, but it seems I can't boot them from flash from within u-boot, with u-boot hanging before the images are decompressed.

 

Any ideas welcome:) I will start moving to v2017.2 in the hope that some of these issues are resolved...


Accepted Solutions
Adventurer
Posts: 73
Registered: ‎05-09-2016

Re: Petalinux 2017.1 MTDUtils flashcp QSPI

A fault in the handling of the flash bank in the spi-nor driver caused that the erase and write of the flash failed whenever it went across 16M boundary. The variable containing the flash bank is only updated  in the beginning of the function, not upon each 4K sector write. I patched the driver by just copying the necessary parts from the 2016.4 version of spi-nor.c and fixing them to fit in with the rest of the driver.

I hope this is something Xilinx can look into and fix on driver level, or with an official patch.

View solution in original post


All Replies
Adventurer
Posts: 73
Registered: ‎05-09-2016

Re: Petalinux 2017.1 MTDUtils flashcp QSPI

[ Edited ]

Sanity checked with 2016.4 and I can succesfully write the flash using flashcp.

I upgrade mtdutils to version 2.0.0 as well.

 

Device Tree Binding:

		spi@e000d000 {
			clock-names = "ref_clk", "pclk";
			clocks = <0x1 0xa 0x1 0x2b>;
			compatible = "xlnx,zynq-qspi-1.0";
			status = "okay";
			interrupt-parent = <0x4>;
			interrupts = <0x0 0x13 0x4>;
			reg = <0xe000d000 0x1000>;
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			is-dual = <0x0>;
			num-cs = <0x1>;
			u-boot,dm-pre-reloc;

			flash@0 {
				compatible = "spansion,s25fl512s", "jedec,spi-nor";
				reg = <0x0>;
				#address-cells = <0x1>;
				#size-cells = <0x1>;
				spi-max-frequency = <0x2faf080>;

				partition@0x00000000 {
					label = "boot";
					reg = <0x0 0x80000>;
				};

			};

I can write the flash from U-boot as well, it's just in the linux environment.

 

EDIT: It also seems to break when the partition is crossing over 16MB, 32MB, 48MB... I'm not sure why this now an issue.

 

Adventurer
Posts: 73
Registered: ‎05-09-2016

Re: Petalinux 2017.1 MTDUtils flashcp QSPI

I have traced the problem to the spi-nor.c file where it seems a bank fault is created when the driver goes over a 16MB boundary.

 

I will look at possibly fixing the driver, but if someone knows of a patch/fix already for this, it would be great.

Adventurer
Posts: 73
Registered: ‎05-09-2016

Re: Petalinux 2017.1 MTDUtils flashcp QSPI

A fault in the handling of the flash bank in the spi-nor driver caused that the erase and write of the flash failed whenever it went across 16M boundary. The variable containing the flash bank is only updated  in the beginning of the function, not upon each 4K sector write. I patched the driver by just copying the necessary parts from the 2016.4 version of spi-nor.c and fixing them to fit in with the rest of the driver.

I hope this is something Xilinx can look into and fix on driver level, or with an official patch.

Visitor
Posts: 4
Registered: ‎09-14-2017

Re: Petalinux 2017.1 MTDUtils flashcp QSPI

Can you post the patch?  I believe I'm running into similar issues and fairly new to Petalinux, so any help is greatly appreciated.

 

I'm using the QSPI to store all binaries execpt for the uimage.ub, which is stored on the SD card due to QSPI limitations.  Below is my partition table and the issue i'm having is using flashcp (or cat) from linux to update qspi-bitsteam partition.  After successfully flashing the QSPI and booting into linux, i copy a bitstream.bin file generated from bootgen -split. 

 

Here are the errors:

root@xilinx-zc706-2017_2:~# flashcp system_top.bit.bin /dev/mtd1
system_top.bit.bin won't fit into /dev/mtd1!
root@xilinx-zc706-2017_2:~# cat system_top.bit.bin > /dev/mtd1
cat: write error: No space left on device

 

Here is my QSPI layout:

Creating 6 MTD partitions on "spi0.0":
0x000000000000-0x0000000e0000 : "qspi-fsbl"
0x0000000e0000-0x0000012a0000 : "qspi-bitstream"
0x0000012a0000-0x0000012c0000 : "qspi-ubootenv"
0x0000012c0000-0x0000014e0000 : "qspi-ubootbin"
0x0000014e0000-0x000001ee0000 : "qspi-config"
0x0000019e0000-0x000002000000 : "qspi-spare"