From owner-svn-src-all@FreeBSD.ORG Wed Aug 20 19:37:07 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 96EF8D37; Wed, 20 Aug 2014 19:37:07 +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 7686B3D82; Wed, 20 Aug 2014 19:37:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7KJb7hL080365; Wed, 20 Aug 2014 19:37:07 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7KJb6Dk080359; Wed, 20 Aug 2014 19:37:06 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201408201937.s7KJb6Dk080359@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 20 Aug 2014 19:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270243 - in stable/10: share/man/man4 sys/arm/broadcom/bcm2835 sys/arm/ti sys/boot/fdt/dts/arm X-SVN-Group: stable-10 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-1 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: Wed, 20 Aug 2014 19:37:07 -0000 Author: loos Date: Wed Aug 20 19:37:05 2014 New Revision: 270243 URL: http://svnweb.freebsd.org/changeset/base/270243 Log: MFC r267021: 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 r267834: Clarify the expected usage of I2C 7-bit slave addresses on ioctl(2) interface. While here add the cross reference to iic(4) on iicbus(4). CR: D210 Suggested by: jmg Modified: stable/10/share/man/man4/iic.4 stable/10/share/man/man4/iicbus.4 stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c stable/10/sys/arm/ti/ti_i2c.c stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts stable/10/sys/boot/fdt/dts/arm/beaglebone.dts Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/iic.4 ============================================================================== --- stable/10/share/man/man4/iic.4 Wed Aug 20 19:30:58 2014 (r270242) +++ stable/10/share/man/man4/iic.4 Wed Aug 20 19:37:05 2014 (r270243) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 6, 2006 +.Dd June 24, 2014 .Dt IIC 4 .Os .Sh NAME @@ -51,12 +51,20 @@ following ioctls: Sends the start condition to the slave specified by the .Va slave element to the bus. +The +.Va slave +element consists of a 7-bit address and a read/write bit +(i.e., 7-bit address << 1 | r/w). +If the read/write bit is set a read operation is initiated, if the read/write +bit is cleared a write operation is initiated. All other elements are ignored. .It Dv I2CRPTSTART .Pq Vt "struct iiccmd" Sends the repeated start condition to the slave specified by the .Va slave element to the bus. +The slave address should be specified as in +.Dv I2CSTART . All other elements are ignored. .It Dv I2CSTOP No argument is passed. @@ -115,10 +123,15 @@ is set in Otherwise the transfer is a write transfer. The .Va slave -element specifies the 7-bit address for the transfer. +element specifies the 7-bit address with the read/write bit for the transfer. +The read/write bit will be handled by the iicbus stack based on the specified +transfer operation. The .Va len -element is the length of the data. +element is the number of +.Pq Vt "struct iic_msg" +messages encoded on +.Pq Vt "struct iic_rdwr_data" . The .Va buf element is a buffer for that data. Modified: stable/10/share/man/man4/iicbus.4 ============================================================================== --- stable/10/share/man/man4/iicbus.4 Wed Aug 20 19:30:58 2014 (r270242) +++ stable/10/share/man/man4/iicbus.4 Wed Aug 20 19:37:05 2014 (r270243) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 1998 +.Dd June 24, 2014 .Dt IICBUS 4 .Os .Sh NAME @@ -104,6 +104,7 @@ Some I2C interfaces are available: .It Sy bktr Ta "Brooktree848 video chipset, hardware and software master-only interface" .El .Sh SEE ALSO +.Xr iic 4 , .Xr iicbb 4 , .Xr lpbb 4 , .Xr pcf 4 Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Aug 20 19:30:58 2014 (r270242) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Aug 20 19:37:05 2014 (r270243) @@ -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: stable/10/sys/arm/ti/ti_i2c.c ============================================================================== --- stable/10/sys/arm/ti/ti_i2c.c Wed Aug 20 19:30:58 2014 (r270242) +++ stable/10/sys/arm/ti/ti_i2c.c Wed Aug 20 19:37:05 2014 (r270243) @@ -747,7 +747,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: stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts Wed Aug 20 19:30:58 2014 (r270242) +++ stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts Wed Aug 20 19:37:05 2014 (r270243) @@ -149,7 +149,7 @@ i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x24>; + reg = <0x48>; }; }; }; Modified: stable/10/sys/boot/fdt/dts/arm/beaglebone.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/beaglebone.dts Wed Aug 20 19:30:58 2014 (r270242) +++ stable/10/sys/boot/fdt/dts/arm/beaglebone.dts Wed Aug 20 19:37:05 2014 (r270243) @@ -133,7 +133,7 @@ i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x24>; + reg = <0x48>; }; }; };