Power: Add power domain for A9
cover Power: Add power domain for A9
Add power controller driver support for Amlogic A9 SoC.
---
Xianwei Zhao (3):
dt-bindings: power: Add Amlogic A9 power domains
pmdomain: amlogic: Add support for A9 power domains controller
arm64: dts: amlogic: a9: Add power domain controller node
.../bindings/power/amlogic,meson-sec-pwrc.yaml | 1 + arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi | 10 ++++ drivers/pmdomain/amlogic/meson-secure-pwrc.c | 69 ++++++++++++++++++++++ include/dt-bindings/power/amlogic,a9-pwrc.h | 61 +++++++++++++++++++ 4 files changed, 141 insertions(+)
---
base-commit: 544455a3a844edd6107b15cd0ab0b657399f2d49
change-id: 20260722-a9-pm-3efb3f2a4d72
Best regards,
Signature · 1 line
Xianwei Zhao <[email protected]>
PATCH 1/3 dt-bindings: power: Add Amlogic A9 power domains
Add devicetree binding document and related header file for Amlogic A9 secure power domains.
--- .../bindings/power/amlogic,meson-sec-pwrc.yaml | 1 + include/dt-bindings/power/amlogic,a9-pwrc.h | 61 ++++++++++++++++++++++ 2 files changed, 62 insertions(+)
Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml +1 -0
@@ -22,6 +22,7 @@ properties: - amlogic,meson-s4-pwrc - amlogic,a4-pwrc - amlogic,a5-pwrc + - amlogic,a9-pwrc - amlogic,c3-pwrc - amlogic,t7-pwrc - amlogic,s6-pwrc
include/dt-bindings/power/amlogic,a9-pwrc.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH 2/3 pmdomain: amlogic: Add support for A9 power domains controller
In reply to Xianwei ZhaoAdd support for the A9 power controller, whose registers are in the secure domain and should be accessed via SMC.
--- drivers/pmdomain/amlogic/meson-secure-pwrc.c | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
drivers/pmdomain/amlogic/meson-secure-pwrc.c +69 -0
@@ -16,6 +16,7 @@#include <dt-bindings/power/amlogic,t7-pwrc.h> #include <dt-bindings/power/amlogic,a4-pwrc.h> #include <dt-bindings/power/amlogic,a5-pwrc.h> +#include <dt-bindings/power/amlogic,a9-pwrc.h> #include <dt-bindings/power/amlogic,s6-pwrc.h> #include <dt-bindings/power/amlogic,s7-pwrc.h> #include <dt-bindings/power/amlogic,s7d-pwrc.h>
@@ -175,6 +176,65 @@ static const struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = { SEC_PD(A5_DSPA, 0), }; +static const struct meson_secure_pwrc_domain_desc a9_pwrc_domains[] = { +SEC_PD (A9_DSPA ,0 ), +SEC_PD (A9_U3HSG_U3 ,0 ), +SEC_PD (A9_DP ,0 ), +SEC_PD (A9_DOS_HCODEC ,0 ), +SEC_PD (A9_TAHOE ,0 ), +SEC_PD (A9_DOS_HEVC ,0 ), +SEC_PD (A9_U2H ,0 ), +SEC_PD (A9_U3DRD_B ,0 ), +SEC_PD (A9_VPU_HDMI ,0 ), +SEC_PD (A9_U2DRD ,0 ), +SEC_PD (A9_U3DRD_A ,0 ), +SEC_PD (A9_SD_EMMC_C ,0 ), +SEC_PD (A9_GE2D ,0 ), +SEC_PD (A9_AMFC ,0 ), +SEC_PD (A9_EDPTX ,0 ), +SEC_PD (A9_OPP ,0 ), +SEC_PD (A9_VICP ,0 ), +SEC_PD (A9_SD_EMMC_A ,0 ), +SEC_PD (A9_SD_EMMC_B ,0 ), +SEC_PD (A9_ETH ,0 ), +SEC_PD (A9_PCIE_A ,0 ), +SEC_PD (A9_PCIE_B ,0 ), +SEC_PD (A9_NNA_4T ,0 ), +SEC_PD (A9_HDMIRX ,0 ), +SEC_PD (A9_CVE ,0 ), +SEC_PD (A9_ISP ,0 ), +SEC_PD (A9_ETH_1G ,0 ), +SEC_PD (A9_U3HSG_HSG ,0 ), +SEC_PD (A9_U3DPPHY_U3 ,0 ), +SEC_PD (A9_U3DPPHY_DP ,0 ), +SEC_PD (A9_PCIE3PHY ,0 ), +SEC_PD (A9_U3HSG_PCIE2 ,0 ), +SEC_PD (A9_MALI_TOP ,0 ), +SEC_PD (A9_AO_SED ,0 ), +SEC_PD (A9_AO_IR ,0 ), +/* UART_B is for console log, and should be always on */ +SEC_PD (A9_AO_UART_B ,GENPD_FLAG_ALWAYS_ON ), +SEC_PD (A9_AO_UART_C ,0 ), +SEC_PD (A9_AO_UART_D ,0 ), +SEC_PD (A9_AO_SPISG ,0 ), +SEC_PD (A9_AO_UART_E ,0 ), +SEC_PD (A9_AO_CEC ,0 ), +/* SRAMA is used as ATF runtime memory, and should be always on */ +SEC_PD (A9_EE_SRAMA ,GENPD_FLAG_ALWAYS_ON ), +SEC_PD (A9_AUDIO ,0 ), +/* DMC0 is for DDR PHY ana/dig and DMC, and should be always on */ +SEC_PD (A9_DMC0 ,GENPD_FLAG_ALWAYS_ON ), +/*GIC needs to be used consistently, and should be always on */ +SEC_PD (A9_GIC ,GENPD_FLAG_ALWAYS_ON ), +/* DDRPHY is for DDR Work, and should be always on */ +SEC_PD (A9_DDRPHY ,GENPD_FLAG_ALWAYS_ON ), +SEC_PD (A9_AUCPU ,0 ), +SEC_PD (A9_DSI0 ,0 ), +SEC_PD (A9_DSI1 ,0 ), +SEC_PD (A9_CAN0 ,0 ), +SEC_PD (A9_CAN1 ,0 ), +}; +static const struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {SEC_PD (C3_NNA ,0 ),SEC_PD (C3_AUDIO ,0 ),
@@ -425,6 +485,11 @@ static const struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = .count = ARRAY_SIZE(a5_pwrc_domains), }; +static const struct meson_secure_pwrc_domain_data amlogic_secure_a9_pwrc_data = { + .domains = a9_pwrc_domains, + .count =ARRAY_SIZE (a9_pwrc_domains), +}; +static const struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = { .domains = c3_pwrc_domains, .count =ARRAY_SIZE (c3_pwrc_domains),
@@ -468,6 +533,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = { .compatible = "amlogic,a5-pwrc", .data = &amlogic_secure_a5_pwrc_data, }, + { + .compatible = "amlogic,a9-pwrc", + .data = &amlogic_secure_a9_pwrc_data, + }, { .compatible = "amlogic,c3-pwrc", .data = &amlogic_secure_c3_pwrc_data,
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH 2/3] pmdomain: amlogic: Add support for A9 power domains controller
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free due to missing .remove callback for meson_secure_pwrc driver --
--- Patch [2]: [PATCH 2/3] pmdomain: amlogic: Add support for A9 power domains controller --- commit 0074a5ab9b85f84325bfc2bf14c8fb48fcd14fb0
Author: Xianwei Zhao <[email protected]>
pmdomain: amlogic: Add support for A9 power domains controller
This commit adds support for the A9 power controller in the Amlogic secure power domain driver. It introduces the A9 domain descriptors and adds the corresponding compatible string to the match table.
Quoted 4 lines
drivers/pmdomain/amlogic/meson-secure-pwrc.c +0
-0
[ ... ]
Quoted 11 lines
drivers/pmdomain/amlogic/meson-secure-pwrc.c +4
-0@@ -468,6 +533,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = { .compatible = "amlogic,a5-pwrc", .data = &amlogic_secure_a5_pwrc_data, }, + { + .compatible = "amlogic,a9-pwrc", + .data = &amlogic_secure_a9_pwrc_data, + }, { .compatible = "amlogic,c3-pwrc", .data = &amlogic_secure_c3_pwrc_data,
Quoted 1 line
},
[Severity: High]
This isn't a bug introduced by this patch, but while reviewing these changes I noticed a pre-existing issue with the platform driver registration:
static struct platform_driver meson_secure_pwrc_driver = {
.probe = meson_secure_pwrc_probe,
.driver = {
.name = "meson_secure_pwrc",
.of_match_table = meson_secure_pwrc_match_table,
},
};
Does meson_secure_pwrc_driver lack a .remove callback?
If this driver is unbound via sysfs or unloaded as a module, it seems pm_genpd_remove(), pm_genpd_remove_subdomain(), and of_genpd_del_provider() are never called to deregister the domains.
Since the driver core's devres cleanup will free the memory allocated for the generic power domains upon removal, couldn't this leave dangling pointers in the global gpd_list and of_genpd_providers lists, causing a Use-After-Free when the power domain framework traverses them?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/3] pmdomain: amlogic: Add support for A9 power domains controller
In reply to Xianwei ZhaoQuoted 102 lines · On 7/22/26 10:39, Xianwei Zhao via B4 Relay wrote:
From: Xianwei Zhao <[email protected]>
Add support for the A9 power controller, whose registers are in the secure domain and should be accessed via SMC.
Signed-off-by Xianwei Zhao <[email protected]>--- drivers/pmdomain/amlogic/meson-secure-pwrc.c | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)drivers/pmdomain/amlogic/meson-secure-pwrc.c +65
-0@@ -16,6 +16,7 @@#include <dt-bindings/power/amlogic,t7-pwrc.h> #include <dt-bindings/power/amlogic,a4-pwrc.h> #include <dt-bindings/power/amlogic,a5-pwrc.h> +#include <dt-bindings/power/amlogic,a9-pwrc.h> #include <dt-bindings/power/amlogic,s6-pwrc.h> #include <dt-bindings/power/amlogic,s7-pwrc.h> #include <dt-bindings/power/amlogic,s7d-pwrc.h> @@ -175,6 +176,65 @@ static const struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = { SEC_PD(A5_DSPA, 0), }; +static const struct meson_secure_pwrc_domain_desc a9_pwrc_domains[] = { +SEC_PD (A9_DSPA ,0 ), +SEC_PD (A9_U3HSG_U3 ,0 ), +SEC_PD (A9_DP ,0 ), +SEC_PD (A9_DOS_HCODEC ,0 ), +SEC_PD (A9_TAHOE ,0 ), +SEC_PD (A9_DOS_HEVC ,0 ), +SEC_PD (A9_U2H ,0 ), +SEC_PD (A9_U3DRD_B ,0 ), +SEC_PD (A9_VPU_HDMI ,0 ), +SEC_PD (A9_U2DRD ,0 ), +SEC_PD (A9_U3DRD_A ,0 ), +SEC_PD (A9_SD_EMMC_C ,0 ), +SEC_PD (A9_GE2D ,0 ), +SEC_PD (A9_AMFC ,0 ), +SEC_PD (A9_EDPTX ,0 ), +SEC_PD (A9_OPP ,0 ), +SEC_PD (A9_VICP ,0 ), +SEC_PD (A9_SD_EMMC_A ,0 ), +SEC_PD (A9_SD_EMMC_B ,0 ), +SEC_PD (A9_ETH ,0 ), +SEC_PD (A9_PCIE_A ,0 ), +SEC_PD (A9_PCIE_B ,0 ), +SEC_PD (A9_NNA_4T ,0 ), +SEC_PD (A9_HDMIRX ,0 ), +SEC_PD (A9_CVE ,0 ), +SEC_PD (A9_ISP ,0 ), +SEC_PD (A9_ETH_1G ,0 ), +SEC_PD (A9_U3HSG_HSG ,0 ), +SEC_PD (A9_U3DPPHY_U3 ,0 ), +SEC_PD (A9_U3DPPHY_DP ,0 ), +SEC_PD (A9_PCIE3PHY ,0 ), +SEC_PD (A9_U3HSG_PCIE2 ,0 ), +SEC_PD (A9_MALI_TOP ,0 ), +SEC_PD (A9_AO_SED ,0 ), +SEC_PD (A9_AO_IR ,0 ), +/* UART_B is for console log, and should be always on */ +SEC_PD (A9_AO_UART_B ,GENPD_FLAG_ALWAYS_ON ), +SEC_PD (A9_AO_UART_C ,0 ), +SEC_PD (A9_AO_UART_D ,0 ), +SEC_PD (A9_AO_SPISG ,0 ), +SEC_PD (A9_AO_UART_E ,0 ), +SEC_PD (A9_AO_CEC ,0 ), +/* SRAMA is used as ATF runtime memory, and should be always on */ +SEC_PD (A9_EE_SRAMA ,GENPD_FLAG_ALWAYS_ON ), +SEC_PD (A9_AUDIO ,0 ), +/* DMC0 is for DDR PHY ana/dig and DMC, and should be always on */ +SEC_PD (A9_DMC0 ,GENPD_FLAG_ALWAYS_ON ), +/*GIC needs to be used consistently, and should be always on */ +SEC_PD (A9_GIC ,GENPD_FLAG_ALWAYS_ON ), +/* DDRPHY is for DDR Work, and should be always on */ +SEC_PD (A9_DDRPHY ,GENPD_FLAG_ALWAYS_ON ), +SEC_PD (A9_AUCPU ,0 ), +SEC_PD (A9_DSI0 ,0 ), +SEC_PD (A9_DSI1 ,0 ), +SEC_PD (A9_CAN0 ,0 ), +SEC_PD (A9_CAN1 ,0 ), +}; +static const struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {SEC_PD (C3_NNA ,0 ),SEC_PD (C3_AUDIO ,0 ),@@ -425,6 +485,11 @@ static const struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = .count = ARRAY_SIZE(a5_pwrc_domains), }; +static const struct meson_secure_pwrc_domain_data amlogic_secure_a9_pwrc_data = { + .domains = a9_pwrc_domains, + .count =ARRAY_SIZE (a9_pwrc_domains), +}; +static const struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = { .domains = c3_pwrc_domains, .count =ARRAY_SIZE (c3_pwrc_domains),
drivers/pmdomain/amlogic/meson-secure-pwrc.c static const struct of_device_id meson_secure_pwrc_match_table[] = { · line 542
Quoted 10 lines
drivers/pmdomain/amlogic/meson-secure-pwrc.c +4
-0@@ -468,6 +533,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = { .compatible = "amlogic,a5-pwrc", .data = &amlogic_secure_a5_pwrc_data, }, + { + .compatible = "amlogic,a9-pwrc", + .data = &amlogic_secure_a9_pwrc_data, + }, { .compatible = "amlogic,c3-pwrc", .data = &amlogic_secure_c3_pwrc_data,
Thanks,
Neil
PATCH 3/3 arm64: dts: amlogic: a9: Add power domain controller node
In reply to Xianwei ZhaoAdd power domain controller node for Amlogic A9 SoC.
--- arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi +10 -0
@@ -7,6 +7,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/pinctrl/amlogic,pinctrl.h> +#include <dt-bindings/power/amlogic,a9-pwrc.h> / { interrupt-parent = <&gic>;
@@ -72,6 +73,15 @@ cpu7: cpu@700 { }; }; + sm: secure-monitor { + compatible = "amlogic,meson-gxbb-sm"; + + pwrc: power-controller { + compatible = "amlogic,a9-pwrc"; + #power-domain-cells = <1>; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
Signature · 1 line
2.52.0
Re: [PATCH 3/3] arm64: dts: amlogic: a9: Add power domain controller node
Quoted 28 lines · On 7/22/26 10:39, Xianwei Zhao via B4 Relay wrote:
From: Xianwei Zhao <[email protected]>
Add power domain controller node for Amlogic A9 SoC.
Signed-off-by Xianwei Zhao <[email protected]>--- arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi +3
-0@@ -7,6 +7,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/pinctrl/amlogic,pinctrl.h> +#include <dt-bindings/power/amlogic,a9-pwrc.h> / { interrupt-parent = <&gic>;@@ -72,6 +73,15 @@ cpu7: cpu@700 { }; }; + sm: secure-monitor { + compatible = "amlogic,meson-gxbb-sm";
arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi cpu7: cpu@700 { · line 87
Quoted 10 lines
arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi +7
-0+ + pwrc: power-controller { + compatible = "amlogic,a9-pwrc"; + #power-domain-cells = <1>; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
Thanks,
Neil
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH 3/3] arm64: dts: amlogic: a9: Add power domain controller node
Hi Neil,
Quoted 26 lines · Neil Armstrong
Quoted 25 lines · On 7/22/26 10:39, Xianwei Zhao via B4 Relay wrote:
From: Xianwei Zhao <[email protected]>
Add power domain controller node for Amlogic A9 SoC.
Signed-off-by Xianwei Zhao <[email protected]>---
arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi| 10 ++++++++++1 file changed, 10 insertions(+)arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi +1
-0@@ -7,6 +7,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/pinctrl/amlogic,pinctrl.h> +#include <dt-bindings/power/amlogic,a9-pwrc.h> / { interrupt-parent = <&gic>;@@ -72,6 +73,15 @@ cpu7: cpu@700 { }; };
Quoted 16 lines
arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi cpu7: cpu@700 { · line 87
Quoted 13 lines
arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi +9
-0+ sm: secure-monitor { + compatible = "amlogic,meson-gxbb-sm"; + + pwrc: power-controller { + compatible = "amlogic,a9-pwrc"; + #power-domain-cells = <1>; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,Reviewed-by Neil Armstrong <[email protected]>
The DT binding and driver patches have already been merged.
Just wondering if there is anything else needed for the DTS patch to be merged.
Thanks!
Quoted 2 lines
Thanks,
Neil
Quoted 15 lines · On Wed, Jul 22, 2026 at 10:39 AM Xianwei Zhao via B4 Relay…
Add power controller driver support for Amlogic A9 SoC.
Signed-off-by Xianwei Zhao <[email protected]>---
Xianwei Zhao (3):
dt-bindings: power: Add Amlogic A9 power domains
pmdomain: amlogic: Add support for A9 power domains controller
arm64: dts: amlogic: a9: Add power domain controller node.../bindings/power/amlogic,meson-sec-pwrc.yaml | 1 + arch/arm64/boot/dts/amlogic/amlogic-a9.dtsi | 10 ++++ drivers/pmdomain/amlogic/meson-secure-pwrc.c | 69 ++++++++++++++++++++++ include/dt-bindings/power/amlogic,a9-pwrc.h | 61 +++++++++++++++++++ 4 files changed, 141 insertions(+)
Quoted 9 lines
---
base-commit:544455a3a844edd6107b15cd0ab0b657399f2d49
change-id: 20260722-a9-pm-3efb3f2a4d72Best regards,
--
Xianwei Zhao <[email protected]>
Patch1 and patch2 applied for next, thanks!
Please note, patch1 (dt patch) is also available in the immutable dt branch, for SoC maintainers to pull in if needed for patch3.
Kind regards
Uffe