From owner-svn-src-head@freebsd.org Wed Oct 21 15:41:18 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53A88A1B1F0; Wed, 21 Oct 2015 15:41:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id 057F319DB; Wed, 21 Oct 2015 15:41:17 +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 t9LFfHsq011960; Wed, 21 Oct 2015 15:41:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9LFfGRS011957; Wed, 21 Oct 2015 15:41:16 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201510211541.t9LFfGRS011957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 21 Oct 2015 15:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289704 - in head/sys: arm/ti/am335x dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2015 15:41:18 -0000 Author: ian Date: Wed Oct 21 15:41:16 2015 New Revision: 289704 URL: https://svnweb.freebsd.org/changeset/base/289704 Log: Fix parsing of I2C addresses properties in fdt data. I2C address is represented in 7-bits format in DT files, but system expect it in 8-bit format. Also, fix two drivers that locally hack around this bug. Submitted by: Michal Meloun Modified: head/sys/arm/ti/am335x/am335x_pmic.c head/sys/arm/ti/am335x/tda19988.c head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/arm/ti/am335x/am335x_pmic.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pmic.c Wed Oct 21 15:32:21 2015 (r289703) +++ head/sys/arm/ti/am335x/am335x_pmic.c Wed Oct 21 15:41:16 2015 (r289704) @@ -147,7 +147,7 @@ am335x_pmic_probe(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; /* Convert to 8-bit addressing */ - sc->sc_addr = iicbus_get_addr(dev) << 1; + sc->sc_addr = iicbus_get_addr(dev); device_set_desc(dev, "TI TPS65217 Power Management IC"); Modified: head/sys/arm/ti/am335x/tda19988.c ============================================================================== --- head/sys/arm/ti/am335x/tda19988.c Wed Oct 21 15:32:21 2015 (r289703) +++ head/sys/arm/ti/am335x/tda19988.c Wed Oct 21 15:41:16 2015 (r289704) @@ -731,7 +731,7 @@ tda19988_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_addr = iicbus_get_addr(dev) << 1; + sc->sc_addr = iicbus_get_addr(dev); sc->sc_cec_addr = (0x34 << 1); /* hardcoded */ sc->sc_edid = malloc(EDID_LENGTH, M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_edid_len = EDID_LENGTH; Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Wed Oct 21 15:32:21 2015 (r289703) +++ head/sys/dev/ofw/ofw_iicbus.c Wed Oct 21 15:41:16 2015 (r289704) @@ -147,7 +147,11 @@ ofw_iicbus_attach(device_t dev) M_NOWAIT | M_ZERO); if (dinfo == NULL) continue; - dinfo->opd_dinfo.addr = paddr; + /* + * OFW uses 7-bit I2C address format (see ePAPR), + * but system expect 8-bit. + */ + dinfo->opd_dinfo.addr = paddr << 1; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF);