Skip to contentSkip to conversation

Initial SPL support for T-Head TH1520 SoC

PATCH Superseded Yao Zi 4 participants 27 messages Apr 26, 2025 – May 24, 2025 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yao Zi

author
#0 lore raw

cover Initial SPL support for T-Head TH1520 SoC

This series adds initial SPL support for T-Head TH1520 SoC and Sipeed Lichee Pi 4A board. Key changes include,

- Support for T-Head-specific cache management operations is split out of CV1800B port and adapted for usage in other ports.
- A new CPU target, THEAD_TH1520, is added with SPL support enabled.
- Driver for TH1520's DDR controller is cleaned up from the vendor U-Boot source.
- For building the bootable image, of which TH1520's BROM executes from the start, from SPL, DDR firmware and proper U-Boot, a binman configuration for TH1520 is added.

Note that the binman configuration doesn't inherit the default one for RISC-V, as our proper U-Boot runs in M-Mode and reusing riscv/dts/binman.dtsi doesn't help much.

Tested on the 16GiB variant of Sipeed Lichee Pi 4A. Loading u-boot-with-spl.bin to SRAM with fastboot through BROM, I've successfully booted into U-Boot console with DRAM initialized.

This series is based on the latest master branch. Additionally, the DDR driver depends on series "Fix binman_sym functionality on RISC-V port"[1] that has been merged earlier today to obtain the firmware.

Thanks for your time and review.

[1]: https://lore.kernel.org/all/[email protected]/

Yao Zi (10):
riscv: lib: Split out support for T-Head cache management operations
riscv: dts: th1520: Add clock-frequency for UART0
riscv: cpu: Add TH1520 CPU support
ram: thead: Add initial DDR controller support for TH1520
riscv: dts: th1520: Preserve necessary devices for SPL
riscv: dts: lichee-module-4a: Preserve memory node for SPL
riscv: dts: th1520: Add DRAM controller
riscv: dts: th1520: Add binman configuration
board: thead: licheepi4a: Enable SPL support
doc: thead: lpi4a: Update documentation

 arch/riscv/Kconfig                            |   9 +
 arch/riscv/cpu/cv1800b/Kconfig                |   1 +
 arch/riscv/cpu/cv1800b/Makefile               |   1 -
 arch/riscv/cpu/th1520/Kconfig                 |  21 +
 arch/riscv/cpu/th1520/Makefile                |   8 +
 arch/riscv/cpu/th1520/cache.c                 |  32 +
 arch/riscv/cpu/th1520/cpu.c                   |  21 +
 arch/riscv/cpu/th1520/dram.c                  |  21 +
 arch/riscv/cpu/th1520/spl.c                   |  31 +
 arch/riscv/dts/th1520-lichee-module-4a.dtsi   |   1 +
 arch/riscv/dts/th1520-lichee-pi-4a.dts        |   1 +
 arch/riscv/dts/th1520.dtsi                    |  17 +
 arch/riscv/dts/thead-th1520-binman.dtsi       |  55 ++
 arch/riscv/include/asm/arch-th1520/cpu.h      |   9 +
 arch/riscv/include/asm/arch-th1520/spl.h      |  10 +
 arch/riscv/lib/Makefile                       |   1 +
 .../{cpu/cv1800b/cache.c => lib/thead_cmo.c}  |   0
 board/thead/th1520_lpi4a/Kconfig              |   5 +-
 board/thead/th1520_lpi4a/Makefile             |   1 +
 board/thead/th1520_lpi4a/spl.c                |  48 ++
 configs/th1520_lpi4a_defconfig                |  18 +
 doc/board/thead/lpi4a.rst                     |  58 +-
 drivers/ram/Kconfig                           |   1 +
 drivers/ram/Makefile                          |   4 +
 drivers/ram/thead/Kconfig                     |   5 +
 drivers/ram/thead/Makefile                    |   1 +
 drivers/ram/thead/th1520_ddr.c                | 781 ++++++++++++++++++
 27 files changed, 1155 insertions(+), 6 deletions(-)
 create mode 100644 arch/riscv/cpu/th1520/Kconfig
 create mode 100644 arch/riscv/cpu/th1520/Makefile
 create mode 100644 arch/riscv/cpu/th1520/cache.c
 create mode 100644 arch/riscv/cpu/th1520/cpu.c
 create mode 100644 arch/riscv/cpu/th1520/dram.c
 create mode 100644 arch/riscv/cpu/th1520/spl.c
 create mode 100644 arch/riscv/dts/thead-th1520-binman.dtsi
 create mode 100644 arch/riscv/include/asm/arch-th1520/cpu.h
 create mode 100644 arch/riscv/include/asm/arch-th1520/spl.h
 rename arch/riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} (100%)
 create mode 100644 board/thead/th1520_lpi4a/spl.c
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH 1/10 riscv: lib: Split out support for T-Head cache management operations

Designed before a standard set of cache management operations defined in RISC-V, earlier T-Head cores like C906 and C910 provide CMO through the customized extension XTheadCMO, which has been used in the CV1800B port of U-Boot.

This patch splits XTheadCMO-related code into a generic module, allowing SoCs shipping T-Head cores to share the code.

---
 arch/riscv/Kconfig                                  | 8 ++++++++
 arch/riscv/cpu/cv1800b/Kconfig                      | 1 +
 arch/riscv/cpu/cv1800b/Makefile                     | 1 -
 arch/riscv/lib/Makefile                             | 1 +
 arch/riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} | 0
 5 files changed, 10 insertions(+), 1 deletion(-)
 rename arch/riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} (100%)
arch/riscv/Kconfig +8 -0
index b24623590f2..dc36d9b8566 100644
@@ -77,6 +77,14 @@ config SYS_DCACHE_OFF
 	help
 	  Do not enable data cache in U-Boot.
 
+config SYS_CACHE_THEAD_CMO
+	bool "THEAD non-standard cache operations"
+	depends on !SYS_DCACHE_OFF
+	default n
+	help
+	  Support for non-standard cache management operations on SoCs based on
+	  T-Head C906/C910 cores.
+
 config SPL_SYS_DCACHE_OFF
 	bool "Do not enable dcache in SPL"
 	depends on SPL
arch/riscv/cpu/cv1800b/Kconfig +1 -0
index 7225b1210c5..57f724ae043 100644
@@ -6,6 +6,7 @@ config SOPHGO_CV1800B
 	bool
 	select ARCH_EARLY_INIT_R
 	select SYS_CACHE_SHIFT_6
+	select SYS_CACHE_THEAD_CMO
 	imply CPU
 	imply CPU_RISCV
 	imply RISCV_TIMER
arch/riscv/cpu/cv1800b/Makefile +0 -1
index 95beb34b51a..da12e0f64e1 100644
@@ -4,4 +4,3 @@
 
 obj-y += dram.o
 obj-y += cpu.o
-obj-y += cache.o
arch/riscv/lib/Makefile +1 -0
index 189b35c24d3..db8d235c699 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
 obj-$(CONFIG_CMD_GO) += boot.o
 obj-y	+= cache.o
 obj-$(CONFIG_SIFIVE_CACHE) += sifive_cache.o
+obj-$(CONFIG_SYS_CACHE_THEAD_CMO) += thead_cmo.o
 ifeq ($(CONFIG_$(PHASE_)RISCV_MMODE),y)
 obj-$(CONFIG_$(PHASE_)RISCV_ACLINT) += aclint_ipi.o
 obj-$(CONFIG_ANDES_PLICSW) += andes_plicsw.o
arch/riscv/lib/thead_cmo.c renamed from arch/riscv/cpu/cv1800b/cache.c +0 -0
similarity index 100%
rename from arch/riscv/cpu/cv1800b/cache.c
rename to arch/riscv/lib/thead_cmo.c
Signature · 1 line
2.49.0
Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] riscv: lib: Split out support for T-Head cache management operations

Quoted 12 lines · Yao Zi

[EXTERNAL MAIL]

Designed before a standard set of cache management operations defined in RISC-V, earlier T-Head cores like C906 and C910 provide CMO through the customized extension XTheadCMO, which has been used in the CV1800B port of U-Boot.

This patch splits XTheadCMO-related code into a generic module, allowing SoCs shipping T-Head cores to share the code.

Quoted 8 lines
---
 arch/riscv/Kconfig                                  | 8 ++++++++
 arch/riscv/cpu/cv1800b/Kconfig                      | 1 +
 arch/riscv/cpu/cv1800b/Makefile                     | 1 -
 arch/riscv/lib/Makefile                             | 1 +
 arch/riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} | 0
 5 files changed, 10 insertions(+), 1 deletion(-)
 rename arch/riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} (100%)
author
#3 lore raw

PATCH 2/10 riscv: dts: th1520: Add clock-frequency for UART0

In reply to Yao Zi

The BROM of TH1520 always initializes its clock and configure the baudrate to 115200. Add a clock-frequency property to provide such information without introducing CCF to SPL.

---
 arch/riscv/dts/th1520.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/dts/th1520.dtsi +1 -0
index cbe3481fadd..e4c8cee66bc 100644
@@ -175,6 +175,7 @@
 			reg = <0xff 0xe7014000 0x0 0x100>;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&uart_sclk>;
+			clock-frequency = <100000000>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			status = "disabled";
Signature · 1 line
2.49.0
Reviewed-by on v1 2/10
#4 lore raw

Re: [PATCH 02/10] riscv: dts: th1520: Add clock-frequency for UART0

Quoted 10 lines · Yao Zi

[EXTERNAL MAIL]

The BROM of TH1520 always initializes its clock and configure the baudrate to 115200. Add a clock-frequency property to provide such information without introducing CCF to SPL.

---
 arch/riscv/dts/th1520.dtsi | 1 +
 1 file changed, 1 insertion(+)
#5 lore raw

Re: [PATCH 02/10] riscv: dts: th1520: Add clock-frequency for UART0

Quoted 7 lines · Leo Liang
Quoted 6 lines · Yao Zi

[EXTERNAL MAIL]

The BROM of TH1520 always initializes its clock and configure the baudrate to 115200. Add a clock-frequency property to provide such information without introducing CCF to SPL.

Quoted 6 lines
Quoted 4 lines
---
 arch/riscv/dts/th1520.dtsi | 1 +
 1 file changed, 1 insertion(+)

NAK from me. Quoting Emil "The uart0 node already has a reference to the uart0_core clock, so it shouldn't
need this property." If SPL does not support the clock framework to do this parent node lookup properly from device-tree then we should not be adjusting the device-tree in this way; use instead the codepath in serial driver that checks a compile-time define.

See for example: https://lore.kernel.org/u-boot/[email protected]/

- E

author
#6 lore raw

Re: [PATCH 02/10] riscv: dts: th1520: Add clock-frequency for UART0

Quoted 13 lines · On Mon, May 12, 2025 at 07:53:01AM -0400, e wrote:
Quoted 12 lines · Leo Liang
Quoted 10 lines · Yao Zi

[EXTERNAL MAIL]

The BROM of TH1520 always initializes its clock and configure the baudrate to 115200. Add a clock-frequency property to provide such information without introducing CCF to SPL.

---
 arch/riscv/dts/th1520.dtsi | 1 +
 1 file changed, 1 insertion(+)
Quoted 8 lines
Quoted 1 line

NAK from me. Quoting Emil "The uart0 node already has a reference to the uart0_core clock, so it shouldn't
need this property." If SPL does not support the clock framework to do this parent node lookup properly from device-tree then we should not be adjusting the device-tree in this way; use instead the codepath in serial driver that checks a compile-time define.

I was not aware of the codepath, thanks for the hint! It should be the correct way to go and I'll try to take in v2.

Quoted 4 lines

See for example:
https://lore.kernel.org/u-boot/[email protected]/

- E

Best regards,
Yao Zi

author
#7 lore raw

PATCH 3/10 riscv: cpu: Add TH1520 CPU support

In reply to Yao Zi

Introduce the SoC-specific code and corresponding Kconfig entries for TH1520 SoC. Following features are implemented for TH1520,

- Cache enable/disable through customized CSR
- Invalidation of customized PMP entries
- DRAM driver probing for SPL

---
 arch/riscv/Kconfig                       |  1 +
 arch/riscv/cpu/th1520/Kconfig            | 21 ++++++++++++++++
 arch/riscv/cpu/th1520/Makefile           |  8 ++++++
 arch/riscv/cpu/th1520/cache.c            | 32 ++++++++++++++++++++++++
 arch/riscv/cpu/th1520/cpu.c              | 21 ++++++++++++++++
 arch/riscv/cpu/th1520/dram.c             | 21 ++++++++++++++++
 arch/riscv/cpu/th1520/spl.c              | 31 +++++++++++++++++++++++
 arch/riscv/include/asm/arch-th1520/cpu.h |  9 +++++++
 arch/riscv/include/asm/arch-th1520/spl.h | 10 ++++++++
 9 files changed, 154 insertions(+)
 create mode 100644 arch/riscv/cpu/th1520/Kconfig
 create mode 100644 arch/riscv/cpu/th1520/Makefile
 create mode 100644 arch/riscv/cpu/th1520/cache.c
 create mode 100644 arch/riscv/cpu/th1520/cpu.c
 create mode 100644 arch/riscv/cpu/th1520/dram.c
 create mode 100644 arch/riscv/cpu/th1520/spl.c
 create mode 100644 arch/riscv/include/asm/arch-th1520/cpu.h
 create mode 100644 arch/riscv/include/asm/arch-th1520/spl.h
arch/riscv/Kconfig +1 -0
index dc36d9b8566..8c6feae5735 100644
@@ -126,6 +126,7 @@ source "arch/riscv/cpu/generic/Kconfig"
 source "arch/riscv/cpu/jh7110/Kconfig"
 source "arch/riscv/cpu/k1/Kconfig"
 source "arch/riscv/cpu/k230/Kconfig"
+source "arch/riscv/cpu/th1520/Kconfig"
 
 # architecture-specific options below
 
arch/riscv/cpu/th1520/Kconfig new file +21 -0
new file mode 100644
index 00000000000..a916d364e6c
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2018, Bin Meng <[email protected]>
+# Copyright (C) 2025, Yao Zi <[email protected]>
+
+config THEAD_TH1520
+	bool
+	select ARCH_EARLY_INIT_R
+	select SYS_CACHE_SHIFT_6
+	select SUPPORT_SPL
+	select BINMAN if SPL
+	select SYS_CACHE_THEAD_CMO
+	imply CPU
+	imply CPU_RISCV
+	imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE)
+	imply RISCV_ACLINT if RISCV_MMODE
+	imply SPL_RISCV_ACLINT if SPL_RISCV_MMODE
+	imply CMD_CPU
+	imply SPL_CPU
+	imply SPL_OPENSBI
+	imply SPL_LOAD_FIT
arch/riscv/cpu/th1520/Makefile new file +8 -0
new file mode 100644
index 00000000000..5d806c06e2e
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2025, Yao Zi <[email protected]>
+
+obj-y += cache.o
+obj-y += cpu.o
+obj-y += dram.o
+obj-y += spl.o
arch/riscv/cpu/th1520/cache.c new file +32 -0
new file mode 100644
index 00000000000..08aa1f789fd
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2025 Yao Zi <[email protected]>
+ */
+
+#include <asm/io.h>
+#include <cpu_func.h>
+#include <linux/bitops.h>
+
+#define CSR_MHCR		0x7c1
+#define  CSR_MHCR_IE		BIT(0)
+#define  CSR_MHCR_DE		BIT(1)
+
+void icache_enable(void)
+{
+	csr_write(CSR_MHCR, csr_read(CSR_MHCR) | CSR_MHCR_IE);
+}
+
+void dcache_enable(void)
+{
+	csr_write(CSR_MHCR, csr_read(CSR_MHCR) | CSR_MHCR_DE);
+}
+
+int icache_status(void)
+{
+	return (csr_read(CSR_MHCR) & CSR_MHCR_IE) != 0;
+}
+
+int dcache_status(void)
+{
+	return (csr_read(CSR_MHCR) & CSR_MHCR_DE) != 0;
+}
arch/riscv/cpu/th1520/cpu.c new file +21 -0
new file mode 100644
index 00000000000..b83f1272c67
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2025 Yao Zi <[email protected]>
+ *
+ * TH1520 SoC has a set of undocumented customized PMP registers that are
+ * configured through MMIO operation. It must be disabled before entering
+ * the DRAM region, or an exception will be raised.
+ */
+
+#include <asm/io.h>
+#include <cpu_func.h>
+
+#define TH1520_PMP_BASE		(void *)0xffdc020000
+
+void th1520_invalidate_pmp(void)
+{
+	/* Invalidate the PMP configuration as in vendor U-Boot code */
+	writel(0x0, TH1520_PMP_BASE + 0x0);
+
+	invalidate_icache_all();
+}
arch/riscv/cpu/th1520/dram.c new file +21 -0
new file mode 100644
index 00000000000..91007c0a3d3
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ */
+
+#include <fdtdec.h>
+#include <init.h>
+#include <asm/global_data.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	return fdtdec_setup_memory_banksize();
+}
arch/riscv/cpu/th1520/spl.c new file +31 -0
new file mode 100644
index 00000000000..aec398528d1
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2025 Yao Zi <[email protected]>
+ */
+#include <dm.h>
+#include <linux/sizes.h>
+#include <log.h>
+#include <init.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int spl_dram_init(void)
+{
+	int ret;
+	struct udevice *dev;
+
+	ret = fdtdec_setup_mem_size_base();
+	if (ret) {
+		printf("failed to setup memory size and base: %d\n", ret);
+		return ret;
+	}
+
+	/* DDR init */
+	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (ret) {
+		printf("DRAM init failed: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
arch/riscv/include/asm/arch-th1520/cpu.h new file +9 -0
new file mode 100644
index 00000000000..837f0b8d06b
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2025 Yao Zi <[email protected]>
+ */
+
+#ifndef _ASM_TH1520_CPU_H_
+#define _ASM_TH1520_CPU_H_
+void th1520_invalidate_pmp(void);
+#endif /* _ASM_TH1520_CPU_H_ */
arch/riscv/include/asm/arch-th1520/spl.h new file +10 -0
new file mode 100644
index 00000000000..59aed8cad62
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2025 Yao Zi <[email protected]>
+ */
+#ifndef _ASM_ARCH_TH1520_SPL_H_
+#define _ASM_ARCH_TH1520_SPL_H_
+
+void spl_dram_init(void);
+
+#endif // _ASM_ARCH_TH1520_SPL_H_
Signature · 1 line
2.49.0
Reviewed-by on v1 3/10
#8 lore raw

Re: [PATCH 03/10] riscv: cpu: Add TH1520 CPU support

Quoted 21 lines · Yao Zi

[EXTERNAL MAIL]

Introduce the SoC-specific code and corresponding Kconfig entries for TH1520 SoC. Following features are implemented for TH1520,

- Cache enable/disable through customized CSR
- Invalidation of customized PMP entries
- DRAM driver probing for SPL

---
 arch/riscv/Kconfig                       |  1 +
 arch/riscv/cpu/th1520/Kconfig            | 21 ++++++++++++++++
 arch/riscv/cpu/th1520/Makefile           |  8 ++++++
 arch/riscv/cpu/th1520/cache.c            | 32 ++++++++++++++++++++++++
 arch/riscv/cpu/th1520/cpu.c              | 21 ++++++++++++++++
 arch/riscv/cpu/th1520/dram.c             | 21 ++++++++++++++++
 arch/riscv/cpu/th1520/spl.c              | 31 +++++++++++++++++++++++
 arch/riscv/include/asm/arch-th1520/cpu.h |  9 +++++++
 arch/riscv/include/asm/arch-th1520/spl.h | 10 ++++++++
 9 files changed, 154 insertions(+)
Quoted 8 lines
 create mode 100644 arch/riscv/cpu/th1520/Kconfig
 create mode 100644 arch/riscv/cpu/th1520/Makefile
 create mode 100644 arch/riscv/cpu/th1520/cache.c
 create mode 100644 arch/riscv/cpu/th1520/cpu.c
 create mode 100644 arch/riscv/cpu/th1520/dram.c
 create mode 100644 arch/riscv/cpu/th1520/spl.c
 create mode 100644 arch/riscv/include/asm/arch-th1520/cpu.h
 create mode 100644 arch/riscv/include/asm/arch-th1520/spl.h
author
#9 lore raw

PATCH 4/10 ram: thead: Add initial DDR controller support for TH1520

In reply to Yao Zi

This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration.

Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later.

---
 drivers/ram/Kconfig            |   1 +
 drivers/ram/Makefile           |   4 +
 drivers/ram/thead/Kconfig      |   5 +
 drivers/ram/thead/Makefile     |   1 +
 drivers/ram/thead/th1520_ddr.c | 781 +++++++++++++++++++++++++++++++++
 5 files changed, 792 insertions(+)
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c
drivers/ram/Kconfig +1 -0
index 2a40b0c9f81..39d03e8d3d3 100644
@@ -135,3 +135,4 @@ source "drivers/ram/sifive/Kconfig"
 source "drivers/ram/stm32mp1/Kconfig"
 source "drivers/ram/starfive/Kconfig"
 source "drivers/ram/sunxi/Kconfig"
+source "drivers/ram/thead/Kconfig"
drivers/ram/Makefile +4 -0
index f92e86eaa3f..82afd5fcbcc 100644
@@ -30,3 +30,7 @@ obj-$(CONFIG_ARCH_OCTEON) += octeon/
 
 obj-$(CONFIG_ARCH_RENESAS) += renesas/
 obj-$(CONFIG_CADENCE_DDR_CTRL) += cadence/
+
+ifdef CONFIG_XPL_BUILD
+obj-$(CONFIG_SPL_THEAD_TH1520_DDR) += thead/
+endif
drivers/ram/thead/Kconfig new file +5 -0
new file mode 100644
index 00000000000..7b05abb6986
@@ -0,0 +1,5 @@
+config SPL_THEAD_TH1520_DDR
+	bool "T-Head TH1520 DDR driver in SPL"
+	depends on SPL_RAM && THEAD_TH1520
+	help
+	  This enables DDR support for T-Head TH1520 platforms.
drivers/ram/thead/Makefile new file +1 -0
new file mode 100644
index 00000000000..ad4d053cfc2
@@ -0,0 +1 @@
+obj-$(CONFIG_SPL_THEAD_TH1520_DDR) += th1520_ddr.o
drivers/ram/thead/th1520_ddr.c new file +781 -0

781 lines not on this page · raw message

Signature · 1 line
2.49.0
author
#10 lore raw

Re: [PATCH 04/10] ram: thead: Add initial DDR controller support for TH1520

Quoted 8 lines · Yao Zi

This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration.

Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later.

I wrongly repeated this patch twice when sending the series, sorry for the noise.

Quoted 12 lines
---
 drivers/ram/Kconfig            |   1 +
 drivers/ram/Makefile           |   4 +
 drivers/ram/thead/Kconfig      |   5 +
 drivers/ram/thead/Makefile     |   1 +
 drivers/ram/thead/th1520_ddr.c | 781 +++++++++++++++++++++++++++++++++
 5 files changed, 792 insertions(+)
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c

...

drivers/ram/thead/th1520_ddr.c line 7

Quoted 13 lines
drivers/ram/thead/th1520_ddr.c new file +7 -0
new file mode 100644
index 00000000000..ff9860b9c3d
@@ -0,0 +1,781 @@
+#include <binman.h>
+#include <binman_sym.h>
+#include <dm.h>
+#include <init.h>
+#include <linux/bitfield.h>
+#include <linux/iopoll.h>
+#include <ram.h>

And here is missing an SPDX license header and a copyright notice. I'll add them in v2.

Thanks,
Yao Zi

#11 lore raw

Re: [PATCH 04/10] ram: thead: Add initial DDR controller support for TH1520

Quoted 28 lines · Yao Zi

[EXTERNAL MAIL]

Quoted 8 lines · Yao Zi

This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration.

Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later.

I wrongly repeated this patch twice when sending the series, sorry for the noise.

Quoted 12 lines
---
 drivers/ram/Kconfig            |   1 +
 drivers/ram/Makefile           |   4 +
 drivers/ram/thead/Kconfig      |   5 +
 drivers/ram/thead/Makefile     |   1 +
 drivers/ram/thead/th1520_ddr.c | 781 +++++++++++++++++++++++++++++++++
 5 files changed, 792 insertions(+)
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c
Quoted 2 lines

And here is missing an SPDX license header and a copyright notice. I'll add them in v2.

Hi Yao,

You could add my reviewed-by tag when sending v2 patch.

Best regards,
Leo

Quoted 3 lines

Thanks,
Yao Zi

Reviewed-by on v1 4/10
#12 lore raw

Re: [PATCH 04/10] ram: thead: Add initial DDR controller support for TH1520

In reply to Yao Zi
Quoted 13 lines · Yao Zi

[EXTERNAL MAIL]

This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration.

Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later.

Quoted 10 lines
---
 drivers/ram/Kconfig            |   1 +
 drivers/ram/Makefile           |   4 +
 drivers/ram/thead/Kconfig      |   5 +
 drivers/ram/thead/Makefile     |   1 +
 drivers/ram/thead/th1520_ddr.c | 781 +++++++++++++++++++++++++++++++++
 5 files changed, 792 insertions(+)
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c
#13 lore raw

Re: [PATCH 04/10] ram: thead: Add initial DDR controller support for TH1520

In reply to Yao Zi
Quoted 8 lines · Yao Zi

This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration.

Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later.

Thank you for this patch series. I only have the 8GB LPi4a. Do you have any suggestions for how I can get that working?

Here is existing output at boot:

-----------------------------------------------
U-Boot SPL 2020.01-g55b713fa (Jan 12 2024 - 02:17:34 +0000) FM[1] lpddr4x dualrank freq=3733 64bit dbi_off=n sdram init ddr initialized, jump to uboot
it worksimage has no header

U-Boot 2020.01-g55b713fa (Jan 12 2024 - 02:17:34 +0000)

CPU:   rv64imafdcvsu
Model: T-HEAD c910 light
DRAM:  8 GiB

-----------------------------------------------

Thanks,
Drew

author
#14 lore raw

PATCH 4/10 ram: thead: Add initial DDR controller support for TH1520

In reply to Yao Zi

This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration.

Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later.

---
 drivers/ram/Kconfig            |   1 +
 drivers/ram/Makefile           |   4 +
 drivers/ram/thead/Kconfig      |   5 +
 drivers/ram/thead/Makefile     |   1 +
 drivers/ram/thead/th1520_ddr.c | 781 +++++++++++++++++++++++++++++++++
 5 files changed, 792 insertions(+)
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c
drivers/ram/Kconfig +1 -0
index 2a40b0c9f81..39d03e8d3d3 100644
@@ -135,3 +135,4 @@ source "drivers/ram/sifive/Kconfig"
 source "drivers/ram/stm32mp1/Kconfig"
 source "drivers/ram/starfive/Kconfig"
 source "drivers/ram/sunxi/Kconfig"
+source "drivers/ram/thead/Kconfig"
drivers/ram/Makefile +4 -0
index f92e86eaa3f..82afd5fcbcc 100644
@@ -30,3 +30,7 @@ obj-$(CONFIG_ARCH_OCTEON) += octeon/
 
 obj-$(CONFIG_ARCH_RENESAS) += renesas/
 obj-$(CONFIG_CADENCE_DDR_CTRL) += cadence/
+
+ifdef CONFIG_XPL_BUILD
+obj-$(CONFIG_SPL_THEAD_TH1520_DDR) += thead/
+endif
drivers/ram/thead/Kconfig new file +5 -0
new file mode 100644
index 00000000000..7b05abb6986
@@ -0,0 +1,5 @@
+config SPL_THEAD_TH1520_DDR
+	bool "T-Head TH1520 DDR driver in SPL"
+	depends on SPL_RAM && THEAD_TH1520
+	help
+	  This enables DDR support for T-Head TH1520 platforms.
drivers/ram/thead/Makefile new file +1 -0
new file mode 100644
index 00000000000..ad4d053cfc2
@@ -0,0 +1 @@
+obj-$(CONFIG_SPL_THEAD_TH1520_DDR) += th1520_ddr.o
drivers/ram/thead/th1520_ddr.c new file +781 -0

781 lines not on this page · raw message

Signature · 1 line
2.49.0
author
#15 lore raw

PATCH 5/10 riscv: dts: th1520: Preserve necessary devices for SPL

In reply to Yao Zi

SPL for TH1520 requires CPU and boot UART nodes to function. Preserve them in SPL devicetree blob with bootph-pre-ram property.

---
 arch/riscv/dts/th1520.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/dts/th1520.dtsi +6 -0
index e4c8cee66bc..ef84d8cc265 100644
@@ -14,6 +14,7 @@
 	cpus: cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		bootph-pre-ram;
 		timebase-frequency = <3000000>;
 
 		c910_0: cpu@0 {
@@ -21,6 +22,7 @@
 			device_type = "cpu";
 			riscv,isa = "rv64imafdc";
 			reg = <0>;
+			bootph-pre-ram;
 			i-cache-block-size = <64>;
 			i-cache-size = <65536>;
 			i-cache-sets = <512>;
@@ -42,6 +44,7 @@
 			device_type = "cpu";
 			riscv,isa = "rv64imafdc";
 			reg = <1>;
+			bootph-pre-ram;
 			i-cache-block-size = <64>;
 			i-cache-size = <65536>;
 			i-cache-sets = <512>;
@@ -63,6 +66,7 @@
 			device_type = "cpu";
 			riscv,isa = "rv64imafdc";
 			reg = <2>;
+			bootph-pre-ram;
 			i-cache-block-size = <64>;
 			i-cache-size = <65536>;
 			i-cache-sets = <512>;
@@ -84,6 +88,7 @@
 			device_type = "cpu";
 			riscv,isa = "rv64imafdc";
 			reg = <3>;
+			bootph-pre-ram;
 			i-cache-block-size = <64>;
 			i-cache-size = <65536>;
 			i-cache-sets = <512>;
@@ -173,6 +178,7 @@
 		uart0: serial@ffe7014000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0xff 0xe7014000 0x0 0x100>;
+			bootph-pre-ram;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&uart_sclk>;
 			clock-frequency = <100000000>;
Signature · 1 line
2.49.0
Reviewed-by on v1 5/10
#16 lore raw

Re: [PATCH 05/10] riscv: dts: th1520: Preserve necessary devices for SPL

Quoted 9 lines · Yao Zi

[EXTERNAL MAIL]

SPL for TH1520 requires CPU and boot UART nodes to function. Preserve them in SPL devicetree blob with bootph-pre-ram property.

---
 arch/riscv/dts/th1520.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
author
#17 lore raw

PATCH 6/10 riscv: dts: lichee-module-4a: Preserve memory node for SPL

In reply to Yao Zi

Memory node is necessary for TH1520 SPL to configure size and base address of DRAM. Let's preserve it in SPL devicetree blob.

---
 arch/riscv/dts/th1520-lichee-module-4a.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/dts/th1520-lichee-module-4a.dtsi +1 -0
index 86a81bdcf77..20dbc4c7d24 100644
@@ -14,6 +14,7 @@
 	memory@0 {
 		device_type = "memory";
 		reg = <0x0 0x00000000 0x2 0x00000000>;
+		bootph-pre-ram;
 	};
 };
 
Signature · 1 line
2.49.0
Reviewed-by on v1 6/10
#18 lore raw

Re: [PATCH 06/10] riscv: dts: lichee-module-4a: Preserve memory node for SPL

Quoted 9 lines · Yao Zi

[EXTERNAL MAIL]

Memory node is necessary for TH1520 SPL to configure size and base address of DRAM. Let's preserve it in SPL devicetree blob.

---
 arch/riscv/dts/th1520-lichee-module-4a.dtsi | 1 +
 1 file changed, 1 insertion(+)
author
#19 lore raw

PATCH 7/10 riscv: dts: th1520: Add DRAM controller

In reply to Yao Zi

Describe DRAM controller integrated in TH1520 SoC and preserve it in SPL devicetree blob.

---
 arch/riscv/dts/th1520.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/riscv/dts/th1520.dtsi +10 -0
index ef84d8cc265..b908eb37e41 100644
@@ -372,6 +372,16 @@
 			status = "disabled";
 		};
 
+		ddrc: ddrc@fffd000000 {
+			compatible = "thead,th1520-ddrc";
+			reg = <0xff 0xfd000000 0x0 0x1000000>,
+			      <0xff 0xfe000000 0x0 0x1000000>,
+			      <0xff 0xff000000 0x0 0x4000>,
+			      <0xff 0xff005000 0x0 0x1000>;
+			reg-names = "phy-0", "phy-1", "ctrl", "sys";
+			bootph-pre-ram;
+		};
+
 		timer4: timer@ffffc33000 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0xff 0xffc33000 0x0 0x14>;
Signature · 1 line
2.49.0
Reviewed-by on v1 7/10
#20 lore raw

Re: [PATCH 07/10] riscv: dts: th1520: Add DRAM controller

Quoted 9 lines · Yao Zi

[EXTERNAL MAIL]

Describe DRAM controller integrated in TH1520 SoC and preserve it in SPL devicetree blob.

---
 arch/riscv/dts/th1520.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
author
#21 lore raw

PATCH 8/10 riscv: dts: th1520: Add binman configuration

In reply to Yao Zi

Add binman configuration for TH1520 SoC, whose BROM loads the image combined into SRAM and directly jumps to it. The configuration creates u-boot-with-spl.bin where the SPL code locates at the start and the DDR firmware is shipped.

---
 arch/riscv/dts/thead-th1520-binman.dtsi | 55 +++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 arch/riscv/dts/thead-th1520-binman.dtsi
arch/riscv/dts/thead-th1520-binman.dtsi new file +55 -0
new file mode 100644
index 00000000000..f060639e1c6
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2025 Yao Zi <[email protected]>
+ */
+
+#include <config.h>
+
+/ {
+	binman: binman {
+	};
+};
+
+&binman {
+	filename = "u-boot-with-spl.bin";
+
+	u-boot-spl {
+	};
+
+	ddr-fw {
+		filename = "th1520-ddr-firmware.bin";
+		type = "blob-ext";
+	};
+
+	fit {
+		offset = <CONFIG_SPL_PAD_TO>;
+
+		description = "Configuration to load M-mode U-Boot";
+
+		#address-cells = <2>;
+		fit,fdt-list = "of-list";
+
+		images {
+			uboot {
+				description = "U-Boot";
+				type = "standalone";
+				os = "U-boot";
+				arch = "riscv";
+				compression = "none";
+				load = /bits/ 64 <CONFIG_TEXT_BASE>;
+
+				uboot_blob: u-boot {
+				};
+			};
+		};
+
+		configurations {
+			default = "conf-th1520-lichee-pi-4a";
+
+			conf-th1520-lichee-pi-4a {
+				description = "th1520-lichee-pi-4a";
+				loadables = "uboot";
+			};
+		};
+	};
+};
Signature · 1 line
2.49.0
Reviewed-by on v1 8/10
#22 lore raw

Re: [PATCH 08/10] riscv: dts: th1520: Add binman configuration

Quoted 7 lines · Yao Zi

[EXTERNAL MAIL]

Add binman configuration for TH1520 SoC, whose BROM loads the image combined into SRAM and directly jumps to it. The configuration creates u-boot-with-spl.bin where the SPL code locates at the start and the DDR firmware is shipped.

Quoted 5 lines
---
 arch/riscv/dts/thead-th1520-binman.dtsi | 55 +++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 arch/riscv/dts/thead-th1520-binman.dtsi
author
#23 lore raw

PATCH 9/10 board: thead: licheepi4a: Enable SPL support

In reply to Yao Zi

Adjust Kconfig and defconfig and add SPL initialization code for Lichee Pi 4A. Then enable SPL support which we've added for TH1520 SoC earlier. The board devicetree is changed to use TH1520 binman configuration to generate bootable images.

---
 arch/riscv/dts/th1520-lichee-pi-4a.dts |  1 +
 board/thead/th1520_lpi4a/Kconfig       |  5 +--
 board/thead/th1520_lpi4a/Makefile      |  1 +
 board/thead/th1520_lpi4a/spl.c         | 48 ++++++++++++++++++++++++++
 configs/th1520_lpi4a_defconfig         | 18 ++++++++++
 5 files changed, 71 insertions(+), 2 deletions(-)
 create mode 100644 board/thead/th1520_lpi4a/spl.c
arch/riscv/dts/th1520-lichee-pi-4a.dts +1 -0
index a1248b2ee3a..49af88b7adf 100644
@@ -4,6 +4,7 @@
  */
 
 #include "th1520-lichee-module-4a.dtsi"
+#include "thead-th1520-binman.dtsi"
 
 / {
 	model = "Sipeed Lichee Pi 4A";
board/thead/th1520_lpi4a/Kconfig +3 -2
index 622246127c1..f139d5ff2bb 100644
@@ -11,7 +11,7 @@ config SYS_VENDOR
 	default "thead"
 
 config SYS_CPU
-	default "generic"
+	default "th1520"
 
 config SYS_CONFIG_NAME
 	default "th1520_lpi4a"
@@ -22,7 +22,7 @@ config TEXT_BASE
 	default 0x01c00000 if RISCV_SMODE
 
 config SPL_TEXT_BASE
-	default 0x08000000
+	default 0xffe0000000
 
 config SPL_OPENSBI_LOAD_ADDR
 	default 0x80000000
@@ -30,6 +30,7 @@ config SPL_OPENSBI_LOAD_ADDR
 config BOARD_SPECIFIC_OPTIONS
 	def_bool y
 	select ARCH_EARLY_INIT_R
+	select THEAD_TH1520
 	imply CPU
 	imply CPU_RISCV
 	imply RISCV_TIMER if RISCV_SMODE
board/thead/th1520_lpi4a/Makefile +1 -0
index 9671b3bbb0b..a7ddfc48d40 100644
@@ -3,3 +3,4 @@
 # Copyright (c) 2023, Yixun Lan <[email protected]>
 
 obj-y += board.o
+obj-$(CONFIG_XPL_BUILD) += spl.o
board/thead/th1520_lpi4a/spl.c new file +48 -0

48 lines not on this page · raw message

configs/th1520_lpi4a_defconfig +18 -0
index d13c97463a8..b19dc009fde 100644
@@ -90,3 +90,21 @@ CONFIG_ZLIB_UNCOMPRESS=y
 CONFIG_BZIP2=y
 CONFIG_ZSTD=y
 CONFIG_LIB_RATIONAL=y
+CONFIG_SPL=y
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_LOAD_FIT_ADDRESS=0xffe0040000
+CONFIG_SPL_HAVE_INIT_STACK=y
+CONFIG_SPL_STACK=0xffe0170000
+CONFIG_SPL_BSS_START_ADDR=0xffe0160000
+CONFIG_SPL_BSS_MAX_SIZE=0x10000
+CONFIG_SPL_MAX_SIZE=0x40000
+CONFIG_SPL_RAM_DEVICE=y
+CONFIG_RAM=y
+CONFIG_SPL_RAM=y
+CONFIG_SPL_THEAD_TH1520_DDR=y
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_MMC_y
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x10000000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x400000
Signature · 1 line
2.49.0
Reviewed-by on v1 9/10
#24 lore raw

Re: [PATCH 09/10] board: thead: licheepi4a: Enable SPL support

Quoted 8 lines · Yao Zi

[EXTERNAL MAIL]

Adjust Kconfig and defconfig and add SPL initialization code for Lichee Pi 4A. Then enable SPL support which we've added for TH1520 SoC earlier. The board devicetree is changed to use TH1520 binman configuration to generate bootable images.

Quoted 8 lines
---
 arch/riscv/dts/th1520-lichee-pi-4a.dts |  1 +
 board/thead/th1520_lpi4a/Kconfig       |  5 +--
 board/thead/th1520_lpi4a/Makefile      |  1 +
 board/thead/th1520_lpi4a/spl.c         | 48 ++++++++++++++++++++++++++
 configs/th1520_lpi4a_defconfig         | 18 ++++++++++
 5 files changed, 71 insertions(+), 2 deletions(-)
 create mode 100644 board/thead/th1520_lpi4a/spl.c
author
#25 lore raw

PATCH 10/10 doc: thead: lpi4a: Update documentation

In reply to Yao Zi

Support for eMMC, SD card, GPIO and SPL have been available in LPi4A port. Update the documentation of support status and build instructions.

---
 doc/board/thead/lpi4a.rst | 58 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 3 deletions(-)
doc/board/thead/lpi4a.rst +55 -3
index e395c6ae12c..7e4c4ea81ee 100644
@@ -32,6 +32,8 @@ Mainline support
 The support for following drivers are already enabled:
 
 1. ns16550 UART Driver.
+2. eMMC and SD card
+
 
 Building
 ~~~~~~~~
@@ -43,15 +45,32 @@ Building
 
    export CROSS_COMPILE=<riscv64 toolchain prefix>
 
-The U-Boot is capable of running in M-Mode, so we can directly build it.
+3. Build DDR firmware
+
+DDR driver requires a firmware to function, to build it:
+
+.. code-block:: bash
+
+	git clone --depth 1 https://github.com/ziyao233/th1520-firmware
+	cd th1520-firmware
+	lua5.4 ddr-generate.lua src/<CONFIGURATION_NAME>.lua th1520-ddr-firmware.bin
+
+4. Build U-Boot images
+
+The U-Boot is capable of running in M-Mode, so we can directly build it without
+OpenSBI. The DDR firmware should be copied to U-Boot source directory before
+building.
 
 .. code-block:: console
 
 	cd <U-Boot-dir>
+	cp <path-to-ddr-firmware> th1520-ddr-firmware.bin
 	make th1520_lpi4a_defconfig
 	make
 
-This will generate u-boot-dtb.bin
+This will generate u-boot-dtb.bin and u-boot-with-spl.bin. The former contains
+only proper U-Boot and is for chainloading; the later contains also SPL and
+DDR firmware and is ready for booting by BROM directly.
 
 Booting
 ~~~~~~~
@@ -61,7 +80,7 @@ and chain load the mainline u-boot image either via tftp or emmc storage,
 then bootup from it.
 
 Sample boot log from Lichee PI 4A board via tftp
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 .. code-block:: none
 
@@ -127,3 +146,36 @@ Sample boot log from Lichee PI 4A board via tftp
         Err:   serial@ffe7014000
         Model: Sipeed Lichee Pi 4A
         LPI4A=>
+
+SPL support is still in an early stage and not all of the functionalities are
+available when booting from mainline SPL. When using mainline SPL,
+u-boot-with-spl.bin should be loaded to SRAM through fastboot.
+
+Sample boot log from Lichee PI 4A board via fastboot and mainline SPL
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. code-block:: none
+
+	brom_ver 8
+	[APP][E] protocol_connect failed, exit.
+	Starting download of 636588 bytes
+
+	downloading of 636588 bytes finished
+
+	U-Boot SPL 2025.04-rc2-00049-geaa9fc99d4cd-dirty (Apr 26 2025 - 13:31:41 +0000)
+	Trying to boot from RAM
+
+
+	U-Boot 2025.04-rc2-00049-geaa9fc99d4cd-dirty (Apr 26 2025 - 13:31:41 +0000)
+
+	CPU:   thead,c910
+	Model: Sipeed Lichee Pi 4A
+	DRAM:  8 GiB
+	Core:  30 devices, 9 uclasses, devicetree: separate
+	MMC:   mmc@ffe7080000: 0, mmc@ffe7090000: 1
+	Loading Environment from <NULL>... OK
+	In:    serial@ffe7014000
+	Out:   serial@ffe7014000
+	Err:   serial@ffe7014000
+	Model: Sipeed Lichee Pi 4A
+	LPI4A=>
Signature · 1 line
2.49.0
Reviewed-by on v1 10/10
#26 lore raw

Re: [PATCH 10/10] doc: thead: lpi4a: Update documentation

Quoted 10 lines · Yao Zi

[EXTERNAL MAIL]

Support for eMMC, SD card, GPIO and SPL have been available in LPi4A port. Update the documentation of support status and build instructions.

---
 doc/board/thead/lpi4a.rst | 58 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 3 deletions(-)