Skip to content
Snippets Groups Projects
Commit 98ab14e8 authored by Peter Meerwald's avatar Peter Meerwald Committed by Heiko Schocher
Browse files

Blackfin: TWI/I2C: fix pure writes


If doing a pure write with register address and data (not a read/write
combo transfer), we don't set the initial transfer length properly which
ends up causing only the register address to be transferred.

While we're here, fix the i2c_write() parameter description of the buffer.

Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 3e88337b
No related branches found
No related tags found
No related merge requests found
...@@ -164,7 +164,7 @@ static int i2c_transfer(uchar chip, uint addr, int alen, uchar *buffer, int len, ...@@ -164,7 +164,7 @@ static int i2c_transfer(uchar chip, uint addr, int alen, uchar *buffer, int len,
/* prime the pump */ /* prime the pump */
if (msg.alen) { if (msg.alen) {
len = msg.alen; len = (msg.flags & I2C_M_COMBO) ? msg.alen : msg.alen + len;
debugi("first byte=0x%02x", *msg.abuf); debugi("first byte=0x%02x", *msg.abuf);
bfin_write_TWI_XMT_DATA8(*(msg.abuf++)); bfin_write_TWI_XMT_DATA8(*(msg.abuf++));
--msg.alen; --msg.alen;
...@@ -275,7 +275,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) ...@@ -275,7 +275,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
* @chip: i2c chip addr * @chip: i2c chip addr
* @addr: memory (register) address in the chip * @addr: memory (register) address in the chip
* @alen: byte size of address * @alen: byte size of address
* @buffer: buffer to store data read from chip * @buffer: buffer holding data to write to chip
* @len: how many bytes to write * @len: how many bytes to write
* @return: 0 on success, non-0 on failure * @return: 0 on success, non-0 on failure
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment