env: Enable SPI flash env for SiFive FU540
authorJagan Teki <jagan@amarulasolutions.com>
Wed, 15 Jul 2020 10:09:00 +0000 (15:39 +0530)
committerAndes <uboot@andestech.com>
Fri, 24 Jul 2020 06:55:19 +0000 (14:55 +0800)
SPI flash device on HiFive Unleashed has 32MiB Size.

This patch adds SPI flash environment after U-Boot proper
partition with a size of 128KiB.

SPI flash partition layout(32MiB):
    0 - 34 : reserved for GPT header
   35 - 39 : unused
   40 - 2087 : loader1 (SPL, FSBL)
 2088 - 10279 : loader2 (U-Boot proper, U-Boot)
10280 - 10535 : environment
10536 - 65494 : rootfs
65528 - 65536 : distro script

Note: the loader1 must start from 40th sector even though
there are 6 free sectors prior since 40th sector is nearest
flash sector boundary. 

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/cpu/fu540/Kconfig

index e9302e87c0d2e4029a92cc9eb230b618608d5eb6..2dcad8e27f7f069e925d14641d1197c9bf73841d 100644 (file)
@@ -13,3 +13,16 @@ config SIFIVE_FU540
        imply SPL_CPU_SUPPORT
        imply SPL_OPENSBI
        imply SPL_LOAD_FIT
+
+if ENV_IS_IN_SPI_FLASH
+
+config ENV_OFFSET
+       default 0x505000
+
+config ENV_SIZE
+       default 0x20000
+
+config ENV_SECT_SIZE
+       default 0x10000
+
+endif # ENV_IS_IN_SPI_FLASH