]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
i2c: designware_i2c: Correct the selection of speed mode
authorSimon Glass <sjg@chromium.org>
Thu, 13 Feb 2020 20:24:55 +0000 (13:24 -0700)
committerHeiko Schocher <hs@denx.de>
Tue, 18 Feb 2020 07:16:45 +0000 (08:16 +0100)
Unfortunately a recent change adjusted the order of the checks here such
that 400MHz now shows up as fast-plus speed (1Mbps). Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: d96440d1e3 ("i2c: designware_i2c: Add support for fast-plus speed")
drivers/i2c/designware_i2c.c

index e1d5aeb19db9e670219053bd021269aa7e2ec43d..0b5e70af591cbf031a7eb83a5d416f696f5cfb9d 100644 (file)
@@ -212,9 +212,9 @@ static int calc_bus_speed(struct dw_i2c *priv, int speed, ulong bus_clk,
        if (speed >= I2C_SPEED_HIGH_RATE &&
            (!scl_sda_cfg || scl_sda_cfg->has_high_speed))
                i2c_spd = IC_SPEED_MODE_HIGH;
-       else if (speed >= I2C_SPEED_FAST_RATE)
-               i2c_spd = IC_SPEED_MODE_FAST_PLUS;
        else if (speed >= I2C_SPEED_FAST_PLUS_RATE)
+               i2c_spd = IC_SPEED_MODE_FAST_PLUS;
+       else if (speed >= I2C_SPEED_FAST_RATE)
                i2c_spd = IC_SPEED_MODE_FAST;
        else
                i2c_spd = IC_SPEED_MODE_STANDARD;