Skip to content

Commit

Permalink
eeprom: at24: fix reading from 24MAC402/24MAC602
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Fixes: 0b81365 ("eeprom: at24: add support for at24mac series")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
  • Loading branch information
Heiner Kallweit authored and Bartosz Golaszewski committed Nov 29, 2017
1 parent 5478e47 commit 644a1f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/misc/eeprom/at24.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf,
memset(msg, 0, sizeof(msg));
msg[0].addr = client->addr;
msg[0].buf = addrbuf;
addrbuf[0] = 0x90 + offset;
/* EUI-48 starts from 0x9a, EUI-64 from 0x98 */
addrbuf[0] = 0xa0 - at24->chip.byte_len + offset;
msg[0].len = 1;
msg[1].addr = client->addr;
msg[1].flags = I2C_M_RD;
Expand Down

0 comments on commit 644a1f1

Please sign in to comment.