i2c: i2c-msm-geni: Reset i2c GPIOs using FORCE_DEFAULT

If cancel command is failing due to bad IOS line and not in
proper state, then reset the GPIOs using FORCE_DEFAULT.

This will ensure if master side is behaving bad, it will come to
the proper state else fix it from the slave side.

Change-Id: I3ac143a3c5184ebc4f7f7072de9ba4f4b132dd42
Signed-off-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
This commit is contained in:
Mukesh Kumar Savaliya 2022-03-10 00:33:26 +05:30 • committed by Gerrit - the friendly Code Review server
commit b1d6f3df63

View file

@ -249,10 +249,21 @@ static int do_pending_cancel(struct geni_i2c_dev *gi2c)
geni_ios = geni_read_reg_nolog(gi2c->base, SE_GENI_IOS);
if ((geni_ios & 0x3) != 0x3) {
/* Try to restore IOS with FORCE_DEFAULT */
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
"%s: Can't do pending cancel, IOS bad state: 0x%x\n",
__func__, geni_ios);
return -EINVAL;
"%s: IOS:0x%x, bad state\n", __func__, geni_ios);
geni_write_reg(FORCE_DEFAULT,
gi2c->base, GENI_FORCE_DEFAULT_REG);
geni_ios = geni_read_reg_nolog(gi2c->base, SE_GENI_IOS);
if ((geni_ios & 0x3) != 0x3) {
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
"%s: IOS:0x%x, Fix from Slave side\n",
__func__, geni_ios);
return -EINVAL;
}
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
"%s: IOS:0x%x restored properly\n", __func__, geni_ios);
}
if (gi2c->se_mode == GSI_ONLY) {