Trenz Electronic GmbH Support Forum

Trenz Electronic Products => Trenz Electronic FPGA Modules => Topic started by: dambedei on January 10, 2019, 05:13:42 PM

Title: TE0726 Linux QSPI Flash programming
Post by: dambedei on January 10, 2019, 05:13:42 PM
Hi,

I'd like to update BOOT.bin on the QSPI from linux.
I tried to use the flashcp command as described here: https://forum.trenz-electronic.de/index.php/topic,302.msg990.html#msg990
However, I get the same mismatch error as described in the topic above:
# flashcp -v BOOT.bin /dev/mtd0                                                                                                                                                                                                                 
Erasing blocks: 664/664 (100%)
Writing data: 2653k/2653k (100%)
Verifying data: 10k/2653k (0%)File does not seem to match flash data. First mismatch at 0x00000000-0x00002800


After re-powering the board, it doesn't boot anymore. So I guess the BOOT.bin wasn't written to QSPI at all or is corrupted.
Flashing the BOOT.bin using Xilinx SDK makes it working again.

I'm using the same device tree entry as in the 2018.2 example:
/* QSPI PHY */
&qspi {
    #address-cells = <1>;
    #size-cells = <0>;
    status = "okay";
    flash0: flash@0 {
        compatible = "jedec,spi-nor";
        reg = <0x0>;
        #address-cells = <1>;
        #size-cells = <1>;
        spi-max-frequency = <50000000>;
        partition@0x00000000 {
            label = "boot";
            reg = <0x00000000 0x00500000>;
        };
        partition@0x00500000 {
            label = "bootenv";
            reg = <0x00500000 0x00020000>;
        };
        partition@0x00520000 {
            label = "kernel";
            reg = <0x00520000 0x00a80000>;
        };
        partition@0x00fa0000 {
            label = "spare";
            reg = <0x00fa0000 0x00000000>;
        };
    };
};


Flash seems to be detected correctly as shown in the boot log:
m25p80 spi0.0: non-uniform erase sector maps are not supported yet.                                                                                                                                                                                                             
m25p80 spi0.0: s25fl128s (16384 Kbytes)                                                                                                                                                                                                                                         
4 ofpart partitions found on MTD device spi0.0                                                                                                                                                                                                                                 
Creating 4 MTD partitions on "spi0.0":                                                                                                                                                                                                                                         
0x000000000000-0x000000500000 : "boot"                                                                                                                                                                                                                                         
0x000000500000-0x000000520000 : "bootenv"                                                                                                                                                                                                                                       
0x000000520000-0x000000fa0000 : "kernel"                                                                                                                                                                                                                                       
0x000000fa0000-0x000001000000 : "spare"


and also in /proc/mtd:
cat /proc/mtd                                                                                                                                                                                                                                                       
dev:    size   erasesize  name
mtd0: 00500000 00001000 "boot"
mtd1: 00020000 00001000 "bootenv"
mtd2: 00a80000 00001000 "kernel"
mtd3: 00060000 00001000 "spare"


I'm using petalinux 2018.1 to build all components.
Kernel version is 4.14.0-xilinx-v2018.1

Any ideas what might be wrong?
Thanks for your help in advance.

--
Best regards,

dambedei
Title: Re: TE0726 Linux QSPI Flash programming
Post by: Oleksandr Kiyenko on January 11, 2019, 11:57:46 AM
Hi,

flashcp command works not in all Linux versions and not with all flash chips, we will check if it works with Petalinux 2018.1 and a flash chip from TE0726.

Best regards
Oleksandr Kiyenko
Title: Re: TE0726 Linux QSPI Flash programming
Post by: JH on January 11, 2019, 12:26:53 PM
Hi,
can you try out all 18.2? Maybe it's a problem of 18.1 petalinux.

I found:

Xilinx has also some note on the Xilinx Wiki with ZC702, but they did not wrote which BSP version they have used for tests. Last wiki changes was done Sep 24, 2018, so maybe 18.2 from the date, 18.3 was released later.

br
John
Title: Re: TE0726 Linux QSPI Flash programming
Post by: dambedei on January 14, 2019, 07:03:49 PM
Hi John,

I cannot easily update to petalinux 2018.2 because support of hdf files is deprecated and I cannot create a dsa file.
However, I tried to replace the kernel used by petalinux 2018.1 with the kernel used by petalinux 2018.2.
But it seems that the kernel versions are identical (4.14.0). I guess there are only bug fixes but no version update (please correct me if I'm wrong).
And the problem is still the same with the 2018.2 version.
Also 2018.3 seems to use the same kernel version.

I also checked the links you provided. It seems that the problem is a little different and the versions mentioned in these topics are quite old.
I saw the Xilinx Wiki before I wrote this forum entry, but as you said, they do not mention which BSP or kernel version they used.

I just tried petalinux v2017.3 (which uses kernel version 4.9.0). This works!
Title: Re: TE0726 Linux QSPI Flash programming
Post by: dambedei on January 15, 2019, 02:51:06 PM
I created backport patches to the kernel used in petalinux 2017.4 for

and applied the patches as described here: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842475/PetaLinux+Yocto+Tips#PetaLinuxYoctoTips-PatchingtheLinuxKernelofaPetaLinuxProject
This fixed the problem for me.

Trying to find the patch which introduced the problem, but this might take some time...
Title: Re: TE0726 Linux QSPI Flash programming
Post by: JH on January 16, 2019, 08:34:15 AM
Hi,

thanks for posting this possible patch to solve this problem!

br
John