Skip to contentSkip to conversation

allwinner: a523: Add power controllers

PATCH In review Chen-Yu Tsai 3 participants 8 messages Jul 12, 2025 – Jul 15, 2025

Subsystems (3)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

v3 cover allwinner: a523: Add power controllers

From: Chen-Yu Tsai <[email protected]>

Hi folks,

This is v3 of my A523 power controllers series.

Changes since v2:
- pck600 driver:
- Fixed whitespace issue
- Added explanation about possible PCK-600 lineage and document references to driver
- Changed Kconfig option to tristate
- Rewrote Kconfig option help text to make it clear that the driver is required for certain peripherals to work
- Made it depend on ARCH_SUNXI or COMPILE_TEST
- Made it enabled by default for ARCH_SUNXI
- Renamed PPU_PWSR_PWR_STATUS to PPU_PWR_STATUS, and added a comment to note the macro is shared between two registers
- New patch changing sun20i-ppu driver to tristate, and enable by default for ARCH_SUNXI
- Fixed pck-600 header path in dtsi file
- Link to v2:
https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Re-order compatible string entries
- Fix name of header file to match compatible string
- Link to v1:
https://lore.kernel.org/all/[email protected]/

This series adds the power controllers found in the Allwinner A523 family of SoCs. There are two power controllers. One is the same type as those found in the D1 SoC, just with a different number of valid power domains. The second is (I assume) a unit based on ARM's PCK-600 power controller. Some of the registers and values match up, but there are extra registers for delay controls in the PCK-600's reserved register range.

Patch 1 adds new compatible string entries for both of these controllers.

Patch 2 adds support for the A523 PPU to the existing D1 PPU driver.

Patch 3 adds a new driver of the PCK-600 unit in the A523 SoC.

Patch 4 aligns Kconfig dependencies and default for SUN20I_PPU with the new PCK-600 driver.

Patch 5 adds device nodes for both of these controllers.

Please have a look. The power controllers are critical for enabling more peripherals, such as display output, camera input, video codecs, the NPU, and a second DWMAC-compatible ethernet interface.

Thanks
ChenYu

Chen-Yu Tsai (5):
dt-bindings: power: Add A523 PPU and PCK600 power controllers
pmdomain: sunxi: sun20i-ppu: add A523 support
pmdomain: sunxi: add driver for Allwinner A523's PCK-600 power
controller
pmdomain: sunxi: sun20i-ppu: change to tristate and enable for
ARCH_SUNXI
arm64: dts: allwinner: a523: Add power controller device nodes

 .../power/allwinner,sun20i-d1-ppu.yaml        |   4 +-
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi |  18 ++
 drivers/pmdomain/sunxi/Kconfig                |  19 +-
 drivers/pmdomain/sunxi/Makefile               |   1 +
 drivers/pmdomain/sunxi/sun20i-ppu.c           |  17 ++
 drivers/pmdomain/sunxi/sun55i-pck600.c        | 234 ++++++++++++++++++
 .../power/allwinner,sun55i-a523-pck-600.h     |  15 ++
 .../power/allwinner,sun55i-a523-ppu.h         |  12 +
 8 files changed, 316 insertions(+), 4 deletions(-)
 create mode 100644 drivers/pmdomain/sunxi/sun55i-pck600.c
 create mode 100644 include/dt-bindings/power/allwinner,sun55i-a523-pck-600.h
 create mode 100644 include/dt-bindings/power/allwinner,sun55i-a523-ppu.h
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH v3 2/5 pmdomain: sunxi: sun20i-ppu: add A523 support

From: Chen-Yu Tsai <[email protected]>

A523 has a PPU like the one in the Allwinner D1 SoC.

Add a compatible entry and a list of power domain names for it.

---
 drivers/pmdomain/sunxi/sun20i-ppu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/pmdomain/sunxi/sun20i-ppu.c +17 -0
index 9f002748d224..b65876a68cc1 100644
@@ -193,6 +193,19 @@ static const struct sun20i_ppu_desc sun8i_v853_ppu_desc = {
 	.num_domains	= ARRAY_SIZE(sun8i_v853_ppu_pd_names),
 };
 
+static const char *const sun55i_a523_ppu_pd_names[] = {
+	"DSP",
+	"NPU",
+	"AUDIO",
+	"SRAM",
+	"RISCV",
+};
+
+static const struct sun20i_ppu_desc sun55i_a523_ppu_desc = {
+	.names		= sun55i_a523_ppu_pd_names,
+	.num_domains	= ARRAY_SIZE(sun55i_a523_ppu_pd_names),
+};
+
 static const struct of_device_id sun20i_ppu_of_match[] = {
 	{
 		.compatible	= "allwinner,sun20i-d1-ppu",
@@ -202,6 +215,10 @@ static const struct of_device_id sun20i_ppu_of_match[] = {
 		.compatible	= "allwinner,sun8i-v853-ppu",
 		.data		= &sun8i_v853_ppu_desc,
 	},
+	{
+		.compatible	= "allwinner,sun55i-a523-ppu",
+		.data		= &sun55i_a523_ppu_desc,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun20i_ppu_of_match);
Signature · 1 line
2.39.5
author maintainer
#3 lore raw

PATCH v3 3/5 pmdomain: sunxi: add driver for Allwinner A523's PCK-600 power controller

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Allwinner A523 family has a second power controller, named PCK-600 in the datasheets and BSP. It is likely based on ARM's PCK-600 hardware block, with some additional delay controls. The only documentation for this hardware is the BSP driver. The standard registers defined in ARM's Power Policy Unit Architecture Specification line up. Some extra delay controls are found in the reserved range of registers.

Add a driver for this power controller. Delay control register values and power domain names are from the BSP driver.

---
Changes since v2:
- Fixed whitespace issue
- Added explanation about possible PCK-600 lineage and document references to driver
- Changed Kconfig option to tristate
- Rewrote Kconfig option help text to make it clear that the driver is required for certain peripherals to work
- Made it depend on ARCH_SUNXI or COMPILE_TEST
- Made it enabled by default for ARCH_SUNXI
- Renamed PPU_PWSR_PWR_STATUS to PPU_PWR_STATUS, and added a comment to note the macro is shared between two registers

---
 drivers/pmdomain/sunxi/Kconfig         |  11 ++
 drivers/pmdomain/sunxi/Makefile        |   1 +
 drivers/pmdomain/sunxi/sun55i-pck600.c | 234 +++++++++++++++++++++++++
 3 files changed, 246 insertions(+)
 create mode 100644 drivers/pmdomain/sunxi/sun55i-pck600.c
drivers/pmdomain/sunxi/Kconfig +11 -0
index 43eecb3ea981..eb1ce2dd8e53 100644
@@ -18,3 +18,14 @@ config SUN50I_H6_PRCM_PPU
 	  Say y to enable the Allwinner H6/H616 PRCM power domain driver.
 	  This is required to enable the Mali GPU in the H616 SoC, it is
 	  optional for the H6.
+
+config SUN55I_PCK600
+	tristate "Allwinner A523 PCK-600 power domain driver"
+	depends on ARCH_SUNXI || COMPILE_TEST
+	depends on PM
+	default ARCH_SUNXI
+	select PM_GENERIC_DOMAINS
+	help
+	  Say y to enable the PCK-600 power domain driver. This is required
+	  to enable power to certain peripherals, such as the display and
+	  video engines.
drivers/pmdomain/sunxi/Makefile +1 -0
index c1343e123759..e344b232fc9f 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SUN20I_PPU)		+= sun20i-ppu.o
 obj-$(CONFIG_SUN50I_H6_PRCM_PPU)	+= sun50i-h6-prcm-ppu.o
+obj-$(CONFIG_SUN55I_PCK600)		+= sun55i-pck600.o
drivers/pmdomain/sunxi/sun55i-pck600.c new file +234 -0

234 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#4 lore raw

PATCH v3 4/5 pmdomain: sunxi: sun20i-ppu: change to tristate and enable for ARCH_SUNXI

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

There is no reason why the sun20i-ppu cannot be built as a module. So change it to tristate.

Also enable it by default for ARCH_SUNXI since this driver is required for some peripherals to work, and update the help text to reflect this requirement.

This aligns it with the new PCK-600 driver.

---
Changes since v2:
- New patch

---
 drivers/pmdomain/sunxi/Kconfig | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pmdomain/sunxi/Kconfig +5 -3
index eb1ce2dd8e53..858446594c88 100644
@@ -1,13 +1,15 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 config SUN20I_PPU
-	bool "Allwinner D1 PPU power domain driver"
+	tristate "Allwinner D1 PPU power domain driver"
 	depends on ARCH_SUNXI || COMPILE_TEST
 	depends on PM
+	default ARCH_SUNXI
 	select PM_GENERIC_DOMAINS
 	help
-	  Say y to enable the PPU power domain driver. This saves power
-	  when certain peripherals, such as the video engine, are idle.
+	  Say y to enable the PPU power domain driver. This is required
+	  to enable power to certain peripherals, such as the display
+	  engine.
 
 config SUN50I_H6_PRCM_PPU
 	tristate "Allwinner H6 PRCM power domain driver"
Signature · 1 line
2.39.5
author maintainer
#5 lore raw

PATCH v3 5/5 arm64: dts: allwinner: a523: Add power controller device nodes

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The A523 SoC family has two power controllers, one based on the existing PPU, and one newer one based on ARM's PCK-600.

Add device nodes for both of them.

---
Changes since v2:
- Fixed pck-600 header path

---
 arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +18 -0
index cf0bc39aab04..2ac6580b2497 100644
@@ -7,6 +7,8 @@
 #include <dt-bindings/clock/sun55i-a523-r-ccu.h>
 #include <dt-bindings/reset/sun55i-a523-ccu.h>
 #include <dt-bindings/reset/sun55i-a523-r-ccu.h>
+#include <dt-bindings/power/allwinner,sun55i-a523-ppu.h>
+#include <dt-bindings/power/allwinner,sun55i-a523-pck-600.h>
 
 / {
 	interrupt-parent = <&gic>;
@@ -576,6 +578,14 @@ mdio0: mdio {
 			};
 		};
 
+		ppu: power-controller@7001400 {
+			compatible = "allwinner,sun55i-a523-ppu";
+			reg = <0x07001400 0x400>;
+			clocks = <&r_ccu CLK_BUS_R_PPU1>;
+			resets = <&r_ccu RST_BUS_R_PPU1>;
+			#power-domain-cells = <1>;
+		};
+
 		r_ccu: clock-controller@7010000 {
 			compatible = "allwinner,sun55i-a523-r-ccu";
 			reg = <0x7010000 0x250>;
@@ -622,6 +632,14 @@ r_i2c_pins: r-i2c-pins {
 			};
 		};
 
+		pck600: power-controller@7060000 {
+			compatible = "allwinner,sun55i-a523-pck-600";
+			reg = <0x07060000 0x8000>;
+			clocks = <&r_ccu CLK_BUS_R_PPU0>;
+			resets = <&r_ccu RST_BUS_R_PPU0>;
+			#power-domain-cells = <1>;
+		};
+
 		r_i2c0: i2c@7081400 {
 			compatible = "allwinner,sun55i-a523-i2c",
 				     "allwinner,sun8i-v536-i2c",
Signature · 1 line
2.39.5
author maintainer
#1 lore raw

PATCH v3 1/5 dt-bindings: power: Add A523 PPU and PCK600 power controllers

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The A523 PPU is likely the same kind of hardware seen on previous SoCs.

The A523 PCK600, as the name suggests, is likely a customized version of ARM's PCK-600 power controller. Comparing the BSP driver against ARM's PPU datasheet shows that the basic registers line up, but Allwinner's hardware has some additional delay controls in the reserved register range. As such it is likely not fully compatible with the standard ARM version.

Document A523 PPU and PCK600 compatibles.

Also reorder the compatible string entries so they are grouped and ordered by family first, then by SoC model.

---
Changes since v1:
- Re-order compatible string entries
- Fix name of header file to match compatible string

---
 .../bindings/power/allwinner,sun20i-d1-ppu.yaml   |  4 +++-
 .../power/allwinner,sun55i-a523-pck-600.h         | 15 +++++++++++++++
 .../dt-bindings/power/allwinner,sun55i-a523-ppu.h | 12 ++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/power/allwinner,sun55i-a523-pck-600.h
 create mode 100644 include/dt-bindings/power/allwinner,sun55i-a523-ppu.h
Documentation/devicetree/bindings/power/allwinner,sun20i-d1-ppu.yaml +3 -1
index f578be6a3bc8..a28e75a9cb6a 100644
@@ -16,8 +16,10 @@ description:
 properties:
   compatible:
     enum:
-      - allwinner,sun20i-d1-ppu
       - allwinner,sun8i-v853-ppu
+      - allwinner,sun20i-d1-ppu
+      - allwinner,sun55i-a523-pck-600
+      - allwinner,sun55i-a523-ppu
 
   reg:
     maxItems: 1
include/dt-bindings/power/allwinner,sun55i-a523-pck-600.h new file +15 -0
new file mode 100644
index 000000000000..6b3d8ea7bb69
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef _DT_BINDINGS_POWER_SUN55I_A523_PCK600_H_
+#define _DT_BINDINGS_POWER_SUN55I_A523_PCK600_H_
+
+#define PD_VE			0
+#define PD_GPU			1
+#define PD_VI			2
+#define PD_VO0			3
+#define PD_VO1			4
+#define PD_DE			5
+#define PD_NAND			6
+#define PD_PCIE			7
+
+#endif /* _DT_BINDINGS_POWER_SUN55I_A523_PCK600_H_ */
include/dt-bindings/power/allwinner,sun55i-a523-ppu.h new file +12 -0
new file mode 100644
index 000000000000..bc9aba73c19a
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef _DT_BINDINGS_POWER_SUN55I_A523_PPU_H_
+#define _DT_BINDINGS_POWER_SUN55I_A523_PPU_H_
+
+#define PD_DSP			0
+#define PD_NPU			1
+#define PD_AUDIO		2
+#define PD_SRAM			3
+#define PD_RISCV		4
+
+#endif /* _DT_BINDINGS_POWER_SUN55I_A523_PPU_H_ */
Signature · 1 line
2.39.5
#6 lore raw
In reply to Chen-Yu Tsai
Quoted 83 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi folks,

This is v3 of my A523 power controllers series.

Changes since v2:
- pck600 driver:
- Fixed whitespace issue
- Added explanation about possible PCK-600 lineage and document references to driver
- Changed Kconfig option to tristate
- Rewrote Kconfig option help text to make it clear that the driver is required for certain peripherals to work
- Made it depend on ARCH_SUNXI or COMPILE_TEST
- Made it enabled by default for ARCH_SUNXI
- Renamed PPU_PWSR_PWR_STATUS to PPU_PWR_STATUS, and added a comment to note the macro is shared between two registers
- New patch changing sun20i-ppu driver to tristate, and enable by default for ARCH_SUNXI
- Fixed pck-600 header path in dtsi file
- Link to v2:
https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Re-order compatible string entries
- Fix name of header file to match compatible string
- Link to v1:
https://lore.kernel.org/all/[email protected]/

This series adds the power controllers found in the Allwinner A523 family of SoCs. There are two power controllers. One is the same type as those found in the D1 SoC, just with a different number of valid power domains. The second is (I assume) a unit based on ARM's PCK-600 power controller. Some of the registers and values match up, but there are extra registers for delay controls in the PCK-600's reserved register range.

Patch 1 adds new compatible string entries for both of these controllers.

Patch 2 adds support for the A523 PPU to the existing D1 PPU driver.

Patch 3 adds a new driver of the PCK-600 unit in the A523 SoC.

Patch 4 aligns Kconfig dependencies and default for SUN20I_PPU with the new PCK-600 driver.

Patch 5 adds device nodes for both of these controllers.

Please have a look. The power controllers are critical for enabling more peripherals, such as display output, camera input, video codecs, the NPU, and a second DWMAC-compatible ethernet interface.

Thanks
ChenYu

Chen-Yu Tsai (5):
dt-bindings: power: Add A523 PPU and PCK600 power controllers
pmdomain: sunxi: sun20i-ppu: add A523 support
pmdomain: sunxi: add driver for Allwinner A523's PCK-600 power
controller
pmdomain: sunxi: sun20i-ppu: change to tristate and enable for
ARCH_SUNXI
arm64: dts: allwinner: a523: Add power controller device nodes

 .../power/allwinner,sun20i-d1-ppu.yaml        |   4 +-
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi |  18 ++
 drivers/pmdomain/sunxi/Kconfig                |  19 +-
 drivers/pmdomain/sunxi/Makefile               |   1 +
 drivers/pmdomain/sunxi/sun20i-ppu.c           |  17 ++
 drivers/pmdomain/sunxi/sun55i-pck600.c        | 234 ++++++++++++++++++
 .../power/allwinner,sun55i-a523-pck-600.h     |  15 ++
 .../power/allwinner,sun55i-a523-ppu.h         |  12 +
 8 files changed, 316 insertions(+), 4 deletions(-)
 create mode 100644 drivers/pmdomain/sunxi/sun55i-pck600.c
 create mode 100644 include/dt-bindings/power/allwinner,sun55i-a523-pck-600.h
 create mode 100644 include/dt-bindings/power/allwinner,sun55i-a523-ppu.h
Quoted 3 lines

--
2.39.5

Patch 1->4 applied for next (the dt patch is also available on the immutable dt branch), thanks!

Kind regards
Uffe

#7 lore raw

Re: (subset) [PATCH v3 0/5] allwinner: a523: Add power controllers

In reply to Chen-Yu Tsai
Quoted 24 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi folks,

This is v3 of my A523 power controllers series.

Changes since v2:
- pck600 driver:
- Fixed whitespace issue
- Added explanation about possible PCK-600 lineage and document references to driver
- Changed Kconfig option to tristate
- Rewrote Kconfig option help text to make it clear that the driver is required for certain peripherals to work
- Made it depend on ARCH_SUNXI or COMPILE_TEST
- Made it enabled by default for ARCH_SUNXI
- Renamed PPU_PWSR_PWR_STATUS to PPU_PWR_STATUS, and added a comment to note the macro is shared between two registers
- New patch changing sun20i-ppu driver to tristate, and enable by default for ARCH_SUNXI
- Fixed pck-600 header path in dtsi file
- Link to v2:
https://lore.kernel.org/all/[email protected]/

Quoted 1 line

[...]

Applied to sunxi/dt-for-6.17 in local tree, thanks!

[5/5] arm64: dts: allwinner: a523: Add power controller device nodes

      commit: 3b430dce33a8b48ddcae4e26991b2516e0431e84

Best regards,

Signature · 1 line
Chen-Yu Tsai <[email protected]>