Dear Nikita Kiryanov,

On Wed, 27 Nov 2013 17:52:31 +0200, Nikita Kiryanov wrote:

> The zeroing of the cnt register also happens in other places in the
> driver, and it is entirely possible that they should be removed for
> OMAP3s as well.
> 
> In my patch I removed it only for i2c_write() because the original
> driver also zeroed the cnt register in I/O functions- except in
> i2c_write(), and I decided to follow the original driver's lead.
> 
> What happens if you remove all the lines that zero the cnt register?

It works. I've removed all the writew(0, ...cnt register...), and then
I've done at least 20 boots of the IGEP board, and all of them were
successful.

I've attached the ugly patch that comments out all of those cases. Of
course, it's not a patch intended for merging, just to show which
locations I've commented.

Since I've absolutely no idea of the background for the problem, would
you mind submitting a proper patch with a good explanation? I will be
happy to test it, of course.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index ef38d71..54c36d8 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -165,7 +165,7 @@ void i2c_init(int speed, int slaveadd)
 	udelay(1000);
 	flush_fifo();
 	writew(0xFFFF, &i2c_base->stat);
-	writew(0, &i2c_base->cnt);
+	//	writew(0, &i2c_base->cnt);
 
 	if (gd->flags & GD_FLG_RELOC)
 		bus_initialized[current_bus] = 1;
@@ -205,7 +205,7 @@ int i2c_probe(uchar chip)
 		return res;
 
 	/* No data transfer, slave addr only */
-	writew(0, &i2c_base->cnt);
+	//writew(0, &i2c_base->cnt);
 	/* Set slave address */
 	writew(chip, &i2c_base->sa);
 	/* Stop bit needed here */
@@ -241,7 +241,7 @@ int i2c_probe(uchar chip)
 pr_exit:
 	flush_fifo();
 	writew(0xFFFF, &i2c_base->stat);
-	writew(0, &i2c_base->cnt);
+	//writew(0, &i2c_base->cnt);
 	return res;
 }
 
@@ -377,7 +377,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
 rd_exit:
 	flush_fifo();
 	writew(0xFFFF, &i2c_base->stat);
-	writew(0, &i2c_base->cnt);
+	//writew(0, &i2c_base->cnt);
 	return i2c_error;
 }
 
@@ -476,7 +476,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
 wr_exit:
 	flush_fifo();
 	writew(0xFFFF, &i2c_base->stat);
-	writew(0, &i2c_base->cnt);
+	//writew(0, &i2c_base->cnt);
 	return i2c_error;
 }
 
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to