rtc: pcf85063: add power loss detection during probe

Retrofit from upstream linux to try resetting the device after power loss.

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Signed-off-by: Alexander Feilke <alexander.feilke@ew.tq-group.com>
This commit is contained in:
Alexander Feilke
2026-05-22 17:39:28 +02:00
committed by Tom Rini
parent d8f535cd8f
commit 059174b955

View File

@@ -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",