[PATCH v2 0/8] riscv: spacemit: k1: add clock and reset drivers, switch to upstream DT
Guodong Xu
guodong at riscstar.com
Wed May 27 04:45:40 CEST 2026
Currently U-Boot's SpacemiT K1 ships its own arch/riscv/dts/k1.dtsi and a
spacemit,k1-reset binding that has no node in the upstream
(kernel-mainline) K1 dts. After list discussion [1], this series
moves U-Boot to the upstream DT before further K1 work lands.
In the upstream DT, each K1 syscon provides both clocks and resets.
The kernel's clock driver spawns the reset child via the auxiliary
bus. This patchset does the same in U-Boot: each clock driver
spawns a UCLASS_RESET sibling on the same ofnode.
The four K1 clock controllers (PLL, MPMU, APMU, APBC) live in separate
syscon nodes, with clock parent dependency chain between them as below:
MPMU <- PLL
APMU <- PLL, MPMU
APBC <- PLL, MPMU, APMU
The following is cover letter from v1:
Patch 1/8 adds the K1 clock driver.
Patch 2/8 adds a new syscon-bound reset driver with no DT of_match. At this
point, the legacy reset driver and local dts are still there.
Patch 3/8 has each per-syscon clock driver spawn the reset child on the
same ofnode, the way the kernel uses auxiliary devices.
Patch 4/8 enables the clock driver.
Patch 5/8 switches BPI-F3 to dts/upstream/.
Patch 6/8, 7/8 and 8/8 clean up the legacy reset driver and local dts files.
Old and new reset drivers coexist from 2/8 through 6/8 so the series
is bisectable.
The K1 SPL bring-up [2] and PIN/SPI [3] series will be rebased on
this and resent once it lands.
Link: https://lore.kernel.org/u-boot/20260507140558.GU1614990@bill-the-cat/ # [1]
Link: https://lore.kernel.org/u-boot/20260325223232.1553212-1-raymondmaoca@gmail.com/ # [2]
Link: https://lore.kernel.org/u-boot/20260422143112.1329478-1-raymondmaoca@gmail.com/ # [3]
Changes in v2:
- 1/8 (clk: spacemit: Add support for K1 SoC):
- Force parent controllers to probe by driver (uclass_get_device_by_driver
+ DM_DRIVER_GET) instead of clk_get_by_index() with magic indices 4/5/6;
(Yao Zi)
- Drop the dead k1_clk_retry_register() loop; retry_list was never
populated (Yao Zi)
- Kconfig: depends on CLK || COMPILE_TEST to allow build-test coverage
(Yao Zi)
- Kconfig: select LIB_RATIONAL from CLK_SPACEMIT, not CLK_SPACEMIT_K1,
(Yao Zi)
- Reword the commit body with the explicit controller dependency graph
above (Yao Zi)
- 5/8 (dts: k1: switch BPI-F3 build to upstream DT):
- As a benefit from changes in patch 1/8, drop the helper clocks/clock-names
from &syscon_mpmu and &syscon_apbc. uboot overlay dtsi simplified;
Link to v1: https://patch.msgid.link/20260510-b4-k1-clk-reset-upstream-dts-v1-0-db0b0503ee44@riscstar.com
BR,
Guodong Xu / docularxu
Signed-off-by: Guodong Xu <guodong at riscstar.com>
---
---
Guodong Xu (7):
reset: spacemit: k1: introduce syscon-bound reset driver
clk: spacemit: k1: spawn reset device from per-syscon clock drivers
configs: bananapi-f3: enable Spacemit K1 clock driver
dts: k1: switch BPI-F3 build to upstream DT
dts: k1: drop legacy local DT files
reset: spacemit: k1: drop legacy spacemit,k1-reset driver
dt-bindings: reset: drop spacemit-k1-reset.h
Junhui Liu (1):
clk: spacemit: Add support for K1 SoC
arch/riscv/dts/Makefile | 1 -
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi | 13 +
arch/riscv/dts/k1-bananapi-f3.dts | 28 -
arch/riscv/dts/k1-pinctrl.dtsi | 19 -
arch/riscv/dts/k1.dtsi | 480 -------
configs/bananapi-f3_defconfig | 6 +-
drivers/clk/Kconfig | 5 +-
drivers/clk/Makefile | 1 +
drivers/clk/spacemit/Kconfig | 23 +
drivers/clk/spacemit/Makefile | 7 +
drivers/clk/spacemit/clk-k1.c | 1750 +++++++++++++++++++++++++
drivers/clk/spacemit/clk_common.h | 79 ++
drivers/clk/spacemit/clk_ddn.c | 93 ++
drivers/clk/spacemit/clk_ddn.h | 53 +
drivers/clk/spacemit/clk_mix.c | 403 ++++++
drivers/clk/spacemit/clk_mix.h | 224 ++++
drivers/clk/spacemit/clk_pll.c | 157 +++
drivers/clk/spacemit/clk_pll.h | 81 ++
drivers/reset/Kconfig | 7 -
drivers/reset/Makefile | 2 +-
drivers/reset/reset-spacemit-k1.c | 548 --------
drivers/reset/spacemit/Makefile | 5 +
drivers/reset/spacemit/reset-spacemit-k1.c | 289 ++++
include/dt-bindings/reset/spacemit-k1-reset.h | 118 --
include/soc/spacemit/k1-reset.h | 23 +
include/soc/spacemit/k1-syscon.h | 149 +++
26 files changed, 3358 insertions(+), 1206 deletions(-)
---
base-commit: 215496fec59b3fa09256b4fb62f92af46e2ec7f9
change-id: 20260510-b4-k1-clk-reset-upstream-dts-cbf1f3a79cfb
Best regards,
--
Guodong Xu <guodong at riscstar.com>
More information about the U-Boot
mailing list