* [PATCH v3 01/13] riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:55 ` E Shattow
2026-11-27 10:30 ` [PATCH v3 02/13] riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides Anand Moon
` (11 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini,
Guodong Xu, Raymond Mao, u-boot-spacemit
The Banana Pi BPI-F3 and MusePi Pro U-Boot device trees contain
identical Binman descriptions and memory node overrides.
Move the Binman description into spacemit-k1-binman.dtsi and the
memory override into spacemit-k1-u-boot.dtsi.
Include the common U-Boot device tree through DEVICE_TREE_INCLUDES
to avoid duplicating these definitions in the board-specific files.
This is a device tree reorganization with no intended functional
changes.
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 | 32 -----------------------
arch/riscv/dts/k1-musepi-pro-u-boot.dtsi | 29 --------------------
arch/riscv/dts/spacemit-k1-binman.dtsi | 29 ++++++++++++++++++++
arch/riscv/dts/spacemit-k1-u-boot.dtsi | 13 +++++++++
configs/spacemit_k1_defconfig | 1 +
5 files changed, 43 insertions(+), 61 deletions(-)
create mode 100644 arch/riscv/dts/spacemit-k1-binman.dtsi
create mode 100644 arch/riscv/dts/spacemit-k1-u-boot.dtsi
diff --git a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
index 36c1bfc12fb..bc117f5987a 100644
--- a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
+++ b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
@@ -3,15 +3,6 @@
* Copyright (C) 2026 RISCstar Ltd.
*/
-#include "binman.dtsi"
-
-/ {
- memory@0 {
- device_type = "memory";
- reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
- };
-};
-
&uart0 {
bootph-pre-ram;
};
@@ -96,26 +87,3 @@
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/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
index f2688a1868f..03cfed10521 100644
--- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
+++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
@@ -4,7 +4,6 @@
*/
#include <dt-bindings/clock/spacemit,k1-syscon.h>
-#include "binman.dtsi"
/ {
aliases {
@@ -15,11 +14,6 @@
chosen {
stdout-path = "serial0:115200n8";
};
-
- memory@0 {
- device_type = "memory";
- reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
- };
};
&syscon_mpmu {
@@ -133,26 +127,3 @@
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/spacemit-k1-u-boot.dtsi b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
new file mode 100644
index 00000000000..0d92edf9fc1
--- /dev/null
+++ b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Copyright (C) 2026 RISCstar Ltd.
+ */
+
+/ {
+ memory@0 {
+ device_type = "memory";
+ reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
+ };
+};
+
+#include "spacemit-k1-binman.dtsi"
diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
index d9cb6c8cebc..0f6e9284259 100644
--- a/configs/spacemit_k1_defconfig
+++ b/configs/spacemit_k1_defconfig
@@ -66,6 +66,7 @@ CONFIG_CMD_EXT4=y
CONFIG_CMD_FAT=y
CONFIG_EFI_PARTITION=y
CONFIG_OF_UPSTREAM=y
+CONFIG_DEVICE_TREE_INCLUDES="spacemit-k1-u-boot.dtsi"
CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
CONFIG_MULTI_DTB_FIT=y
CONFIG_ENV_OVERWRITE=y
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 01/13] riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI
2026-11-27 10:30 ` [PATCH v3 01/13] riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI Anand Moon
@ 2026-11-27 10:55 ` E Shattow
0 siblings, 0 replies; 21+ messages in thread
From: E Shattow @ 2026-11-27 10:55 UTC (permalink / raw)
To: Anand Moon, u-boot
Cc: Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng, Yixun Lan,
Tim Ouyang, Leo Liang, Yao Zi, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
On 11/27/26 02:30, Anand Moon wrote:
> The Banana Pi BPI-F3 and MusePi Pro U-Boot device trees contain
> identical Binman descriptions and memory node overrides.
>
> Move the Binman description into spacemit-k1-binman.dtsi and the
> memory override into spacemit-k1-u-boot.dtsi.
>
> Include the common U-Boot device tree through DEVICE_TREE_INCLUDES
> to avoid duplicating these definitions in the board-specific files.
>
> This is a device tree reorganization with no intended functional
> changes.
>
> 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 | 32 -----------------------
> arch/riscv/dts/k1-musepi-pro-u-boot.dtsi | 29 --------------------
> arch/riscv/dts/spacemit-k1-binman.dtsi | 29 ++++++++++++++++++++
> arch/riscv/dts/spacemit-k1-u-boot.dtsi | 13 +++++++++
> configs/spacemit_k1_defconfig | 1 +
> 5 files changed, 43 insertions(+), 61 deletions(-)
> create mode 100644 arch/riscv/dts/spacemit-k1-binman.dtsi
> create mode 100644 arch/riscv/dts/spacemit-k1-u-boot.dtsi
>
> diff --git a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
> index 36c1bfc12fb..bc117f5987a 100644
> --- a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
> +++ b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
> @@ -3,15 +3,6 @@
> * Copyright (C) 2026 RISCstar Ltd.
> */
>
> -#include "binman.dtsi"
> -
> -/ {
> - memory@0 {
> - device_type = "memory";
> - reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
> - };
> -};
> -
> &uart0 {
> bootph-pre-ram;
> };
> @@ -96,26 +87,3 @@
> 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/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> index f2688a1868f..03cfed10521 100644
> --- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> +++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> @@ -4,7 +4,6 @@
> */
>
> #include <dt-bindings/clock/spacemit,k1-syscon.h>
> -#include "binman.dtsi"
>
> / {
> aliases {
> @@ -15,11 +14,6 @@
> chosen {
> stdout-path = "serial0:115200n8";
> };
> -
> - memory@0 {
> - device_type = "memory";
> - reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
> - };
> };
>
> &syscon_mpmu {
> @@ -133,26 +127,3 @@
> 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/spacemit-k1-u-boot.dtsi b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
> new file mode 100644
> index 00000000000..0d92edf9fc1
> --- /dev/null
> +++ b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
> @@ -0,0 +1,13 @@
> +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> +/*
> + * Copyright (C) 2026 RISCstar Ltd.
> + */
> +
> +/ {
> + memory@0 {
> + device_type = "memory";
> + reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
> + };
> +};
> +
> +#include "spacemit-k1-binman.dtsi"
> diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
> index d9cb6c8cebc..0f6e9284259 100644
> --- a/configs/spacemit_k1_defconfig
> +++ b/configs/spacemit_k1_defconfig
> @@ -66,6 +66,7 @@ CONFIG_CMD_EXT4=y
> CONFIG_CMD_FAT=y
> CONFIG_EFI_PARTITION=y
> CONFIG_OF_UPSTREAM=y
> +CONFIG_DEVICE_TREE_INCLUDES="spacemit-k1-u-boot.dtsi"
> CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
> CONFIG_MULTI_DTB_FIT=y
> CONFIG_ENV_OVERWRITE=y
Reviewed-by: E Shattow <e@freeshell.de>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 02/13] riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
2026-11-27 10:30 ` [PATCH v3 01/13] riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:59 ` E Shattow
2026-11-27 10:30 ` [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI Anand Moon
` (10 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini,
u-boot-spacemit
The upstream MusePi Pro device tree already defines the serial0,
mmc0 and mmc1 aliases, as well as the chosen stdout-path.
Remove the duplicate definitions from the U-Boot-specific device
tree while retaining the console alias.
No functional changes are intended.
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-musepi-pro-u-boot.dtsi | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
index 03cfed10521..ddea04a8e3e 100644
--- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
+++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
@@ -8,11 +8,6 @@
/ {
aliases {
console = &uart0;
- serial0 = &uart0;
- };
-
- chosen {
- stdout-path = "serial0:115200n8";
};
};
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 02/13] riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides
2026-11-27 10:30 ` [PATCH v3 02/13] riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides Anand Moon
@ 2026-11-27 10:59 ` E Shattow
0 siblings, 0 replies; 21+ messages in thread
From: E Shattow @ 2026-11-27 10:59 UTC (permalink / raw)
To: Anand Moon, u-boot
Cc: Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng, Yixun Lan,
Tim Ouyang, Leo Liang, Yao Zi, Tom Rini, u-boot-spacemit
On 11/27/26 02:30, Anand Moon wrote:
> The upstream MusePi Pro device tree already defines the serial0,
> mmc0 and mmc1 aliases, as well as the chosen stdout-path.
>
> Remove the duplicate definitions from the U-Boot-specific device
> tree while retaining the console alias.
>
> No functional changes are intended.
>
> 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-musepi-pro-u-boot.dtsi | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> index 03cfed10521..ddea04a8e3e 100644
> --- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> +++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> @@ -8,11 +8,6 @@
> / {
> aliases {
> console = &uart0;
> - serial0 = &uart0;
> - };
> -
> - chosen {
> - stdout-path = "serial0:115200n8";
> };
> };
>
Reviewed-by: E Shattow <e@freeshell.de>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
2026-11-27 10:30 ` [PATCH v3 01/13] riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI Anand Moon
2026-11-27 10:30 ` [PATCH v3 02/13] riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 11:26 ` E Shattow
2026-11-27 10:30 ` [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL Anand Moon
` (9 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini,
Guodong Xu, Raymond Mao, u-boot-spacemit
Move common U-Boot device tree properties from the Banana Pi F3
and MusePi Pro board-specific DTSI files into spacemit-k1-u-boot.dtsi.
Consolidate early boot properties for UART, clocks, I2C, eMMC and
SDHCI controllers to reduce duplication between the boards.
Also move the clock configuration for the MPMU and APBC system
controllers into the shared DTSI.
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 | 54 ----------------
arch/riscv/dts/k1-musepi-pro-u-boot.dtsi | 79 -----------------------
arch/riscv/dts/spacemit-k1-u-boot.dtsi | 76 ++++++++++++++++++++++
3 files changed, 76 insertions(+), 133 deletions(-)
diff --git a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
index bc117f5987a..4e9f2c13203 100644
--- a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
+++ b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
@@ -3,50 +3,6 @@
* Copyright (C) 2026 RISCstar Ltd.
*/
-&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.
* The SPL board code looks up the bucks that DDR training depends on by
@@ -77,13 +33,3 @@
};
};
};
-
-&emmc {
- bootph-pre-ram;
- max-frequency = <204800000>;
-};
-
-&sdhci0 {
- bootph-pre-ram;
- max-frequency = <204800000>;
-};
diff --git a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
index ddea04a8e3e..834d9f46b48 100644
--- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
+++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
@@ -3,75 +3,6 @@
* Copyright (C) 2026 RISCstar Ltd.
*/
-#include <dt-bindings/clock/spacemit,k1-syscon.h>
-
-/ {
- aliases {
- console = &uart0;
- };
-};
-
-&syscon_mpmu {
- clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
- <&pll CLK_PLL1_D4>;
- clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
- "pll1_d4";
-};
-
-&syscon_apbc {
- clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
- <&pll CLK_PLL1_D4>,
- <&syscon_mpmu CLK_PLL1_31P5>,
- <&syscon_apmu CLK_PMUA_ACLK>;
- clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
- "pll1_d4", "pll1_d78_31p5", "pmua_aclk";
-};
-
-&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;
- status = "okay";
- };
-};
-
&i2c8 {
bootph-pre-ram;
status = "okay";
@@ -112,13 +43,3 @@
status = "okay";
};
};
-
-&emmc {
- bootph-pre-ram;
- max-frequency = <204800000>;
-};
-
-&sdhci0 {
- bootph-pre-ram;
- max-frequency = <204800000>;
-};
diff --git a/arch/riscv/dts/spacemit-k1-u-boot.dtsi b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
index 0d92edf9fc1..c084e15cb94 100644
--- a/arch/riscv/dts/spacemit-k1-u-boot.dtsi
+++ b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
@@ -3,11 +3,87 @@
* Copyright (C) 2026 RISCstar Ltd.
*/
+#include <dt-bindings/clock/spacemit,k1-syscon.h>
+
/ {
memory@0 {
device_type = "memory";
reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
};
+
+ aliases {
+ console = &uart0;
+ };
+};
+
+&syscon_mpmu {
+ clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
+ <&pll CLK_PLL1_D4>;
+ clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
+ "pll1_d4";
+};
+
+&syscon_apbc {
+ clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
+ <&pll CLK_PLL1_D4>,
+ <&syscon_mpmu CLK_PLL1_31P5>,
+ <&syscon_apmu CLK_PMUA_ACLK>;
+ clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
+ "pll1_d4", "pll1_d78_31p5", "pmua_aclk";
+};
+
+&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;
+ };
+};
+
+&emmc {
+ bootph-pre-ram;
+ max-frequency = <204800000>;
+};
+
+&sdhci0 {
+ bootph-pre-ram;
+ max-frequency = <204800000>;
};
#include "spacemit-k1-binman.dtsi"
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI
2026-11-27 10:30 ` [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI Anand Moon
@ 2026-11-27 11:26 ` E Shattow
2026-11-28 8:09 ` Anand Moon
0 siblings, 1 reply; 21+ messages in thread
From: E Shattow @ 2026-11-27 11:26 UTC (permalink / raw)
To: Anand Moon, u-boot
Cc: Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng, Yixun Lan,
Tim Ouyang, Leo Liang, Yao Zi, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
Hi Anand,
On 11/27/26 02:30, Anand Moon wrote:
> Move common U-Boot device tree properties from the Banana Pi F3
> and MusePi Pro board-specific DTSI files into spacemit-k1-u-boot.dtsi.
>
> Consolidate early boot properties for UART, clocks, I2C, eMMC and
> SDHCI controllers to reduce duplication between the boards.
No, this "reduce duplication" increases the duplication of work in
future and likely broken outcome, also making git bisect confusing to
compare. If a node sits in k1-bananapi-f3.dts devicetree-rebasing and
needs a bootph-pre-ram hint then it should get the override in u-boot
k1-bananapi-f3-u-boot.dtsi; if there is e.g. "k1-common.dtsi" included
by *some* boards' dts then it is still per-board and not
spacemit-k1-u-boot.dtsi specific, for u-boot override purposes. What I
can think of that should be in spacemit-k1-u-boot.dtsi u-boot override
are k1.dtsi specific nodes.
If they are indeed common then upstream would have consolidated this
firstly. I would accept a link to LKML discussion where such
"consolidation" has been reviewed and queued for-next in the case where
you are implementing this here knowing that, for development cycle
schedule considerations, it is going to be the same as the shape of
upstream development that has not yet been applied in a merge window for
the Linux development cycle.
>
> Also move the clock configuration for the MPMU and APBC system
> controllers into the shared DTSI.
>
> 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 | 54 ----------------
> arch/riscv/dts/k1-musepi-pro-u-boot.dtsi | 79 -----------------------
> arch/riscv/dts/spacemit-k1-u-boot.dtsi | 76 ++++++++++++++++++++++
> 3 files changed, 76 insertions(+), 133 deletions(-)
>
> diff --git a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
> index bc117f5987a..4e9f2c13203 100644
> --- a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
> +++ b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
> @@ -3,50 +3,6 @@
> * Copyright (C) 2026 RISCstar Ltd.
> */
>
> -&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.
> * The SPL board code looks up the bucks that DDR training depends on by
> @@ -77,13 +33,3 @@
> };
> };
> };
> -
> -&emmc {
> - bootph-pre-ram;
> - max-frequency = <204800000>;
> -};
> -
> -&sdhci0 {
> - bootph-pre-ram;
> - max-frequency = <204800000>;
> -};
> diff --git a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> index ddea04a8e3e..834d9f46b48 100644
> --- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> +++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
> @@ -3,75 +3,6 @@
> * Copyright (C) 2026 RISCstar Ltd.
> */
>
> -#include <dt-bindings/clock/spacemit,k1-syscon.h>
> -
> -/ {
> - aliases {
> - console = &uart0;
> - };
> -};
> -
> -&syscon_mpmu {
> - clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
> - <&pll CLK_PLL1_D4>;
> - clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
> - "pll1_d4";
> -};
> -
> -&syscon_apbc {
> - clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
> - <&pll CLK_PLL1_D4>,
> - <&syscon_mpmu CLK_PLL1_31P5>,
> - <&syscon_apmu CLK_PMUA_ACLK>;
> - clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
> - "pll1_d4", "pll1_d78_31p5", "pmua_aclk";
> -};
> -
> -&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;
> - status = "okay";
> - };
> -};
> -
> &i2c8 {
> bootph-pre-ram;
> status = "okay";
> @@ -112,13 +43,3 @@
> status = "okay";
> };
> };
> -
> -&emmc {
> - bootph-pre-ram;
> - max-frequency = <204800000>;
> -};
> -
> -&sdhci0 {
> - bootph-pre-ram;
> - max-frequency = <204800000>;
> -};
> diff --git a/arch/riscv/dts/spacemit-k1-u-boot.dtsi b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
> index 0d92edf9fc1..c084e15cb94 100644
> --- a/arch/riscv/dts/spacemit-k1-u-boot.dtsi
> +++ b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
> @@ -3,11 +3,87 @@
> * Copyright (C) 2026 RISCstar Ltd.
> */
>
> +#include <dt-bindings/clock/spacemit,k1-syscon.h>
> +
> / {
> memory@0 {
> device_type = "memory";
> reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
> };
> +
> + aliases {
> + console = &uart0;
> + };
> +};
> +
> +&syscon_mpmu {
> + clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
> + <&pll CLK_PLL1_D4>;
> + clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
> + "pll1_d4";
> +};
> +
> +&syscon_apbc {
> + clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>,
> + <&pll CLK_PLL1_D4>,
> + <&syscon_mpmu CLK_PLL1_31P5>,
> + <&syscon_apmu CLK_PMUA_ACLK>;
> + clock-names = "osc", "vctcxo_1m", "vctcxo_3m", "vctcxo_24m",
> + "pll1_d4", "pll1_d78_31p5", "pmua_aclk";
> +};
> +
> +&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;
> + };
> +};
> +
> +&emmc {
> + bootph-pre-ram;
> + max-frequency = <204800000>;
> +};
> +
> +&sdhci0 {
> + bootph-pre-ram;
> + max-frequency = <204800000>;
> };
>
> #include "spacemit-k1-binman.dtsi"
As above, changes requested please.
-E
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI
2026-11-27 11:26 ` E Shattow
@ 2026-11-28 8:09 ` Anand Moon
0 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-28 8:09 UTC (permalink / raw)
To: E Shattow
Cc: u-boot, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
Yixun Lan, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini, Guodong Xu,
Raymond Mao, u-boot-spacemit
Hi E Shattow,
On Fri, 27 Nov 2026 at 16:56, E Shattow <e@freeshell.de> wrote:
>
> Hi Anand,
>
> On 11/27/26 02:30, Anand Moon wrote:
> > Move common U-Boot device tree properties from the Banana Pi F3
> > and MusePi Pro board-specific DTSI files into spacemit-k1-u-boot.dtsi.
> >
> > Consolidate early boot properties for UART, clocks, I2C, eMMC and
> > SDHCI controllers to reduce duplication between the boards.
>
> No, this "reduce duplication" increases the duplication of work in
> future and likely broken outcome, also making git bisect confusing to
> compare. If a node sits in k1-bananapi-f3.dts devicetree-rebasing and
> needs a bootph-pre-ram hint then it should get the override in u-boot
> k1-bananapi-f3-u-boot.dtsi; if there is e.g. "k1-common.dtsi" included
> by *some* boards' dts then it is still per-board and not
> spacemit-k1-u-boot.dtsi specific, for u-boot override purposes. What I
> can think of that should be in spacemit-k1-u-boot.dtsi u-boot override
> are k1.dtsi specific nodes.
>
As of now, k1.dtsi does not contain any bootph-pre-ram properties,
so the early boot overrides are still necessary where the corresponding
devices are required in SPL.
> If they are indeed common then upstream would have consolidated this
> firstly. I would accept a link to LKML discussion where such
> "consolidation" has been reviewed and queued for-next in the case where
> you are implementing this here knowing that, for development cycle
> schedule considerations, it is going to be the same as the shape of
> upstream development that has not yet been applied in a merge window for
> the Linux development cycle.
>
Earlier, I had requested adding the missing bootph-pre-ram properties
to the pinctrl nodes and the missing regulator names in the upstream
device trees [1].
Currently, most of the device tree configurations for eMMC, SD cards,
SPI flash and PCIe are already available in the upstream device trees
under dts/upstream/src/riscv/spacemit/. Only a few bootph-pre-ram
properties and other required properties are missing.
The intention behind moving the common properties into
spacemit-k1-u-boot.dtsi was to simplify the U-Boot-specific device tree
overrides for Banana Pi BPI-F3 and MusePi Pro, while retaining the
board-specific i2c8 regulator configurations in their respective DTSI
files.
However, I understand your concern about maintaining consistency with
the upstream device tree hierarchy and avoiding additional maintenance
during future devicetree-rebasing updates.
I will revisit these changes and limit spacemit-k1-u-boot.dtsi to
overrides for nodes defined in k1.dtsi, while retaining board-specific
overrides in their respective U-Boot DTSI files.
Once the changes are accepted and synchronized into U-Boot through
devicetree-rebasing, we can remove the corresponding redundant overrides.
[1] https://lore.kernel.org/all/CANAwSgQ=Djw_o89MgvEsmKVxuNiE3Yuy=e0T5DcLfqCYy6eWMw@mail.gmail.com/#t
Thanks,
-Anand
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (2 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 11:36 ` E Shattow
2026-11-27 10:30 ` [PATCH v3 05/13] pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver Anand Moon
` (8 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Lukasz Majewski, Tom Rini, Guodong Xu
The SpacemiT K1 GPIO and pinctrl controllers require their functional
and bus clocks to be enabled before accessing the controller registers.
These clocks are currently only available in U-Boot proper, preventing
the GPIO and pinctrl drivers from enabling their clocks in SPL.
Move the GPIO and AIB clock definitions outside the SPL conditional
and register them in the SPL APBC clock table.
This allows both controllers to enable their required clocks during
early boot.
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>
Suggested-by: Junhui Liu <junhui.liu@pigmoral.tech>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
drivers/clk/spacemit/clk-k1.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/spacemit/clk-k1.c b/drivers/clk/spacemit/clk-k1.c
index 20b8595aa3c..646c81a2d60 100644
--- a/drivers/clk/spacemit/clk-k1.c
+++ b/drivers/clk/spacemit/clk-k1.c
@@ -379,9 +379,6 @@ CCU_MUX_GATE_DEFINE(CLK_UART9, uart9_clk, uart9_clk, uart_clk_parents,
ARRAY_SIZE(uart_clk_parents), APBC_UART9_CLK_RST,
4, 3, BIT(1) | BIT(0), 0);
-CCU_GATE_DEFINE(CLK_GPIO, gpio_clk, gpio_clk, "clock-24m", APBC_GPIO_CLK_RST,
- BIT(1) | BIT(0), 0);
-
static const char * const pwm_parents[] = {
"pll1_d192_12p8",
"clock-32k",
@@ -499,9 +496,6 @@ CCU_MUX_GATE_DEFINE(CLK_TIMERS2, timers2_clk, timers2_clk, timer_parents,
ARRAY_SIZE(timer_parents), APBC_TIMERS2_CLK_RST, 4, 3,
BIT(1) | BIT(0), 0);
-CCU_GATE_DEFINE(CLK_AIB, aib_clk, aib_clk, "clock-24m", APBC_AIB_CLK_RST,
- BIT(1) | BIT(0), 0);
-
CCU_GATE_DEFINE(CLK_ONEWIRE, onewire_clk, onewire_clk, "clock-24m",
APBC_ONEWIRE_CLK_RST, BIT(1) | BIT(0), 0);
@@ -584,9 +578,6 @@ CCU_GATE_DEFINE(CLK_UART8_BUS, uart8_bus_clk, uart8_bus_clk, "apb_clk",
CCU_GATE_DEFINE(CLK_UART9_BUS, uart9_bus_clk, uart9_bus_clk, "apb_clk",
APBC_UART9_CLK_RST, BIT(0), 0);
-CCU_GATE_DEFINE(CLK_GPIO_BUS, gpio_bus_clk, gpio_bus_clk, "apb_clk",
- APBC_GPIO_CLK_RST, BIT(0), 0);
-
CCU_GATE_DEFINE(CLK_PWM0_BUS, pwm0_bus_clk, pwm0_bus_clk, "apb_clk",
APBC_PWM0_CLK_RST, BIT(0), 0);
CCU_GATE_DEFINE(CLK_PWM1_BUS, pwm1_bus_clk, pwm1_bus_clk, "apb_clk",
@@ -655,9 +646,6 @@ CCU_GATE_DEFINE(CLK_TIMERS1_BUS, timers1_bus_clk, timers1_bus_clk, "apb_clk",
CCU_GATE_DEFINE(CLK_TIMERS2_BUS, timers2_bus_clk, timers2_bus_clk, "apb_clk",
APBC_TIMERS2_CLK_RST, BIT(0), 0);
-CCU_GATE_DEFINE(CLK_AIB_BUS, aib_bus_clk, aib_bus_clk, "apb_clk",
- APBC_AIB_CLK_RST, BIT(0), 0);
-
CCU_GATE_DEFINE(CLK_ONEWIRE_BUS, onewire_bus_clk, onewire_bus_clk, "apb_clk",
APBC_ONEWIRE_CLK_RST, BIT(0), 0);
@@ -672,6 +660,19 @@ CCU_GATE_DEFINE(CLK_TSEN_BUS, tsen_bus_clk, tsen_bus_clk, "apb_clk",
CCU_GATE_DEFINE(CLK_IPC_AP2AUD_BUS, ipc_ap2aud_bus_clk, ipc_ap2aud_bus_clk,
"apb_clk", APBC_IPC_AP2AUD_CLK_RST, BIT(0), 0);
#endif
+
+CCU_GATE_DEFINE(CLK_GPIO, gpio_clk, gpio_clk, "clock-24m", APBC_GPIO_CLK_RST,
+ BIT(1) | BIT(0), 0);
+
+CCU_GATE_DEFINE(CLK_AIB, aib_clk, aib_clk, "clock-24m", APBC_AIB_CLK_RST,
+ BIT(1) | BIT(0), 0);
+
+CCU_GATE_DEFINE(CLK_GPIO_BUS, gpio_bus_clk, gpio_bus_clk, "apb_clk",
+ APBC_GPIO_CLK_RST, BIT(0), 0);
+
+CCU_GATE_DEFINE(CLK_AIB_BUS, aib_bus_clk, aib_bus_clk, "apb_clk",
+ APBC_AIB_CLK_RST, BIT(0), 0);
+
/* APBC clocks end */
/* APMU clocks start */
@@ -1309,10 +1310,14 @@ static const struct spacemit_ccu_data k1_ccu_mpmu_data = {
#if IS_ENABLED(CONFIG_SPL_BUILD)
static struct clk *k1_ccu_apbc_clks[] = {
&uart0_clk.common.clk,
+ &gpio_clk.common.clk,
&twsi2_clk.common.clk,
&twsi8_clk.common.clk,
+ &aib_clk.common.clk,
+ &gpio_bus_clk.common.clk,
&twsi2_bus_clk.common.clk,
&twsi8_bus_clk.common.clk,
+ &aib_bus_clk.common.clk,
};
#else
static struct clk *k1_ccu_apbc_clks[] = {
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL
2026-11-27 10:30 ` [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL Anand Moon
@ 2026-11-27 11:36 ` E Shattow
0 siblings, 0 replies; 21+ messages in thread
From: E Shattow @ 2026-11-27 11:36 UTC (permalink / raw)
To: Anand Moon, u-boot
Cc: Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng, Yixun Lan,
Lukasz Majewski, Tom Rini, Guodong Xu
On 11/27/26 02:30, Anand Moon wrote:
> The SpacemiT K1 GPIO and pinctrl controllers require their functional
> and bus clocks to be enabled before accessing the controller registers.
>
> These clocks are currently only available in U-Boot proper, preventing
> the GPIO and pinctrl drivers from enabling their clocks in SPL.
>
> Move the GPIO and AIB clock definitions outside the SPL conditional
> and register them in the SPL APBC clock table.
>
> This allows both controllers to enable their required clocks during
> early boot.
>
> 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>
> Suggested-by: Junhui Liu <junhui.liu@pigmoral.tech>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> drivers/clk/spacemit/clk-k1.c | 29 +++++++++++++++++------------
> 1 file changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/clk/spacemit/clk-k1.c b/drivers/clk/spacemit/clk-k1.c
> index 20b8595aa3c..646c81a2d60 100644
> --- a/drivers/clk/spacemit/clk-k1.c
> +++ b/drivers/clk/spacemit/clk-k1.c
> @@ -379,9 +379,6 @@ CCU_MUX_GATE_DEFINE(CLK_UART9, uart9_clk, uart9_clk, uart_clk_parents,
> ARRAY_SIZE(uart_clk_parents), APBC_UART9_CLK_RST,
> 4, 3, BIT(1) | BIT(0), 0);
>
> -CCU_GATE_DEFINE(CLK_GPIO, gpio_clk, gpio_clk, "clock-24m", APBC_GPIO_CLK_RST,
> - BIT(1) | BIT(0), 0);
> -
> static const char * const pwm_parents[] = {
> "pll1_d192_12p8",
> "clock-32k",
> @@ -499,9 +496,6 @@ CCU_MUX_GATE_DEFINE(CLK_TIMERS2, timers2_clk, timers2_clk, timer_parents,
> ARRAY_SIZE(timer_parents), APBC_TIMERS2_CLK_RST, 4, 3,
> BIT(1) | BIT(0), 0);
>
> -CCU_GATE_DEFINE(CLK_AIB, aib_clk, aib_clk, "clock-24m", APBC_AIB_CLK_RST,
> - BIT(1) | BIT(0), 0);
> -
> CCU_GATE_DEFINE(CLK_ONEWIRE, onewire_clk, onewire_clk, "clock-24m",
> APBC_ONEWIRE_CLK_RST, BIT(1) | BIT(0), 0);
>
> @@ -584,9 +578,6 @@ CCU_GATE_DEFINE(CLK_UART8_BUS, uart8_bus_clk, uart8_bus_clk, "apb_clk",
> CCU_GATE_DEFINE(CLK_UART9_BUS, uart9_bus_clk, uart9_bus_clk, "apb_clk",
> APBC_UART9_CLK_RST, BIT(0), 0);
>
> -CCU_GATE_DEFINE(CLK_GPIO_BUS, gpio_bus_clk, gpio_bus_clk, "apb_clk",
> - APBC_GPIO_CLK_RST, BIT(0), 0);
> -
> CCU_GATE_DEFINE(CLK_PWM0_BUS, pwm0_bus_clk, pwm0_bus_clk, "apb_clk",
> APBC_PWM0_CLK_RST, BIT(0), 0);
> CCU_GATE_DEFINE(CLK_PWM1_BUS, pwm1_bus_clk, pwm1_bus_clk, "apb_clk",
> @@ -655,9 +646,6 @@ CCU_GATE_DEFINE(CLK_TIMERS1_BUS, timers1_bus_clk, timers1_bus_clk, "apb_clk",
> CCU_GATE_DEFINE(CLK_TIMERS2_BUS, timers2_bus_clk, timers2_bus_clk, "apb_clk",
> APBC_TIMERS2_CLK_RST, BIT(0), 0);
>
> -CCU_GATE_DEFINE(CLK_AIB_BUS, aib_bus_clk, aib_bus_clk, "apb_clk",
> - APBC_AIB_CLK_RST, BIT(0), 0);
> -
> CCU_GATE_DEFINE(CLK_ONEWIRE_BUS, onewire_bus_clk, onewire_bus_clk, "apb_clk",
> APBC_ONEWIRE_CLK_RST, BIT(0), 0);
>
> @@ -672,6 +660,19 @@ CCU_GATE_DEFINE(CLK_TSEN_BUS, tsen_bus_clk, tsen_bus_clk, "apb_clk",
> CCU_GATE_DEFINE(CLK_IPC_AP2AUD_BUS, ipc_ap2aud_bus_clk, ipc_ap2aud_bus_clk,
> "apb_clk", APBC_IPC_AP2AUD_CLK_RST, BIT(0), 0);
> #endif
> +
> +CCU_GATE_DEFINE(CLK_GPIO, gpio_clk, gpio_clk, "clock-24m", APBC_GPIO_CLK_RST,
> + BIT(1) | BIT(0), 0);
> +
> +CCU_GATE_DEFINE(CLK_AIB, aib_clk, aib_clk, "clock-24m", APBC_AIB_CLK_RST,
> + BIT(1) | BIT(0), 0);
> +
> +CCU_GATE_DEFINE(CLK_GPIO_BUS, gpio_bus_clk, gpio_bus_clk, "apb_clk",
> + APBC_GPIO_CLK_RST, BIT(0), 0);
> +
> +CCU_GATE_DEFINE(CLK_AIB_BUS, aib_bus_clk, aib_bus_clk, "apb_clk",
> + APBC_AIB_CLK_RST, BIT(0), 0);
> +
> /* APBC clocks end */
>
> /* APMU clocks start */
> @@ -1309,10 +1310,14 @@ static const struct spacemit_ccu_data k1_ccu_mpmu_data = {
> #if IS_ENABLED(CONFIG_SPL_BUILD)
> static struct clk *k1_ccu_apbc_clks[] = {
> &uart0_clk.common.clk,
> + &gpio_clk.common.clk,
> &twsi2_clk.common.clk,
> &twsi8_clk.common.clk,
> + &aib_clk.common.clk,
> + &gpio_bus_clk.common.clk,
> &twsi2_bus_clk.common.clk,
> &twsi8_bus_clk.common.clk,
> + &aib_bus_clk.common.clk,
> };
> #else
> static struct clk *k1_ccu_apbc_clks[] = {
Reviewed-by: E Shattow <e@freeshell.de>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 05/13] pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (3 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 11:42 ` E Shattow
2026-11-27 10:30 ` [PATCH v3 06/13] gpio: spacemit: Add SPL support for K1/K3 GPIO driver Anand Moon
` (7 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tom Rini, Raymond Mao, u-boot-spacemit
Add a Kconfig option to enable the SpacemiT K1/K3 pinctrl driver
in SPL, allowing pin multiplexing and pin configuration during
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>
Reviewed-by: 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..ad5b458480a 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/K3 pinctrl driver in SPL"
+ depends on SPL_PINCTRL && (TARGET_SPACEMIT_K1 || TARGET_SPACEMIT_K3)
+ select PINCTRL_SPACEMIT_K1
+ help
+ Enable the SpacemiT K1/K3 pinctrl driver in SPL to configure
+ pin multiplexing and pin settings during early initialization.
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 05/13] pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver
2026-11-27 10:30 ` [PATCH v3 05/13] pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver Anand Moon
@ 2026-11-27 11:42 ` E Shattow
0 siblings, 0 replies; 21+ messages in thread
From: E Shattow @ 2026-11-27 11:42 UTC (permalink / raw)
To: Anand Moon, u-boot
Cc: Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng, Yixun Lan,
Tom Rini, Raymond Mao, u-boot-spacemit
On 11/27/26 02:30, Anand Moon wrote:
> Add a Kconfig option to enable the SpacemiT K1/K3 pinctrl driver
> in SPL, allowing pin multiplexing and pin configuration during
> 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>
> Reviewed-by: 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..ad5b458480a 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/K3 pinctrl driver in SPL"
> + depends on SPL_PINCTRL && (TARGET_SPACEMIT_K1 || TARGET_SPACEMIT_K3)
> + select PINCTRL_SPACEMIT_K1
> + help
> + Enable the SpacemiT K1/K3 pinctrl driver in SPL to configure
> + pin multiplexing and pin settings during early initialization.
Reviewed-by: E Shattow <e@freeshell.de>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 06/13] gpio: spacemit: Add SPL support for K1/K3 GPIO driver
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (4 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 05/13] pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 11:40 ` E Shattow
2026-11-27 10:30 ` [PATCH v3 07/13] mmc: spacemit_sdhci: Improve voltage switching diagnostics Anand Moon
` (6 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tom Rini, Johan Jonker, Raymond Mao
Allow SPL to access GPIOs on SpacemiT K1 and K3 platforms during
early board initialization, including GPIO-based card detection
for SD controllers.
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>
Reviewed-by: 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..ac7bd642cf6 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 GPIO driver in SPL"
+ depends on SPL_DM_GPIO && (TARGET_SPACEMIT_K1 || TARGET_SPACEMIT_K3)
+ select SPACEMIT_GPIO
+ help
+ Enable the SpacemiT GPIO driver in SPL to provide GPIO
+ access during early board initialization.
config SUNXI_GPIO
bool "Allwinner GPIO driver"
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 06/13] gpio: spacemit: Add SPL support for K1/K3 GPIO driver
2026-11-27 10:30 ` [PATCH v3 06/13] gpio: spacemit: Add SPL support for K1/K3 GPIO driver Anand Moon
@ 2026-11-27 11:40 ` E Shattow
0 siblings, 0 replies; 21+ messages in thread
From: E Shattow @ 2026-11-27 11:40 UTC (permalink / raw)
To: Anand Moon, u-boot
Cc: Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng, Yixun Lan,
Tom Rini, Johan Jonker, Raymond Mao
On 11/27/26 02:30, Anand Moon wrote:
> Allow SPL to access GPIOs on SpacemiT K1 and K3 platforms during
> early board initialization, including GPIO-based card detection
> for SD controllers.
>
> 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>
> Reviewed-by: 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..ac7bd642cf6 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 GPIO driver in SPL"
> + depends on SPL_DM_GPIO && (TARGET_SPACEMIT_K1 || TARGET_SPACEMIT_K3)
> + select SPACEMIT_GPIO
> + help
> + Enable the SpacemiT GPIO driver in SPL to provide GPIO
> + access during early board initialization.
>
> config SUNXI_GPIO
> bool "Allwinner GPIO driver"
Reviewed-by: E Shattow <e@freeshell.de>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 07/13] mmc: spacemit_sdhci: Improve voltage switching diagnostics
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (5 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 06/13] gpio: spacemit: Add SPL support for K1/K3 GPIO driver Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:30 ` [PATCH v3 08/13] mmc: spacemit_sdhci: Select pinctrl state based on signal voltage Anand Moon
` (5 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, 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 | 79 ++++++++++++++++++++++--------------
1 file changed, 48 insertions(+), 31 deletions(-)
diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
index fdedb9a301a..45acab38b4b 100644
--- a/drivers/mmc/spacemit_sdhci.c
+++ b/drivers/mmc/spacemit_sdhci.c
@@ -226,11 +226,18 @@ static int spacemit_sdhci_set_vqmmc_voltage(struct mmc *mmc, int voltage)
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 +246,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.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 08/13] mmc: spacemit_sdhci: Select pinctrl state based on signal voltage
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (6 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 07/13] mmc: spacemit_sdhci: Improve voltage switching diagnostics Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:30 ` [PATCH v3 09/13] riscv: spacemit: k1: Adjust SPL stack and malloc configuration Anand Moon
` (4 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Peng Fan, Jaehoon Chung, Tanmay Kathpalia,
Tom Rini, u-boot-spacemit
The default and UHS pinctrl states describe the electrical
configuration of the SD interface for 3.3V and 1.8V operation,
respectively.
Selecting the pinctrl state based on the timing mode may apply
an incorrect pin configuration during voltage switching and
does not account for UHS DDR50 mode.
Introduce a helper to select the appropriate pinctrl state based
on the requested signal voltage immediately after configuring
the controller voltage.
Check whether the requested pinctrl state is available before
attempting to select it, as not all SDHCI instances provide
pinctrl states and these properties may be absent in SPL.
Use the phase-specific PINCTRL configuration and report 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 | 65 +++++++++++++++++++++++++++---------
1 file changed, 50 insertions(+), 15 deletions(-)
diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
index 45acab38b4b..132bec8d1c1 100644
--- a/drivers/mmc/spacemit_sdhci.c
+++ b/drivers/mmc/spacemit_sdhci.c
@@ -341,12 +341,62 @@ static int spacemit_sdhci_wait_dat0(struct udevice *dev, int state,
return 0;
}
+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_pinctrl_state(struct sdhci_host *host)
+{
+ struct mmc *mmc = host->mmc;
+ struct udevice *dev = mmc->dev;
+ const char *state;
+ int ret;
+
+ if (!CONFIG_IS_ENABLED(PINCTRL))
+ return;
+
+ switch (mmc->signal_voltage) {
+ case MMC_SIGNAL_VOLTAGE_330:
+ state = "default";
+ break;
+ case MMC_SIGNAL_VOLTAGE_180:
+ state = "uhs";
+ break;
+ default:
+ return;
+ }
+
+ if (!spacemit_sdhci_has_pinctrl_state(dev, state))
+ return;
+
+ ret = pinctrl_select_state(dev, state);
+ if (ret)
+ log_err("%s: failed to select pinctrl state '%s': %d\n",
+ dev->name, state, ret);
+ else
+ log_debug("%s: selected pinctrl state '%s'\n",
+ dev->name, state);
+}
+
static void spacemit_sdhci_set_control_reg(struct sdhci_host *host)
{
struct mmc *mmc = host->mmc;
u32 reg;
spacemit_sdhci_set_voltage(host);
+ spacemit_sdhci_set_pinctrl_state(host);
if (spacemit_sdhci_is_voltage_switch_cmd(host))
spacemit_sdhci_set_clk_gate(host, 0);
@@ -368,21 +418,6 @@ 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)) {
- switch (mmc->selected_mode) {
- case UHS_SDR12:
- case UHS_SDR25:
- case UHS_SDR50:
- case UHS_SDR104:
- pinctrl_select_state(mmc->dev, "uhs");
- break;
- default:
- pinctrl_select_state(mmc->dev, "default");
- break;
- }
- }
-
if (mmc->selected_mode == MMC_HS_200 ||
mmc->selected_mode == MMC_HS_400 ||
mmc->selected_mode == MMC_HS_400_ES) {
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 09/13] riscv: spacemit: k1: Adjust SPL stack and malloc configuration
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (7 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 08/13] mmc: spacemit_sdhci: Select pinctrl state based on signal voltage Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:30 ` [PATCH v3 10/13] riscv: dts: spacemit: k1: Retain GPIO and pinctrl nodes in SPL Anand Moon
` (3 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
Move the configured initial stack pointer from 0x01000000 to
0x01200000 and set the SPL relocated-stack simple malloc
allocation size to 2 MiB.
Trying to boot from MMC2
Transfer data timeout
spl: mmc init failed with error: -110
Error: -110
SPL: Unsupported Boot Device!
Trying to boot from MMC1
alloc space exhausted ptr 100380 limit 100000
Aligned buffer alloc failed
spl: could not find mmc device 0. error: -19
Error: -19
This updates the early boot memory configuration to accommodate
SPL stack and dynamic allocation requirements.
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
index 0f6e9284259..a6d0ba6153c 100644
--- a/configs/spacemit_k1_defconfig
+++ b/configs/spacemit_k1_defconfig
@@ -3,7 +3,8 @@ 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_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200000
CONFIG_DM_GPIO=y
CONFIG_SPL_DM_SPI=y
CONFIG_DEFAULT_DEVICE_TREE="spacemit/k1-musepi-pro"
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 10/13] riscv: dts: spacemit: k1: Retain GPIO and pinctrl nodes in SPL
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (8 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 09/13] riscv: spacemit: k1: Adjust SPL stack and malloc configuration Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:30 ` [PATCH v3 11/13] riscv: spacemit: k1: Enable GPIO, pinctrl and MMC UHS support Anand Moon
` (2 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini
The GPIO and pinctrl controllers are required during early boot
to configure pins and access GPIOs used by SPL devices.
Add bootph-pre-ram to the GPIO and pinctrl controller nodes and
the pin configuration groups used by UART, I2C, QSPI and SDHCI.
Retain the corresponding child nodes to prevent SPL device tree
filtering from removing the pinmux and electrical configuration
properties.
This makes the required pin configurations available during SPL
initialization on 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/spacemit-k1-u-boot.dtsi | 44 ++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/arch/riscv/dts/spacemit-k1-u-boot.dtsi b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
index c084e15cb94..482f1c2aae1 100644
--- a/arch/riscv/dts/spacemit-k1-u-boot.dtsi
+++ b/arch/riscv/dts/spacemit-k1-u-boot.dtsi
@@ -86,4 +86,48 @@
max-frequency = <204800000>;
};
+&gpio {
+ bootph-pre-ram;
+};
+
+&pinctrl {
+ bootph-pre-ram;
+};
+
+&qspi_cfg {
+ bootph-pre-ram;
+
+ qspi-pins {
+ bootph-pre-ram;
+ };
+
+ qspi-cs1-pins {
+ bootph-pre-ram;
+ };
+};
+
+&mmc1_cfg {
+ bootph-pre-ram;
+
+ mmc1-data-cmd-pins {
+ bootph-pre-ram;
+ };
+
+ mmc1-clk-pins {
+ bootph-pre-ram;
+ };
+};
+
+&mmc1_uhs_cfg {
+ bootph-pre-ram;
+
+ mmc1-data-cmd-pins {
+ bootph-pre-ram;
+ };
+
+ mmc1-clk-pins {
+ bootph-pre-ram;
+ };
+};
+
#include "spacemit-k1-binman.dtsi"
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 11/13] riscv: spacemit: k1: Enable GPIO, pinctrl and MMC UHS support
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (9 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 10/13] riscv: dts: spacemit: k1: Retain GPIO and pinctrl nodes in SPL Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:30 ` [PATCH v3 12/13] riscv: spacemit: k1: Enable uncompressed multi-DTB FIT support in SPL Anand Moon
2026-11-27 10:30 ` [PATCH v3 13/13] riscv: dts: spacemit: k1: Support multi-DTB SPL images in Binman Anand Moon
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
Enable the SpacemiT GPIO and pinctrl drivers in SPL to support
GPIO-based SD card detection and device tree-based pin
configuration during early boot.
Enable MMC UHS support in both SPL and U-Boot proper to allow
SD cards to operate in the supported UHS modes and select the
appropriate pinctrl state for 1.8V signaling.
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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
index a6d0ba6153c..8e41384a3e1 100644
--- a/configs/spacemit_k1_defconfig
+++ b/configs/spacemit_k1_defconfig
@@ -122,3 +122,10 @@ CONFIG_USB_DWC3_GENERIC=y
CONFIG_USB_STORAGE=y
CONFIG_USB_ONBOARD_HUB=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_MMC_UHS_SUPPORT=y
+CONFIG_SPL_MMC_UHS_SUPPORT=y
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 12/13] riscv: spacemit: k1: Enable uncompressed multi-DTB FIT support in SPL
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (10 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 11/13] riscv: spacemit: k1: Enable GPIO, pinctrl and MMC UHS support Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
2026-11-27 10:30 ` [PATCH v3 13/13] riscv: dts: spacemit: k1: Support multi-DTB SPL images in Binman Anand Moon
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tom Rini, Guodong Xu, Raymond Mao,
u-boot-spacemit
Enable multi-DTB FIT support in SPL for the Banana Pi BPI-F3 and
MusePi Pro boards.
Use an uncompressed FIT to avoid allocating a decompression buffer
from the limited early SPL malloc pool.
Increasing the early malloc pool to accommodate the compressed FIT
causes the relocated DDR firmware to overlap SPL global data and
malloc memory, resulting in memory corruption before DDR
initialization.
Using an uncompressed FIT allows the original early malloc pool
size to be retained and avoids the observed SRAM overlap.
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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/configs/spacemit_k1_defconfig b/configs/spacemit_k1_defconfig
index 8e41384a3e1..5b1153fa63f 100644
--- a/configs/spacemit_k1_defconfig
+++ b/configs/spacemit_k1_defconfig
@@ -69,7 +69,10 @@ CONFIG_EFI_PARTITION=y
CONFIG_OF_UPSTREAM=y
CONFIG_DEVICE_TREE_INCLUDES="spacemit-k1-u-boot.dtsi"
CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
+CONFIG_SPL_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
CONFIG_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
CONFIG_ENV_OVERWRITE=y
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_SYSCON=y
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 13/13] riscv: dts: spacemit: k1: Support multi-DTB SPL images in Binman
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
` (11 preceding siblings ...)
2026-11-27 10:30 ` [PATCH v3 12/13] riscv: spacemit: k1: Enable uncompressed multi-DTB FIT support in SPL Anand Moon
@ 2026-11-27 10:30 ` Anand Moon
12 siblings, 0 replies; 21+ messages in thread
From: Anand Moon @ 2026-11-27 10:30 UTC (permalink / raw)
To: u-boot
Cc: Anand Moon, Junhui Liu, Dave Klotz, Eric Chung, Hung-Chun Tseng,
E Shattow, Yixun Lan, Tim Ouyang, Leo Liang, Yao Zi, Tom Rini
When SPL multi-DTB FIT support is enabled, the build appends the
FIT image to the SPL binary instead of generating a standalone
u-boot-spl.dtb file.
The expanded Binman SPL entry expects this standalone DTB, causing
image generation to fail.
Add the no-expanded property to use the combined SPL binary directly,
allowing both single-DTB and multi-DTB SPL images to be packaged
while preserving the existing DDR firmware alignment.
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/spacemit-k1-binman.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/dts/spacemit-k1-binman.dtsi b/arch/riscv/dts/spacemit-k1-binman.dtsi
index 2ff6bd2cc43..9e75c0f5f08 100644
--- a/arch/riscv/dts/spacemit-k1-binman.dtsi
+++ b/arch/riscv/dts/spacemit-k1-binman.dtsi
@@ -12,6 +12,7 @@
pad-byte = <0xff>;
u-boot-spl {
+ no-expanded;
};
ddr-fw {
--
2.56.1
^ permalink raw reply related [flat|nested] 21+ messages in thread