diff options
author | Guy Thouret <guy.thouret@wems.co.uk> | 2016-03-11 16:23:41 +0000 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2016-03-28 09:23:28 +0200 |
commit | 32b9b556f7ca198e62646662e3260f8ef352094f (patch) | |
tree | 4ed82bf1cedfc55340e36a63745c4ea60ea8a89a | |
parent | e1bed8027223121254fc3d975ab6684a7b57200c (diff) | |
download | u-boot-imx-32b9b556f7ca198e62646662e3260f8ef352094f.zip u-boot-imx-32b9b556f7ca198e62646662e3260f8ef352094f.tar.gz u-boot-imx-32b9b556f7ca198e62646662e3260f8ef352094f.tar.bz2 |
omap24xx_i2c: Implement CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW
Signed-off-by: Guy Thouret <guy.thouret@wems.co.uk>
Cc: Heiko Schocher <hs@denx.de>
-rw-r--r-- | drivers/i2c/omap24xx_i2c.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 79a5c94..a7f3fb4 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -371,6 +371,23 @@ static int omap24_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr, return 1; } +#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW + /* + * EEPROM chips that implement "address overflow" are ones + * like Catalyst 24WC04/08/16 which has 9/10/11 bits of + * address and the extra bits end up in the "chip address" + * bit slots. This makes a 24WC08 (1Kbyte) chip look like + * four 256 byte chips. + * + * Note that we consider the length of the address field to + * still be one byte because the extra address bits are + * hidden in the chip address. + */ + if (alen > 0) + chip |= ((addr >> (alen * 8)) & + CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW); +#endif + /* Wait until bus not busy */ if (wait_for_bb(adap)) return 1; @@ -501,6 +518,23 @@ static int omap24_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr, return 1; } +#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW + /* + * EEPROM chips that implement "address overflow" are ones + * like Catalyst 24WC04/08/16 which has 9/10/11 bits of + * address and the extra bits end up in the "chip address" + * bit slots. This makes a 24WC08 (1Kbyte) chip look like + * four 256 byte chips. + * + * Note that we consider the length of the address field to + * still be one byte because the extra address bits are + * hidden in the chip address. + */ + if (alen > 0) + chip |= ((addr >> (alen * 8)) & + CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW); +#endif + /* Wait until bus not busy */ if (wait_for_bb(adap)) return 1; |