riscv: spacemit: Add GPIO and pinctrl support in SPL
Subsystems (4)
v2 cover riscv: spacemit: Add GPIO and pinctrl support in SPL
This series consolidates common U-Boot device tree properties for SpacemiT K1 boards and enables GPIO and pinctrl support in SPL.
The device tree changes move common early boot properties into shared DTSI files, reducing duplication between the Banana Pi BPI-F3 and MusePi Pro boards.
The remaining patches add SPL build support for the SpacemiT K1/K3 GPIO and pinctrl drivers and enable these drivers in the K1 SPL configuration.
The series consists of six patches:
1. Move common K1 U-Boot nodes into a shared DTSI.
2. Remove redundant MusePi Pro device tree overrides.
3. Move common K1 U-Boot properties into the shared DTSI.
4. Add SPL support for the K1/K3 pinctrl driver.
5. Add SPL support for the K1/K3 GPIO driver.
6. Enable GPIO and pinctrl support in K1 SPL.
Changes in v2:
- Consolidate additional common U-Boot properties into spacemit-k1-u-boot.dtsi.
- Reduce duplication in the board-specific DTSI files.
- Retain board-specific configuration where required.
v1: https://patchwork.ozlabs.org/project/uboot/list/?series=530594
Thanks
-Anand
Anand Moon (6):
riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI
riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides
riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI
pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver
gpio: spacemit: Add SPL support for K1/K3 GPIO driver
riscv: spacemit: k1: Enable GPIO and pinctrl support in SPL
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi | 86 ---------------- arch/riscv/dts/k1-musepi-pro-u-boot.dtsi | 113 ---------------------- arch/riscv/dts/spacemit-k1-binman.dtsi | 29 ++++++ arch/riscv/dts/spacemit-k1-u-boot.dtsi | 89 +++++++++++++++++ configs/spacemit_k1_defconfig | 6 ++ drivers/gpio/Kconfig | 7 ++ drivers/pinctrl/spacemit/Kconfig | 8 ++ 7 files changed, 139 insertions(+), 199 deletions(-) create mode 100644 arch/riscv/dts/spacemit-k1-binman.dtsi create mode 100644 arch/riscv/dts/spacemit-k1-u-boot.dtsi
base-commit: eb7af371cb8c9964d0551f3b94c7f138debb0cb7
Signature · 1 line
2.56.1
PATCH v2 1/6 riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI
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.
--- 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
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi +0 -32
@@ -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>; - }; - }; -};
arch/riscv/dts/k1-musepi-pro-u-boot.dtsi +0 -29
@@ -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>; - }; - }; -};
arch/riscv/dts/spacemit-k1-binman.dtsi new file +29 -0
@@ -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>; + }; + }; +};
arch/riscv/dts/spacemit-k1-u-boot.dtsi new file +13 -0
@@ -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"
configs/spacemit_k1_defconfig +1 -0
@@ -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
Signature · 1 line
2.56.1
PATCH v2 2/6 riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides
In reply to Anand MoonThe 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.
--- arch/riscv/dts/k1-musepi-pro-u-boot.dtsi | 5 ----- 1 file changed, 5 deletions(-)
arch/riscv/dts/k1-musepi-pro-u-boot.dtsi +0 -5
@@ -8,11 +8,6 @@ / { aliases { console = &uart0; - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n8"; }; };
Signature · 1 line
2.56.1
PATCH v2 3/6 riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI
In reply to Anand MoonMove 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.
--- 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(-)
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi +0 -54
@@ -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>; -};
arch/riscv/dts/k1-musepi-pro-u-boot.dtsi +0 -79
88 lines not on this page · raw message
arch/riscv/dts/spacemit-k1-u-boot.dtsi +76 -0
87 lines not on this page · raw message
Signature · 1 line
2.56.1
PATCH v2 4/6 pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver
In reply to Anand MoonAdd a Kconfig option to enable the SpacemiT K1/K3 pinctrl driver in SPL, allowing pin multiplexing and pin configuration during early board initialization.
Depend on SPL_PINCTRL instead of SPL_DM_GPIO, as pinctrl support does not require the GPIO subsystem.
--- drivers/pinctrl/spacemit/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pinctrl/spacemit/Kconfig +8 -0
@@ -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.
Signature · 1 line
2.56.1
PATCH v2 5/6 gpio: spacemit: Add SPL support for K1/K3 GPIO driver
In reply to Anand MoonAllow SPL to access GPIOs on SpacemiT K1 and K3 platforms during early board initialization, including GPIO-based card detection for SD controllers.
--- drivers/gpio/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpio/Kconfig +7 -0
@@ -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"
Signature · 1 line
2.56.1
PATCH v2 6/6 riscv: spacemit: k1: Enable GPIO and pinctrl support in SPL
In reply to Anand MoonEnable GPIO and pinctrl support in SPL for the SpacemiT K1 SoC.
Select the SPL driver model GPIO framework and the SpacemiT GPIO driver, along with the pinctrl framework and K1 pinctrl driver.
These drivers allow SPL to configure pin multiplexing and access GPIOs required by early boot peripherals, including I2C, MMC and other board-specific devices.
--- configs/spacemit_k1_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/spacemit_k1_defconfig +5 -0
@@ -121,3 +121,8 @@ 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
Signature · 1 line
2.56.1