summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2014-08-20 19:37:05 +0000
committerloos <loos@FreeBSD.org>2014-08-20 19:37:05 +0000
commite4ebeceadb6a37e1ccf33800c4312cceabca6b57 (patch)
treee6d1dad9e555738abec006db57843693485d6beb /sys/arm
parent5efc9173fa69c32dee331f42b6cd63d4b6da7125 (diff)
downloadFreeBSD-src-e4ebeceadb6a37e1ccf33800c4312cceabca6b57.zip
FreeBSD-src-e4ebeceadb6a37e1ccf33800c4312cceabca6b57.tar.gz
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
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_bsc.c2
-rw-r--r--sys/arm/ti/ti_i2c.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
index 33e4769..1e486a4 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
@@ -407,7 +407,7 @@ bcm_bsc_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
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);
diff --git a/sys/arm/ti/ti_i2c.c b/sys/arm/ti/ti_i2c.c
index e4b7b58..19e2a89 100644
--- a/sys/arm/ti/ti_i2c.c
+++ b/sys/arm/ti/ti_i2c.c
@@ -747,7 +747,7 @@ ti_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
}
/* 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) {
OpenPOWER on IntegriCloud