]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
i2c: Fix i2c speed command
authorDarwin Rambo <drambo@broadcom.com>
Fri, 13 Dec 2013 20:57:26 +0000 (12:57 -0800)
committerHeiko Schocher <hs@denx.de>
Mon, 13 Jan 2014 07:17:51 +0000 (08:17 +0100)
This corrects i2c core to interpret the value returned by
i2c_set_bus_speed as a success indicator rather than the
actual speed that was set. When i2c_set_bus_speed returns
a failure code, the speed is unknown so the adapter speed
is set to zero.

Signed-off-by: Darwin Rambo <drambo@broadcom.com>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Steve Rae <srae@broadcom.com>
Acked-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
drivers/i2c/i2c_core.c

index e1767f4bd4546aa53459ee52a708fb41a88dcb43..18d6736601c161f45cb7d81b5eae53bdeaaf6b0b 100644 (file)
@@ -349,7 +349,7 @@ unsigned int i2c_set_bus_speed(unsigned int speed)
                return 0;
        ret = I2C_ADAP->set_bus_speed(I2C_ADAP, speed);
        if (gd->flags & GD_FLG_RELOC)
-               I2C_ADAP->speed = ret;
+               I2C_ADAP->speed = (ret == 0) ? speed : 0;
 
        return ret;
 }