git: f5d1d22f25bd - stable/13 - nxprtc: Fix timing issue with register access.

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 04 Nov 2022 21:51:36 UTC
The branch stable/13 has been updated by imp:

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

commit f5d1d22f25bd8b96aba1b83aea79b598fe6d9bcb
Author:     Tetsuya Uemura <t_uemura@macome.co.jp>
AuthorDate: 2022-11-04 21:49:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-11-04 21:50:05 +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
    (cherry picked from commit e2386f18eca2f6f75f7c5c2d49d603e3d2674509)
---
 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 0e5162fcd395..2827ebc1a29e 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);