Skip to content

Commit 644a1f1

Browse files
hkallweitbrgl
authored andcommitted
eeprom: at24: fix reading from 24MAC402/24MAC602
Chip datasheet mentions that word addresses other than the actual start position of the MAC delivers undefined results. So fix this. Current implementation doesn't work due to this wrong offset. Cc: [email protected] Fixes: 0b81365 ("eeprom: at24: add support for at24mac series") Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 5478e47 commit 644a1f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/misc/eeprom/at24.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf,
425425
memset(msg, 0, sizeof(msg));
426426
msg[0].addr = client->addr;
427427
msg[0].buf = addrbuf;
428-
addrbuf[0] = 0x90 + offset;
428+
/* EUI-48 starts from 0x9a, EUI-64 from 0x98 */
429+
addrbuf[0] = 0xa0 - at24->chip.byte_len + offset;
429430
msg[0].len = 1;
430431
msg[1].addr = client->addr;
431432
msg[1].flags = I2C_M_RD;

0 commit comments

Comments
 (0)