i2c: i2c-qcom-geni: Reinitialize the variables after every transfer

Reinitialize fifo cur_wr, cur_rd and gi2c->xfer for every transfer.
Add "MSM_GPI_QUP_FW_ERROR" event to callback event list. Dump GSI
registers in case of Channel RESET failure.

Change-Id: I7607572c6b70ea46325cce3ff648ee1b70b49fbf
Signed-off-by: Vipin Deep Kaur <vkaur@codeaurora.org>
This commit is contained in:
Vipin Deep Kaur 2020-02-28 11:15:46 +05:30
parent 17d718ca15
commit 2c99b9d708
2 changed files with 11 additions and 5 deletions

View file

@ -279,6 +279,7 @@ static const char *const gpi_cb_event_str[MSM_GPI_QUP_MAX_EVENT] = {
[MSM_GPI_QUP_NOTIFY] = "NOTIFY",
[MSM_GPI_QUP_ERROR] = "GLOBAL ERROR",
[MSM_GPI_QUP_CH_ERROR] = "CHAN ERROR",
[MSM_GPI_QUP_FW_ERROR] = "UNHANDLED ERROR",
[MSM_GPI_QUP_PENDING_EVENT] = "PENDING EVENT",
[MSM_GPI_QUP_EOT_DESC_MISMATCH] = "EOT/DESC MISMATCH",
[MSM_GPI_QUP_SW_ERROR] = "SW ERROR",
@ -2238,6 +2239,10 @@ int gpi_terminate_all(struct dma_chan *chan)
if (ret) {
GPII_ERR(gpii, gpii_chan->chid,
"Error resetting channel ret:%d\n", ret);
if (!gpii->reg_table_dump) {
gpi_dump_debug_reg(gpii);
gpii->reg_table_dump = true;
}
goto terminate_exit;
}

View file

@ -360,6 +360,7 @@ static void gi2c_ev_cb(struct dma_chan *ch, struct msm_gpi_cb const *cb_str,
case MSM_GPI_QUP_MAX_EVENT:
/* fall through to stall impacted channel */
case MSM_GPI_QUP_CH_ERROR:
case MSM_GPI_QUP_FW_ERROR:
case MSM_GPI_QUP_PENDING_EVENT:
case MSM_GPI_QUP_EOT_DESC_MISMATCH:
break;
@ -377,9 +378,9 @@ static void gi2c_ev_cb(struct dma_chan *ch, struct msm_gpi_cb const *cb_str,
}
if (cb_str->cb_event != MSM_GPI_QUP_NOTIFY)
GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,
"GSI QN err:0x%x, status:0x%x, err:%d slv_addr: 0x%x R/W: %d\n",
"GSI QN err:0x%x, status:0x%x, err:%d\n",
cb_str->error_log.error_code, m_stat,
cb_str->cb_event, gi2c->cur->addr, gi2c->cur->flags);
cb_str->cb_event);
}
static void gi2c_gsi_cb_err(struct msm_gpi_dma_async_tx_cb_param *cb,
@ -512,6 +513,7 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
struct msm_gpi_tre *go_t = &gi2c->go_t;
struct device *rx_dev = gi2c->wrapper_dev;
struct device *tx_dev = gi2c->wrapper_dev;
reinit_completion(&gi2c->xfer);
gi2c->cur = &msgs[i];
@ -731,7 +733,6 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
int i, ret = 0, timeout = 0;
gi2c->err = 0;
reinit_completion(&gi2c->xfer);
/* Client to respect system suspend */
if (!pm_runtime_enabled(gi2c->dev)) {
@ -873,6 +874,8 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
geni_abort_m_cmd(gi2c->base);
}
}
gi2c->cur_wr = 0;
gi2c->cur_rd = 0;
if (mode == SE_DMA) {
if (gi2c->err) {
@ -905,8 +908,6 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
pm_runtime_mark_last_busy(gi2c->dev);
pm_runtime_put_autosuspend(gi2c->dev);
gi2c->cur_wr = 0;
gi2c->cur_rd = 0;
gi2c->cur = NULL;
gi2c->err = 0;
GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,