All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] riscv: sifive/fu540: SPI boot
@ 2020-06-04 20:39 Jagan Teki
  2020-06-04 20:39 ` [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection Jagan Teki
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

Updated series with boot device detection directly
on spl_boot_device function instead of having separate
board driver.

Previous version changes are at [1].

Changes for v3:
- fixed env definitions build
- added boot device detection in board
Changes for v2:
- fu540 board driver
- runtime bootmode detection
- rebase on Pragnesh v11 series

[1] https://patchwork.ozlabs.org/project/uboot/cover/20200519192340.16624-1-jagan at amarulasolutions.com/

Any inputs?
Jagan.

Jagan Teki (6):
  sifive: fu540: Add runtime boot mode detection
  sifive: fu540: Add Booting from SPI
  env: Enable SPI flash env for SiFive FU540
  sifive: fu540: Mark the default env as SPI flash
  sifive: fu540: Add boot flash script offset, size
  sifive: fu540: Enable SF distro bootcmd

 arch/riscv/cpu/fu540/Kconfig                  | 15 +++++++
 .../dts/hifive-unleashed-a00-u-boot.dtsi      | 12 ++++++
 board/sifive/fu540/Kconfig                    |  1 +
 board/sifive/fu540/fu540.c                    | 25 ++++++++---
 configs/sifive_fu540_defconfig                |  4 ++
 doc/board/sifive/fu540.rst                    | 41 +++++++++++++++++++
 include/configs/sifive-fu540.h                |  7 +++-
 7 files changed, 98 insertions(+), 7 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
@ 2020-06-04 20:39 ` Jagan Teki
  2020-06-22 13:50   ` Bin Meng
  2020-06-04 20:39 ` [PATCH v3 2/6] sifive: fu540: Add Booting from SPI Jagan Teki
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

Add support to detect boot mode at runtime for
SiFive FU540 boards.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v3:
- new patch

 board/sifive/fu540/fu540.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c
index fa705dea71..a35b79ace3 100644
--- a/board/sifive/fu540/fu540.c
+++ b/board/sifive/fu540/fu540.c
@@ -10,6 +10,7 @@
 #include <env.h>
 #include <init.h>
 #include <log.h>
+#include <linux/bitops.h>
 #include <linux/bug.h>
 #include <linux/delay.h>
 #include <linux/io.h>
@@ -120,14 +121,26 @@ int board_init(void)
 }
 
 #ifdef CONFIG_SPL
+#define MODE_SELECT_REG		0x1000
+#define MODE_SELECT_QSPI	0x6
+#define MODE_SELECT_SD		0xb
+#define MODE_SELECT_MASK	GENMASK(3, 0)
+
 u32 spl_boot_device(void)
 {
-#ifdef CONFIG_SPL_MMC_SUPPORT
-	return BOOT_DEVICE_MMC1;
-#else
-	puts("Unknown boot device\n");
-	hang();
-#endif
+	u32 mode_select = readl((void *)MODE_SELECT_REG);
+	u32 boot_device = mode_select & MODE_SELECT_MASK;
+
+	switch (boot_device) {
+	case MODE_SELECT_QSPI:
+		return BOOT_DEVICE_SPI;
+	case MODE_SELECT_SD:
+		return BOOT_DEVICE_MMC1;
+	default:
+		debug("Unsupported boot device 0x%x but trying MMC1\n",
+		      boot_device);
+		return BOOT_DEVICE_MMC1;
+	}
 }
 #endif
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 2/6] sifive: fu540: Add Booting from SPI
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
  2020-06-04 20:39 ` [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection Jagan Teki
@ 2020-06-04 20:39 ` Jagan Teki
  2020-06-22 13:53   ` Bin Meng
  2020-06-04 20:39 ` [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540 Jagan Teki
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

Add booting from SPI for SiFive Unleashed board.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v3:
- updated based on master

 arch/riscv/cpu/fu540/Kconfig                  |  2 +
 .../dts/hifive-unleashed-a00-u-boot.dtsi      | 12 ++++++
 configs/sifive_fu540_defconfig                |  4 ++
 doc/board/sifive/fu540.rst                    | 41 +++++++++++++++++++
 4 files changed, 59 insertions(+)

diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig
index e9302e87c0..7a813a9ac8 100644
--- a/arch/riscv/cpu/fu540/Kconfig
+++ b/arch/riscv/cpu/fu540/Kconfig
@@ -5,6 +5,8 @@
 config SIFIVE_FU540
 	bool
 	select ARCH_EARLY_INIT_R
+	imply BOARD
+	imply BOARD_FU540
 	imply CPU
 	imply CPU_RISCV
 	imply RISCV_TIMER
diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
index 303806454b..4b2b242deb 100644
--- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
+++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
@@ -12,6 +12,10 @@
 		spi2 = &qspi2;
 	};
 
+	config {
+		u-boot,spl-payload-offset = <0x105000>; /* loader2 @1044KB */
+	};
+
 	hfclk {
 		u-boot,dm-spl;
 	};
@@ -22,6 +26,14 @@
 
 };
 
+&qspi0 {
+	u-boot,dm-spl;
+
+	flash at 0 {
+		u-boot,dm-spl;
+	};
+};
+
 &qspi2 {
 	mmc at 0 {
 		u-boot,dm-spl;
diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
index 8d412f8d6a..551d4b04a5 100644
--- a/configs/sifive_fu540_defconfig
+++ b/configs/sifive_fu540_defconfig
@@ -2,9 +2,11 @@ CONFIG_RISCV=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x3000
 CONFIG_ENV_SIZE=0x20000
+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
@@ -15,9 +17,11 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_SEPARATE_BSS=y
+CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_OF_BOARD_FIXUP=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
diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst
index f7c2c9f5bd..7a4b208288 100644
--- a/doc/board/sifive/fu540.rst
+++ b/doc/board/sifive/fu540.rst
@@ -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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
  2020-06-04 20:39 ` [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection Jagan Teki
  2020-06-04 20:39 ` [PATCH v3 2/6] sifive: fu540: Add Booting from SPI Jagan Teki
@ 2020-06-04 20:39 ` Jagan Teki
  2020-06-22 13:55   ` Bin Meng
  2020-06-04 20:39 ` [PATCH v3 4/6] sifive: fu540: Mark the default env as SPI flash Jagan Teki
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

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

 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 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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 4/6] sifive: fu540: Mark the default env as SPI flash
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
                   ` (2 preceding siblings ...)
  2020-06-04 20:39 ` [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540 Jagan Teki
@ 2020-06-04 20:39 ` Jagan Teki
  2020-06-22 13:56   ` Bin Meng
  2020-06-04 20:39 ` [PATCH v3 5/6] sifive: fu540: Add boot flash script offset, size Jagan Teki
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

Mark the default U-Boot environment as SPI flash since
this is an on board flash device.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v3:
- none

 board/sifive/fu540/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
index 86193d7668..e1ba629e37 100644
--- a/board/sifive/fu540/Kconfig
+++ b/board/sifive/fu540/Kconfig
@@ -27,6 +27,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
 	select SIFIVE_FU540
 	select SUPPORT_SPL
+	select ENV_IS_IN_SPI_FLASH
 	select RAM
 	select SPL_RAM if SPL
 	imply CMD_DHCP
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 5/6] sifive: fu540: Add boot flash script offset, size
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
                   ` (3 preceding siblings ...)
  2020-06-04 20:39 ` [PATCH v3 4/6] sifive: fu540: Mark the default env as SPI flash Jagan Teki
@ 2020-06-04 20:39 ` Jagan Teki
  2020-06-22 13:57   ` Bin Meng
  2020-06-04 20:39 ` [PATCH v3 6/6] sifive: fu540: Enable SF distro bootcmd Jagan Teki
  2020-06-11  9:59 ` [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
  6 siblings, 1 reply; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

HiFive-Unleashed-A00 has SPI flash with 32MiB size.
So, let's use the script offset at the end of 4K.
This way it cannot overlap any offsets being used
by software components in flash layout.

So, SF distrocmd will pick the script at desired
script address and run.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v3:
- none

 include/configs/sifive-fu540.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
index 72c841eb9b..68fda14d76 100644
--- a/include/configs/sifive-fu540.h
+++ b/include/configs/sifive-fu540.h
@@ -62,6 +62,8 @@
 	"kernel_addr_r=0x84000000\0" \
 	"fdt_addr_r=0x88000000\0" \
 	"scriptaddr=0x88100000\0" \
+	"script_offset_f=0x1fff000\0" \
+	"script_size_f=0x1000\0" \
 	"pxefile_addr_r=0x88200000\0" \
 	"ramdisk_addr_r=0x88300000\0" \
 	"type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 6/6] sifive: fu540: Enable SF distro bootcmd
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
                   ` (4 preceding siblings ...)
  2020-06-04 20:39 ` [PATCH v3 5/6] sifive: fu540: Add boot flash script offset, size Jagan Teki
@ 2020-06-04 20:39 ` Jagan Teki
  2020-06-22 14:01   ` Bin Meng
  2020-06-11  9:59 ` [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
  6 siblings, 1 reply; 16+ messages in thread
From: Jagan Teki @ 2020-06-04 20:39 UTC (permalink / raw)
  To: u-boot

Enable SPI flash(SF) distro boot command in Sifive FU540.

This distro boot will read the boot script at specific
location at the flash and start sourcing the same.

Included the SF device at the last of the target devices
list since all the rest of the devices on the list have
more possibility to boot the distribution due to the
size of the SPI flash is concern.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v3:
- none

 include/configs/sifive-fu540.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
index 68fda14d76..f21411a701 100644
--- a/include/configs/sifive-fu540.h
+++ b/include/configs/sifive-fu540.h
@@ -43,9 +43,11 @@
 #ifndef CONFIG_SPL_BUILD
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 0) \
+	func(SF, sf, 0) \
 	func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>
+#include <environment/distro/sf.h>
 
 #define TYPE_GUID_LOADER1	"5B193300-FC78-40CD-8002-E86C45580B47"
 #define TYPE_GUID_LOADER2	"2E54B353-1271-4842-806F-E436D6AF6985"
@@ -70,7 +72,8 @@
 	"type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
 	"type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \
 	"partitions=" PARTS_DEFAULT "\0" \
-	BOOTENV
+	BOOTENV \
+	BOOTENV_SF
 
 #define CONFIG_PREBOOT \
 	"setenv fdt_addr ${fdtcontroladdr};" \
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 0/6] riscv: sifive/fu540: SPI boot
  2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
                   ` (5 preceding siblings ...)
  2020-06-04 20:39 ` [PATCH v3 6/6] sifive: fu540: Enable SF distro bootcmd Jagan Teki
@ 2020-06-11  9:59 ` Jagan Teki
  6 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-06-11  9:59 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, Jun 5, 2020 at 2:10 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Updated series with boot device detection directly
> on spl_boot_device function instead of having separate
> board driver.
>
> Previous version changes are at [1].
>
> Changes for v3:
> - fixed env definitions build
> - added boot device detection in board
> Changes for v2:
> - fu540 board driver
> - runtime bootmode detection
> - rebase on Pragnesh v11 series
>
> [1] https://patchwork.ozlabs.org/project/uboot/cover/20200519192340.16624-1-jagan at amarulasolutions.com/
>
> Any inputs?
> Jagan.
>
> Jagan Teki (6):
>   sifive: fu540: Add runtime boot mode detection
>   sifive: fu540: Add Booting from SPI
>   env: Enable SPI flash env for SiFive FU540
>   sifive: fu540: Mark the default env as SPI flash
>   sifive: fu540: Add boot flash script offset, size
>   sifive: fu540: Enable SF distro bootcmd

Hope these will push for the release?

Jagan.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection
  2020-06-04 20:39 ` [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection Jagan Teki
@ 2020-06-22 13:50   ` Bin Meng
  0 siblings, 0 replies; 16+ messages in thread
From: Bin Meng @ 2020-06-22 13:50 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 5, 2020 at 4:40 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Add support to detect boot mode at runtime for
> SiFive FU540 boards.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v3:
> - new patch
>
>  board/sifive/fu540/fu540.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
>

Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 2/6] sifive: fu540: Add Booting from SPI
  2020-06-04 20:39 ` [PATCH v3 2/6] sifive: fu540: Add Booting from SPI Jagan Teki
@ 2020-06-22 13:53   ` Bin Meng
       [not found]     ` <752D002CFF5D0F4FA35C0100F1D73F3FA471F297@ATCPCS16.andestech.com>
  0 siblings, 1 reply; 16+ messages in thread
From: Bin Meng @ 2020-06-22 13:53 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 5, 2020 at 4:40 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Add booting from SPI for SiFive Unleashed board.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v3:
> - updated based on master
>
>  arch/riscv/cpu/fu540/Kconfig                  |  2 +
>  .../dts/hifive-unleashed-a00-u-boot.dtsi      | 12 ++++++
>  configs/sifive_fu540_defconfig                |  4 ++
>  doc/board/sifive/fu540.rst                    | 41 +++++++++++++++++++
>  4 files changed, 59 insertions(+)
>
> diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig
> index e9302e87c0..7a813a9ac8 100644
> --- a/arch/riscv/cpu/fu540/Kconfig
> +++ b/arch/riscv/cpu/fu540/Kconfig
> @@ -5,6 +5,8 @@
>  config SIFIVE_FU540
>         bool
>         select ARCH_EARLY_INIT_R
> +       imply BOARD
> +       imply BOARD_FU540

These 2 are not needed in v3.

>         imply CPU
>         imply CPU_RISCV
>         imply RISCV_TIMER
> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> index 303806454b..4b2b242deb 100644
> --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> @@ -12,6 +12,10 @@
>                 spi2 = &qspi2;
>         };
>
> +       config {
> +               u-boot,spl-payload-offset = <0x105000>; /* loader2 @1044KB */
> +       };
> +
>         hfclk {
>                 u-boot,dm-spl;
>         };
> @@ -22,6 +26,14 @@
>
>  };
>
> +&qspi0 {
> +       u-boot,dm-spl;
> +
> +       flash at 0 {
> +               u-boot,dm-spl;
> +       };
> +};
> +
>  &qspi2 {
>         mmc at 0 {
>                 u-boot,dm-spl;

Other than above,
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540
  2020-06-04 20:39 ` [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540 Jagan Teki
@ 2020-06-22 13:55   ` Bin Meng
  2020-06-22 13:57     ` Bin Meng
  0 siblings, 1 reply; 16+ messages in thread
From: Bin Meng @ 2020-06-22 13:55 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 5, 2020 at 4:41 AM Jagan Teki <jagan@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@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@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 4/6] sifive: fu540: Mark the default env as SPI flash
  2020-06-04 20:39 ` [PATCH v3 4/6] sifive: fu540: Mark the default env as SPI flash Jagan Teki
@ 2020-06-22 13:56   ` Bin Meng
  0 siblings, 0 replies; 16+ messages in thread
From: Bin Meng @ 2020-06-22 13:56 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 5, 2020 at 4:41 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Mark the default U-Boot environment as SPI flash since
> this is an on board flash device.
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v3:
> - none
>
>  board/sifive/fu540/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>

Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540
  2020-06-22 13:55   ` Bin Meng
@ 2020-06-22 13:57     ` Bin Meng
  0 siblings, 0 replies; 16+ messages in thread
From: Bin Meng @ 2020-06-22 13:57 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 22, 2020 at 9:55 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Fri, Jun 5, 2020 at 4:41 AM Jagan Teki <jagan@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@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@windriver.com>
> Tested-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 5/6] sifive: fu540: Add boot flash script offset, size
  2020-06-04 20:39 ` [PATCH v3 5/6] sifive: fu540: Add boot flash script offset, size Jagan Teki
@ 2020-06-22 13:57   ` Bin Meng
  0 siblings, 0 replies; 16+ messages in thread
From: Bin Meng @ 2020-06-22 13:57 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 5, 2020 at 4:41 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> HiFive-Unleashed-A00 has SPI flash with 32MiB size.
> So, let's use the script offset at the end of 4K.
> This way it cannot overlap any offsets being used
> by software components in flash layout.
>
> So, SF distrocmd will pick the script at desired
> script address and run.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v3:
> - none
>
>  include/configs/sifive-fu540.h | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 6/6] sifive: fu540: Enable SF distro bootcmd
  2020-06-04 20:39 ` [PATCH v3 6/6] sifive: fu540: Enable SF distro bootcmd Jagan Teki
@ 2020-06-22 14:01   ` Bin Meng
  0 siblings, 0 replies; 16+ messages in thread
From: Bin Meng @ 2020-06-22 14:01 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 5, 2020 at 4:41 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Enable SPI flash(SF) distro boot command in Sifive FU540.
>
> This distro boot will read the boot script at specific
> location at the flash and start sourcing the same.
>
> Included the SF device at the last of the target devices
> list since all the rest of the devices on the list have
> more possibility to boot the distribution due to the
> size of the SPI flash is concern.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v3:
> - none
>
>  include/configs/sifive-fu540.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 2/6] sifive: fu540: Add Booting from SPI
       [not found]     ` <752D002CFF5D0F4FA35C0100F1D73F3FA471F297@ATCPCS16.andestech.com>
@ 2020-06-29  6:29       ` Rick Chen
  0 siblings, 0 replies; 16+ messages in thread
From: Rick Chen @ 2020-06-29  6:29 UTC (permalink / raw)
  To: u-boot

Hi Jagan

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, June 22, 2020 9:53 PM
> To: Jagan Teki
> Cc: Rick Jian-Zhi Chen(???); Atish Patra; Palmer Dabbelt; Paul Walmsley; Anup Patel; Sagar Kadam; U-Boot Mailing List; linux-amarula
> Subject: Re: [PATCH v3 2/6] sifive: fu540: Add Booting from SPI
>
> On Fri, Jun 5, 2020 at 4:40 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > Add booting from SPI for SiFive Unleashed board.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> > Changes for v3:
> > - updated based on master
> >
> >  arch/riscv/cpu/fu540/Kconfig                  |  2 +
> >  .../dts/hifive-unleashed-a00-u-boot.dtsi      | 12 ++++++
> >  configs/sifive_fu540_defconfig                |  4 ++
> >  doc/board/sifive/fu540.rst                    | 41 +++++++++++++++++++
> >  4 files changed, 59 insertions(+)
> >
> > diff --git a/arch/riscv/cpu/fu540/Kconfig
> > b/arch/riscv/cpu/fu540/Kconfig index e9302e87c0..7a813a9ac8 100644
> > --- a/arch/riscv/cpu/fu540/Kconfig
> > +++ b/arch/riscv/cpu/fu540/Kconfig
> > @@ -5,6 +5,8 @@
> >  config SIFIVE_FU540
> >         bool
> >         select ARCH_EARLY_INIT_R
> > +       imply BOARD
> > +       imply BOARD_FU540
>
> These 2 are not needed in v3.

How is your opinion here ?

>
> >         imply CPU
> >         imply CPU_RISCV
> >         imply RISCV_TIMER
> > diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > index 303806454b..4b2b242deb 100644
> > --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > @@ -12,6 +12,10 @@
> >                 spi2 = &qspi2;
> >         };
> >
> > +       config {
> > +               u-boot,spl-payload-offset = <0x105000>; /* loader2 @1044KB */
> > +       };
> > +
> >         hfclk {
> >                 u-boot,dm-spl;
> >         };
> > @@ -22,6 +26,14 @@
> >
> >  };
> >
> > +&qspi0 {
> > +       u-boot,dm-spl;
> > +
> > +       flash at 0 {
> > +               u-boot,dm-spl;
> > +       };
> > +};
> > +
> >  &qspi2 {
> >         mmc at 0 {
> >                 u-boot,dm-spl;
>
> Other than above,
> Reviewed-by: Bin Meng <bin.meng@windriver.com>
> Tested-by: Bin Meng <bin.meng@windriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-06-29  6:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 20:39 [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki
2020-06-04 20:39 ` [PATCH v3 1/6] sifive: fu540: Add runtime boot mode detection Jagan Teki
2020-06-22 13:50   ` Bin Meng
2020-06-04 20:39 ` [PATCH v3 2/6] sifive: fu540: Add Booting from SPI Jagan Teki
2020-06-22 13:53   ` Bin Meng
     [not found]     ` <752D002CFF5D0F4FA35C0100F1D73F3FA471F297@ATCPCS16.andestech.com>
2020-06-29  6:29       ` Rick Chen
2020-06-04 20:39 ` [PATCH v3 3/6] env: Enable SPI flash env for SiFive FU540 Jagan Teki
2020-06-22 13:55   ` Bin Meng
2020-06-22 13:57     ` Bin Meng
2020-06-04 20:39 ` [PATCH v3 4/6] sifive: fu540: Mark the default env as SPI flash Jagan Teki
2020-06-22 13:56   ` Bin Meng
2020-06-04 20:39 ` [PATCH v3 5/6] sifive: fu540: Add boot flash script offset, size Jagan Teki
2020-06-22 13:57   ` Bin Meng
2020-06-04 20:39 ` [PATCH v3 6/6] sifive: fu540: Enable SF distro bootcmd Jagan Teki
2020-06-22 14:01   ` Bin Meng
2020-06-11  9:59 ` [PATCH v3 0/6] riscv: sifive/fu540: SPI boot Jagan Teki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.