[PATCH 0/8] SUNIV SPI NAND support in SPL

Sam Edwards cfsworks at gmail.com
Mon Jun 5 23:03:15 CEST 2023


Hey hey Icenowy,

On 10/13/22 21:05, Icenowy Zheng wrote:
> This patchset tries to extend SPI-based boot code in sunxi SPL to
> support SPI NAND, following the same principle with current SPI NOR code
> (mimicking the behavior of sunxi BROM).

Thank you for your work on this patchset; it works great on T113 as 
well! Note that I have had to apply an extra patch to resolve a bootloop 
of "Unknown boot source 4" (find the patch below).

Also, since on both SUNXI and SUNIV the SPL knows whether it came from 
NOR or NAND, perhaps it would be better to break apart 
BOOT_DEVICE_SPI/spl_spi_load_image into specific NOR and NAND variants, 
as opposed to the current try-NAND-then-NOR approach?

Cheers (and thanks again),
Sam

--

diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
b/arch/arm/include/asm/arch-sunxi/spl.h
index 14944a20ea..703aa70a49 100644
--- a/arch/arm/include/asm/arch-sunxi/spl.h
+++ b/arch/arm/include/asm/arch-sunxi/spl.h
@@ -12,10 +12,11 @@
  #define SPL_ADDR		CONFIG_SUNXI_SRAM_ADDRESS

  /* The low 8-bits of the 'boot_media' field in the SPL header */
-#define SUNXI_BOOTED_FROM_MMC0	0
-#define SUNXI_BOOTED_FROM_NAND	1
-#define SUNXI_BOOTED_FROM_MMC2	2
-#define SUNXI_BOOTED_FROM_SPI	3
+#define SUNXI_BOOTED_FROM_MMC0		0
+#define SUNXI_BOOTED_FROM_NAND		1
+#define SUNXI_BOOTED_FROM_MMC2		2
+#define SUNXI_BOOTED_FROM_SPI		3
+#define SUNXI_BOOTED_FROM_SPI_NAND	4
  #define SUNXI_BOOTED_FROM_MMC0_HIGH	0x10
  #define SUNXI_BOOTED_FROM_MMC2_HIGH	0x12

diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index a48f5aaa05..9bbd0753e6 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -298,6 +298,7 @@ uint32_t sunxi_get_boot_device(void)
  	case SUNXI_BOOTED_FROM_MMC2_HIGH:
  		return BOOT_DEVICE_MMC2;
  	case SUNXI_BOOTED_FROM_SPI:
+	case SUNXI_BOOTED_FROM_SPI_NAND:
  		return BOOT_DEVICE_SPI;
  	}



More information about the U-Boot mailing list