mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-25 16:41:34 +00:00
imx: mxc_i2c: tweak the i2c transfer method
Tweak the i2c transfer to work for devices that want to read data without addressing a register. Signed-off-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk> Acked-by: Heiko Schocher <hs@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Stefano Babic <sbabic@denx.de>
This commit is contained in:
parent
401cabc287
commit
2feec4eafd
1 changed files with 15 additions and 10 deletions
|
@ -317,6 +317,7 @@ static int i2c_init_transfer_(struct mxc_i2c_bus *i2c_bus, u8 chip,
|
||||||
temp |= I2CR_MTX | I2CR_TX_NO_AK;
|
temp |= I2CR_MTX | I2CR_TX_NO_AK;
|
||||||
writeb(temp, base + (I2CR << reg_shift));
|
writeb(temp, base + (I2CR << reg_shift));
|
||||||
|
|
||||||
|
if (alen >= 0) {
|
||||||
/* write slave address */
|
/* write slave address */
|
||||||
ret = tx_byte(i2c_bus, chip << 1);
|
ret = tx_byte(i2c_bus, chip << 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -327,6 +328,8 @@ static int i2c_init_transfer_(struct mxc_i2c_bus *i2c_bus, u8 chip,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,9 +540,11 @@ static int bus_i2c_read(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (alen >= 0) {
|
||||||
temp = readb(base + (I2CR << reg_shift));
|
temp = readb(base + (I2CR << reg_shift));
|
||||||
temp |= I2CR_RSTA;
|
temp |= I2CR_RSTA;
|
||||||
writeb(temp, base + (I2CR << reg_shift));
|
writeb(temp, base + (I2CR << reg_shift));
|
||||||
|
}
|
||||||
|
|
||||||
ret = tx_byte(i2c_bus, (chip << 1) | 1);
|
ret = tx_byte(i2c_bus, (chip << 1) | 1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue