Skip to content

Commit

Permalink
Merge branch 'topic/imx' into for-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinod Koul committed Apr 10, 2018
2 parents 238eed6 + 2746e2c commit ab2528c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/dma/imx-sdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ struct sdma_channel {
unsigned int chn_real_count;
struct tasklet_struct tasklet;
struct imx_dma_data data;
bool enabled;
};

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

static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
{
unsigned long flags;
struct sdma_channel *sdmac = &sdma->channel[channel];

writel(BIT(channel), sdma->regs + SDMA_H_START);

spin_lock_irqsave(&sdmac->lock, flags);
sdmac->enabled = true;
spin_unlock_irqrestore(&sdmac->lock, flags);
}

/*
Expand Down Expand Up @@ -685,6 +693,14 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
struct sdma_buffer_descriptor *bd;
int error = 0;
enum dma_status old_status = sdmac->status;
unsigned long flags;

spin_lock_irqsave(&sdmac->lock, flags);
if (!sdmac->enabled) {
spin_unlock_irqrestore(&sdmac->lock, flags);
return;
}
spin_unlock_irqrestore(&sdmac->lock, flags);

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

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

spin_lock_irqsave(&sdmac->lock, flags);
sdmac->enabled = false;
spin_unlock_irqrestore(&sdmac->lock, flags);

return 0;
}

Expand Down

0 comments on commit ab2528c

Please sign in to comment.