aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/iop-adma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/iop-adma.c')
-rw-r--r--drivers/dma/iop-adma.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index ca6e6a0cb793..ee40dbba1879 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -893,14 +893,14 @@ static void iop_adma_free_chan_resources(struct dma_chan *chan)
893} 893}
894 894
895/** 895/**
896 * iop_adma_is_complete - poll the status of an ADMA transaction 896 * iop_adma_status - poll the status of an ADMA transaction
897 * @chan: ADMA channel handle 897 * @chan: ADMA channel handle
898 * @cookie: ADMA transaction identifier 898 * @cookie: ADMA transaction identifier
899 * @txstate: a holder for the current state of the channel or NULL
899 */ 900 */
900static enum dma_status iop_adma_is_complete(struct dma_chan *chan, 901static enum dma_status iop_adma_status(struct dma_chan *chan,
901 dma_cookie_t cookie, 902 dma_cookie_t cookie,
902 dma_cookie_t *done, 903 struct dma_tx_state *txstate)
903 dma_cookie_t *used)
904{ 904{
905 struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan); 905 struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan);
906 dma_cookie_t last_used; 906 dma_cookie_t last_used;
@@ -910,10 +910,11 @@ static enum dma_status iop_adma_is_complete(struct dma_chan *chan,
910 last_used = chan->cookie; 910 last_used = chan->cookie;
911 last_complete = iop_chan->completed_cookie; 911 last_complete = iop_chan->completed_cookie;
912 912
913 if (done) 913 if (txstate) {
914 *done = last_complete; 914 txstate->last = last_complete;
915 if (used) 915 txstate->used = last_used;
916 *used = last_used; 916 txstate->residue = 0;
917 }
917 918
918 ret = dma_async_is_complete(cookie, last_complete, last_used); 919 ret = dma_async_is_complete(cookie, last_complete, last_used);
919 if (ret == DMA_SUCCESS) 920 if (ret == DMA_SUCCESS)
@@ -924,10 +925,11 @@ static enum dma_status iop_adma_is_complete(struct dma_chan *chan,
924 last_used = chan->cookie; 925 last_used = chan->cookie;
925 last_complete = iop_chan->completed_cookie; 926 last_complete = iop_chan->completed_cookie;
926 927
927 if (done) 928 if (txstate) {
928 *done = last_complete; 929 txstate->last = last_complete;
929 if (used) 930 txstate->used = last_used;
930 *used = last_used; 931 txstate->residue = 0;
932 }
931 933
932 return dma_async_is_complete(cookie, last_complete, last_used); 934 return dma_async_is_complete(cookie, last_complete, last_used);
933} 935}
@@ -1042,7 +1044,7 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
1042 iop_adma_issue_pending(dma_chan); 1044 iop_adma_issue_pending(dma_chan);
1043 msleep(1); 1045 msleep(1);
1044 1046
1045 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != 1047 if (iop_adma_status(dma_chan, cookie, NULL) !=
1046 DMA_SUCCESS) { 1048 DMA_SUCCESS) {
1047 dev_printk(KERN_ERR, dma_chan->device->dev, 1049 dev_printk(KERN_ERR, dma_chan->device->dev,
1048 "Self-test copy timed out, disabling\n"); 1050 "Self-test copy timed out, disabling\n");
@@ -1142,7 +1144,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
1142 iop_adma_issue_pending(dma_chan); 1144 iop_adma_issue_pending(dma_chan);
1143 msleep(8); 1145 msleep(8);
1144 1146
1145 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != 1147 if (iop_adma_status(dma_chan, cookie, NULL) !=
1146 DMA_SUCCESS) { 1148 DMA_SUCCESS) {
1147 dev_printk(KERN_ERR, dma_chan->device->dev, 1149 dev_printk(KERN_ERR, dma_chan->device->dev,
1148 "Self-test xor timed out, disabling\n"); 1150 "Self-test xor timed out, disabling\n");
@@ -1189,7 +1191,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
1189 iop_adma_issue_pending(dma_chan); 1191 iop_adma_issue_pending(dma_chan);
1190 msleep(8); 1192 msleep(8);
1191 1193
1192 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { 1194 if (iop_adma_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
1193 dev_printk(KERN_ERR, dma_chan->device->dev, 1195 dev_printk(KERN_ERR, dma_chan->device->dev,
1194 "Self-test zero sum timed out, disabling\n"); 1196 "Self-test zero sum timed out, disabling\n");
1195 err = -ENODEV; 1197 err = -ENODEV;
@@ -1213,7 +1215,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
1213 iop_adma_issue_pending(dma_chan); 1215 iop_adma_issue_pending(dma_chan);
1214 msleep(8); 1216 msleep(8);
1215 1217
1216 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { 1218 if (iop_adma_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
1217 dev_printk(KERN_ERR, dma_chan->device->dev, 1219 dev_printk(KERN_ERR, dma_chan->device->dev,
1218 "Self-test memset timed out, disabling\n"); 1220 "Self-test memset timed out, disabling\n");
1219 err = -ENODEV; 1221 err = -ENODEV;
@@ -1245,7 +1247,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
1245 iop_adma_issue_pending(dma_chan); 1247 iop_adma_issue_pending(dma_chan);
1246 msleep(8); 1248 msleep(8);
1247 1249
1248 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { 1250 if (iop_adma_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
1249 dev_printk(KERN_ERR, dma_chan->device->dev, 1251 dev_printk(KERN_ERR, dma_chan->device->dev,
1250 "Self-test non-zero sum timed out, disabling\n"); 1252 "Self-test non-zero sum timed out, disabling\n");
1251 err = -ENODEV; 1253 err = -ENODEV;
@@ -1340,7 +1342,7 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
1340 iop_adma_issue_pending(dma_chan); 1342 iop_adma_issue_pending(dma_chan);
1341 msleep(8); 1343 msleep(8);
1342 1344
1343 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != 1345 if (iop_adma_status(dma_chan, cookie, NULL) !=
1344 DMA_SUCCESS) { 1346 DMA_SUCCESS) {
1345 dev_err(dev, "Self-test pq timed out, disabling\n"); 1347 dev_err(dev, "Self-test pq timed out, disabling\n");
1346 err = -ENODEV; 1348 err = -ENODEV;
@@ -1377,7 +1379,7 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
1377 iop_adma_issue_pending(dma_chan); 1379 iop_adma_issue_pending(dma_chan);
1378 msleep(8); 1380 msleep(8);
1379 1381
1380 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != 1382 if (iop_adma_status(dma_chan, cookie, NULL) !=
1381 DMA_SUCCESS) { 1383 DMA_SUCCESS) {
1382 dev_err(dev, "Self-test pq-zero-sum timed out, disabling\n"); 1384 dev_err(dev, "Self-test pq-zero-sum timed out, disabling\n");
1383 err = -ENODEV; 1385 err = -ENODEV;
@@ -1409,7 +1411,7 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
1409 iop_adma_issue_pending(dma_chan); 1411 iop_adma_issue_pending(dma_chan);
1410 msleep(8); 1412 msleep(8);
1411 1413
1412 if (iop_adma_is_complete(dma_chan, cookie, NULL, NULL) != 1414 if (iop_adma_status(dma_chan, cookie, NULL) !=
1413 DMA_SUCCESS) { 1415 DMA_SUCCESS) {
1414 dev_err(dev, "Self-test !pq-zero-sum timed out, disabling\n"); 1416 dev_err(dev, "Self-test !pq-zero-sum timed out, disabling\n");
1415 err = -ENODEV; 1417 err = -ENODEV;
@@ -1507,7 +1509,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev)
1507 /* set base routines */ 1509 /* set base routines */
1508 dma_dev->device_alloc_chan_resources = iop_adma_alloc_chan_resources; 1510 dma_dev->device_alloc_chan_resources = iop_adma_alloc_chan_resources;
1509 dma_dev->device_free_chan_resources = iop_adma_free_chan_resources; 1511 dma_dev->device_free_chan_resources = iop_adma_free_chan_resources;
1510 dma_dev->device_is_tx_complete = iop_adma_is_complete; 1512 dma_dev->device_tx_status = iop_adma_status;
1511 dma_dev->device_issue_pending = iop_adma_issue_pending; 1513 dma_dev->device_issue_pending = iop_adma_issue_pending;
1512 dma_dev->dev = &pdev->dev; 1514 dma_dev->dev = &pdev->dev;
1513 1515