sifive: fu540: Add Booting from SPI
authorJagan Teki <jagan@amarulasolutions.com>
Wed, 15 Jul 2020 10:08:59 +0000 (15:38 +0530)
committerAndes <uboot@andestech.com>
Fri, 24 Jul 2020 06:55:19 +0000 (14:55 +0800)
Add booting from SPI for SiFive Unleashed board.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
configs/sifive_fu540_defconfig
doc/board/sifive/fu540.rst

index e037150..7d838bf 100644 (file)
                spi2 = &qspi2;
        };
 
+       config {
+               u-boot,spl-payload-offset = <0x105000>; /* loader2 @1044KB */
+       };
+
        hfclk {
                u-boot,dm-spl;
        };
 
 };
 
+&qspi0 {
+       u-boot,dm-spl;
+
+       flash@0 {
+               u-boot,dm-spl;
+       };
+};
+
 &qspi2 {
        mmc@0 {
                u-boot,dm-spl;
index 9e00a56..06e1786 100644 (file)
@@ -6,6 +6,7 @@ CONFIG_SPL_DM_SPI=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_SPL=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_TARGET_SIFIVE_FU540=y
 CONFIG_ARCH_RV64I=y
@@ -16,8 +17,11 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_SEPARATE_BSS=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_CLK=y
 CONFIG_DM_MTD=y
index 739eefa..1ce9ab1 100644 (file)
@@ -533,3 +533,44 @@ Sample boot log from HiFive Unleashed board
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
        type:   linux
        guid:   9faa81b6-39b1-4418-af5e-89c48f29c20d
+
+Booting from SPI
+----------------
+
+Use Building steps from "Booting from MMC using U-Boot SPL" section.
+
+Partition the SPI in Linux via mtdblock. (Require to boot the board in
+SD boot mode by enabling MTD block in Linux)
+
+Use prebuilt image from here [1], which support to partition the SPI flash.
+
+.. code-block:: none
+
+  # sgdisk --clear \
+  > --set-alignment=2 \
+  > --new=1:40:2087 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
+  > --new=2:2088:10279 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
+  > --new=3:10536:65494 --change-name=3:rootfs --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
+  > /dev/mtdblock0
+
+Program the SPI (Require to boot the board in SD boot mode)
+
+Execute below steps on U-Boot proper,
+
+.. code-block:: none
+
+  tftpboot $kernel_addr_r u-boot-spl.bin
+  sf erase 0x5000 $filesize
+  sf write $kernel_addr_r 0x5000 $filesize
+
+  tftpboot $kernel_addr_r u-boot.itb
+  sf erase 0x105000 $filesize
+  sf write $kernel_addr_r 0x105000 $filesize
+
+Power off the board
+
+Change DIP switches MSEL[3:0] are set to 0110
+
+Power up the board.
+
+[1] https://github.com/amarula/bsp-sifive