mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
Revert "i2c: i2c-msm-geni: Do i2c transfer if GENI IOS in proper state"
GENI IOs read register - Allows a mean to SW for reading current GENI IOs
DATA might not reflect current bus status due to synchronization delay.
Let's revert it and monitor I2C crash issue some time .
This reverts commit 5ad2f9de06.
Change-Id: Ie4c9788976a0054dc7c945623b4d0562568f331d
Reviewed-on: https://gerrit.mot.com/2180331
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Hujun Liao <liaohj@motorola.com>
Reviewed-by: Minghui Wei <weimh1@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
parent
d84f09e293
commit
1f76f16f57
1 changed files with 0 additions and 93 deletions
|
|
@ -139,7 +139,6 @@ struct geni_i2c_dev {
|
|||
bool first_resume;
|
||||
bool gpi_reset;
|
||||
bool disable_dma_mode;
|
||||
bool prev_cancel_pending; //Halt cancel till IOS in good state
|
||||
bool is_i2c_rtl_based; /* doing pending cancel only for rtl based SE's */
|
||||
atomic_t is_xfer_in_progress; /* Used to maintain xfer inprogress status */
|
||||
};
|
||||
|
|
@ -250,58 +249,6 @@ err_ret:
|
|||
gi2c->err = gi2c_log[err].err;
|
||||
}
|
||||
|
||||
static int do_pending_cancel(struct geni_i2c_dev *gi2c)
|
||||
{
|
||||
int timeout = 0;
|
||||
u32 geni_ios = 0;
|
||||
|
||||
/* doing pending cancel only rtl based SE's */
|
||||
if (!gi2c->is_i2c_rtl_based)
|
||||
return 0;
|
||||
|
||||
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: 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) {
|
||||
dmaengine_terminate_all(gi2c->tx_c);
|
||||
gi2c->cfg_sent = 0;
|
||||
} else {
|
||||
reinit_completion(&gi2c->xfer);
|
||||
geni_cancel_m_cmd(gi2c->base);
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer, HZ);
|
||||
if (!timeout) {
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s:Pending Cancel failed\n", __func__);
|
||||
reinit_completion(&gi2c->xfer);
|
||||
geni_abort_m_cmd(gi2c->base);
|
||||
timeout = wait_for_completion_timeout(&gi2c->xfer, HZ);
|
||||
if (!timeout)
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s:Abort failed\n", __func__);
|
||||
}
|
||||
}
|
||||
gi2c->prev_cancel_pending = false;
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s: Pending Cancel done\n", __func__);
|
||||
return timeout;
|
||||
}
|
||||
|
||||
static int geni_i2c_prepare(struct geni_i2c_dev *gi2c)
|
||||
{
|
||||
if (gi2c->se_mode == UNINITIALIZED) {
|
||||
|
|
@ -1006,8 +953,6 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
|||
timeout = wait_for_completion_timeout(&gi2c->xfer,
|
||||
gi2c->xfer_timeout);
|
||||
if (!timeout) {
|
||||
u32 geni_ios = 0;
|
||||
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"I2C gsi xfer timeout:%u flags:%d addr:0x%x\n",
|
||||
gi2c->xfer_timeout, gi2c->cur->flags,
|
||||
|
|
@ -1015,18 +960,6 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
|||
geni_se_dump_dbg_regs(&gi2c->i2c_rsc, gi2c->base,
|
||||
gi2c->ipcl);
|
||||
gi2c->err = -ETIMEDOUT;
|
||||
|
||||
/* WAR: Set flag to mark cancel pending if IOS stuck */
|
||||
geni_ios = geni_read_reg_nolog(gi2c->base, SE_GENI_IOS);
|
||||
if ((geni_ios & 0x3) != 0x3) { //SCL:b'1, SDA:b'0
|
||||
GENI_SE_DBG(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s: IO lines not in good state\n", __func__);
|
||||
/* doing pending cancel only rtl based SE's */
|
||||
if (gi2c->is_i2c_rtl_based) {
|
||||
gi2c->prev_cancel_pending = true;
|
||||
goto geni_i2c_gsi_cancel_pending;
|
||||
}
|
||||
}
|
||||
}
|
||||
geni_i2c_err_prep_sg:
|
||||
if (gi2c->err) {
|
||||
|
|
@ -1049,7 +982,6 @@ geni_i2c_err_prep_sg:
|
|||
/* Resend cfg tre for every new message on shared se */
|
||||
gi2c->cfg_sent = 0;
|
||||
|
||||
geni_i2c_gsi_cancel_pending:
|
||||
if (msgs[i].flags & I2C_M_RD)
|
||||
geni_se_iommu_unmap_buf(rx_dev, &gi2c->rx_ph,
|
||||
msgs[i].len, DMA_FROM_DEVICE);
|
||||
|
|
@ -1106,17 +1038,6 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
|||
}
|
||||
}
|
||||
|
||||
// WAR : Complete previous pending cancel cmd
|
||||
if (gi2c->prev_cancel_pending) {
|
||||
ret = do_pending_cancel(gi2c);
|
||||
if (ret) {
|
||||
pm_runtime_mark_last_busy(gi2c->dev);
|
||||
pm_runtime_put_autosuspend(gi2c->dev);
|
||||
atomic_set(&gi2c->is_xfer_in_progress, 0);
|
||||
return ret; //Don't perform xfer is cancel failed
|
||||
}
|
||||
}
|
||||
|
||||
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
|
||||
"n:%d addr:0x%x\n", num, msgs[0].addr);
|
||||
|
||||
|
|
@ -1234,23 +1155,9 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
|
|||
timeout = wait_for_completion_timeout(&gi2c->xfer,
|
||||
gi2c->xfer_timeout);
|
||||
if (!timeout) {
|
||||
u32 geni_ios = 0;
|
||||
|
||||
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
|
||||
"I2C xfer timeout: %d\n", gi2c->xfer_timeout);
|
||||
geni_i2c_err(gi2c, GENI_TIMEOUT);
|
||||
|
||||
/* WAR: Set flag to mark cancel pending if IOS bad */
|
||||
geni_ios = geni_read_reg_nolog(gi2c->base, SE_GENI_IOS);
|
||||
if ((geni_ios & 0x3) != 0x3) { //SCL:b'1, SDA:b'0
|
||||
GENI_SE_DBG(gi2c->ipcl, true, gi2c->dev,
|
||||
"%s: IO lines not in good state\n", __func__);
|
||||
/* doing pending cancel only rtl based SE's */
|
||||
if (gi2c->is_i2c_rtl_based) {
|
||||
gi2c->prev_cancel_pending = true;
|
||||
goto geni_i2c_txn_ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gi2c->err) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue