Skip to content

Commit ab2528c

Browse files
author
Vinod Koul
committed
Merge branch 'topic/imx' into for-linus
2 parents 238eed6 + 2746e2c commit ab2528c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/dma/imx-sdma.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ struct sdma_channel {
338338
unsigned int chn_real_count;
339339
struct tasklet_struct tasklet;
340340
struct imx_dma_data data;
341+
bool enabled;
341342
};
342343

343344
#define IMX_DMA_SG_LOOP BIT(0)
@@ -596,7 +597,14 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
596597

597598
static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
598599
{
600+
unsigned long flags;
601+
struct sdma_channel *sdmac = &sdma->channel[channel];
602+
599603
writel(BIT(channel), sdma->regs + SDMA_H_START);
604+
605+
spin_lock_irqsave(&sdmac->lock, flags);
606+
sdmac->enabled = true;
607+
spin_unlock_irqrestore(&sdmac->lock, flags);
600608
}
601609

602610
/*
@@ -685,6 +693,14 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
685693
struct sdma_buffer_descriptor *bd;
686694
int error = 0;
687695
enum dma_status old_status = sdmac->status;
696+
unsigned long flags;
697+
698+
spin_lock_irqsave(&sdmac->lock, flags);
699+
if (!sdmac->enabled) {
700+
spin_unlock_irqrestore(&sdmac->lock, flags);
701+
return;
702+
}
703+
spin_unlock_irqrestore(&sdmac->lock, flags);
688704

689705
/*
690706
* loop mode. Iterate over descriptors, re-setup them and
@@ -938,10 +954,15 @@ static int sdma_disable_channel(struct dma_chan *chan)
938954
struct sdma_channel *sdmac = to_sdma_chan(chan);
939955
struct sdma_engine *sdma = sdmac->sdma;
940956
int channel = sdmac->channel;
957+
unsigned long flags;
941958

942959
writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP);
943960
sdmac->status = DMA_ERROR;
944961

962+
spin_lock_irqsave(&sdmac->lock, flags);
963+
sdmac->enabled = false;
964+
spin_unlock_irqrestore(&sdmac->lock, flags);
965+
945966
return 0;
946967
}
947968

0 commit comments

Comments
 (0)