+ case MV64XXX_I2C_STATUS_BUS_ERR: /* 0x00 */
+ dev_warn(&drv_data->adapter.dev,
+ "bus error: slave has driven SDA/SCL unexpectedly\n");
+ drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+ mv64xxx_i2c_hw_init(drv_data);
+ drv_data->rc = -EIO;
+ break;
+
Actually you do the same thing that we have in the default case but with
a different warning message.
In this case What about just keeping this line and then go through the
default case ?
+ case MV64XXX_I2C_STATUS_BUS_ERR: /* 0x00 */
+ dev_warn(&drv_data->adapter.dev,
+ "bus error: slave has driven SDA/SCL unexpectedly\n");
But actually according to the datasheet we don't have to reset hardware
and initialize FSM. The only request actions are "setting the Stop field in
the I2C Control Register and clearing the interrupt." For your patch
that would mean removing the "mv64xxx_i2c_hw_init(drv_data);" line.
Could you test it?
Hi Gregory, sorry for a late response. I cannot easily test this, it was an
one-off error due to a misbehaving external I2C slave. I don't know how to
trigger it repeatedly.
Which one would you prefer?
- drop this patch,
- rely on the datasheet and skip the call to hw_init even though I cannot
test it,
- simplify as you suggest above with a fallthrough, and live with a
duplicate dev_warn followed by dev_err?
With kind regards,
Jan