public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] i2c: mv_i2c.c: Correct address endianness
@ 2016-12-13 17:49 Bradley Bolen
  2016-12-19  5:56 ` Stefan Roese
  0 siblings, 1 reply; 3+ messages in thread
From: Bradley Bolen @ 2016-12-13 17:49 UTC (permalink / raw)
  To: u-boot

0c0f719ad2f46c8566a56daee37ebdb7c078c3b1 accidentally changed the
endianness of the i2c read and write addresses.  This was noticable when
accessing EEPROMs that use 2 byte addressing as the LSB was being sent
first.

Signed-off-by: Bradley Bolen <bradleybolen@gmail.com>
---
 drivers/i2c/mv_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c
index 7f52fa2..c780272 100644
--- a/drivers/i2c/mv_i2c.c
+++ b/drivers/i2c/mv_i2c.c
@@ -270,7 +270,7 @@ static int __i2c_read(struct mv_i2c *base, uchar chip, u8 *addr, int alen,
 		msg.condition = I2C_COND_NORMAL;
 		msg.acknack   = I2C_ACKNAK_WAITACK;
 		msg.direction = I2C_WRITE;
-		msg.data      = *(addr++);
+		msg.data      = addr[alen];
 		if (i2c_transfer(base, &msg))
 			return -1;
 	}
@@ -341,7 +341,7 @@ static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen,
 		msg.condition = I2C_COND_NORMAL;
 		msg.acknack   = I2C_ACKNAK_WAITACK;
 		msg.direction = I2C_WRITE;
-		msg.data      = *(addr++);
+		msg.data      = addr[alen];
 		if (i2c_transfer(base, &msg))
 			return -1;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-19  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-13 17:49 [U-Boot] [PATCH] i2c: mv_i2c.c: Correct address endianness Bradley Bolen
2016-12-19  5:56 ` Stefan Roese
2016-12-19  6:22   ` Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox