tegra: Avoid using I2C prior to relocation
authorSimon Glass <sjg@chromium.org>
Wed, 7 Aug 2013 05:52:25 +0000 (22:52 -0700)
committerTom Rini <trini@ti.com>
Tue, 13 Aug 2013 21:11:25 +0000 (17:11 -0400)
Tegra recently moved to the new I2C framework, which sets up I2C prior to
relocation, and prior to calling i2c_init_board(). This causes a crash on
Tegra boards.

Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/i2c/tegra_i2c.c

index 9ac3969a07cfe1d71df571b978e815ff95abbf03..9847cf126bf26104c268c54ddead0f22033b881d 100644 (file)
@@ -453,6 +453,10 @@ void i2c_init_board(void)
 
 static void tegra_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
 {
+       /* No i2c support prior to relocation */
+       if (!(gd->flags & GD_FLG_RELOC))
+               return;
+
        /* This will override the speed selected in the fdt for that port */
        debug("i2c_init(speed=%u, slaveaddr=0x%x)\n", speed, slaveaddr);
        i2c_set_bus_speed(speed);