diff options
| author | Tom Rini <trini@ti.com> | 2014-01-20 07:51:22 -0500 |
|---|---|---|
| committer | Tom Rini <trini@ti.com> | 2014-01-20 07:51:22 -0500 |
| commit | 55ca99f8940e230366cadd522702fac9f962e904 (patch) | |
| tree | d767ca262f9d015df4b1c18aa80468a97fccdc5c /drivers/i2c/designware_i2c.c | |
| parent | 4641c211f6e37454c30770521c4de79c725036b0 (diff) | |
| parent | dccacbe01968f9e682cb1dc9b7d43c831897cbec (diff) | |
| download | olio-uboot-2014.01-55ca99f8940e230366cadd522702fac9f962e904.tar.xz olio-uboot-2014.01-55ca99f8940e230366cadd522702fac9f962e904.zip | |
Merge branch 'master' of git://git.denx.de/u-boot-i2c
Diffstat (limited to 'drivers/i2c/designware_i2c.c')
| -rw-r--r-- | drivers/i2c/designware_i2c.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index cb2ac04b6..9ed929521 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -266,6 +266,25 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) { unsigned long start_time_rx; +#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. + */ + chip |= ((addr >> (alen * 8)) & CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW); + addr &= ~(CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW << (alen * 8)); + + debug("%s: fix addr_overflow: chip %02x addr %02x\n", __func__, chip, + addr); +#endif + if (check_params(addr, alen, buffer, len)) return 1; @@ -307,6 +326,25 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) int nb = len; unsigned long start_time_tx; +#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. + */ + chip |= ((addr >> (alen * 8)) & CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW); + addr &= ~(CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW << (alen * 8)); + + debug("%s: fix addr_overflow: chip %02x addr %02x\n", __func__, chip, + addr); +#endif + if (check_params(addr, alen, buffer, len)) return 1; |