Jump to content

SPI flash boot doesn't work


jsorocil
Go to solution Solved by jsorocil,

Recommended Posts

On 12/23/2020 at 12:54 PM, Panzerknacker said:

Boot from SPI directly to NVME works:

 

Latest U-Boot v2021.01-rc4 + this patch:

rockchip: roc-pc-rk3399: fix boot from SPI flash on spi1

https://patchwork.kernel.org/project/linux-rockchip/list/?series=403611

 

To build uboot on roc-pc:

make roc-pc-mezzanine-rk3399_defconfig
make -j6
./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader-spi.img

 

To deploy uboot on spi:

dd if=idbloader-spi.img of=spi.img

                  (#0x60000 = 393216 = 4096 * 96)

dd if=u-boot.itb of=spi.img bs=4096 seek=96

flashcp -v spi.img /dev/mtd0

 

According to this, to run u-boot from flash I just need latest u-boot, apply patch from the link (CONFIG_SF_DEFAULT_BUS=1), copy config to .config, build it, flash it to SPI and it should work?

I did that and for my SOM-RK3399v2 (I have added SPI flash 16 MB chip to it), it starts to boot and it got stuck on line:

Trying to boot from SPI

 

I am trying for weeks, tried various .configs/OFFSets/various config options/printf debugging/... , various binary files (for RockPro64, PineBook Pro, Roc-PC, etc) and same error. U-boot flashed to SD/eMMC works. SPI flash works in Linux:

Quote

mtdinfo /dev/mtd0
mtd0
Name:                           spi0.0
Type:                           nor
Eraseblock size:                4096 bytes, 4.0 KiB
Amount of eraseblocks:          4096 (16777216 bytes, 16.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

 

Link to comment
Share on other sites

  • Solution

Finally found the problem - HW "issue". My SPI flash is not soldered (no place on motherboard) - it is connected with wires which are (presumably) too long. Workaround is to reduce SPI speed in u-boot and Linux.

 

U-boot:


diff --git a/arch/arm/dts/rk3399-rockpro64.dtsi b/arch/arm/dts/rk3399-rockpro64.dtsi
index 9bca258012..797dd80d38 100644
--- a/arch/arm/dts/rk3399-rockpro64.dtsi
+++ b/arch/arm/dts/rk3399-rockpro64.dtsi
@@ -677,7 +677,7 @@
        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
-               spi-max-frequency = <10000000>;
+               spi-max-frequency = <1000000>;
        };
 };

 

Linux:

Recompile your device tree with reduced SPI speed:


        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
-               spi-max-frequency = <10000000>;
+               spi-max-frequency = <1000000>;
        };

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines