All of lore.kernel.org
 help / color / mirror / Atom feed
* [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP
@ 2026-10-29  0:15 E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 1/7] reduced SpacemiT K3 vendor BSP: use MKIMAGE build env E Shattow
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.

As of 2026 October there is initial SpacemiT K3 mainline U-Boot
support merged for U-Boot main app in the v2027.01 development cycle;
the vendor Board Support Package is used as an SPL to read DDR model
from EEPROM and then configure DDR before loading U-Boot main app.

Patches in reply to this cover letter are in support of the vendored
fork of U-Boot 2022.10 that we currently rely on for building the SPL.

Guidance how to build this to be continued in reply to this message...

E Shattow (7):
  reduced SpacemiT K3 vendor BSP: use MKIMAGE build env
  reduced SpacemiT K3 vendor BSP: add guards around config optioned k3.c
    code
  reduced SpacemiT K3 vendor BSP: add fallback fastboot buf addr and
    size def
  reduced SpacemiT K3 vendor BSP: force UART boot when YMODEM_SUPPORT
    enabled
  reduced SpacemiT K3 vendor BSP: add UART SPI defconfig
  reduced SpacemiT K3 vendor BSP: add UART (no SPI) defconfig
  reduced SpacemiT K3 vendor BSP: set uart compatible for mainline
    OpenSBI

 arch/riscv/dts/k3.dtsi                   |  2 +-
 board/spacemit/k3/config.mk              | 12 ++---
 board/spacemit/k3/k3.c                   | 28 +++++++++++
 board/spacemit/k3/spl.c                  |  8 ++++
 configs/spacemit_k3_uart_nospi_defconfig | 44 +++++++++++++++++
 configs/spacemit_k3_uart_spi_defconfig   | 61 ++++++++++++++++++++++++
 include/configs/k3.h                     |  8 ++++
 7 files changed, 153 insertions(+), 10 deletions(-)
 create mode 100644 configs/spacemit_k3_uart_nospi_defconfig
 create mode 100644 configs/spacemit_k3_uart_spi_defconfig


base-commit: 289dc2b7bd25bf9d88ce9e7e263e95234868ca14
-- 
2.53.0


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

* [DNM PATCH v1 1/7] reduced SpacemiT K3 vendor BSP: use MKIMAGE build env
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 2/7] reduced SpacemiT K3 vendor BSP: add guards around config optioned k3.c code E Shattow
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.
---
 board/spacemit/k3/config.mk | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/board/spacemit/k3/config.mk b/board/spacemit/k3/config.mk
index bb8657ad0247..db871c53047b 100755
--- a/board/spacemit/k3/config.mk
+++ b/board/spacemit/k3/config.mk
@@ -74,13 +74,7 @@ endif
 u-boot.itb: u-boot-nodtb.bin u-boot-dtb.bin u-boot.dtb FORCE
 	$(call if_changed,build_itb,$@,$(its),$(key_para))
 
-ifneq ($(CONFIG_SPL_BUILD),)
-INPUTS-y += FSBL.bin
+MKIMAGE := tools/mkimage
+spl/u-boot-spl-mkimage.bin: spl/u-boot-spl.bin
+	${MKIMAGE} -T smtimage -n k3 -d $< $@
 
-FSBL.bin: spl/u-boot-spl.bin FORCE
-	$(call if_changed,build_spl_platform,$@,$<)
-else
-INPUTS-y += u-boot-env-default.bin
-u-boot-env-default.bin: u-boot-nodtb.bin FORCE
-	$(call if_changed,build_default_env,$@)
-endif
-- 
2.53.0


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

* [DNM PATCH v1 2/7] reduced SpacemiT K3 vendor BSP: add guards around config optioned k3.c code
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 1/7] reduced SpacemiT K3 vendor BSP: use MKIMAGE build env E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 3/7] reduced SpacemiT K3 vendor BSP: add fallback fastboot buf addr and size def E Shattow
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.
---
 board/spacemit/k3/k3.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/board/spacemit/k3/k3.c b/board/spacemit/k3/k3.c
index 40b7720eee6d..a06db6f3ffd6 100644
--- a/board/spacemit/k3/k3.c
+++ b/board/spacemit/k3/k3.c
@@ -421,6 +421,7 @@ static ulong read_boot_storage_emmc(ulong byte_addr, ulong byte_size, void* buff
 }
 #endif
 
+#if CONFIG_IS_ENABLED(SPI_FLASH)
 static ulong read_boot_storage_spinor(ulong byte_addr, ulong byte_size, void* buff)
 {
 	struct udevice *dev;
@@ -434,6 +435,7 @@ static ulong read_boot_storage_spinor(ulong byte_addr, ulong byte_size, void* bu
 		return 0;
 	}
 }
+#endif
 
 #if CONFIG_IS_ENABLED(SCSI)
 static ulong read_boot_storage_ufs(ulong byte_addr, ulong byte_size, void* buff)
@@ -450,7 +452,9 @@ static const struct boot_storage_op storage_op[] = {
 #if CONFIG_IS_ENABLED(MMC)
 	{ BOOT_MODE_EMMC, 0x140000, read_boot_storage_emmc, NULL },
 #endif
+#if CONFIG_IS_ENABLED(SPI_FLASH)
 	{ BOOT_MODE_NOR, 0x10000, read_boot_storage_spinor, NULL },
+#endif
 #if CONFIG_IS_ENABLED(SCSI)
 	{ BOOT_MODE_UFS, 0x140000, read_boot_storage_ufs, NULL },
 #endif
@@ -482,6 +486,7 @@ static bool write_boot_storage_emmc(ulong byte_addr, ulong byte_size, void* buff
 }
 #endif
 
+#if CONFIG_IS_ENABLED(SPI_FLASH)
 static bool write_boot_storage_spinor(ulong byte_addr, ulong byte_size, void* buff)
 {
 	struct udevice *dev;
@@ -497,6 +502,7 @@ static bool write_boot_storage_spinor(ulong byte_addr, ulong byte_size, void* bu
 	} else
 		return false;
 }
+#endif
 
 #if CONFIG_IS_ENABLED(SCSI)
 static bool write_boot_storage_ufs(ulong byte_addr, ulong byte_size, void* buff)
@@ -510,7 +516,9 @@ static const struct boot_storage_op storage_op[] = {
 #if CONFIG_IS_ENABLED(MMC)
 	{ BOOT_MODE_EMMC, 0x140000, read_boot_storage_emmc, write_boot_storage_emmc },
 #endif
+#if CONFIG_IS_ENABLED(SPI_FLASH)
 	{ BOOT_MODE_NOR, 0x10000, read_boot_storage_spinor, write_boot_storage_spinor },
+#endif
 #if CONFIG_IS_ENABLED(SCSI)
 	{ BOOT_MODE_UFS, 0x140000, read_boot_storage_ufs, write_boot_storage_ufs },
 #endif
@@ -707,7 +715,11 @@ uint32_t get_serial_number(char *sn, uint32_t max_size)
 			if ((0 != ret) || (0 == chipid)) {
 				seed = get_ticks();
 				for (i = 0; i < sizeof(chipid); i++) {
+#if IS_ENABLED(LIB_RAND)
 					((uint8_t*)&chipid)[i] = rand_r(&seed);
+#else
+					((uint8_t*)&chipid)[i] = 0;
+#endif
 				}
 			}
 			snprintf(temp, sizeof(temp), "%016llx", chipid);
@@ -748,7 +760,11 @@ void set_dev_serial_no(void)
 
 int board_init(void)
 {
+#if defined(CONFIG_DM_REGULATOR_SPM8XX) \
+|| CONFIG_IS_ENABLED(ESPI) \
+|| CONFIG_IS_ENABLED(RT7451_RETIMER)
 	int ret = 0;
+#endif
 
 #if CONFIG_IS_ENABLED(RT7451_RETIMER)
 	struct udevice *dev;
@@ -787,12 +803,15 @@ int board_init(void)
 
 void get_reboot_config(void)
 {
+#if CONFIG_IS_ENABLED(DM_PMIC)
 	int ret;
 
 	struct udevice *dev;
 	uint8_t value;
+#endif
 	reboot_config = get_boot_mode();
 
+#if CONFIG_IS_ENABLED(DM_PMIC)
 	ret = uclass_get_device_by_driver(UCLASS_PMIC,
 			DM_DRIVER_GET(spacemit_pm8xx), &dev);
 	if (ret) {
@@ -818,6 +837,7 @@ void get_reboot_config(void)
 		pr_err("spacemit reboot: PMIC write failed\n");
 		return;
 	}
+#endif
 }
 
 void run_fastboot_command(void)
@@ -1717,10 +1737,16 @@ void set_env_ethaddr(void)
 		return;
 	}
 
+#if IS_ENABLED(NET_RANDOM_ETHADDR)
 	/*if there is NO valid MAC address, create 4 random ethaddr */
 	maccount = 4;
 	pr_info("generate %d random ethaddr.\n", maccount);
 	net_random_ethaddr(mac_addr);
+#else
+	mac_addr[3] = 0;
+	mac_addr[4] = 0;
+	mac_addr[5] = 0;
+#endif
 	mac_addr[0] = 0xfe;
 	mac_addr[1] = 0xfe;
 	mac_addr[2] = 0xfe;
@@ -1911,6 +1937,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 	__maybe_unused struct fdt_memory mem;
 	int ret;
 
+#if CONFIG_IS_ENABLED(DM_VIDEO)
 	if (CONFIG_IS_ENABLED(FDT_SIMPLEFB)) {
 		/* reserved with no-map tag the video buffer */
 		mem.start = gd->video_bottom;
@@ -1918,6 +1945,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 
 		fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL, 0);
 	}
+#endif
 
 	ft_board_cpu_fixup(blob, bd);
 	ft_board_info_fixup(blob, bd);
-- 
2.53.0


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

* [DNM PATCH v1 3/7] reduced SpacemiT K3 vendor BSP: add fallback fastboot buf addr and size def
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 1/7] reduced SpacemiT K3 vendor BSP: use MKIMAGE build env E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 2/7] reduced SpacemiT K3 vendor BSP: add guards around config optioned k3.c code E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 4/7] reduced SpacemiT K3 vendor BSP: force UART boot when YMODEM_SUPPORT enabled E Shattow
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.
---
 include/configs/k3.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/configs/k3.h b/include/configs/k3.h
index 7183a4e8fdb8..d3de233b1736 100644
--- a/include/configs/k3.h
+++ b/include/configs/k3.h
@@ -8,6 +8,14 @@
 
 #include <linux/sizes.h>
 
+#ifndef CONFIG_FASTBOOT_BUF_ADDR
+#define CONFIG_FASTBOOT_BUF_ADDR	0x140000000
+#endif
+
+#ifndef CONFIG_FASTBOOT_BUF_SIZE
+#define CONFIG_FASTBOOT_BUF_SIZE	0x20000000
+#endif
+
 #define PHY_ANEG_TIMEOUT		20000
 
 #define SZ_1MB				0x00100000
-- 
2.53.0


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

* [DNM PATCH v1 4/7] reduced SpacemiT K3 vendor BSP: force UART boot when YMODEM_SUPPORT enabled
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
                   ` (2 preceding siblings ...)
  2026-10-29  0:15 ` [DNM PATCH v1 3/7] reduced SpacemiT K3 vendor BSP: add fallback fastboot buf addr and size def E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 5/7] reduced SpacemiT K3 vendor BSP: add UART SPI defconfig E Shattow
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.
---
 board/spacemit/k3/spl.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/spacemit/k3/spl.c b/board/spacemit/k3/spl.c
index 522f3977c485..8f640f1affcb 100644
--- a/board/spacemit/k3/spl.c
+++ b/board/spacemit/k3/spl.c
@@ -867,8 +867,13 @@ void board_boot_order(u32* spl_boot_list)
 	u32 boot_mode = get_boot_mode();
 	pr_debug("boot_mode:0x%x\n", boot_mode);
 	if (boot_mode == BOOT_MODE_USB) {
+#if CONFIG_IS_ENABLED(YMODEM_SUPPORT)
+		spl_boot_list[0] = BOOT_DEVICE_UART;
+		spl_boot_list[1] = BOOT_DEVICE_RAM;
+#else
 		update_usb_serial_number();
 		spl_boot_list[0] = BOOT_DEVICE_BOARD;
+#endif /* CONFIG_IS_ENABLED(YMODEM_SUPPORT) */
 	} else {
 		switch (boot_mode) {
 		case BOOT_MODE_SD:
@@ -883,6 +888,9 @@ void board_boot_order(u32* spl_boot_list)
 		case BOOT_MODE_NOR:
 			spl_boot_list[0] = BOOT_DEVICE_NOR;
 			break;
+		case BOOT_MODE_UART:
+			spl_boot_list[0] = BOOT_DEVICE_UART;
+			break;
 		case BOOT_MODE_UFS:
 			spl_boot_list[0] = BOOT_DEVICE_UFS;
 			break;
-- 
2.53.0


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

* [DNM PATCH v1 5/7] reduced SpacemiT K3 vendor BSP: add UART SPI defconfig
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
                   ` (3 preceding siblings ...)
  2026-10-29  0:15 ` [DNM PATCH v1 4/7] reduced SpacemiT K3 vendor BSP: force UART boot when YMODEM_SUPPORT enabled E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 6/7] reduced SpacemiT K3 vendor BSP: add UART (no SPI) defconfig E Shattow
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.

Minimize config to only YMODEM load and SPI as new defconfig
---
 configs/spacemit_k3_uart_spi_defconfig | 61 ++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 configs/spacemit_k3_uart_spi_defconfig

diff --git a/configs/spacemit_k3_uart_spi_defconfig b/configs/spacemit_k3_uart_spi_defconfig
new file mode 100644
index 000000000000..734df7eba4ca
--- /dev/null
+++ b/configs/spacemit_k3_uart_spi_defconfig
@@ -0,0 +1,61 @@
+CONFIG_RISCV=y
+CONFIG_SYS_TEXT_BASE=0x102000000
+CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_SYS_MALLOC_F_LEN=0x80000
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_ENV_SIZE=0x4000
+CONFIG_ENV_OFFSET=0xA0000
+CONFIG_SPL_DM_SPI=y
+CONFIG_DEFAULT_DEVICE_TREE="k3_spl"
+CONFIG_SPL_TEXT_BASE=0xc0801000
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_SIZE_LIMIT=0x72F00
+CONFIG_SPL=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
+CONFIG_SYS_LOAD_ADDR=0x102000000
+CONFIG_TARGET_SPACEMIT_K3=y
+CONFIG_SPL_OPENSBI_LOAD_ADDR=0x100000000
+CONFIG_K3_BOARD_ASIC=y
+CONFIG_ARCH_RV64I=y
+CONFIG_RISCV_SMODE=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x102300000
+CONFIG_STACK_SIZE=0x100000
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT_ADDRESS=0x140000000
+CONFIG_LOGLEVEL=6
+CONFIG_SPL_MAX_SIZE=0x70F00
+CONFIG_SPL_PAD_TO=0x0
+CONFIG_SPL_BSS_START_ADDR=0xc0874000
+CONFIG_SPL_BSS_MAX_SIZE=0x3000
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_STACK=0xc0880000
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_I2C=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_DM_RESET=y
+CONFIG_SPL_SPI_FLASH_MTD=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_CMD_TLV_EEPROM=y
+CONFIG_ENV_IS_IN_MTD=y
+# CONFIG_SPL_ENV_IS_NOWHERE is not set
+CONFIG_SPL_CLK=y
+CONFIG_SPL_CLK_CCF=y
+CONFIG_SPACEMIT_K3_CCU=y
+CONFIG_DM_I2C=y
+# CONFIG_SPL_DM_I2C is not set
+CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_SPL_SYS_I2C_SPACEMIT=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_RESET_SPACEMIT_K3=y
+CONFIG_SYS_NS16550=y
+CONFIG_SYS_NS16550_IER=0x40
+CONFIG_SPI=y
+CONFIG_K1X_QSPI=y
+CONFIG_TIMER_EARLY=y
+CONFIG_SPL_LZO=y
-- 
2.53.0


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

* [DNM PATCH v1 6/7] reduced SpacemiT K3 vendor BSP: add UART (no SPI) defconfig
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
                   ` (4 preceding siblings ...)
  2026-10-29  0:15 ` [DNM PATCH v1 5/7] reduced SpacemiT K3 vendor BSP: add UART SPI defconfig E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:15 ` [DNM PATCH v1 7/7] reduced SpacemiT K3 vendor BSP: set uart compatible for mainline OpenSBI E Shattow
  2026-10-29  0:33 ` [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP (continued) E Shattow
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.

Drop QSPI SPI MTD CLK and RESET as a new defconfig
---
 configs/spacemit_k3_uart_nospi_defconfig | 44 ++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 configs/spacemit_k3_uart_nospi_defconfig

diff --git a/configs/spacemit_k3_uart_nospi_defconfig b/configs/spacemit_k3_uart_nospi_defconfig
new file mode 100644
index 000000000000..9a8c5cb18406
--- /dev/null
+++ b/configs/spacemit_k3_uart_nospi_defconfig
@@ -0,0 +1,44 @@
+CONFIG_RISCV=y
+CONFIG_SYS_TEXT_BASE=0x102000000
+CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_SYS_MALLOC_F_LEN=0x80000
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_ENV_SIZE=0x4000
+CONFIG_DEFAULT_DEVICE_TREE="k3_spl"
+CONFIG_SPL_TEXT_BASE=0xc0801000
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_SIZE_LIMIT=0x72F00
+CONFIG_SPL=y
+CONFIG_SYS_LOAD_ADDR=0x102000000
+CONFIG_TARGET_SPACEMIT_K3=y
+CONFIG_SPL_OPENSBI_LOAD_ADDR=0x100000000
+CONFIG_K3_BOARD_ASIC=y
+CONFIG_ARCH_RV64I=y
+CONFIG_RISCV_SMODE=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x102300000
+CONFIG_STACK_SIZE=0x100000
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT_ADDRESS=0x140000000
+CONFIG_LOGLEVEL=6
+CONFIG_SPL_MAX_SIZE=0x70F00
+CONFIG_SPL_PAD_TO=0x0
+CONFIG_SPL_BSS_START_ADDR=0xc0874000
+CONFIG_SPL_BSS_MAX_SIZE=0x3000
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_STACK=0xc0880000
+CONFIG_SPL_CRC32=y
+CONFIG_SPL_I2C=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_CMD_TLV_EEPROM=y
+CONFIG_DM_I2C=y
+# CONFIG_SPL_DM_I2C is not set
+CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_SPL_SYS_I2C_SPACEMIT=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_NS16550=y
+CONFIG_SYS_NS16550_IER=0x40
+CONFIG_TIMER_EARLY=y
+CONFIG_SPL_LZO=y
-- 
2.53.0


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

* [DNM PATCH v1 7/7] reduced SpacemiT K3 vendor BSP: set uart compatible for mainline OpenSBI
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
                   ` (5 preceding siblings ...)
  2026-10-29  0:15 ` [DNM PATCH v1 6/7] reduced SpacemiT K3 vendor BSP: add UART (no SPI) defconfig E Shattow
@ 2026-10-29  0:15 ` E Shattow
  2026-10-29  0:33 ` [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP (continued) E Shattow
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:15 UTC (permalink / raw)
  To: u-boot; +Cc: E Shattow

From: E Shattow <eshattow@users.noreply.github.com>

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.

"The compatible order makes OpenSBI select UART_CAP_UUE and preserve
UART_IER_UUE (bit 6); matching only 'ns16550' writes 0x00 to UART_IER and
stops serial output." from [1] OpenSBI mailing list series
"platform: generic: spacemit: add K3 platform support"

1: https://lore.kernel.org/opensbi/20261028-spacemit-k3-v6-0-01d984f60941@linux.spacemit.com/
---
 arch/riscv/dts/k3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/dts/k3.dtsi b/arch/riscv/dts/k3.dtsi
index 8c374519fcde..88bb60be404f 100644
--- a/arch/riscv/dts/k3.dtsi
+++ b/arch/riscv/dts/k3.dtsi
@@ -259,7 +259,7 @@
 
 		uart0: uart@d4017000 {
 			u-boot,dm-spl;
-			compatible = "ns16550";
+			compatible = "spacemit,k1-uart", "intel,xscale-uart", "ns16550";
 			reg = <0x00000000 0xD4017000 0x00000000 0x00000100>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-- 
2.53.0


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

* [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP (continued)
  2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
                   ` (6 preceding siblings ...)
  2026-10-29  0:15 ` [DNM PATCH v1 7/7] reduced SpacemiT K3 vendor BSP: set uart compatible for mainline OpenSBI E Shattow
@ 2026-10-29  0:33 ` E Shattow
  7 siblings, 0 replies; 9+ messages in thread
From: E Shattow @ 2026-10-29  0:33 UTC (permalink / raw)
  To: u-boot

Do Not Merge

Informational purpose only, to aid mainline development of SpacemiT K3
support.

...continued from https://lore.kernel.org/u-boot/20261029001555.1890775-1-e@freeshell.de/

What is known to be working from mainline?
- mkimage to post-process SPL into spl/u-boot-spl-mkimage.bin
- FIT U-Boot main app u-boot.itb
- dependency on OpenSBI

What do we need from the vendor BSP?
- SPL

(Optional) Additional hardware used?
- K3 Pico-ITX BootROM UART SPL loader mode selected by pull-up via
  FPC-36P reverse cable and adapter to header pins (2.54mm pitch
  DuPont connector).

The assumption in this guide is root user in a fresh Debian 13
Trixie build environment on amd64 architecture build host.

dpkg --add-architecture riscv64
apt install -y bison ca-certificates flex gcc-riscv64-linux-gnu git \
  libgnutls28-dev libpython3-dev libssl-dev python3-setuptools swig \
  curl
export CROSS_COMPILE=riscv64-linux-gnu-

git clone https://github.com/riscv-software-src/opensbi.git \
  opensbi.git
git -C opensbi.git checkout d28bc6f89837 # origin/master
# v6 "platform: generic: spacemit: add K3 platform support"
# https://patchwork.ozlabs.org/project/opensbi/list/?series=530305
curl https://patchwork.ozlabs.org/series/530305/mbox/ \
  | git -C opensbi.git am
make -C opensbi.git O=../opensbi clean
make -C opensbi.git O=../opensbi PLATFORM=generic

git clone https://git.u-boot-project.org/u-boot/u-boot.git u-boot.git
git -C u-boot.git remote add -f spacemit-com \
  https://github.com/spacemit-com/uboot-2022.10.git

git -C u-boot.git checkout 03e45557e1f3 # origin/main
# v1 "Spacemit K3 enable Linux boot"
# https://patchwork.ozlabs.org/project/uboot/list/?series=530384
curl https://patchwork.ozlabs.org/series/530384/mbox/ \
  | git -C u-boot.git am
make -C u-boot.git O=../u-boot spacemit_k3_defconfig
fw_dynbin=$(realpath opensbi/platform/generic/firmware/fw_dynamic.bin)
make -C u-boot.git O=../u-boot OPENSBI=$fw_dynbin

git -C u-boot.git checkout k3-br-v1.0.10 # spacemit-com/k3-br-v1.0.y
# v1 "Guide to build reduced SpacemiT K3 vendor BSP"
# https://patchwork.ozlabs.org/project/uboot/list/?series=530447
curl https://patchwork.ozlabs.org/series/530447/mbox/ \
  | git -C u-boot.git am
mki=$(realpath u-boot/tools/mkimage)
make -C u-boot.git O=../bsp-spi \
  spacemit_k3_uart_spi_defconfig
make -C u-boot.git O=../bsp-spi MKIMAGE=$mki \
  spl/u-boot-spl-mkimage.bin
make -C u-boot.git O=../bsp-nospi \
  spacemit_k3_uart_nospi_defconfig
make -C u-boot.git O=../bsp-nospi MKIMAGE=$mki \
  spl/u-boot-spl-mkimage.bin

tar -czf reduced-spacemit-k3-vendor-bsp.tar.gz \
  --transform 's~^~reduced-spacemit-k3-vendor-bsp/~' \
  bsp-nospi/spl/u-boot-spl-mkimage.bin \
  bsp-spi/spl/u-boot-spl-mkimage.bin \
  u-boot/u-boot.itb

### K3 Pico-ITX BootROM UART SPL loader
Connect USB selection bias-pulldown pin 10 high to VCC1V8 pin 1 or
pin 2 for UART selection and pin 11 high to VCC1V8 selects BootROM
USB/UART download mode; pin 11 low is normal operation from selected
NOR/UFS/MMC/NAND secondary boot after SD card. If you do not have a
flat flex cable then it is possible with a sharp probe and steady
hands to do so, the easiest method apparently being to connect the
physically large VCC1V8 leg of the EEPROM part to probe FPC-36P pin 10
and depress the Firmware DownLoad button held for a moment while
pressing the reset or powering up the board. The reason for wanting to
activate BootROM UART mode is to avoid the use of Fastboot USB, and to
isolate any peripheral configuration that may have been acted upon by
BootROM which may be different between the available BootROM SPL
loader modes.

Visual reference:
https://web.archive.org/web/20261025124009/https://freeshell.de/e/riscv64/K3PicoITX-explainer_boot_resistors-20261017draft.webp

Connect for fastboot transfers the K3 Pico-ITX USB-C OTG port (not the
corner USB-C power input/display port) using USB-C to USB-A cable and
then to any USB-A port on the fastboot and serial terminal host.

Connect a serial UART cable, note the board TXD is adjacent to the PCB
board edge and opposite of that is GND with board RXD in the middle;
swap adapter TXD and adapter RXD as appropriate.

The vanilla vendor BSP assumes use of fastboot USB in FSBL.bin SPL for
main.itb loading. If the vanilla vendor BSP main.itb runs with pin 10
low (the board default) then it again attempts to load an SPL and this
can be escaped to a hush prompt by fastboot host 'fastboot continue'.

The UART variants of vendor BSP are patched to assume that u-boot.itb
is loaded over serial UART in YMODEM protocol. If activated the
BootROM UART loader assumes loading an SPL over serial UART in XMODEM
protocol. Using the 'tio' serial terminal software the keybind
sequences are (Control-t,x,0) for XMODEM and (Control-t,y) for YMODEM.
If you initiate a transfer and question-mark characters '?' appear
then the transfer has not synchronized correctly, so abort sending and
then re-try sending the transfer until you will see '.' progress marks
appear. The reduction in build config options for "bsp-spi" deletes
support for USB from SPL. The "bsp-nospi" has nearly all options
removed leaving only YMODEM loading, DRAM initialization, and
dependency of EEPROM TLV access for DRAM id.

Example boot 'mini.efi' netinst Debian debian-installer:
Power on or reset board with FDL button pressed (or pin 11 high)
  sys: 0x10001200
  bm:2
  usb_init : enter 3296,3072
  usb_core_init : enter 
  DWC3_GRXTHRCFG:0x4400000
  ROM: usb download handler
   rst
  done H
  setup= 0x1000680 0x400000,
   rst
  done H
  setup= 0x1a0500 0x0,
  setup= 0x1000680 0x120000,
  setup= 0x2000680 0x90000,
  setup= 0x2000680 0x200000,
  setup= 0x3000680 0xff0000,
  setup= 0x3020680 0xff0409,
  setup= 0x3010680 0xff0409,
  setup= 0x10900 0x0,
  usb_rx_bytes : start len[4096]
  setup= 0x3020680 0xff0409,
  setup= 0x3040680 0xff0409,
host$ fastboot stage bsp-nospi/spl/u-boot-spl-mkimage.bin
  fastboot_handle_command: max-download-size
  usb_tx_bytes : start len[14]
  usb_rx_bytes : start len[4096]
  fastboot_handle_command: 0003cd00
  Starting download of 249088 bytes
  usb_tx_bytes : start len[12]
  usb_rx_bytes : start len[249088]
  usb_tx_bytes : start len[4]
  usb_rx_bytes : start len[4096]
host$ fastboot continue
  fastboot_handle_command: continue
  usb_tx_bytes : start len[4]
  j...
  U-Boot SPL 2022.10-00007-g69c3d4b55f6 (Oct 28 2026 - 21:57:06 +0000)
  LPDDR5 total size: 32 GB, data rate: 6400 MT/s
  DDR training consume 5612ms
  Get cluster clk error
  CCC
host$ curl -LO \
 https://d-i.debian.org/daily-images/riscv64/daily/netboot/mini.efi
host$ python3 -m http.server 8000
(Control-t,y)
  [16:28:01.384] Send file with YMODEM
  [16:28:01.384] Enter file name:
u-boot/u-boot.itb
  [16:28:01.384] Enter file name: u-boot/u-boot.itb
  [16:28:01.384] Send file with YMODEM
  [16:28:12.766] Sending file 'u-boot/u-boot.itb'  
  [16:28:12.766] Press any key to abort transfer
  ...|
  [16:29:57.267] Done
  Loaded 1115321 bytes
  load failed: uboot=-1 esos=-1
  <debug_uart>
  clk_register: failed to get external_clk device (parent of espi_s...
  U-Boot 2027.01-rc1-00037-g96c9b2e9d606 (Oct 28 2026 - 21:54:22 +0...
  DRAM:  16 GiB
  clk_register: failed to get external_clk device (parent of espi_s...
  Core:  452 devices, 21 uclasses, devicetree: separate
  *** Warning - spi_flash_probe_bus_cs() failed, using default envi...
  In:    serial@d4017000
  Out:   serial@d4017000
  Err:   serial@d4017000
  Net:   
  Warning: ethernet@cac80000 (eth0) using random MAC address - 06:3...
  eth0: ethernet@cac80000
  Hit any key to stop autoboot: 2 1 0
(Control-c)
  =>
dhcp
  => dhcp
  ethernet@cac80000 Waiting for PHY auto negotiation to complete......
  DHCP client bound to address 192.168.2.81 (29 ms)
  error: no file name
=> 
wget http://host:8000/mini.efi
  ##################################################
  88906240 bytes transferred in 760 ms (111.6 MiB/s)
  Bytes transferred = 88906240 (54c9a00 hex)
bootefi $loadaddr


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

end of thread, other threads:[~2026-10-29  0:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 1/7] reduced SpacemiT K3 vendor BSP: use MKIMAGE build env E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 2/7] reduced SpacemiT K3 vendor BSP: add guards around config optioned k3.c code E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 3/7] reduced SpacemiT K3 vendor BSP: add fallback fastboot buf addr and size def E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 4/7] reduced SpacemiT K3 vendor BSP: force UART boot when YMODEM_SUPPORT enabled E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 5/7] reduced SpacemiT K3 vendor BSP: add UART SPI defconfig E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 6/7] reduced SpacemiT K3 vendor BSP: add UART (no SPI) defconfig E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 7/7] reduced SpacemiT K3 vendor BSP: set uart compatible for mainline OpenSBI E Shattow
2026-10-29  0:33 ` [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP (continued) E Shattow

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.