summaryrefslogtreecommitdiff
path: root/drivers/misc/i2c_eeprom.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-05-29 23:54:01 -0400
committerTom Rini <trini@konsulko.com>2020-05-29 23:54:01 -0400
commit29b0540d5acc35c8096d7147d7574d0b3ae7dcc0 (patch)
tree6db3ed3db2915a836f446f1adcf482146792338e /drivers/misc/i2c_eeprom.c
parent606cced58bf44bdf640760711be40d15a169aa71 (diff)
parentb24dc83f156604f253ef6521776444188c5bff9b (diff)
Merge tag 'bugfixes-for-v2020.07-rc4' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c
i2c changes for v2020.07-rc4 - fix eeprom issue with AT24MAC402 (address != 0) - fix in i2c-uclass.c when compiling compiling with -Wtype-limits - designware_i2c: small fixes: - check if the device is powered - tidy up use of NULL priv
Diffstat (limited to 'drivers/misc/i2c_eeprom.c')
-rw-r--r--drivers/misc/i2c_eeprom.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index ed23a623846..45c34d388c8 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -18,6 +18,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)
@@ -148,7 +149,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;
@@ -216,6 +221,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 = {