aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/ioat_dma.c')
-rw-r--r--drivers/dma/ioat_dma.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 1ef68b315657..6607fdd00b1c 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -33,6 +33,7 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36#include <linux/i7300_idle.h>
36#include "ioatdma.h" 37#include "ioatdma.h"
37#include "ioatdma_registers.h" 38#include "ioatdma_registers.h"
38#include "ioatdma_hw.h" 39#include "ioatdma_hw.h"
@@ -171,6 +172,11 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device)
171 xfercap_scale = readb(device->reg_base + IOAT_XFERCAP_OFFSET); 172 xfercap_scale = readb(device->reg_base + IOAT_XFERCAP_OFFSET);
172 xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); 173 xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale));
173 174
175#ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL
176 if (i7300_idle_platform_probe(NULL, NULL) == 0) {
177 device->common.chancnt--;
178 }
179#endif
174 for (i = 0; i < device->common.chancnt; i++) { 180 for (i = 0; i < device->common.chancnt; i++) {
175 ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); 181 ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL);
176 if (!ioat_chan) { 182 if (!ioat_chan) {
@@ -519,7 +525,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
519 } 525 }
520 526
521 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 527 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
522 if (new->async_tx.callback) { 528 if (first->async_tx.callback) {
523 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; 529 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
524 if (first != new) { 530 if (first != new) {
525 /* move callback into to last desc */ 531 /* move callback into to last desc */
@@ -611,7 +617,7 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
611 } 617 }
612 618
613 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 619 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
614 if (new->async_tx.callback) { 620 if (first->async_tx.callback) {
615 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; 621 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
616 if (first != new) { 622 if (first != new) {
617 /* move callback into to last desc */ 623 /* move callback into to last desc */
@@ -801,6 +807,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
801 struct ioat_desc_sw *desc, *_desc; 807 struct ioat_desc_sw *desc, *_desc;
802 int in_use_descs = 0; 808 int in_use_descs = 0;
803 809
810 /* Before freeing channel resources first check
811 * if they have been previously allocated for this channel.
812 */
813 if (ioat_chan->desccount == 0)
814 return;
815
804 tasklet_disable(&ioat_chan->cleanup_task); 816 tasklet_disable(&ioat_chan->cleanup_task);
805 ioat_dma_memcpy_cleanup(ioat_chan); 817 ioat_dma_memcpy_cleanup(ioat_chan);
806 818
@@ -863,6 +875,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
863 ioat_chan->last_completion = ioat_chan->completion_addr = 0; 875 ioat_chan->last_completion = ioat_chan->completion_addr = 0;
864 ioat_chan->pending = 0; 876 ioat_chan->pending = 0;
865 ioat_chan->dmacount = 0; 877 ioat_chan->dmacount = 0;
878 ioat_chan->desccount = 0;
866 ioat_chan->watchdog_completion = 0; 879 ioat_chan->watchdog_completion = 0;
867 ioat_chan->last_compl_desc_addr_hw = 0; 880 ioat_chan->last_compl_desc_addr_hw = 0;
868 ioat_chan->watchdog_tcp_cookie = 881 ioat_chan->watchdog_tcp_cookie =
@@ -1328,10 +1341,12 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
1328 */ 1341 */
1329#define IOAT_TEST_SIZE 2000 1342#define IOAT_TEST_SIZE 2000
1330 1343
1344DECLARE_COMPLETION(test_completion);
1331static void ioat_dma_test_callback(void *dma_async_param) 1345static void ioat_dma_test_callback(void *dma_async_param)
1332{ 1346{
1333 printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n", 1347 printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n",
1334 dma_async_param); 1348 dma_async_param);
1349 complete(&test_completion);
1335} 1350}
1336 1351
1337/** 1352/**
@@ -1397,7 +1412,8 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1397 goto free_resources; 1412 goto free_resources;
1398 } 1413 }
1399 device->common.device_issue_pending(dma_chan); 1414 device->common.device_issue_pending(dma_chan);
1400 msleep(1); 1415
1416 wait_for_completion_timeout(&test_completion, msecs_to_jiffies(3000));
1401 1417
1402 if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) 1418 if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL)
1403 != DMA_SUCCESS) { 1419 != DMA_SUCCESS) {