mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver
@ 2025-03-13  9:21 Jonas Rebmann
  2025-03-13  9:21 ` [PATCH v2 1/2] mfd: pca9450: configure pmic reset behavior Jonas Rebmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonas Rebmann @ 2025-03-13  9:21 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann

Configure the RESET_CTRL register of the pca9450 pmic in the driver,
like u-boot and kernel do. Subsequently, remove the setup of this
register from the pca9450_register_init_callback of the two imx93 boards
we currently have.

Configuration of this register in lowlevel.c of the imx8 boards remains
untouched for now.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
Changes in v2:
- Move to commit message the reasoning for keeping mx8 boards explicit register initialization
- When mentioning other commits in a commit message, include their subject line 
- Remove superfluous include
- Link to v1: https://lore.kernel.org/r/20250311-pca9450-wdog-v1-0-45120abeae00@pengutronix.de

---
Jonas Rebmann (2):
      mfd: pca9450: configure pmic reset behavior
      ARM: boards: remove obsolete PCA9450_RESET_CTRL setup

 arch/arm/boards/phytec-phycore-imx93/board.c |  9 ---------
 arch/arm/boards/tqma93xx/board.c             |  3 ---
 drivers/mfd/pca9450.c                        | 10 ++++++++++
 include/mfd/pca9450.h                        |  4 ++++
 4 files changed, 14 insertions(+), 12 deletions(-)
---
base-commit: d004da6e3710cc01b645a57c8dd1a986eced1c80
change-id: 20250311-pca9450-wdog-b9458f1a26ff

Best regards,
-- 
Jonas Rebmann <jre@pengutronix.de>




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

* [PATCH v2 1/2] mfd: pca9450: configure pmic reset behavior
  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
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Jonas Rebmann @ 2025-03-13  9:21 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann

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




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

* [PATCH v2 2/2] ARM: boards: remove obsolete PCA9450_RESET_CTRL setup
  2025-03-13  9:21 [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver Jonas Rebmann
  2025-03-13  9:21 ` [PATCH v2 1/2] mfd: pca9450: configure pmic reset behavior Jonas Rebmann
@ 2025-03-13  9:21 ` Jonas Rebmann
  2025-03-14 16:12 ` [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Jonas Rebmann @ 2025-03-13  9:21 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann

Since a previous commit, PCA9450_RESET_CTRL is initialized to 0xA1 in
pca9450_probe; explicitly setting this in board.c has no effect anymore.

Remove the setup of this register from the
pca9450_register_init_callback of the two imx93 boards we currently
have.

Configuration of this register in power_init_board() in lowlevel.c of
the imx8 boards remains untouched for now. This is because there, the
register is configured even if the pca9450 driver is not enabled.
Furthermore, the power_init_board() functions initialize a larger array
of pmic registers which I haven't compared against other pmic and
-driver defaults.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 arch/arm/boards/phytec-phycore-imx93/board.c | 9 ---------
 arch/arm/boards/tqma93xx/board.c             | 3 ---
 2 files changed, 12 deletions(-)

diff --git a/arch/arm/boards/phytec-phycore-imx93/board.c b/arch/arm/boards/phytec-phycore-imx93/board.c
index 149248ca654624826d0e8f6fe0f1f42c2747e248..03ba8cb5026d2a9eaa054fcfc69e18872fcd658e 100644
--- a/arch/arm/boards/phytec-phycore-imx93/board.c
+++ b/arch/arm/boards/phytec-phycore-imx93/board.c
@@ -6,23 +6,14 @@
 #include <init.h>
 #include <linux/kernel.h>
 #include <environment.h>
-#include <mfd/pca9450.h>
 #include <deep-probe.h>
 #include <mach/imx/bbu.h>
 #include <linux/pinctrl/consumer.h>
 
-static void phycore_imx93_init_pmic(struct regmap *map)
-{
-	/* set WDOG_B_CFG to cold reset */
-	regmap_write(map, PCA9450_RESET_CTRL, 0xA1);
-}
-
 static int phycore_imx93_probe(struct device *dev)
 {
 	struct device_node *np;
 
-	pca9450_register_init_callback(phycore_imx93_init_pmic);
-
 	/*
 	 * The phy on the EQOS has its MDIO lines connected to the FEC. The phy
 	 * registers can only be successfully read when the EQOS pinctrl setup
diff --git a/arch/arm/boards/tqma93xx/board.c b/arch/arm/boards/tqma93xx/board.c
index b181784079cf12e5a112d13f95c87c2cf5ebeba6..b4de6c2f6c347cb255537a3784a667a9c2607de3 100644
--- a/arch/arm/boards/tqma93xx/board.c
+++ b/arch/arm/boards/tqma93xx/board.c
@@ -27,9 +27,6 @@ static void tqma93xx_init_pmic(struct regmap *map)
 
 	/* I2C_LT_EN*/
 	regmap_write(map, 0xa, 0x3);
-
-	/* set WDOG_B_CFG to cold reset */
-	regmap_write(map, PCA9450_RESET_CTRL, 0xA1);
 }
 
 static int tqma93xx_probe(struct device *dev)

-- 
2.39.5




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

* Re: [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver
  2025-03-13  9:21 [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver Jonas Rebmann
  2025-03-13  9:21 ` [PATCH v2 1/2] mfd: pca9450: configure pmic reset behavior Jonas Rebmann
  2025-03-13  9:21 ` [PATCH v2 2/2] ARM: boards: remove obsolete PCA9450_RESET_CTRL setup Jonas Rebmann
@ 2025-03-14 16:12 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-03-14 16:12 UTC (permalink / raw)
  To: BAREBOX, Jonas Rebmann


On Thu, 13 Mar 2025 10:21:17 +0100, Jonas Rebmann wrote:
> Configure the RESET_CTRL register of the pca9450 pmic in the driver,
> like u-boot and kernel do. Subsequently, remove the setup of this
> register from the pca9450_register_init_callback of the two imx93 boards
> we currently have.
> 
> Configuration of this register in lowlevel.c of the imx8 boards remains
> untouched for now.
> 
> [...]

Applied, thanks!

[1/2] mfd: pca9450: configure pmic reset behavior
      https://git.pengutronix.de/cgit/barebox/commit/?id=36fc07dcd418 (link may not be stable)
[2/2] ARM: boards: remove obsolete PCA9450_RESET_CTRL setup
      https://git.pengutronix.de/cgit/barebox/commit/?id=86612dd9568d (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2025-03-14 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-13  9:21 [PATCH v2 0/2] Move pca9450 RESET_CTRL configuration to driver Jonas Rebmann
2025-03-13  9:21 ` [PATCH v2 1/2] mfd: pca9450: configure pmic reset behavior Jonas Rebmann
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

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