[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250501-bd718x7-snvs-reset-v1-1-1fcc7088200e@geanix.com>
Date: Thu, 01 May 2025 16:48:35 +0200
From: Esben Haabendal <esben@...nix.com>
To: Matti Vaittinen <mazziesaccount@...il.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org, Esben Haabendal <esben@...nix.com>
Subject: [PATCH] regulator: bd718x7: Ensure SNVS power state is used as
requested
With the introduction of the rohm,reset-snvs-powered DT binding [2], the
PMIC settings were only changed when the new property was not found.
As mentioned in [1] the default for BD71387 and BD71847 is to switch to
SNVS power state on watchdog reset.
So even with rohm,reset-snvs-powered added to DT, a watchdog reset causes
transitions through READY instead of SNVS. And with the default reboot
method in mxc_restart() is to cause a watchdog reset, we ended up powering
off the SNVS domains, and thus losing SNVS state such as SNVS RTC and
LPGPR, on reboots.
With this change, the rohm,reset-snvs-powered property results in the PMIC
configuration being modified so POWEROFF transitions to SNVS for all reset
types, including watchdog reset.
[1] commit e770b18bbbae ("regulator: bd718x7: Change next state after poweroff to ready")
[2] commit 049369d46428 ("regulator: bd718x7: Support SNVS low power state")
Signed-off-by: Esben Haabendal <esben@...nix.com>
---
drivers/regulator/bd718x7-regulator.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/regulator/bd718x7-regulator.c b/drivers/regulator/bd718x7-regulator.c
index 1bb048de3ecd5a8df1087a48afc728a64623a024..d8c7fb2e73986a39066c9e8a114dd8d733bc8a33 100644
--- a/drivers/regulator/bd718x7-regulator.c
+++ b/drivers/regulator/bd718x7-regulator.c
@@ -1715,23 +1715,24 @@ static int bd718xx_probe(struct platform_device *pdev)
"rohm,reset-snvs-powered");
/*
- * Change the next stage from poweroff to be READY instead of SNVS
- * for all reset types because OTP loading at READY will clear SEL
- * bit allowing HW defaults for power rails to be used
+ * Set next power state from poweroff to be either READY or SNVS for all
+ * reset types. The default is READY state because OTP loading at READY
+ * will clear SEL bit allowing HW defaults for power rails to be used.
+ * Using SNVS power state instead allows SNVS state, such as RTC and
+ * LPGPR to be persisted over reboots.
*/
- if (!use_snvs) {
- err = regmap_update_bits(regmap, BD718XX_REG_TRANS_COND1,
- BD718XX_ON_REQ_POWEROFF_MASK |
- BD718XX_SWRESET_POWEROFF_MASK |
- BD718XX_WDOG_POWEROFF_MASK |
- BD718XX_KEY_L_POWEROFF_MASK,
- BD718XX_POWOFF_TO_RDY);
- if (err)
- return dev_err_probe(&pdev->dev, err,
- "Failed to change reset target\n");
-
- dev_dbg(&pdev->dev, "Changed all resets from SVNS to READY\n");
- }
+ err = regmap_update_bits(regmap, BD718XX_REG_TRANS_COND1,
+ BD718XX_ON_REQ_POWEROFF_MASK |
+ BD718XX_SWRESET_POWEROFF_MASK |
+ BD718XX_WDOG_POWEROFF_MASK |
+ BD718XX_KEY_L_POWEROFF_MASK,
+ use_snvs ? 0 : BD718XX_POWOFF_TO_RDY);
+ if (err)
+ return dev_err_probe(&pdev->dev, err,
+ "Failed to change reset target\n");
+
+ dev_dbg(&pdev->dev, "Changed all resets from %s to %s\n",
+ use_snvs ? "READY" : "SNVS", use_snvs ? "SNVS" : "READY");
config.dev = pdev->dev.parent;
config.regmap = regmap;
---
base-commit: b4432656b36e5cc1d50a1f2dc15357543add530e
change-id: 20250501-bd718x7-snvs-reset-186d934b37c1
Best regards,
--
Esben Haabendal <esben@...nix.com>
Powered by blists - more mailing lists