From owner-svn-src-releng@FreeBSD.ORG Sun Oct 21 12:53:34 2012 Return-Path: Delivered-To: svn-src-releng@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA4CD82A; Sun, 21 Oct 2012 12:53:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 693BE8FC0A; Sun, 21 Oct 2012 12:53:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9LCrYK4079471; Sun, 21 Oct 2012 12:53:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9LCrYSo079469; Sun, 21 Oct 2012 12:53:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201210211253.q9LCrYSo079469@svn.freebsd.org> From: Marius Strobl Date: Sun, 21 Oct 2012 12:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r241813 - releng/9.1/sys/dev/iicbus X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Oct 2012 12:53:34 -0000 Author: marius Date: Sun Oct 21 12:53:33 2012 New Revision: 241813 URL: http://svn.freebsd.org/changeset/base/241813 Log: 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) Modified: releng/9.1/sys/dev/iicbus/pcf8563.c Directory Properties: releng/9.1/sys/ (props changed) releng/9.1/sys/dev/ (props changed) Modified: releng/9.1/sys/dev/iicbus/pcf8563.c ============================================================================== --- releng/9.1/sys/dev/iicbus/pcf8563.c Sun Oct 21 12:33:38 2012 (r241812) +++ releng/9.1/sys/dev/iicbus/pcf8563.c Sun Oct 21 12:53:33 2012 (r241813) @@ -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 */