misc: i2c_eeprom: implement different probe test eeprom offset
PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
Because of this commit :5ae84860b0 ("misc: i2c_eeprom: verify that the chip is functional at probe()") at probe time, each eeprom is tested for read at offset 0.
The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is used for the lower 0x80 bytes and another i2c slave address is used for the upper 0x80 bytes. Because of this basically the i2c master sees 2 different slaves. We need the upper bytes because we read the unique MAC address from this EEPROM area.
However this implies that our slave address will return error on reads from address 0x0 to 0x80.
To solve this, implemented an offset field inside platform data that is by default 0 (as it is used now), but can be changed in the compatible table.
The probe function will now read at this offset and use it, instead of blindly checking offset 0.
This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
---
Please disregard patch
[PATCH] misc: i2c_eeprom: implement different probe test eeprom offset
as that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.
drivers/misc/i2c_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/misc/i2c_eeprom.c +7 -1
@@ -17,6 +17,7 @@ struct i2c_eeprom_drv_data {u32 pagesize;/* page size in bytes */ u32 addr_offset_mask;/* bits in addr used for offset overflow */ u32 offset_len;/* size in bytes of offset */ +u32 start_offset;/* valid start offset inside memory, by default 0 */ };int i2c_eeprom_read (struct udevice *dev,int offset,uint8_t *buf,int size)
@@ -147,7 +148,11 @@ static int i2c_eeprom_std_probe(struct udevice *dev)i2c_set_chip_addr_offset_mask (dev, data->addr_offset_mask);/* Verify that the chip is functional */ - ret =i2c_eeprom_read (dev,0 , &test_byte,1 ); +/* +* Not all eeproms start from offset 0. Valid offset is available +* in the platform data struct. +*/ + ret =i2c_eeprom_read (dev, data->start_offset, &test_byte,1 );if (ret)return -ENODEV ;
@@ -215,6 +220,7 @@ static const struct i2c_eeprom_drv_data atmel24mac402_data = { .pagesize = 16, .addr_offset_mask = 0, .offset_len = 1, + .start_offset = 0x80, };static const struct i2c_eeprom_drv_data atmel24c32_data = {
Signature · 1 line
2.25.1
PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
Hello Eugen,
Am 07.05.2020 um 10:53 schrieb Eugen Hristev:
Quoted 28 lines
Because of this commit :
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()") at probe time, each eeprom is tested for read at offset 0.The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is used for the lower
0x80bytes and another i2c slave address is used for the upper0x80bytes. Because of this basically the i2c master sees 2 different slaves. We need the upper bytes because we read the unique MAC address from this EEPROM area.However this implies that our slave address will return error on reads from address
0x0to0x80.To solve this, implemented an offset field inside platform data that is by default 0 (as it is used now), but can be changed in the compatible table.
The probe function will now read at this offset and use it, instead of blindly checking offset 0.
This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
Signed-off-by Eugen Hristev <[email protected]>---
Please disregard patch
[PATCH] misc:i2c_eeprom: implement different probe test eeprom offset
Quoted 8 lines
as that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.drivers/misc/i2c_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Thanks for rebasing!
I prefer to fix the issue instead reverting commit:
5ae84860b0 ("misc: i2c_eeprom: verify that the chip is functional at probe()")
@Baruch, is this Ok for you?
bye,
Heiko
Quoted 35 lines
drivers/misc/i2c_eeprom.c +7
-1@@ -17,6 +17,7 @@ struct i2c_eeprom_drv_data {u32 pagesize;/* page size in bytes */ u32 addr_offset_mask;/* bits in addr used for offset overflow */ u32 offset_len;/* size in bytes of offset */ +u32 start_offset;/* valid start offset inside memory, by default 0 */ };int i2c_eeprom_read (struct udevice *dev,int offset,uint8_t *buf,int size)@@ -147,7 +148,11 @@ static int i2c_eeprom_std_probe(struct udevice *dev)i2c_set_chip_addr_offset_mask (dev, data->addr_offset_mask);/* Verify that the chip is functional */ - ret =i2c_eeprom_read (dev,0 , &test_byte,1 ); +/* +* Not all eeproms start from offset 0. Valid offset is available +* in the platform data struct. +*/ + ret =i2c_eeprom_read (dev, data->start_offset, &test_byte,1 );if (ret)return -ENODEV ;@@ -215,6 +220,7 @@ static const struct i2c_eeprom_drv_data atmel24mac402_data = { .pagesize = 16, .addr_offset_mask = 0, .offset_len = 1, + .start_offset = 0x80, };static const struct i2c_eeprom_drv_data atmel24c32_data = {
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
Hi Heiko,
Quoted 40 lines · Heiko Schocher
Am 07.05.2020 um 10:53 schrieb Eugen Hristev:
Quoted 28 lines
Because of this commit :
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()") at probe time, each eeprom is tested for read at offset 0.The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is used for the lower
0x80bytes and another i2c slave address is used for the upper0x80bytes. Because of this basically the i2c master sees 2 different slaves. We need the upper bytes because we read the unique MAC address from this EEPROM area.However this implies that our slave address will return error on reads from address
0x0to0x80.To solve this, implemented an offset field inside platform data that is by default 0 (as it is used now), but can be changed in the compatible table.
The probe function will now read at this offset and use it, instead of blindly checking offset 0.
This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
Signed-off-by Eugen Hristev <[email protected]>---
Please disregard patch
[PATCH] misc:i2c_eeprom: implement different probe test eeprom offsetQuoted 8 lines
as that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.drivers/misc/i2c_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)Thanks for rebasing!
Quoted 7 lines
I prefer to fix the issue instead reverting commit:
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()")Reviewed-by Heiko Schocher <[email protected]>@Baruch, is this Ok for you?
According to the Linux driver there are more devices that need read offset. 24cs32 and 24cs64 are affected. This patch does not fix the regression for those devices.
Eugen, would it be possible for you to extend the fix to 24cs32/64 and test on real hardware?
baruch
Quoted 32 lines
Quoted 32 lines
drivers/misc/i2c_eeprom.c +6
-1@@ -17,6 +17,7 @@ struct i2c_eeprom_drv_data {u32 pagesize;/* page size in bytes */ u32 addr_offset_mask;/* bits in addr used for offset overflow */ u32 offset_len;/* size in bytes of offset */ +u32 start_offset;/* valid start offset inside memory, by default 0 */ };int i2c_eeprom_read (struct udevice *dev,int offset,uint8_t *buf,int size)@@ -147,7 +148,11 @@ static int i2c_eeprom_std_probe(struct udevice *dev)i2c_set_chip_addr_offset_mask (dev, data->addr_offset_mask);/* Verify that the chip is functional */ - ret =i2c_eeprom_read (dev,0 , &test_byte,1 ); +/* +* Not all eeproms start from offset 0. Valid offset is available +* in the platform data struct. +*/ + ret =i2c_eeprom_read (dev, data->start_offset, &test_byte,1 );if (ret)return -ENODEV ; @@ -215,6 +220,7 @@ static const struct i2c_eeprom_drv_data atmel24mac402_data = {.pagesize = 16,
.addr_offset_mask = 0,
.offset_len = 1,drivers/misc/i2c_eeprom.c +1
-0+ .start_offset = 0x80, };static const struct i2c_eeprom_drv_data atmel24c32_data = {
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
Quoted 49 lines · Baruch Siach
Hi Heiko,
Quoted 46 lines · Heiko Schocher
Am 07.05.2020 um 10:53 schrieb Eugen Hristev:
Quoted 28 lines
Because of this commit :
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()") at probe time, each eeprom is tested for read at offset 0.The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is used for the lower
0x80bytes and another i2c slave address is used for the upper0x80bytes. Because of this basically the i2c master sees 2 different slaves. We need the upper bytes because we read the unique MAC address from this EEPROM area.However this implies that our slave address will return error on reads from address
0x0to0x80.To solve this, implemented an offset field inside platform data that is by default 0 (as it is used now), but can be changed in the compatible table.
The probe function will now read at this offset and use it, instead of blindly checking offset 0.
This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
Signed-off-by Eugen Hristev <[email protected]>---
Please disregard patch
[PATCH] misc:i2c_eeprom: implement different probe test eeprom offsetQuoted 8 lines
as that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.drivers/misc/i2c_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)Thanks for rebasing!
I prefer to fix the issue instead reverting commit:
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()")Reviewed-by Heiko Schocher <[email protected]>
Quoted 8 lines
Quoted 1 line
@Baruch, is this Ok for you?
According to the Linux driver there are more devices that need read offset. 24cs32 and 24cs64 are affected. This patch does not fix the regression for those devices.
Eugen, would it be possible for you to extend the fix to 24cs32/64 and test on real hardware?
Hi Baruch,
This patch fixes my issue at hand and the eeprom which I have at my disposal. I will look to see if I have those, but, most likely not. I can extend the fix, but I cannot test, so, I rather not go blind with it.
Eugen
Quoted 42 lines
baruch
Quoted 24 lines
Quoted 24 lines
drivers/misc/i2c_eeprom.c +6
-1@@ -17,6 +17,7 @@ struct i2c_eeprom_drv_data {u32 pagesize;/* page size in bytes */ u32 addr_offset_mask;/* bits in addr used for offset overflow */ u32 offset_len;/* size in bytes of offset */ +u32 start_offset;/* valid start offset inside memory, by default 0 */ };int i2c_eeprom_read (struct udevice *dev,int offset,uint8_t *buf,int size)@@ -147,7 +148,11 @@ static int i2c_eeprom_std_probe(struct udevice *dev)i2c_set_chip_addr_offset_mask (dev, data->addr_offset_mask);/* Verify that the chip is functional */ - ret =i2c_eeprom_read (dev,0 , &test_byte,1 ); +/* +* Not all eeproms start from offset 0. Valid offset is available +* in the platform data struct. +*/ + ret =i2c_eeprom_read (dev, data->start_offset, &test_byte,1 );if (ret)return -ENODEV ; @@ -215,6 +220,7 @@ static const struct i2c_eeprom_drv_dataQuoted 8 lines
Quoted 8 lines
drivers/misc/i2c_eeprom.c +0
-0atmel24mac402_data = {.pagesize = 16, .addr_offset_mask = 0, .offset_len = 1, + .start_offset = 0x80, }; static const struct i2c_eeprom_drv_data atmel24c32_data = {--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
Hello Eugen,
Am 07.05.2020 um 17:08 schrieb Eugen.Hristev at microchip.com:
Quoted 56 lines · Baruch Siach
Quoted 55 lines
Hi Heiko,
Quoted 40 lines · Heiko Schocher
Am 07.05.2020 um 10:53 schrieb Eugen Hristev:
Quoted 28 lines
Because of this commit :
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()") at probe time, each eeprom is tested for read at offset 0.The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is used for the lower
0x80bytes and another i2c slave address is used for the upper0x80bytes. Because of this basically the i2c master sees 2 different slaves. We need the upper bytes because we read the unique MAC address from this EEPROM area.However this implies that our slave address will return error on reads from address
0x0to0x80.To solve this, implemented an offset field inside platform data that is by default 0 (as it is used now), but can be changed in the compatible table.
The probe function will now read at this offset and use it, instead of blindly checking offset 0.
This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
Signed-off-by Eugen Hristev <[email protected]>---
Please disregard patch
[PATCH] misc:i2c_eeprom: implement different probe test eeprom offsetQuoted 8 lines
as that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.drivers/misc/i2c_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)Thanks for rebasing!
Quoted 7 lines
I prefer to fix the issue instead reverting commit:
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()")Reviewed-by Heiko Schocher <[email protected]>@Baruch, is this Ok for you?
According to the Linux driver there are more devices that need read offset. 24cs32 and 24cs64 are affected. This patch does not fix the regression for those devices.
Quoted 8 lines
Quoted 2 lines
Eugen, would it be possible for you to extend the fix to 24cs32/64 and test on real hardware?
Hi Baruch,
This patch fixes my issue at hand and the eeprom which I have at my disposal. I will look to see if I have those, but, most likely not. I can extend the fix, but I cannot test, so, I rather not go blind with it.
Any news here?
Thanks!
bye,
HEiko
Quoted 45 lines
Eugen
Quoted 42 lines
baruch
Quoted 24 lines
Quoted 24 lines
drivers/misc/i2c_eeprom.c +6
-1@@ -17,6 +17,7 @@ struct i2c_eeprom_drv_data {u32 pagesize;/* page size in bytes */ u32 addr_offset_mask;/* bits in addr used for offset overflow */ u32 offset_len;/* size in bytes of offset */ +u32 start_offset;/* valid start offset inside memory, by default 0 */ };int i2c_eeprom_read (struct udevice *dev,int offset,uint8_t *buf,int size)@@ -147,7 +148,11 @@ static int i2c_eeprom_std_probe(struct udevice *dev)i2c_set_chip_addr_offset_mask (dev, data->addr_offset_mask);/* Verify that the chip is functional */ - ret =i2c_eeprom_read (dev,0 , &test_byte,1 ); +/* +* Not all eeproms start from offset 0. Valid offset is available +* in the platform data struct. +*/ + ret =i2c_eeprom_read (dev, data->start_offset, &test_byte,1 );if (ret)return -ENODEV ; @@ -215,6 +220,7 @@ static const struct i2c_eeprom_drv_dataQuoted 8 lines
Quoted 8 lines
drivers/misc/i2c_eeprom.c +0
-0atmel24mac402_data = {.pagesize = 16, .addr_offset_mask = 0, .offset_len = 1, + .start_offset = 0x80, }; static const struct i2c_eeprom_drv_data atmel24c32_data = {--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
Quoted 72 lines · Heiko Schocher
Hello Eugen,
Am 07.05.2020 um 17:08 schrieb Eugen.Hristev at microchip.com:
Quoted 69 lines · Baruch Siach
Quoted 67 lines
Hi Heiko,
Quoted 49 lines · Heiko Schocher
Am 07.05.2020 um 10:53 schrieb Eugen Hristev:
Quoted 39 lines
Because of this commit :
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()")
at probe time, each eeprom is tested for read at offset 0.The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is
used for the lower0x80bytes and another i2c slave address is used for the
upper0x80bytes. Because of this basically the i2c master sees 2 different
slaves. We need the upper bytes because we read the unique MAC address from
this EEPROM area.However this implies that our slave address will return error on reads from address
0x0to0x80.To solve this, implemented an offset field inside platform data that is by
default 0 (as it is used now), but can be changed in the compatible table.The probe function will now read at this offset and use it, instead of blindly
checking offset 0.This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
Signed-off-by Eugen Hristev <[email protected]>---
Please disregard patch
[PATCH] misc:i2c_eeprom: implement different probe test eeprom offsetas that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Quoted 6 lines
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.???
drivers/misc/i2c_eeprom.c| 8 +++++++- ??? 1 file changed, 7 insertions(+), 1 deletion(-)Thanks for rebasing!
Quoted 8 lines
I prefer to fix the issue instead reverting commit:
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()")Reviewed-by Heiko Schocher <[email protected]>@Baruch, is this Ok for you?
According to the Linux driver there are more devices that need read offset. 24cs32 and 24cs64 are affected. This patch does not fix the regression for those devices.
Eugen, would it be possible for you to extend the fix to 24cs32/64 and test on real hardware?
Quoted 8 lines
Quoted 6 lines
Hi Baruch,
This patch fixes my issue at hand and the eeprom which I have at my disposal. I will look to see if I have those, but, most likely not. I can extend the fix, but I cannot test, so, I rather not go blind with it.
Any news here?
Hello Heiko,
I do not have any other memory in the compatible list at my disposal right now. I assumed that you would take this patch as-is. If I hit the issue on another memory, I will send another patch.
Right now with the lockdown this is the only memory I have.
Eugen
Quoted 62 lines
Thanks!
bye,
HEikoQuoted 52 lines
Eugen
Quoted 49 lines
baruch
Quoted 36 lines
Quoted 36 lines
drivers/misc/i2c_eeprom.c +0
-0@@ -17,6 +17,7 @@ struct i2c_eeprom_drv_data {?????? u32 pagesize; /* page size in bytes */
?????? u32addr_offset_mask; /* bits in addr used for offset overflow */
?????? u32offset_len; /* size in bytes of offset */ +??? u32start_offset; /* valid start offset inside memory, by default 0 */
??? };
????? int i2c_eeprom_read(struct udevice *dev, int offset,uint8_t*buf, int
size)drivers/misc/i2c_eeprom.c +0
-0@@ -147,7 +148,11 @@ static int i2c_eeprom_std_probe(struct udevice *dev) ?????? i2c_set_chip_addr_offset_mask(dev, data->addr_offset_mask);?????? /* Verify that the chip is functional */
-??? ret =i2c_eeprom_read(dev, 0, &test_byte, 1);
+??? /*
+???? * Not all eeproms start from offset 0. Valid offset is available +???? * in the platform data struct.
+???? */
+??? ret =i2c_eeprom_read(dev, data->start_offset, &test_byte, 1); ?????? if (ret)
?????????????? return-ENODEV;
??? @@ -215,6 +220,7 @@ static const structi2c_eeprom_drv_dataatmel24mac402_data= {
?????? .pagesize = 16,
?????? .addr_offset_mask = 0,
?????? .offset_len = 1,
+??? .start_offset =0x80,
??? };
????? static const structi2c_eeprom_drv_dataatmel24c32_data= {Signature · 6 lines
?????????????????????????????????????????????????????? ~. .~?? Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= ???? - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -Signature · 3 lines
DENX Software Engineering GmbH,????? Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52?? Fax: +49-8142-66989-80?? Email: hs at denx.de
PATCH v2 1/1 misc: i2c_eeprom: implement different probe test eeprom offset
In reply to Eugen HristevHello Eugen,
Am 07.05.2020 um 10:53 schrieb Eugen Hristev:
Quoted 28 lines
Because of this commit :
5ae84860b0("misc:i2c_eeprom: verify that the chip is functional atprobe()") at probe time, each eeprom is tested for read at offset 0.The Atmel AT24MAC402 eeprom has different mapping. One i2c slave address is used for the lower
0x80bytes and another i2c slave address is used for the upper0x80bytes. Because of this basically the i2c master sees 2 different slaves. We need the upper bytes because we read the unique MAC address from this EEPROM area.However this implies that our slave address will return error on reads from address
0x0to0x80.To solve this, implemented an offset field inside platform data that is by default 0 (as it is used now), but can be changed in the compatible table.
The probe function will now read at this offset and use it, instead of blindly checking offset 0.
This will fix the regression noticed on these EEPROMs since the commit abovementioned that introduces the probe failed issue.
Signed-off-by Eugen Hristev <[email protected]>---
Please disregard patch
[PATCH] misc:i2c_eeprom: implement different probe test eeprom offset
Quoted 8 lines
as that patch was mistakenly done on an older u-boot version. This v2 patch applies correctly on u-boot/master
Changes in v2:
- adapt to latest changes in driver. v1 was done on u-boot 2020.01 accidentaly.drivers/misc/i2c_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Applied to u-boot-i2c master
Thanks!
May we should rethink and look at what linux do, but as it fixes a bug it is ok for me.
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de