nxprtc: Fix timing issue with register access.

My Adafruit PCF8523 RTC on either RPi2B or RPi3B+ failed to work around
80 ~ 90 % of boot-ups, by printing the following log lines.

nxprtc0: <NXP PCF8523 RTC> at addr 0xd0 on iicbus0
nxprtc0: cannot set up timer
Warning: no time-of-day clock registered, system time will not be set accurately

This is due to pcf8523_start_timer(sc) returned non-zero in
nxprtc_start() due to a register read failure of PCF8523_R_TMR_A_FREQ or
PCF8523_R_TMR_CLKOUT or a failure to program a new value.

The pause_sbt("nxpbat") sleep was too short and caused the register
access failures.

PR: 266093
This commit is contained in:
Tetsuya Uemura 2022-09-14 07:34:15 -06:00 committed by Warner Losh
parent b94e192660
commit e2386f18ec

View File

@ -418,7 +418,7 @@ pcf8523_battery_check(struct nxprtc_softc *sc)
device_printf(sc->dev, "cannot write CS3 reg\n");
return (err);
}
pause_sbt("nxpbat", mstosbt(10), 0, 0);
pause_sbt("nxpbat", mstosbt(100), 0, 0);
if ((err = read_reg(sc, PCF8523_R_CS3, &cs3)) != 0) {
device_printf(sc->dev, "cannot read CS3 reg\n");
return (err);