diff options
author | Steve Sakoman <steve@sakoman.com> | 2010-06-12 06:42:57 -0700 |
---|---|---|
committer | Sandeep Paulraj <s-paulraj@ti.com> | 2010-07-05 20:00:10 -0400 |
commit | 938717cee195159950cc4e3b16f4e4f7148421a2 (patch) | |
tree | 4d10d1f388eaea7ca95048cea259caca81091282 /drivers/i2c/omap24xx_i2c.c | |
parent | bec3dc75996abf3cd878e54462708b1d9255bdc9 (diff) | |
download | u-boot-imx-938717cee195159950cc4e3b16f4e4f7148421a2.zip u-boot-imx-938717cee195159950cc4e3b16f4e4f7148421a2.tar.gz u-boot-imx-938717cee195159950cc4e3b16f4e4f7148421a2.tar.bz2 |
ARMV7: Restructure OMAP i2c driver to allow code sharing between OMAP3 and OMAP4
This patch modifies the omap24xx driver so that it will also work with OMAP4.
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Diffstat (limited to 'drivers/i2c/omap24xx_i2c.c')
-rw-r--r-- | drivers/i2c/omap24xx_i2c.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index ff18991..3256133 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -25,6 +25,8 @@ #include <asm/arch/i2c.h> #include <asm/io.h> +#include "omap24xx_i2c.h" + static void wait_for_bb (void); static u16 wait_for_pin (void); static void flush_fifo(void); @@ -176,7 +178,8 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) status = wait_for_pin (); if (status & I2C_STAT_RRDY) { -#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) +#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ + defined(CONFIG_OMAP44XX) *value = readb (&i2c_base->data); #else *value = readw (&i2c_base->data); @@ -221,7 +224,8 @@ static int i2c_write_byte (u8 devaddr, u8 regoffset, u8 value) status = wait_for_pin (); if (status & I2C_STAT_XRDY) { -#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) +#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ + defined(CONFIG_OMAP44XX) /* send out 1 byte */ writeb (regoffset, &i2c_base->data); writew (I2C_STAT_XRDY, &i2c_base->stat); @@ -274,7 +278,8 @@ static void flush_fifo(void) while(1){ stat = readw(&i2c_base->stat); if(stat == I2C_STAT_RRDY){ -#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) +#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ + defined(CONFIG_OMAP44XX) readb(&i2c_base->data); #else readw(&i2c_base->data); @@ -435,3 +440,9 @@ int i2c_set_bus_num(unsigned int bus) return 0; } + +int i2c_get_bus_num(void) +{ + return (int) current_bus; +} + |