* [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains
@ 2026-11-04 8:56 Cunhao Lu via B4 Relay
2026-11-04 8:56 ` [PATCH v4 1/2] dt-bindings: power: " Cunhao Lu via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Cunhao Lu via B4 Relay @ 2026-11-04 8:56 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Elaine Zhang, Ulf Hansson
Cc: Cunhao Lu, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-pm, Finley Xiao
This is one of the subsystem submissions for RK3572 support.
This series adds the RK3572 power-controller binding and power IDs,
followed by support for all 14 power domains. It includes system GRF
firmware shift-ready checks, NPU voltage-domain control and genpd startup
protection for boot-enabled IMG, VOP, VOP_PRE and VO.
The RK3572 SoC has eight CPU cores: two Cortex-A73 cores and six
Cortex-A53 cores. It also integrates an Arm Mali-G310V2 MC1 GPU.
The OK3572-C board provides two Gigabit Ethernet ports, three USB3 Type-A
ports, a Type-C dual-role port, eMMC, microSD, and UART.
This series depends on the separately submitted power-on rollback fix [1].
Firmware readiness failures reuse it, preserving the original error and
saved QoS. If rollback fails, the domain may remain on while resources are
released and genpd may power down its parent.
[1] https://patch.msgid.link/20261101-fix-rockchip-pmdomain-power-on-rollback-v1-1-59a45783e33e@qq.com
Testing was performed with Debian 13 minimal and Linux 7.3 on the
OK3572-C with the FET3572-C module. Shared peripheral tests were run with
the system booted from SD, while eMMC validation covered the complete
boot chain.
Passed functionality:
- SD and eMMC complete the firmware, kernel, and root filesystem
boot chain.
- UART console works at 1500000 baud.
- SD read/write and data persistence checks pass.
- All eight CPUs start; CPU frequency scaling and hotplug checks pass.
- Both Ethernet ports obtain IPv4 addresses and pass bidirectional file
transfers.
- All three Type-A ports pass USB2 and USB3 enumeration, data transfers,
and reconnect persistence checks.
- Type-C host and device modes pass in both plug orientations. Physical
reconnects correctly select the expected device, host, and device roles
in sequence.
Stability:
- Repeated cold and software reboots complete on SD and eMMC without
data integrity failures or power-domain transition failures.
- A combined CPU, memory, network, SD, and USB3 stress test completes
without a crash, lockup, CPU offline event, or thermal shutdown.
- Ethernet error and drop counters do not increase during bidirectional
network tests.
Power-domain validation:
- All 14 domains register; 11 complete 1,140 runtime-PM cycles. NPU VD
sequencing and startup-protection release are checked.
- Physical cold boot with an eMMC root filesystem succeeds. Read/write
checks pass on eMMC, SD and two USB storage devices; both Ethernet
ports pass ping tests bound to their respective interfaces.
- Thirteen return-value injections after successful operations check
idle-exit and firmware-readiness rollback, NPU cleanup, original errors
and saved QoS. Retries succeed after removing injection.
- 124 host model cases using the driver and genpd pass ASan and UBSan.
Build and checks:
- The kernel, modules, and board DTB build successfully.
- Strict checkpatch reports no errors.
Untested hardware and paths:
- NPU
- PCIe
- GPU, video output, and audio
- CPU rates above 1.2 GHz and voltage scaling
- Other low-speed external interfaces
Some files in this series are derived from the Forlinx OK3572-C BSP
Alpha1. Thanks to Forlinx for their support.
Thanks also to Rockchip's David Wu, Elaine Zhang, Finley Xiao, Frank
Wang, William Wu, and Ye Zhang for providing the driver source files.
AI assistance:
- Codex / DeepSeek V4.1 Flash were used for:
- Reviewing and adjusting code style to follow community conventions
- Automating tests
- Collecting data
Signed-off-by: Cunhao Lu <1579567540@qq.com>
---
Changes in v4:
- Drop generic pending-state tracking and power-off recovery; reuse the
separate power-on rollback fix for firmware readiness errors.
- Support all 14 domains, including NPU voltage-domain control and
cleanup after failed transitions.
- Retain boot-enabled IMG, VOP, VOP_PRE and VO domains until sync_state.
- Use firmware shift-ready naming for the GRF status.
- Build ungate write masks with unsigned arithmetic.
- Link to v3:
https://patch.msgid.link/20261026-add-board-ok3572-c-pmdomain-v3-0-70d614d3d921@qq.com
Changes in v3:
- Track incomplete shutdowns to preserve QoS and complete firmware updates.
- Preserve pending memory resets across shutdown and cancel unfinished
power-on requests.
- Attempt to restore the domain after power-off errors, while preserving
the original error returned to genpd.
- Link to v2:
https://patch.msgid.link/20261023-add-board-ok3572-c-pmdomain-v2-0-79ddd42e92c1@qq.com
Changes in v2:
- Split the original RK3572 support series by subsystem.
- Track low-level power-on and restoration separately. Retain unfinished
memory resets across retries, avoid repeating completed resets, and
preserve QoS snapshots when shutting down after a failed power-on.
- Link to v1:
https://patch.msgid.link/20261022-add-board-ok3572-c-v1-0-0b0fd85a31ee@qq.com
---
Raw dmesg: see v2 cover letter.
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Heiko Stuebner <heiko@sntech.de>
To: Elaine Zhang <zhangqing@rock-chips.com>
To: Ulf Hansson <ulfh@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org
---
Cunhao Lu (1):
pmdomain: rockchip: Add RK3572 power domains
Finley Xiao (1):
dt-bindings: power: rockchip: Add RK3572 power domains
.../bindings/power/rockchip,power-controller.yaml | 17 +++
drivers/pmdomain/rockchip/pm-domains.c | 168 +++++++++++++++++++--
.../power/rockchip,rk3572-power-controller.h | 30 ++++
3 files changed, 204 insertions(+), 11 deletions(-)
---
base-commit: 99e3bb2c6f246f38179cc569e38a45d9555206ed
change-id: 20261023-add-board-ok3572-c-pmdomain-2f02da11386e
Best regards,
--
Cunhao Lu <1579567540@qq.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v4 1/2] dt-bindings: power: rockchip: Add RK3572 power domains 2026-11-04 8:56 [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains Cunhao Lu via B4 Relay @ 2026-11-04 8:56 ` Cunhao Lu via B4 Relay 2026-11-04 8:56 ` [PATCH v4 2/2] pmdomain: " Cunhao Lu via B4 Relay 2026-11-14 10:28 ` [PATCH v4 0/2] " Ulf Hansson 2 siblings, 0 replies; 5+ messages in thread From: Cunhao Lu via B4 Relay @ 2026-11-04 8:56 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Elaine Zhang, Ulf Hansson Cc: Cunhao Lu, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm, Finley Xiao From: Finley Xiao <finley.xiao@rock-chips.com> Describe the RK3572 power controller and define its 14 power-domain IDs. Require the system GRF phandle used to check firmware shift-ready status. Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com> Signed-off-by: Cunhao Lu <1579567540@qq.com> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> --- Changes in v4: - Describe the system GRF register as firmware shift-ready status. --- .../bindings/power/rockchip,power-controller.yaml | 17 ++++++++++++ .../power/rockchip,rk3572-power-controller.h | 30 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml index b41db576f95d..fbf3e0ab4cd9 100644 --- a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml +++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml @@ -43,6 +43,7 @@ properties: - rockchip,rk3528-power-controller - rockchip,rk3562-power-controller - rockchip,rk3568-power-controller + - rockchip,rk3572-power-controller - rockchip,rk3576-power-controller - rockchip,rk3588-power-controller - rockchip,rv1126-power-controller @@ -57,6 +58,22 @@ properties: "#size-cells": const: 0 + rockchip,grf: + $ref: /schemas/types.yaml#/definitions/phandle + description: System GRF with firmware shift-ready status. + +allOf: + - if: + properties: + compatible: + const: rockchip,rk3572-power-controller + then: + required: + - rockchip,grf + else: + properties: + rockchip,grf: false + required: - compatible - "#power-domain-cells" diff --git a/include/dt-bindings/power/rockchip,rk3572-power-controller.h b/include/dt-bindings/power/rockchip,rk3572-power-controller.h new file mode 100644 index 000000000000..c2316fa859df --- /dev/null +++ b/include/dt-bindings/power/rockchip,rk3572-power-controller.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/* + * Copyright (c) 2026 Rockchip Electronics Co., Ltd. + * Author: Finley Xiao <finley.xiao@rock-chips.com> + */ + +#ifndef __DT_BINDINGS_POWER_RK3572_POWER_CONTROLLER_H__ +#define __DT_BINDINGS_POWER_RK3572_POWER_CONTROLLER_H__ + +/* VD_NPU */ +#define RK3572_PD_NPU 0 + +/* VD_GPU */ +#define RK3572_PD_GPU 1 + +/* VD_LOGIC */ +#define RK3572_PD_NVM0 2 +#define RK3572_PD_NVM1 3 +#define RK3572_PD_DSMC 4 +#define RK3572_PD_PHP 5 +#define RK3572_PD_AUDIO 6 +#define RK3572_PD_IMG 7 +#define RK3572_PD_VDEC 8 +#define RK3572_PD_VI 9 +#define RK3572_PD_VENC 10 +#define RK3572_PD_VO 11 +#define RK3572_PD_VOP 12 +#define RK3572_PD_VOP_PRE 13 + +#endif -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 2/2] pmdomain: rockchip: Add RK3572 power domains 2026-11-04 8:56 [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains Cunhao Lu via B4 Relay 2026-11-04 8:56 ` [PATCH v4 1/2] dt-bindings: power: " Cunhao Lu via B4 Relay @ 2026-11-04 8:56 ` Cunhao Lu via B4 Relay 2026-11-14 10:28 ` [PATCH v4 0/2] " Ulf Hansson 2 siblings, 0 replies; 5+ messages in thread From: Cunhao Lu via B4 Relay @ 2026-11-04 8:56 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Elaine Zhang, Ulf Hansson Cc: Cunhao Lu, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm From: Cunhao Lu <1579567540@qq.com> Add the RK3572 PMU register layout and all 14 power domains, including bus idle requests, memory power controls and firmware shift-ready checks. Control the NPU voltage domain around power transitions. Keep boot-enabled IMG, VOP, VOP_PRE and VO domains powered until genpd releases startup protection after their consumers have probed. Signed-off-by: Cunhao Lu <1579567540@qq.com> --- Changes in v4: - Drop generic pending-state tracking and power-off recovery; reuse the separate power-on rollback fix for firmware readiness errors. - Support all 14 domains, including NPU voltage-domain control and cleanup after failed transitions. - Retain boot-enabled IMG, VOP, VOP_PRE and VO domains until sync_state. - Use firmware shift-ready naming for the GRF status. - Build ungate write masks with unsigned arithmetic. Changes in v3: - Track incomplete shutdowns to preserve QoS and complete firmware updates. - Preserve pending memory resets across shutdown and cancel unfinished power-on requests. - Attempt to restore the domain after power-off errors, while preserving the original error returned to genpd. Changes in v2: - Record low-level power-on and restoration stages before hardware operations, so a retry cannot skip unfinished low-level work. - Retain pending memory resets even if memory is off on retry, and avoid repeating completed resets during restoration. - Preserve QoS snapshots across failed power-on and shutdown; clear progress after successful power-on or shutdown. --- References: Finley Xiao: RK3572 power-domain support https://github.com/rockchip-linux/kernel/commit/ac06def92d0abb61f5262b9c099831802cd90ef2 Finley Xiao: IMG startup protection https://github.com/rockchip-linux/kernel/commit/71cc8905484f2a3a9fae4562fbd5f2d1fa31fa4c Finley Xiao: delayed release of startup protection https://github.com/rockchip-linux/kernel/commit/c7709ff2668a4ce3813f4df838743af562568150 --- FAQ: Q: Can a failed power-off still overwrite saved QoS or leave the NIU idle? A: A shutdown retry while the domain still reads ON saves QoS again and can replace the earlier snapshot with unrestored values. After failed power-off, genpd retains its ON state and normally skips the driver's power-on callback on resume, so the NIU can remain idle. These failures predate this series. Changing the driver's early-return condition alone cannot repair a callback that genpd does not invoke; shared shutdown recovery needs a separate design. Q: Can a delayed power-off still miss the firmware notification? A: If polling times out before the OFF SMC and hardware completes the request later, a retry can observe OFF and return without notifying firmware. Rollback can also time out before its OFF notification. The shared path has no record of this unfinished notification. Handling it requires completion tracking independent of the sampled power state; the RK3572 support patch does not provide that shared recovery mechanism. Q: What remains after a low-level power-on or memory-reset timeout? A: A PMU ON request can still complete after its polling timeout, and an interrupted memory reset can leave the memory force-off bit set. A retry that observes the domain ON returns before idle exit, firmware readiness polling and QoS restore. genpd records OFF after failed power-on and normally does not issue the direct OFF callback assumed in the v2 review. Removing the pending-state fields removes that bookkeeping failure, but does not fix these underlying failures. Recovery needs to account for unfinished requests and memory resets; a sampled power-state bit does not establish their completion. The shared low-level error handling is retained pending that recovery work. Q: Can failed rollback still leave hardware ON while genpd records OFF? A: If rollback cannot idle or power off the domain, the original error is returned and transition clocks are released. The power-on wrapper also drops the supply reference where configured, and genpd may undo parent power-on while the child remains powered. The new firmware wait can reach this failure path too. NPU VD is retained while the domain reads ON, but this does not protect its external supply or parent. RK3572's domain table does not set need_regulator; the supply-reference case applies to domains configured to use that shared path. Persistent fault isolation and safe retry require a shared resource-lifetime and genpd recovery policy, which this series does not implement. Link: https://sashiko.dev/#/patchset/20261022-add-board-ok3572-c-v1-0-0b0fd85a31ee@qq.com?part=10 Link: https://sashiko.dev/#/patchset/20261023-add-board-ok3572-c-pmdomain-v2-0-79ddd42e92c1@qq.com?part=2 Link: https://sashiko.dev/#/patchset/20261026-add-board-ok3572-c-pmdomain-v3-0-70d614d3d921@qq.com?part=2 --- drivers/pmdomain/rockchip/pm-domains.c | 168 ++++++++++++++++++++++++++++++--- 1 file changed, 157 insertions(+), 11 deletions(-) diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c index 170f140601d0..32f6fed1ffcc 100644 --- a/drivers/pmdomain/rockchip/pm-domains.c +++ b/drivers/pmdomain/rockchip/pm-domains.c @@ -39,6 +39,7 @@ #include <dt-bindings/power/rockchip,rk3528-power.h> #include <dt-bindings/power/rockchip,rk3562-power.h> #include <dt-bindings/power/rk3568-power.h> +#include <dt-bindings/power/rockchip,rk3572-power-controller.h> #include <dt-bindings/power/rockchip,rk3576-power.h> #include <dt-bindings/power/rk3588-power.h> @@ -49,25 +50,34 @@ struct rockchip_domain_info { int req_mask; int idle_mask; int ack_mask; + bool vd_en; bool active_wakeup; + bool keepon_startup; bool need_regulator; int pwr_w_mask; int req_w_mask; int clk_ungate_mask; int mem_status_mask; int repair_status_mask; + u32 fw_mask; u32 pwr_offset; u32 mem_offset; u32 req_offset; + u32 status_offset; + u32 clk_ungate_offset; }; struct rockchip_pmu_info { + bool chain_status_inverted; + + u32 vd_offset; u32 pwr_offset; u32 status_offset; u32 req_offset; u32 idle_offset; u32 ack_offset; u32 mem_pwr_offset; + u32 fw_status_offset; u32 chain_status_offset; u32 mem_status_offset; u32 repair_status_offset; @@ -105,6 +115,7 @@ struct rockchip_pm_domain { struct rockchip_pmu { struct device *dev; + struct regmap *grf; struct regmap *regmap; const struct rockchip_pmu_info *info; struct mutex mutex; /* mutex lock for pmu */ @@ -258,6 +269,35 @@ struct rockchip_pmu { #define DOMAIN_RK3568(name, pwr, req, wakeup, regulator) \ DOMAIN_M_R(name, pwr, pwr, req, req, req, wakeup, regulator) +#define DOMAIN_RK3572_FLAGS(_name, p_offset, pwr, status, repair, r_offset, req, vd, fw, keepon) \ +{ \ + .name = _name, \ + .pwr_offset = p_offset, \ + .pwr_mask = (pwr), \ + .pwr_w_mask = (pwr) << 16, \ + .status_mask = (status), \ + .mem_offset = p_offset, \ + .mem_status_mask = (pwr), \ + .repair_status_mask = (repair), \ + .req_offset = r_offset, \ + .req_mask = (req), \ + .req_w_mask = (req) << 16, \ + .status_offset = r_offset, \ + .idle_mask = (req), \ + .ack_mask = (req), \ + .clk_ungate_offset = r_offset, \ + .clk_ungate_mask = (req), \ + .vd_en = vd, \ + .fw_mask = (fw), \ + .keepon_startup = keepon, \ +} + +#define DOMAIN_RK3572(name, p_offset, pwr, status, repair, r_offset, req, vd, fw) \ + DOMAIN_RK3572_FLAGS(name, p_offset, pwr, status, repair, r_offset, req, vd, fw, false) + +#define DOMAIN_RK3572_P(name, p_offset, pwr, status, repair, r_offset, req, vd, fw) \ + DOMAIN_RK3572_FLAGS(name, p_offset, pwr, status, repair, r_offset, req, vd, fw, true) + #define DOMAIN_RK3576(name, p_offset, pwr, status, r_status, r_offset, req, idle, g_mask, wakeup) \ DOMAIN_M_O_R_G(name, p_offset, pwr, status, 0, r_status, r_status, r_offset, req, idle, idle, g_mask, wakeup) @@ -373,15 +413,16 @@ static bool rockchip_pmu_domain_is_idle(struct rockchip_pm_domain *pd) const struct rockchip_domain_info *pd_info = pd->info; unsigned int val; - regmap_read(pmu->regmap, pmu->info->idle_offset, &val); + regmap_read(pmu->regmap, pmu->info->idle_offset + pd_info->status_offset, &val); return (val & pd_info->idle_mask) == pd_info->idle_mask; } -static unsigned int rockchip_pmu_read_ack(struct rockchip_pmu *pmu) +static unsigned int rockchip_pmu_read_ack(struct rockchip_pm_domain *pd) { + struct rockchip_pmu *pmu = pd->pmu; unsigned int val; - regmap_read(pmu->regmap, pmu->info->ack_offset, &val); + regmap_read(pmu->regmap, pmu->info->ack_offset + pd->info->status_offset, &val); return val; } @@ -390,7 +431,7 @@ static int rockchip_pmu_ungate_clk(struct rockchip_pm_domain *pd, bool ungate) const struct rockchip_domain_info *pd_info = pd->info; struct rockchip_pmu *pmu = pd->pmu; unsigned int val; - int clk_ungate_w_mask = pd_info->clk_ungate_mask << 16; + u32 clk_ungate_w_mask = (u32)pd_info->clk_ungate_mask << 16; if (!pd_info->clk_ungate_mask) return 0; @@ -400,7 +441,8 @@ static int rockchip_pmu_ungate_clk(struct rockchip_pm_domain *pd, bool ungate) val = ungate ? (pd_info->clk_ungate_mask | clk_ungate_w_mask) : clk_ungate_w_mask; - regmap_write(pmu->regmap, pmu->info->clk_ungate_offset, val); + regmap_write(pmu->regmap, + pmu->info->clk_ungate_offset + pd_info->clk_ungate_offset, val); return 0; } @@ -429,9 +471,8 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, wmb(); - /* Wait util idle_ack = 1 */ target_ack = idle ? pd_info->ack_mask : 0; - ret = readx_poll_timeout_atomic(rockchip_pmu_read_ack, pmu, val, + ret = readx_poll_timeout_atomic(rockchip_pmu_read_ack, pd, val, (val & pd_info->ack_mask) == target_ack, 0, 10000); if (ret) { @@ -543,6 +584,9 @@ static bool rockchip_pmu_domain_is_chain_on(struct rockchip_pm_domain *pd) regmap_read(pmu->regmap, pmu->info->chain_status_offset + pd->info->mem_offset, &val); + if (pmu->info->chain_status_inverted) + return !(val & pd->info->mem_status_mask); + /* 1'b1: power on, 1'b0: power off */ return val & pd->info->mem_status_mask; } @@ -667,9 +711,37 @@ static void rockchip_pd_power_on_rollback(struct rockchip_pm_domain *pd) pd->genpd.name, ret); } +static void rockchip_pmu_vd_on(struct rockchip_pm_domain *pd, bool on) +{ + const struct rockchip_domain_info *pd_info = pd->info; + struct rockchip_pmu *pmu = pd->pmu; + unsigned int val; + + if (!pd_info->vd_en) + return; + + val = on ? pd_info->pwr_w_mask : pd_info->pwr_mask | pd_info->pwr_w_mask; + regmap_write(pmu->regmap, pmu->info->vd_offset + pd_info->pwr_offset, val); +} + +static int rockchip_pmu_wait_fw_shift_ready(struct rockchip_pm_domain *pd) +{ + struct rockchip_pmu *pmu = pd->pmu; + u32 mask = pd->info->fw_mask; + unsigned int val; + + if (!mask) + return 0; + + return regmap_read_poll_timeout(pmu->grf, pmu->info->fw_status_offset, + val, (val & mask) == mask, 0, 10000); +} + static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on) { struct rockchip_pmu *pmu = pd->pmu; + bool vd_was_on = false; + unsigned int val; int ret; guard(mutex)(&pmu->mutex); @@ -677,9 +749,21 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on) if (rockchip_pmu_domain_is_on(pd) == power_on) return 0; + if (power_on && pd->info->vd_en) { + ret = regmap_read(pmu->regmap, + pmu->info->vd_offset + pd->info->pwr_offset, &val); + if (ret) + return ret; + vd_was_on = !(val & pd->info->pwr_mask); + rockchip_pmu_vd_on(pd, true); + } + ret = clk_bulk_enable(pd->num_clks, pd->clks); if (ret < 0) { dev_err(pmu->dev, "failed to enable clocks\n"); + /* Preserve a VD request retained by an earlier failed attempt. */ + if (power_on && !vd_was_on) + rockchip_pmu_vd_on(pd, false); return ret; } @@ -694,6 +778,7 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on) goto out; } + /* A timed-out power-on request may still complete, so keep VD on. */ ret = rockchip_do_pmu_set_power_domain(pd, power_on); if (ret < 0) goto out; @@ -701,13 +786,26 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on) if (power_on) { /* if powering up, leave idle mode */ ret = rockchip_pmu_set_idle_request(pd, false); - if (ret < 0) { - rockchip_pd_power_on_rollback(pd); - goto out; + if (ret < 0) + goto rollback; + + ret = rockchip_pmu_wait_fw_shift_ready(pd); + if (ret) { + dev_err(pmu->dev, "failed to get firmware ready for domain '%s': %d\n", + pd->genpd.name, ret); + goto rollback; } rockchip_pmu_restore_qos(pd); + } else { + rockchip_pmu_vd_on(pd, false); } + goto out; + +rollback: + rockchip_pd_power_on_rollback(pd); + if (pd->info->vd_en && !rockchip_pmu_domain_is_on(pd)) + rockchip_pmu_vd_on(pd, false); out: rockchip_pmu_ungate_clk(pd, false); @@ -943,7 +1041,9 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, pd->genpd.power_on = rockchip_pd_power_on; pd->genpd.attach_dev = rockchip_pd_attach_dev; pd->genpd.detach_dev = rockchip_pd_detach_dev; - pd->genpd.flags = GENPD_FLAG_PM_CLK | GENPD_FLAG_NO_STAY_ON; + pd->genpd.flags = GENPD_FLAG_PM_CLK; + if (!pd_info->keepon_startup) + pd->genpd.flags |= GENPD_FLAG_NO_STAY_ON; if (pd_info->active_wakeup) pd->genpd.flags |= GENPD_FLAG_ACTIVE_WAKEUP; pm_genpd_init(&pd->genpd, NULL, @@ -1089,6 +1189,12 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev) mutex_init(&pmu->mutex); pmu->info = pmu_info; + if (pmu_info->fw_status_offset) { + pmu->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); + if (IS_ERR(pmu->grf)) + return dev_err_probe(dev, PTR_ERR(pmu->grf), + "failed to get system GRF\n"); + } pmu->genpd_data.domains = pmu->domains; pmu->genpd_data.num_domains = pmu_info->num_domains; @@ -1338,6 +1444,23 @@ static const struct rockchip_domain_info rk3568_pm_domains[] = { [RK3568_PD_PIPE] = DOMAIN_RK3568("pipe", BIT(8), BIT(11), false, false), }; +static const struct rockchip_domain_info rk3572_pm_domains[] = { + [RK3572_PD_NVM1] = DOMAIN_RK3572("nvm1", 0x0, BIT(4), 0, BIT(3), 0x0, BIT(6), false, 0), + [RK3572_PD_DSMC] = DOMAIN_RK3572("dsmc", 0x0, BIT(5), BIT(5), 0, 0x0, BIT(7), false, 0), + [RK3572_PD_AUDIO] = DOMAIN_RK3572("audio", 0x0, BIT(6), 0, BIT(4), 0x0, BIT(8), false, 0), + [RK3572_PD_PHP] = DOMAIN_RK3572("php", 0x0, BIT(7), 0, BIT(5), 0x0, BIT(9), false, BIT(28)), + [RK3572_PD_VDEC] = DOMAIN_RK3572("vdec", 0x0, BIT(8), 0, BIT(6), 0x0, BIT(10), false, 0), + [RK3572_PD_IMG] = DOMAIN_RK3572_P("img", 0x0, BIT(9), 0, BIT(7), 0x0, BIT(11), false, 0), + [RK3572_PD_VI] = DOMAIN_RK3572("vi", 0x0, BIT(10), 0, BIT(8), 0x0, BIT(12), false, 0), + [RK3572_PD_VENC] = DOMAIN_RK3572("venc", 0x0, BIT(11), 0, BIT(9), 0x0, BIT(13), false, 0), + [RK3572_PD_VOP] = DOMAIN_RK3572_P("vop", 0x0, BIT(12), 0, BIT(10), 0x0, BIT(14), false, BIT(23)), + [RK3572_PD_VOP_PRE] = DOMAIN_RK3572_P("vop_pre", 0x0, BIT(13), 0, BIT(11), 0x0, 0, false, 0), + [RK3572_PD_VO] = DOMAIN_RK3572_P("vo", 0x0, BIT(14), 0, BIT(12), 0x0, BIT(15), false, 0), + [RK3572_PD_NVM0] = DOMAIN_RK3572("nvm0", 0x0, BIT(15), 0, BIT(13), 0x4, BIT(0), false, 0), + [RK3572_PD_NPU] = DOMAIN_RK3572("npu", 0x4, BIT(1), 0, BIT(14), 0x4, BIT(2), true, BIT(27)), + [RK3572_PD_GPU] = DOMAIN_RK3572("gpu", 0x4, BIT(2), 0, BIT(15), 0x4, BIT(3), false, BIT(29)), +}; + static const struct rockchip_domain_info rk3576_pm_domains[] = { [RK3576_PD_NPU] = DOMAIN_RK3576("npu", 0x0, BIT(0), BIT(0), 0, 0x0, 0, 0, 0, false), [RK3576_PD_NVM] = DOMAIN_RK3576("nvm", 0x0, BIT(6), 0, BIT(6), 0x4, BIT(2), BIT(18), BIT(2), false), @@ -1561,6 +1684,25 @@ static const struct rockchip_pmu_info rk3568_pmu = { .domain_info = rk3568_pm_domains, }; +static const struct rockchip_pmu_info rk3572_pmu = { + .pwr_offset = 0x210, + .status_offset = 0x230, + .chain_status_offset = 0x250, + .chain_status_inverted = true, + .mem_status_offset = 0x260, + .mem_pwr_offset = 0x300, + .req_offset = 0x110, + .idle_offset = 0x130, + .ack_offset = 0x120, + .repair_status_offset = 0x570, + .clk_ungate_offset = 0x150, + .vd_offset = 0x220, + .fw_status_offset = 0x140, + + .num_domains = ARRAY_SIZE(rk3572_pm_domains), + .domain_info = rk3572_pm_domains, +}; + static const struct rockchip_pmu_info rk3576_pmu = { .pwr_offset = 0x210, .status_offset = 0x230, @@ -1672,6 +1814,10 @@ static const struct of_device_id rockchip_pm_domain_dt_match[] = { .compatible = "rockchip,rk3568-power-controller", .data = (void *)&rk3568_pmu, }, + { + .compatible = "rockchip,rk3572-power-controller", + .data = (void *)&rk3572_pmu, + }, { .compatible = "rockchip,rk3576-power-controller", .data = (void *)&rk3576_pmu, -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains 2026-11-04 8:56 [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains Cunhao Lu via B4 Relay 2026-11-04 8:56 ` [PATCH v4 1/2] dt-bindings: power: " Cunhao Lu via B4 Relay 2026-11-04 8:56 ` [PATCH v4 2/2] pmdomain: " Cunhao Lu via B4 Relay @ 2026-11-14 10:28 ` Ulf Hansson 2026-11-16 9:50 ` Cunhao Lu 2 siblings, 1 reply; 5+ messages in thread From: Ulf Hansson @ 2026-11-14 10:28 UTC (permalink / raw) To: 1579567540 Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Elaine Zhang, Ulf Hansson, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm, Finley Xiao On Wed, Nov 4, 2026 at 9:57 AM Cunhao Lu via B4 Relay <devnull+1579567540.qq.com@kernel.org> wrote: > > This is one of the subsystem submissions for RK3572 support. > > This series adds the RK3572 power-controller binding and power IDs, > followed by support for all 14 power domains. It includes system GRF > firmware shift-ready checks, NPU voltage-domain control and genpd startup > protection for boot-enabled IMG, VOP, VOP_PRE and VO. > > The RK3572 SoC has eight CPU cores: two Cortex-A73 cores and six > Cortex-A53 cores. It also integrates an Arm Mali-G310V2 MC1 GPU. > The OK3572-C board provides two Gigabit Ethernet ports, three USB3 Type-A > ports, a Type-C dual-role port, eMMC, microSD, and UART. > > This series depends on the separately submitted power-on rollback fix [1]. > Firmware readiness failures reuse it, preserving the original error and > saved QoS. If rollback fails, the domain may remain on while resources are > released and genpd may power down its parent. > > [1] https://patch.msgid.link/20261101-fix-rockchip-pmdomain-power-on-rollback-v1-1-59a45783e33e@qq.com > > Testing was performed with Debian 13 minimal and Linux 7.3 on the > OK3572-C with the FET3572-C module. Shared peripheral tests were run with > the system booted from SD, while eMMC validation covered the complete > boot chain. > > Passed functionality: > > - SD and eMMC complete the firmware, kernel, and root filesystem > boot chain. > - UART console works at 1500000 baud. > - SD read/write and data persistence checks pass. > - All eight CPUs start; CPU frequency scaling and hotplug checks pass. > - Both Ethernet ports obtain IPv4 addresses and pass bidirectional file > transfers. > - All three Type-A ports pass USB2 and USB3 enumeration, data transfers, > and reconnect persistence checks. > - Type-C host and device modes pass in both plug orientations. Physical > reconnects correctly select the expected device, host, and device roles > in sequence. > > Stability: > > - Repeated cold and software reboots complete on SD and eMMC without > data integrity failures or power-domain transition failures. > - A combined CPU, memory, network, SD, and USB3 stress test completes > without a crash, lockup, CPU offline event, or thermal shutdown. > - Ethernet error and drop counters do not increase during bidirectional > network tests. > > Power-domain validation: > > - All 14 domains register; 11 complete 1,140 runtime-PM cycles. NPU VD > sequencing and startup-protection release are checked. > - Physical cold boot with an eMMC root filesystem succeeds. Read/write > checks pass on eMMC, SD and two USB storage devices; both Ethernet > ports pass ping tests bound to their respective interfaces. > - Thirteen return-value injections after successful operations check > idle-exit and firmware-readiness rollback, NPU cleanup, original errors > and saved QoS. Retries succeed after removing injection. > - 124 host model cases using the driver and genpd pass ASan and UBSan. > > Build and checks: > > - The kernel, modules, and board DTB build successfully. > - Strict checkpatch reports no errors. > > Untested hardware and paths: > > - NPU > - PCIe > - GPU, video output, and audio > - CPU rates above 1.2 GHz and voltage scaling > - Other low-speed external interfaces > > Some files in this series are derived from the Forlinx OK3572-C BSP > Alpha1. Thanks to Forlinx for their support. > Thanks also to Rockchip's David Wu, Elaine Zhang, Finley Xiao, Frank > Wang, William Wu, and Ye Zhang for providing the driver source files. > > AI assistance: > > - Codex / DeepSeek V4.1 Flash were used for: > - Reviewing and adjusting code style to follow community conventions > - Automating tests > - Collecting data > > Signed-off-by: Cunhao Lu <1579567540@qq.com> > --- > Changes in v4: > - Drop generic pending-state tracking and power-off recovery; reuse the > separate power-on rollback fix for firmware readiness errors. > - Support all 14 domains, including NPU voltage-domain control and > cleanup after failed transitions. > - Retain boot-enabled IMG, VOP, VOP_PRE and VO domains until sync_state. > - Use firmware shift-ready naming for the GRF status. > - Build ungate write masks with unsigned arithmetic. > - Link to v3: > https://patch.msgid.link/20261026-add-board-ok3572-c-pmdomain-v3-0-70d614d3d921@qq.com > > Changes in v3: > - Track incomplete shutdowns to preserve QoS and complete firmware updates. > - Preserve pending memory resets across shutdown and cancel unfinished > power-on requests. > - Attempt to restore the domain after power-off errors, while preserving > the original error returned to genpd. > - Link to v2: > https://patch.msgid.link/20261023-add-board-ok3572-c-pmdomain-v2-0-79ddd42e92c1@qq.com > > Changes in v2: > - Split the original RK3572 support series by subsystem. > - Track low-level power-on and restoration separately. Retain unfinished > memory resets across retries, avoid repeating completed resets, and > preserve QoS snapshots when shutting down after a failed power-on. > - Link to v1: > https://patch.msgid.link/20261022-add-board-ok3572-c-v1-0-0b0fd85a31ee@qq.com > > --- > Raw dmesg: see v2 cover letter. > > To: Rob Herring <robh@kernel.org> > To: Krzysztof Kozlowski <krzk+dt@kernel.org> > To: Conor Dooley <conor+dt@kernel.org> > To: Heiko Stuebner <heiko@sntech.de> > To: Elaine Zhang <zhangqing@rock-chips.com> > To: Ulf Hansson <ulfh@kernel.org> > Cc: devicetree@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-rockchip@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-pm@vger.kernel.org > > --- > Cunhao Lu (1): > pmdomain: rockchip: Add RK3572 power domains > > Finley Xiao (1): > dt-bindings: power: rockchip: Add RK3572 power domains > > .../bindings/power/rockchip,power-controller.yaml | 17 +++ > drivers/pmdomain/rockchip/pm-domains.c | 168 +++++++++++++++++++-- > .../power/rockchip,rk3572-power-controller.h | 30 ++++ > 3 files changed, 204 insertions(+), 11 deletions(-) > --- > base-commit: 99e3bb2c6f246f38179cc569e38a45d9555206ed > change-id: 20261023-add-board-ok3572-c-pmdomain-2f02da11386e > > Best regards, > -- > Cunhao Lu <1579567540@qq.com> > > There are quite a lot of patches on the rockchip power domain driver in the pipe. On my end, I can only try to apply pieces by piece, but it would be nice if you could start reviewing each other's patches to help coordinate this bit. Anyway, this series needs to be rebased on top of the latest changes that I have queued for next. I will have a look when that's done. Kind regards Uffe ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains 2026-11-14 10:28 ` [PATCH v4 0/2] " Ulf Hansson @ 2026-11-16 9:50 ` Cunhao Lu 0 siblings, 0 replies; 5+ messages in thread From: Cunhao Lu @ 2026-11-16 9:50 UTC (permalink / raw) To: Ulf Hansson Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Elaine Zhang, Ulf Hansson, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm, Finley Xiao Hi, > There are quite a lot of patches on the rockchip power domain driver > in the pipe. On my end, I can only try to apply pieces by piece, but > it would be nice if you could start reviewing each other's patches to > help coordinate this bit. > > Anyway, this series needs to be rebased on top of the latest changes > that I have queued for next. I will have a look when that's done. I have rebased this series and its prerequisite power-on rollback fix [1] onto your latest next branch (6f5c8ec9302c). Both rebased cleanly, with no conflicts or functional changes. Should I send new revisions of both (v5 for this series and v2 for the rollback fix)? [1] https://patch.msgid.link/20261101-fix-rockchip-pmdomain-power-on-rollback-v1-1-59a45783e33e@qq.com Best regards, Cunhao Lu ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-16 9:50 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-04 8:56 [PATCH v4 0/2] pmdomain: rockchip: Add RK3572 power domains Cunhao Lu via B4 Relay 2026-11-04 8:56 ` [PATCH v4 1/2] dt-bindings: power: " Cunhao Lu via B4 Relay 2026-11-04 8:56 ` [PATCH v4 2/2] pmdomain: " Cunhao Lu via B4 Relay 2026-11-14 10:28 ` [PATCH v4 0/2] " Ulf Hansson 2026-11-16 9:50 ` Cunhao Lu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®