[Bug 266093] [nxprtc] My PCF8523 fails to initialize properly after 2444018f7dd3c0ecd1099d63de0a856e7f6b1984

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 29 Aug 2022 06:34:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266093

            Bug ID: 266093
           Summary: [nxprtc] My PCF8523 fails to initialize properly after
                    2444018f7dd3c0ecd1099d63de0a856e7f6b1984
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: t_uemura@macome.co.jp

I've noticed that on 13.1-STABLE stable/13-n251859-8d4ccb9da29-dirty, 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

The following log could be seen rarely but on successful boot-ups.

nxprtc0: <NXP PCF8523 RTC> at addr 0xd0 on iicbus0
nxprtc0: registered as a time-of-day clock, resolution 0.015625s

I've tried the same kernel but with the old
18cd8a2df868a3a7154172348f8bc61f699e78d4 nxprtc.ko and found it worked like a
charm. The next revision 2444018f7dd3c0ecd1099d63de0a856e7f6b1984 seemed to
introduce a hitch.

"cannot set up timer" was printed because pcf8523_start_timer(sc) returned
non-zero in nxprtc_start(), so I've added some device_printf() calls and
observed that one of the following register access failed.

read_reg(sc, PCF8523_R_TMR_A_FREQ, &tmrfreq)
read_reg(sc, PCF8523_R_TMR_CLKOUT, &clkout)
write_reg(sc, sc->tmcaddr, 0)

pcf8523_start_timer() itself was unmodified in
2444018f7dd3c0ecd1099d63de0a856e7f6b1984 so I couldn't guess the root cause of
the above register access failure.

-- 
You are receiving this mail because:
You are the assignee for the bug.