Commit e3db72e9 authored by hongming's avatar hongming Committed by Adam Wujek

userspace/libwr: fix i2c bitbang

WRS cannot read the EEPROM of some SFPs correctly.
Add delay after switching the SDA from output to input to
solve this bug.
parent 28800845
...@@ -103,6 +103,7 @@ static uint8_t mi2c_get_byte(struct i2c_bitbang *bus, int ack) ...@@ -103,6 +103,7 @@ static uint8_t mi2c_get_byte(struct i2c_bitbang *bus, int ack)
mi2c_pin_out(bus->scl, 0); mi2c_pin_out(bus->scl, 0);
shw_pio_setdir(bus->sda, PIO_IN); //let SDA float so we can read it shw_pio_setdir(bus->sda, PIO_IN); //let SDA float so we can read it
shw_udelay(I2C_DELAY); // wait for the SDA to become stable
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
mi2c_pin_out(bus->scl, 1); mi2c_pin_out(bus->scl, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment