From owner-svn-src-all@freebsd.org Thu Jul 18 01:30:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 394C3BA610; Thu, 18 Jul 2019 01:30:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BC1D6D211; Thu, 18 Jul 2019 01:30:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6CFB2771B; Thu, 18 Jul 2019 01:30:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6I1Uuc4009532; Thu, 18 Jul 2019 01:30:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6I1Uui6009531; Thu, 18 Jul 2019 01:30:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907180130.x6I1Uui6009531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 18 Jul 2019 01:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350104 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 350104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1BC1D6D211 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jul 2019 01:30:57 -0000 Author: ian Date: Thu Jul 18 01:30:56 2019 New Revision: 350104 URL: https://svnweb.freebsd.org/changeset/base/350104 Log: Handle the PCF2127 RTC chip the same as PCF2129 when init'ing the chip. This affects the detection of 24-hour vs AM/PM mode... the ampm bit is in a different location on 2127 and 2129 chips compared to other nxp rtc chips. I noticed the 2127 case wasn't being handled correctly when I accidentally misconfiged my system by claiming my PCF2129 was a 2127. Modified: head/sys/dev/iicbus/nxprtc.c Modified: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- head/sys/dev/iicbus/nxprtc.c Thu Jul 18 00:27:28 2019 (r350103) +++ head/sys/dev/iicbus/nxprtc.c Thu Jul 18 01:30:56 2019 (r350104) @@ -351,9 +351,18 @@ pcf8523_start(struct nxprtc_softc *sc) { int err; uint8_t cs1, cs3, clkout; - bool is2129; + bool is212x; - is2129 = (sc->chiptype == TYPE_PCA2129 || sc->chiptype == TYPE_PCF2129); + switch (sc->chiptype) { + case TYPE_PCF2127: + case TYPE_PCA2129: + case TYPE_PCF2129: + is212x = true; + break; + default: + is212x = true; + break; + } /* Read and sanity-check the control registers. */ if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) { @@ -389,7 +398,7 @@ pcf8523_start(struct nxprtc_softc *sc) * to zero then back to 1, then wait 100ms for the refresh, and * finally set the bit back to zero with the COF_HIGHZ write. */ - if (is2129) { + if (is212x) { clkout = PCF2129_B_CLKOUT_HIGHZ; if ((err = write_reg(sc, PCF8523_R_TMR_CLKOUT, clkout)) != 0) { @@ -429,7 +438,7 @@ pcf8523_start(struct nxprtc_softc *sc) device_printf(sc->dev, "WARNING: RTC battery is low\n"); /* Remember whether we're running in AM/PM mode. */ - if (is2129) { + if (is212x) { if (cs1 & PCF2129_B_CS1_12HR) sc->use_ampm = true; } else {