diff options
author | Marius Strobl <marius@FreeBSD.org> | 2012-10-21 12:53:33 +0000 |
---|---|---|
committer | Marius Strobl <marius@FreeBSD.org> | 2012-10-21 12:53:33 +0000 |
commit | 7c3664f6ea67cdad4bc03521775ed14caf875095 (patch) | |
tree | 0d2778de83ec0932f6aeccd9741d57b81e2ac89a | |
parent | 77ab896b5e41fb3222277477b09203077113714b (diff) | |
download | src-7c3664f6ea67cdad4bc03521775ed14caf875095.tar.gz src-7c3664f6ea67cdad4bc03521775ed14caf875095.zip |
MFC: r241679
It turns out that as documented, PCF8563_R_SECOND_VL (i.e. battery low)
doesn't automatically clear when VDD rises above Vlow again and needs to be
cleared manually. However, apparently this needs all of the time registers
to be set, i.e. pcf8563_settime(), and not just PCF8563_R_SECOND in order
for PCF8563_R_SECOND_VL to stick. Thus, we just issue a warning during
pcf8563_attach() rather than failing with ENXIO in case it is set.
Approved by: re (kib)
Notes
Notes:
svn path=/releng/9.1/; revision=241813
-rw-r--r-- | sys/dev/iicbus/pcf8563.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/iicbus/pcf8563.c b/sys/dev/iicbus/pcf8563.c index 8db26efefd03..88307a5728a2 100644 --- a/sys/dev/iicbus/pcf8563.c +++ b/sys/dev/iicbus/pcf8563.c @@ -83,6 +83,16 @@ pcf8563_attach(device_t dev) if (sc->sc_addr == 0) sc->sc_addr = PCF8563_ADDR; + /* + * NB: PCF8563_R_SECOND_VL doesn't automatically clear when VDD + * rises above Vlow again and needs to be cleared manually. + * However, apparently this needs all of the time registers to be + * set, i.e. pcf8563_settime(), and not just PCF8563_R_SECOND in + * order for PCF8563_R_SECOND_VL to stick. Thus, we just issue a + * warning here rather than failing with ENXIO in case it is set. + * Note that pcf8563_settime() will also clear PCF8563_R_SECOND_VL + * as a side-effect. + */ msgs[0].slave = msgs[1].slave = sc->sc_addr; error = iicbus_transfer(device_get_parent(dev), msgs, sizeof(msgs) / sizeof(*msgs)); @@ -90,10 +100,8 @@ pcf8563_attach(device_t dev) device_printf(dev, "%s: cannot read RTC\n", __func__); return (error); } - if ((val & PCF8563_R_SECOND_VL) != 0) { + if ((val & PCF8563_R_SECOND_VL) != 0) device_printf(dev, "%s: battery low\n", __func__); - return (ENXIO); - } sc->sc_year0 = 1900; clock_register(dev, 1000000); /* 1 second resolution */ |