* [v3 PATCH] soc: mediatek: Add support always on flag
@ 2022-05-20 3:03 ` Chunfeng Yun
0 siblings, 0 replies; 6+ messages in thread
From: Chunfeng Yun @ 2022-05-20 3:03 UTC (permalink / raw)
To: Matthias Brugger
Cc: linux-arm-kernel, linux-mediatek, linux-kernel, Min Guo,
MandyJH Liu, Eddie Hung, Jianjun Wang, Rafael J . Wysocki,
Kevin Hilman, Ulf Hansson, Chunfeng Yun
There is a t-phy shared by PCIe and USB3 on mt8195, if the t-phy is
used by PCIe, when power off its mtcmos, need software reset it
(workaround way, usually hardware do it, but has an issue on mt8195),
but it has side effect to USB2 phy(works with USB3 phy to support
USB3.2 Gen1), so add support GENPD_FLAG_ALWAYS_ON flag, and make its
power always on;
Another reason is that USB3.2 Gen1/2 need keep power always on when
support runtime-pm due to hardware limitation until now;
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v3: make always-on flag exclusive with defualt-off flag
v2: keep active_wakeup flag for mt8195
---
drivers/soc/mediatek/mt8195-pm-domains.h | 2 +-
drivers/soc/mediatek/mtk-pm-domains.c | 3 +++
drivers/soc/mediatek/mtk-pm-domains.h | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/mediatek/mt8195-pm-domains.h b/drivers/soc/mediatek/mt8195-pm-domains.h
index 938f4d51f5ae..0529d130b675 100644
--- a/drivers/soc/mediatek/mt8195-pm-domains.h
+++ b/drivers/soc/mediatek/mt8195-pm-domains.h
@@ -67,7 +67,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8195[] = {
.ctl_offs = 0x334,
.pwr_sta_offs = 0x174,
.pwr_sta2nd_offs = 0x178,
- .caps = MTK_SCPD_ACTIVE_WAKEUP,
+ .caps = MTK_SCPD_ACTIVE_WAKEUP | MTK_SCPD_ALWAYS_ON,
},
[MT8195_POWER_DOMAIN_CSI_RX_TOP] = {
.name = "csi_rx_top",
diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
index 5ced254b082b..a3dae391a38a 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.c
+++ b/drivers/soc/mediatek/mtk-pm-domains.c
@@ -428,6 +428,9 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret);
goto err_put_subsys_clocks;
}
+
+ if (MTK_SCPD_CAPS(pd, MTK_SCPD_ALWAYS_ON))
+ pd->genpd.flags |= GENPD_FLAG_ALWAYS_ON;
}
if (scpsys->domains[id]) {
diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h
index daa24e890dd4..7d3c0c36316c 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.h
+++ b/drivers/soc/mediatek/mtk-pm-domains.h
@@ -8,6 +8,8 @@
#define MTK_SCPD_SRAM_ISO BIT(2)
#define MTK_SCPD_KEEP_DEFAULT_OFF BIT(3)
#define MTK_SCPD_DOMAIN_SUPPLY BIT(4)
+/* can't set MTK_SCPD_KEEP_DEFAULT_OFF at the same time */
+#define MTK_SCPD_ALWAYS_ON BIT(5)
#define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x))
#define SPM_VDE_PWR_CON 0x0210
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [v3 PATCH] soc: mediatek: Add support always on flag
@ 2022-05-20 3:03 ` Chunfeng Yun
0 siblings, 0 replies; 6+ messages in thread
From: Chunfeng Yun @ 2022-05-20 3:03 UTC (permalink / raw)
To: Matthias Brugger
Cc: linux-arm-kernel, linux-mediatek, linux-kernel, Min Guo,
MandyJH Liu, Eddie Hung, Jianjun Wang, Rafael J . Wysocki,
Kevin Hilman, Ulf Hansson, Chunfeng Yun
There is a t-phy shared by PCIe and USB3 on mt8195, if the t-phy is
used by PCIe, when power off its mtcmos, need software reset it
(workaround way, usually hardware do it, but has an issue on mt8195),
but it has side effect to USB2 phy(works with USB3 phy to support
USB3.2 Gen1), so add support GENPD_FLAG_ALWAYS_ON flag, and make its
power always on;
Another reason is that USB3.2 Gen1/2 need keep power always on when
support runtime-pm due to hardware limitation until now;
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v3: make always-on flag exclusive with defualt-off flag
v2: keep active_wakeup flag for mt8195
---
drivers/soc/mediatek/mt8195-pm-domains.h | 2 +-
drivers/soc/mediatek/mtk-pm-domains.c | 3 +++
drivers/soc/mediatek/mtk-pm-domains.h | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/mediatek/mt8195-pm-domains.h b/drivers/soc/mediatek/mt8195-pm-domains.h
index 938f4d51f5ae..0529d130b675 100644
--- a/drivers/soc/mediatek/mt8195-pm-domains.h
+++ b/drivers/soc/mediatek/mt8195-pm-domains.h
@@ -67,7 +67,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8195[] = {
.ctl_offs = 0x334,
.pwr_sta_offs = 0x174,
.pwr_sta2nd_offs = 0x178,
- .caps = MTK_SCPD_ACTIVE_WAKEUP,
+ .caps = MTK_SCPD_ACTIVE_WAKEUP | MTK_SCPD_ALWAYS_ON,
},
[MT8195_POWER_DOMAIN_CSI_RX_TOP] = {
.name = "csi_rx_top",
diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
index 5ced254b082b..a3dae391a38a 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.c
+++ b/drivers/soc/mediatek/mtk-pm-domains.c
@@ -428,6 +428,9 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret);
goto err_put_subsys_clocks;
}
+
+ if (MTK_SCPD_CAPS(pd, MTK_SCPD_ALWAYS_ON))
+ pd->genpd.flags |= GENPD_FLAG_ALWAYS_ON;
}
if (scpsys->domains[id]) {
diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h
index daa24e890dd4..7d3c0c36316c 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.h
+++ b/drivers/soc/mediatek/mtk-pm-domains.h
@@ -8,6 +8,8 @@
#define MTK_SCPD_SRAM_ISO BIT(2)
#define MTK_SCPD_KEEP_DEFAULT_OFF BIT(3)
#define MTK_SCPD_DOMAIN_SUPPLY BIT(4)
+/* can't set MTK_SCPD_KEEP_DEFAULT_OFF at the same time */
+#define MTK_SCPD_ALWAYS_ON BIT(5)
#define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x))
#define SPM_VDE_PWR_CON 0x0210
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [v3 PATCH] soc: mediatek: Add support always on flag
@ 2022-05-20 3:03 ` Chunfeng Yun
0 siblings, 0 replies; 6+ messages in thread
From: Chunfeng Yun @ 2022-05-20 3:03 UTC (permalink / raw)
To: Matthias Brugger
Cc: linux-arm-kernel, linux-mediatek, linux-kernel, Min Guo,
MandyJH Liu, Eddie Hung, Jianjun Wang, Rafael J . Wysocki,
Kevin Hilman, Ulf Hansson, Chunfeng Yun
There is a t-phy shared by PCIe and USB3 on mt8195, if the t-phy is
used by PCIe, when power off its mtcmos, need software reset it
(workaround way, usually hardware do it, but has an issue on mt8195),
but it has side effect to USB2 phy(works with USB3 phy to support
USB3.2 Gen1), so add support GENPD_FLAG_ALWAYS_ON flag, and make its
power always on;
Another reason is that USB3.2 Gen1/2 need keep power always on when
support runtime-pm due to hardware limitation until now;
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v3: make always-on flag exclusive with defualt-off flag
v2: keep active_wakeup flag for mt8195
---
drivers/soc/mediatek/mt8195-pm-domains.h | 2 +-
drivers/soc/mediatek/mtk-pm-domains.c | 3 +++
drivers/soc/mediatek/mtk-pm-domains.h | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/mediatek/mt8195-pm-domains.h b/drivers/soc/mediatek/mt8195-pm-domains.h
index 938f4d51f5ae..0529d130b675 100644
--- a/drivers/soc/mediatek/mt8195-pm-domains.h
+++ b/drivers/soc/mediatek/mt8195-pm-domains.h
@@ -67,7 +67,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8195[] = {
.ctl_offs = 0x334,
.pwr_sta_offs = 0x174,
.pwr_sta2nd_offs = 0x178,
- .caps = MTK_SCPD_ACTIVE_WAKEUP,
+ .caps = MTK_SCPD_ACTIVE_WAKEUP | MTK_SCPD_ALWAYS_ON,
},
[MT8195_POWER_DOMAIN_CSI_RX_TOP] = {
.name = "csi_rx_top",
diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
index 5ced254b082b..a3dae391a38a 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.c
+++ b/drivers/soc/mediatek/mtk-pm-domains.c
@@ -428,6 +428,9 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret);
goto err_put_subsys_clocks;
}
+
+ if (MTK_SCPD_CAPS(pd, MTK_SCPD_ALWAYS_ON))
+ pd->genpd.flags |= GENPD_FLAG_ALWAYS_ON;
}
if (scpsys->domains[id]) {
diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h
index daa24e890dd4..7d3c0c36316c 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.h
+++ b/drivers/soc/mediatek/mtk-pm-domains.h
@@ -8,6 +8,8 @@
#define MTK_SCPD_SRAM_ISO BIT(2)
#define MTK_SCPD_KEEP_DEFAULT_OFF BIT(3)
#define MTK_SCPD_DOMAIN_SUPPLY BIT(4)
+/* can't set MTK_SCPD_KEEP_DEFAULT_OFF at the same time */
+#define MTK_SCPD_ALWAYS_ON BIT(5)
#define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x))
#define SPM_VDE_PWR_CON 0x0210
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] soc: mediatek: Add support always on flag
2022-05-20 3:03 ` Chunfeng Yun
(?)
@ 2022-05-23 11:11 ` AngeloGioacchino Del Regno
-1 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-05-23 11:11 UTC (permalink / raw)
To: Chunfeng Yun, Matthias Brugger
Cc: linux-arm-kernel, linux-mediatek, linux-kernel, Min Guo,
MandyJH Liu, Eddie Hung, Jianjun Wang, Rafael J . Wysocki,
Kevin Hilman, Ulf Hansson
Il 20/05/22 05:03, Chunfeng Yun ha scritto:
> There is a t-phy shared by PCIe and USB3 on mt8195, if the t-phy is
> used by PCIe, when power off its mtcmos, need software reset it
> (workaround way, usually hardware do it, but has an issue on mt8195),
> but it has side effect to USB2 phy(works with USB3 phy to support
> USB3.2 Gen1), so add support GENPD_FLAG_ALWAYS_ON flag, and make its
> power always on;
> Another reason is that USB3.2 Gen1/2 need keep power always on when
> support runtime-pm due to hardware limitation until now;
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
All these quirks are making this situation very unfortunate. I don't
really like setting GENPD_FLAG_ALWAYS_ON, but I recognize that there's
nothing else to do to fix that.
After all, this power domain is going to stay up for >=95% of the time
anyway even if we handle this in the various drivers instead of setting
it as always on and.. in the end, it's not worth the effort if we're
saving power in the order of a few microamps per hour.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] soc: mediatek: Add support always on flag
@ 2022-05-23 11:11 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-05-23 11:11 UTC (permalink / raw)
To: Chunfeng Yun, Matthias Brugger
Cc: linux-arm-kernel, linux-mediatek, linux-kernel, Min Guo,
MandyJH Liu, Eddie Hung, Jianjun Wang, Rafael J . Wysocki,
Kevin Hilman, Ulf Hansson
Il 20/05/22 05:03, Chunfeng Yun ha scritto:
> There is a t-phy shared by PCIe and USB3 on mt8195, if the t-phy is
> used by PCIe, when power off its mtcmos, need software reset it
> (workaround way, usually hardware do it, but has an issue on mt8195),
> but it has side effect to USB2 phy(works with USB3 phy to support
> USB3.2 Gen1), so add support GENPD_FLAG_ALWAYS_ON flag, and make its
> power always on;
> Another reason is that USB3.2 Gen1/2 need keep power always on when
> support runtime-pm due to hardware limitation until now;
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
All these quirks are making this situation very unfortunate. I don't
really like setting GENPD_FLAG_ALWAYS_ON, but I recognize that there's
nothing else to do to fix that.
After all, this power domain is going to stay up for >=95% of the time
anyway even if we handle this in the various drivers instead of setting
it as always on and.. in the end, it's not worth the effort if we're
saving power in the order of a few microamps per hour.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] soc: mediatek: Add support always on flag
@ 2022-05-23 11:11 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-05-23 11:11 UTC (permalink / raw)
To: Chunfeng Yun, Matthias Brugger
Cc: linux-arm-kernel, linux-mediatek, linux-kernel, Min Guo,
MandyJH Liu, Eddie Hung, Jianjun Wang, Rafael J . Wysocki,
Kevin Hilman, Ulf Hansson
Il 20/05/22 05:03, Chunfeng Yun ha scritto:
> There is a t-phy shared by PCIe and USB3 on mt8195, if the t-phy is
> used by PCIe, when power off its mtcmos, need software reset it
> (workaround way, usually hardware do it, but has an issue on mt8195),
> but it has side effect to USB2 phy(works with USB3 phy to support
> USB3.2 Gen1), so add support GENPD_FLAG_ALWAYS_ON flag, and make its
> power always on;
> Another reason is that USB3.2 Gen1/2 need keep power always on when
> support runtime-pm due to hardware limitation until now;
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
All these quirks are making this situation very unfortunate. I don't
really like setting GENPD_FLAG_ALWAYS_ON, but I recognize that there's
nothing else to do to fix that.
After all, this power domain is going to stay up for >=95% of the time
anyway even if we handle this in the various drivers instead of setting
it as always on and.. in the end, it's not worth the effort if we're
saving power in the order of a few microamps per hour.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-23 11:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 3:03 [v3 PATCH] soc: mediatek: Add support always on flag Chunfeng Yun
2022-05-20 3:03 ` Chunfeng Yun
2022-05-20 3:03 ` Chunfeng Yun
2022-05-23 11:11 ` AngeloGioacchino Del Regno
2022-05-23 11:11 ` AngeloGioacchino Del Regno
2022-05-23 11:11 ` AngeloGioacchino Del Regno
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.