diff mbox series

[2/5] env: Enable SPI flash env for SiFive FU540

Message ID 20200420140514.25847-3-jagan@amarulasolutions.com
State New
Headers show
Series riscv: sifive/fu540: Booting from SPI | expand

Commit Message

Jagan Teki April 20, 2020, 2:05 p.m. UTC
SPI flash device on HiFive Unleashed has 32MiB Size.

This patch add 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

Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
 env/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bin Meng April 20, 2020, 2:35 p.m. UTC | #1
Hi Jagan,

On Mon, Apr 20, 2020 at 10:05 PM Jagan Teki <jagan at amarulasolutions.com> wrote:
>
> SPI flash device on HiFive Unleashed has 32MiB Size.
>
> This patch add 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
>
> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
> ---
>  env/Kconfig | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/env/Kconfig b/env/Kconfig
> index 0d6f559b39..67c88fd40b 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -500,6 +500,7 @@ config ENV_OFFSET
>         default 0 if ARC
>         default 0x140000 if ARCH_AT91
>         default 0x260000 if ARCH_OMAP2PLUS
> +       default 0x505000 if TARGET_SIFIVE_FU540
>         help
>           Offset from the start of the device (or partition)
>
> @@ -519,6 +520,7 @@ config ENV_SIZE
>         default 0x2000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
>         default 0x8000 if ARCH_ZYNQMP || ARCH_VERSAL
>         default 0x4000 if ARC
> +       default 0x20000 if TARGET_SIFIVE_FU540
>         default 0x1f000
>         help
>           Size of the environment storage area
> @@ -529,6 +531,7 @@ config ENV_SECT_SIZE
>         default 0x2000 if ARCH_ROCKCHIP
>         default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL
>         default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
> +       default 0x10000 if TARGET_SIFIVE_FU540
>         help
>           Size of the sector containing the environment.

We really should not touch the generic env/Kconfig file otherwise the
generic Kconfig will soon become unmaintainable.
Instead put it into either board specific Kconfig, or SoC specific
Kconfig. If this should be common layout for all SiFive FU540 SoCs, we
should put it under arch/riscv/cpu/fu540/Kconfig

Regards,
Bin
diff mbox series

Patch

diff --git a/env/Kconfig b/env/Kconfig
index 0d6f559b39..67c88fd40b 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -500,6 +500,7 @@  config ENV_OFFSET
 	default 0 if ARC
 	default 0x140000 if ARCH_AT91
 	default 0x260000 if ARCH_OMAP2PLUS
+	default 0x505000 if TARGET_SIFIVE_FU540
 	help
 	  Offset from the start of the device (or partition)
 
@@ -519,6 +520,7 @@  config ENV_SIZE
 	default 0x2000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
 	default 0x8000 if ARCH_ZYNQMP || ARCH_VERSAL
 	default 0x4000 if ARC
+	default 0x20000 if TARGET_SIFIVE_FU540
 	default 0x1f000
 	help
 	  Size of the environment storage area
@@ -529,6 +531,7 @@  config ENV_SECT_SIZE
 	default 0x2000 if ARCH_ROCKCHIP
 	default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL
 	default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
+	default 0x10000 if TARGET_SIFIVE_FU540
 	help
 	  Size of the sector containing the environment.