* [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support
@ 2026-10-29 13:46 Anand Moon
2026-10-29 13:46 ` [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization Anand Moon
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot; +Cc: Anand Moon, Yixun Lan
This series improves U-Boot support for SpacemiT K1-based boards by
consolidating common device tree configuration and enabling GPIO and
pinctrl support during SPL initialization.
It also improves the SpacemiT SDHCI driver's voltage-switching
diagnostics and handling of missing pinctrl states, making SD card
initialization more robust across board configurations.
This series builds on the upstream changes proposed here:
[1] https://lore.kernel.org/all/20261024092558.143621-1-alan.tseng.cs@gmail.com/
The SpacemiT SPL uses the P1 PMIC to initialize the regulator
framework and enable the SD card and eMMC interfaces. Since boards
may use different device tree node names for vmmc-supply and
vqmmc-supply, the regulator configuration must be handled
appropriately for each board.
This series used above series to marks the nodes required during early
initialization with bootph-pre-ram, including SoC clocks, UART, boot media,
I2C buses, EEPROM, PMIC rails, and SPI NOR flash. This ensures that the
required devices are available during SPL execution.
Additionally, the series moves the I2C8-related nodes required for
regulator configuration into the respective board device trees.
This avoids duplicated board-specific settings in the shared
spacemit-k1-u-boot.dtsi and keeps the common K1 configuration minimal
and easier to maintain.
Tested on the Banana Pi BPI-F3 board.
Thanks,
Anand
Anand Moon (6):
riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL
Initialization
mmc: spacemit_sdhci: Improve voltage switching diagnostics
mmc: spacemit_sdhci: Handle missing pinctrl states
gpio: spacemit: Add SPL support for K1 GPIO driver
pinctrl: spacemit: Add SPL support for K1 pinctrl driver
configs: spacemit_k1: Enable SPL GPIO and pinctrl support
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi | 121 ------------------
arch/riscv/dts/spacemit-k1-binman.dtsi | 29 +++++
...ro-u-boot.dtsi => spacemit-k1-u-boot.dtsi} | 80 +++++-------
configs/spacemit_k1_defconfig | 20 ++-
drivers/gpio/Kconfig | 7 +
drivers/mmc/spacemit_sdhci.c | 118 ++++++++++++-----
drivers/pinctrl/spacemit/Kconfig | 8 ++
7 files changed, 174 insertions(+), 209 deletions(-)
delete mode 100644 arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
create mode 100644 arch/riscv/dts/spacemit-k1-binman.dtsi
rename arch/riscv/dts/{k1-musepi-pro-u-boot.dtsi => spacemit-k1-u-boot.dtsi} (66%)
base-commit: 03e45557e1f38a39a0c80fe30483130ff376cf92
--
2.56.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
@ 2026-10-29 13:46 ` Anand Moon
2026-10-31 11:54 ` Hung-Chun Tseng
2026-10-31 11:56 ` Hung-Chun Tseng
2026-10-29 13:46 ` [PATCH v1 2/6] mmc: spacemit_sdhci: Improve voltage switching diagnostics Anand Moon
` (4 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Yixun Lan, Huan Zhou, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini,
Guodong Xu, Raymond Mao, u-boot-spacemit
Consolidate common SpacemiT K1 U-Boot device tree configuration into
spacemit-k1-u-boot.dtsi, replacing the MusePi Pro and Banana Pi F3
specific overlays with a shared K1 configuration.
Separate the Binman layout and DDR firmware packaging into
spacemit-k1-binman.dtsi, keeping image generation independent of
board-specific bring-up.
Keep common clock, UART, I2C, GPIO, and pinctrl settings in the shared
DTSI to support SPL initialization and reduce duplicated board-specific
configuration.
Move the I2C8 regulator configuration to dts/upstream so regulators
can be mapped by name to the corresponding nodes in the board device
trees.
These changes provide a cleaner foundation for migrating peripheral
configuration to the upstream device trees while minimizing duplicated
settings across SpacemiT K1 boards.
Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi | 121 ------------------
arch/riscv/dts/spacemit-k1-binman.dtsi | 29 +++++
...ro-u-boot.dtsi => spacemit-k1-u-boot.dtsi} | 80 +++++-------
3 files changed, 59 insertions(+), 171 deletions(-)
delete mode 100644 arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
create mode 100644 arch/riscv/dts/spacemit-k1-binman.dtsi
rename arch/riscv/dts/{k1-musepi-pro-u-boot.dtsi => spacemit-k1-u-boot.dtsi} (66%)
diff --git a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
deleted file mode 100644
index 3077cdee55d..00000000000
--- a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
+++ /dev/null
@@ -1,121 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+ OR MIT
-/*
- * Copyright (C) 2026 RISCstar Ltd.
- */
-
-#include "binman.dtsi"
-
-/ {
- memory@0 {
- device_type = "memory";
- reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
- };
-};
-
-&uart0 {
- bootph-pre-ram;
-};
-
-&osc_32k {
- bootph-pre-ram;
-};
-
-&vctcxo_1m {
- bootph-pre-ram;
-};
-
-&vctcxo_3m {
- bootph-pre-ram;
-};
-
-&vctcxo_24m {
- bootph-pre-ram;
-};
-
-&syscon_mpmu {
- bootph-pre-ram;
-};
-
-&pll {
- bootph-pre-ram;
-};
-
-&syscon_apmu {
- bootph-pre-ram;
-};
-
-&syscon_apbc {
- bootph-pre-ram;
-};
-
-&i2c2 {
- bootph-pre-ram;
-
- eeprom@50 {
- bootph-pre-ram;
- };
-};
-
-/*
- * The kernel pmic@41 nodes use the standard regulator-* properties only;
- * U-Boot's regulator framework looks up suppliers by `regulator-name`.
- * Carry the U-Boot-specific names (vdd_core / vdd_1v8 / vdd_1v8_mmc) here
- * so SPL can program the bucks that DDR training depends on.
- */
-&i2c8 {
- bootph-pre-ram;
-
- pmic@41 {
- bootph-pre-ram;
-
- regulators {
- buck1 {
- regulator-name = "vdd_core";
- bootph-pre-ram;
- };
-
- buck3 {
- regulator-name = "vdd_1v8";
- bootph-pre-ram;
- };
-
- aldo1 {
- regulator-name = "vdd_1v8_mmc";
- bootph-pre-ram;
- };
- };
- };
-};
-
-&emmc {
- bootph-pre-ram;
- max-frequency = <204800000>;
-};
-
-&sdhci0 {
- bootph-pre-ram;
- max-frequency = <204800000>;
-};
-
-&binman {
- u-boot-spl-ddr {
- type = "section";
- filename = "u-boot-spl-ddr.bin";
- pad-byte = <0xff>;
-
- u-boot-spl {
- };
-
- ddr-fw {
- type = "blob";
- filename = "ddr_fw.bin";
- align = <64>;
- };
-
- u-boot-any {
- type = "section";
- size = <0>;
- offset = <0>;
- };
- };
-};
diff --git a/arch/riscv/dts/spacemit-k1-binman.dtsi b/arch/riscv/dts/spacemit-k1-binman.dtsi
new file mode 100644
index 00000000000..2ff6bd2cc43
--- /dev/null
+++ b/arch/riscv/dts/spacemit-k1-binman.dtsi
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Copyright (C) 2026 RISCstar Ltd.
+ */
+
+#include "binman.dtsi"
+
+&binman {
+ u-boot-spl-ddr {
+ type = "section";
+ filename = "u-boot-spl-ddr.bin";
+ pad-byte = <0xff>;
+
+ u-boot-spl {
+ };
+
+ ddr-fw {
+ type = "blob";
+ filename = "ddr_fw.bin";
+ align = <64>;
+ };
+
+ u-boot-any {
+ type = "section";
+ size = <0>;
+ offset = <0>;
+ };
+ };
+};
diff --git a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
similarity index 66%
rename from arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
rename to arch/riscv/dts/spacemit-k1-u-boot.dtsi
index d6299c96949..94107da3e5f 100644
--- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
+++ b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
@@ -4,12 +4,13 @@
*/
#include <dt-bindings/clock/spacemit,k1-syscon.h>
-#include "binman.dtsi"
/ {
aliases {
console = &uart0;
serial0 = &uart0;
+ mmc0 = &emmc;
+ mmc1 = &sdhci0;
};
chosen {
@@ -83,77 +84,56 @@
};
};
-&i2c8 {
+&qspi {
bootph-pre-ram;
status = "okay";
- pmic@41 {
+ flash@0 {
+ reg = <0>;
+ spi-max-frequency = <50000000>;
bootph-pre-ram;
- compatible = "spacemit,p1";
- reg = <0x41>;
- interrupts = <64>;
status = "okay";
-
- regulators {
- buck1 {
- bootph-pre-ram;
- regulator-name = "vdd_core";
- };
-
- buck3_1v8: buck3 {
- bootph-pre-ram;
- regulator-name = "vdd_1v8";
- };
-
- aldo1 {
- bootph-pre-ram;
- regulator-name = "vdd_1v8_mmc";
- };
-
- };
};
};
-&qspi {
+&qspi_cfg {
bootph-pre-ram;
- status = "okay";
-
- flash@0 {
- bootph-pre-ram;
- status = "okay";
- };
};
&emmc {
+ compatible = "spacemit,k1-sdhci";
bootph-pre-ram;
max-frequency = <204800000>;
+ status = "okay";
};
&sdhci0 {
+ compatible = "spacemit,k1-sdhci";
bootph-pre-ram;
- cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ pinctrl-names = "default", "uhs";
max-frequency = <204800000>;
+ pinctrl-0 = <&mmc1_cfg>;
+ pinctrl-1 = <&mmc1_uhs_cfg>;
+ status = "okay";
};
-&binman {
- u-boot-spl-ddr {
- type = "section";
- filename = "u-boot-spl-ddr.bin";
- pad-byte = <0xff>;
+&pinctrl {
+ bootph-pre-ram;
+ status = "okay";
+};
- u-boot-spl {
- };
+&gpio {
+ bootph-pre-ram;
+ status = "okay";
+};
- ddr-fw {
- type = "blob";
- filename = "ddr_fw.bin";
- align = <64>;
- };
+&mmc1_cfg {
+ bootph-pre-ram;
+};
- u-boot-any {
- type = "section";
- size = <0>;
- offset = <0>;
- };
- };
+&mmc1_uhs_cfg {
+ bootph-pre-ram;
};
+
+/* Keep the existing binman layout and DDR firmware section. */
+#include "spacemit-k1-binman.dtsi"
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 2/6] mmc: spacemit_sdhci: Improve voltage switching diagnostics
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
2026-10-29 13:46 ` [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization Anand Moon
@ 2026-10-29 13:46 ` Anand Moon
2026-10-29 13:46 ` [PATCH v1 3/6] mmc: spacemit_sdhci: Handle missing pinctrl states Anand Moon
` (3 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Yixun Lan, Huan Zhou, Peng Fan, Jaehoon Chung, Tanmay Kathpalia,
Tom Rini, u-boot-spacemit
Improve error reporting when setting or enabling the VQMMC
regulator fails.
Refactor voltage handling to determine the target signal voltage
before updating the regulator, and report failures when the
SDHCI voltage-switch bit does not reflect the requested state.
Keep the SDHCI host-control voltage-bit handling specific to SD
devices, while allowing the VQMMC regulator to be configured
for other MMC device types.
Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
drivers/mmc/spacemit_sdhci.c | 85 ++++++++++++++++++++++--------------
1 file changed, 53 insertions(+), 32 deletions(-)
diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
index f5578f38bdd..836201ce83c 100644
--- a/drivers/mmc/spacemit_sdhci.c
+++ b/drivers/mmc/spacemit_sdhci.c
@@ -222,15 +222,26 @@ static int spacemit_sdhci_set_vqmmc_voltage(struct mmc *mmc, int voltage)
#if CONFIG_IS_ENABLED(DM_REGULATOR)
int ret;
- if (!mmc->vqmmc_supply)
+ /*
+ * eMMC VCCQ is fixed at 1.8V on the BPI-F3.
+ * Do not attempt to switch its VQMMC regulator.
+ */
+ if (!IS_SD(mmc) || !mmc->vqmmc_supply)
return 0;
ret = regulator_set_value(mmc->vqmmc_supply, voltage);
- if (ret)
+ if (ret) {
+ log_err("%s: failed to set VQMMC to %d uV: %d\n",
+ mmc->dev->name, voltage, ret);
return ret;
+ }
+
ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
- if (ret)
+ if (ret) {
+ log_err("%s: failed to enable VQMMC: %d\n",
+ mmc->dev->name, ret);
return ret;
+ }
#endif
return 0;
}
@@ -239,44 +250,54 @@ static void spacemit_sdhci_set_voltage(struct sdhci_host *host)
{
if (IS_ENABLED(CONFIG_MMC_IO_VOLTAGE)) {
struct mmc *mmc = host->mmc;
+ bool to_180, ok;
+ int voltage_uv, ret;
u32 ctrl;
- ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
-
switch (mmc->signal_voltage) {
case MMC_SIGNAL_VOLTAGE_330:
- case MMC_SIGNAL_VOLTAGE_180: {
- bool to_180 = mmc->signal_voltage ==
- MMC_SIGNAL_VOLTAGE_180;
- bool ok;
- int voltage_mv = to_180 ? 1800000 : 3300000;
-
- if (spacemit_sdhci_set_vqmmc_voltage(mmc, voltage_mv))
- return;
- if (!IS_SD(mmc))
- return;
- if (to_180)
- ctrl |= SDHCI_CTRL_VDD_180;
- else
- ctrl &= ~SDHCI_CTRL_VDD_180;
- sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
-
- mdelay(5);
-
- ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
- ok = !!(ctrl & SDHCI_CTRL_VDD_180) == to_180;
- if (ok)
- return;
-
- log_err("%d.%dV regulator output not stable\n",
- voltage_mv / 1000000,
- (voltage_mv / 100000) % 10);
+ to_180 = false;
+ voltage_uv = 3300000;
+ break;
+ case MMC_SIGNAL_VOLTAGE_180:
+ to_180 = true;
+ voltage_uv = 1800000;
break;
- }
default:
/* No signal voltage switch required */
return;
}
+
+ ret = spacemit_sdhci_set_vqmmc_voltage(mmc, voltage_uv);
+ if (ret) {
+ log_err("%s: VQMMC switch to %d uV failed: %d\n",
+ mmc->dev->name, voltage_uv, ret);
+ return;
+ }
+
+ /*
+ * Non-SD devices may not use the SD Host Control 2
+ * voltage-switch bit. Keep their handling separate.
+ */
+ if (!IS_SD(mmc))
+ return;
+
+ ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
+
+ if (to_180)
+ ctrl |= SDHCI_CTRL_VDD_180;
+ else
+ ctrl &= ~SDHCI_CTRL_VDD_180;
+
+ sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
+ mdelay(5);
+
+ ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
+ ok = !!(ctrl & SDHCI_CTRL_VDD_180) == to_180;
+ if (!ok) {
+ log_err("%s: SDHCI voltage bit did not switch to %d uV\n",
+ mmc->dev->name, voltage_uv);
+ }
}
}
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 3/6] mmc: spacemit_sdhci: Handle missing pinctrl states
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
2026-10-29 13:46 ` [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization Anand Moon
2026-10-29 13:46 ` [PATCH v1 2/6] mmc: spacemit_sdhci: Improve voltage switching diagnostics Anand Moon
@ 2026-10-29 13:46 ` Anand Moon
2026-10-29 13:46 ` [PATCH v1 4/6] gpio: spacemit: Add SPL support for K1 GPIO driver Anand Moon
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Yixun Lan, Huan Zhou, Peng Fan, Jaehoon Chung, Tanmay Kathpalia,
Tom Rini, u-boot-spacemit
Check for available pinctrl states before selecting them in the
SpacemiT SDHCI driver.
Skip pinctrl selection when the device does not define a default
state, allowing eMMC configurations without pinctrl properties
to work without spurious pinctrl errors.
Select the UHS pinctrl state only when it is defined, and log
errors when pinctrl state selection fails.
Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
drivers/mmc/spacemit_sdhci.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
index 836201ce83c..668555b94e1 100644
--- a/drivers/mmc/spacemit_sdhci.c
+++ b/drivers/mmc/spacemit_sdhci.c
@@ -355,10 +355,27 @@ static int spacemit_sdhci_get_b_max(struct udevice *dev, void *dst,
return mmc->cfg->b_max;
}
+static bool spacemit_sdhci_has_pinctrl_state(struct udevice *dev,
+ const char *state_name)
+{
+ char propname[20];
+ int state;
+
+ state = dev_read_stringlist_search(dev, "pinctrl-names",
+ state_name);
+ if (state < 0)
+ return false;
+
+ snprintf(propname, sizeof(propname), "pinctrl-%d", state);
+
+ return !!dev_read_prop(dev, propname, NULL);
+}
+
static void spacemit_sdhci_set_control_reg(struct sdhci_host *host)
{
struct mmc *mmc = host->mmc;
u32 reg;
+ int ret;
spacemit_sdhci_set_voltage(host);
@@ -383,16 +400,26 @@ static void spacemit_sdhci_set_control_reg(struct sdhci_host *host)
sdhci_writel(host, reg, SPACEMIT_SDHC_TX_CFG_REG);
/* Set pinctrl state based on selected timing mode */
- if (IS_ENABLED(CONFIG_PINCTRL)) {
+ if (IS_ENABLED(CONFIG_PINCTRL) &&
+ spacemit_sdhci_has_pinctrl_state(mmc->dev, "default")) {
switch (mmc->selected_mode) {
case UHS_SDR12:
case UHS_SDR25:
case UHS_SDR50:
case UHS_SDR104:
- pinctrl_select_state(mmc->dev, "uhs");
+ if (spacemit_sdhci_has_pinctrl_state(mmc->dev, "uhs")) {
+ ret = pinctrl_select_state(mmc->dev, "uhs");
+ if (ret)
+ log_err("SDHCI %s: uhs pinctrl selection failed: %d\n",
+ mmc->dev->name, ret);
+ }
break;
+
default:
- pinctrl_select_state(mmc->dev, "default");
+ ret = pinctrl_select_state(mmc->dev, "default");
+ if (ret)
+ log_err("SDHCI %s: default pinctrl selection failed: %d\n",
+ mmc->dev->name, ret);
break;
}
}
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 4/6] gpio: spacemit: Add SPL support for K1 GPIO driver
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
` (2 preceding siblings ...)
2026-10-29 13:46 ` [PATCH v1 3/6] mmc: spacemit_sdhci: Handle missing pinctrl states Anand Moon
@ 2026-10-29 13:46 ` Anand Moon
2026-11-20 5:58 ` Yixun Lan
2026-10-29 13:46 ` [PATCH v1 5/6] pinctrl: spacemit: Add SPL support for K1 pinctrl driver Anand Moon
2026-10-29 13:46 ` [PATCH v1 6/6] configs: spacemit_k1: Enable SPL GPIO and pinctrl support Anand Moon
5 siblings, 1 reply; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Yixun Lan, Tom Rini, Johan Jonker, Raymond Mao
Add SPL_SPACEMIT_GPIO to enable the SpacemiT K1 GPIO driver
during SPL initialization.
Depend on SPL_DM_GPIO and TARGET_SPACEMIT_K1, and select
SPACEMIT_GPIO to reuse the existing driver implementation.
This allows SPL to access GPIOs required for early board
initialization.
Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
drivers/gpio/Kconfig | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 7f12e39dad8..3be6a9e54fa 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -457,6 +457,13 @@ config SPACEMIT_GPIO
arranged into a number of banks (different for each SoC type) each
with 32 GPIOs.
+config SPL_SPACEMIT_GPIO
+ bool "Spacemit K1 GPIO driver in SPL"
+ depends on SPL_DM_GPIO && TARGET_SPACEMIT_K1
+ select SPACEMIT_GPIO
+ help
+ Enable the Spacemit K1 GPIO driver in SPL.
+ This allows SPL to configure GPIOs during early board initialization.
config SUNXI_GPIO
bool "Allwinner GPIO driver"
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 5/6] pinctrl: spacemit: Add SPL support for K1 pinctrl driver
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
` (3 preceding siblings ...)
2026-10-29 13:46 ` [PATCH v1 4/6] gpio: spacemit: Add SPL support for K1 GPIO driver Anand Moon
@ 2026-10-29 13:46 ` Anand Moon
2026-11-20 6:12 ` Yixun Lan
2026-10-29 13:46 ` [PATCH v1 6/6] configs: spacemit_k1: Enable SPL GPIO and pinctrl support Anand Moon
5 siblings, 1 reply; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Yixun Lan, Huan Zhou, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
Add `SPL_PINCTRL_SPACEMIT_K1` to enable the SpacemiT K1
pinctrl driver during SPL initialization.
Depend on `SPL_PINCTRL`, `SPL_DM`, and `PINCTRL_GENERIC`,
and select `PINCTRL_SPACEMIT_K1` to reuse the existing
driver implementation.
This allows SPL to configure pin multiplexing for early
board initialization.
Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
drivers/pinctrl/spacemit/Kconfig | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/pinctrl/spacemit/Kconfig b/drivers/pinctrl/spacemit/Kconfig
index 87cba336923..5770e4865d9 100644
--- a/drivers/pinctrl/spacemit/Kconfig
+++ b/drivers/pinctrl/spacemit/Kconfig
@@ -7,3 +7,11 @@ config PINCTRL_SPACEMIT_K1
The driver is controlled by a device tree node which contains both
the GPIO definitions and pin control functions for each available
multiplex function.
+
+config SPL_PINCTRL_SPACEMIT_K1
+ bool "Spacemit K1 pinctrl driver in SPL"
+ depends on SPL_PINCTRL && SPL_DM && PINCTRL_GENERIC
+ select PINCTRL_SPACEMIT_K1
+ help
+ Enable the Spacemit K1 pinctrl driver in SPL.
+ This allows SPL to configure pinctrl during early board initialization.
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 6/6] configs: spacemit_k1: Enable SPL GPIO and pinctrl support
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
` (4 preceding siblings ...)
2026-10-29 13:46 ` [PATCH v1 5/6] pinctrl: spacemit: Add SPL support for K1 pinctrl driver Anand Moon
@ 2026-10-29 13:46 ` Anand Moon
2026-11-20 6:19 ` Yixun Lan
5 siblings, 1 reply; 15+ messages in thread
From: Anand Moon @ 2026-10-29 13:46 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Yixun Lan, Huan Zhou, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
Enable GPIO and pinctrl support in SPL for SpacemiT K1 boards
to support early board initialization and SD card boot.
Enable SPL MMC I/O voltage switching and configure the shared
K1 U-Boot device tree include for the supported boards.
Also enable MTD and SPI NOR partition support with the default
flash partition layout.
Configure a 2 MiB SPL simple malloc buffer for early allocations.
Enable regulator commands, SPL GPIO and pinctrl support, and
SPL MMC I/O voltage switching.
Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
configs/spacemit_k1_defconfig | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
index 8ee9baa13b7..04b5ec4f700 100644
--- a/configs/spacemit_k1_defconfig
+++ b/configs/spacemit_k1_defconfig
@@ -3,10 +3,10 @@ CONFIG_SYS_MALLOC_LEN=0x1000000
CONFIG_SYS_MALLOC_F_LEN=0x10000
CONFIG_NR_DRAM_BANKS=2
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1200000
CONFIG_DM_GPIO=y
CONFIG_SPL_DM_SPI=y
-CONFIG_DEFAULT_DEVICE_TREE="spacemit/k1-musepi-pro"
+CONFIG_DEFAULT_DEVICE_TREE="spacemit/k1-bananapi-f3"
CONFIG_SPL_SYS_MALLOC_F_LEN=0x4000
CONFIG_SPL_MMC=y
CONFIG_SPL_STACK_R_ADDR=0xc00000
@@ -63,10 +63,12 @@ CONFIG_CMD_PCI=y
CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_EXT4=y
+CONFIG_CMD_REGULATOR=y
CONFIG_CMD_FAT=y
CONFIG_EFI_PARTITION=y
CONFIG_OF_UPSTREAM=y
-CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
+CONFIG_DEVICE_TREE_INCLUDES="spacemit-k1-u-boot.dtsi"
+CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro spacemit/k1-milkv-jupiter"
CONFIG_MULTI_DTB_FIT=y
CONFIG_ENV_OVERWRITE=y
CONFIG_SPL_DM_SEQ_ALIAS=y
@@ -117,3 +119,15 @@ CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GENERIC=y
CONFIG_USB_STORAGE=y
CONFIG_SPL_LIB_RATIONAL=y
+CONFIG_SPL_GPIO=y
+CONFIG_SPL_DM_GPIO=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_SPACEMIT_GPIO=y
+CONFIG_SPL_PINCTRL_SPACEMIT_K1=y
+CONFIG_SPL_MMC_IO_VOLTAGE=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200000
+CONFIG_CMD_MTD=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
+CONFIG_MTDPARTS_DEFAULT="spi0.0:128k(bootinfo),512k(fsbl),64k(env),1024k(esos),384k(opensbi),-(uboot)"
--
2.56.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization
2026-10-29 13:46 ` [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization Anand Moon
@ 2026-10-31 11:54 ` Hung-Chun Tseng
2026-10-31 11:56 ` Hung-Chun Tseng
1 sibling, 0 replies; 15+ messages in thread
From: Hung-Chun Tseng @ 2026-10-31 11:54 UTC (permalink / raw)
To: Anand Moon
Cc: u-boot, u-boot-spacemit, DaveWK225, eric.chung, e, dlan,
pericycle.cc, tim609, leo.liang, me, trini, docular.xu,
raymond.mao
Hi Anand,
Thanks for sending this. I tested the series on a Milk-V Jupiter,
booting from SD. It reaches the U-Boot prompt, but the SPL no longer
finds the PMIC:
Get board name:k1-x_milkv-jupiter
No PMIC (-19), leaving rails as found
DDR firmware: [0xc0820740]:0xf0227179, size:0x8d98
With a Jupiter -u-boot.dtsi that has the same i2c8/pmic block this
patch removes, the SPL sets the rails before DDR init:
vdd_core, value:900000
vdd_1v8, value:1800000
vdd_1v8_mmc, value:3300000
The commit message says the regulator configuration moves to
dts/upstream, but k1-milkv-jupiter.dts there has no bootph tags and no
vdd_core/vdd_1v8/vdd_1v8_mmc names, so the PMIC is not in the SPL
device tree and pmic_init() skips it. It works on this board only
because the BootROM leaves usable voltages. How do you plan to let the
SPL find the rails?
Two other things I saw, neither caused by this series: the SPI NOR on
the Jupiter is a GigaDevice part (JEDEC c8 40 17), which needs
"configs: k1: enable GigaDevice SPI NOR flash support" [1], and
U-Boot reports 8 GiB on this 4 GiB board, a known issue in
ddr_get_density().
[1] https://lore.kernel.org/u-boot/20261027154347.1392094-2-alan.tseng.cs@gmail.com/
Thanks,
Hung-Chun
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization
2026-10-29 13:46 ` [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization Anand Moon
2026-10-31 11:54 ` Hung-Chun Tseng
@ 2026-10-31 11:56 ` Hung-Chun Tseng
2026-10-31 16:45 ` Anand Moon
1 sibling, 1 reply; 15+ messages in thread
From: Hung-Chun Tseng @ 2026-10-31 11:56 UTC (permalink / raw)
To: Anand Moon
Cc: u-boot, u-boot-spacemit, DaveWK225, eric.chung, e, dlan,
pericycle.cc, tim609, leo.liang, me, trini, docular.xu,
raymond.mao
Hi Anand,
Thanks for sending this. I tested the series on a Milk-V Jupiter,
booting from SD. It reaches the U-Boot prompt, but the SPL no longer
finds the PMIC:
Get board name:k1-x_milkv-jupiter
No PMIC (-19), leaving rails as found
DDR firmware: [0xc0820740]:0xf0227179, size:0x8d98
With a Jupiter -u-boot.dtsi that has the same i2c8/pmic block this
patch removes, the SPL sets the rails before DDR init:
vdd_core, value:900000
vdd_1v8, value:1800000
vdd_1v8_mmc, value:3300000
The commit message says the regulator configuration moves to
dts/upstream, but k1-milkv-jupiter.dts there has no bootph tags and no
vdd_core/vdd_1v8/vdd_1v8_mmc names, so the PMIC is not in the SPL
device tree and pmic_init() skips it. It works on this board only
because the rails come up at usable voltages. How do you plan to let
the SPL find the rails?
The new file is also not picked up until 6/6. U-Boot includes
<dtb>-u-boot.dtsi, $(SYS_SOC)-u-boot.dtsi, $(SYS_CPU)-u-boot.dtsi,
$(SYS_VENDOR)-u-boot.dtsi and u-boot.dtsi (scripts/Makefile.lib),
which on K1 means k1-u-boot.dtsi or spacemit-u-boot.dtsi. Nothing
includes spacemit-k1-u-boot.dtsi until 6/6 sets
CONFIG_DEVICE_TREE_INCLUDES, so 1/6 to 5/6 build without any K1
overlay, which breaks bisection. I have not built each step. Naming the
file k1-u-boot.dtsi would get it included from this patch on, and 6/6
would not need DEVICE_TREE_INCLUDES.
The MusePi Pro overlay also set sdhci0's cd-gpios to GPIO 80 active
low, while k1-musepi-pro.dts in dts/upstream has it active high, so
removing the override flips card detect on that board. Was the
override fixing the upstream polarity?
Two other things I saw, neither caused by this series: the SPI NOR on
the Jupiter is a GigaDevice part (JEDEC c8 40 17), which needs
"configs: k1: enable GigaDevice SPI NOR flash support" [1], and
U-Boot reports 8 GiB on this 4 GiB board, a known issue in
ddr_get_density().
[1] https://lore.kernel.org/u-boot/20261027154347.1392094-2-alan.tseng.cs@gmail.com/
Thanks,
Hung-Chun
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization
2026-10-31 11:56 ` Hung-Chun Tseng
@ 2026-10-31 16:45 ` Anand Moon
2026-10-31 18:15 ` E Shattow
0 siblings, 1 reply; 15+ messages in thread
From: Anand Moon @ 2026-10-31 16:45 UTC (permalink / raw)
To: Hung-Chun Tseng
Cc: u-boot, u-boot-spacemit, DaveWK225, eric.chung, e, dlan,
pericycle.cc, tim609, leo.liang, me, trini, docular.xu,
raymond.mao
Hi Hung-Chun,
Thanks for testing this series
On Sat, 31 Oct 2026 at 17:26, Hung-Chun Tseng <alan.tseng.cs@gmail.com> wrote:
>
> Hi Anand,
>
> Thanks for sending this. I tested the series on a Milk-V Jupiter,
> booting from SD. It reaches the U-Boot prompt, but the SPL no longer
> finds the PMIC:
>
> Get board name:k1-x_milkv-jupiter
> No PMIC (-19), leaving rails as found
> DDR firmware: [0xc0820740]:0xf0227179, size:0x8d98
>
> With a Jupiter -u-boot.dtsi that has the same i2c8/pmic block this
> patch removes, the SPL sets the rails before DDR init:
>
> vdd_core, value:900000
> vdd_1v8, value:1800000
> vdd_1v8_mmc, value:3300000
>
> The commit message says the regulator configuration moves to
> dts/upstream, but k1-milkv-jupiter.dts there has no bootph tags and no
> vdd_core/vdd_1v8/vdd_1v8_mmc names, so the PMIC is not in the SPL
> device tree and pmic_init() skips it. It works on this board only
> because the rails come up at usable voltages. How do you plan to let
> the SPL find the rails?
>
> The new file is also not picked up until 6/6. U-Boot includes
> <dtb>-u-boot.dtsi, $(SYS_SOC)-u-boot.dtsi, $(SYS_CPU)-u-boot.dtsi,
> $(SYS_VENDOR)-u-boot.dtsi and u-boot.dtsi (scripts/Makefile.lib),
> which on K1 means k1-u-boot.dtsi or spacemit-u-boot.dtsi. Nothing
> includes spacemit-k1-u-boot.dtsi until 6/6 sets
> CONFIG_DEVICE_TREE_INCLUDES, so 1/6 to 5/6 build without any K1
> overlay, which breaks bisection. I have not built each step. Naming the
> file k1-u-boot.dtsi would get it included from this patch on, and 6/6
> would not need DEVICE_TREE_INCLUDES.
>
I think configs/spacemit_k3_defconfig uses the same approach.
CONFIG_DEVICE_TREE_INCLUDES="spacemit-k3-u-boot.dtsi"
It is consistent to use the same naming format for files.
> The MusePi Pro overlay also set sdhci0's cd-gpios to GPIO 80 active
> low, while k1-musepi-pro.dts in dts/upstream has it active high, so
> removing the override flips card detect on that board. Was the
> override fixing the upstream polarity?
I haven't verified this yet, but we can retain the override if you prefer
>
> Two other things I saw, neither caused by this series: the SPI NOR on
> the Jupiter is a GigaDevice part (JEDEC c8 40 17), which needs
> "configs: k1: enable GigaDevice SPI NOR flash support" [1], and
> U-Boot reports 8 GiB on this 4 GiB board, a known issue in
> ddr_get_density().
>
Yep, you can enable CONFIG_SPI_FLASH_GIGADEVICE in the
configs/spacemit_k1_defconfig
> [1] https://lore.kernel.org/u-boot/20261027154347.1392094-2-alan.tseng.cs@gmail.com/
>
You likely need to update the regulator name in your upstream patches
to match the specific naming convention of your board.
for example
regulators {
buck1_0v9: buck1 {
regulator-name = "vdd_core";
bootph-pre-ram;
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <1050000>;
regulator-ramp-delay = <5000>;
regulator-always-on;
};
buck4: buck4 {
bootph-pre-ram;
regulator-name = "vdd_1v8";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3300000>;
regulator-ramp-delay = <5000>;
regulator-always-on;
};
aldo1: aldo1 {
regulator-name = "vdd_1v8_mmc";
bootph-pre-ram;
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3400000>;
regulator-boot-on;
};
You can verify this using the command below
# dtc -I dtb -O dts spl/u-boot-spl.dtb |
grep -n -E \
'regulator|pmic|reset-controller|reset-gpios|vmmc-supply|vqmmc-supply'
136: pmic@41 {
149: regulators {
152: regulator-name = "vdd_core";
153:
regulator-min-microvolt = <0x7a120>;
154:
regulator-max-microvolt = <0x100590>;
155: regulator-ramp-delay = <0x1388>;
156: regulator-always-on;
161: regulator-name = "vdd_1v8";
162:
regulator-min-microvolt = <0x7a120>;
163:
regulator-max-microvolt = <0x1b7740>;
164: regulator-ramp-delay = <0x1388>;
165: regulator-always-on;
170: regulator-name = "vdd_1v8_mmc";
171:
regulator-min-microvolt = <0x7a120>;
172:
regulator-max-microvolt = <0x33e140>;
173: regulator-boot-on;
298: vmmc-supply = <0x3d>;
299: vqmmc-supply = <0x3e>;
If you get this working on your boards, please consider updating it in
your patch series.
> Thanks,
> Hung-Chun
Thanks
-Anand
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization
2026-10-31 16:45 ` Anand Moon
@ 2026-10-31 18:15 ` E Shattow
2026-11-02 7:40 ` Anand Moon
0 siblings, 1 reply; 15+ messages in thread
From: E Shattow @ 2026-10-31 18:15 UTC (permalink / raw)
To: Anand Moon, Hung-Chun Tseng
Cc: u-boot, u-boot-spacemit, DaveWK225, eric.chung, dlan,
pericycle.cc, tim609, leo.liang, me, trini, docular.xu,
raymond.mao
Hi Anand,
On 10/31/26 09:45, Anand Moon wrote:
> Hi Hung-Chun,
>
> Thanks for testing this series
>
> On Sat, 31 Oct 2026 at 17:26, Hung-Chun Tseng <alan.tseng.cs@gmail.com> wrote:
>>
>> Hi Anand,
>>
>> Thanks for sending this. I tested the series on a Milk-V Jupiter,
>> booting from SD. It reaches the U-Boot prompt, but the SPL no longer
>> finds the PMIC:
>>
>> Get board name:k1-x_milkv-jupiter
>> No PMIC (-19), leaving rails as found
>> DDR firmware: [0xc0820740]:0xf0227179, size:0x8d98
>>
>> With a Jupiter -u-boot.dtsi that has the same i2c8/pmic block this
>> patch removes, the SPL sets the rails before DDR init:
>>
>> vdd_core, value:900000
>> vdd_1v8, value:1800000
>> vdd_1v8_mmc, value:3300000
>>
>> The commit message says the regulator configuration moves to
>> dts/upstream, but k1-milkv-jupiter.dts there has no bootph tags and no
>> vdd_core/vdd_1v8/vdd_1v8_mmc names, so the PMIC is not in the SPL
>> device tree and pmic_init() skips it. It works on this board only
>> because the rails come up at usable voltages. How do you plan to let
>> the SPL find the rails?
>>
>> The new file is also not picked up until 6/6. U-Boot includes
>> <dtb>-u-boot.dtsi, $(SYS_SOC)-u-boot.dtsi, $(SYS_CPU)-u-boot.dtsi,
>> $(SYS_VENDOR)-u-boot.dtsi and u-boot.dtsi (scripts/Makefile.lib),
>> which on K1 means k1-u-boot.dtsi or spacemit-u-boot.dtsi. Nothing
>> includes spacemit-k1-u-boot.dtsi until 6/6 sets
>> CONFIG_DEVICE_TREE_INCLUDES, so 1/6 to 5/6 build without any K1
>> overlay, which breaks bisection. I have not built each step. Naming the
>> file k1-u-boot.dtsi would get it included from this patch on, and 6/6
>> would not need DEVICE_TREE_INCLUDES.
>>
> I think configs/spacemit_k3_defconfig uses the same approach.
>
> CONFIG_DEVICE_TREE_INCLUDES="spacemit-k3-u-boot.dtsi"
>
Please split up the dts reorganization changes into three-or-four
patches [A], ([B]), [C], and [D]; The initial transition to this as [A]
should be not adding or fixing any nodes:
A1. New file 'spacemit-k1-binman.dtsi' with '#include "binman.dtsi"' at
the top just after the copyright identifier
A2. '&binman' sections from per-board k1-*-u-boot.dtsi overrides should
merge and be moved appended to spacemit-k1-binman.dtsi
A3. New file 'spacemit-k1-u-boot.dtsi' specified by
CONFIG_DEVICE_TREE_INCLUDES, with '#include "spacemit-k1-binman.dtsi"'
as the very last line of the file.
A4. Merge and move from per-board k1-*-u-boot.dtsi files any properties
in devicetree root that are rejected by upstream for devicetree-rebasing
subtree. The content should be inserted after the copyright identifier
and before the last line of the file '#include
"spacemit-k1-binman.dtsi"'. An example of this is the memory controller
reg override in which we specify a sensible fixed-amount value so that
the bootloader bring-up can function, but this configuration would never
be accepted upstream. If not for [B] this should only be the memory
controller reg override, apparently.
B. Resolve the presence of /aliases and /chosen nodes in
k1-musepi-pro-u-boot.dtsi compared to the lack of such nodes in
k1-bananapi-f3-u-boot.dtsi and then upstream and/or merge and move any
resolution to spacemit-k1-u-boot.dtsi ; I do not understand the
implications so maybe you would find that this can be ignored unchanged
and then removed in [D]
C(n). Import to per-board -u-boot.dtsi and spacemit-k1-u-boot.dtsi all
the proposed upstream changes (i.e. bootph-pre-ram hints). These should
be grouped by upstream patch discussion thread or commit id so that from
view of u-boot git tree one upstream discussion thread (patch or commit
id) is referenced in a comment within the dtsi file(s) that import it.
D. Delete redundant nodes and properties from per-board dtsi places
where they are redundant. This deletion is not combined with [C] because
we should be able to later do a git revert of [C(n)] when a
corresponding commit lands upstream.
There is going to be a considerable amount of per-board overrides that
are identical over a subset of per-board override -u-boot.dtsi and so
duplication is preferable as it is (from U-Boot git log) logically
grouped by commits that reference a particular upstream discussion or
commit id. That is also to say further organizing some changesets in
additional dtsi files to be included from a subset of per-board dtsi is
considered, but I am not yet convinced it would be helpful rather than
just duplicating it among the per-board dtsi files now and having a
sensible git history for reverting later when appropriate.
> It is consistent to use the same naming format for files.
>> The MusePi Pro overlay also set sdhci0's cd-gpios to GPIO 80 active
>> low, while k1-musepi-pro.dts in dts/upstream has it active high, so
>> removing the override flips card detect on that board. Was the
>> override fixing the upstream polarity?
> I haven't verified this yet, but we can retain the override if you prefer
>>
>> Two other things I saw, neither caused by this series: the SPI NOR on
>> the Jupiter is a GigaDevice part (JEDEC c8 40 17), which needs
>> "configs: k1: enable GigaDevice SPI NOR flash support" [1], and
>> U-Boot reports 8 GiB on this 4 GiB board, a known issue in
>> ddr_get_density().
>>
> Yep, you can enable CONFIG_SPI_FLASH_GIGADEVICE in the
> configs/spacemit_k1_defconfig
>
>> [1] https://lore.kernel.org/u-boot/20261027154347.1392094-2-alan.tseng.cs@gmail.com/
>>
> You likely need to update the regulator name in your upstream patches
> to match the specific naming convention of your board.
>
> for example
> regulators {
> buck1_0v9: buck1 {
> regulator-name = "vdd_core";
> bootph-pre-ram;
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <1050000>;
> regulator-ramp-delay = <5000>;
> regulator-always-on;
> };
>
> buck4: buck4 {
> bootph-pre-ram;
> regulator-name = "vdd_1v8";
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <3300000>;
> regulator-ramp-delay = <5000>;
> regulator-always-on;
> };
>
> aldo1: aldo1 {
> regulator-name = "vdd_1v8_mmc";
> bootph-pre-ram;
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <3400000>;
> regulator-boot-on;
> };
>
> You can verify this using the command below
>
> # dtc -I dtb -O dts spl/u-boot-spl.dtb |
> grep -n -E \
> 'regulator|pmic|reset-controller|reset-gpios|vmmc-supply|vqmmc-supply'
> 136: pmic@41 {
> 149: regulators {
> 152: regulator-name = "vdd_core";
> 153:
> regulator-min-microvolt = <0x7a120>;
> 154:
> regulator-max-microvolt = <0x100590>;
> 155: regulator-ramp-delay = <0x1388>;
> 156: regulator-always-on;
> 161: regulator-name = "vdd_1v8";
> 162:
> regulator-min-microvolt = <0x7a120>;
> 163:
> regulator-max-microvolt = <0x1b7740>;
> 164: regulator-ramp-delay = <0x1388>;
> 165: regulator-always-on;
> 170: regulator-name = "vdd_1v8_mmc";
> 171:
> regulator-min-microvolt = <0x7a120>;
> 172:
> regulator-max-microvolt = <0x33e140>;
> 173: regulator-boot-on;
> 298: vmmc-supply = <0x3d>;
> 299: vqmmc-supply = <0x3e>;
>
> If you get this working on your boards, please consider updating it in
> your patch series.
>
>> Thanks,
>> Hung-Chun
>
> Thanks
> -Anand
-E
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization
2026-10-31 18:15 ` E Shattow
@ 2026-11-02 7:40 ` Anand Moon
0 siblings, 0 replies; 15+ messages in thread
From: Anand Moon @ 2026-11-02 7:40 UTC (permalink / raw)
To: E Shattow
Cc: Hung-Chun Tseng, u-boot, u-boot-spacemit, DaveWK225, eric.chung,
dlan, pericycle.cc, tim609, leo.liang, me, trini, docular.xu,
raymond.mao
H E Shattow,
On Sat, 31 Oct 2026 at 23:45, E Shattow <e@freeshell.de> wrote:
>
> Hi Anand,
>
> On 10/31/26 09:45, Anand Moon wrote:
> > Hi Hung-Chun,
> >
> > Thanks for testing this series
> >
> > On Sat, 31 Oct 2026 at 17:26, Hung-Chun Tseng <alan.tseng.cs@gmail.com> wrote:
> >>
> >> Hi Anand,
> >>
> >> Thanks for sending this. I tested the series on a Milk-V Jupiter,
> >> booting from SD. It reaches the U-Boot prompt, but the SPL no longer
> >> finds the PMIC:
> >>
> >> Get board name:k1-x_milkv-jupiter
> >> No PMIC (-19), leaving rails as found
> >> DDR firmware: [0xc0820740]:0xf0227179, size:0x8d98
> >>
> >> With a Jupiter -u-boot.dtsi that has the same i2c8/pmic block this
> >> patch removes, the SPL sets the rails before DDR init:
> >>
> >> vdd_core, value:900000
> >> vdd_1v8, value:1800000
> >> vdd_1v8_mmc, value:3300000
> >>
> >> The commit message says the regulator configuration moves to
> >> dts/upstream, but k1-milkv-jupiter.dts there has no bootph tags and no
> >> vdd_core/vdd_1v8/vdd_1v8_mmc names, so the PMIC is not in the SPL
> >> device tree and pmic_init() skips it. It works on this board only
> >> because the rails come up at usable voltages. How do you plan to let
> >> the SPL find the rails?
> >>
> >> The new file is also not picked up until 6/6. U-Boot includes
> >> <dtb>-u-boot.dtsi, $(SYS_SOC)-u-boot.dtsi, $(SYS_CPU)-u-boot.dtsi,
> >> $(SYS_VENDOR)-u-boot.dtsi and u-boot.dtsi (scripts/Makefile.lib),
> >> which on K1 means k1-u-boot.dtsi or spacemit-u-boot.dtsi. Nothing
> >> includes spacemit-k1-u-boot.dtsi until 6/6 sets
> >> CONFIG_DEVICE_TREE_INCLUDES, so 1/6 to 5/6 build without any K1
> >> overlay, which breaks bisection. I have not built each step. Naming the
> >> file k1-u-boot.dtsi would get it included from this patch on, and 6/6
> >> would not need DEVICE_TREE_INCLUDES.
> >>
> > I think configs/spacemit_k3_defconfig uses the same approach.
> >
> > CONFIG_DEVICE_TREE_INCLUDES="spacemit-k3-u-boot.dtsi"
> >
>
> Please split up the dts reorganization changes into three-or-four
> patches [A], ([B]), [C], and [D]; The initial transition to this as [A]
> should be not adding or fixing any nodes:
>
> A1. New file 'spacemit-k1-binman.dtsi' with '#include "binman.dtsi"' at
> the top just after the copyright identifier
>
> A2. '&binman' sections from per-board k1-*-u-boot.dtsi overrides should
> merge and be moved appended to spacemit-k1-binman.dtsi
>
> A3. New file 'spacemit-k1-u-boot.dtsi' specified by
> CONFIG_DEVICE_TREE_INCLUDES, with '#include "spacemit-k1-binman.dtsi"'
> as the very last line of the file.
>
> A4. Merge and move from per-board k1-*-u-boot.dtsi files any properties
> in devicetree root that are rejected by upstream for devicetree-rebasing
> subtree. The content should be inserted after the copyright identifier
> and before the last line of the file '#include
> "spacemit-k1-binman.dtsi"'. An example of this is the memory controller
> reg override in which we specify a sensible fixed-amount value so that
> the bootloader bring-up can function, but this configuration would never
> be accepted upstream. If not for [B] this should only be the memory
> controller reg override, apparently.
>
> B. Resolve the presence of /aliases and /chosen nodes in
> k1-musepi-pro-u-boot.dtsi compared to the lack of such nodes in
> k1-bananapi-f3-u-boot.dtsi and then upstream and/or merge and move any
> resolution to spacemit-k1-u-boot.dtsi ; I do not understand the
> implications so maybe you would find that this can be ignored unchanged
> and then removed in [D]
>
> C(n). Import to per-board -u-boot.dtsi and spacemit-k1-u-boot.dtsi all
> the proposed upstream changes (i.e. bootph-pre-ram hints). These should
> be grouped by upstream patch discussion thread or commit id so that from
> view of u-boot git tree one upstream discussion thread (patch or commit
> id) is referenced in a comment within the dtsi file(s) that import it.
>
> D. Delete redundant nodes and properties from per-board dtsi places
> where they are redundant. This deletion is not combined with [C] because
> we should be able to later do a git revert of [C(n)] when a
> corresponding commit lands upstream.
>
> There is going to be a considerable amount of per-board overrides that
> are identical over a subset of per-board override -u-boot.dtsi and so
> duplication is preferable as it is (from U-Boot git log) logically
> grouped by commits that reference a particular upstream discussion or
> commit id. That is also to say further organizing some changesets in
> additional dtsi files to be included from a subset of per-board dtsi is
> considered, but I am not yet convinced it would be helpful rather than
> just duplicating it among the per-board dtsi files now and having a
> sensible git history for reverting later when appropriate.
>
Thanks for your review comments.
Yes, I will follow this procedure in future patch series.
For this series, I wanted to have the changes tested on another
development board
so that I could better understand and follow the proposed process for
restructuring
the code changes.
Thanks for the guidance.
Thanks
-Anand
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 4/6] gpio: spacemit: Add SPL support for K1 GPIO driver
2026-10-29 13:46 ` [PATCH v1 4/6] gpio: spacemit: Add SPL support for K1 GPIO driver Anand Moon
@ 2026-11-20 5:58 ` Yixun Lan
0 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2026-11-20 5:58 UTC (permalink / raw)
To: Anand Moon
Cc: u-boot, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Tom Rini, Johan Jonker, Raymond Mao
Hi Anand,
Can you split out patch 4, 5 and send a v2? I'd like to
take them first..
On 19:16 Thu 29 Oct , Anand Moon wrote:
> Add SPL_SPACEMIT_GPIO to enable the SpacemiT K1 GPIO driver
> during SPL initialization.
>
..
> Depend on SPL_DM_GPIO and TARGET_SPACEMIT_K1, and select
> SPACEMIT_GPIO to reuse the existing driver implementation.
>
I'd rather drop above explanation, it's quite obvious from
reading the code..
> This allows SPL to access GPIOs required for early board
s/This allows/Allow/, use imperative mood
> initialization.
>
Any specific user of the GPIO? Can you add more detail, I can
think of reason that SdCard's Dectect pin will use gpio..
> Cc: Dave Klotz <DaveWK225@protonmail.com>
> Cc: Eric Chung <eric.chung@riscstar.com>
> Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
> Cc: E Shattow <e@freeshell.de>
> Cc: Yixun Lan <dlan@kernel.org>
Can you put CC list in cover letter? I'd rather not apply them..
or possibly under line "---" if you want specific CC in single
patch? and of course it works..
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> drivers/gpio/Kconfig | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 7f12e39dad8..3be6a9e54fa 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -457,6 +457,13 @@ config SPACEMIT_GPIO
> arranged into a number of banks (different for each SoC type) each
> with 32 GPIOs.
>
> +config SPL_SPACEMIT_GPIO
> + bool "Spacemit K1 GPIO driver in SPL"
just "SpacemiT GPIO driver in SPL", which also make it work for K3,
so let's not only mention for K1..
> + depends on SPL_DM_GPIO && TARGET_SPACEMIT_K1
I'd also like to see it enabled in K3 platform, so how about
depends on SPL_DM_GPIO && (TARGET_SPACEMIT_K1 || TARGET_SPACEMIT_K3)
or simply remove platform contraint..
depends on SPL_DM_GPIO
> + select SPACEMIT_GPIO
> + help
> + Enable the Spacemit K1 GPIO driver in SPL.
> + This allows SPL to configure GPIOs during early board initialization.
>
> config SUNXI_GPIO
> bool "Allwinner GPIO driver"
> --
> 2.56.0
>
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 5/6] pinctrl: spacemit: Add SPL support for K1 pinctrl driver
2026-10-29 13:46 ` [PATCH v1 5/6] pinctrl: spacemit: Add SPL support for K1 pinctrl driver Anand Moon
@ 2026-11-20 6:12 ` Yixun Lan
0 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2026-11-20 6:12 UTC (permalink / raw)
To: Anand Moon
Cc: u-boot, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Huan Zhou, Tom Rini, Guodong Xu, Raymond Mao, u-boot-spacemit
Hi Anand,
For the title, how about
pinctrl: spacemit: Add SPL support for early access
On 19:16 Thu 29 Oct , Anand Moon wrote:
> Add `SPL_PINCTRL_SPACEMIT_K1` to enable the SpacemiT K1
> pinctrl driver during SPL initialization.
>
..
> Depend on `SPL_PINCTRL`, `SPL_DM`, and `PINCTRL_GENERIC`,
> and select `PINCTRL_SPACEMIT_K1` to reuse the existing
> driver implementation.
>
Redundant, drop it
> This allows SPL to configure pin multiplexing for early
> board initialization.
>
This is ok, but better if able to add some more detail
> Cc: Dave Klotz <DaveWK225@protonmail.com>
> Cc: Eric Chung <eric.chung@riscstar.com>
> Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
> Cc: E Shattow <e@freeshell.de>
> Cc: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> drivers/pinctrl/spacemit/Kconfig | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/pinctrl/spacemit/Kconfig b/drivers/pinctrl/spacemit/Kconfig
> index 87cba336923..5770e4865d9 100644
> --- a/drivers/pinctrl/spacemit/Kconfig
> +++ b/drivers/pinctrl/spacemit/Kconfig
> @@ -7,3 +7,11 @@ config PINCTRL_SPACEMIT_K1
> The driver is controlled by a device tree node which contains both
> the GPIO definitions and pin control functions for each available
> multiplex function.
> +
> +config SPL_PINCTRL_SPACEMIT_K1
> + bool "Spacemit K1 pinctrl driver in SPL"
similar, s/Spacemit K1/SpacemiT/
K3 reuse same config with K1, so other part looks good
> + depends on SPL_PINCTRL && SPL_DM && PINCTRL_GENERIC
can you check if able to combine this two? SPL_PINCTRL && PINCTRL_GENERIC
as I see SPL_PINCTRL_GENERIC
> + select PINCTRL_SPACEMIT_K1
> + help
> + Enable the Spacemit K1 pinctrl driver in SPL.
> + This allows SPL to configure pinctrl during early board initialization.
> --
> 2.56.0
>
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1 6/6] configs: spacemit_k1: Enable SPL GPIO and pinctrl support
2026-10-29 13:46 ` [PATCH v1 6/6] configs: spacemit_k1: Enable SPL GPIO and pinctrl support Anand Moon
@ 2026-11-20 6:19 ` Yixun Lan
0 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2026-11-20 6:19 UTC (permalink / raw)
To: Anand Moon
Cc: u-boot, Dave Klotz, Eric Chung, Hung-Chun Tseng, E Shattow,
Huan Zhou, Tom Rini, Guodong Xu, Raymond Mao, u-boot-spacemit
Hi Anand,
With those two mmc patches 2,3, which should be used for switching
i/o pins to 1.8v, so can you check if it able to work in UHS mode?
try with CONFIG_MMC_UHS_SUPPORT enabled?
On 19:16 Thu 29 Oct , Anand Moon wrote:
> Enable GPIO and pinctrl support in SPL for SpacemiT K1 boards
> to support early board initialization and SD card boot.
>
> Enable SPL MMC I/O voltage switching and configure the shared
> K1 U-Boot device tree include for the supported boards.
>
> Also enable MTD and SPI NOR partition support with the default
> flash partition layout.
>
> Configure a 2 MiB SPL simple malloc buffer for early allocations.
> Enable regulator commands, SPL GPIO and pinctrl support, and
> SPL MMC I/O voltage switching.
>
> Cc: Dave Klotz <DaveWK225@protonmail.com>
> Cc: Eric Chung <eric.chung@riscstar.com>
> Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
> Cc: E Shattow <e@freeshell.de>
> Cc: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> configs/spacemit_k1_defconfig | 20 +++++++++++++++++---
> 1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
> index 8ee9baa13b7..04b5ec4f700 100644
> --- a/configs/spacemit_k1_defconfig
> +++ b/configs/spacemit_k1_defconfig
> @@ -3,10 +3,10 @@ CONFIG_SYS_MALLOC_LEN=0x1000000
> CONFIG_SYS_MALLOC_F_LEN=0x10000
> CONFIG_NR_DRAM_BANKS=2
> CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
> -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
> +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1200000
> CONFIG_DM_GPIO=y
> CONFIG_SPL_DM_SPI=y
..
> -CONFIG_DEFAULT_DEVICE_TREE="spacemit/k1-musepi-pro"
> +CONFIG_DEFAULT_DEVICE_TREE="spacemit/k1-bananapi-f3"
no need to change
> CONFIG_SPL_SYS_MALLOC_F_LEN=0x4000
> CONFIG_SPL_MMC=y
> CONFIG_SPL_STACK_R_ADDR=0xc00000
> @@ -63,10 +63,12 @@ CONFIG_CMD_PCI=y
> CONFIG_CMD_SPI=y
> CONFIG_CMD_USB=y
> CONFIG_CMD_EXT4=y
> +CONFIG_CMD_REGULATOR=y
> CONFIG_CMD_FAT=y
> CONFIG_EFI_PARTITION=y
> CONFIG_OF_UPSTREAM=y
> -CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
> +CONFIG_DEVICE_TREE_INCLUDES="spacemit-k1-u-boot.dtsi"
..
> +CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro spacemit/k1-milkv-jupiter"
ditto
> CONFIG_MULTI_DTB_FIT=y
> CONFIG_ENV_OVERWRITE=y
> CONFIG_SPL_DM_SEQ_ALIAS=y
> @@ -117,3 +119,15 @@ CONFIG_USB_DWC3=y
> CONFIG_USB_DWC3_GENERIC=y
> CONFIG_USB_STORAGE=y
> CONFIG_SPL_LIB_RATIONAL=y
> +CONFIG_SPL_GPIO=y
> +CONFIG_SPL_DM_GPIO=y
> +CONFIG_SPL_PINCTRL=y
> +CONFIG_SPL_SPACEMIT_GPIO=y
> +CONFIG_SPL_PINCTRL_SPACEMIT_K1=y
> +CONFIG_SPL_MMC_IO_VOLTAGE=y
> +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200000
> +CONFIG_CMD_MTD=y
> +CONFIG_CMD_MTDPARTS=y
> +CONFIG_SPI_FLASH_MTD=y
> +CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
> +CONFIG_MTDPARTS_DEFAULT="spi0.0:128k(bootinfo),512k(fsbl),64k(env),1024k(esos),384k(opensbi),-(uboot)"
> --
> 2.56.0
>
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-11-20 6:20 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 13:46 [PATCH v1 0/6] riscv: dts: spacemit: Improve K1 SPL support Anand Moon
2026-10-29 13:46 ` [PATCH v1 1/6] riscv: dts: spacemit: Clean Up K1 U-Boot Device Tree for SPL Initialization Anand Moon
2026-10-31 11:54 ` Hung-Chun Tseng
2026-10-31 11:56 ` Hung-Chun Tseng
2026-10-31 16:45 ` Anand Moon
2026-10-31 18:15 ` E Shattow
2026-11-02 7:40 ` Anand Moon
2026-10-29 13:46 ` [PATCH v1 2/6] mmc: spacemit_sdhci: Improve voltage switching diagnostics Anand Moon
2026-10-29 13:46 ` [PATCH v1 3/6] mmc: spacemit_sdhci: Handle missing pinctrl states Anand Moon
2026-10-29 13:46 ` [PATCH v1 4/6] gpio: spacemit: Add SPL support for K1 GPIO driver Anand Moon
2026-11-20 5:58 ` Yixun Lan
2026-10-29 13:46 ` [PATCH v1 5/6] pinctrl: spacemit: Add SPL support for K1 pinctrl driver Anand Moon
2026-11-20 6:12 ` Yixun Lan
2026-10-29 13:46 ` [PATCH v1 6/6] configs: spacemit_k1: Enable SPL GPIO and pinctrl support Anand Moon
2026-11-20 6:19 ` Yixun Lan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.