]> git.sur5r.net Git - u-boot/commitdiff
beagle: expansion boards: retry i2c_read with 16bit addressing
authorrobertcnelson@gmail.com <robertcnelson@gmail.com>
Mon, 4 Feb 2013 06:03:10 +0000 (06:03 +0000)
committerTom Rini <trini@ti.com>
Mon, 18 Feb 2013 18:48:04 +0000 (13:48 -0500)
Some expansion boards now ship with at24 eeproms that need to communicate
via 16bit addressing.

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
board/ti/beagle/beagle.c

index b829a792b2c49b06e04508ce3b2bf9b4f3eb225a..9493c6b4927a6e467c34abe05105b165926a4aef 100644 (file)
@@ -227,6 +227,14 @@ static unsigned int get_expansion_id(void)
        i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
                 sizeof(expansion_config));
 
+       /* retry reading configuration data with 16bit addressing */
+       if ((expansion_config.device_vendor == 0xFFFFFF00) ||
+           (expansion_config.device_vendor == 0xFFFFFFFF)) {
+               printf("EEPROM is blank or 8bit addressing failed: retrying with 16bit:\n");
+               i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 2, (u8 *)&expansion_config,
+                        sizeof(expansion_config));
+       }
+
        i2c_set_bus_num(TWL4030_I2C_BUS);
 
        return expansion_config.device_vendor;