From owner-svn-src-all@FreeBSD.ORG Tue Jun 3 19:24:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD5C579F; Tue, 3 Jun 2014 19:24:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 9DDE22D96; Tue, 3 Jun 2014 19:24:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s53JOsC7037464; Tue, 3 Jun 2014 19:24:54 GMT (envelope-from loos@svn.freebsd.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s53JOrT3037460; Tue, 3 Jun 2014 19:24:53 GMT (envelope-from loos@svn.freebsd.org) Message-Id: <201406031924.s53JOrT3037460@svn.freebsd.org> From: Luiz Otavio O Souza Date: Tue, 3 Jun 2014 19:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267021 - in head/sys: arm/broadcom/bcm2835 arm/ti boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 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: Tue, 03 Jun 2014 19:24:54 -0000 Author: loos Date: Tue Jun 3 19:24:53 2014 New Revision: 267021 URL: http://svnweb.freebsd.org/changeset/base/267021 Log: FreeBSD, historically, has always used 8-bit addresses for i2c devices (7-bit device address << 1), always leaving the room for the read/write bit. This commit convert ti_i2c and revert r259127 on bcm2835_bsc to make them compatible with 8-bit addresses. Previous to this commit an i2c device would have different addresses depending on the controller it was attached to (by example, when compared to any iicbb(4) based i2c controller), which was a pretty annoying behavior. Also, update the PMIC i2c address on beaglebone* DTS files to match the new address scheme. Now the userland utilities need to do the correct slave address shifting (but it is going to work with any i2c controller on the system). Discussed with: ian MFC after: 2 weeks Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c head/sys/arm/ti/ti_i2c.c head/sys/boot/fdt/dts/arm/beaglebone-black.dts head/sys/boot/fdt/dts/arm/beaglebone.dts Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Tue Jun 3 19:06:47 2014 (r267020) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Tue Jun 3 19:24:53 2014 (r267021) @@ -407,7 +407,7 @@ bcm_bsc_transfer(device_t dev, struct ii for (i = 0; i < nmsgs; i++) { /* Write the slave address. */ - BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave); + BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave >> 1); /* Write the data length. */ BCM_BSC_WRITE(sc, BCM_BSC_DLEN, msgs[i].len); Modified: head/sys/arm/ti/ti_i2c.c ============================================================================== --- head/sys/arm/ti/ti_i2c.c Tue Jun 3 19:06:47 2014 (r267020) +++ head/sys/arm/ti/ti_i2c.c Tue Jun 3 19:24:53 2014 (r267021) @@ -763,7 +763,7 @@ ti_i2c_transfer(device_t dev, struct iic } /* set the slave address */ - ti_i2c_write_reg(sc, I2C_REG_SA, msgs[i].slave); + ti_i2c_write_reg(sc, I2C_REG_SA, msgs[i].slave >> 1); /* perform the read or write */ if (msgs[i].flags & IIC_M_RD) { Modified: head/sys/boot/fdt/dts/arm/beaglebone-black.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/beaglebone-black.dts Tue Jun 3 19:06:47 2014 (r267020) +++ head/sys/boot/fdt/dts/arm/beaglebone-black.dts Tue Jun 3 19:24:53 2014 (r267021) @@ -149,7 +149,7 @@ i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x24>; + reg = <0x48>; }; }; }; Modified: head/sys/boot/fdt/dts/arm/beaglebone.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/beaglebone.dts Tue Jun 3 19:06:47 2014 (r267020) +++ head/sys/boot/fdt/dts/arm/beaglebone.dts Tue Jun 3 19:24:53 2014 (r267021) @@ -133,7 +133,7 @@ i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x24>; + reg = <0x48>; }; }; };