diff mbox series

[v3,3/6] env: Enable SPI flash env for SiFive FU540

Message ID 20200604203949.550290-4-jagan@amarulasolutions.com
State Superseded
Headers show
Series riscv: sifive/fu540: SPI boot | expand

Commit Message

Jagan Teki June 4, 2020, 8:39 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

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 at amarulasolutions.com>
---
Changes for v3:
- fixed build issues

 arch/riscv/cpu/fu540/Kconfig | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Bin Meng June 22, 2020, 1:55 p.m. UTC | #1
On Fri, Jun 5, 2020 at 4:41 AM 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
>
> 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 at amarulasolutions.com>
> ---
> Changes for v3:
> - fixed build issues
>
>  arch/riscv/cpu/fu540/Kconfig | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>

Reviewed-by: Bin Meng <bin.meng at windriver.com>
Tested-by: Bin Meng <bin.meng at windriver.com>
Bin Meng June 22, 2020, 1:57 p.m. UTC | #2
On Mon, Jun 22, 2020 at 9:55 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> On Fri, Jun 5, 2020 at 4:41 AM 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

Forgot to mention a nit:

add -> adds

> > 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 at amarulasolutions.com>
> > ---
> > Changes for v3:
> > - fixed build issues
> >
> >  arch/riscv/cpu/fu540/Kconfig | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
>
> Reviewed-by: Bin Meng <bin.meng at windriver.com>
> Tested-by: Bin Meng <bin.meng at windriver.com>
diff mbox series

Patch

diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig
index 7a813a9ac8..15698eaf65 100644
--- a/arch/riscv/cpu/fu540/Kconfig
+++ b/arch/riscv/cpu/fu540/Kconfig
@@ -15,3 +15,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