Skip to content

Commit

Permalink
ti: common: Remove additional i2c read for board detection
Browse files Browse the repository at this point in the history
There shouldn't be a need to call additional i2c read if above failed
already. Based on comment it should be enough to try to detect legacy
boards which are mentioned in the comment.

Fixes: 2463f67 ("ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT")
Fixes: 0bea813 ("ARM: omap-common: Add standard access for board description EEPROM")
Signed-off-by: Michal Simek <[email protected]>
  • Loading branch information
Michal Simek authored and lokeshvutla committed Aug 31, 2020
1 parent e66ae8e commit b892b6d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions board/ti/common/board_detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,15 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,

/* Corrupted data??? */
if (hdr_read != header) {
rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4);
/*
* read the eeprom header using i2c again, but use only a
* 1 byte address (some legacy boards need this..)
*/
if (rc) {
rc = i2c_set_chip_offset_len(dev, 1);
if (rc)
return rc;
rc = i2c_set_chip_offset_len(dev, 1);
if (rc)
return rc;

rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4);
}
rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4);
if (rc)
return rc;
}
Expand Down Expand Up @@ -153,16 +150,13 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,

/* Corrupted data??? */
if (hdr_read != header) {
rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read, 4);
/*
* read the eeprom header using i2c again, but use only a
* 1 byte address (some legacy boards need this..)
*/
byte = 1;
if (rc) {
rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read,
4);
}
rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read,
4);
if (rc)
return rc;
}
Expand Down

0 comments on commit b892b6d

Please sign in to comment.