regulator: pca9450: Enable system reset on WDOG_B assertion
authorFrieder Schrempf <frieder.schrempf@kontron.de>
Thu, 11 Feb 2021 10:55:30 +0000 (11:55 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 11 Feb 2021 13:11:35 +0000 (13:11 +0000)
By default the PCA9450 doesn't handle the assertion of the WDOG_B
signal, but this is required to guarantee that things like software
resets triggered by the watchdog work reliably.

As we don't want to rely on the bootloader to enable this, we tell
the PMIC to issue a cold reset in case the WDOG_B signal is
asserted (WDOG_B_CFG = 10), just as the NXP U-Boot code does.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20210211105534.38972-3-frieder.schrempf@kontron.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/pca9450-regulator.c
include/linux/regulator/pca9450.h

index 1bba8fdcb7b7a423e531780f3bcfec13e896eab2..833d398c6aa21f3f5cdd777ca0c3ec6120d1045b 100644 (file)
@@ -797,6 +797,14 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
                return ret;
        }
 
+       /* 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);
+       if (ret) {
+               dev_err(&i2c->dev, "Failed to set WDOG_B reset behavior\n");
+               return ret;
+       }
+
        /*
         * The driver uses the LDO5CTRL_H register to control the LDO5 regulator.
         * This is only valid if the SD_VSEL input of the PMIC is high. Let's
index 1bbd3014f9067f70f7085e7b397e4b7f2e5caf6a..ccdb5320a2406a400a3c111c4a3cd5557c6b5fce 100644 (file)
@@ -216,4 +216,11 @@ enum {
 #define IRQ_THERM_105                  0x02
 #define IRQ_THERM_125                  0x01
 
+/* PCA9450_REG_RESET_CTRL bits */
+#define WDOG_B_CFG_MASK                        0xC0
+#define WDOG_B_CFG_NONE                        0x00
+#define WDOG_B_CFG_WARM                        0x40
+#define WDOG_B_CFG_COLD_LDO12          0x80
+#define WDOG_B_CFG_COLD                        0xC0
+
 #endif /* __LINUX_REG_PCA9450_H__ */