Commit 374dab2366c64666612b8f6275f8c373a373b8d0
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine fixes from Vinod Koul: "This contains small fixes spread across the drivers" * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma: dmaengine: mmp_pdma: fix warning about slave caps dmaengine: qcom_bam_dma: fix wrong register offsets dmaengine: bam-dma: fix a warning about missing capabilities dmaengine: ioatdma: workaround for incorrect DMACAP register dmaengine: at_xdmac: fix for chan conf simplification dmaengine: dw: don't handle interrupt when dmaengine is not used dma: mmp-tdma: refine dma disable and dma-pos update dmaengine: shdma: Move DMA stop to (runtime) suspend callbacks dmaenegine: mmp-pdma: fix irq handler overwrite physical chan issue
Showing 7 changed files Side-by-side Diff
drivers/dma/at_xdmac.c
... | ... | @@ -664,7 +664,6 @@ |
664 | 664 | struct at_xdmac_desc *first = NULL, *prev = NULL; |
665 | 665 | unsigned int periods = buf_len / period_len; |
666 | 666 | int i; |
667 | - u32 cfg; | |
668 | 667 | |
669 | 668 | dev_dbg(chan2dev(chan), "%s: buf_addr=%pad, buf_len=%zd, period_len=%zd, dir=%s, flags=0x%lx\n", |
670 | 669 | __func__, &buf_addr, buf_len, period_len, |
671 | 670 | |
672 | 671 | |
... | ... | @@ -700,17 +699,17 @@ |
700 | 699 | if (direction == DMA_DEV_TO_MEM) { |
701 | 700 | desc->lld.mbr_sa = atchan->per_src_addr; |
702 | 701 | desc->lld.mbr_da = buf_addr + i * period_len; |
703 | - cfg = atchan->cfg[AT_XDMAC_DEV_TO_MEM_CFG]; | |
702 | + desc->lld.mbr_cfg = atchan->cfg[AT_XDMAC_DEV_TO_MEM_CFG]; | |
704 | 703 | } else { |
705 | 704 | desc->lld.mbr_sa = buf_addr + i * period_len; |
706 | 705 | desc->lld.mbr_da = atchan->per_dst_addr; |
707 | - cfg = atchan->cfg[AT_XDMAC_MEM_TO_DEV_CFG]; | |
706 | + desc->lld.mbr_cfg = atchan->cfg[AT_XDMAC_MEM_TO_DEV_CFG]; | |
708 | 707 | } |
709 | 708 | desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV1 |
710 | 709 | | AT_XDMAC_MBR_UBC_NDEN |
711 | 710 | | AT_XDMAC_MBR_UBC_NSEN |
712 | 711 | | AT_XDMAC_MBR_UBC_NDE |
713 | - | period_len >> at_xdmac_get_dwidth(cfg); | |
712 | + | period_len >> at_xdmac_get_dwidth(desc->lld.mbr_cfg); | |
714 | 713 | |
715 | 714 | dev_dbg(chan2dev(chan), |
716 | 715 | "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n", |
drivers/dma/dw/core.c
drivers/dma/ioat/dma_v3.c
... | ... | @@ -230,6 +230,10 @@ |
230 | 230 | switch (pdev->device) { |
231 | 231 | case PCI_DEVICE_ID_INTEL_IOAT_BWD2: |
232 | 232 | case PCI_DEVICE_ID_INTEL_IOAT_BWD3: |
233 | + case PCI_DEVICE_ID_INTEL_IOAT_BDXDE0: | |
234 | + case PCI_DEVICE_ID_INTEL_IOAT_BDXDE1: | |
235 | + case PCI_DEVICE_ID_INTEL_IOAT_BDXDE2: | |
236 | + case PCI_DEVICE_ID_INTEL_IOAT_BDXDE3: | |
233 | 237 | return true; |
234 | 238 | default: |
235 | 239 | return false; |
drivers/dma/mmp_pdma.c
... | ... | @@ -219,6 +219,9 @@ |
219 | 219 | |
220 | 220 | while (dint) { |
221 | 221 | i = __ffs(dint); |
222 | + /* only handle interrupts belonging to pdma driver*/ | |
223 | + if (i >= pdev->dma_channels) | |
224 | + break; | |
222 | 225 | dint &= (dint - 1); |
223 | 226 | phy = &pdev->phy[i]; |
224 | 227 | ret = mmp_pdma_chan_handler(irq, phy); |
... | ... | @@ -999,6 +1002,9 @@ |
999 | 1002 | struct resource *iores; |
1000 | 1003 | int i, ret, irq = 0; |
1001 | 1004 | int dma_channels = 0, irq_num = 0; |
1005 | + const enum dma_slave_buswidth widths = | |
1006 | + DMA_SLAVE_BUSWIDTH_1_BYTE | DMA_SLAVE_BUSWIDTH_2_BYTES | | |
1007 | + DMA_SLAVE_BUSWIDTH_4_BYTES; | |
1002 | 1008 | |
1003 | 1009 | pdev = devm_kzalloc(&op->dev, sizeof(*pdev), GFP_KERNEL); |
1004 | 1010 | if (!pdev) |
... | ... | @@ -1066,6 +1072,10 @@ |
1066 | 1072 | pdev->device.device_config = mmp_pdma_config; |
1067 | 1073 | pdev->device.device_terminate_all = mmp_pdma_terminate_all; |
1068 | 1074 | pdev->device.copy_align = PDMA_ALIGNMENT; |
1075 | + pdev->device.src_addr_widths = widths; | |
1076 | + pdev->device.dst_addr_widths = widths; | |
1077 | + pdev->device.directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM); | |
1078 | + pdev->device.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; | |
1069 | 1079 | |
1070 | 1080 | if (pdev->dev->coherent_dma_mask) |
1071 | 1081 | dma_set_mask(pdev->dev, pdev->dev->coherent_dma_mask); |
drivers/dma/mmp_tdma.c
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 | struct tasklet_struct tasklet; |
111 | 111 | |
112 | 112 | struct mmp_tdma_desc *desc_arr; |
113 | - phys_addr_t desc_arr_phys; | |
113 | + dma_addr_t desc_arr_phys; | |
114 | 114 | int desc_num; |
115 | 115 | enum dma_transfer_direction dir; |
116 | 116 | dma_addr_t dev_addr; |
117 | 117 | |
... | ... | @@ -166,9 +166,12 @@ |
166 | 166 | static int mmp_tdma_disable_chan(struct dma_chan *chan) |
167 | 167 | { |
168 | 168 | struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); |
169 | + u32 tdcr; | |
169 | 170 | |
170 | - writel(readl(tdmac->reg_base + TDCR) & ~TDCR_CHANEN, | |
171 | - tdmac->reg_base + TDCR); | |
171 | + tdcr = readl(tdmac->reg_base + TDCR); | |
172 | + tdcr |= TDCR_ABR; | |
173 | + tdcr &= ~TDCR_CHANEN; | |
174 | + writel(tdcr, tdmac->reg_base + TDCR); | |
172 | 175 | |
173 | 176 | tdmac->status = DMA_COMPLETE; |
174 | 177 | |
175 | 178 | |
... | ... | @@ -296,12 +299,27 @@ |
296 | 299 | return -EAGAIN; |
297 | 300 | } |
298 | 301 | |
302 | +static size_t mmp_tdma_get_pos(struct mmp_tdma_chan *tdmac) | |
303 | +{ | |
304 | + size_t reg; | |
305 | + | |
306 | + if (tdmac->idx == 0) { | |
307 | + reg = __raw_readl(tdmac->reg_base + TDSAR); | |
308 | + reg -= tdmac->desc_arr[0].src_addr; | |
309 | + } else if (tdmac->idx == 1) { | |
310 | + reg = __raw_readl(tdmac->reg_base + TDDAR); | |
311 | + reg -= tdmac->desc_arr[0].dst_addr; | |
312 | + } else | |
313 | + return -EINVAL; | |
314 | + | |
315 | + return reg; | |
316 | +} | |
317 | + | |
299 | 318 | static irqreturn_t mmp_tdma_chan_handler(int irq, void *dev_id) |
300 | 319 | { |
301 | 320 | struct mmp_tdma_chan *tdmac = dev_id; |
302 | 321 | |
303 | 322 | if (mmp_tdma_clear_chan_irq(tdmac) == 0) { |
304 | - tdmac->pos = (tdmac->pos + tdmac->period_len) % tdmac->buf_len; | |
305 | 323 | tasklet_schedule(&tdmac->tasklet); |
306 | 324 | return IRQ_HANDLED; |
307 | 325 | } else |
... | ... | @@ -343,7 +361,7 @@ |
343 | 361 | int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); |
344 | 362 | |
345 | 363 | gpool = tdmac->pool; |
346 | - if (tdmac->desc_arr) | |
364 | + if (gpool && tdmac->desc_arr) | |
347 | 365 | gen_pool_free(gpool, (unsigned long)tdmac->desc_arr, |
348 | 366 | size); |
349 | 367 | tdmac->desc_arr = NULL; |
... | ... | @@ -499,6 +517,7 @@ |
499 | 517 | { |
500 | 518 | struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); |
501 | 519 | |
520 | + tdmac->pos = mmp_tdma_get_pos(tdmac); | |
502 | 521 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, |
503 | 522 | tdmac->buf_len - tdmac->pos); |
504 | 523 | |
... | ... | @@ -610,7 +629,7 @@ |
610 | 629 | int i, ret; |
611 | 630 | int irq = 0, irq_num = 0; |
612 | 631 | int chan_num = TDMA_CHANNEL_NUM; |
613 | - struct gen_pool *pool; | |
632 | + struct gen_pool *pool = NULL; | |
614 | 633 | |
615 | 634 | of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); |
616 | 635 | if (of_id) |
drivers/dma/qcom_bam_dma.c
... | ... | @@ -162,9 +162,9 @@ |
162 | 162 | [BAM_P_IRQ_STTS] = { 0x1010, 0x1000, 0x00, 0x00 }, |
163 | 163 | [BAM_P_IRQ_CLR] = { 0x1014, 0x1000, 0x00, 0x00 }, |
164 | 164 | [BAM_P_IRQ_EN] = { 0x1018, 0x1000, 0x00, 0x00 }, |
165 | - [BAM_P_EVNT_DEST_ADDR] = { 0x102C, 0x00, 0x1000, 0x00 }, | |
166 | - [BAM_P_EVNT_REG] = { 0x1018, 0x00, 0x1000, 0x00 }, | |
167 | - [BAM_P_SW_OFSTS] = { 0x1000, 0x00, 0x1000, 0x00 }, | |
165 | + [BAM_P_EVNT_DEST_ADDR] = { 0x182C, 0x00, 0x1000, 0x00 }, | |
166 | + [BAM_P_EVNT_REG] = { 0x1818, 0x00, 0x1000, 0x00 }, | |
167 | + [BAM_P_SW_OFSTS] = { 0x1800, 0x00, 0x1000, 0x00 }, | |
168 | 168 | [BAM_P_DATA_FIFO_ADDR] = { 0x1824, 0x00, 0x1000, 0x00 }, |
169 | 169 | [BAM_P_DESC_FIFO_ADDR] = { 0x181C, 0x00, 0x1000, 0x00 }, |
170 | 170 | [BAM_P_EVNT_GEN_TRSHLD] = { 0x1828, 0x00, 0x1000, 0x00 }, |
... | ... | @@ -1143,6 +1143,10 @@ |
1143 | 1143 | dma_cap_set(DMA_SLAVE, bdev->common.cap_mask); |
1144 | 1144 | |
1145 | 1145 | /* initialize dmaengine apis */ |
1146 | + bdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); | |
1147 | + bdev->common.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; | |
1148 | + bdev->common.src_addr_widths = DMA_SLAVE_BUSWIDTH_4_BYTES; | |
1149 | + bdev->common.dst_addr_widths = DMA_SLAVE_BUSWIDTH_4_BYTES; | |
1146 | 1150 | bdev->common.device_alloc_chan_resources = bam_alloc_chan; |
1147 | 1151 | bdev->common.device_free_chan_resources = bam_free_chan; |
1148 | 1152 | bdev->common.device_prep_slave_sg = bam_prep_slave_sg; |
drivers/dma/sh/shdmac.c
... | ... | @@ -582,15 +582,12 @@ |
582 | 582 | } |
583 | 583 | } |
584 | 584 | |
585 | -static void sh_dmae_shutdown(struct platform_device *pdev) | |
586 | -{ | |
587 | - struct sh_dmae_device *shdev = platform_get_drvdata(pdev); | |
588 | - sh_dmae_ctl_stop(shdev); | |
589 | -} | |
590 | - | |
591 | 585 | #ifdef CONFIG_PM |
592 | 586 | static int sh_dmae_runtime_suspend(struct device *dev) |
593 | 587 | { |
588 | + struct sh_dmae_device *shdev = dev_get_drvdata(dev); | |
589 | + | |
590 | + sh_dmae_ctl_stop(shdev); | |
594 | 591 | return 0; |
595 | 592 | } |
596 | 593 | |
... | ... | @@ -605,6 +602,9 @@ |
605 | 602 | #ifdef CONFIG_PM_SLEEP |
606 | 603 | static int sh_dmae_suspend(struct device *dev) |
607 | 604 | { |
605 | + struct sh_dmae_device *shdev = dev_get_drvdata(dev); | |
606 | + | |
607 | + sh_dmae_ctl_stop(shdev); | |
608 | 608 | return 0; |
609 | 609 | } |
610 | 610 | |
611 | 611 | |
... | ... | @@ -929,13 +929,12 @@ |
929 | 929 | } |
930 | 930 | |
931 | 931 | static struct platform_driver sh_dmae_driver = { |
932 | - .driver = { | |
932 | + .driver = { | |
933 | 933 | .pm = &sh_dmae_pm, |
934 | 934 | .name = SH_DMAE_DRV_NAME, |
935 | 935 | .of_match_table = sh_dmae_of_match, |
936 | 936 | }, |
937 | 937 | .remove = sh_dmae_remove, |
938 | - .shutdown = sh_dmae_shutdown, | |
939 | 938 | }; |
940 | 939 | |
941 | 940 | static int __init sh_dmae_init(void) |