public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rickard Andersson <rickaran@axis.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>,
	<linux-kernel@vger.kernel.org>, <yibin.gong@nxp.com>
Cc: <rickaran@axis.com>, <rickard314.andersson@gmail.com>, <perdo@axis.com>
Subject: [PATCH 4/5] regulator: pca9450: Make warm reset on WDOG_B assertion
Date: Thu, 28 Apr 2022 16:01:38 +0200	[thread overview]
Message-ID: <20220428140139.7349-4-rickaran@axis.com> (raw)
In-Reply-To: <20220428140139.7349-1-rickaran@axis.com>

From: Rickard x Andersson <rickaran@axis.com>

The default configuration of the PMIC behavior makes the PMIC
power cycle most regulators on WDOG_B assertion. This power
cycling causes the memory contents of OCRAM to be lost.
Some systems neeeds some memory that survives reset and
reboot, therefore this patch is created.

Signed-off-by: Rickard x Andersson <rickaran@axis.com>
---
 drivers/regulator/pca9450-regulator.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index 87b4e6e29ba1..4a3ae73c600c 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -702,6 +702,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
 	struct regulator_config config = { };
 	struct pca9450 *pca9450;
 	unsigned int device_id, i;
+	unsigned int reset_ctrl;
 	int ret;
 
 	if (!i2c->irq) {
@@ -802,9 +803,14 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
+	if (of_property_read_bool(i2c->dev.of_node, "nxp,wdog_b-warm-reset"))
+		reset_ctrl = WDOG_B_CFG_WARM;
+	else
+		reset_ctrl = WDOG_B_CFG_COLD_LDO12;
+
 	/* Set reset behavior on assertion of WDOG_B signal */
 	ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL,
-				WDOG_B_CFG_MASK, WDOG_B_CFG_COLD_LDO12);
+				 WDOG_B_CFG_MASK, reset_ctrl);
 	if (ret) {
 		dev_err(&i2c->dev, "Failed to set WDOG_B reset behavior\n");
 		return ret;
-- 
2.20.1


  parent reply	other threads:[~2022-04-28 14:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
2022-04-28 14:01 ` [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable Rickard Andersson
2022-04-28 14:01 ` [PATCH 3/5] dt-bindings: regulator: Add property for WDOG_B warm reset Rickard Andersson
2022-04-28 14:01 ` Rickard Andersson [this message]
2022-04-28 14:01 ` [PATCH 5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ Rickard Andersson
2022-04-28 15:07 ` [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Mark Brown
2022-05-03 15:51 ` (subset) " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220428140139.7349-4-rickaran@axis.com \
    --to=rickaran@axis.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perdo@axis.com \
    --cc=rickard314.andersson@gmail.com \
    --cc=yibin.gong@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox