devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs
@ 2022-06-23 12:38 AngeloGioacchino Del Regno
  2022-06-23 12:38 ` [PATCH v2 1/2] soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs AngeloGioacchino Del Regno
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-06-23 12:38 UTC (permalink / raw)
  To: robh+dt
  Cc: krzysztof.kozlowski+dt, matthias.bgg, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel, wenst,
	AngeloGioacchino Del Regno

This is one of the steps to enable DVFS with the Panfrost driver:
since Panfrost is already enabling the (required) MFG power domains
and since the mtk-pm-domains driver is already responsible for
actually enabling the SRAM PDN, it makes sense to make sure that
the VSRAM supply is ON when trying to reset/enable the SRAM.

For this reason, the MTK_SCPD_DOMAIN_SUPPLY flag was added to one
more MFG domain, ensuring that the SRAM is actually powered and
also not relying on the bootloader leaving this supply on; on the
other hand, this is also making possible to avoid setting a
sram-supply on the GPU node, making devfreq happy about having
only one supply and finally allowing DVFS to happen.

If no domain-supply is declared in devicetree, mtk-pm-domains driver
probe will anyway keep going, so this is not breaking old devicetrees.

No side effects either when this supply is declared for both a MFG
domain and Panfrost together.

This series has no dependencies.

 Changes in v2:
  - Squashed all mtXXXX-pm-domains.h changes in one patch

AngeloGioacchino Del Regno (2):
  soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs
  arm64: dts: mediatek: mt8183-kukui: Assign sram supply to mfg_async pd

 arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 ++++
 arch/arm64/boot/dts/mediatek/mt8183.dtsi       | 2 +-
 drivers/soc/mediatek/mt8183-pm-domains.h       | 1 +
 drivers/soc/mediatek/mt8186-pm-domains.h       | 2 +-
 drivers/soc/mediatek/mt8192-pm-domains.h       | 2 ++
 drivers/soc/mediatek/mt8195-pm-domains.h       | 2 +-
 6 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs
  2022-06-23 12:38 [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs AngeloGioacchino Del Regno
@ 2022-06-23 12:38 ` AngeloGioacchino Del Regno
  2022-06-23 12:38 ` [PATCH v2 2/2] arm64: dts: mediatek: mt8183-kukui: Assign sram supply to mfg_async pd AngeloGioacchino Del Regno
  2022-07-07  8:22 ` [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs Matthias Brugger
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-06-23 12:38 UTC (permalink / raw)
  To: robh+dt
  Cc: krzysztof.kozlowski+dt, matthias.bgg, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel, wenst,
	AngeloGioacchino Del Regno

MediaTek SoCs have multiple MFG power-domains, exclusively used for
the GPU which, in turn, requires external power supplies: make sure
to have the MTK_SCPD_DOMAIN_SUPPLY cap on the two topmost MFGs to
allow voting for regulators on/off upon usage of these power domains.

This also ensures that the SRAM is actually powered and that we're
not relying on the bootloader leaving this supply on when performing
the first (and latter) poweron sequence for these domains' sram.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/soc/mediatek/mt8183-pm-domains.h | 1 +
 drivers/soc/mediatek/mt8186-pm-domains.h | 2 +-
 drivers/soc/mediatek/mt8192-pm-domains.h | 2 ++
 drivers/soc/mediatek/mt8195-pm-domains.h | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/mediatek/mt8183-pm-domains.h b/drivers/soc/mediatek/mt8183-pm-domains.h
index 71b8757e552d..99de67fe5de8 100644
--- a/drivers/soc/mediatek/mt8183-pm-domains.h
+++ b/drivers/soc/mediatek/mt8183-pm-domains.h
@@ -41,6 +41,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8183[] = {
 		.pwr_sta2nd_offs = 0x0184,
 		.sram_pdn_bits = 0,
 		.sram_pdn_ack_bits = 0,
+		.caps = MTK_SCPD_DOMAIN_SUPPLY,
 	},
 	[MT8183_POWER_DOMAIN_MFG] = {
 		.name = "mfg",
diff --git a/drivers/soc/mediatek/mt8186-pm-domains.h b/drivers/soc/mediatek/mt8186-pm-domains.h
index bf2dd0cdc3a8..108af61854a3 100644
--- a/drivers/soc/mediatek/mt8186-pm-domains.h
+++ b/drivers/soc/mediatek/mt8186-pm-domains.h
@@ -51,7 +51,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8186[] = {
 				MT8186_TOP_AXI_PROT_EN_1_CLR,
 				MT8186_TOP_AXI_PROT_EN_1_STA),
 		},
-		.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
+		.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
 	},
 	[MT8186_POWER_DOMAIN_MFG2] = {
 		.name = "mfg2",
diff --git a/drivers/soc/mediatek/mt8192-pm-domains.h b/drivers/soc/mediatek/mt8192-pm-domains.h
index 558c4ee4784a..b97b2051920f 100644
--- a/drivers/soc/mediatek/mt8192-pm-domains.h
+++ b/drivers/soc/mediatek/mt8192-pm-domains.h
@@ -58,6 +58,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8192[] = {
 		.pwr_sta2nd_offs = 0x0170,
 		.sram_pdn_bits = GENMASK(8, 8),
 		.sram_pdn_ack_bits = GENMASK(12, 12),
+		.caps = MTK_SCPD_DOMAIN_SUPPLY,
 	},
 	[MT8192_POWER_DOMAIN_MFG1] = {
 		.name = "mfg1",
@@ -85,6 +86,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8192[] = {
 				    MT8192_TOP_AXI_PROT_EN_2_CLR,
 				    MT8192_TOP_AXI_PROT_EN_2_STA1),
 		},
+		.caps = MTK_SCPD_DOMAIN_SUPPLY,
 	},
 	[MT8192_POWER_DOMAIN_MFG2] = {
 		.name = "mfg2",
diff --git a/drivers/soc/mediatek/mt8195-pm-domains.h b/drivers/soc/mediatek/mt8195-pm-domains.h
index 0529d130b675..d7387ea1b9c9 100644
--- a/drivers/soc/mediatek/mt8195-pm-domains.h
+++ b/drivers/soc/mediatek/mt8195-pm-domains.h
@@ -162,7 +162,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8195[] = {
 				    MT8195_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_CLR,
 				    MT8195_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_STA1),
 		},
-		.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
+		.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
 	},
 	[MT8195_POWER_DOMAIN_MFG2] = {
 		.name = "mfg2",
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] arm64: dts: mediatek: mt8183-kukui: Assign sram supply to mfg_async pd
  2022-06-23 12:38 [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs AngeloGioacchino Del Regno
  2022-06-23 12:38 ` [PATCH v2 1/2] soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs AngeloGioacchino Del Regno
@ 2022-06-23 12:38 ` AngeloGioacchino Del Regno
  2022-07-07  8:22 ` [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs Matthias Brugger
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-06-23 12:38 UTC (permalink / raw)
  To: robh+dt
  Cc: krzysztof.kozlowski+dt, matthias.bgg, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel, wenst,
	AngeloGioacchino Del Regno

Add a phandle to the MT8183_POWER_DOMAIN_MFG_ASYNC power domain and
assign the GPU VSRAM supply to this in mt8183-kukui: this allows to
keep the sram powered up while the GPU is used.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 ++++
 arch/arm64/boot/dts/mediatek/mt8183.dtsi       | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
index 89e4358f140a..33f3bf277ce9 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
@@ -821,6 +821,10 @@ cros_ec {
 	};
 };
 
+&mfg_async {
+	domain-supply = <&mt6358_vsram_gpu_reg>;
+};
+
 &mfg {
 	domain-supply = <&mt6358_vgpu_reg>;
 };
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 9485c1efc87c..9d32871973a2 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -788,7 +788,7 @@ power-domain@MT8183_POWER_DOMAIN_CONN {
 					#power-domain-cells = <0>;
 				};
 
-				power-domain@MT8183_POWER_DOMAIN_MFG_ASYNC {
+				mfg_async: power-domain@MT8183_POWER_DOMAIN_MFG_ASYNC {
 					reg = <MT8183_POWER_DOMAIN_MFG_ASYNC>;
 					clocks = <&topckgen CLK_TOP_MUX_MFG>;
 					clock-names = "mfg";
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs
  2022-06-23 12:38 [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs AngeloGioacchino Del Regno
  2022-06-23 12:38 ` [PATCH v2 1/2] soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs AngeloGioacchino Del Regno
  2022-06-23 12:38 ` [PATCH v2 2/2] arm64: dts: mediatek: mt8183-kukui: Assign sram supply to mfg_async pd AngeloGioacchino Del Regno
@ 2022-07-07  8:22 ` Matthias Brugger
  2 siblings, 0 replies; 4+ messages in thread
From: Matthias Brugger @ 2022-07-07  8:22 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, robh+dt
  Cc: krzysztof.kozlowski+dt, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, wenst



On 23/06/2022 14:38, AngeloGioacchino Del Regno wrote:
> This is one of the steps to enable DVFS with the Panfrost driver:
> since Panfrost is already enabling the (required) MFG power domains
> and since the mtk-pm-domains driver is already responsible for
> actually enabling the SRAM PDN, it makes sense to make sure that
> the VSRAM supply is ON when trying to reset/enable the SRAM.
> 
> For this reason, the MTK_SCPD_DOMAIN_SUPPLY flag was added to one
> more MFG domain, ensuring that the SRAM is actually powered and
> also not relying on the bootloader leaving this supply on; on the
> other hand, this is also making possible to avoid setting a
> sram-supply on the GPU node, making devfreq happy about having
> only one supply and finally allowing DVFS to happen.
> 
> If no domain-supply is declared in devicetree, mtk-pm-domains driver
> probe will anyway keep going, so this is not breaking old devicetrees.
> 
> No side effects either when this supply is declared for both a MFG
> domain and Panfrost together.
> 
> This series has no dependencies.

Both patches applied, thanks!

> 
>   Changes in v2:
>    - Squashed all mtXXXX-pm-domains.h changes in one patch
> 
> AngeloGioacchino Del Regno (2):
>    soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs
>    arm64: dts: mediatek: mt8183-kukui: Assign sram supply to mfg_async pd
> 
>   arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 ++++
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi       | 2 +-
>   drivers/soc/mediatek/mt8183-pm-domains.h       | 1 +
>   drivers/soc/mediatek/mt8186-pm-domains.h       | 2 +-
>   drivers/soc/mediatek/mt8192-pm-domains.h       | 2 ++
>   drivers/soc/mediatek/mt8195-pm-domains.h       | 2 +-
>   6 files changed, 10 insertions(+), 3 deletions(-)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-07  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 12:38 [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs AngeloGioacchino Del Regno
2022-06-23 12:38 ` [PATCH v2 1/2] soc: mediatek: mtk-pm-domains: Allow probing vreg supply on two MFGs AngeloGioacchino Del Regno
2022-06-23 12:38 ` [PATCH v2 2/2] arm64: dts: mediatek: mt8183-kukui: Assign sram supply to mfg_async pd AngeloGioacchino Del Regno
2022-07-07  8:22 ` [PATCH v2 0/2] Allow getting regulator on MFG for multiple SoCs Matthias Brugger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).