All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] mpc5200: reduce delays in i2c
Date: Mon, 30 Mar 2009 21:03:30 -0400	[thread overview]
Message-ID: <20090331010330.20946.41742.stgit@localhost> (raw)

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);
 	}
 

             reply	other threads:[~2009-03-31  1:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31  1:03 Jon Smirl [this message]
2009-03-31 20:54 ` [U-Boot] [PATCH V2] mpc5200: reduce delays in i2c Wolfgang Denk
2009-03-31 21:15   ` Jon Smirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090331010330.20946.41742.stgit@localhost \
    --to=jonsmirl@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.