PATCH: Add command support for multiple I2C controllers
Hello,
Attached is a second stab at a patch to allow access to multiple I2C controllers. It enhances the command set by adding the following command, which changes the 'current' I2C bus. Further write, read, probe etc. commands will deal with the newly selected bus:
ibus [bus_index] [speed in Hz]
In addition, the logic for ignoring I2C devices during a probe command has been enhanced to work with multiple controllers. The software has been tested with new and old configurations (i.e. is backwards compatible).
Old way of ignoring devices:
#define CFG_I2C_NOPROBES {0x11, 0x22}
New way:
#define CFG_I2C_MULTI_NOPROBES {0x11, 0x22, 0xff, 0x33, 0x44, 0xff}
where controller lists are delimited by '0xff', which is an invalid I2C address.
Note: In order to use, drivers must be modified to implement the following API extensions:
int i2c_set_bus(uchar bus, int speed);
uchar i2c_get_bus_num(void);
int i2c_get_bus_speed(void);
Code is conditionally compiled using:
CONFIG_I2C_MULTI_BUSCFG_I2C_MULTI_NOPROBES
CHANGELOG:
If CONFIG_I2C_MULTI_BUS is defined, the 'ibus' command becomes
available, allowing the user to switch between I2C buses and to change bus speeds. Additionally, devices may be excluded from being probed by defining a CFG_I2C_MULTI_NOPROBES array, where lists for each controller are delimited by '0xff'
Please have a look and feed back any suggestions.
regards,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: I2C_MULTIBUS.patch
Type: text/x-patch
Size: 5032 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060517/704f7a3c/attachment.bin
Quoted 7 lines · In message <[email protected]> you wrote:
Attached is a second stab at a patch to allow access to multiple I2C controllers. It enhances the command set by adding the following command, which changes the 'current' I2C bus. Further write, read, probe etc. commands will deal with the newly selected bus:
ibus [
bus_index] [speed in Hz]
No. Please read my posting again. I want to see this as compatible as possible with other commands that operate on devices connected to busses. We use "ide dev ...", so I want to see "i2c dev" here, too.
As mentioned before, in the long term all i2c related commands should become sub-commands to the new "i2c" command.
Quoted 5 lines
In addition, the logic for ignoring I2C devices during a probe command has been enhanced to work with multiple controllers. The software has been tested with new and old configurations (i.e. is backwards compatible).
Quoted 7 lines
Old way of ignoring devices:
#define
CFG_I2C_NOPROBES{0x11,0x22}New way:
#define
CFG_I2C_MULTI_NOPROBES{0x11,0x22,0xff,0x33,0x44,0xff}
Argh... This is pretty unreadable. Can';t we just use an array of lists?
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Things are not as simple as they seem at first. - Edward Thorp