Skip to contentSkip to conversation

Add PIN and SPI support for Spacemit K1

PATCH Superseded Raymond Mao 6 participants 25 messages Apr 22 – May 7

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add PIN and SPI support for Spacemit K1

From: Raymond Mao <[email protected]>

Add pinctrl, GPIO, and SPI NOR flash support for the Spacemit K1 SoC and enable U-Boot to boot on K1-based boards.

Notes:
Tested on the Muse Pi Pro.
BananaPi F3 is untestable due to missing SPI NOR flash.

Prerequisite:
-------------
This series depend on another pending-to-merge series [1].

[1] [PATCH v3 00/16] Add board support for Spacemit K1 SoC in SPL
https://lore.kernel.org/u-boot/[email protected]/

Raymond Mao (16):
gpio: add gpio driver for Spacemit K1 SoC
pinctrl: add pinctrl driver for Spacemit K1 SoC
dts: k1: fix gpio ranges
dts: k1: import pinctrl dts file from upstream folder
dts: k1: remove embedded subnode in pin configs
configs: k1: enable pinctrl and gpio
mtd: spi: select SPL_SPI_FLASH_TINY in SPL stage
mtd: spi: enable spi_nor_remove() in soft reset config
spi: fsl: add support for Spacemit K1 SoC
dts: k1: add QSPI controller support
board: k1: enable SPI NOR flash in SPL
riscv: binman: Always set default configuration in FIT image
spacemit: k1: append RISCV_MMODE_TIMERBASE
spacemit: k1: Add multiple device tree support
spacemit: k1: Add support for mmc regulator initialization
spacemit: k1: rename device tree prefix from "k1-" to "k1_"

 arch/riscv/dts/Makefile                   |   2 +-
 arch/riscv/dts/binman.dtsi                |   2 -
 arch/riscv/dts/k1-bananapi-f3.dts         |  28 --
 arch/riscv/dts/k1-pinctrl.dtsi            |  19 -
 arch/riscv/dts/k1.dtsi                    |  21 +-
 arch/riscv/dts/k1_bananapi-f3.dts         | 189 ++++++++
 arch/riscv/dts/k1_muse-pi-pro.dts         | 199 ++++++++
 arch/riscv/dts/k1_pinctrl.dtsi            |  79 ++++
 arch/riscv/dts/{k1-spl.dts => k1_spl.dts} |  62 ++-
 board/spacemit/k1/MAINTAINERS             |   2 +
 board/spacemit/k1/spl.c                   |  56 ++-
 configs/spacemit_k1_defconfig             |  37 +-
 drivers/gpio/Kconfig                      |   8 +
 drivers/gpio/Makefile                     |   1 +
 drivers/gpio/spacemit_gpio.c              | 217 +++++++++
 drivers/mtd/spi/Makefile                  |   5 +-
 drivers/mtd/spi/sf_probe.c                |   8 +-
 drivers/pinctrl/Kconfig                   |   1 +
 drivers/pinctrl/Makefile                  |   1 +
 drivers/pinctrl/spacemit/Kconfig          |   9 +
 drivers/pinctrl/spacemit/Makefile         |   2 +
 drivers/pinctrl/spacemit/pinctrl-k1.c     | 550 ++++++++++++++++++++++
 drivers/spi/fsl_qspi.c                    |   9 +
 include/configs/k1.h                      |  12 +-
 24 files changed, 1422 insertions(+), 97 deletions(-)
 delete mode 100644 arch/riscv/dts/k1-bananapi-f3.dts
 delete mode 100644 arch/riscv/dts/k1-pinctrl.dtsi
 create mode 100644 arch/riscv/dts/k1_bananapi-f3.dts
 create mode 100644 arch/riscv/dts/k1_muse-pi-pro.dts
 create mode 100644 arch/riscv/dts/k1_pinctrl.dtsi
 rename arch/riscv/dts/{k1-spl.dts => k1_spl.dts} (88%)
 create mode 100644 drivers/gpio/spacemit_gpio.c
 create mode 100644 drivers/pinctrl/spacemit/Kconfig
 create mode 100644 drivers/pinctrl/spacemit/Makefile
 create mode 100644 drivers/pinctrl/spacemit/pinctrl-k1.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/16 gpio: add gpio driver for Spacemit K1 SoC

From: Raymond Mao <[email protected]>

Enable gpio driver for Spacemit K1 SoC.

---
 drivers/gpio/Kconfig         |   8 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/spacemit_gpio.c | 217 +++++++++++++++++++++++++++++++++++
 3 files changed, 226 insertions(+)
 create mode 100644 drivers/gpio/spacemit_gpio.c
drivers/gpio/Kconfig +8 -0
index 1484dd3504c..b51886d41f3 100644
@@ -449,6 +449,14 @@ config SANDBOX_GPIO_COUNT
 	  of 'anonymous' GPIOs that do not belong to any device or bank.
 	  Select a suitable value depending on your needs.
 
+config SPACEMIT_GPIO
+	bool "Spacemit K1 GPIO driver"
+	depends on DM_GPIO && TARGET_SPACEMIT_K1
+	help
+	  Support the GPIO device in Spacemit SoCs. The GPIOs are arranged
+	  into a number of banks (different for each SoC type) each with 32
+	  GPIOs.
+
 config SUNXI_GPIO
 	bool "Allwinner GPIO driver"
 	depends on ARCH_SUNXI
drivers/gpio/Makefile +1 -0
index fec258f59f5..7760aa8e11a 100644
@@ -66,6 +66,7 @@ obj-$(CONFIG_MVEBU_GPIO)	+= mvebu_gpio.o
 obj-$(CONFIG_MSM_GPIO)		+= msm_gpio.o
 obj-$(CONFIG_$(PHASE_)PCF8575_GPIO)	+= pcf8575_gpio.o
 obj-$(CONFIG_$(PHASE_)QCOM_PMIC_GPIO)	+= qcom_pmic_gpio.o qcom_spmi_gpio.o
+obj-$(CONFIG_$(PHASE_)SPACEMIT_GPIO)	+= spacemit_gpio.o
 obj-$(CONFIG_MT7620_GPIO)	+= mt7620_gpio.o
 obj-$(CONFIG_MT7621_GPIO)	+= mt7621_gpio.o
 obj-$(CONFIG_MSCC_SGPIO)	+= mscc_sgpio.o
drivers/gpio/spacemit_gpio.c new file +217 -0

217 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/16 pinctrl: add pinctrl driver for Spacemit K1 SoC

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Add pinctrl driver for Spacemit K1 SoC.

---
 drivers/pinctrl/Kconfig               |   1 +
 drivers/pinctrl/Makefile              |   1 +
 drivers/pinctrl/spacemit/Kconfig      |   9 +
 drivers/pinctrl/spacemit/Makefile     |   2 +
 drivers/pinctrl/spacemit/pinctrl-k1.c | 550 ++++++++++++++++++++++++++
 5 files changed, 563 insertions(+)
 create mode 100644 drivers/pinctrl/spacemit/Kconfig
 create mode 100644 drivers/pinctrl/spacemit/Makefile
 create mode 100644 drivers/pinctrl/spacemit/pinctrl-k1.c
drivers/pinctrl/Kconfig +1 -0
index 578edbf8168..a3abe0ea04d 100644
@@ -419,6 +419,7 @@ source "drivers/pinctrl/nxp/Kconfig"
 source "drivers/pinctrl/qcom/Kconfig"
 source "drivers/pinctrl/renesas/Kconfig"
 source "drivers/pinctrl/rockchip/Kconfig"
+source "drivers/pinctrl/spacemit/Kconfig"
 source "drivers/pinctrl/sunxi/Kconfig"
 source "drivers/pinctrl/tegra/Kconfig"
 source "drivers/pinctrl/uniphier/Kconfig"
drivers/pinctrl/Makefile +1 -0
index 29fb9b484d0..ece7a57767c 100644
@@ -33,6 +33,7 @@ obj-$(CONFIG_PINCTRL_SCMI)	+= pinctrl-scmi.o
 obj-$(CONFIG_PINCTRL_SINGLE)	+= pinctrl-single.o
 obj-$(CONFIG_PINCTRL_STI)	+= pinctrl-sti.o
 obj-$(CONFIG_PINCTRL_STM32)	+= pinctrl_stm32.o
+obj-$(CONFIG_$(PHASE_)PINCTRL_SPACEMIT_K1) += spacemit/
 obj-$(CONFIG_$(PHASE_)PINCTRL_SX150X) += pinctrl-sx150x.o
 obj-$(CONFIG_$(PHASE_)PINCTRL_STMFX)	+= pinctrl-stmfx.o
 obj-$(CONFIG_PINCTRL_TH1520)	+= pinctrl-th1520.o
drivers/pinctrl/spacemit/Kconfig new file +9 -0
new file mode 100644
index 00000000000..6aab89e160c
@@ -0,0 +1,9 @@
+config PINCTRL_SPACEMIT_K1
+	bool "Spacemit K1 SoC pinctrl driver"
+	depends on PINCTRL_GENERIC && DM
+	help
+	  Supports pin multiplexing control on Spacemit K1 SoCs.
+
+	  The driver is controlled by a device tree node which contains both
+	  the GPIO definitions and pin control functions for each available
+	  multiplex function.
drivers/pinctrl/spacemit/Makefile new file +2 -0
new file mode 100644
index 00000000000..0dc43c72cb1
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-y += pinctrl-k1.o
drivers/pinctrl/spacemit/pinctrl-k1.c new file +550 -0

550 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/16 dts: k1: fix gpio ranges

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

The numbers of cells in gpio-ranges should only be 3.

---
 arch/riscv/dts/k1.dtsi | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/riscv/dts/k1.dtsi +1 -4
index 682d2fb88e2..fc3a693a10e 100644
@@ -383,10 +383,7 @@
 			interrupt-parent = <&plic>;
 			interrupt-controller;
 			#interrupt-cells = <3>;
-			gpio-ranges = <&pinctrl 0 0 0 32>,
-				      <&pinctrl 1 0 32 32>,
-				      <&pinctrl 2 0 64 32>,
-				      <&pinctrl 3 0 96 32>;
+			gpio-ranges = <&pinctrl 0 0 128>;
 		};
 
 		pwm0: pwm@d401a000 {
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/16 dts: k1: import pinctrl dts file from upstream folder

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

---
 arch/riscv/dts/k1-pinctrl.dtsi | 66 ++++++++++++++++++++++++++++++++--
 1 file changed, 63 insertions(+), 3 deletions(-)
arch/riscv/dts/k1-pinctrl.dtsi +63 -3
index 14e7096fbcf..aff19c86d5f 100644
@@ -1,12 +1,64 @@
-// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
- * Copyright (C) 2022 Spacemit Inc.
- * Copyright (C) 2025 Yixun Lan <[email protected]>
+ * Copyright (c) 2024 Yixun Lan <[email protected]>
  */
 
+#include <dt-bindings/gpio/gpio.h>
+
 #define K1_PADCONF(pin, func) (((pin) << 16) | (func))
 
+/* Map GPIO pin to each bank's <index, offset> */
+#define K1_GPIO(x)	(x / 32) (x % 32)
+
 &pinctrl {
+	gmac0_cfg: gmac0-cfg {
+		gmac0-pins {
+			pinmux = <K1_PADCONF(0, 1)>,	/* gmac0_rxdv */
+				 <K1_PADCONF(1, 1)>,	/* gmac0_rx_d0 */
+				 <K1_PADCONF(2, 1)>,	/* gmac0_rx_d1 */
+				 <K1_PADCONF(3, 1)>,	/* gmac0_rx_clk */
+				 <K1_PADCONF(4, 1)>,	/* gmac0_rx_d2 */
+				 <K1_PADCONF(5, 1)>,	/* gmac0_rx_d3 */
+				 <K1_PADCONF(6, 1)>,	/* gmac0_tx_d0 */
+				 <K1_PADCONF(7, 1)>,	/* gmac0_tx_d1 */
+				 <K1_PADCONF(8, 1)>,	/* gmac0_tx */
+				 <K1_PADCONF(9, 1)>,	/* gmac0_tx_d2 */
+				 <K1_PADCONF(10, 1)>,	/* gmac0_tx_d3 */
+				 <K1_PADCONF(11, 1)>,	/* gmac0_tx_en */
+				 <K1_PADCONF(12, 1)>,	/* gmac0_mdc */
+				 <K1_PADCONF(13, 1)>,	/* gmac0_mdio */
+				 <K1_PADCONF(14, 1)>,	/* gmac0_int_n */
+				 <K1_PADCONF(45, 1)>;	/* gmac0_clk_ref */
+
+			bias-pull-up = <0>;
+			drive-strength = <21>;
+		};
+	};
+
+	gmac1_cfg: gmac1-cfg {
+		gmac1-pins {
+			pinmux = <K1_PADCONF(29, 1)>,	/* gmac1_rxdv */
+				 <K1_PADCONF(30, 1)>,	/* gmac1_rx_d0 */
+				 <K1_PADCONF(31, 1)>,	/* gmac1_rx_d1 */
+				 <K1_PADCONF(32, 1)>,	/* gmac1_rx_clk */
+				 <K1_PADCONF(33, 1)>,	/* gmac1_rx_d2 */
+				 <K1_PADCONF(34, 1)>,	/* gmac1_rx_d3 */
+				 <K1_PADCONF(35, 1)>,	/* gmac1_tx_d0 */
+				 <K1_PADCONF(36, 1)>,	/* gmac1_tx_d1 */
+				 <K1_PADCONF(37, 1)>,	/* gmac1_tx */
+				 <K1_PADCONF(38, 1)>,	/* gmac1_tx_d2 */
+				 <K1_PADCONF(39, 1)>,	/* gmac1_tx_d3 */
+				 <K1_PADCONF(40, 1)>,	/* gmac1_tx_en */
+				 <K1_PADCONF(41, 1)>,	/* gmac1_mdc */
+				 <K1_PADCONF(42, 1)>,	/* gmac1_mdio */
+				 <K1_PADCONF(43, 1)>,	/* gmac1_int_n */
+				 <K1_PADCONF(46, 1)>;	/* gmac1_clk_ref */
+
+			bias-pull-up = <0>;
+			drive-strength = <21>;
+		};
+	};
+
 	uart0_2_cfg: uart0-2-cfg {
 		uart0-2-pins {
 			pinmux = <K1_PADCONF(68, 2)>,
@@ -16,4 +68,12 @@
 			drive-strength = <32>;
 		};
 	};
+
+	pwm14_1_cfg: pwm14-1-cfg {
+		pwm14-1-pins {
+			pinmux = <K1_PADCONF(44, 4)>;
+			bias-pull-up = <0>;
+			drive-strength = <32>;
+		};
+	};
 };
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH 04/16] dts: k1: import pinctrl dts file from upstream folder

Quoted 3 lines · Raymond Mao

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

Why doesn't the platform just use the upstream dts directly?

#6 lore raw

Re: [PATCH 04/16] dts: k1: import pinctrl dts file from upstream folder

Quoted 6 lines · Conor Dooley
Quoted 3 lines · Raymond Mao

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

Why doesn't the platform just use the upstream dts directly?

AFAIK, U-Boot's reset driver for SpacemiT K1 predates land of the kernel side driver, and follows a complete different (and to me, broken since it combines completely unrelated MMIO regions) ABI.

U-Boot's version,

	reset: reset-controller@d4050000 {
		compatible = "spacemit,k1-reset";
		reg = <0x0 0xd4050000 0x0 0x209c>,
		      <0x0 0xd4282800 0x0 0x400>,
		      <0x0 0xd4015000 0x0 0x1000>,
		      <0x0 0xd4090000 0x0 0x1000>,
		      <0x0 0xd4282c00 0x0 0x400>,
		      <0x0 0xd8440000 0x0 0x98>,
		      <0x0 0xc0000000 0x0 0x4280>,
		      <0x0 0xf0610000 0x0 0x20>;
		      reg-names = "mpmu", "apmu", "apbc", "apbs", "ciu", "dciu", "ddrc", "apbc2";
		      #reset-cells = <1>;
		      status = "disabled";
	};

Kernel's version,

	syscon_apmu: system-controller@d4282800 {
		compatible = "spacemit,k1-syscon-apmu";
		reg = <0x0 0xd4282800 0x0 0x400>;
		clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>,
			 <&vctcxo_24m>;
		clock-names = "osc", "vctcxo_1m", "vctcxo_3m",
			 "vctcxo_24m";
		#clock-cells = <1>;
		#power-domain-cells = <1>;
		#reset-cells = <1>;
	};

	(and many other independent system-controller nodes, each for a
	 distinct MMIO region)

I suspect we have to deal with the difference before switching to upstream devicetree, since I2C controllers introduced in this series do depend on resets.

Regards,
Yao Zi

#7 lore raw

Re: [PATCH 04/16] dts: k1: import pinctrl dts file from upstream folder

Am 30. April 2026 03:26:38 MESZ schrieb Yao Zi <[email protected]>:

Quoted 11 lines · Conor Dooley
Quoted 6 lines · Raymond Mao
Quoted 3 lines

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

Why doesn't the platform just use the upstream dts directly?

AFAIK, U-Boot's reset driver for SpacemiT K1 predates land of the kernel side driver, and follows a complete different (and to me, broken since it combines completely unrelated MMIO regions) ABI.

Shouldn't we first correct the reset drivers and switch to the upstream kernel device-tree before adding anything new? - This would reduce future rework.

Best regards

Heinrich

Quoted 41 lines

U-Boot's version,

	reset: reset-controller@d4050000 {
		compatible = "spacemit,k1-reset";
		reg = <0x0 0xd4050000 0x0 0x209c>,
		      <0x0 0xd4282800 0x0 0x400>,
		      <0x0 0xd4015000 0x0 0x1000>,
		      <0x0 0xd4090000 0x0 0x1000>,
		      <0x0 0xd4282c00 0x0 0x400>,
		      <0x0 0xd8440000 0x0 0x98>,
		      <0x0 0xc0000000 0x0 0x4280>,
		      <0x0 0xf0610000 0x0 0x20>;
		      reg-names = "mpmu", "apmu", "apbc", "apbs", "ciu", "dciu", "ddrc", "apbc2";
		      #reset-cells = <1>;
		      status = "disabled";
	};

Kernel's version,

	syscon_apmu: system-controller@d4282800 {
		compatible = "spacemit,k1-syscon-apmu";
		reg = <0x0 0xd4282800 0x0 0x400>;
		clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>,
			 <&vctcxo_24m>;
		clock-names = "osc", "vctcxo_1m", "vctcxo_3m",
			 "vctcxo_24m";
		#clock-cells = <1>;
		#power-domain-cells = <1>;
		#reset-cells = <1>;
	};

	(and many other independent system-controller nodes, each for a
	 distinct MMIO region)

I suspect we have to deal with the difference before switching to upstream devicetree, since I2C controllers introduced in this series do depend on resets.

Regards,
Yao Zi

#8 lore raw

Re: [PATCH 04/16] dts: k1: import pinctrl dts file from upstream folder

Quoted 7 lines · Heinrich Schuchardt

Am 30. April 2026 03:26:38 MESZ schrieb Yao Zi <[email protected]>:

Quoted 6 lines · Conor Dooley
Quoted 5 lines · Raymond Mao
Quoted 3 lines

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Why doesn't the platform just use the upstream dts directly?

AFAIK, U-Boot's reset driver for SpacemiT K1 predates land of the kernel side driver, and follows a complete different (and to me, broken since it combines completely unrelated MMIO regions) ABI.

Shouldn't we first correct the reset drivers and switch to the upstream kernel device-tree before adding anything new? - This would reduce future rework.

Exactly. That's a condition of bringing stuff in to U-Boot before it's accepted to the kernel. It *must* be updated once the kernel folks have provided feedback, we do not diverge.

Signature · 1 line
Tom
#9 lore raw

Re: [PATCH 04/16] dts: k1: import pinctrl dts file from upstream folder

Hi Tom, Conor, Heinrich, Yao Zi,

Quoted 15 lines · Tom Rini
Quoted 13 lines · Heinrich Schuchardt

Am 30. April 2026 03:26:38 MESZ schrieb Yao Zi <[email protected]>:

Quoted 11 lines · Conor Dooley
Quoted 6 lines · Raymond Mao
Quoted 3 lines

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

Why doesn't the platform just use the upstream dts directly?

AFAIK, U-Boot's reset driver for SpacemiT K1 predates land of the kernel side driver, and follows a complete different (and to me, broken since it combines completely unrelated MMIO regions) ABI.

Quoted 6 lines
Quoted 1 line

Shouldn't we first correct the reset drivers and switch to the upstream kernel device-tree before adding anything new? - This would reduce future rework.

Exactly. That's a condition of bringing stuff in to U-Boot before it's accepted to the kernel. It *must* be updated once the kernel folks have provided feedback, we do not diverge.

Chiming in as one of the K1 platform contributors.

Yao Zi is right about the reset driver. U-Boot's spacemit,k1-reset driver predates the current kernel binding. The kernel K1 reset driver was reworked to use the auxiliary-device mechanism during upstream review. At that point the kernel DTS (arch/riscv/boot/dts/spacemit/k1.dtsi) dropped its reset-controller node. And it is from there, the K1 uboot and kernel dts/dtsi files starting to diverge with each other.

To pull them back together, with the goal to reuse the kernel dts, we plan to:

1. Refactor U-Boot's K1 reset driver to be spawned from each per-syscon clock driver via device_bind_driver_to_node(), called from the .bind hook in drivers/clk/spacemit/clk-k1.c. More study is requried but for now we think this is the correct way. After the refactor, the K1 build should be able to switch dts/upstream/src/riscv/spacemit/, with a simple U-Boot specifics layered as <board>-u-boot.dtsi overlays.

2. After the refactor, we'll rebase the still in-flight K1 SPL bring-up work [1] and the PIN/SPI series [2] (this one) on top, dropping the patches that imported the forked DT, and resend.

Could you confirm this matches your direction? If so, we'll send the K1 reset driver refactor as a standalone series first.

[PATCH v3 00/16] Add board support for Spacemit K1 SoC in SPL

[PATCH 00/16] Add PIN and SPI support for Spacemit K1

Thanks,
Guodong

Quoted 2 lines

--
Tom

#10 lore raw

Re: [PATCH 04/16] dts: k1: import pinctrl dts file from upstream folder

Quoted 52 lines · Guodong Xu

Hi Tom, Conor, Heinrich, Yao Zi,

Quoted 15 lines · Tom Rini
Quoted 13 lines · Heinrich Schuchardt

Am 30. April 2026 03:26:38 MESZ schrieb Yao Zi <[email protected]>:

Quoted 11 lines · Conor Dooley
Quoted 6 lines · Raymond Mao
Quoted 3 lines

From: Raymond Mao <[email protected]>

Import k1-pinctrl.dtsi from upstream folder.

Why doesn't the platform just use the upstream dts directly?

AFAIK, U-Boot's reset driver for SpacemiT K1 predates land of the kernel side driver, and follows a complete different (and to me, broken since it combines completely unrelated MMIO regions) ABI.

Quoted 6 lines
Quoted 1 line

Shouldn't we first correct the reset drivers and switch to the upstream kernel device-tree before adding anything new? - This would reduce future rework.

Exactly. That's a condition of bringing stuff in to U-Boot before it's accepted to the kernel. It *must* be updated once the kernel folks have provided feedback, we do not diverge.

Chiming in as one of the K1 platform contributors.

Yao Zi is right about the reset driver. U-Boot's spacemit,k1-reset driver predates the current kernel binding. The kernel K1 reset driver was reworked to use the auxiliary-device mechanism during upstream review. At that point the kernel DTS (arch/riscv/boot/dts/spacemit/k1.dtsi) dropped its reset-controller node. And it is from there, the K1 uboot and kernel dts/dtsi files starting to diverge with each other.

To pull them back together, with the goal to reuse the kernel dts, we plan to:

1. Refactor U-Boot's K1 reset driver to be spawned from each per-syscon clock driver via device_bind_driver_to_node(), called from the .bind hook in drivers/clk/spacemit/clk-k1.c. More study is requried but for now we think this is the correct way. After the refactor, the K1 build should be able to switch dts/upstream/src/riscv/spacemit/, with a simple U-Boot specifics layered as <board>-u-boot.dtsi overlays.

2. After the refactor, we'll rebase the still in-flight K1 SPL bring-up work [1] and the PIN/SPI series [2] (this one) on top, dropping the patches that imported the forked DT, and resend.

Could you confirm this matches your direction? If so, we'll send the K1 reset driver refactor as a standalone series first.

Quoted 7 lines

[PATCH v3 00/16] Add board support for Spacemit K1 SoC in SPL

[PATCH 00/16] Add PIN and SPI support for Spacemit K1

From my point of view, yes, whatever is needed such that we can use the upstream bindings again makes sense and I'll defer to you about how is best given the SoC design. Thanks!

Signature · 1 line
Tom
#11 lore raw

PATCH 5/16 dts: k1: remove embedded subnode in pin configs

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Fix the embedded subnode that is defined in pin configs.

---
 arch/riscv/dts/k1-pinctrl.dtsi | 102 ++++++++++++++++-----------------
 1 file changed, 51 insertions(+), 51 deletions(-)
arch/riscv/dts/k1-pinctrl.dtsi +51 -51
index aff19c86d5f..2e4216f94d0 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
  * Copyright (c) 2024 Yixun Lan <[email protected]>
+ * Copyright (c) 2025-2026 RISCstar Ltd.
  */
 
 #include <dt-bindings/gpio/gpio.h>
@@ -12,68 +13,67 @@
 
 &pinctrl {
 	gmac0_cfg: gmac0-cfg {
-		gmac0-pins {
-			pinmux = <K1_PADCONF(0, 1)>,	/* gmac0_rxdv */
-				 <K1_PADCONF(1, 1)>,	/* gmac0_rx_d0 */
-				 <K1_PADCONF(2, 1)>,	/* gmac0_rx_d1 */
-				 <K1_PADCONF(3, 1)>,	/* gmac0_rx_clk */
-				 <K1_PADCONF(4, 1)>,	/* gmac0_rx_d2 */
-				 <K1_PADCONF(5, 1)>,	/* gmac0_rx_d3 */
-				 <K1_PADCONF(6, 1)>,	/* gmac0_tx_d0 */
-				 <K1_PADCONF(7, 1)>,	/* gmac0_tx_d1 */
-				 <K1_PADCONF(8, 1)>,	/* gmac0_tx */
-				 <K1_PADCONF(9, 1)>,	/* gmac0_tx_d2 */
-				 <K1_PADCONF(10, 1)>,	/* gmac0_tx_d3 */
-				 <K1_PADCONF(11, 1)>,	/* gmac0_tx_en */
-				 <K1_PADCONF(12, 1)>,	/* gmac0_mdc */
-				 <K1_PADCONF(13, 1)>,	/* gmac0_mdio */
-				 <K1_PADCONF(14, 1)>,	/* gmac0_int_n */
-				 <K1_PADCONF(45, 1)>;	/* gmac0_clk_ref */
+		pinmux = <K1_PADCONF(0, 1)>,	/* gmac0_rxdv */
+			 <K1_PADCONF(1, 1)>,	/* gmac0_rx_d0 */
+			 <K1_PADCONF(2, 1)>,	/* gmac0_rx_d1 */
+			 <K1_PADCONF(3, 1)>,	/* gmac0_rx_clk */
+			 <K1_PADCONF(4, 1)>,	/* gmac0_rx_d2 */
+			 <K1_PADCONF(5, 1)>,	/* gmac0_rx_d3 */
+			 <K1_PADCONF(6, 1)>,	/* gmac0_tx_d0 */
+			 <K1_PADCONF(7, 1)>,	/* gmac0_tx_d1 */
+			 <K1_PADCONF(8, 1)>,	/* gmac0_tx */
+			 <K1_PADCONF(9, 1)>,	/* gmac0_tx_d2 */
+			 <K1_PADCONF(10, 1)>,	/* gmac0_tx_d3 */
+			 <K1_PADCONF(11, 1)>,	/* gmac0_tx_en */
+			 <K1_PADCONF(12, 1)>,	/* gmac0_mdc */
+			 <K1_PADCONF(13, 1)>,	/* gmac0_mdio */
+			 <K1_PADCONF(14, 1)>,	/* gmac0_int_n */
+			 <K1_PADCONF(45, 1)>;	/* gmac0_clk_ref */
 
-			bias-pull-up = <0>;
-			drive-strength = <21>;
-		};
+		bias-pull-up = <0>;
+		drive-strength = <21>;
 	};
 
 	gmac1_cfg: gmac1-cfg {
-		gmac1-pins {
-			pinmux = <K1_PADCONF(29, 1)>,	/* gmac1_rxdv */
-				 <K1_PADCONF(30, 1)>,	/* gmac1_rx_d0 */
-				 <K1_PADCONF(31, 1)>,	/* gmac1_rx_d1 */
-				 <K1_PADCONF(32, 1)>,	/* gmac1_rx_clk */
-				 <K1_PADCONF(33, 1)>,	/* gmac1_rx_d2 */
-				 <K1_PADCONF(34, 1)>,	/* gmac1_rx_d3 */
-				 <K1_PADCONF(35, 1)>,	/* gmac1_tx_d0 */
-				 <K1_PADCONF(36, 1)>,	/* gmac1_tx_d1 */
-				 <K1_PADCONF(37, 1)>,	/* gmac1_tx */
-				 <K1_PADCONF(38, 1)>,	/* gmac1_tx_d2 */
-				 <K1_PADCONF(39, 1)>,	/* gmac1_tx_d3 */
-				 <K1_PADCONF(40, 1)>,	/* gmac1_tx_en */
-				 <K1_PADCONF(41, 1)>,	/* gmac1_mdc */
-				 <K1_PADCONF(42, 1)>,	/* gmac1_mdio */
-				 <K1_PADCONF(43, 1)>,	/* gmac1_int_n */
-				 <K1_PADCONF(46, 1)>;	/* gmac1_clk_ref */
+		pinmux = <K1_PADCONF(29, 1)>,	/* gmac1_rxdv */
+			 <K1_PADCONF(30, 1)>,	/* gmac1_rx_d0 */
+			 <K1_PADCONF(31, 1)>,	/* gmac1_rx_d1 */
+			 <K1_PADCONF(32, 1)>,	/* gmac1_rx_clk */
+			 <K1_PADCONF(33, 1)>,	/* gmac1_rx_d2 */
+			 <K1_PADCONF(34, 1)>,	/* gmac1_rx_d3 */
+			 <K1_PADCONF(35, 1)>,	/* gmac1_tx_d0 */
+			 <K1_PADCONF(36, 1)>,	/* gmac1_tx_d1 */
+			 <K1_PADCONF(37, 1)>,	/* gmac1_tx */
+			 <K1_PADCONF(38, 1)>,	/* gmac1_tx_d2 */
+			 <K1_PADCONF(39, 1)>,	/* gmac1_tx_d3 */
+			 <K1_PADCONF(40, 1)>,	/* gmac1_tx_en */
+			 <K1_PADCONF(41, 1)>,	/* gmac1_mdc */
+			 <K1_PADCONF(42, 1)>,	/* gmac1_mdio */
+			 <K1_PADCONF(43, 1)>,	/* gmac1_int_n */
+			 <K1_PADCONF(46, 1)>;	/* gmac1_clk_ref */
 
-			bias-pull-up = <0>;
-			drive-strength = <21>;
-		};
+		bias-pull-up = <0>;
+		drive-strength = <21>;
 	};
 
 	uart0_2_cfg: uart0-2-cfg {
-		uart0-2-pins {
-			pinmux = <K1_PADCONF(68, 2)>,
-				 <K1_PADCONF(69, 2)>;
+		pinmux = <K1_PADCONF(68, 2)>,
+			 <K1_PADCONF(69, 2)>;
 
-			bias-pull-up = <0>;
-			drive-strength = <32>;
-		};
+		bias-pull-up = <0>;
+		drive-strength = <32>;
+		bootph-pre-ram;
+	};
+
+	i2c2_0_cfg: i2c2-0-cfg {
+		pinmux = <K1_PADCONF(84, 4)>,	/* I2C2_SCL */
+			 <K1_PADCONF(85, 4)>;	/* I2C2_SDA */
+		bootph-pre-ram;
 	};
 
 	pwm14_1_cfg: pwm14-1-cfg {
-		pwm14-1-pins {
-			pinmux = <K1_PADCONF(44, 4)>;
-			bias-pull-up = <0>;
-			drive-strength = <32>;
-		};
+		pinmux = <K1_PADCONF(44, 4)>;
+		bias-pull-up = <0>;
+		drive-strength = <32>;
 	};
 };
Signature · 1 line
2.25.1
#12 lore raw

PATCH 6/16 configs: k1: enable pinctrl and gpio

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Enable pinctrl and gpio configurations for Spacemit K1 SoC.

---
 board/spacemit/k1/MAINTAINERS | 2 ++
 configs/spacemit_k1_defconfig | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
board/spacemit/k1/MAINTAINERS +2 -0
index 408621ab819..6a2c4c23f9f 100644
@@ -6,6 +6,8 @@ S:	Maintained
 F:	board/spacemit/k1/
 F:	configs/spacemit_k1_defconfig
 F:	doc/board/spacemit/bananapi-f3.rst
+F:	drivers/gpio/spacemit_gpio.c
 F:	drivers/i2c/k1_i2c.c
+F:	drivers/pinctrl/spacemit/pinctrl-k1.c
 F:	drivers/power/pmic/pmic_spacemit_p1.c
 F:	drivers/power/regulator/spacemit_p1_regulator.c
configs/spacemit_k1_defconfig +5 -1
index 16754ea98d3..29a3c71f19e 100644
@@ -31,7 +31,11 @@ CONFIG_SYS_PBSIZE=276
 CONFIG_HUSH_PARSER=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_PINCTRL=y
-CONFIG_PINCTRL_SINGLE=y
+CONFIG_PINCTRL_SPACEMIT_K1=y
+CONFIG_GPIO=y
+CONFIG_DM_GPIO=y
+CONFIG_CMD_GPIO=y
+CONFIG_SPACEMIT_GPIO=y
 CONFIG_RESET_SPACEMIT_K1=y
 CONFIG_SPL_RESET_SPACEMIT_K1=y
 CONFIG_SYS_NS16550=y
Signature · 1 line
2.25.1
#13 lore raw

PATCH 7/16 mtd: spi: select SPL_SPI_FLASH_TINY in SPL stage

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Fix to select CONFIG_SPL_SPI_FLASH_TINY in SPL_BUILD stage.

---
 drivers/mtd/spi/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mtd/spi/Makefile +2 -3
index 44e67cd913a..9a96be11e6d 100644
@@ -8,14 +8,13 @@ spi-nor-y := sf_probe.o spi-nor-ids.o
 
 ifdef CONFIG_XPL_BUILD
 obj-$(CONFIG_SPL_SPI_BOOT)	+= fsl_espi_spl.o
+endif
+
 ifeq ($(CONFIG_$(PHASE_)SPI_FLASH_TINY),y)
 spi-nor-y += spi-nor-tiny.o
 else
 spi-nor-y += spi-nor-core.o
 endif
-else
-spi-nor-y += spi-nor-core.o
-endif
 
 obj-$(CONFIG_SPI_FLASH) += spi-nor.o
 obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o
Signature · 1 line
2.25.1
#14 lore raw

PATCH 8/16 mtd: spi: enable spi_nor_remove() in soft reset config

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

spi_nor_remove() is only implemented in spi-nor-core.o, not spi-nor-tiny.o.

So make spi_nor_remove() only valid for CONFIG_SPI_FLASH_SOFT_RESET.

---
 drivers/mtd/spi/sf_probe.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi/sf_probe.c +5 -3
index 7100b64bf22..dee03662d45 100644
@@ -229,9 +229,11 @@ static int spi_flash_std_remove(struct udevice *dev)
 		spi_mem_dirmap_destroy(flash->dirmap.rdesc);
 	}
 
-	ret = spi_nor_remove(flash);
-	if (ret)
-		return ret;
+	if (CONFIG_IS_ENABLED(SPI_FLASH_SOFT_RESET)) {
+		ret = spi_nor_remove(flash);
+		if (ret)
+			return ret;
+	}
 
 	if (CONFIG_IS_ENABLED(SPI_FLASH_MTD))
 		spi_flash_mtd_unregister(flash);
Signature · 1 line
2.25.1
#15 lore raw

PATCH 9/16 spi: fsl: add support for Spacemit K1 SoC

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Make FSL QSPI driver supporting Spacemit K1 SoC.

---
 drivers/spi/fsl_qspi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/fsl_qspi.c +9 -0
index 65ab3e306d7..5692510a558 100644
@@ -267,6 +267,14 @@ static const struct fsl_qspi_devtype_data ls2080a_data = {
 	.little_endian = true,
 };
 
+static const struct fsl_qspi_devtype_data spacemit_k1_data = {
+	.rxfifo = SZ_128,
+	.txfifo = SZ_256,
+	.ahb_buf_size = SZ_128,
+	.quirks = QUADSPI_QUIRK_TKT253890,
+	.little_endian = true,
+};
+
 struct fsl_qspi {
 	struct udevice *dev;
 	void __iomem *iobase;
@@ -870,6 +878,7 @@ static const struct udevice_id fsl_qspi_ids[] = {
 	{ .compatible = "fsl,ls1021a-qspi", .data = (ulong)&ls1021a_data, },
 	{ .compatible = "fsl,ls1088a-qspi", .data = (ulong)&ls2080a_data, },
 	{ .compatible = "fsl,ls2080a-qspi", .data = (ulong)&ls2080a_data, },
+	{ .compatible = "spacemit,k1-qspi", .data = (ulong)&spacemit_k1_data, },
 	{ }
 };
 
Signature · 1 line
2.25.1
#16 lore raw

PATCH 10/16 dts: k1: add QSPI controller support

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Add QSPI controller support in DTS for Spacemit K1 SoC.

---
 arch/riscv/dts/k1-spl.dts | 15 +++++++++++++++
 arch/riscv/dts/k1.dtsi    | 16 ++++++++++++++++
 2 files changed, 31 insertions(+)
arch/riscv/dts/k1-spl.dts +15 -0
index 6f9407aada6..e3311af76e6 100644
@@ -226,3 +226,18 @@
 		};
 	};
 };
+
+&qspi {
+	status = "okay";
+	bootph-pre-ram;
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <26500000>;
+		m25p,fast-read;
+		broken-flash-reset;
+		status = "okay";
+		bootph-pre-ram;
+	};
+};
arch/riscv/dts/k1.dtsi +16 -0
index fc3a693a10e..96f604b0561 100644
@@ -879,6 +879,22 @@
 				status = "disabled";
 			};
 
+			qspi: spi@d420c000 {
+				compatible = "spacemit,k1-qspi";
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0x0 0xd420c000 0x0 0x1000>,
+				      <0x0 0xb8000000 0x0 0xc00000>;
+				reg-names = "QuadSPI", "QuadSPI-memory";
+				clocks = <&syscon_apmu CLK_QSPI_BUS>,
+					 <&syscon_apmu CLK_QSPI>;
+				clock-names = "qspi_en", "qspi";
+				resets = <&syscon_apmu RESET_QSPI>,
+					 <&syscon_apmu RESET_QSPI_BUS>;
+				interrupts = <117>;
+				status = "disabled";
+			};
+
 			sec_uart1: serial@f0612000 {
 				compatible = "spacemit,k1-uart",
 					     "intel,xscale-uart";
Signature · 1 line
2.25.1
#17 lore raw

PATCH 11/16 board: k1: enable SPI NOR flash in SPL

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Enable SPI NOR flash in SPL stage.

---
 board/spacemit/k1/spl.c       | 24 +++++++++++++++++++++++-
 configs/spacemit_k1_defconfig | 22 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
board/spacemit/k1/spl.c +23 -1
index 5af804f0409..77b6df1371b 100644
@@ -20,6 +20,7 @@
 #include <spl.h>
 #include <tlv_eeprom.h>
 #include "tlv_codes.h"
+#include <spi_flash.h>
 
 #define MUX_MODE4		4
 #define EDGE_NONE		BIT(6)
@@ -309,6 +310,21 @@ void ddr_early_init(void)
 		log_info("DDR isn't invalid\n");
 }
 
+void nor_early_init(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	ret = uclass_get_device(UCLASS_SPI, 0, &dev);
+	if (ret)
+		panic("Fail to detect spi controller.\n");
+	udelay(10);
+	ret = uclass_get_device(UCLASS_SPI_FLASH, 0, &dev);
+	if (ret)
+		panic("Fail to detect spi nor flash.\n");
+	udelay(10);
+}
+
 void board_init_f(ulong dummy)
 {
 	u8 i2c_buf[I2C_BUF_SIZE];
@@ -335,13 +351,19 @@ void board_init_f(ulong dummy)
 	pmic_init();
 
 	ddr_early_init();
+	nor_early_init();
 }
 
 u32 spl_boot_device(void)
 {
-	return BOOT_DEVICE_NOR;
+	return BOOT_DEVICE_SPI;
 }
 
 void spl_board_init(void)
 {
 }
+
+void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
+{
+	return (void *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+}
configs/spacemit_k1_defconfig +22 -0
index 29a3c71f19e..97b6c8cbbb0 100644
@@ -14,6 +14,7 @@ CONFIG_SPL_HAVE_INIT_STACK=y
 CONFIG_SPL_STACK=0xc0840000
 CONFIG_SPL_SIZE_LIMIT=0x31000
 CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x08000000
 CONFIG_STACK_SIZE=0x100000
 CONFIG_SYS_BOOTM_LEN=0xa000000
@@ -29,7 +30,10 @@ CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 # CONFIG_BOARD_INIT is not set
 CONFIG_HUSH_PARSER=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_OFFSET=0x60000
+CONFIG_ENV_SIZE=0x4000
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_SPACEMIT_K1=y
 CONFIG_GPIO=y
@@ -65,6 +69,18 @@ CONFIG_DM_PMIC=y
 CONFIG_PMIC_SPACEMIT_P1=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_SPACEMIT_P1=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_FSL_QSPI=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_MEM=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x000a0000
+CONFIG_CMD_SPI=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SPL_LIB_RATIONAL=y
 CONFIG_SPL_DM_RESET=y
@@ -78,3 +94,9 @@ CONFIG_SPL_CMD_TLV_EEPROM=y
 CONFIG_SPL_POWER=y
 CONFIG_SPL_DM_PMIC=y
 CONFIG_SPL_DM_REGULATOR=y
+CONFIG_SPL_SPI=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SPL_SPI_FLASH_TINY=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
Signature · 1 line
2.25.1
#18 lore raw

PATCH 12/16 riscv: binman: Always set default configuration in FIT image

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

When CONFIG_MULTI_DTB_FIT is enabled, the FIT image contains multiple device tree configurations for different boards. The default configuration must be explicitly set to ensure the FIT framework traverses all available configurations instead of falling back to CONFIG_DEFAULT_DEVICE_TREE.

Without this default property, fit_find_config_node() will use CONFIG_DEFAULT_DEVICE_TREE as the configuration name to match. This prevents the SPL from correctly selecting the appropriate DTB based on runtime board detection (e.g., from EEPROM).

Remove the conditional guard so that "default = conf-1" is always present in the FIT image, regardless of CONFIG_MULTI_DTB_FIT.

---
 arch/riscv/dts/binman.dtsi | 2 --
 1 file changed, 2 deletions(-)
arch/riscv/dts/binman.dtsi +0 -2
index b518560bb94..84c261c6849 100644
@@ -93,9 +93,7 @@
 
 			configurations {
 
-#ifndef CONFIG_MULTI_DTB_FIT
 				default = "conf-1";
-#endif
 
 #if !defined(CONFIG_OF_BOARD) || defined(CONFIG_MULTI_DTB_FIT)
 				@conf-SEQ {
Signature · 1 line
2.25.1
#19 lore raw

PATCH 13/16 spacemit: k1: append RISCV_MMODE_TIMERBASE

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Append the definition of RISCV_MMODE_TIMER_BASE & RISCV_MMODE_TIMEROFF. Since they're required by riscv aclint timer.

---
 include/configs/k1.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
include/configs/k1.h +7 -5
index 8e148803dea..33cbbeb6fd6 100644
@@ -8,12 +8,14 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CFG_SYS_SDRAM_BASE	    0x0
+#define CFG_SYS_SDRAM_BASE		0x0
 
-#define CFG_SYS_NS16550_CLK	    14700000
-#define CFG_SYS_NS16550_IER	    0x40 /* UART Unit Enable */
+#define CFG_SYS_NS16550_CLK		14700000
+#define CFG_SYS_NS16550_IER		0x40 /* UART Unit Enable */
 
-#define RISCV_MMODE_TIMER_FREQ	    24000000
-#define RISCV_SMODE_TIMER_FREQ	    24000000
+#define RISCV_MMODE_TIMERBASE		0xe4000000
+#define RISCV_MMODE_TIMEROFF		0xbff8
+#define RISCV_MMODE_TIMER_FREQ		24000000
+#define RISCV_SMODE_TIMER_FREQ		24000000
 
 #endif /* __CONFIG_H */
Signature · 1 line
2.25.1
#20 lore raw

PATCH 14/16 spacemit: k1: Add multiple device tree support

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Enable multiple DTB support in the FIT image for the Spacemit K1 SoC, allowing a single U-Boot binary to support different board variants.

The SPL reads the board type from EEPROM and selects the corresponding device tree at runtime via board_fit_config_name_match(), ensuring the correct hardware description is passed to U-Boot proper.

Enlarge CONFIG_SYS_MALLOC_F_LEN to enable multiple device tree support.

Switch to MMODE since opensbi firmware is included at the same tim.

---
 arch/riscv/dts/Makefile           |   2 +-
 arch/riscv/dts/k1-bananapi-f3.dts | 161 ++++++++++++++++++++++++
 arch/riscv/dts/k1-muse-pi-pro.dts | 199 ++++++++++++++++++++++++++++++
 arch/riscv/dts/k1-spl.dts         |  47 +++----
 board/spacemit/k1/spl.c           |  29 ++++-
 configs/spacemit_k1_defconfig     |   7 +-
 6 files changed, 415 insertions(+), 30 deletions(-)
 create mode 100644 arch/riscv/dts/k1-muse-pi-pro.dts
arch/riscv/dts/Makefile +1 -1
index 61a7acabd27..22b62e25d4d 100644
@@ -9,7 +9,7 @@ dtb-$(CONFIG_TARGET_LICHEERV_NANO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb
 dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
-dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1-bananapi-f3.dtb k1-spl.dtb
+dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1-bananapi-f3.dtb k1-muse-pi-pro.dtb k1-spl.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv64.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-binman.dtb
arch/riscv/dts/k1-bananapi-f3.dts +161 -0

169 lines not on this page · raw message

arch/riscv/dts/k1-muse-pi-pro.dts new file +199 -0

199 lines not on this page · raw message

arch/riscv/dts/k1-spl.dts +24 -23

65 lines not on this page · raw message

board/spacemit/k1/spl.c +25 -4
index 77b6df1371b..9b30bc9ea7e 100644
@@ -8,12 +8,12 @@
 #include <binman_sym.h>
 #include <clk.h>
 #include <clk-uclass.h>
-#include <cpu_func.h>
 #include <configs/k1.h>
 #include <cpu_func.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <i2c.h>
+#include <linux/ctype.h>
 #include <linux/delay.h>
 #include <log.h>
 #include <power/regulator.h>
@@ -56,6 +56,8 @@ struct ddr_cfg {
 binman_sym_declare(ulong, ddr_fw, image_pos);
 binman_sym_declare(ulong, ddr_fw, size);
 
+char product_name[I2C_BUF_SIZE] = "k1";
+
 static void reset_early_init(void)
 {
 	struct udevice *dev;
@@ -327,7 +329,6 @@ void nor_early_init(void)
 
 void board_init_f(ulong dummy)
 {
-	u8 i2c_buf[I2C_BUF_SIZE];
 	int ret;
 
 	ret = spl_early_init();
@@ -343,11 +344,11 @@ void board_init_f(ulong dummy)
 	preloader_console_init();
 
 	i2c_early_init();
-	ret = read_product_name(i2c_buf, I2C_BUF_SIZE);
+	ret = read_product_name(product_name, I2C_BUF_SIZE);
 	if (ret)
 		log_info("Fail to detect board:%d\n", ret);
 	else
-		log_info("Get board name:%s\n", (char *)i2c_buf);
+		log_info("Get board name:%s\n", product_name);
 	pmic_init();
 
 	ddr_early_init();
@@ -363,6 +364,26 @@ void spl_board_init(void)
 {
 }
 
+int board_fit_config_name_match(const char *name)
+{
+	char fdt_name[I2C_BUF_SIZE];
+	int i;
+
+	memset(fdt_name, 0, I2C_BUF_SIZE);
+	if (!strncmp(product_name, "k1-x_", 5)) {
+		snprintf(fdt_name, I2C_BUF_SIZE, "%s-%s", "k1",
+			 &product_name[5]);
+	}
+	for (i = 0; i < I2C_BUF_SIZE; i++) {
+		if (fdt_name[i] == '\0')
+			break;
+		fdt_name[i] = tolower(fdt_name[i]);
+	}
+	if (!strcmp(name, fdt_name))
+		return 0;
+	return -ENOENT;
+}
+
 void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
 {
 	return (void *)CONFIG_SPL_LOAD_FIT_ADDRESS;
configs/spacemit_k1_defconfig +5 -2
index 97b6c8cbbb0..13f055cdf53 100644
@@ -4,6 +4,7 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
 CONFIG_DEFAULT_DEVICE_TREE="k1-spl"
+CONFIG_OF_LIST="k1-bananapi-f3 k1-muse-pi-pro"
 CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0xc0801000
 CONFIG_SPL_MAX_SIZE=0x33000
@@ -22,7 +23,8 @@ CONFIG_SYS_LOAD_ADDR=0x200000
 CONFIG_ARCH_RV64I=y
 CONFIG_RISCV_SMODE=y
 CONFIG_TARGET_SPACEMIT_K1=y
-CONFIG_SPL_RISCV_SMODE=y
+CONFIG_SPL_RISCV_MMODE=y
+# CONFIG_SPL_SMP is not set
 CONFIG_FIT=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
@@ -58,7 +60,7 @@ CONFIG_CLK=y
 CONFIG_CLK_CCF=y
 CONFIG_CLK_SPACEMIT=y
 CONFIG_CLK_SPACEMIT_K1=y
-CONFIG_SYS_MALLOC_F_LEN=0x5000
+CONFIG_SYS_MALLOC_F_LEN=0x10000
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_SPACEMIT_K1=y
 CONFIG_MISC=y
@@ -100,3 +102,4 @@ CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_SPI_FLASH_TINY=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x5300
Signature · 1 line
2.25.1
#21 lore raw

PATCH 15/16 spacemit: k1: Add support for mmc regulator initialization

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

Initialize the 1.8V supply for the MMC I/O domain to ensure proper voltage configuration for MMC interfaces. This is required for reliable operation of the MMC controller.

---
 board/spacemit/k1/spl.c | 3 +++
 1 file changed, 3 insertions(+)
board/spacemit/k1/spl.c +3 -0
index 9b30bc9ea7e..2556dfe047a 100644
@@ -196,6 +196,9 @@ static void set_vdd_mmc(void)
 	ret = regulator_get_by_platname("vdd_1v8_mmc", &dev);
 	if (ret)
 		panic("Fail to detect vdd_1v8_mmc (%d)\n", ret);
+	ret = regulator_set_value(dev, 1800000);
+	if (ret)
+		log_warning("Fail to set vdd_1v8_mmc as 1800000 (%d)\n", ret);
 	ret = regulator_set_enable(dev, true);
 	if (ret)
 		log_warning("Fail to enable vdd_1v8_mmc (%d)\n", ret);
Signature · 1 line
2.25.1
#22 lore raw

PATCH 16/16 spacemit: k1: rename device tree prefix from "k1-" to "k1_"

In reply to Raymond Mao

From: Raymond Mao <[email protected]>

This change replaces the hyphen ("-") in the DTS prefix with an underscore ("_") for consistency with other prefixes in the Spacemit K1 SoC platform.

---
 arch/riscv/dts/Makefile                                   | 2 +-
 arch/riscv/dts/{k1-bananapi-f3.dts => k1_bananapi-f3.dts} | 2 +-
 arch/riscv/dts/{k1-muse-pi-pro.dts => k1_muse-pi-pro.dts} | 0
 arch/riscv/dts/{k1-pinctrl.dtsi => k1_pinctrl.dtsi}       | 0
 arch/riscv/dts/{k1-spl.dts => k1_spl.dts}                 | 0
 board/spacemit/k1/spl.c                                   | 2 +-
 configs/spacemit_k1_defconfig                             | 4 ++--
 7 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/riscv/dts/{k1-bananapi-f3.dts => k1_bananapi-f3.dts} (99%)
 rename arch/riscv/dts/{k1-muse-pi-pro.dts => k1_muse-pi-pro.dts} (100%)
 rename arch/riscv/dts/{k1-pinctrl.dtsi => k1_pinctrl.dtsi} (100%)
 rename arch/riscv/dts/{k1-spl.dts => k1_spl.dts} (100%)
arch/riscv/dts/Makefile +1 -1
index 22b62e25d4d..3827ff72215 100644
@@ -9,7 +9,7 @@ dtb-$(CONFIG_TARGET_LICHEERV_NANO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb
 dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
-dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1-bananapi-f3.dtb k1-muse-pi-pro.dtb k1-spl.dtb
+dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1_bananapi-f3.dtb k1_muse-pi-pro.dtb k1_spl.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv64.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-binman.dtb
arch/riscv/dts/k1_bananapi-f3.dts renamed from arch/riscv/dts/k1-bananapi-f3.dts +1 -1
similarity index 99%
rename from arch/riscv/dts/k1-bananapi-f3.dts
rename to arch/riscv/dts/k1_bananapi-f3.dts
index ea11029c182..bcb5be5f1bc 100644
@@ -5,7 +5,7 @@
 
 #include "k1.dtsi"
 #include "binman.dtsi"
-#include "k1-pinctrl.dtsi"
+#include "k1_pinctrl.dtsi"
 
 / {
 	model = "Banana Pi BPI-F3";
arch/riscv/dts/k1_muse-pi-pro.dts renamed from arch/riscv/dts/k1-muse-pi-pro.dts +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-muse-pi-pro.dts
rename to arch/riscv/dts/k1_muse-pi-pro.dts
arch/riscv/dts/k1_pinctrl.dtsi renamed from arch/riscv/dts/k1-pinctrl.dtsi +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-pinctrl.dtsi
rename to arch/riscv/dts/k1_pinctrl.dtsi
arch/riscv/dts/k1_spl.dts renamed from arch/riscv/dts/k1-spl.dts +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-spl.dts
rename to arch/riscv/dts/k1_spl.dts
board/spacemit/k1/spl.c +1 -1
index 2556dfe047a..b8e1327dc57 100644
@@ -374,7 +374,7 @@ int board_fit_config_name_match(const char *name)
 
 	memset(fdt_name, 0, I2C_BUF_SIZE);
 	if (!strncmp(product_name, "k1-x_", 5)) {
-		snprintf(fdt_name, I2C_BUF_SIZE, "%s-%s", "k1",
+		snprintf(fdt_name, I2C_BUF_SIZE, "%s_%s", "k1",
 			 &product_name[5]);
 	}
 	for (i = 0; i < I2C_BUF_SIZE; i++) {
configs/spacemit_k1_defconfig +2 -2
index 13f055cdf53..ddd0c959c12 100644
@@ -3,8 +3,8 @@ CONFIG_SYS_MALLOC_LEN=0x1000000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
-CONFIG_DEFAULT_DEVICE_TREE="k1-spl"
-CONFIG_OF_LIST="k1-bananapi-f3 k1-muse-pi-pro"
+CONFIG_DEFAULT_DEVICE_TREE="k1_spl"
+CONFIG_OF_LIST="k1_bananapi-f3 k1_muse-pi-pro"
 CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0xc0801000
 CONFIG_SPL_MAX_SIZE=0x33000
Signature · 1 line
2.25.1
#23 lore raw

Re: [PATCH 16/16] spacemit: k1: rename device tree prefix from "k1-" to "k1_"

Quoted 5 lines · Raymond Mao

From: Raymond Mao <[email protected]>

This change replaces the hyphen ("-") in the DTS prefix with an underscore ("_") for consistency with other prefixes in the Spacemit K1 SoC platform.

Doesn't this inconsistency only exist because you added files that made it inconsistent? Using hyphens is the norm anyway, right?

Quoted 88 lines
---
 arch/riscv/dts/Makefile                                   | 2 +-
 arch/riscv/dts/{k1-bananapi-f3.dts => k1_bananapi-f3.dts} | 2 +-
 arch/riscv/dts/{k1-muse-pi-pro.dts => k1_muse-pi-pro.dts} | 0
 arch/riscv/dts/{k1-pinctrl.dtsi => k1_pinctrl.dtsi}       | 0
 arch/riscv/dts/{k1-spl.dts => k1_spl.dts}                 | 0
 board/spacemit/k1/spl.c                                   | 2 +-
 configs/spacemit_k1_defconfig                             | 4 ++--
 7 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/riscv/dts/{k1-bananapi-f3.dts => k1_bananapi-f3.dts} (99%)
 rename arch/riscv/dts/{k1-muse-pi-pro.dts => k1_muse-pi-pro.dts} (100%)
 rename arch/riscv/dts/{k1-pinctrl.dtsi => k1_pinctrl.dtsi} (100%)
 rename arch/riscv/dts/{k1-spl.dts => k1_spl.dts} (100%)
arch/riscv/dts/Makefile +1 -1
index 22b62e25d4d..3827ff72215 100644
@@ -9,7 +9,7 @@ dtb-$(CONFIG_TARGET_LICHEERV_NANO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb
 dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
-dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1-bananapi-f3.dtb k1-muse-pi-pro.dtb k1-spl.dtb
+dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1_bananapi-f3.dtb k1_muse-pi-pro.dtb k1_spl.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv64.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-binman.dtb
arch/riscv/dts/k1_bananapi-f3.dts renamed from arch/riscv/dts/k1-bananapi-f3.dts +1 -1
similarity index 99%
rename from arch/riscv/dts/k1-bananapi-f3.dts
rename to arch/riscv/dts/k1_bananapi-f3.dts
index ea11029c182..bcb5be5f1bc 100644
@@ -5,7 +5,7 @@
 
 #include "k1.dtsi"
 #include "binman.dtsi"
-#include "k1-pinctrl.dtsi"
+#include "k1_pinctrl.dtsi"
 
 / {
 	model = "Banana Pi BPI-F3";
arch/riscv/dts/k1_muse-pi-pro.dts renamed from arch/riscv/dts/k1-muse-pi-pro.dts +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-muse-pi-pro.dts
rename to arch/riscv/dts/k1_muse-pi-pro.dts
arch/riscv/dts/k1_pinctrl.dtsi renamed from arch/riscv/dts/k1-pinctrl.dtsi +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-pinctrl.dtsi
rename to arch/riscv/dts/k1_pinctrl.dtsi
arch/riscv/dts/k1_spl.dts renamed from arch/riscv/dts/k1-spl.dts +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-spl.dts
rename to arch/riscv/dts/k1_spl.dts
board/spacemit/k1/spl.c +1 -1
index 2556dfe047a..b8e1327dc57 100644
@@ -374,7 +374,7 @@ int board_fit_config_name_match(const char *name)
 
 	memset(fdt_name, 0, I2C_BUF_SIZE);
 	if (!strncmp(product_name, "k1-x_", 5)) {
-		snprintf(fdt_name, I2C_BUF_SIZE, "%s-%s", "k1",
+		snprintf(fdt_name, I2C_BUF_SIZE, "%s_%s", "k1",
 			 &product_name[5]);
 	}
 	for (i = 0; i < I2C_BUF_SIZE; i++) {
configs/spacemit_k1_defconfig +2 -2
index 13f055cdf53..ddd0c959c12 100644
@@ -3,8 +3,8 @@ CONFIG_SYS_MALLOC_LEN=0x1000000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
-CONFIG_DEFAULT_DEVICE_TREE="k1-spl"
-CONFIG_OF_LIST="k1-bananapi-f3 k1-muse-pi-pro"
+CONFIG_DEFAULT_DEVICE_TREE="k1_spl"
+CONFIG_OF_LIST="k1_bananapi-f3 k1_muse-pi-pro"
 CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0xc0801000
 CONFIG_SPL_MAX_SIZE=0x33000
Signature · 1 line
2.25.1
#24 lore raw

Re: [PATCH 16/16] spacemit: k1: rename device tree prefix from "k1-" to "k1_"

Am 29. April 2026 21:42:04 MESZ schrieb Conor Dooley <[email protected]>:

Quoted 9 lines · Raymond Mao
Quoted 5 lines

From: Raymond Mao <[email protected]>

This change replaces the hyphen ("-") in the DTS prefix with an underscore ("_") for consistency with other prefixes in the Spacemit K1 SoC platform.

Doesn't this inconsistency only exist because you added files that made it inconsistent? Using hyphens is the norm anyway, right?

The kernel uses hyphens. We should not deviate from Linux. In the long term we want to use the upstream Linux device-trees in U-Boot.

Renaming in Linux should also be avoided.

Best regards

Heinrich

Quoted 89 lines
Quoted 89 lines
---
 arch/riscv/dts/Makefile                                   | 2 +-
 arch/riscv/dts/{k1-bananapi-f3.dts => k1_bananapi-f3.dts} | 2 +-
 arch/riscv/dts/{k1-muse-pi-pro.dts => k1_muse-pi-pro.dts} | 0
 arch/riscv/dts/{k1-pinctrl.dtsi => k1_pinctrl.dtsi}       | 0
 arch/riscv/dts/{k1-spl.dts => k1_spl.dts}                 | 0
 board/spacemit/k1/spl.c                                   | 2 +-
 configs/spacemit_k1_defconfig                             | 4 ++--
 7 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/riscv/dts/{k1-bananapi-f3.dts => k1_bananapi-f3.dts} (99%)
 rename arch/riscv/dts/{k1-muse-pi-pro.dts => k1_muse-pi-pro.dts} (100%)
 rename arch/riscv/dts/{k1-pinctrl.dtsi => k1_pinctrl.dtsi} (100%)
 rename arch/riscv/dts/{k1-spl.dts => k1_spl.dts} (100%)
arch/riscv/dts/Makefile +1 -1
index 22b62e25d4d..3827ff72215 100644
@@ -9,7 +9,7 @@ dtb-$(CONFIG_TARGET_LICHEERV_NANO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb
 dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
-dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1-bananapi-f3.dtb k1-muse-pi-pro.dtb k1-spl.dtb
+dtb-$(CONFIG_TARGET_SPACEMIT_K1) += k1_bananapi-f3.dtb k1_muse-pi-pro.dtb k1_spl.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv64.dtb
 dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-binman.dtb
arch/riscv/dts/k1_bananapi-f3.dts renamed from arch/riscv/dts/k1-bananapi-f3.dts +1 -1
similarity index 99%
rename from arch/riscv/dts/k1-bananapi-f3.dts
rename to arch/riscv/dts/k1_bananapi-f3.dts
index ea11029c182..bcb5be5f1bc 100644
@@ -5,7 +5,7 @@
 
 #include "k1.dtsi"
 #include "binman.dtsi"
-#include "k1-pinctrl.dtsi"
+#include "k1_pinctrl.dtsi"
 
 / {
 	model = "Banana Pi BPI-F3";
arch/riscv/dts/k1_muse-pi-pro.dts renamed from arch/riscv/dts/k1-muse-pi-pro.dts +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-muse-pi-pro.dts
rename to arch/riscv/dts/k1_muse-pi-pro.dts
arch/riscv/dts/k1_pinctrl.dtsi renamed from arch/riscv/dts/k1-pinctrl.dtsi +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-pinctrl.dtsi
rename to arch/riscv/dts/k1_pinctrl.dtsi
arch/riscv/dts/k1_spl.dts renamed from arch/riscv/dts/k1-spl.dts +0 -0
similarity index 100%
rename from arch/riscv/dts/k1-spl.dts
rename to arch/riscv/dts/k1_spl.dts
board/spacemit/k1/spl.c +1 -1
index 2556dfe047a..b8e1327dc57 100644
@@ -374,7 +374,7 @@ int board_fit_config_name_match(const char *name)
 
 	memset(fdt_name, 0, I2C_BUF_SIZE);
 	if (!strncmp(product_name, "k1-x_", 5)) {
-		snprintf(fdt_name, I2C_BUF_SIZE, "%s-%s", "k1",
+		snprintf(fdt_name, I2C_BUF_SIZE, "%s_%s", "k1",
 			 &product_name[5]);
 	}
 	for (i = 0; i < I2C_BUF_SIZE; i++) {
configs/spacemit_k1_defconfig +2 -2
index 13f055cdf53..ddd0c959c12 100644
@@ -3,8 +3,8 @@ CONFIG_SYS_MALLOC_LEN=0x1000000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
-CONFIG_DEFAULT_DEVICE_TREE="k1-spl"
-CONFIG_OF_LIST="k1-bananapi-f3 k1-muse-pi-pro"
+CONFIG_DEFAULT_DEVICE_TREE="k1_spl"
+CONFIG_OF_LIST="k1_bananapi-f3 k1_muse-pi-pro"
 CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0xc0801000
 CONFIG_SPL_MAX_SIZE=0x33000
Signature · 1 line
2.25.1