[U-Boot] [PATCH 19/31] i2c, mpc83xx: add CONFIG_SYS_I2C_INIT_BOARD for fsl_i2c
Joakim Tjernlund
Joakim.Tjernlund at transmode.se
Wed Jan 28 11:15:56 CET 2009
>
> This patch adds the possibility to call a board specific
> i2c bus reset routine for the fsl_i2c bus driver, and adds
> this option for the keymile kmeter1 board.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
> board/keymile/common/common.c | 14 ++++++++++++++
> drivers/i2c/fsl_i2c.c | 6 ++++++
> include/configs/kmeter1.h | 1 +
> 3 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/board/keymile/common/common.c
b/board/keymile/common/common.c
> index 17312b5..a282421 100644
> --- a/board/keymile/common/common.c
> +++ b/board/keymile/common/common.c
> @@ -421,6 +421,7 @@ static int get_scl (void)
>
> #endif
>
> +#if !defined(CONFIG_KMETER1)
> static void writeStartSeq (void)
> {
> set_sda (1);
> @@ -471,6 +472,7 @@ static int i2c_make_abort (void)
> get_sda ();
> return ret;
> }
> +#endif
>
> /**
> * i2c_init_board - reset i2c bus. When the board is powercycled during
a
> @@ -478,6 +480,17 @@ static int i2c_make_abort (void)
> */
> void i2c_init_board(void)
> {
> +#if defined(CONFIG_KMETER1)
> + struct fsl_i2c *dev;
> + dev = (struct fsl_i2c *) (CONFIG_SYS_IMMR + CONFIG_SYS_I2C_OFFSET);
> + uchar dummy;
> +
> + out_8 (&dev->cr, (I2C_CR_MSTA));
> + out_8 (&dev->cr, (I2C_CR_MEN | I2C_CR_MSTA));
> + dummy = in_8(&dev->dr);
> + out_8 (&dev->cr, (I2C_CR_MEN));
Are you sure this will generate a proper I2C reset sequence? We also
use this controller and I tried to do it too but didn't find a way. I then
asked
Freescale and they could not come up with a solution either.
Jocke
More information about the U-Boot
mailing list