diff options
Diffstat (limited to 'drivers/dma/ioat_dma.c')
-rw-r--r-- | drivers/dma/ioat_dma.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 43b8cefad2c6..ecd743f7cc61 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,8 +172,10 @@ 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 | ||
174 | #if CONFIG_I7300_IDLE_IOAT_CHANNEL | 175 | #ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL |
175 | device->common.chancnt--; | 176 | if (i7300_idle_platform_probe(NULL, NULL) == 0) { |
177 | device->common.chancnt--; | ||
178 | } | ||
176 | #endif | 179 | #endif |
177 | for (i = 0; i < device->common.chancnt; i++) { | 180 | for (i = 0; i < device->common.chancnt; i++) { |
178 | ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); | 181 | ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); |
@@ -522,7 +525,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx) | |||
522 | } | 525 | } |
523 | 526 | ||
524 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 527 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
525 | if (new->async_tx.callback) { | 528 | if (first->async_tx.callback) { |
526 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; | 529 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; |
527 | if (first != new) { | 530 | if (first != new) { |
528 | /* move callback into to last desc */ | 531 | /* move callback into to last desc */ |
@@ -614,7 +617,7 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx) | |||
614 | } | 617 | } |
615 | 618 | ||
616 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 619 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
617 | if (new->async_tx.callback) { | 620 | if (first->async_tx.callback) { |
618 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; | 621 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; |
619 | if (first != new) { | 622 | if (first != new) { |
620 | /* move callback into to last desc */ | 623 | /* move callback into to last desc */ |
@@ -804,6 +807,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
804 | struct ioat_desc_sw *desc, *_desc; | 807 | struct ioat_desc_sw *desc, *_desc; |
805 | int in_use_descs = 0; | 808 | int in_use_descs = 0; |
806 | 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 | |||
807 | tasklet_disable(&ioat_chan->cleanup_task); | 816 | tasklet_disable(&ioat_chan->cleanup_task); |
808 | ioat_dma_memcpy_cleanup(ioat_chan); | 817 | ioat_dma_memcpy_cleanup(ioat_chan); |
809 | 818 | ||
@@ -866,6 +875,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
866 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; | 875 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; |
867 | ioat_chan->pending = 0; | 876 | ioat_chan->pending = 0; |
868 | ioat_chan->dmacount = 0; | 877 | ioat_chan->dmacount = 0; |
878 | ioat_chan->desccount = 0; | ||
869 | ioat_chan->watchdog_completion = 0; | 879 | ioat_chan->watchdog_completion = 0; |
870 | ioat_chan->last_compl_desc_addr_hw = 0; | 880 | ioat_chan->last_compl_desc_addr_hw = 0; |
871 | ioat_chan->watchdog_tcp_cookie = | 881 | ioat_chan->watchdog_tcp_cookie = |