Skip to content

Commit 28da283

Browse files
Viresh KumarVinod Koul
authored andcommitted
dmaengine/amba-pl08x: Schedule tasklet in case of error interrupt
Currently, if error interrupt occurs, nothing is done in interrupt handler (just clearing the interrupts). We must somehow indicate this to the user that DMA is over, due to ERR interrupt or TC interrupt. So, this patch just schedules existing tasklet, with a print showing error interrupt has occurred on which channels. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent 16ca810 commit 28da283

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

‎drivers/dma/amba-pl08x.c‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,38 +1619,40 @@ static void pl08x_tasklet(unsigned long data)
16191619
static irqreturn_t pl08x_irq(int irq, void *dev)
16201620
{
16211621
struct pl08x_driver_data *pl08x = dev;
1622-
u32 mask = 0;
1623-
u32 val;
1624-
int i;
1625-
1626-
val = readl(pl08x->base + PL080_ERR_STATUS);
1627-
if (val) {
1628-
/* An error interrupt (on one or more channels) */
1629-
dev_err(&pl08x->adev->dev,
1630-
"%s error interrupt, register value 0x%08x\n",
1631-
__func__, val);
1632-
/*
1633-
* Simply clear ALL PL08X error interrupts,
1634-
* regardless of channel and cause
1635-
* FIXME: should be 0x00000003 on PL081 really.
1636-
*/
1637-
writel(0x000000FF, pl08x->base + PL080_ERR_CLEAR);
1622+
u32 mask = 0, err, tc, i;
1623+
1624+
/* check & clear - ERR & TC interrupts */
1625+
err = readl(pl08x->base + PL080_ERR_STATUS);
1626+
if (err) {
1627+
dev_err(&pl08x->adev->dev, "%s error interrupt, register value 0x%08x\n",
1628+
__func__, err);
1629+
writel(err, pl08x->base + PL080_ERR_CLEAR);
16381630
}
1639-
val = readl(pl08x->base + PL080_INT_STATUS);
1631+
tc = readl(pl08x->base + PL080_INT_STATUS);
1632+
if (tc)
1633+
writel(tc, pl08x->base + PL080_TC_CLEAR);
1634+
1635+
if (!err && !tc)
1636+
return IRQ_NONE;
1637+
16401638
for (i = 0; i < pl08x->vd->channels; i++) {
1641-
if ((1 << i) & val) {
1639+
if (((1 << i) & err) || ((1 << i) & tc)) {
16421640
/* Locate physical channel */
16431641
struct pl08x_phy_chan *phychan = &pl08x->phy_chans[i];
16441642
struct pl08x_dma_chan *plchan = phychan->serving;
16451643

1644+
if (!plchan) {
1645+
dev_err(&pl08x->adev->dev,
1646+
"%s Error TC interrupt on unused channel: 0x%08x\n",
1647+
__func__, i);
1648+
continue;
1649+
}
1650+
16461651
/* Schedule tasklet on this channel */
16471652
tasklet_schedule(&plchan->tasklet);
1648-
16491653
mask |= (1 << i);
16501654
}
16511655
}
1652-
/* Clear only the terminal interrupts on channels we processed */
1653-
writel(mask, pl08x->base + PL080_TC_CLEAR);
16541656

16551657
return mask ? IRQ_HANDLED : IRQ_NONE;
16561658
}

0 commit comments

Comments
 (0)