aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2018-04-09 23:25:19 -0400
committerVinod Koul <vinod.koul@intel.com>2018-04-09 23:25:19 -0400
commitab2528c1b19e6e3b5a3713dfe6b054c672b4a498 (patch)
treea5ed68fa9877ef9bab8098ac0325eec70d29488b
parent238eed66be899ab4d576c60d446f595c64e4b557 (diff)
parent2746e2c389f9d50043d21e2204270403efb9d62f (diff)
Merge branch 'topic/imx' into for-linus
-rw-r--r--drivers/dma/imx-sdma.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index e7db24c67030..ccd03c3cedfe 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -338,6 +338,7 @@ struct sdma_channel {
338 unsigned int chn_real_count; 338 unsigned int chn_real_count;
339 struct tasklet_struct tasklet; 339 struct tasklet_struct tasklet;
340 struct imx_dma_data data; 340 struct imx_dma_data data;
341 bool enabled;
341}; 342};
342 343
343#define IMX_DMA_SG_LOOP BIT(0) 344#define IMX_DMA_SG_LOOP BIT(0)
@@ -596,7 +597,14 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
596 597
597static void sdma_enable_channel(struct sdma_engine *sdma, int channel) 598static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
598{ 599{
600 unsigned long flags;
601 struct sdma_channel *sdmac = &sdma->channel[channel];
602
599 writel(BIT(channel), sdma->regs + SDMA_H_START); 603 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);
600} 608}
601 609
602/* 610/*
@@ -685,6 +693,14 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
685 struct sdma_buffer_descriptor *bd; 693 struct sdma_buffer_descriptor *bd;
686 int error = 0; 694 int error = 0;
687 enum dma_status old_status = sdmac->status; 695 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);
688 704
689 /* 705 /*
690 * loop mode. Iterate over descriptors, re-setup them and 706 * loop mode. Iterate over descriptors, re-setup them and
@@ -938,10 +954,15 @@ static int sdma_disable_channel(struct dma_chan *chan)
938 struct sdma_channel *sdmac = to_sdma_chan(chan); 954 struct sdma_channel *sdmac = to_sdma_chan(chan);
939 struct sdma_engine *sdma = sdmac->sdma; 955 struct sdma_engine *sdma = sdmac->sdma;
940 int channel = sdmac->channel; 956 int channel = sdmac->channel;
957 unsigned long flags;
941 958
942 writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP); 959 writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP);
943 sdmac->status = DMA_ERROR; 960 sdmac->status = DMA_ERROR;
944 961
962 spin_lock_irqsave(&sdmac->lock, flags);
963 sdmac->enabled = false;
964 spin_unlock_irqrestore(&sdmac->lock, flags);
965
945 return 0; 966 return 0;
946} 967}
947 968