aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/coh901318.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/coh901318.c')
-rw-r--r--drivers/dma/coh901318.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index f636c4a87c7f..53c54e034aa3 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -506,10 +506,11 @@ u32 coh901318_get_bytes_left(struct dma_chan *chan)
506EXPORT_SYMBOL(coh901318_get_bytes_left); 506EXPORT_SYMBOL(coh901318_get_bytes_left);
507 507
508 508
509/* Stops a transfer without losing data. Enables power save. 509/*
510 Use this function in conjunction with coh901318_continue(..) 510 * Pauses a transfer without losing data. Enables power save.
511*/ 511 * Use this function in conjunction with coh901318_resume.
512void coh901318_stop(struct dma_chan *chan) 512 */
513static void coh901318_pause(struct dma_chan *chan)
513{ 514{
514 u32 val; 515 u32 val;
515 unsigned long flags; 516 unsigned long flags;
@@ -550,12 +551,11 @@ void coh901318_stop(struct dma_chan *chan)
550 551
551 spin_unlock_irqrestore(&cohc->lock, flags); 552 spin_unlock_irqrestore(&cohc->lock, flags);
552} 553}
553EXPORT_SYMBOL(coh901318_stop);
554 554
555/* Continues a transfer that has been stopped via 300_dma_stop(..). 555/* Resumes a transfer that has been stopped via 300_dma_stop(..).
556 Power save is handled. 556 Power save is handled.
557*/ 557*/
558void coh901318_continue(struct dma_chan *chan) 558static void coh901318_resume(struct dma_chan *chan)
559{ 559{
560 u32 val; 560 u32 val;
561 unsigned long flags; 561 unsigned long flags;
@@ -581,7 +581,6 @@ void coh901318_continue(struct dma_chan *chan)
581 581
582 spin_unlock_irqrestore(&cohc->lock, flags); 582 spin_unlock_irqrestore(&cohc->lock, flags);
583} 583}
584EXPORT_SYMBOL(coh901318_continue);
585 584
586bool coh901318_filter_id(struct dma_chan *chan, void *chan_id) 585bool coh901318_filter_id(struct dma_chan *chan, void *chan_id)
587{ 586{
@@ -945,7 +944,7 @@ coh901318_free_chan_resources(struct dma_chan *chan)
945 944
946 spin_unlock_irqrestore(&cohc->lock, flags); 945 spin_unlock_irqrestore(&cohc->lock, flags);
947 946
948 chan->device->device_terminate_all(chan); 947 chan->device->device_control(chan, DMA_TERMINATE_ALL);
949} 948}
950 949
951 950
@@ -1179,16 +1178,29 @@ coh901318_issue_pending(struct dma_chan *chan)
1179 spin_unlock_irqrestore(&cohc->lock, flags); 1178 spin_unlock_irqrestore(&cohc->lock, flags);
1180} 1179}
1181 1180
1182static void 1181static int
1183coh901318_terminate_all(struct dma_chan *chan) 1182coh901318_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
1184{ 1183{
1185 unsigned long flags; 1184 unsigned long flags;
1186 struct coh901318_chan *cohc = to_coh901318_chan(chan); 1185 struct coh901318_chan *cohc = to_coh901318_chan(chan);
1187 struct coh901318_desc *cohd; 1186 struct coh901318_desc *cohd;
1188 void __iomem *virtbase = cohc->base->virtbase; 1187 void __iomem *virtbase = cohc->base->virtbase;
1189 1188
1190 coh901318_stop(chan); 1189 if (cmd == DMA_PAUSE) {
1190 coh901318_pause(chan);
1191 return 0;
1192 }
1193
1194 if (cmd == DMA_RESUME) {
1195 coh901318_resume(chan);
1196 return 0;
1197 }
1198
1199 if (cmd != DMA_TERMINATE_ALL)
1200 return -ENXIO;
1191 1201
1202 /* The remainder of this function terminates the transfer */
1203 coh901318_pause(chan);
1192 spin_lock_irqsave(&cohc->lock, flags); 1204 spin_lock_irqsave(&cohc->lock, flags);
1193 1205
1194 /* Clear any pending BE or TC interrupt */ 1206 /* Clear any pending BE or TC interrupt */
@@ -1227,6 +1239,8 @@ coh901318_terminate_all(struct dma_chan *chan)
1227 cohc->busy = 0; 1239 cohc->busy = 0;
1228 1240
1229 spin_unlock_irqrestore(&cohc->lock, flags); 1241 spin_unlock_irqrestore(&cohc->lock, flags);
1242
1243 return 0;
1230} 1244}
1231void coh901318_base_init(struct dma_device *dma, const int *pick_chans, 1245void coh901318_base_init(struct dma_device *dma, const int *pick_chans,
1232 struct coh901318_base *base) 1246 struct coh901318_base *base)
@@ -1344,7 +1358,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
1344 base->dma_slave.device_prep_slave_sg = coh901318_prep_slave_sg; 1358 base->dma_slave.device_prep_slave_sg = coh901318_prep_slave_sg;
1345 base->dma_slave.device_is_tx_complete = coh901318_is_tx_complete; 1359 base->dma_slave.device_is_tx_complete = coh901318_is_tx_complete;
1346 base->dma_slave.device_issue_pending = coh901318_issue_pending; 1360 base->dma_slave.device_issue_pending = coh901318_issue_pending;
1347 base->dma_slave.device_terminate_all = coh901318_terminate_all; 1361 base->dma_slave.device_control = coh901318_control;
1348 base->dma_slave.dev = &pdev->dev; 1362 base->dma_slave.dev = &pdev->dev;
1349 1363
1350 err = dma_async_device_register(&base->dma_slave); 1364 err = dma_async_device_register(&base->dma_slave);
@@ -1364,7 +1378,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
1364 base->dma_memcpy.device_prep_dma_memcpy = coh901318_prep_memcpy; 1378 base->dma_memcpy.device_prep_dma_memcpy = coh901318_prep_memcpy;
1365 base->dma_memcpy.device_is_tx_complete = coh901318_is_tx_complete; 1379 base->dma_memcpy.device_is_tx_complete = coh901318_is_tx_complete;
1366 base->dma_memcpy.device_issue_pending = coh901318_issue_pending; 1380 base->dma_memcpy.device_issue_pending = coh901318_issue_pending;
1367 base->dma_memcpy.device_terminate_all = coh901318_terminate_all; 1381 base->dma_memcpy.device_control = coh901318_control;
1368 base->dma_memcpy.dev = &pdev->dev; 1382 base->dma_memcpy.dev = &pdev->dev;
1369 /* 1383 /*
1370 * This controller can only access address at even 32bit boundaries, 1384 * This controller can only access address at even 32bit boundaries,