X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=drivers%2Fi2c%2Fbusses%2Fi2c-npcm7xx.c;h=2ad166355ec9b06b9528bc35018f77a28b6b87b0;hb=13cb73490f475f8e7669f9288be0bcfa85399b1f;hp=dfcf04e1967f1743db35b82a7c62532a1d57ac36;hpb=69828c475d15290553cb5512108424746baf6225;p=linux-2.6-microblaze.git diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index dfcf04e1967f..2ad166355ec9 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -2163,6 +2163,15 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, if (bus->cmd_err == -EAGAIN) ret = i2c_recover_bus(adap); + /* + * After any type of error, check if LAST bit is still set, + * due to a HW issue. + * It cannot be cleared without resetting the module. + */ + if (bus->cmd_err && + (NPCM_I2CRXF_CTL_LAST_PEC & ioread8(bus->reg + NPCM_I2CRXF_CTL))) + npcm_i2c_reset(bus); + #if IS_ENABLED(CONFIG_I2C_SLAVE) /* reenable slave if it was enabled */ if (bus->slave)