]> git.sur5r.net Git - u-boot/commitdiff
mxs: i2c: Restore speed setting after block reset
authorMarek Vasut <marex@denx.de>
Fri, 30 Nov 2012 18:17:06 +0000 (18:17 +0000)
committerTom Rini <trini@ti.com>
Tue, 11 Dec 2012 20:17:30 +0000 (13:17 -0700)
The I2C block reset configures the I2C bus speed to strange value.
Read the I2C speed from the block before reseting the block and
restore it afterwards, so the I2C operates correctly. This issue
can be replicated by doing unsuccessful I2C transfer, after such
transfer finishes, the I2C block clock speed is misconfigured.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
drivers/i2c/mxs_i2c.c

index 006fb919f41cbd8aa2d21ab7b5fb372659d5ad83..73a6659dd4102fa53bc6d3d1dfbdca519245e9b1 100644 (file)
@@ -40,6 +40,7 @@ void mxs_i2c_reset(void)
 {
        struct mxs_i2c_regs *i2c_regs = (struct mxs_i2c_regs *)MXS_I2C0_BASE;
        int ret;
+       int speed = i2c_get_bus_speed();
 
        ret = mxs_reset_block(&i2c_regs->hw_i2c_ctrl0_reg);
        if (ret) {
@@ -53,6 +54,8 @@ void mxs_i2c_reset(void)
                &i2c_regs->hw_i2c_ctrl1_clr);
 
        writel(I2C_QUEUECTRL_PIO_QUEUE_MODE, &i2c_regs->hw_i2c_queuectrl_set);
+
+       i2c_set_bus_speed(speed);
 }
 
 void mxs_i2c_setup_read(uint8_t chip, int len)