reset: spacemit: Add support for SpacemiT K3 SoC
Subsystems (5)
v3 cover reset: spacemit: Add support for SpacemiT K3 SoC
This series adds support for the reset controller found on the SpacemiT K3 SoC.
The clock driver changes, which defined new auxiliary device name patterns for reset on K1 and K3, have been applied to the clock tree. To facilitate merging, Yixun Lan has created an immutable tag (spacemit-clkrst-v6.20-3) within his pull request to the clock subsystem [1]. Hence, the dependencies mentioned in v2 have now been deblocked, making the reset driver ready to be applied, if it gets approval from review.
In this version (v3), the entire series has been rebased and tested on top of the linux-next tag: next-20260119.
General informaiton about the series:
The K3 reset controller shares the same architecture as the K1. To facilitate support for both and future SoCs, the existing K1 reset driver is refactored with the following changes:
1. The existing K1 driver is moved to a dedicated 'drivers/reset/spacemit/' directory.
2. Common reset operations are extracted into reset-spacemit-common.{c,h}
The K3 driver is implemented using this common infrastructure.
Changes in v3:
- Updated dependency status and base information.
- Patch 1:
Add Acked-by from Krzysztof and Alex.
- Patch 2:
Removed trailing blank line from Makefile.
- Patch 1/2/3/4:
Add Acked-by / Reviewed-by from Alex Elder.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Patch 1:
Update the commit message to explain the why.
Update the spacemit,k1-syscon.yaml to point to k3 reset IDs
header file.
- Patch 3:
Use dev->driver->owner for the reset controller owner instead of THIS_MODULE to fix the module reference counting issue pointed out by Krzysztof Kozlowski.
- Patch 3 and 4:
Update the K1_AUX_DEV_ID and K3_AUX_DEV_ID macros to a simpler but direct form, one benefit is to improve the code readability. More discussion can be found in Link [4].
Link to v1: https://lore.kernel.org/r/[email protected]
---
Guodong Xu (4):
dt-bindings: soc: spacemit: Add K3 reset support and IDs
reset: Create subdirectory for SpacemiT drivers
reset: spacemit: Extract common K1 reset code
reset: spacemit: Add SpacemiT K3 reset driver
.../bindings/soc/spacemit/spacemit,k1-syscon.yaml | 8 +- drivers/reset/Kconfig | 12 +- drivers/reset/Makefile | 2 +- drivers/reset/spacemit/Kconfig | 36 ++++ drivers/reset/spacemit/Makefile | 5 + drivers/reset/spacemit/reset-spacemit-common.c | 77 +++++++ drivers/reset/spacemit/reset-spacemit-common.h | 42 ++++ .../reset-spacemit-k1.c} | 107 +--------- drivers/reset/spacemit/reset-spacemit-k3.c | 233 +++++++++++++++++++++ include/dt-bindings/reset/spacemit,k3-resets.h | 171 +++++++++++++++ 10 files changed, 583 insertions(+), 110 deletions(-)
---
base-commit: 6ada99659c6d6a0cde83e6c0f4ed0ef0ba1867e1
change-id: 20251229-k3-reset-8d9b751ef391
Best regards,
Signature · 1 line
Guodong Xu <[email protected]>
PATCH v3 1/4 dt-bindings: soc: spacemit: Add K3 reset support and IDs
Update the spacemit,k1-syscon.yaml binding to document K3 SoC reset support.
K3 reset devices are registered at runtime as auxiliary devices by the K3 CCU driver. Since K3 reuses the K1 syscon binding, there is no separate YAML binding file for K3 resets.
Update #reset-cells description to document where reset IDs are defined.
---
v3: Add Acked-by from Krzysztof and Alex.
v2: Update spacemit,k1-syscon binding to clarify K3 reset is supported.
Update the commit message to add backgrounds of this patch why,
instead of what.
--- .../bindings/soc/spacemit/spacemit,k1-syscon.yaml | 8 +- include/dt-bindings/reset/spacemit,k3-resets.h | 171 +++++++++++++++++++++ 2 files changed, 178 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/soc/spacemit/spacemit,k1-syscon.yaml +7 -1
@@ -10,7 +10,7 @@ maintainers: - Haylen Chu <[email protected]> description: - System controllers found on SpacemiT K1 SoC, which are capable of + System controllers found on SpacemiT K1/K3 SoC, which are capable of clock, reset and power-management functions. properties:
@@ -50,6 +50,12 @@ properties: "#reset-cells": const: 1 + description: | + ID of the reset controller line. Valid IDs are defined in corresponding + files: + + For SpacemiT K1, see include/dt-bindings/clock/spacemit,k1-syscon.h + For SpacemiT K3, see include/dt-bindings/reset/spacemit,k3-resets.h required: - compatible
include/dt-bindings/reset/spacemit,k3-resets.h new file +171 -0
171 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v3 2/4 reset: Create subdirectory for SpacemiT drivers
In reply to Guodong XuCreate a dedicated subdirectory for SpacemiT reset drivers to allow for better organization as support for more SoCs is added.
Move the existing K1 reset driver into this new directory and rename it to reset-spacemit-k1.c.
Rename the Kconfig symbol to RESET_SPACEMIT_K1 and update its default from ARCH_SPACEMIT to SPACEMIT_K1_CCU. The reset driver depends on the clock driver to register reset devices as an auxiliary device, so the default should reflect this dependency.
Also sort the drivers/reset/Kconfig entries alphabetically.
---
v3: Add Alex's reviewed-by.
Remove the trailing empty newline in Makefile to keep constant style
with others in the reset folder.
v2: No change.
---
drivers/reset/Kconfig | 12 ++----------
drivers/reset/Makefile | 2 +-
drivers/reset/spacemit/Kconfig | 14 ++++++++++++++
drivers/reset/spacemit/Makefile | 2 ++
.../{reset-spacemit.c => spacemit/reset-spacemit-k1.c} | 0
5 files changed, 19 insertions(+), 11 deletions(-)drivers/reset/Kconfig +2 -10
@@ -299,15 +299,6 @@ config RESET_SOCFPGA This enables the reset driver for the SoCFPGA ARMv7 platforms. This driver gets initialized early during platform init calls. -config RESET_SPACEMIT - tristate "SpacemiT reset driver" - depends on ARCH_SPACEMIT || COMPILE_TEST - select AUXILIARY_BUS - default ARCH_SPACEMIT - help - This enables the reset controller driver for SpacemiT SoCs, - including the K1. - config RESET_SUNPLUS bool "Sunplus SoCs Reset Driver" if COMPILE_TEST default ARCH_SUNPLUS
@@ -406,9 +397,10 @@ config RESET_ZYNQMP This enables the reset controller driver for Xilinx ZynqMP SoCs. source "drivers/reset/amlogic/Kconfig" +source "drivers/reset/hisilicon/Kconfig" +source "drivers/reset/spacemit/Kconfig" source "drivers/reset/starfive/Kconfig" source "drivers/reset/sti/Kconfig" -source "drivers/reset/hisilicon/Kconfig" source "drivers/reset/tegra/Kconfig" endif
drivers/reset/Makefile +1 -1
@@ -2,6 +2,7 @@ obj-y += core.o obj-y += amlogic/ obj-y += hisilicon/ +obj-y += spacemit/ obj-y += starfive/ obj-y += sti/ obj-y += tegra/
@@ -38,7 +39,6 @@ obj-$(CONFIG_RESET_RZV2H_USB2PHY) += reset-rzv2h-usb2phy.o obj-$(CONFIG_RESET_SCMI) += reset-scmi.o obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o -obj-$(CONFIG_RESET_SPACEMIT) += reset-spacemit.o obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o obj-$(CONFIG_RESET_TH1520) += reset-th1520.o
drivers/reset/spacemit/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config RESET_SPACEMIT_K1 + tristate "SpacemiT K1 reset driver" + depends on ARCH_SPACEMIT || COMPILE_TEST + depends on SPACEMIT_K1_CCU + select AUXILIARY_BUS + default SPACEMIT_K1_CCU + help + Support for reset controller in SpacemiT K1 SoC. + This driver works with the SpacemiT K1 clock controller + unit (CCU) driver to provide reset control functionality + for various peripherals and subsystems in the SoC. +
drivers/reset/spacemit/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_RESET_SPACEMIT_K1) += reset-spacemit-k1.o
drivers/reset/spacemit/reset-spacemit-k1.c renamed from drivers/reset/reset-spacemit.c +0 -0
Signature · 1 line
2.43.0
PATCH v3 3/4 reset: spacemit: Extract common K1 reset code
In reply to Guodong XuExtract the common reset controller code from the K1 driver into separate reset-spacemit-common.{c,h} files to prepare for additional SpacemiT SoCs that share the same reset controller architecture.
The common code includes handlers for reset assert and deassert operations and probing for auxiliary bus devices.
Changes during extraction:
- Module ownership: Use dev->driver->owner instead of THIS_MODULE in spacemit_reset_controller_register() to correctly reference the calling driver's module.
- Rename spacemit_reset_ids to spacemit_k1_reset_ids.
- Define new namespace "RESET_SPACEMIT" for the exported common functions (spacemit_reset_probe) and update K1 driver to import it.
This prepares for additional SpacemiT SoCs (K3) that share the same reset controller architecture.
---
v3: Add reviewed-by from Alex.
v2: Use dev->driver->owner for the reset controller owner instead of
THIS_MODULE to fix the module reference counting issue pointed out by Krzysztof Kozlowski.
--- drivers/reset/spacemit/Kconfig | 17 +++- drivers/reset/spacemit/Makefile | 2 + drivers/reset/spacemit/reset-spacemit-common.c | 77 ++++++++++++++++++ drivers/reset/spacemit/reset-spacemit-common.h | 42 ++++++++++ drivers/reset/spacemit/reset-spacemit-k1.c | 107 +++---------------------- 5 files changed, 144 insertions(+), 101 deletions(-)
drivers/reset/spacemit/Kconfig +14 -3
@@ -1,10 +1,20 @@ # SPDX-License-Identifier: GPL-2.0-only -config RESET_SPACEMIT_K1 - tristate "SpacemiT K1 reset driver" +menu "Reset support for SpacemiT platforms" depends on ARCH_SPACEMIT || COMPILE_TEST - depends on SPACEMIT_K1_CCU + +config RESET_SPACEMIT_COMMON + tristate select AUXILIARY_BUS + help + Common reset controller infrastructure for SpacemiT SoCs. + This provides shared code and helper functions used by + reset drivers for various SpacemiT SoC families. + +config RESET_SPACEMIT_K1 + tristate "Support for SpacemiT K1 SoC" + depends on SPACEMIT_K1_CCU + select RESET_SPACEMIT_COMMON default SPACEMIT_K1_CCU help Support for reset controller in SpacemiT K1 SoC.
@@ -12,3 +22,4 @@ config RESET_SPACEMIT_K1 unit (CCU) driver to provide reset control functionality for various peripherals and subsystems in the SoC. +endmenu
drivers/reset/spacemit/Makefile +2 -0
@@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_RESET_SPACEMIT_COMMON) += reset-spacemit-common.o + obj-$(CONFIG_RESET_SPACEMIT_K1) += reset-spacemit-k1.o
drivers/reset/spacemit/reset-spacemit-common.c new file +77 -0
77 lines not on this page · raw message
drivers/reset/spacemit/reset-spacemit-common.h new file +42 -0
42 lines not on this page · raw message
drivers/reset/spacemit/reset-spacemit-k1.c +9 -98
141 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v3 4/4 reset: spacemit: Add SpacemiT K3 reset driver
In reply to Guodong XuAdd support for the SpacemiT K3 SoC reset controller. The K3 reset driver reuses the common reset controller code and provides K3-specific reset data for devices managed by the following units:
- MPMU (Main Power Management Unit)
- APBC (APB clock unit)
- APMU (Application Subsystem Power Management Unit)
- DCIU (DMA Control and Interface Unit)
---
v3: Add acked-by from Alex.
v2: No change.
--- drivers/reset/spacemit/Kconfig | 11 ++ drivers/reset/spacemit/Makefile | 1 + drivers/reset/spacemit/reset-spacemit-k3.c | 233 +++++++++++++++++++++++++++++ 3 files changed, 245 insertions(+)
drivers/reset/spacemit/Kconfig +11 -0
@@ -22,4 +22,15 @@ config RESET_SPACEMIT_K1 unit (CCU) driver to provide reset control functionality for various peripherals and subsystems in the SoC. +config RESET_SPACEMIT_K3 + tristate "Support for SpacemiT K3 SoC" + depends on SPACEMIT_K3_CCU + select RESET_SPACEMIT_COMMON + default SPACEMIT_K3_CCU + help + Support for reset controller in SpacemiT K3 SoC. + This driver works with the SpacemiT K3 clock controller + unit (CCU) driver to provide reset control functionality + for various peripherals and subsystems in the SoC. + endmenu
drivers/reset/spacemit/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_RESET_SPACEMIT_COMMON) += reset-spacemit-common.o obj-$(CONFIG_RESET_SPACEMIT_K1) += reset-spacemit-k1.o +obj-$(CONFIG_RESET_SPACEMIT_K3) += reset-spacemit-k3.o
drivers/reset/spacemit/reset-spacemit-k3.c new file +233 -0
233 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 9 lines · Guodong Xu
This series adds support for the reset controller found on the SpacemiT K3 SoC.
The clock driver changes, which defined new auxiliary device name patterns for reset on K1 and K3, have been applied to the clock tree. To facilitate merging, Yixun Lan has created an immutable tag (spacemit-clkrst-v6.20-3) within his pull request to the clock subsystem [1]. Hence, the dependencies mentioned in v2 have now
Apologies, I noticed the link [1] referenced was incorrect. Fixed below.
Quoted 12 lines
been deblocked, making the reset driver ready to be applied, if it gets approval from review.
In this version (v3), the entire series has been rebased and tested on top of the linux-next tag: next-20260119.
General informaiton about the series:
The K3 reset controller shares the same architecture as the K1. To facilitate support for both and future SoCs, the existing K1 reset driver is refactored with the following changes:
Quoted 7 lines
1. The existing K1 driver is moved to a dedicated '
drivers/reset/spacemit/' directory.
2. Common reset operations are extracted into reset-spacemit-common.{c,h}The K3 driver is implemented using this common infrastructure.
Please use this link for the immutable tag reference instead:
The code remains unchanged.
Best regards,
Guodong Xu
Quoted 54 lines
Changes in v3:
- Updated dependency status and base information.
- Patch 1:
Add Acked-by from Krzysztof and Alex.
- Patch 2:
Removed trailing blank line fromMakefile.
- Patch 1/2/3/4:
Add Acked-by / Reviewed-by from Alex Elder.- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Patch 1:
Update the commit message to explain the why.
Update the spacemit,k1-syscon.yaml to point to k3 reset IDs
header file.
- Patch 3:
Usedev->driver->ownerfor the reset controller owner instead ofTHIS_MODULEto fix the module reference counting issue pointed out by Krzysztof Kozlowski.
- Patch 3 and 4:
Update theK1_AUX_DEV_IDandK3_AUX_DEV_IDmacros to a simpler but direct form, one benefit is to improve the code readability. More discussion can be found in Link [4].
Link to v1: https://lore.kernel.org/r/[email protected]Signed-off-by Guodong Xu <[email protected]>---
Guodong Xu (4):
dt-bindings: soc: spacemit: Add K3 reset support and IDs
reset: Create subdirectory for SpacemiT drivers
reset: spacemit: Extract common K1 reset code
reset: spacemit: Add SpacemiT K3 reset driver.../bindings/soc/spacemit/spacemit,k1-syscon.yaml | 8 +- drivers/reset/Kconfig | 12 +- drivers/reset/Makefile | 2 +- drivers/reset/spacemit/Kconfig | 36 ++++ drivers/reset/spacemit/Makefile | 5 + drivers/reset/spacemit/reset-spacemit-common.c | 77 +++++++ drivers/reset/spacemit/reset-spacemit-common.h | 42 ++++ .../reset-spacemit-k1.c} | 107 +--------- drivers/reset/spacemit/reset-spacemit-k3.c | 233 +++++++++++++++++++++ include/dt-bindings/reset/spacemit,k3-resets.h | 171 +++++++++++++++ 10 files changed, 583 insertions(+), 110 deletions(-)---
base-commit:6ada99659c6d6a0cde83e6c0f4ed0ef0ba1867e1
change-id: 20251229-k3-reset-8d9b751ef391Best regards,
--
Guodong Xu <[email protected]>
Hi Philipp Zabel,
Quoted 20 lines · Guodong Xu
This series adds support for the reset controller found on the SpacemiT K3 SoC.
The clock driver changes, which defined new auxiliary device name patterns for reset on K1 and K3, have been applied to the clock tree. To facilitate merging, Yixun Lan has created an immutable tag (spacemit-clkrst-v6.20-3) within his pull request to the clock subsystem [1]. Hence, the dependencies mentioned in v2 have now been deblocked, making the reset driver ready to be applied, if it gets approval from review.
In this version (v3), the entire series has been rebased and tested on top of the linux-next tag: next-20260119.
General informaiton about the series:
The K3 reset controller shares the same architecture as the K1. To facilitate support for both and future SoCs, the existing K1 reset driver is refactored with the following changes:
Quoted 8 lines
1. The existing K1 driver is moved to a dedicated '
drivers/reset/spacemit/' directory.
2. Common reset operations are extracted into reset-spacemit-common.{c,h}The K3 driver is implemented using this common infrastructure.
Just want to ping this with my SpacemiT maintainer position, the reset driver is the last piece that I hope can be accepted during this merge window (target the v6.20 release), it would help other drivers since it is a fundamental dependency..
The clock PR which is a dependency for reset has been pulled by Stephen[2], and the driver also has been tested for a while locally
https://lore.kernel.org/r/176902257445.4027.5972559722832621691@lazor [2]
Signature · 1 line
Yixun Lan (dlan)