]> git.sur5r.net Git - u-boot/commitdiff
FSL I2C driver programs the two I2C busses differently
authorTimur Tabi <timur@freescale.com>
Tue, 3 Jul 2007 18:46:32 +0000 (13:46 -0500)
committerKim Phillips <kim.phillips@freescale.com>
Fri, 10 Aug 2007 06:12:03 +0000 (01:12 -0500)
The i2c_init() function in fsl_i2c.c programs the two I2C busses differently.
The second I2C bus has its slave address programmed incorrectly and is
missing a 5-us delay.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
drivers/fsl_i2c.c

index ebae5af154ee95bcadd738e8a78a57372f66d7c7..22485ea916f4a958d31892192c277a48e29a05ae 100644 (file)
@@ -69,9 +69,10 @@ i2c_init(int speed, int slaveadd)
        dev = (struct fsl_i2c *) (CFG_IMMR + CFG_I2C2_OFFSET);
 
        writeb(0, &dev->cr);                    /* stop I2C controller */
+       udelay(5);                              /* let it shutdown in peace */
        writeb(0x3F, &dev->fdr);                /* set bus speed */
        writeb(0x3F, &dev->dfsrr);              /* set default filter */
-       writeb(slaveadd, &dev->adr);            /* write slave address */
+       writeb(slaveadd << 1, &dev->adr);       /* write slave address */
        writeb(0x0, &dev->sr);                  /* clear status register */
        writeb(I2C_CR_MEN, &dev->cr);           /* start I2C controller */
 #endif /* CFG_I2C2_OFFSET */