Skip to content
Snippets Groups Projects
Commit 66839773 authored by Vincent Stehlé's avatar Vincent Stehlé Committed by Tom Rini
Browse files

omap24xx_i2c: Handle OMAP5 like OMAP2,3,4


OMAP5 has 8b i2c data register field, like OMAP2, 3 and 4. Handle in the same
way. This fixes the following error on OMAP5:

  OMAP5430 EVM # mmc rescan
  timed out in wait_for_bb: I2C_STAT=1410
  twl6035: could not turn on LDO9.

Signed-off-by: default avatarVincent Stehlé <v-stehle@ti.com>
parent fa5e2845
No related branches found
No related tags found
No related merge requests found
...@@ -179,7 +179,8 @@ static int i2c_read_byte(u8 devaddr, u16 regoffset, u8 alen, u8 *value) ...@@ -179,7 +179,8 @@ static int i2c_read_byte(u8 devaddr, u16 regoffset, u8 alen, u8 *value)
if (status & I2C_STAT_XRDY) { if (status & I2C_STAT_XRDY) {
w = tmpbuf[i++]; w = tmpbuf[i++];
#if !(defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ #if !(defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX)) defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) || \
defined(CONFIG_OMAP54XX))
w |= tmpbuf[i++] << 8; w |= tmpbuf[i++] << 8;
#endif #endif
writew(w, &i2c_base->data); writew(w, &i2c_base->data);
...@@ -209,7 +210,8 @@ static int i2c_read_byte(u8 devaddr, u16 regoffset, u8 alen, u8 *value) ...@@ -209,7 +210,8 @@ static int i2c_read_byte(u8 devaddr, u16 regoffset, u8 alen, u8 *value)
} }
if (status & I2C_STAT_RRDY) { if (status & I2C_STAT_RRDY) {
#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ #if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) || \
defined(CONFIG_OMAP54XX)
*value = readb(&i2c_base->data); *value = readb(&i2c_base->data);
#else #else
*value = readw(&i2c_base->data); *value = readw(&i2c_base->data);
...@@ -239,7 +241,8 @@ static void flush_fifo(void) ...@@ -239,7 +241,8 @@ static void flush_fifo(void)
stat = readw(&i2c_base->stat); stat = readw(&i2c_base->stat);
if (stat == I2C_STAT_RRDY) { if (stat == I2C_STAT_RRDY) {
#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ #if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) || \
defined(CONFIG_OMAP54XX)
readb(&i2c_base->data); readb(&i2c_base->data);
#else #else
readw(&i2c_base->data); readw(&i2c_base->data);
...@@ -289,7 +292,8 @@ int i2c_probe(uchar chip) ...@@ -289,7 +292,8 @@ int i2c_probe(uchar chip)
if (status & I2C_STAT_RRDY) { if (status & I2C_STAT_RRDY) {
res = 0; res = 0;
#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ #if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) || \
defined(CONFIG_OMAP54XX)
readb(&i2c_base->data); readb(&i2c_base->data);
#else #else
readw(&i2c_base->data); readw(&i2c_base->data);
...@@ -376,7 +380,8 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) ...@@ -376,7 +380,8 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
if (status & I2C_STAT_XRDY) { if (status & I2C_STAT_XRDY) {
w = (i < 0) ? tmpbuf[2+i] : buffer[i]; w = (i < 0) ? tmpbuf[2+i] : buffer[i];
#if !(defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \ #if !(defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX)) defined(CONFIG_OMAP44XX) || defined(CONFIG_AM33XX) || \
defined(CONFIG_OMAP54XX))
w |= ((++i < 0) ? tmpbuf[2+i] : buffer[i]) << 8; w |= ((++i < 0) ? tmpbuf[2+i] : buffer[i]) << 8;
#endif #endif
writew(w, &i2c_base->data); writew(w, &i2c_base->data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment