Skip to contentSkip to conversation

Power: A5: add power domain driver

PATCH Applied Xianwei Zhao 4 participants 9 messages Jun 27, 2024 – Jul 9, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Power: A5: add power domain driver

Add power controller driver support for Amlogic A5 SoC.

---
Xianwei Zhao (3):
dt-bindings: power: add Amlogic A5 power domains
pmdomain: amlogic: Add support for A5 power domains controller
arm64: dts: amlogic: a5: add power domain controller node

 .../bindings/power/amlogic,meson-sec-pwrc.yaml     |  1 +
 arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi        | 10 +++++++++
 drivers/pmdomain/amlogic/meson-secure-pwrc.c       | 26 ++++++++++++++++++++++
 include/dt-bindings/power/amlogic,a5-pwrc.h        | 21 +++++++++++++++++
 4 files changed, 58 insertions(+)

---
base-commit: cc647e931a249605e06d3eb3ec89a7e320fc28cc
change-id: 20240627-a5_secpower-bfa1bb4bd9c4

Best regards,

Signature · 1 line
Xianwei Zhao <[email protected]>
#1 lore raw

PATCH 1/3 dt-bindings: power: add Amlogic A5 power domains

Add devicetree binding document and related header file for Amlogic A5 secure power domains.

---
 .../bindings/power/amlogic,meson-sec-pwrc.yaml      |  1 +
 include/dt-bindings/power/amlogic,a5-pwrc.h         | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml +1 -0
index 59915f9d4860..15d74138baa3 100644
@@ -21,6 +21,7 @@ properties:
       - amlogic,meson-a1-pwrc
       - amlogic,meson-s4-pwrc
       - amlogic,a4-pwrc
+      - amlogic,a5-pwrc
       - amlogic,c3-pwrc
       - amlogic,t7-pwrc
 
include/dt-bindings/power/amlogic,a5-pwrc.h new file +21 -0
new file mode 100644
index 000000000000..3a6f53eb959f
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
+/*
+ * Copyright (C) 2024 Amlogic, Inc. All rights reserved
+ */
+
+#ifndef _DT_BINDINGS_AMLOGIC_A5_POWER_H
+#define _DT_BINDINGS_AMLOGIC_A5_POWER_H
+
+#define PWRC_A5_NNA_ID			0
+#define PWRC_A5_AUDIO_ID		1
+#define PWRC_A5_SDIOA_ID		2
+#define PWRC_A5_EMMC_ID			3
+#define PWRC_A5_USB_COMB_ID		4
+#define PWRC_A5_ETH_ID			5
+#define PWRC_A5_RSA_ID			6
+#define PWRC_A5_AUDIO_PDM_ID		7
+#define PWRC_A5_DMC_ID			8
+#define PWRC_A5_SYS_WRAP_ID		9
+#define PWRC_A5_DSPA_ID			10
+
+#endif
Signature · 1 line
2.37.1
#3 lore raw

PATCH 2/3 pmdomain: amlogic: Add support for A5 power domains controller

In reply to Xianwei Zhao

Add support for the A5 power controller, whose registers are in the secure domain and should be accessed via SMC.

---
 drivers/pmdomain/amlogic/meson-secure-pwrc.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/pmdomain/amlogic/meson-secure-pwrc.c +26 -0
index df5567418226..f6729eea6b8c 100644
@@ -15,6 +15,7 @@
 #include <dt-bindings/power/meson-s4-power.h>
 #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 <linux/arm-smccc.h>
 #include <linux/firmware/meson/meson_sm.h>
 #include <linux/module.h>
@@ -155,6 +156,22 @@ static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
 	SEC_PD(A4_AO_IR,	GENPD_FLAG_ALWAYS_ON),
 };
 
+static struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
+	SEC_PD(A5_NNA,		0),
+	SEC_PD(A5_AUDIO,	0),
+	SEC_PD(A5_SDIOA,	0),
+	SEC_PD(A5_EMMC,		0),
+	SEC_PD(A5_USB_COMB,	0),
+	SEC_PD(A5_ETH,		0),
+	SEC_PD(A5_RSA,		0),
+	SEC_PD(A5_AUDIO_PDM,	0),
+	/* DMC is for DDR PHY ana/dig and DMC, and should be always on */
+	SEC_PD(A5_DMC,		GENPD_FLAG_ALWAYS_ON),
+	/* WRAP is secure_top, a lot of modules are included, and should be always on */
+	SEC_PD(A5_SYS_WRAP,	GENPD_FLAG_ALWAYS_ON),
+	SEC_PD(A5_DSPA,		0),
+};
+
 static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
 	SEC_PD(C3_NNA,		0),
 	SEC_PD(C3_AUDIO,	0),
@@ -335,6 +352,11 @@ static struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
 	.count = ARRAY_SIZE(a4_pwrc_domains),
 };
 
+static struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = {
+	.domains = a5_pwrc_domains,
+	.count = ARRAY_SIZE(a5_pwrc_domains),
+};
+
 static struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
 	.domains = c3_pwrc_domains,
 	.count = ARRAY_SIZE(c3_pwrc_domains),
@@ -359,6 +381,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = {
 		.compatible = "amlogic,a4-pwrc",
 		.data = &amlogic_secure_a4_pwrc_data,
 	},
+	{
+		.compatible = "amlogic,a5-pwrc",
+		.data = &amlogic_secure_a5_pwrc_data,
+	},
 	{
 		.compatible = "amlogic,c3-pwrc",
 		.data = &amlogic_secure_c3_pwrc_data,
Signature · 1 line
2.37.1
maintainer Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] pmdomain: amlogic: Add support for A5 power domains controller

Quoted 60 lines · On 27/06/2024 13:47, Xianwei Zhao via B4 Relay wrote:

From: Xianwei Zhao <[email protected]>

Add support for the A5 power controller, whose registers are in the secure domain and should be accessed via SMC.

---
  drivers/pmdomain/amlogic/meson-secure-pwrc.c | 26 ++++++++++++++++++++++++++
  1 file changed, 26 insertions(+)
drivers/pmdomain/amlogic/meson-secure-pwrc.c +22 -0
index df5567418226..f6729eea6b8c 100644
@@ -15,6 +15,7 @@
  #include <dt-bindings/power/meson-s4-power.h>
  #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 <linux/arm-smccc.h>
  #include <linux/firmware/meson/meson_sm.h>
  #include <linux/module.h>
@@ -155,6 +156,22 @@ static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
  	SEC_PD(A4_AO_IR,	GENPD_FLAG_ALWAYS_ON),
  };
 
+static struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
+	SEC_PD(A5_NNA,		0),
+	SEC_PD(A5_AUDIO,	0),
+	SEC_PD(A5_SDIOA,	0),
+	SEC_PD(A5_EMMC,		0),
+	SEC_PD(A5_USB_COMB,	0),
+	SEC_PD(A5_ETH,		0),
+	SEC_PD(A5_RSA,		0),
+	SEC_PD(A5_AUDIO_PDM,	0),
+	/* DMC is for DDR PHY ana/dig and DMC, and should be always on */
+	SEC_PD(A5_DMC,		GENPD_FLAG_ALWAYS_ON),
+	/* WRAP is secure_top, a lot of modules are included, and should be always on */
+	SEC_PD(A5_SYS_WRAP,	GENPD_FLAG_ALWAYS_ON),
+	SEC_PD(A5_DSPA,		0),
+};
+
  static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
  	SEC_PD(C3_NNA,		0),
  	SEC_PD(C3_AUDIO,	0),
@@ -335,6 +352,11 @@ static struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
  	.count = ARRAY_SIZE(a4_pwrc_domains),
  };
 
+static struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = {
+	.domains = a5_pwrc_domains,
+	.count = ARRAY_SIZE(a5_pwrc_domains),
+};
+
  static 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 390

Quoted 10 lines
drivers/pmdomain/amlogic/meson-secure-pwrc.c +4 -0
@@ -359,6 +381,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = {
  		.compatible = "amlogic,a4-pwrc",
  		.data = &amlogic_secure_a4_pwrc_data,
  	},
+	{
+		.compatible = "amlogic,a5-pwrc",
+		.data = &amlogic_secure_a5_pwrc_data,
+	},
  	{
  		.compatible = "amlogic,c3-pwrc",
  		.data = &amlogic_secure_c3_pwrc_data,
#5 lore raw

PATCH 3/3 arm64: dts: amlogic: a5: add power domain controller node

In reply to Xianwei Zhao

Add power domain controller node for Amlogic A5 SoC.

---
 arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi +10 -0
index 43f68a7da2f7..17a6316de891 100644
@@ -4,6 +4,7 @@
  */
 
 #include "amlogic-a4-common.dtsi"
+#include <dt-bindings/power/amlogic,a5-pwrc.h>
 / {
 	cpus {
 		#address-cells = <2>;
@@ -37,4 +38,13 @@ cpu3: cpu@300 {
 			enable-method = "psci";
 		};
 	};
+
+	sm: secure-monitor {
+		compatible = "amlogic,meson-gxbb-sm";
+
+		pwrc: power-controller {
+			compatible = "amlogic,a5-pwrc";
+			#power-domain-cells = <1>;
+		};
+	};
 };
Signature · 1 line
2.37.1
maintainer Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] arm64: dts: amlogic: a5: add power domain controller node

Quoted 27 lines · On 27/06/2024 13:47, Xianwei Zhao via B4 Relay wrote:

From: Xianwei Zhao <[email protected]>

Add power domain controller node for Amlogic A5 SoC.

---
  arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi | 10 ++++++++++
  1 file changed, 10 insertions(+)
arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi +1 -0
index 43f68a7da2f7..17a6316de891 100644
@@ -4,6 +4,7 @@
   */
 
  #include "amlogic-a4-common.dtsi"
+#include <dt-bindings/power/amlogic,a5-pwrc.h>
  / {
  	cpus {
  		#address-cells = <2>;
@@ -37,4 +38,13 @@ cpu3: cpu@300 {
  			enable-method = "psci";
  		};
  	};

arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi cpu3: cpu@300 { · line 50

Quoted 10 lines
arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi +9 -0
+
+	sm: secure-monitor {
+		compatible = "amlogic,meson-gxbb-sm";
+
+		pwrc: power-controller {
+			compatible = "amlogic,a5-pwrc";
+			#power-domain-cells = <1>;
+		};
+	};
  };
#7 lore raw
In reply to Xianwei Zhao
Quoted 10 lines · On Thu, 27 Jun 2024 at 13:47, Xianwei Zhao via B4 Relay…

Add power controller driver support for Amlogic A5 SoC.

---
Xianwei Zhao (3):
dt-bindings: power: add Amlogic A5 power domains
pmdomain: amlogic: Add support for A5 power domains controller
arm64: dts: amlogic: a5: add power domain controller node

Quoted 6 lines
 .../bindings/power/amlogic,meson-sec-pwrc.yaml     |  1 +
 arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi        | 10 +++++++++
 drivers/pmdomain/amlogic/meson-secure-pwrc.c       | 26 ++++++++++++++++++++++
 include/dt-bindings/power/amlogic,a5-pwrc.h        | 21 +++++++++++++++++
 4 files changed, 58 insertions(+)

---

Patch 1 and 2 applied for next (patch 1 is available at the immutable dt branch too), thanks!

Kind regards
Uffe

maintainer Applied
#8 lore raw

Re: (subset) [PATCH 0/3] Power: A5: add power domain driver

In reply to Xianwei Zhao

Hi,

Quoted 3 lines · Xianwei Zhao

Add power controller driver support for Amlogic A5 SoC.

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.11/arm64-dt)

[3/3] arm64: dts: amlogic: a5: add power domain controller node

      https://git.kernel.org/amlogic/c/c087cd0ef1b0c2adfabd216e28dfed242b5f4f07

These changes has been applied on the intermediate git tree [1].

The v6.11/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers for inclusion in their intermediate git branches in order to be sent to Linus during the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate kernel and as soon they appear on the Linux master branch they will be backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3], people are encouraged testing these pre-release kernels and report issues on the relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signature · 1 line
Neil