deficiencies in the omap24xx u-boot i2c driver

Hi All-

I've built my own board that has an Overo Earth plugged into it and I'm
attempting to use the i2c bus 3 on the Overo's external pins. My i2c driver
has the patch to enable multibus.

I'm using the Overo defaults:

#define CONFIG_SYS_I2C_SPEED 100000
#define CONFIG_SYS_I2C_SLAVE 1

and I call:

i2c_set_bus_num(2);
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);

and then go into an infinite loop (deliberately) reading the i2c bus forever
so that I can look at the I2C3_SCL signal with the scope. I was expecting
to see it toggling at roughly 100kHz but instead I see it toggling at about
757kHz! This does much to explain the i2c trouble I've been having.

Also it appears that the mulibus support does not anticipate running
different busses at different speeds. True you could initialize like so:

i2c_set_bus_num(0);
i2c_init(I2C_SPEED_0, I2C_SLAVE_0);
i2c_set_bus_num(1);
i2c_init(I2C_SPEED_1, I2C_SLAVE_1);
i2c_set_bus_num(2);
i2c_init(I2C_SPEED_2, I2C_SLAVE_2);

to give the individual busses each its own speed (at first). But the
i2c_read and i2c_write routines internally can make calls to
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); (see below) which will
blow away your individual speed settings.

Dan

int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
{
  int i;

  if (alen > 1) {
    printf ("I2C read: addr len %d not supported\n", alen);
    return 1;
  }

  if (addr + len > 256) {
    printf ("I2C read: address out of range\n");
    return 1;
  }

  for (i = 0; i < len; i++) {
    if (i2c_read_byte (chip, addr + i, &buffer[i])) {
      printf ("I2C read: I/O error\n");
      i2c_init (CONFIG_SYS_I2C_SPEED,
CONFIG_SYS_I2C_SLAVE);
      return 1;
    }
  }

  return 0;
}

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4035 (20090425) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com