summaryrefslogtreecommitdiff
path: root/drivers/fsl_i2c.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@freescale.com>2006-10-20 15:54:48 -0500
committerJon Loeliger <jdl@freescale.com>2006-10-20 15:54:48 -0500
commit3acb7727ce6aa403e938e7cf3761924590bead47 (patch)
tree52c8b88f187e5945af41ff134db0005744dacd1c /drivers/fsl_i2c.c
parentf5012827df11ca0c9be1df5f8b153e188dc2fa7c (diff)
parent2047672684cf85cb6f96a1fbc993180aaaf19a99 (diff)
downloadu-boot-imx-3acb7727ce6aa403e938e7cf3761924590bead47.zip
u-boot-imx-3acb7727ce6aa403e938e7cf3761924590bead47.tar.gz
u-boot-imx-3acb7727ce6aa403e938e7cf3761924590bead47.tar.bz2
Merge branch 'i2c'
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 */