drivers: soc: xilinx: Add support for ZynqMP power domain driver
Subsystems (2)
v2 cover drivers: soc: xilinx: Add support for ZynqMP power domain driver
The zynqmp power domain driver communicates the usage requirements for logical power domains / devices to the platform FW. FW is responsible for choosing appropriate power states, taking Linux' usage information into account.
This patch series is based on top of Xilinx firmware patch set:
https://patchwork.kernel.org/cover/10555405/
v2:
- Rebased on top of latest firmware driver patch series
- Updated driver name from zynqmp-genpd to zynqmp-power-controller
- Updated device tree bindings to move power controller node under firmware node
Jolly Shah (1):
drivers: soc: xilinx: Add ZynqMP power domain driver
Rajan Vaja (2):
dt-bindings: power: Add ZynqMP power domain bindings
firmware: xilinx: Add APIs to control node status/power
.../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47 +++ drivers/firmware/xilinx/zynqmp.c | 58 ++++ drivers/soc/xilinx/Kconfig | 9 + drivers/soc/xilinx/Makefile | 2 + drivers/soc/xilinx/zynqmp_pm_domains.c | 352 +++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 26 ++ 6 files changed, 494 insertions(+) create mode 100644 drivers/soc/xilinx/zynqmp_pm_domains.c
Signature · 1 line
2.7.4
PATCH v2 1/3 dt-bindings: power: Add ZynqMP power domain bindings
From: Rajan Vaja <[email protected]>
Add documentation to describe ZynqMP power domain bindings.
--- .../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+)
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +47 -0
@@ -64,6 +64,29 @@ Output clocks are registered based on clock information received from firmware. Output clocks indexes are mentioned in include/dt-bindings/clock/xlnx,zynqmp-clk.h. +----------------------------------------------------------- +Device Tree Bindings for the Xilinx Zynq MPSoC PM domains +----------------------------------------------------------- +The binding for zynqmp-power-controller follow the common +generic PM domain binding[1]. + +[1] Documentation/devicetree/bindings/power/power_domain.txt + +== Zynq MPSoC Generic PM Domain Node == + +Required properties: + - compatible: Must be: "xlnx,zynqmp-power-controller" + +This node contains a number of subnodes, each representing a single PM domain +that PM domain consumer devices reference. + +== PM Domain Nodes == + +Required properties: + - #power-domain-cells: Number of cells in a PM domain specifier. Must be 0. + - pd-id: Domain identifier as defined by platform firmware. + This identifier is passed to the PM firmware. + ------- Example -------
@@ -78,5 +101,29 @@ firmware { clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>, <&aux_ref_clk>, <>_crx_ref_clk>; clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk","aux_ref_clk", "gt_crx_ref_clk"; }; + zynqmp-power-controller { + compatible = "xlnx,zynqmp-power-controller"; + + pd_usb0: pd-usb0 { + pd-id = <22>; + #power-domain-cells = <0>; + }; + + pd_sata: pd-sata { + pd-id = <28>; + #power-domain-cells = <0>; + }; + + pd_gpu : pd-gpu { + pd-id = <58 20 21>; + #power-domain-cells = <0>; + }; + }; }; }; + +sata0: ahci at SATA_AHCI_HBA { + ... + power-domains = <&pd_sata>; + ... +};
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindings
Quoted 8 lines · Jolly Shah
From: Rajan Vaja <[email protected]>
Add documentation to describe ZynqMP power domain bindings.
Signed-off-by Rajan Vaja <[email protected]>Signed-off-by Jolly Shah <[email protected]>--- .../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47 ++++++++++++++++++++++
This should be with all the other power domain bindings.
Quoted 22 lines
1 file changed, 47 insertions(+)Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +12
-0@@ -64,6 +64,29 @@ Output clocks are registered based on clock information received from firmware. Output clocks indexes are mentioned in include/dt-bindings/clock/xlnx,zynqmp-clk.h. +----------------------------------------------------------- +Device Tree Bindings for the Xilinx Zynq MPSoC PM domains +----------------------------------------------------------- +The binding for zynqmp-power-controller follow the common +generic PM domain binding[1]. + +[1] Documentation/devicetree/bindings/power/power_domain.txt + +== Zynq MPSoC Generic PM Domain Node == + +Required properties: + - compatible: Must be: "xlnx,zynqmp-power-controller"
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received · line 88
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +10
-0+ +This node contains a number of subnodes, each representing a single PM domain +that PM domain consumer devices reference. + +== PM Domain Nodes == + +Required properties: + - #power-domain-cells: Number of cells in a PM domain specifier. Must be 0. + - pd-id: Domain identifier as defined by platform firmware. + This identifier is passed to the PM firmware.
Make this a cell for the power domain consumer.
Quoted 20 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +13
-0+ ------- Example -------@@ -78,5 +101,29 @@ firmware { clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>, <&aux_ref_clk>, <>_crx_ref_clk>; clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk","aux_ref_clk", "gt_crx_ref_clk"; }; + zynqmp-power-controller { + compatible = "xlnx,zynqmp-power-controller"; + + pd_usb0: pd-usb0 { + pd-id = <22>; + #power-domain-cells = <0>; + }; + + pd_sata: pd-sata { + pd-id = <28>; + #power-domain-cells = <0>; + };
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt firmware { · line 125
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +8
-0+ + pd_gpu : pd-gpu { + pd-id = <58 20 21>; + #power-domain-cells = <0>; + }; + }; }; }; + +sata0: ahci at SATA_AHCI_HBA {
Don't use defines in unit-addresses (or reg for that matter). It's pointless indirection.
Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +4
-0+ ... + power-domains = <&pd_sata>; + ... +};Signature · 1 line
2.7.4
RE: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindings
Hi Rob,
Quoted 19 lines
-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Monday, August 20, 2018 12:46 PM
To: Jolly Shah <[email protected]>
Cc: matthias.bgg at gmail.com; andy.gross at linaro.org; shawnguo at kernel.org; geert+renesas at glider.be; bjorn.andersson at linaro.org; sean.wang at mediatek.com; m.szyprowski at samsung.com; Michal Simek <[email protected]>; mark.rutland at arm.com; Rajan Vaja <[email protected]>; devicetree at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>
Subject: Re: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindingsQuoted 4 lines · Jolly Shah
From: Rajan Vaja <[email protected]>
Add documentation to describe ZynqMP power domain bindings.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Rajan Vaja <[email protected]>Signed-off-by Jolly Shah <[email protected]>--- .../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47++++++++++++++++++++++
This should be with all the other power domain bindings.
The firmware node has clock, reset and power domain subnodes. Please suggest the right location for binding.
Quoted 38 lines
Quoted 27 lines
1 file changed, 47 insertions(+)diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt
index d215d15..5fa10a0 100644
---
a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi +++ rmware.txt(quoted diff) +0
-0@@ -64,6 +64,29 @@ Output clocks are registered based on clockinformation received from firmware. Output clocks indexes are mentioned in
include/dt-bindings/clock/xlnx,zynqmp-clk.h.+-----------------------------------------------------------
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +9
-0+Device Tree Bindings for the Xilinx Zynq MPSoC PM domains +----------------------------------------------------------- +The binding for zynqmp-power-controller follow the common generic PM +domain binding[1]. + +[1] Documentation/devicetree/bindings/power/power_domain.txt + +== Zynq MPSoC Generic PM Domain Node == +Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +10
-0+Required properties: + - compatible: Must be: "xlnx,zynqmp-power-controller" + +This node contains a number of subnodes, each representing a single +PM domain that PM domain consumer devices reference. + +== PM Domain Nodes == + +Required properties: + - #power-domain-cells: Number of cells in a PM domain specifier. Mustbe 0.
Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received · line 88
Quoted 2 lines
+ - pd-id: Domain identifier as defined by platform firmware.
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +1
-0+ This identifier is passed to the PM firmware.Make this a cell for the power domain consumer.
I am not clear here. Do you suggest to move pd-id property under consumer nodes? Right now, consumer nodes use power-domains property as below:
usb0: usb0 at ff9d0000 {
#address-cells = <2>;
...................................................
power-domains = <&pd_usb0>;
};Thanks,
Jolly Shah
Quoted 43 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt firmware { · line 101
Quoted 6 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +1
-0+ ------- Example -------@@ -78,5 +101,29 @@ firmware { clocks = <&pss_ref_clk>, <&video_clk>,<
&pss_alt_ref_clk>, <&aux_ref_clk>, <>_crx_ref_clk>;Review firmware { · line 102
Quoted 1 line
(quoted diff) +0
-0clock-names = "pss_ref_clk", "video_clk","pss_alt_ref_clk","aux_ref_clk", "
gt_crx_ref_clk";Quoted 13 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +12
-0}; + zynqmp-power-controller { + compatible = "xlnx,zynqmp-power-controller"; + + pd_usb0: pd-usb0 { + pd-id = <22>; + #power-domain-cells = <0>; + }; + + pd_sata: pd-sata { + pd-id = <28>; + #power-domain-cells = <0>; + };Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt firmware { · line 125
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +8
-0+ + pd_gpu : pd-gpu { + pd-id = <58 20 21>; + #power-domain-cells = <0>; + }; + }; }; }; + +sata0: ahci at SATA_AHCI_HBA {Don't use defines in unit-addresses (or reg for that matter). It's pointless indirection.
Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +4
-1+ ... + power-domains = <&pd_sata>; + ... +}; --2.7.4
RE: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindings
In reply to Rob HerringHi Rob,
Quoted 65 lines
-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Monday, August 20, 2018 12:46 PM
To: Jolly Shah <[email protected]>
Cc: matthias.bgg at gmail.com; andy.gross at linaro.org; shawnguo at kernel.org; geert+renesas at glider.be; bjorn.andersson at linaro.org; sean.wang at mediatek.com; m.szyprowski at samsung.com; Michal Simek <[email protected]>; mark.rutland at arm.com; Rajan Vaja <[email protected]>; devicetree at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>
Subject: Re: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindingsQuoted 8 lines · Jolly Shah
From: Rajan Vaja <[email protected]>
Add documentation to describe ZynqMP power domain bindings.
Signed-off-by Rajan Vaja <[email protected]>Signed-off-by Jolly Shah <[email protected]>--- .../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47++++++++++++++++++++++
This should be with all the other power domain bindings.
Quoted 27 lines
1 file changed, 47 insertions(+)diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt
index d215d15..5fa10a0 100644
---
a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi +++ rmware.txt(quoted diff) +0
-0@@ -64,6 +64,29 @@ Output clocks are registered based on clockinformation received from firmware. Output clocks indexes are mentioned in
include/dt-bindings/clock/xlnx,zynqmp-clk.h.+-----------------------------------------------------------
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +9
-0+Device Tree Bindings for the Xilinx Zynq MPSoC PM domains +----------------------------------------------------------- +The binding for zynqmp-power-controller follow the common generic PM +domain binding[1]. + +[1] Documentation/devicetree/bindings/power/power_domain.txt + +== Zynq MPSoC Generic PM Domain Node == +Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +10
-0+Required properties: + - compatible: Must be: "xlnx,zynqmp-power-controller" + +This node contains a number of subnodes, each representing a single +PM domain that PM domain consumer devices reference. + +== PM Domain Nodes == + +Required properties: + - #power-domain-cells: Number of cells in a PM domain specifier. Mustbe 0.
Quoted 4 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received · line 88
Quoted 2 lines
+ - pd-id: Domain identifier as defined by platform firmware.
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +1
-0+ This identifier is passed to the PM firmware.Make this a cell for the power domain consumer.
[Jolly] We have more than one Ids for GPU device. Also they don't have parent child relationship and hence are defined as flat hierarchy. (shown in example below)
Thanks,
Jolly Shah
Quoted 44 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt firmware { · line 101
Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +1
-0+ ------- Example -------@@ -78,5 +101,29 @@ firmware { clocks = <&pss_ref_clk>, <&video_clk>,<
&pss_alt_ref_clk>, <&aux_ref_clk>, <>_crx_ref_clk>;Review firmware { · line 102
Quoted 1 line
(quoted diff) +0
-0clock-names = "pss_ref_clk", "video_clk","pss_alt_ref_clk","aux_ref_clk", "
gt_crx_ref_clk";Quoted 13 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +12
-0}; + zynqmp-power-controller { + compatible = "xlnx,zynqmp-power-controller"; + + pd_usb0: pd-usb0 { + pd-id = <22>; + #power-domain-cells = <0>; + }; + + pd_sata: pd-sata { + pd-id = <28>; + #power-domain-cells = <0>; + };Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt firmware { · line 125
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +8
-0+ + pd_gpu : pd-gpu { + pd-id = <58 20 21>; + #power-domain-cells = <0>; + }; + }; }; }; + +sata0: ahci at SATA_AHCI_HBA {Don't use defines in unit-addresses (or reg for that matter). It's pointless indirection.
Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +4
-1+ ... + power-domains = <&pd_sata>; + ... +}; --2.7.4
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindings
Quoted 68 lines · Jolly Shah
Hi Rob,
Quoted 65 lines
-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Monday, August 20, 2018 12:46 PM
To: Jolly Shah <[email protected]>
Cc: matthias.bgg at gmail.com; andy.gross at linaro.org; shawnguo at kernel.org; geert+renesas at glider.be; bjorn.andersson at linaro.org; sean.wang at mediatek.com; m.szyprowski at samsung.com; Michal Simek <[email protected]>; mark.rutland at arm.com; Rajan Vaja <[email protected]>; devicetree at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>
Subject: Re: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindingsQuoted 8 lines · Jolly Shah
From: Rajan Vaja <[email protected]>
Add documentation to describe ZynqMP power domain bindings.
Signed-off-by Rajan Vaja <[email protected]>Signed-off-by Jolly Shah <[email protected]>--- .../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47++++++++++++++++++++++
This should be with all the other power domain bindings.
Quoted 27 lines
1 file changed, 47 insertions(+)diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt
index d215d15..5fa10a0 100644
---
a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa re.txt
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi +++ rmware.txt(quoted diff) +0
-0@@ -64,6 +64,29 @@ Output clocks are registered based on clockinformation received from firmware. Output clocks indexes are mentioned in
include/dt-bindings/clock/xlnx,zynqmp-clk.h.+-----------------------------------------------------------
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +9
-0+Device Tree Bindings for the Xilinx Zynq MPSoC PM domains +----------------------------------------------------------- +The binding for zynqmp-power-controller follow the common generic PM +domain binding[1]. + +[1] Documentation/devicetree/bindings/power/power_domain.txt + +== Zynq MPSoC Generic PM Domain Node == +Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +10
-0+Required properties: + - compatible: Must be: "xlnx,zynqmp-power-controller" + +This node contains a number of subnodes, each representing a single +PM domain that PM domain consumer devices reference. + +== PM Domain Nodes == + +Required properties: + - #power-domain-cells: Number of cells in a PM domain specifier. Mustbe 0.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
+ - pd-id: Domain identifier as defined by platform firmware.
+ This identifier is passed to the PM firmware.Make this a cell for the power domain consumer.
[Jolly] We have more than one Ids for GPU device. Also they don't have parent child relationship and hence are defined as flat hierarchy. (shown in example below)
Then the gpu node should have:
power-domains = <&pd 58 &pd 20 &pd 21>;
Also, for this and the firmware reset binding, there is no reason that I see to make these all subnodes. A single firmware node can be a provider of multiple functions. You only need child nodes if the sub-functions have their own resources (clks, irqs, etc.). IOW, don't create nodes just because you want to instantiate drivers that way. DT is not the only way to instantiate devices for drivers.
Rob
RE: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindings
Hi Rob,
Quoted 100 lines
-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Tuesday, September 25, 2018 9:15 AM
To: Jolly Shah <[email protected]>
Cc: Matthias Brugger <[email protected]>; Andy Gross <[email protected]>; Shawn Guo <[email protected]>; Geert Uytterhoeven <[email protected]>; Bjorn Andersson <[email protected]>; Sean Wang <[email protected]>; Marek Szyprowski <[email protected]>; Michal Simek <[email protected]>; Mark Rutland <[email protected]>; Rajan Vaja <[email protected]>; devicetree at vger.kernel.org; moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE <linux-arm- kernel at lists.infradead.org>; linux-kernel at vger.kernel.org
Subject: Re: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindingsQuoted 73 lines · Jolly Shah
Hi Rob,
Quoted 70 lines
-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Monday, August 20, 2018 12:46 PM
To: Jolly Shah <[email protected]>
Cc: matthias.bgg at gmail.com; andy.gross at linaro.org; shawnguo at kernel.org;
geert+renesas at glider.be; bjorn.andersson at linaro.org; sean.wang at mediatek.com; m.szyprowski at samsung.com; Michal Simek <[email protected]>; mark.rutland at arm.com; Rajan Vaja <[email protected]>; devicetree at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>
Subject: Re: [PATCH v2 1/3] dt-bindings: power: Add ZynqMP power domain bindingsQuoted 8 lines · Jolly Shah
From: Rajan Vaja <[email protected]>
Add documentation to describe ZynqMP power domain bindings.
Signed-off-by Rajan Vaja <[email protected]>Signed-off-by Jolly Shah <[email protected]>--- .../firmware/xilinx/xlnx,zynqmp-firmware.txt | 47++++++++++++++++++++++
This should be with all the other power domain bindings.
Quoted 31 lines
1 file changed, 47 insertions(+)diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi rmwa
re.txt b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi rmwa
re.txt
index d215d15..5fa10a0 100644
---
a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi rmwa
re.txt
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm +++ p-fi
+++ rmware.txt(quoted diff) +0
-0@@ -64,6 +64,29 @@ Output clocks are registered based on clockinformation received from firmware. Output clocks indexes are mentioned in
include/dt-bindings/clock/xlnx,zynqmp-clk.h.+-----------------------------------------------------------
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +9
-0+Device Tree Bindings for the Xilinx Zynq MPSoC PM domains +----------------------------------------------------------- +The binding for zynqmp-power-controller follow the common generic +PM domain binding[1]. + +[1] Documentation/devicetree/bindings/power/power_domain.txt + +== Zynq MPSoC Generic PM Domain Node == +Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt Output clocks are registered based on clock information received
Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +10
-0+Required properties: + - compatible: Must be: "xlnx,zynqmp-power-controller" + +This node contains a number of subnodes, each representing a +single PM domain that PM domain consumer devices reference. + +== PM Domain Nodes == + +Required properties: + - #power-domain-cells: Number of cells in a PM domain specifier. Mustbe 0.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
+ - pd-id: Domain identifier as defined by platform firmware.
+ This identifier is passed to the PM firmware.Make this a cell for the power domain consumer.
[Jolly] We have more than one Ids for GPU device. Also they don't have parent child relationship and hence are defined as flat hierarchy. (shown in example below)
Then the gpu node should have:
Quoted 9 lines
power-domains = <&pd 58 &pd 20 &pd 21>;
Also, for this and the firmware reset binding, there is no reason that I see to make these all subnodes. A single firmware node can be a provider of multiple functions. You only need child nodes if the sub-functions have their own resources (clks, irqs, etc.). IOW, don't create nodes just because you want to instantiate drivers that way. DT is not the only way to instantiate devices for drivers.
Got it. Pushed v3 with suggested changes. Please review.
Quoted 1 line
Rob
PATCH v2 2/3 firmware: xilinx: Add APIs to control node status/power
In reply to Jolly ShahFrom: Rajan Vaja <[email protected]>
Add Xilinx ZynqMP firmware APIs to control node status and power. These APIs allows turning on/off power domain and setting capabilities of devices present in power domain.
--- drivers/firmware/xilinx/zynqmp.c | 58 ++++++++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 26 ++++++++++++++++ 2 files changed, 84 insertions(+)
drivers/firmware/xilinx/zynqmp.c +58 -0
@@ -447,6 +447,61 @@ static int zynqmp_pm_clock_getparent(u32 clock_id, u32 *parent_id)return ret; } +/** +* zynqmp_pm_request_node() - Request a node with specific capabilities +* @node: Node ID of the slave +* @capabilities: Requested capabilities of the slave +* @qos: Quality of service (not supported) +* @ack: Flag to specify whether acknowledge is requested +* +* This function is used by master to request particular node from firmware. +* Every master must request node before using it. +* +* Return: Returns status, either success or error+reason +*/ +static int zynqmp_pm_request_node (const u32 node,const u32 capabilities, +const u32 qos, +const enum zynqmp_pm_request_ack ack) +{ +return zynqmp_pm_invoke_fn (PM_REQUEST_NODE , node, capabilities, + qos, ack,NULL ); +} + +/** +* zynqmp_pm_release_node() - Release a node +* @node: Node ID of the slave +* +* This function is used by master to inform firmware that master +* has released node. Once released, master must not use that node +* without re-request. +* +* Return: Returns status, either success or error+reason +*/ +static int zynqmp_pm_release_node (const u32 node) +{ +return zynqmp_pm_invoke_fn (PM_RELEASE_NODE , node,0 ,0 ,0 ,NULL ); +} + +/** +* zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves +* @node: Node ID of the slave +* @capabilities: Requested capabilities of the slave +* @qos: Quality of service (not supported) +* @ack: Flag to specify whether acknowledge is requested +* +* This API function is to be used for slaves a PU already has requested +* to change its capabilities. +* +* Return: Returns status, either success or error+reason +*/ +static int zynqmp_pm_set_requirement (const u32 node,const u32 capabilities, +const u32 qos, +const enum zynqmp_pm_request_ack ack) +{ +return zynqmp_pm_invoke_fn (PM_SET_REQUIREMENT , node, capabilities, + qos, ack,NULL ); +} +static const struct zynqmp_eemi_ops eemi_ops = { .get_api_version = zynqmp_pm_get_api_version, .ioctl = zynqmp_pm_ioctl,
@@ -460,6 +515,9 @@ static const struct zynqmp_eemi_ops eemi_ops = { .clock_getrate = zynqmp_pm_clock_getrate, .clock_setparent = zynqmp_pm_clock_setparent, .clock_getparent = zynqmp_pm_clock_getparent, + .request_node = zynqmp_pm_request_node, + .release_node = zynqmp_pm_release_node, + .set_requirement = zynqmp_pm_set_requirement, };/**
include/linux/firmware/xlnx-zynqmp.h +26 -0
@@ -32,8 +32,19 @@/* Number of 32bits values in payload */ #define PAYLOAD_ARG_CNT 4U +#define ZYNQMP_PM_MAX_QOS 100U + +/* Node capabilities */ +#define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U +#define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U +#define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U +#define ZYNQMP_PM_CAPABILITY_POWER 0x8U +enum pm_api_id {PM_GET_API_VERSION =1 , +PM_REQUEST_NODE =13 , +PM_RELEASE_NODE , +PM_SET_REQUIREMENT ,PM_IOCTL =34 ,PM_QUERY_DATA ,PM_CLOCK_ENABLE ,
@@ -75,6 +86,12 @@ enum pm_query_id { PM_QID_CLOCK_GET_NUM_CLOCKS = 12, }; +enum zynqmp_pm_request_ack { +ZYNQMP_PM_REQUEST_ACK_NO =1 , +ZYNQMP_PM_REQUEST_ACK_BLOCKING , +ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING , +}; +/** * struct zynqmp_pm_query_data - PM query data * @qid: query ID
@@ -102,6 +119,15 @@ struct zynqmp_eemi_ops {int (*clock_getrate)(u32 clock_id,u64 *rate);int (*clock_setparent)(u32 clock_id,u32 parent_id);int (*clock_getparent)(u32 clock_id,u32 *parent_id); +int (*request_node)(const u32 node, +const u32 capabilities, +const u32 qos, +const enum zynqmp_pm_request_ack ack); +int (*release_node)(const u32 node); +int (*set_requirement)(const u32 node, +const u32 capabilities, +const u32 qos, +const enum zynqmp_pm_request_ack ack); };#if IS_REACHABLE (CONFIG_ARCH_ZYNQMP )
Signature · 1 line
2.7.4
PATCH v2 3/3 drivers: soc: xilinx: Add ZynqMP power domain driver
In reply to Jolly ShahFrom: Jolly Shah <[email protected]>
The zynqmp-genpd driver communicates the usage requirements for logical power domains / devices to the platform FW. FW is responsible for choosing appropriate power states, taking Linux' usage information into account.
--- drivers/soc/xilinx/Kconfig | 9 + drivers/soc/xilinx/Makefile | 2 + drivers/soc/xilinx/zynqmp_pm_domains.c | 352 +++++++++++++++++++++++++++++++++ 3 files changed, 363 insertions(+) create mode 100644 drivers/soc/xilinx/zynqmp_pm_domains.c
drivers/soc/xilinx/Kconfig +9 -0
@@ -17,4 +17,13 @@ config XILINX_VCU To compile this driver as a module, choose M here: the module will be called xlnx_vcu. +config ZYNQMP_PM_DOMAINS + bool "Enable Zynq MPSoC generic PM domains" + default y + depends on PM && ARCH_ZYNQMP + select PM_GENERIC_DOMAINS + help + Say yes to enable device power management through PM domains + If in doubt, say N. + endmenu
drivers/soc/xilinx/Makefile +2 -0
@@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_XILINX_VCU) += xlnx_vcu.o + +obj-$(CONFIG_ZYNQMP_PM_DOMAINS) += zynqmp_pm_domains.o
drivers/soc/xilinx/zynqmp_pm_domains.c new file +352 -0
352 lines not on this page · raw message
Signature · 1 line
2.7.4