i2c: mv_i2c.c: Correct address endianness
PATCH 1/1 i2c: mv_i2c.c: Correct address endianness
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.
--- drivers/i2c/mv_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/mv_i2c.c +2 -2
@@ -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 ; }
Signature · 1 line
2.7.4
PATCH 1/1 i2c: mv_i2c.c: Correct address endianness
Quoted 25 lines · Bradley Bolen
0c0f719ad2f46c8566a56daee37ebdb7c078c3b1accidentally 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 <[email protected]>--- drivers/i2c/mv_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/i2c/mv_i2c.c +1
-1@@ -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 ; }
drivers/i2c/mv_i2c.c static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen, · line 347
Quoted 8 lines
drivers/i2c/mv_i2c.c +1
-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 ; }
Thanks for spotting:
Thanks,
Stefan
PATCH 1/1 i2c: mv_i2c.c: Correct address endianness
Hello Stefan,
Am 19.12.2016 um 06:56 schrieb Stefan Roese:
Quoted 37 lines · Bradley Bolen
Quoted 25 lines
0c0f719ad2f46c8566a56daee37ebdb7c078c3b1accidentally 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 <[email protected]>--- drivers/i2c/mv_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/i2c/mv_i2c.c +1
-1@@ -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 ; }drivers/i2c/mv_i2c.c static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen, · line 347
Quoted 8 lines
drivers/i2c/mv_i2c.c +1
-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 ; }Thanks for spotting:
Quoted 1 line
Rewiewed-by Stefan Roese <[email protected]>
Typo ... I fix this when applying this patch.
Thanks!
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany