Skip to contentSkip to conversation

regulator: pca9450: make warm reset on PMIC_RST_B assertion

PATCH Superseded Fabio Aiuto 3 participants 7 messages Apr 11, 2024

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover regulator: pca9450: make warm reset on PMIC_RST_B assertion

Hello all,

sorry for spamming, this one have the correct email addresses. This patch adds a property for to control reset behavior on PMIC_RST_B assertion.

---
v1 ---> v2:
- Fix email addresses

Fabio Aiuto (1):
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(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 regulator: pca9450: make warm reset on PMIC_RST_B assertion

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 <[email protected]>
CC Mirko Ardinghi <[email protected]>
---
 .../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(-)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +6 -0
index 849bfa50bdba..1030375a8578 100644
@@ -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
drivers/regulator/pca9450-regulator.c +8 -3
index be488c5dff14..6e3823032e6c 100644
@@ -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;
 	}
 
include/linux/regulator/pca9450.h +6 -0
index 243633c8dceb..d87f0b410b00 100644
@@ -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
Signature · 1 line
2.34.1
#2 lore raw
Quoted 10 lines · Fabio Aiuto

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.

Quoted 5 lines
CC Matteo Lisi <[email protected]>
CC Mirko Ardinghi <[email protected]>
---
 .../bindings/regulator/nxp,pca9450-regulator.yaml     |  6 ++++++

Please run scripts/checkpatch.pl and fix reported warnings. Then please run scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Quoted 4 lines
 drivers/regulator/pca9450-regulator.c                 | 11 ++++++++---
 include/linux/regulator/pca9450.h                     |  6 ++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline), work on fork of kernel (don't, instead use mainline) or you ignore some maintainers (really don't). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.

Please kindly resend and include all necessary To/Cc entries.

Also: underscores are not allowed in property names.

Best regards,
Krzysztof

#3 lore raw

Dear Krzysztof,

Il Thu, Apr 11, 2024 at 04:46:06PM +0200, Krzysztof Kozlowski ha scritto:

Quoted 45 lines · Fabio Aiuto
Quoted 10 lines

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.

Quoted 5 lines
CC Matteo Lisi <[email protected]>
CC Mirko Ardinghi <[email protected]>
---
 .../bindings/regulator/nxp,pca9450-regulator.yaml     |  6 ++++++

Please run scripts/checkpatch.pl and fix reported warnings. Then please run scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Quoted 4 lines
 drivers/regulator/pca9450-regulator.c                 | 11 ++++++++---
 include/linux/regulator/pca9450.h                     |  6 ++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline), work on fork of kernel (don't, instead use mainline) or you ignore some maintainers (really don't). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.

Quoted 5 lines

Please kindly resend and include all necessary To/Cc entries.

Also: underscores are not allowed in property names.

thanks a lot for all suggestions, will send a patchset soon.

kind regards,

fabio

Quoted 4 lines

Best regards,
Krzysztof

maintainer
#4 lore raw
In reply to Fabio Aiuto
Quoted 5 lines · Fabio Aiuto

Hello all,

sorry for spamming, this one have the correct email addresses. This patch adds a property for to control reset behavior on PMIC_RST_B assertion.

Please don't send cover letters for single patches, if there is anything that needs saying put it in the changelog of the patch or after the --- if it's administrative stuff. This reduces mail volume and ensures that any important information is recorded in the changelog rather than being lost.

#5 lore raw

Dear Mark,

Il Thu, Apr 11, 2024 at 01:37:48PM +0100, Mark Brown ha scritto:

Quoted 7 lines · Fabio Aiuto
Quoted 5 lines

Hello all,

sorry for spamming, this one have the correct email addresses. This patch adds a property for to control reset behavior on PMIC_RST_B assertion.

Quoted 5 lines

Please don't send cover letters for single patches, if there is anything that needs saying put it in the changelog of the patch or after the --- if it's administrative stuff. This reduces mail volume and ensures that any important information is recorded in the changelog rather than being lost.

I've got it, thanks. Do you want me to send a v3 or are you taking in consideration this one?

kr

fabio

maintainer
#6 lore raw
Quoted 2 lines · Fabio Aiuto

I've got it, thanks. Do you want me to send a v3 or are you taking in consideration this one?

No, it's fine this time - just a note for next time.