aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/amba-pl08x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/amba-pl08x.c')
-rw-r--r--drivers/dma/amba-pl08x.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 297f48b0cba9..8321a3997c95 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -267,19 +267,24 @@ static void pl08x_resume_phy_chan(struct pl08x_phy_chan *ch)
267} 267}
268 268
269 269
270/* Stops the channel */ 270/*
271static void pl08x_stop_phy_chan(struct pl08x_phy_chan *ch) 271 * pl08x_terminate_phy_chan() stops the channel, clears the FIFO and
272 * clears any pending interrupt status. This should not be used for
273 * an on-going transfer, but as a method of shutting down a channel
274 * (eg, when it's no longer used) or terminating a transfer.
275 */
276static void pl08x_terminate_phy_chan(struct pl08x_driver_data *pl08x,
277 struct pl08x_phy_chan *ch)
272{ 278{
273 u32 val; 279 u32 val = readl(ch->base + PL080_CH_CONFIG);
274 280
275 pl08x_pause_phy_chan(ch); 281 val &= ~(PL080_CONFIG_ENABLE | PL080_CONFIG_ERR_IRQ_MASK |
282 PL080_CONFIG_TC_IRQ_MASK);
276 283
277 /* Disable channel */
278 val = readl(ch->base + PL080_CH_CONFIG);
279 val &= ~PL080_CONFIG_ENABLE;
280 val &= ~PL080_CONFIG_ERR_IRQ_MASK;
281 val &= ~PL080_CONFIG_TC_IRQ_MASK;
282 writel(val, ch->base + PL080_CH_CONFIG); 284 writel(val, ch->base + PL080_CH_CONFIG);
285
286 writel(1 << ch->id, pl08x->base + PL080_ERR_CLEAR);
287 writel(1 << ch->id, pl08x->base + PL080_TC_CLEAR);
283} 288}
284 289
285static inline u32 get_bytes_in_cctl(u32 cctl) 290static inline u32 get_bytes_in_cctl(u32 cctl)
@@ -404,13 +409,12 @@ static inline void pl08x_put_phy_channel(struct pl08x_driver_data *pl08x,
404{ 409{
405 unsigned long flags; 410 unsigned long flags;
406 411
412 spin_lock_irqsave(&ch->lock, flags);
413
407 /* Stop the channel and clear its interrupts */ 414 /* Stop the channel and clear its interrupts */
408 pl08x_stop_phy_chan(ch); 415 pl08x_terminate_phy_chan(pl08x, ch);
409 writel((1 << ch->id), pl08x->base + PL080_ERR_CLEAR);
410 writel((1 << ch->id), pl08x->base + PL080_TC_CLEAR);
411 416
412 /* Mark it as free */ 417 /* Mark it as free */
413 spin_lock_irqsave(&ch->lock, flags);
414 ch->serving = NULL; 418 ch->serving = NULL;
415 spin_unlock_irqrestore(&ch->lock, flags); 419 spin_unlock_irqrestore(&ch->lock, flags);
416} 420}
@@ -1449,7 +1453,7 @@ static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
1449 plchan->state = PL08X_CHAN_IDLE; 1453 plchan->state = PL08X_CHAN_IDLE;
1450 1454
1451 if (plchan->phychan) { 1455 if (plchan->phychan) {
1452 pl08x_stop_phy_chan(plchan->phychan); 1456 pl08x_terminate_phy_chan(pl08x, plchan->phychan);
1453 1457
1454 /* 1458 /*
1455 * Mark physical channel as free and free any slave 1459 * Mark physical channel as free and free any slave