* [PATCH] eeprom: at24: fix reading from 24MAC402/24MAC602
@ 2017-11-24 6:42 Heiner Kallweit
2017-11-27 13:51 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2017-11-24 6:42 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: linux-i2c@vger.kernel.org
Chip datasheet mentions that word addresses other than the actual
start position of the MAC delivers undefined results. So fix this.
Fixes: 0b813658c115 "eeprom: at24: add support for at24mac series"
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/misc/eeprom/at24.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index e0b4b36ef..00d602be7 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -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;
--
2.15.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] eeprom: at24: fix reading from 24MAC402/24MAC602
2017-11-24 6:42 [PATCH] eeprom: at24: fix reading from 24MAC402/24MAC602 Heiner Kallweit
@ 2017-11-27 13:51 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2017-11-27 13:51 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-i2c@vger.kernel.org
2017-11-24 7:42 GMT+01:00 Heiner Kallweit <hkallweit1@gmail.com>:
> Chip datasheet mentions that word addresses other than the actual
> start position of the MAC delivers undefined results. So fix this.
>
Could you also mention in the commit message, that the current
implementation doesn't work because the offset is simply wrong?
Thanks,
Bartosz
> Fixes: 0b813658c115 "eeprom: at24: add support for at24mac series"
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/misc/eeprom/at24.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index e0b4b36ef..00d602be7 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -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;
> --
> 2.15.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-27 13:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-24 6:42 [PATCH] eeprom: at24: fix reading from 24MAC402/24MAC602 Heiner Kallweit
2017-11-27 13:51 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).