Skip to contentSkip to conversation

soc: mediatek: pm-domains: Fix the power glitch issue

PATCH In review Chun-Jie Chen 3 participants 5 messages Mar 10, 2022 – Mar 11, 2022 Arm MediaTek

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: mediatek: pm-domains: Fix the power glitch issue

Power reset maybe generate unexpected signal. In order to avoid the glitch issue, we need to enable isolation first to guarantee the stable signal when power reset is triggered.

Fixes 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains")

---
This patch is based on 5.17-rc1.

---
 drivers/soc/mediatek/mtk-pm-domains.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/mediatek/mtk-pm-domains.c +1 -1
index b762bc40f56b..0195f6c3396b 100644
@@ -272,9 +272,9 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
 	clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks);
 
 	/* subsys power off */
-	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
 	regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT);
 	regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT);
+	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
 	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT);
 	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT);
 
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Chun-Jie Chen

Power reset maybe generate unexpected signal. In order to avoid the glitch issue, we need to enable isolation first to guarantee the stable signal when power reset is triggered.

Fixes 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains")
Quoted 29 lines

---
This patch is based on 5.17-rc1.

---
 drivers/soc/mediatek/mtk-pm-domains.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/mediatek/mtk-pm-domains.c +1 -2
index b762bc40f56b..0195f6c3396b 100644
@@ -272,9 +272,9 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
        clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks);
 
        /* subsys power off */
-       regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
        regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT);
        regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT);
+       regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
        regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT);
        regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT);
 
--

2.18.0

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#2 lore raw
In reply to Chun-Jie Chen

Hi Chun-Jie,

Quoted 17 lines

Power reset maybe generate unexpected signal. In order to avoid the glitch issue, we need to enable isolation first to guarantee the stable signal when power reset is triggered.

Fixes 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains")

---
This patch is based on 5.17-rc1.
---
drivers/soc/mediatek/mtk-pm-domains.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/mediatek/mtk-pm-domains.c +0 -0
index b762bc40f56b..0195f6c3396b 100644

drivers/soc/mediatek/mtk-pm-domains.c static int scpsys_power_off(struct generic_pm_domain *genpd) · line 279

Quoted 9 lines
drivers/soc/mediatek/mtk-pm-domains.c +1 -1
@@ -272,9 +272,9 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
 	clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks);
 
 	/* subsys power off */
-	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
 	regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT);
 	regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT);
+	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
 	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT);
 	regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT);

Does it mean that we have to do power off by:
regmap_set_bits(PWR_ISO_BIT)
regmap_clear_bits(PWR_RST_B_BIT )

and do power on by:
regmap_set_bits(PWR_RST_B_BIT)
regmap_clear_bits(PWR_ISO_BIT)

But scpsys_power_on() has the following sequence:
regmap_clear_bits(PWR_ISO_BIT)
regmap_set_bits(PWR_RST_B_BIT)

Thanks,
Miles

#3 lore raw
Quoted 48 lines · Miles Chen

Hi Chun-Jie,

Quoted 35 lines

Power reset maybe generate unexpected signal. In order to avoid the glitch issue, we need to enable isolation first to guarantee the
stable signal when power reset is triggered.

Fixes 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power

domains")

---
This patch is based on 5.17-rc1.
---
drivers/soc/mediatek/mtk-pm-domains.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/mediatek/mtk-pm-domains.c +0 -1
index b762bc40f56b..0195f6c3396b 100644
@@ -272,9 +272,9 @@ static int scpsys_power_off(struct
 generic_pm_domain *genpd)
 	clk_bulk_disable_unprepare(pd->num_subsys_clks, pd-
 >subsys_clks);
 
 	/* subsys power off */
-	regmap_clear_bits(scpsys->base, pd->data->ctl_offs,
 PWR_RST_B_BIT);
 	regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT);
 	regmap_set_bits(scpsys->base, pd->data->ctl_offs,

PWR_CLK_DIS_BIT);

drivers/soc/mediatek/mtk-pm-domains.c +1 -0
+	regmap_clear_bits(scpsys->base, pd->data->ctl_offs,
PWR_RST_B_BIT);
	regmap_clear_bits(scpsys->base, pd->data->ctl_offs,
PWR_ON_2ND_BIT);
	regmap_clear_bits(scpsys->base, pd->data->ctl_offs,
Quoted 1 line

PWR_ON_BIT);

Does it mean that we have to do power off by:
regmap_set_bits(PWR_ISO_BIT)
regmap_clear_bits(PWR_RST_B_BIT )

and do power on by:
regmap_set_bits(PWR_RST_B_BIT)
regmap_clear_bits(PWR_ISO_BIT)

Quoted 6 lines

But scpsys_power_on() has the following sequence:
regmap_clear_bits(PWR_ISO_BIT)
regmap_set_bits(PWR_RST_B_BIT)

Thanks,
Miles

Hi Miles,

This control sequence is suggested by hardware designer, and when PWR_RST_B from 0 -> 1, it will trigger to exit from reset state to running state, if we still enable isolation then can't start running normally, so we need to disable isolation first in power on sequence.

Thanks!

Reviewed-by
#4 lore raw

Hi Chun-Jie,

Quoted 8 lines

Hi Miles,

This control sequence is suggested by hardware designer, and when PWR_RST_B from 0 -> 1, it will trigger to exit from reset state to running state, if we still enable isolation then can't start running normally, so we need to disable isolation first in power on sequence.

Thanks for your explanation.

Thanks,
Miles