Add power controller driver support for Amlogic A4 SoC.
Signed-off-by: Xianwei Zhao <[email protected]>
---
Xianwei Zhao (3):
dt-bindings: power: add Amlogic A4 power domains
pmdomain: amlogic: Add support for A4 power domains controller
arm64: dts: amlogic: a4: add power domain controller node
.../bindings/power/amlogic,meson-sec-pwrc.yaml | 1 +
arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi | 4 ++++
arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi | 5 ++++
drivers/pmdomain/amlogic/meson-secure-pwrc.c | 28 ++++++++++++++++++++++
include/dt-bindings/power/amlogic,a4-pwrc.h | 21 ++++++++++++++++
5 files changed, 59 insertions(+)
---
base-commit: 456f4f5e6e6d3a2228501068a37ce13fe0b333d4
change-id: 20240528-a4_secpowerdomain-5eb005648930
Best regards,
--
Xianwei Zhao <[email protected]>
From: Xianwei Zhao <[email protected]>
Add support for A4 power controller. A4 power control
registers are in secure domain, and should be accessed by SMC.
Signed-off-by: Xianwei Zhao <[email protected]>
---
drivers/pmdomain/amlogic/meson-secure-pwrc.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/pmdomain/amlogic/meson-secure-pwrc.c b/drivers/pmdomain/amlogic/meson-secure-pwrc.c
index 4d5bda0d60fc..3a84d8a74a5e 100644
--- a/drivers/pmdomain/amlogic/meson-secure-pwrc.c
+++ b/drivers/pmdomain/amlogic/meson-secure-pwrc.c
@@ -14,6 +14,7 @@
#include <dt-bindings/power/amlogic,c3-pwrc.h>
#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 <linux/arm-smccc.h>
#include <linux/firmware/meson/meson_sm.h>
#include <linux/module.h>
@@ -136,6 +137,24 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
SEC_PD(RSA, 0),
};
+static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
+ SEC_PD(A4_AUDIO, 0),
+ SEC_PD(A4_SDIOA, 0),
+ SEC_PD(A4_EMMC, 0),
+ SEC_PD(A4_USB_COMB, 0),
+ SEC_PD(A4_ETH, 0),
+ SEC_PD(A4_VOUT, 0),
+ SEC_PD(A4_AUDIO_PDM, 0),
+ /* DMC is for DDR PHY ana/dig and DMC, and should be always on */
+ SEC_PD(A4_DMC, GENPD_FLAG_ALWAYS_ON),
+ /* WRAP is secure_top, a lot of modules are included, and should be always on */
+ SEC_PD(A4_SYS_WRAP, GENPD_FLAG_ALWAYS_ON),
+ SEC_PD(A4_AO_I2C_S, 0),
+ SEC_PD(A4_AO_UART, 0),
+ /* IR is wake up trigger source, and should be always on */
+ SEC_PD(A4_AO_IR, GENPD_FLAG_ALWAYS_ON),
+};
+
static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
SEC_PD(C3_NNA, 0),
SEC_PD(C3_AUDIO, 0),
@@ -311,6 +330,11 @@ static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
.count = ARRAY_SIZE(a1_pwrc_domains),
};
+static struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
+ .domains = a4_pwrc_domains,
+ .count = ARRAY_SIZE(a4_pwrc_domains),
+};
+
static struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
.domains = c3_pwrc_domains,
.count = ARRAY_SIZE(c3_pwrc_domains),
@@ -331,6 +355,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = {
.compatible = "amlogic,meson-a1-pwrc",
.data = &meson_secure_a1_pwrc_data,
},
+ {
+ .compatible = "amlogic,a4-pwrc",
+ .data = &amlogic_secure_a4_pwrc_data,
+ },
{
.compatible = "amlogic,c3-pwrc",
.data = &amlogic_secure_c3_pwrc_data,
--
2.37.1
On 28/05/2024 10:39, Xianwei Zhao via B4 Relay wrote:
> From: Xianwei Zhao <[email protected]>
>
> Add support for A4 power controller. A4 power control
> registers are in secure domain, and should be accessed by SMC.
>
> Signed-off-by: Xianwei Zhao <[email protected]>
> ---
> drivers/pmdomain/amlogic/meson-secure-pwrc.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/pmdomain/amlogic/meson-secure-pwrc.c b/drivers/pmdomain/amlogic/meson-secure-pwrc.c
> index 4d5bda0d60fc..3a84d8a74a5e 100644
> --- a/drivers/pmdomain/amlogic/meson-secure-pwrc.c
> +++ b/drivers/pmdomain/amlogic/meson-secure-pwrc.c
> @@ -14,6 +14,7 @@
> #include <dt-bindings/power/amlogic,c3-pwrc.h>
> #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 <linux/arm-smccc.h>
> #include <linux/firmware/meson/meson_sm.h>
> #include <linux/module.h>
> @@ -136,6 +137,24 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
> SEC_PD(RSA, 0),
> };
>
> +static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
> + SEC_PD(A4_AUDIO, 0),
> + SEC_PD(A4_SDIOA, 0),
> + SEC_PD(A4_EMMC, 0),
> + SEC_PD(A4_USB_COMB, 0),
> + SEC_PD(A4_ETH, 0),
> + SEC_PD(A4_VOUT, 0),
> + SEC_PD(A4_AUDIO_PDM, 0),
> + /* DMC is for DDR PHY ana/dig and DMC, and should be always on */
> + SEC_PD(A4_DMC, GENPD_FLAG_ALWAYS_ON),
> + /* WRAP is secure_top, a lot of modules are included, and should be always on */
> + SEC_PD(A4_SYS_WRAP, GENPD_FLAG_ALWAYS_ON),
> + SEC_PD(A4_AO_I2C_S, 0),
> + SEC_PD(A4_AO_UART, 0),
> + /* IR is wake up trigger source, and should be always on */
> + SEC_PD(A4_AO_IR, GENPD_FLAG_ALWAYS_ON),
> +};
> +
> static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
> SEC_PD(C3_NNA, 0),
> SEC_PD(C3_AUDIO, 0),
> @@ -311,6 +330,11 @@ static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
> .count = ARRAY_SIZE(a1_pwrc_domains),
> };
>
> +static struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
> + .domains = a4_pwrc_domains,
> + .count = ARRAY_SIZE(a4_pwrc_domains),
> +};
> +
> static struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
> .domains = c3_pwrc_domains,
> .count = ARRAY_SIZE(c3_pwrc_domains),
> @@ -331,6 +355,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = {
> .compatible = "amlogic,meson-a1-pwrc",
> .data = &meson_secure_a1_pwrc_data,
> },
> + {
> + .compatible = "amlogic,a4-pwrc",
> + .data = &amlogic_secure_a4_pwrc_data,
> + },
> {
> .compatible = "amlogic,c3-pwrc",
> .data = &amlogic_secure_c3_pwrc_data,
>
Reviewed-by: Neil Armstrong <[email protected]>
From: Xianwei Zhao <[email protected]>
Add power domain controller node for Amlogic A4 SoC
Signed-off-by: Xianwei Zhao <[email protected]>
---
arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi | 4 ++++
arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
index b6106ad4a072..eebde77ae5b4 100644
--- a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
@@ -27,6 +27,10 @@ xtal: xtal-clk {
#clock-cells = <0>;
};
+ sm: secure-monitor {
+ compatible = "amlogic,meson-gxbb-sm";
+ };
+
soc {
compatible = "simple-bus";
#address-cells = <2>;
diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
index 73ca1d7eed81..917c05219b9c 100644
--- a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
+++ b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
@@ -37,4 +37,9 @@ cpu3: cpu@3 {
enable-method = "psci";
};
};
+
+ pwrc: power-controller {
+ compatible = "amlogic,a4-pwrc";
+ #power-domain-cells = <1>;
+ };
};
--
2.37.1
On 28/05/2024 10:39, Xianwei Zhao via B4 Relay wrote:
> From: Xianwei Zhao <[email protected]>
>
> Add power domain controller node for Amlogic A4 SoC
>
> Signed-off-by: Xianwei Zhao <[email protected]>
> ---
> arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi | 4 ++++
> arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
> index b6106ad4a072..eebde77ae5b4 100644
> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
> @@ -27,6 +27,10 @@ xtal: xtal-clk {
> #clock-cells = <0>;
> };
>
> + sm: secure-monitor {
> + compatible = "amlogic,meson-gxbb-sm";
> + };
> +
> soc {
> compatible = "simple-bus";
> #address-cells = <2>;
> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
> index 73ca1d7eed81..917c05219b9c 100644
> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
> @@ -37,4 +37,9 @@ cpu3: cpu@3 {
> enable-method = "psci";
> };
> };
> +
> + pwrc: power-controller {
> + compatible = "amlogic,a4-pwrc";
> + #power-domain-cells = <1>;
> + };
pwrc is supposed to be a child of secure-monitor.
Neil
> };
>
Hi Neil,
Thanks for your quickly reply.
On 2024/5/28 16:46, Neil Armstrong wrote:
> [ EXTERNAL EMAIL ]
>
> On 28/05/2024 10:39, Xianwei Zhao via B4 Relay wrote:
>> From: Xianwei Zhao <[email protected]>
>>
>> Add power domain controller node for Amlogic A4 SoC
>>
>> Signed-off-by: Xianwei Zhao <[email protected]>
>> ---
>> arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi | 4 ++++
>> arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi | 5 +++++
>> 2 files changed, 9 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>> b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>> index b6106ad4a072..eebde77ae5b4 100644
>> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>> @@ -27,6 +27,10 @@ xtal: xtal-clk {
>> #clock-cells = <0>;
>> };
>>
>> + sm: secure-monitor {
>> + compatible = "amlogic,meson-gxbb-sm";
>> + };
>> +
>> soc {
>> compatible = "simple-bus";
>> #address-cells = <2>;
>> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>> b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>> index 73ca1d7eed81..917c05219b9c 100644
>> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>> @@ -37,4 +37,9 @@ cpu3: cpu@3 {
>> enable-method = "psci";
>> };
>> };
>> +
>> + pwrc: power-controller {
>> + compatible = "amlogic,a4-pwrc";
>> + #power-domain-cells = <1>;
>> + };
>
> pwrc is supposed to be a child of secure-monitor.
>
Considered writing it like this when I wrote this.
Here are two approaches: one is to include secure-monitor in the comm
dtsi and fill power-controller by aliases in dtsi of each chip, while
the other is to directly include secure-monitor in the dtsi of each
chip. Which one do you suggest?
> Neil
>
>> };
>>
>
On 28/05/2024 11:00, Xianwei Zhao wrote:
> Hi Neil,
> Thanks for your quickly reply.
>
> On 2024/5/28 16:46, Neil Armstrong wrote:
>> [ EXTERNAL EMAIL ]
>>
>> On 28/05/2024 10:39, Xianwei Zhao via B4 Relay wrote:
>>> From: Xianwei Zhao <[email protected]>
>>>
>>> Add power domain controller node for Amlogic A4 SoC
>>>
>>> Signed-off-by: Xianwei Zhao <[email protected]>
>>> ---
>>> arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi | 4 ++++
>>> arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi | 5 +++++
>>> 2 files changed, 9 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>> index b6106ad4a072..eebde77ae5b4 100644
>>> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>> @@ -27,6 +27,10 @@ xtal: xtal-clk {
>>> #clock-cells = <0>;
>>> };
>>>
>>> + sm: secure-monitor {
>>> + compatible = "amlogic,meson-gxbb-sm";
>>> + };
>>> +
>>> soc {
>>> compatible = "simple-bus";
>>> #address-cells = <2>;
>>> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>> index 73ca1d7eed81..917c05219b9c 100644
>>> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>> @@ -37,4 +37,9 @@ cpu3: cpu@3 {
>>> enable-method = "psci";
>>> };
>>> };
>>> +
>>> + pwrc: power-controller {
>>> + compatible = "amlogic,a4-pwrc";
>>> + #power-domain-cells = <1>;
>>> + };
>>
>> pwrc is supposed to be a child of secure-monitor.
>>
> Considered writing it like this when I wrote this.
>
> Here are two approaches: one is to include secure-monitor in the comm dtsi and fill power-controller by aliases in dtsi of each chip, while the other is to directly include secure-monitor in the dtsi of each chip. Which one do you suggest?
The bindings mandates it to be a child of the secure monitor.
Neil
>
>> Neil
>>
>>> };
>>>
>>
Hi Neil,
Thanks for your reply.
On 2024/5/28 17:08, [email protected] wrote:
> [ EXTERNAL EMAIL ]
>
> On 28/05/2024 11:00, Xianwei Zhao wrote:
>> Hi Neil,
>> Thanks for your quickly reply.
>>
>> On 2024/5/28 16:46, Neil Armstrong wrote:
>>> [ EXTERNAL EMAIL ]
>>>
>>> On 28/05/2024 10:39, Xianwei Zhao via B4 Relay wrote:
>>>> From: Xianwei Zhao <[email protected]>
>>>>
>>>> Add power domain controller node for Amlogic A4 SoC
>>>>
>>>> Signed-off-by: Xianwei Zhao <[email protected]>
>>>> ---
>>>> arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi | 4 ++++
>>>> arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi | 5 +++++
>>>> 2 files changed, 9 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>>> b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>>> index b6106ad4a072..eebde77ae5b4 100644
>>>> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>>> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi
>>>> @@ -27,6 +27,10 @@ xtal: xtal-clk {
>>>> #clock-cells = <0>;
>>>> };
>>>>
>>>> + sm: secure-monitor {
>>>> + compatible = "amlogic,meson-gxbb-sm";
>>>> + };
>>>> +
>>>> soc {
>>>> compatible = "simple-bus";
>>>> #address-cells = <2>;
>>>> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>>> b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>>> index 73ca1d7eed81..917c05219b9c 100644
>>>> --- a/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>>> +++ b/arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi
>>>> @@ -37,4 +37,9 @@ cpu3: cpu@3 {
>>>> enable-method = "psci";
>>>> };
>>>> };
>>>> +
>>>> + pwrc: power-controller {
>>>> + compatible = "amlogic,a4-pwrc";
>>>> + #power-domain-cells = <1>;
>>>> + };
>>>
>>> pwrc is supposed to be a child of secure-monitor.
>>>
>> Considered writing it like this when I wrote this.
>>
>> Here are two approaches: one is to include secure-monitor in the comm
>> dtsi and fill power-controller by aliases in dtsi of each chip, while
>> the other is to directly include secure-monitor in the dtsi of each
>> chip. Which one do you suggest?
>
> The bindings mandates it to be a child of the secure monitor.
>
Will fix it.
> Neil
>
>>
>>> Neil
>>>
>>>> };
>>>>
>>>
>
Hi,
On Tue, 28 May 2024 16:39:27 +0800, Xianwei Zhao wrote:
> Add power controller driver support for Amlogic A4 SoC.
>
>
Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.11/arm64-dt)
[1/3] dt-bindings: power: add Amlogic A4 power domains
(no commit info)
[2/3] pmdomain: amlogic: Add support for A4 power domains controller
(no commit info)
[3/3] arm64: dts: amlogic: a4: add power domain controller node
https://git.kernel.org/amlogic/c/c830ead0d16131de93d2020369ede4d670a4123b
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
--
Neil