]> git.dujemihanovic.xyz Git - u-boot.git/commit
i2c: designware_i2c: Restore enable state after set speed
authorJun Chen <ptchentw@gmail.com>
Wed, 5 Jun 2019 07:23:16 +0000 (15:23 +0800)
committerHeiko Schocher <hs@denx.de>
Tue, 9 Jul 2019 05:02:10 +0000 (07:02 +0200)
commite3b93dcee88ff2c782790f8ad556d12f142efc4e
tree28293d2b31048a5b18aa5f9cf785f10efe1ec0f3
parente5aee22e4be75e75a854ab64503fc80598bc2004
i2c: designware_i2c: Restore enable state after set speed

Before calling __dw_i2c_set_bus_speed(),
the I2C could already be set as ether enable or disable,
we should restore the original setting instead of enable i2c anyway.

This patch fix a bug happened in init function:
    __dw_i2c_init(){
            /* Disable i2c */
            ...
            __dw_i2c_set_bus_speed(i2c_base, NULL, speed);
            writel(slaveaddr, &i2c_base->ic_sar);
            /* Enable i2c */
    }
In this case, enable i2c inside __dw_i2c_set_bus_speed() function
will cause ic_sar write fail.

Signed-off-by: Jun Chen <ptchentw@gmail.com>
drivers/i2c/designware_i2c.c