From: Alexey Brodkin Date: Thu, 7 Nov 2013 13:52:18 +0000 (+0400) Subject: designware_i2c: disable i2c controller during target address setup X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=8b7c87253960aac0b670e606d8dbe2f64b1e5652;p=u-boot.git designware_i2c: disable i2c controller during target address setup As it is stated in DesignWare I2C databook: writes to IC_TAR (0x4) register succeed only when IC_ENABLE[0] is set to 0. Signed-off-by: Alexey Brodkin Cc: Tom Rini cc: Armando Visconti Cc: Stefan Roese Cc: Albert ARIBAUD Cc: Heiko Schocher Cc: Vipin KUMAR Cc: Tom Rix Cc: Mischa Jonker --- diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index c2f06627d3..c5c6015e99 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -151,7 +151,19 @@ void i2c_init(int speed, int slaveadd) */ static void i2c_setaddress(unsigned int i2c_addr) { + unsigned int enbl; + + /* Disable i2c */ + enbl = readl(&i2c_regs_p->ic_enable); + enbl &= ~IC_ENABLE_0B; + writel(enbl, &i2c_regs_p->ic_enable); + writel(i2c_addr, &i2c_regs_p->ic_tar); + + /* Enable i2c */ + enbl = readl(&i2c_regs_p->ic_enable); + enbl |= IC_ENABLE_0B; + writel(enbl, &i2c_regs_p->ic_enable); } /*