Not for upstream! With these trace_printks, one can verify that DMA is only finished once both end_flags are set. The order in which they are set does not matter. Also, cases when CMD or DATA have errors still work Not-Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> --- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c index f6d1e04a627f..ac3983aca275 100644 --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c @@ -325,6 +325,7 @@ static bool renesas_sdhi_internal_dmac_dma_irq(struct tmio_mmc_host *host) if (status & dma_irqs) { writel(status ^ dma_irqs, host->ctl + DM_CM_INFO1); set_bit(SDHI_DMA_END_FLAG_DMA, &dma_priv->end_flags); +trace_printk("DMA end\n"); if (test_bit(SDHI_DMA_END_FLAG_ACCESS, &dma_priv->end_flags)) tasklet_schedule(&dma_priv->dma_complete); } @@ -339,6 +340,7 @@ renesas_sdhi_internal_dmac_dataend_dma(struct tmio_mmc_host *host) struct renesas_sdhi_dma *dma_priv = &priv->dma_priv; set_bit(SDHI_DMA_END_FLAG_ACCESS, &dma_priv->end_flags); +trace_printk("Access end: %d\n", host->data->error); if (test_bit(SDHI_DMA_END_FLAG_DMA, &dma_priv->end_flags) || host->data->error) tasklet_schedule(&dma_priv->dma_complete); @@ -442,6 +444,7 @@ static void renesas_sdhi_internal_dmac_issue_tasklet_fn(unsigned long arg) } else { /* on CMD errors, simulate DMA end immediately */ set_bit(SDHI_DMA_END_FLAG_DMA, &priv->dma_priv.end_flags); +trace_printk("Simulated DMA end\n"); if (test_bit(SDHI_DMA_END_FLAG_ACCESS, &priv->dma_priv.end_flags)) tasklet_schedule(&priv->dma_priv.dma_complete); } @@ -477,6 +480,7 @@ static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg) { struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg; +trace_printk("Tasklet\n"); spin_lock_irq(&host->lock); if (!renesas_sdhi_internal_dmac_complete(host)) goto out; -- 2.35.1