mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion
@ 2024-04-12  8:44 Fabio Aiuto
  2024-04-12  8:44 ` [PATCH v4 1/2] regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property Fabio Aiuto
  2024-04-12  8:44 ` [PATCH v4 2/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Fabio Aiuto
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Aiuto @ 2024-04-12  8:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Krzysztof Kozlowski, Rob Herring,
	Conor Dooley
  Cc: devicetree, linux-kernel

Hello all,

the following two patches add a property in devicetree
to mark a board which needs warm reset on PMIC_RST_B pin
assertion.

kr

---
v3 ---> v4:
	- improve "dt-bindings" patch commit log
	- drop yibin.gong@nxp.com email for failure report

v2 ---> v3:
	- split patch in two: bindings patch comes first
	- add missing mailing lists and maintainers
	- remove underscore in property name

v1 ---> v2:
	- Fix email addresses

Fabio Aiuto (2):
  regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property
  regulator: pca9450: make warm reset on PMIC_RST_B assertion

 .../bindings/regulator/nxp,pca9450-regulator.yaml     |  6 ++++++
 drivers/regulator/pca9450-regulator.c                 | 11 ++++++++---
 include/linux/regulator/pca9450.h                     |  6 ++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

-- 
2.34.1


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

* [PATCH v4 1/2] regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property
  2024-04-12  8:44 [PATCH v4 0/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Fabio Aiuto
@ 2024-04-12  8:44 ` Fabio Aiuto
  2024-04-13 10:58   ` Krzysztof Kozlowski
  2024-04-12  8:44 ` [PATCH v4 2/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Fabio Aiuto
  1 sibling, 1 reply; 4+ messages in thread
From: Fabio Aiuto @ 2024-04-12  8:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Krzysztof Kozlowski, Rob Herring,
	Conor Dooley
  Cc: devicetree, linux-kernel, Matteo Lisi, Mirko Ardinghi

The default configuration of the PMIC behavior makes the PMIC
power cycle most regulators on PMIC_RST_B assertion. This power
cycling causes the memory contents of OCRAM to be lost.
Some systems needs some memory that survives reset and
reboot, therefore add a property to mark the regulator as
performing warm resets on PMIC_RST_B assertion.

Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Mirko Ardinghi <mirko.ardinghi@engicam.com>
Signed-off-by: Fabio Aiuto <fabio.aiuto@engicam.com>
---
 .../bindings/regulator/nxp,pca9450-regulator.yaml           | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
index 849bfa50bdba..865b259dac37 100644
--- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
@@ -93,6 +93,12 @@ properties:
       When WDOG_B signal is asserted a warm reset will be done instead of cold
       reset.
 
+  nxp,pmic-rst-b-warm-reset:
+    type: boolean
+    description:
+      When PMIC_RST_B signal is asserted a warm reset will be done instead of cold
+      reset.
+
 required:
   - compatible
   - reg
-- 
2.34.1


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

* [PATCH v4 2/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion
  2024-04-12  8:44 [PATCH v4 0/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Fabio Aiuto
  2024-04-12  8:44 ` [PATCH v4 1/2] regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property Fabio Aiuto
@ 2024-04-12  8:44 ` Fabio Aiuto
  1 sibling, 0 replies; 4+ messages in thread
From: Fabio Aiuto @ 2024-04-12  8:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Krzysztof Kozlowski, Rob Herring,
	Conor Dooley
  Cc: devicetree, linux-kernel, Matteo Lisi, Mirko Ardinghi

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

This patch extends commit 2364a64d0673 ("regulator: pca9450:
Make warm reset on WDOG_B assertion") to the other reset
input source PMIC_RST_B as per pmic specs.

Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Mirko Ardinghi <mirko.ardinghi@engicam.com>
Signed-off-by: Fabio Aiuto <fabio.aiuto@engicam.com>
---
 drivers/regulator/pca9450-regulator.c | 11 ++++++++---
 include/linux/regulator/pca9450.h     |  6 ++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index be488c5dff14..3a7f238de1a5 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -999,11 +999,16 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
 	else
 		reset_ctrl = WDOG_B_CFG_COLD_LDO12;
 
-	/* Set reset behavior on assertion of WDOG_B signal */
+	if (of_property_read_bool(i2c->dev.of_node, "nxp,pmic-rst-b-warm-reset"))
+		reset_ctrl |= PMIC_RST_CFG_WARM;
+	else
+		reset_ctrl |= PMIC_RST_CFG_COLD_LDO12;
+
+	/* Set reset behavior on assertion of WDOG_B/PMIC_RST_B signal */
 	ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL,
-				 WDOG_B_CFG_MASK, reset_ctrl);
+				 WDOG_B_CFG_MASK | PMIC_RST_CFG_MASK, reset_ctrl);
 	if (ret) {
-		dev_err(&i2c->dev, "Failed to set WDOG_B reset behavior\n");
+		dev_err(&i2c->dev, "Failed to set WDOG_B/PMIC_RST_B reset behavior\n");
 		return ret;
 	}
 
diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h
index 243633c8dceb..d87f0b410b00 100644
--- a/include/linux/regulator/pca9450.h
+++ b/include/linux/regulator/pca9450.h
@@ -227,6 +227,12 @@ enum {
 #define WDOG_B_CFG_COLD_LDO12		0x80
 #define WDOG_B_CFG_COLD			0xC0
 
+#define PMIC_RST_CFG_MASK		0x30
+#define PMIC_RST_CFG_NONE		0x00
+#define PMIC_RST_CFG_WARM		0x10
+#define PMIC_RST_CFG_COLD_LDO12		0x20
+#define PMIC_RST_CFG_COLD		0x30
+
 /* PCA9450_REG_CONFIG2 bits */
 #define I2C_LT_MASK			0x03
 #define I2C_LT_FORCE_DISABLE		0x00
-- 
2.34.1


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

* Re: [PATCH v4 1/2] regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property
  2024-04-12  8:44 ` [PATCH v4 1/2] regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property Fabio Aiuto
@ 2024-04-13 10:58   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-13 10:58 UTC (permalink / raw)
  To: Fabio Aiuto, Mark Brown, Liam Girdwood, Rob Herring, Conor Dooley
  Cc: devicetree, linux-kernel, Matteo Lisi, Mirko Ardinghi

On 12/04/2024 10:44, Fabio Aiuto wrote:
> The default configuration of the PMIC behavior makes the PMIC
> power cycle most regulators on PMIC_RST_B assertion. This power
> cycling causes the memory contents of OCRAM to be lost.
> Some systems needs some memory that survives reset and
> reboot, therefore add a property to mark the regulator as
> performing warm resets on PMIC_RST_B assertion.
> 
> Cc: Matteo Lisi <matteo.lisi@engicam.com>
> Cc: Mirko Ardinghi <mirko.ardinghi@engicam.com>
> Signed-off-by: Fabio Aiuto <fabio.aiuto@engicam.com>
> ---

Discussion continues in v3.

Best regards,
Krzysztof


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

end of thread, other threads:[~2024-04-13 10:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12  8:44 [PATCH v4 0/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Fabio Aiuto
2024-04-12  8:44 ` [PATCH v4 1/2] regulator: dt-bindings: pca9450: add PMIC_RST_B warm reset property Fabio Aiuto
2024-04-13 10:58   ` Krzysztof Kozlowski
2024-04-12  8:44 ` [PATCH v4 2/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Fabio Aiuto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®