public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ppc4xx: Fix problem with I2C bus >= 1 initialization
Date: Mon, 29 Mar 2010 15:35:43 +0200	[thread overview]
Message-ID: <1269869743-2093-1-git-send-email-sr@denx.de> (raw)

This patch fixes a problem introduced with patch eb5eb2b0
[ppc4xx: Cleanup PPC4xx I2C infrastructure]. We need to assign the I2C
base address to the "i2c" pointer inside of the controller loop.
Otherwise controller 0 is initialized multiple times instead of
initializing each I2C controller sequentially.

Tested on Katmai.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
---
Heiko, I just noticed that this PPC4xx I2C driver is still in the
cpu/ppc4xx directory. I suggest that we move it into drivers/i2c
after the next release. Is this ok for you? I can provide a patch
for this soon.

Please let me know if you see any problems with this patch. I would
really like to push it into this release, since it really is a bug
fix.

Thanks.

 cpu/ppc4xx/i2c.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/cpu/ppc4xx/i2c.c b/cpu/ppc4xx/i2c.c
index 7976e75..9b86187 100644
--- a/cpu/ppc4xx/i2c.c
+++ b/cpu/ppc4xx/i2c.c
@@ -93,7 +93,7 @@ static void _i2c_bus_reset(void)
 
 void i2c_init(int speed, int slaveaddr)
 {
-	struct ppc4xx_i2c *i2c = (struct ppc4xx_i2c *)I2C_BASE_ADDR;
+	struct ppc4xx_i2c *i2c;
 	int val, divisor;
 	int bus;
 
@@ -109,6 +109,9 @@ void i2c_init(int speed, int slaveaddr)
 	for (bus = 0; bus < CONFIG_SYS_MAX_I2C_BUS; bus++) {
 		I2C_SET_BUS(bus);
 
+		/* Set i2c pointer after calling I2C_SET_BUS() */
+		i2c = (struct ppc4xx_i2c *)I2C_BASE_ADDR;
+
 		/* Handle possible failed I2C state */
 		/* FIXME: put this into i2c_init_board()? */
 		_i2c_bus_reset();
-- 
1.7.0.3

             reply	other threads:[~2010-03-29 13:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 13:35 Stefan Roese [this message]
2010-03-29 13:43 ` [U-Boot] [PATCH] ppc4xx: Fix problem with I2C bus >= 1 initialization Heiko Schocher
2010-03-29 13:49   ` Stefan Roese
2010-03-29 13:57     ` Heiko Schocher
2010-03-29 14:31       ` Stefan Roese
2010-03-29 14:56         ` Heiko Schocher
2010-03-29 15:29           ` Stefan Roese
2010-03-30 11:05 ` Stefan Roese

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=1269869743-2093-1-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox