summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2016-08-25 15:20:01 +0200
committerHeiko Schocher <hs@denx.de>2016-08-26 07:02:49 +0200
commit03d6cd972efb7289ef208ba4bad72d1e7acccf1d (patch)
tree53f6239c917586fbc49d438382f1f7572e3a63d2 /drivers/i2c
parent46fe9eb08812cc27a0d5cd97d97373c14d578fe9 (diff)
i2c: mvtwsi: Fix order of address bytes (high to low)
Patch f8a10ed1 [i2c: mvtwsi: Make address length variable] accidentally inverted the sequence of address bytes sent to the I2C device. This patch corrects this by sending the highest byte first and the lowest byte last again. Tested on theadorable Armada-XP board. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Mario Six <mario.six@gdsys.cc> Cc: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/mvtwsi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index ab7481a0d4..3765fed50d 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -595,7 +595,7 @@ static int __twsi_i2c_read(struct mvtwsi_registers *twsi, uchar chip,
status = i2c_begin(twsi, expected_start, (chip << 1), tick);
/* Send address bytes */
while ((status == 0) && alen--)
- status = twsi_send(twsi, *(addr++),
+ status = twsi_send(twsi, addr[alen],
MVTWSI_STATUS_DATA_W_ACK, tick);
/* Send repeated STARTs after the initial START */
expected_start = MVTWSI_STATUS_REPEATED_START;
@@ -642,7 +642,7 @@ static int __twsi_i2c_write(struct mvtwsi_registers *twsi, uchar chip,
status = i2c_begin(twsi, MVTWSI_STATUS_START, (chip << 1), tick);
/* Send address bytes */
while ((status == 0) && (alen-- > 0))
- status = twsi_send(twsi, *(addr++), MVTWSI_STATUS_DATA_W_ACK,
+ status = twsi_send(twsi, addr[alen], MVTWSI_STATUS_DATA_W_ACK,
tick);
/* Send data bytes */
while ((status == 0) && (length-- > 0))