summaryrefslogtreecommitdiff
path: root/drivers/fsl_i2c.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@freescale.com>2006-10-20 15:50:15 -0500
committerJon Loeliger <jdl@freescale.com>2006-10-20 15:50:15 -0500
commit2047672684cf85cb6f96a1fbc993180aaaf19a99 (patch)
tree6c282cc7fd149edb7fe78b1afd4417f20a7aa99f /drivers/fsl_i2c.c
parent4d45f69e362b05892c9e92a7907e5820995612aa (diff)
downloadu-boot-imx-2047672684cf85cb6f96a1fbc993180aaaf19a99.zip
u-boot-imx-2047672684cf85cb6f96a1fbc993180aaaf19a99.tar.gz
u-boot-imx-2047672684cf85cb6f96a1fbc993180aaaf19a99.tar.bz2
Converted all 85xx boards to use a common FSL I2C driver.
Introduced COFIG_FSL_I2C to select the common FSL I2C driver. And removed hard i2c path from a few u-boot.lds scipts too. Minor whitespace cleanups along the way. Signed-off-by: Jon Loeliger <jdl@freescale.com>
Diffstat (limited to 'drivers/fsl_i2c.c')
-rw-r--r--drivers/fsl_i2c.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/fsl_i2c.c b/drivers/fsl_i2c.c
index af19191..65c2743 100644
--- a/drivers/fsl_i2c.c
+++ b/drivers/fsl_i2c.c
@@ -18,11 +18,14 @@
#include <common.h>
+#ifdef CONFIG_FSL_I2C
#ifdef CONFIG_HARD_I2C
#include <command.h>
+#include <i2c.h> /* Functional interface */
+
#include <asm/io.h>
-#include <asm/fsl_i2c.h>
+#include <asm/fsl_i2c.h> /* HW definitions */
#define I2C_TIMEOUT (CFG_HZ / 4)
#define I2C ((struct fsl_i2c *)(CFG_IMMR + CFG_I2C_OFFSET))
@@ -32,7 +35,7 @@ void
i2c_init(int speed, int slaveadd)
{
/* stop I2C controller */
- writeb(0x0 , &I2C->cr);
+ writeb(0x0, &I2C->cr);
/* set clock */
writeb(0x3f, &I2C->fdr);
@@ -53,7 +56,7 @@ i2c_init(int speed, int slaveadd)
static __inline__ int
i2c_wait4bus(void)
{
- ulong timeval = get_timer (0);
+ ulong timeval = get_timer(0);
while (readb(&I2C->sr) & I2C_SR_MBB) {
if (get_timer(timeval) > I2C_TIMEOUT) {
@@ -235,3 +238,4 @@ i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
}
#endif /* CONFIG_HARD_I2C */
+#endif /* CONFIG_FSL_I2C */