2023-07-07 01:02:27

by Xianwei Zhao

[permalink] [raw]
Subject: [PATCH V2 0/4] Power: C3: add power domain driver

First patch is that Use 'name' instead of 'index' as criterion.
The variate 'index' could be equal to zero in some SoCs. Such as C3 SoC,
PWRC_C3_NNA_ID be defined zero.

Other patchs adds power controller driver support for Amlogic C3 SoC.
The power domains registers can be accessed in the secure world only.

Changes Since v1:
-Add a new patch for change that use 'name' instead of 'index'.
-Mofiy filename matching compatibles
-Delete unnecessary blank line.
-Fixed some formatting.
-Delete status,use "okay" status by default.

Xianwei Zhao (4):
soc: amlogic: use name instead of index as criterion
dt-bindings: power: add Amlogic C3 power domains
soc: c3: Add support for power domains controller
arm64: dts: add support for C3 power domain controller

.../power/amlogic,meson-sec-pwrc.yaml | 3 +-
arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 9 ++++++
drivers/soc/amlogic/meson-secure-pwrc.c | 28 ++++++++++++++++++-
include/dt-bindings/power/amlogic,c3-pwrc.h | 25 +++++++++++++++++
4 files changed, 63 insertions(+), 2 deletions(-)
create mode 100644 include/dt-bindings/power/amlogic,c3-pwrc.h


base-commit: 057889cb4244096ea5abcbe76ffd4d311c3078fe
--
2.37.1



2023-07-07 01:05:41

by Xianwei Zhao

[permalink] [raw]
Subject: [PATCH V2 1/4] soc: amlogic: use name instead of index as criterion

The variate 'index' could be equal to zero in some SoCs. Such as C3 SoC,
PWRC_C3_NNA_ID be defined zero. Use 'name' instead of 'index' as criterion.

Signed-off-by: Xianwei Zhao <[email protected]>
---
V1 -> V2: add a new patch for change.
---
drivers/soc/amlogic/meson-secure-pwrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c
index 25b4b71df9b8..c11d65a3e3d9 100644
--- a/drivers/soc/amlogic/meson-secure-pwrc.c
+++ b/drivers/soc/amlogic/meson-secure-pwrc.c
@@ -179,7 +179,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
for (i = 0 ; i < match->count ; ++i) {
struct meson_secure_pwrc_domain *dom = &pwrc->domains[i];

- if (!match->domains[i].index)
+ if (!match->domains[i].name)
continue;

dom->pwrc = pwrc;
--
2.37.1


2023-07-07 01:35:19

by Xianwei Zhao

[permalink] [raw]
Subject: [PATCH V2 2/4] dt-bindings: power: add Amlogic C3 power domains

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

Signed-off-by: Xianwei Zhao <[email protected]>
---
V1 -> V2: Mofiy filename matching compatibles.
Delete unnecessary blank line.
---
.../power/amlogic,meson-sec-pwrc.yaml | 3 ++-
include/dt-bindings/power/amlogic,c3-pwrc.h | 25 +++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
create mode 100644 include/dt-bindings/power/amlogic,c3-pwrc.h

diff --git a/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml b/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml
index eab21bb2050a..d80bbedfe3aa 100644
--- a/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml
+++ b/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml
@@ -12,7 +12,7 @@ maintainers:
- Jianxin Pan <[email protected]>

description: |+
- Secure Power Domains used in Meson A1/C1/S4 SoCs, and should be the child node
+ Secure Power Domains used in Meson A1/C1/S4 & C3 SoCs, and should be the child node
of secure-monitor.

properties:
@@ -20,6 +20,7 @@ properties:
enum:
- amlogic,meson-a1-pwrc
- amlogic,meson-s4-pwrc
+ - amlogic,c3-pwrc

"#power-domain-cells":
const: 1
diff --git a/include/dt-bindings/power/amlogic,c3-pwrc.h b/include/dt-bindings/power/amlogic,c3-pwrc.h
new file mode 100644
index 000000000000..1d98a25b08a4
--- /dev/null
+++ b/include/dt-bindings/power/amlogic,c3-pwrc.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
+/*
+ * Copyright (c) 2023 Amlogic, Inc.
+ * Author: hongyu chen1 <[email protected]>
+ */
+#ifndef _DT_BINDINGS_AMLOGIC_C3_POWER_H
+#define _DT_BINDINGS_AMLOGIC_C3_POWER_H
+
+#define PWRC_C3_NNA_ID 0
+#define PWRC_C3_AUDIO_ID 1
+#define PWRC_C3_RESV_SEC_ID 2
+#define PWRC_C3_SDIOA_ID 3
+#define PWRC_C3_EMMC_ID 4
+#define PWRC_C3_USB_COMB_ID 5
+#define PWRC_C3_SDCARD_ID 6
+#define PWRC_C3_ETH_ID 7
+#define PWRC_C3_RESV0_ID 8
+#define PWRC_C3_GE2D_ID 9
+#define PWRC_C3_CVE_ID 10
+#define PWRC_C3_GDC_WRAP_ID 11
+#define PWRC_C3_ISP_TOP_ID 12
+#define PWRC_C3_MIPI_ISP_WRAP_ID 13
+#define PWRC_C3_VCODEC_ID 14
+
+#endif
--
2.37.1


2023-07-07 01:35:20

by Xianwei Zhao

[permalink] [raw]
Subject: [PATCH V2 4/4] arm64: dts: add support for C3 power domain controller

Enable power domain controller for Amlogic C3 SoC

Signed-off-by: Xianwei Zhao <[email protected]>
---
V1 -> V2: delete status,use "okay" status by default.
---
arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
index 60ad4f3eef9d..f6603fd57551 100644
--- a/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
+++ b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
@@ -47,6 +47,15 @@ xtal: xtal-clk {
#clock-cells = <0>;
};

+ sm: secure-monitor {
+ compatible = "amlogic,meson-gxbb-sm";
+
+ pwrc: power-controller {
+ compatible = "amlogic,c3-pwrc";
+ #power-domain-cells = <1>;
+ };
+ };
+
soc {
compatible = "simple-bus";
#address-cells = <2>;
--
2.37.1


2023-07-07 08:10:43

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH V2 1/4] soc: amlogic: use name instead of index as criterion

On 07/07/2023 02:37, Xianwei Zhao wrote:
> The variate 'index' could be equal to zero in some SoCs. Such as C3 SoC,
> PWRC_C3_NNA_ID be defined zero. Use 'name' instead of 'index' as criterion.
>
> Signed-off-by: Xianwei Zhao <[email protected]>
> ---
> V1 -> V2: add a new patch for change.
> ---
> drivers/soc/amlogic/meson-secure-pwrc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c
> index 25b4b71df9b8..c11d65a3e3d9 100644
> --- a/drivers/soc/amlogic/meson-secure-pwrc.c
> +++ b/drivers/soc/amlogic/meson-secure-pwrc.c
> @@ -179,7 +179,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
> for (i = 0 ; i < match->count ; ++i) {
> struct meson_secure_pwrc_domain *dom = &pwrc->domains[i];
>
> - if (!match->domains[i].index)
> + if (!match->domains[i].name)
> continue;
>
> dom->pwrc = pwrc;

Reviewed-by: Neil Armstrong <[email protected]>

2023-07-07 08:20:36

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH V2 4/4] arm64: dts: add support for C3 power domain controller

On 07/07/2023 02:37, Xianwei Zhao wrote:
> Enable power domain controller for Amlogic C3 SoC
>
> Signed-off-by: Xianwei Zhao <[email protected]>
> ---
> V1 -> V2: delete status,use "okay" status by default.
> ---
> arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
> index 60ad4f3eef9d..f6603fd57551 100644
> --- a/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
> @@ -47,6 +47,15 @@ xtal: xtal-clk {
> #clock-cells = <0>;
> };
>
> + sm: secure-monitor {
> + compatible = "amlogic,meson-gxbb-sm";
> +
> + pwrc: power-controller {
> + compatible = "amlogic,c3-pwrc";
> + #power-domain-cells = <1>;
> + };
> + };
> +
> soc {
> compatible = "simple-bus";
> #address-cells = <2>;

Reviewed-by: Neil Armstrong <[email protected]>

2023-07-07 15:52:00

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V2 2/4] dt-bindings: power: add Amlogic C3 power domains


On Fri, 07 Jul 2023 08:37:08 +0800, Xianwei Zhao wrote:
> Add devicetree binding document and related header file for Amlogic C3 secure power domains.
>
> Signed-off-by: Xianwei Zhao <[email protected]>
> ---
> V1 -> V2: Mofiy filename matching compatibles.
> Delete unnecessary blank line.
> ---
> .../power/amlogic,meson-sec-pwrc.yaml | 3 ++-
> include/dt-bindings/power/amlogic,c3-pwrc.h | 25 +++++++++++++++++++
> 2 files changed, 27 insertions(+), 1 deletion(-)
> create mode 100644 include/dt-bindings/power/amlogic,c3-pwrc.h
>

Acked-by: Rob Herring <[email protected]>


2023-07-19 19:57:41

by Dmitry Rokosov

[permalink] [raw]
Subject: Re: [PATCH V2 1/4] soc: amlogic: use name instead of index as criterion

On Fri, Jul 07, 2023 at 08:37:07AM +0800, Xianwei Zhao wrote:
> The variate 'index' could be equal to zero in some SoCs. Such as C3 SoC,
> PWRC_C3_NNA_ID be defined zero. Use 'name' instead of 'index' as criterion.
>
> Signed-off-by: Xianwei Zhao <[email protected]>

Reviewed-by: Dmitry Rokosov <[email protected]>

> ---
> V1 -> V2: add a new patch for change.
> ---
> drivers/soc/amlogic/meson-secure-pwrc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c
> index 25b4b71df9b8..c11d65a3e3d9 100644
> --- a/drivers/soc/amlogic/meson-secure-pwrc.c
> +++ b/drivers/soc/amlogic/meson-secure-pwrc.c
> @@ -179,7 +179,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
> for (i = 0 ; i < match->count ; ++i) {
> struct meson_secure_pwrc_domain *dom = &pwrc->domains[i];
>
> - if (!match->domains[i].index)
> + if (!match->domains[i].name)
> continue;
>
> dom->pwrc = pwrc;
> --
> 2.37.1
>
>
> _______________________________________________
> linux-amlogic mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

--
Thank you,
Dmitry

2023-07-31 10:52:46

by Neil Armstrong

[permalink] [raw]
Subject: Re: (subset) [PATCH V2 0/4] Power: C3: add power domain driver

Hi,

On Fri, 07 Jul 2023 08:37:06 +0800, Xianwei Zhao wrote:
> First patch is that Use 'name' instead of 'index' as criterion.
> The variate 'index' could be equal to zero in some SoCs. Such as C3 SoC,
> PWRC_C3_NNA_ID be defined zero.
>
> Other patchs adds power controller driver support for Amlogic C3 SoC.
> The power domains registers can be accessed in the secure world only.
>
> [...]

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

[4/4] arm64: dts: add support for C3 power domain controller
https://git.kernel.org/amlogic/c/22a9b2a488c3f0937fe0c57c96176cbea0953c20

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

The v6.6/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

--
Neil


2023-07-31 10:55:44

by Neil Armstrong

[permalink] [raw]
Subject: Re: (subset) [PATCH V2 0/4] Power: C3: add power domain driver

Hi,

On Fri, 07 Jul 2023 08:37:06 +0800, Xianwei Zhao wrote:
> First patch is that Use 'name' instead of 'index' as criterion.
> The variate 'index' could be equal to zero in some SoCs. Such as C3 SoC,
> PWRC_C3_NNA_ID be defined zero.
>
> Other patchs adds power controller driver support for Amlogic C3 SoC.
> The power domains registers can be accessed in the secure world only.
>
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.6/drivers-genpd)

[1/4] soc: amlogic: use name instead of index as criterion
https://git.kernel.org/amlogic/c/fadf18180022743ff74b1f6ca4f3cff462ddaddb
[2/4] dt-bindings: power: add Amlogic C3 power domains
https://git.kernel.org/amlogic/c/83b03d62939c46c118a8d722f07ae03a87967b00
[3/4] soc: c3: Add support for power domains controller
https://git.kernel.org/amlogic/c/77e2f4e3cbd5cde442d05a7bdb6cd01565bead6d

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

The v6.6/drivers-genpd 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

--
Neil