diff options
| author | Alexander Feilke <[email protected]> | 2026-05-22 17:39:28 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-06-05 10:14:24 -0600 |
| commit | 059174b9554ef4f366accd75b641447244c00f3c (patch) | |
| tree | 05a9100bec5cba986cd95b21f356e1bbe6351e8c /drivers | |
| parent | d8f535cd8f7cb5f9231f91a3307895db7c9f9552 (diff) | |
rtc: pcf85063: add power loss detection during probe
Retrofit from upstream linux to try resetting the device after power loss.
Reviewed-by: Alexander Sverdlin <[email protected]>
Signed-off-by: Alexander Feilke <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/rtc/pcf85063.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/rtc/pcf85063.c b/drivers/rtc/pcf85063.c index 107e8b4d4c8..421c42c0b81 100644 --- a/drivers/rtc/pcf85063.c +++ b/drivers/rtc/pcf85063.c @@ -185,6 +185,20 @@ static int pcf85063_probe(struct udevice *dev) return err; } + /* + * If a Power loss is detected, SW reset the device. + * From PCF85063A datasheet: + * There is a low probability that some devices will have corruption + * of the registers after the automatic power-on reset... + */ + if (tmp & PCF85063_REG_SC_OS) { + dev_warn(dev, "POR issue detected, sending a SW reset\n"); + err = dm_i2c_reg_clrset(dev, PCF85063_REG_CTRL1, + 0xff, PCF85063_REG_CTRL1_SWR); + if (err < 0) + dev_warn(dev, "SW reset failed, trying to continue\n"); + } + err = pcf85063_load_capacitance(dev); if (err < 0) dev_warn(dev, "failed to set xtal load capacitance: %d", |
