From patchwork Thu Jul 2 08:02:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 240604 List-Id: U-Boot discussion From: jagan at amarulasolutions.com (Jagan Teki) Date: Thu, 2 Jul 2020 13:32:59 +0530 Subject: [PATCH v4 3/6] env: Enable SPI flash env for SiFive FU540 In-Reply-To: <20200702080259.12417-1-jagan@amarulasolutions.com> References: <20200702080259.12417-1-jagan@amarulasolutions.com> Message-ID: <20200702080259.12417-2-jagan@amarulasolutions.com> 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 Reviewed-by: Bin Meng Tested-by: Bin Meng --- Changes for v4: - %s/add/adds arch/riscv/cpu/fu540/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig index e9302e87c0..2dcad8e27f 100644 --- a/arch/riscv/cpu/fu540/Kconfig +++ b/arch/riscv/cpu/fu540/Kconfig @@ -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