public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] mpc5200: reduce delays in i2c
@ 2009-03-31  1:03 Jon Smirl
  2009-03-31 20:54 ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Smirl @ 2009-03-31  1:03 UTC (permalink / raw)
  To: u-boot

Make the i2c delays smaller. The measured delay is 55us at
100Khz. Set the delay to 15us which should work for 400Khz.
100Khz will loop four times and get a 60us delay. Previous
total delay was 100,000us new total delay is 150,000us before
timeout.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>

---
 cpu/mpc5xxx/i2c.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpu/mpc5xxx/i2c.c b/cpu/mpc5xxx/i2c.c
index e2506d8..48b6464 100644
--- a/cpu/mpc5xxx/i2c.c
+++ b/cpu/mpc5xxx/i2c.c
@@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_SYS_I2C_MODULE is not properly configured
 #endif
 
-#define I2C_TIMEOUT	100
+#define I2C_TIMEOUT	10000
 #define I2C_RETRIES	3
 
 struct mpc5xxx_i2c_tap {
@@ -94,7 +94,7 @@ static int wait_for_bb(void)
 		mpc_reg_out(&regs->mcr, 0, 0);
 		mpc_reg_out(&regs->mcr, I2C_EN, 0);
 #endif
-		udelay(1000);
+		udelay(15);
 		status = mpc_reg_in(&regs->msr);
 	}
 
@@ -109,7 +109,7 @@ static int wait_for_pin(int *status)
 	*status = mpc_reg_in(&regs->msr);
 
 	while (timeout-- && !(*status & I2C_IF)) {
-		udelay(1000);
+		udelay(15);
 		*status = mpc_reg_in(&regs->msr);
 	}
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-31 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-31  1:03 [U-Boot] [PATCH V2] mpc5200: reduce delays in i2c Jon Smirl
2009-03-31 20:54 ` Wolfgang Denk
2009-03-31 21:15   ` Jon Smirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox