summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/etherfabric.c
diff options
context:
space:
mode:
authorMichael Brown2008-10-01 20:15:07 +0200
committerMichael Brown2008-10-01 20:24:56 +0200
commit9dccbc0af2337e3e81716b338c0f55449c0be360 (patch)
treec28206f93faef967455025e036c8efa6fe1623bb /src/drivers/net/etherfabric.c
parent[makefile] Fix -fno-stack-protector test on older versions of gcc (diff)
downloadipxe-9dccbc0af2337e3e81716b338c0f55449c0be360.tar.gz
ipxe-9dccbc0af2337e3e81716b338c0f55449c0be360.tar.xz
ipxe-9dccbc0af2337e3e81716b338c0f55449c0be360.zip
[i2c] Generalise i2c bit-bashing support to addressless devices
Some devices (e.g. the Atmel AT24C11) have no concept of a device address; they respond to every device address and use this value as the word address. Some other devices use part of the device address field to extend the word address field. Generalise the i2c bit-bashing support to handle this by defining the device address length and word address length as properties of an i2c device. The word address is assumed to overflow into the device address field if the address used exceeds the width of the word address field. Also add a bus reset mechanism. i2c chips don't usually have a reset line, so rebooting the host will not clear any bizarre state that the chip may be in. We reset the bus by clocking SCL until we see SDA high, at which point we know we can generate a start condition and have it seen by all devices. We then generate a stop condition to leave the bus in a known state prior to use. Finally, add some extra debugging messages to i2c_bit.c.
Diffstat (limited to 'src/drivers/net/etherfabric.c')
-rw-r--r--src/drivers/net/etherfabric.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/drivers/net/etherfabric.c b/src/drivers/net/etherfabric.c
index 8a6b1a17..d9af625a 100644
--- a/src/drivers/net/etherfabric.c
+++ b/src/drivers/net/etherfabric.c
@@ -1069,9 +1069,9 @@ static struct bit_basher_operations ef1002_basher_ops = {
};
static void ef1002_init_eeprom ( struct efab_nic *efab ) {
- efab->ef1002_i2c.basher.op = &ef1002_basher_ops;
- init_i2c_bit_basher ( &efab->ef1002_i2c );
- efab->ef1002_eeprom.address = EF1_EEPROM_I2C_ID;
+ init_i2c_bit_basher ( &efab->ef1002_i2c,
+ &ef1002_basher_ops );
+ init_i2c_eeprom ( &efab->ef1002_eeprom, EF1_EEPROM_I2C_ID );
}
/**