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>; }; }; }; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"