[U-Boot] [PATCH 1/3] i2c: add i2c_core and prepare for new multibus support

Timur Tabi timur at freescale.com
Thu Jan 19 19:47:48 CET 2012


Wolfgang Denk wrote:
> As mentioned before, this is what we currently have as "device model"
> in U-Boot - not only I2C: we have the same "current device" concept
> with IDE, USB, ...

The difference is that I2C operations are typically done internally by
other code, whereas IDE, USB, etc are done by the user on the command
line.  It's not unusual for boot code to access multiple I2C devices on
different buses, so we're switching I2C buses a lot.  People generally
don't try to access two networks or two USB devices back-to-back, but
that's exactly what we do with I2C.

The other problem is that I2C operations are necessary prior to
relocation, but IDE, USB, etc generally are not.  That's why we have this:

static unsigned int i2c_bus_num __attribute__ ((section (".data"))) =
CONFIG_SYS_SPD_BUS_NUM;

We need to initialize i2c_bus_num to the I2C bus that SPD is on, because
i2c_bus_num is not writable until after relocation, and DDR initialization
requires I2C.

A board that has SPD on two different I2C buses could not be supported by
U-Boot today.

-- 
Timur Tabi
Linux kernel developer at Freescale



More information about the U-Boot mailing list