From 0e691a6146158bcabf34e6d944c9ee387fc35118 Mon Sep 17 00:00:00 2001 From: Vipin Deep Kaur Date: Fri, 18 Sep 2020 19:36:52 +0530 Subject: [PATCH] dma: gpi: Correct the return code in dmaengine_pause api Correct the return code in dmaengine_pause api. Enhance debug infra in GSI driver. Change-Id: Ic05d45c028d38ae756bce01402bb6b0413b08702 Signed-off-by: Vipin Deep Kaur --- drivers/dma/qcom/gpi.c | 43 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c index 4d931b63c20d..f208260f223d 100644 --- a/drivers/dma/qcom/gpi.c +++ b/drivers/dma/qcom/gpi.c @@ -2306,7 +2306,11 @@ static void gpi_noop_tre(struct gpii_chan *gpii_chan) noop_tre = NOOP_TRE; while (local_rp != local_wp) { + /* dump the channel ring at the time of error */ tre = (struct msm_gpi_tre *)cntxt_rp; + GPII_ERR(gpii, gpii_chan->chid, "local_rp:0x%011x TRE: %08x %08x %08x %08x\n", + local_rp, tre->dword[0], tre->dword[1], + tre->dword[2], tre->dword[3]); tre->dword[3] &= noop_mask; tre->dword[3] |= noop_tre; local_rp += ch_ring->el_size; @@ -2327,11 +2331,46 @@ static int gpi_pause(struct dma_chan *chan) { struct gpii_chan *gpii_chan = to_gpii_chan(chan); struct gpii *gpii = gpii_chan->gpii; - int i, ret; + int i, ret, idx = 0; + u32 offset1, offset2, type1, type2; + struct gpi_ring *ev_ring = &gpii->ev_ring; + phys_addr_t cntxt_rp, local_rp; + void *rp, *rp1; + union gpi_event *gpi_event; + u32 chid, type; GPII_INFO(gpii, gpii_chan->chid, "Enter\n"); mutex_lock(&gpii->ctrl_lock); + /* dump the GPII IRQ register at the time of error */ + offset1 = GPI_GPII_n_CNTXT_TYPE_IRQ_OFFS(gpii->gpii_id); + offset2 = GPI_GPII_n_CNTXT_SRC_IEOB_IRQ_MSK_OFFS(gpii->gpii_id); + while (idx++ < 3) { + type1 = gpi_read_reg(gpii, gpii->regs + offset1); + type2 = gpi_read_reg(gpii, gpii->regs + offset2); + GPII_ERR(gpii, GPI_DBG_COMMON, "CNTXT_TYPE_IRQ:0x%08x IEOB_MASK_OFF:0x%08x\n", + type1, type2); + } + + cntxt_rp = gpi_read_reg(gpii, gpii->ev_ring_rp_lsb_reg); + rp = to_virtual(ev_ring, cntxt_rp); + local_rp = to_physical(ev_ring, ev_ring->rp); + rp1 = ev_ring->rp; + + /* dump the event ring at the time of error */ + GPII_ERR(gpii, GPI_DBG_COMMON, "cntxt_rp:%pa local_rp:%pa\n", + &cntxt_rp, &local_rp); + while (rp != rp1) { + gpi_event = rp1; + chid = gpi_event->xfer_compl_event.chid; + type = gpi_event->xfer_compl_event.type; + GPII_ERR(gpii, GPI_DBG_COMMON, + "chid:%u type:0x%x %08x %08x %08x %08x\n", chid, type, + gpi_event->gpi_ere.dword[0], gpi_event->gpi_ere.dword[1], + gpi_event->gpi_ere.dword[2], gpi_event->gpi_ere.dword[3]); + rp1 += ev_ring->el_size; + } + /* send stop command to stop the channels */ for (i = 0; i < MAX_CHANNELS_PER_GPII; i++) { gpii_chan = &gpii->gpii_chan[i]; @@ -2362,7 +2401,7 @@ static int gpi_pause(struct dma_chan *chan) GPII_ERR(gpii, gpii_chan->chid, "Error Starting Channel ret:%d\n", ret); mutex_unlock(&gpii->ctrl_lock); - return ret; + return -ECONNRESET; } }