[U-Boot] [PATCH] designware_i2c: disable i2c controller during target address setup

Alexey Brodkin Alexey.Brodkin at synopsys.com
Thu Nov 7 14:52:18 CET 2013


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 <abrodkin at synopsys.com>

Cc: Tom Rini <trini at ti.com>
cc: Armando Visconti <armando.visconti at st.com>
Cc: Stefan Roese <sr at denx.de>
Cc: Albert ARIBAUD <albert.u.boot at aribaud.net>
Cc: Heiko Schocher <hs at denx.de>
Cc: Vipin KUMAR <vipin.kumar at st.com>
Cc: Tom Rix <Tom.Rix at windriver.com>
Cc: Mischa Jonker <mjonker at synopsys.com>
---
 drivers/i2c/designware_i2c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index c2f0662..c5c6015 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);
 }
 
 /*
-- 
1.8.4.2



More information about the U-Boot mailing list