git: e2386f18eca2 - main - nxprtc: Fix timing issue with register access.

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 14 Sep 2022 13:42:10 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e2386f18eca2f6f75f7c5c2d49d603e3d2674509

commit e2386f18eca2f6f75f7c5c2d49d603e3d2674509
Author:     Tetsuya Uemura <t_uemura@macome.co.jp>
AuthorDate: 2022-09-14 13:34:15 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-09-14 13:34:15 +0000

    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
---
 sys/dev/iicbus/nxprtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/iicbus/nxprtc.c b/sys/dev/iicbus/nxprtc.c
index 74ff3acef914..784b71dfc966 100644
--- a/sys/dev/iicbus/nxprtc.c
+++ b/sys/dev/iicbus/nxprtc.c
@@ -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);