Skip to contentSkip to conversation

mpc5200: reduce delays in i2c

PATCH Superseded Jon Smirl 2 participants 3 messages Mar 31, 2009

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

PATCH v2 1/1 mpc5200: reduce delays in i2c

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.

---
 cpu/mpc5xxx/i2c.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
cpu/mpc5xxx/i2c.c +3 -3
index e2506d8..48b6464 100644
@@ -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);
 	}
 
#1 lore raw

PATCH v2 1/1 mpc5200: reduce delays in i2c

Dear Jon Smirl,

Quoted 5 lines · In message <20090331010330.20946.41742.stgit@localhost> you wrote:

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.

I think you did not even bother to read my comments to your previous patch (foar from trying to understand and react on them).

Sorry, NAK. Please at least answer the questions you've been asked.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I dislike companies that have a we-are-the-high-priests-of-hardware-
so-you'll-like-what-we-give-you attitude. I like commodity markets in
which iron-and-silicon hawkers know that they exist to  provide  fast
toys for software types like me to play with..."    - Eric S. Raymond
author
#2 lore raw

PATCH v2 1/1 mpc5200: reduce delays in i2c

Quoted 9 lines · Wolfgang Denk

Dear Jon Smirl,

Quoted 5 lines · In message <20090331010330.20946.41742.stgit@localhost> you wrote:

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.

Quoted 4 lines

I think you did not even bother to read my comments to your previous patch (foar from trying to understand and react on them).

Sorry, NAK. ?Please at least answer the questions you've been asked.

You said:
"I agree that the change itself looks harmless, and I'm willing to accept it, but at least make sure not to reduce the total timeout values - that would require re-testing on some boards."

I made the total time out bigger just to be extra sure, but I could lower it back to 100ms.

If this isn't ok. Just drop the patch and I'll keep it in my private tree.

Quoted 14 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "I dislike companies that have a we-are-the-high-priests-of-hardware- so-you'll-like-what-we-give-you attitude. I like commodity markets in which iron-and-silicon hawkers know that they exist to ?provide ?fast toys for software types like me to play with..." ? ?- Eric S. Raymond

Signature · 2 lines
Jon Smirl
jonsmirl at gmail.com