>From 00f84e4a9a2d13971c9328fc815825456b25f760 Mon Sep 17 00:00:00 2001
From: Richard Retanubun <richardretanu...@ruggedcom.com>
Date: Mon, 12 Apr 2010 13:32:09 -0400
Subject: [PATCH] fsl_i2c: Move the call for i2c_init_board to the end of 
i2c_init

This patch moved the call to i2c_init_board to the end of i2c_init.
This allows the board fixup functions to take advantage of the
setups done by i2c_init (i.e. bus speed and slave address).

On other boards, i2c_init_board is called before i2c_init operation
because the method of resetting i2c bus typically uses GPIOs
to bit-bang SCLK. For i2c controllers that is using fsl_i2c this is
unneccessary because there is a i2c register access sequence that
accomplish the same thing, and it is better to do the accesses
after the bus speed and slave address have been configured.
---

Hi Heiko,
Here is the patch for moving i2c_init_board to the end of i2c_init
that we talked about. Thanks

- Richard

 drivers/i2c/fsl_i2c.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 2241990..5d992b6 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -220,12 +220,6 @@ i2c_init(int speed, int slaveadd)
        struct fsl_i2c *dev;
        unsigned int temp;
 
-#ifdef CONFIG_SYS_I2C_INIT_BOARD
-       /* call board specific i2c bus reset routine before accessing the   */
-       /* environment, which might be in a chip on that bus. For details   */
-       /* about this problem see doc/I2C_Edge_Conditions.                  */
-       i2c_init_board();
-#endif
        dev = (struct fsl_i2c *) (CONFIG_SYS_IMMR + CONFIG_SYS_I2C_OFFSET);
 
        writeb(0, &dev->cr);                    /* stop I2C controller */
@@ -249,6 +243,13 @@ i2c_init(int speed, int slaveadd)
        writeb(0x0, &dev->sr);                  /* clear status register */
        writeb(I2C_CR_MEN, &dev->cr);           /* start I2C controller */
 #endif
+
+#ifdef CONFIG_SYS_I2C_INIT_BOARD
+       /* call board specific i2c bus reset routine before accessing the   */
+       /* environment, which might be in a chip on that bus. For details   */
+       /* about this problem see doc/I2C_Edge_Conditions.                  */
+       i2c_init_board();
+#endif
 }
 
 static int
-- 
1.7.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to