mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jonas Rebmann <jre@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Jonas Rebmann <jre@pengutronix.de>
Subject: [PATCH v2 1/2] mfd: pca9450: configure pmic reset behavior
Date: Thu, 13 Mar 2025 10:21:18 +0100	[thread overview]
Message-ID: <20250313-pca9450-wdog-v2-1-28e97e7da480@pengutronix.de> (raw)
In-Reply-To: <20250313-pca9450-wdog-v2-0-28e97e7da480@pengutronix.de>

Currently, boards using the pca9450 pmic driver initialize the
RESET_CTRL register either in lowlevel.c or board.c explicitly to 0xA1
to enable the watchdog for Cold Reset with all voltage regulators
recycled except LDO1/ LDO2 in addition to the default configuration of
0x11 where the WDOG_B watchdog input is disabled.

Instead, enable the watchdog in the driver for Cold Reset with all
voltage regulators recycled except LDO1/ LDO2. When
nxp,wdog_b-warm-reset is set, the watchdog is instead enabled for Warm
Reset.

This is identical to U-Boot's behaviour since commit 910c7a881f5 ("pmic:
pca9450: Make warm reset on WDOG_B assertion") and Linux's since commit
2364a64d0673f ("regulator: pca9450: Make warm reset on WDOG_B
assertion").

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 drivers/mfd/pca9450.c | 10 ++++++++++
 include/mfd/pca9450.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/mfd/pca9450.c b/drivers/mfd/pca9450.c
index 2511e662c3dfb5dfedbc461357ffa82d1812166f..5d5d3d8e017232a45676efad390a503500dd2156 100644
--- a/drivers/mfd/pca9450.c
+++ b/drivers/mfd/pca9450.c
@@ -103,6 +103,16 @@ static int __init pca9450_probe(struct device *dev)
 	/* Chip ID defined in bits [7:4] */
 	dev_info(dev, "PMIC Chip ID: 0x%x\n", (reg >> 4));
 
+	/* Enable WDOG_B, for cold reset by default */
+	if (of_property_read_bool(dev->of_node, "nxp,wdog_b-warm-reset"))
+		regmap_update_bits(regmap, PCA9450_RESET_CTRL,
+				   PCA9450_PMIC_RESET_WDOG_B_CFG_MASK,
+				   PCA9450_PMIC_RESET_WDOG_B_CFG_WARM);
+	else
+		regmap_update_bits(regmap, PCA9450_RESET_CTRL,
+				   PCA9450_PMIC_RESET_WDOG_B_CFG_MASK,
+				   PCA9450_PMIC_RESET_WDOG_B_CFG_COLD_LDO12);
+
 	if (pca9450_init_callback)
 		pca9450_init_callback(regmap);
 	pca9450_map = regmap;
diff --git a/include/mfd/pca9450.h b/include/mfd/pca9450.h
index 7071c3a9da6c5adc26dbd6149fec5fa96f3365bf..af10e409855ff6c3585c7f63098a16e8ec33dee2 100644
--- a/include/mfd/pca9450.h
+++ b/include/mfd/pca9450.h
@@ -66,4 +66,8 @@ static inline int pca9450_register_init_callback(void(*callback)(struct regmap *
 }
 #endif
 
+#define PCA9450_PMIC_RESET_WDOG_B_CFG_MASK		0xc0
+#define PCA9450_PMIC_RESET_WDOG_B_CFG_WARM		0x40
+#define PCA9450_PMIC_RESET_WDOG_B_CFG_COLD_LDO12	0x80
+
 #endif

-- 
2.39.5




  reply	other threads:[~2025-03-13  9:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13  9:21 [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver Jonas Rebmann
2025-03-13  9:21 ` Jonas Rebmann [this message]
2025-03-13  9:21 ` [PATCH v2 2/2] ARM: boards: remove obsolete PCA9450_RESET_CTRL setup Jonas Rebmann
2025-03-14 16:12 ` [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver Sascha Hauer

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=20250313-pca9450-wdog-v2-1-28e97e7da480@pengutronix.de \
    --to=jre@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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