Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'fixes' into next

+82 -34
+12 -16
drivers/dma/amd/qdma/qdma.c
··· 7 7 #include <linux/bitfield.h> 8 8 #include <linux/bitops.h> 9 9 #include <linux/dmaengine.h> 10 + #include <linux/dma-mapping.h> 10 11 #include <linux/module.h> 11 12 #include <linux/mod_devicetable.h> 12 - #include <linux/dma-map-ops.h> 13 13 #include <linux/platform_device.h> 14 14 #include <linux/platform_data/amd_qdma.h> 15 15 #include <linux/regmap.h> ··· 496 496 497 497 static int qdma_device_setup(struct qdma_device *qdev) 498 498 { 499 - struct device *dev = &qdev->pdev->dev; 500 499 u32 ring_sz = QDMA_DEFAULT_RING_SIZE; 501 500 int ret = 0; 502 - 503 - while (dev && get_dma_ops(dev)) 504 - dev = dev->parent; 505 - if (!dev) { 506 - qdma_err(qdev, "dma device not found"); 507 - return -EINVAL; 508 - } 509 - set_dma_ops(&qdev->pdev->dev, get_dma_ops(dev)); 510 501 511 502 ret = qdma_setup_fmap_context(qdev); 512 503 if (ret) { ··· 543 552 { 544 553 struct qdma_queue *queue = to_qdma_queue(chan); 545 554 struct qdma_device *qdev = queue->qdev; 546 - struct device *dev = qdev->dma_dev.dev; 555 + struct qdma_platdata *pdata; 547 556 548 557 qdma_clear_queue_context(queue); 549 558 vchan_free_chan_resources(&queue->vchan); 550 - dma_free_coherent(dev, queue->ring_size * QDMA_MM_DESC_SIZE, 559 + pdata = dev_get_platdata(&qdev->pdev->dev); 560 + dma_free_coherent(pdata->dma_dev, queue->ring_size * QDMA_MM_DESC_SIZE, 551 561 queue->desc_base, queue->dma_desc_base); 552 562 } 553 563 ··· 561 569 struct qdma_queue *queue = to_qdma_queue(chan); 562 570 struct qdma_device *qdev = queue->qdev; 563 571 struct qdma_ctxt_sw_desc desc; 572 + struct qdma_platdata *pdata; 564 573 size_t size; 565 574 int ret; 566 575 ··· 569 576 if (ret) 570 577 return ret; 571 578 579 + pdata = dev_get_platdata(&qdev->pdev->dev); 572 580 size = queue->ring_size * QDMA_MM_DESC_SIZE; 573 - queue->desc_base = dma_alloc_coherent(qdev->dma_dev.dev, size, 581 + queue->desc_base = dma_alloc_coherent(pdata->dma_dev, size, 574 582 &queue->dma_desc_base, 575 583 GFP_KERNEL); 576 584 if (!queue->desc_base) { ··· 586 592 if (ret) { 587 593 qdma_err(qdev, "Failed to setup SW desc ctxt for %s", 588 594 chan->name); 589 - dma_free_coherent(qdev->dma_dev.dev, size, queue->desc_base, 595 + dma_free_coherent(pdata->dma_dev, size, queue->desc_base, 590 596 queue->dma_desc_base); 591 597 return ret; 592 598 } ··· 946 952 947 953 static int qdmam_alloc_qintr_rings(struct qdma_device *qdev) 948 954 { 949 - u32 ctxt[QDMA_CTXT_REGMAP_LEN]; 955 + struct qdma_platdata *pdata = dev_get_platdata(&qdev->pdev->dev); 950 956 struct device *dev = &qdev->pdev->dev; 957 + u32 ctxt[QDMA_CTXT_REGMAP_LEN]; 951 958 struct qdma_intr_ring *ring; 952 959 struct qdma_ctxt_intr intr_ctxt; 953 960 u32 vector; ··· 968 973 ring->msix_id = qdev->err_irq_idx + i + 1; 969 974 ring->ridx = i; 970 975 ring->color = 1; 971 - ring->base = dmam_alloc_coherent(dev, QDMA_INTR_RING_SIZE, 976 + ring->base = dmam_alloc_coherent(pdata->dma_dev, 977 + QDMA_INTR_RING_SIZE, 972 978 &ring->dev_base, GFP_KERNEL); 973 979 if (!ring->base) { 974 980 qdma_err(qdev, "Failed to alloc intr ring %d", i);
+2 -5
drivers/dma/apple-admac.c
··· 153 153 { 154 154 struct admac_sram *sram; 155 155 int i, ret = 0, nblocks; 156 + ad->txcache.size = readl_relaxed(ad->base + REG_TX_SRAM_SIZE); 157 + ad->rxcache.size = readl_relaxed(ad->base + REG_RX_SRAM_SIZE); 156 158 157 159 if (dir == DMA_MEM_TO_DEV) 158 160 sram = &ad->txcache; ··· 914 912 goto free_irq; 915 913 } 916 914 917 - ad->txcache.size = readl_relaxed(ad->base + REG_TX_SRAM_SIZE); 918 - ad->rxcache.size = readl_relaxed(ad->base + REG_RX_SRAM_SIZE); 919 - 920 915 dev_info(&pdev->dev, "Audio DMA Controller\n"); 921 - dev_info(&pdev->dev, "imprint %x TX cache %u RX cache %u\n", 922 - readl_relaxed(ad->base + REG_IMPRINT), ad->txcache.size, ad->rxcache.size); 923 916 924 917 return 0; 925 918
+2
drivers/dma/at_xdmac.c
··· 1363 1363 return NULL; 1364 1364 1365 1365 desc = at_xdmac_memset_create_desc(chan, atchan, dest, len, value); 1366 + if (!desc) 1367 + return NULL; 1366 1368 list_add_tail(&desc->desc_node, &desc->descs_list); 1367 1369 1368 1370 desc->tx_dma_desc.cookie = -EBUSY;
+4 -2
drivers/dma/dw/acpi.c
··· 8 8 9 9 static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param) 10 10 { 11 + struct dw_dma *dw = to_dw_dma(chan->device); 12 + struct dw_dma_chip_pdata *data = dev_get_drvdata(dw->dma.dev); 11 13 struct acpi_dma_spec *dma_spec = param; 12 14 struct dw_dma_slave slave = { 13 15 .dma_dev = dma_spec->dev, 14 16 .src_id = dma_spec->slave_id, 15 17 .dst_id = dma_spec->slave_id, 16 - .m_master = 0, 17 - .p_master = 1, 18 + .m_master = data->m_master, 19 + .p_master = data->p_master, 18 20 }; 19 21 20 22 return dw_dma_filter(chan, &slave);
+8
drivers/dma/dw/internal.h
··· 51 51 int (*probe)(struct dw_dma_chip *chip); 52 52 int (*remove)(struct dw_dma_chip *chip); 53 53 struct dw_dma_chip *chip; 54 + u8 m_master; 55 + u8 p_master; 54 56 }; 55 57 56 58 static __maybe_unused const struct dw_dma_chip_pdata dw_dma_chip_pdata = { 57 59 .probe = dw_dma_probe, 58 60 .remove = dw_dma_remove, 61 + .m_master = 0, 62 + .p_master = 1, 59 63 }; 60 64 61 65 static const struct dw_dma_platform_data idma32_pdata = { ··· 76 72 .pdata = &idma32_pdata, 77 73 .probe = idma32_dma_probe, 78 74 .remove = idma32_dma_remove, 75 + .m_master = 0, 76 + .p_master = 0, 79 77 }; 80 78 81 79 static const struct dw_dma_platform_data xbar_pdata = { ··· 94 88 .pdata = &xbar_pdata, 95 89 .probe = idma32_dma_probe, 96 90 .remove = idma32_dma_remove, 91 + .m_master = 0, 92 + .p_master = 0, 97 93 }; 98 94 99 95 #endif /* _DMA_DW_INTERNAL_H */
+2 -2
drivers/dma/dw/pci.c
··· 56 56 if (ret) 57 57 return ret; 58 58 59 - dw_dma_acpi_controller_register(chip->dw); 60 - 61 59 pci_set_drvdata(pdev, data); 60 + 61 + dw_dma_acpi_controller_register(chip->dw); 62 62 63 63 return 0; 64 64 }
+1
drivers/dma/fsl-edma-common.h
··· 168 168 struct work_struct issue_worker; 169 169 struct platform_device *pdev; 170 170 struct device *pd_dev; 171 + struct device_link *pd_dev_link; 171 172 u32 srcid; 172 173 struct clk *clk; 173 174 int priority;
+36 -5
drivers/dma/fsl-edma-main.c
··· 524 524 }; 525 525 MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids); 526 526 527 + static void fsl_edma3_detach_pd(struct fsl_edma_engine *fsl_edma) 528 + { 529 + struct fsl_edma_chan *fsl_chan; 530 + int i; 531 + 532 + for (i = 0; i < fsl_edma->n_chans; i++) { 533 + if (fsl_edma->chan_masked & BIT(i)) 534 + continue; 535 + fsl_chan = &fsl_edma->chans[i]; 536 + if (fsl_chan->pd_dev_link) 537 + device_link_del(fsl_chan->pd_dev_link); 538 + if (fsl_chan->pd_dev) { 539 + dev_pm_domain_detach(fsl_chan->pd_dev, false); 540 + pm_runtime_dont_use_autosuspend(fsl_chan->pd_dev); 541 + pm_runtime_set_suspended(fsl_chan->pd_dev); 542 + } 543 + } 544 + } 545 + 546 + static void devm_fsl_edma3_detach_pd(void *data) 547 + { 548 + fsl_edma3_detach_pd(data); 549 + } 550 + 527 551 static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) 528 552 { 529 553 struct fsl_edma_chan *fsl_chan; 530 - struct device_link *link; 531 554 struct device *pd_chan; 532 555 struct device *dev; 533 556 int i; ··· 566 543 pd_chan = dev_pm_domain_attach_by_id(dev, i); 567 544 if (IS_ERR_OR_NULL(pd_chan)) { 568 545 dev_err(dev, "Failed attach pd %d\n", i); 569 - return -EINVAL; 546 + goto detach; 570 547 } 571 548 572 - link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | 549 + fsl_chan->pd_dev_link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | 573 550 DL_FLAG_PM_RUNTIME | 574 551 DL_FLAG_RPM_ACTIVE); 575 - if (!link) { 552 + if (!fsl_chan->pd_dev_link) { 576 553 dev_err(dev, "Failed to add device_link to %d\n", i); 577 - return -EINVAL; 554 + dev_pm_domain_detach(pd_chan, false); 555 + goto detach; 578 556 } 579 557 580 558 fsl_chan->pd_dev = pd_chan; ··· 586 562 } 587 563 588 564 return 0; 565 + 566 + detach: 567 + fsl_edma3_detach_pd(fsl_edma); 568 + return -EINVAL; 589 569 } 590 570 591 571 static int fsl_edma_probe(struct platform_device *pdev) ··· 673 645 674 646 if (drvdata->flags & FSL_EDMA_DRV_HAS_PD) { 675 647 ret = fsl_edma3_attach_pd(pdev, fsl_edma); 648 + if (ret) 649 + return ret; 650 + ret = devm_add_action_or_reset(&pdev->dev, devm_fsl_edma3_detach_pd, fsl_edma); 676 651 if (ret) 677 652 return ret; 678 653 }
+1 -1
drivers/dma/loongson2-apb-dma.c
··· 31 31 #define LDMA_ASK_VALID BIT(2) 32 32 #define LDMA_START BIT(3) /* DMA start operation */ 33 33 #define LDMA_STOP BIT(4) /* DMA stop operation */ 34 - #define LDMA_CONFIG_MASK GENMASK(4, 0) /* DMA controller config bits mask */ 34 + #define LDMA_CONFIG_MASK GENMASK_ULL(4, 0) /* DMA controller config bits mask */ 35 35 36 36 /* Bitfields in ndesc_addr field of HW descriptor */ 37 37 #define LDMA_DESC_EN BIT(0) /*1: The next descriptor is valid */
+2
drivers/dma/mv_xor.c
··· 1388 1388 irq = irq_of_parse_and_map(np, 0); 1389 1389 if (!irq) { 1390 1390 ret = -ENODEV; 1391 + of_node_put(np); 1391 1392 goto err_channel_add; 1392 1393 } 1393 1394 ··· 1397 1396 if (IS_ERR(chan)) { 1398 1397 ret = PTR_ERR(chan); 1399 1398 irq_dispose_mapping(irq); 1399 + of_node_put(np); 1400 1400 goto err_channel_add; 1401 1401 } 1402 1402
+10 -3
include/linux/dmaengine.h
··· 84 84 DMA_TRANS_NONE, 85 85 }; 86 86 87 - /** 87 + /* 88 88 * Interleaved Transfer Request 89 89 * ---------------------------- 90 90 * A chunk is collection of contiguous bytes to be transferred. ··· 223 223 }; 224 224 225 225 /** 226 - * enum pq_check_flags - result of async_{xor,pq}_zero_sum operations 226 + * enum sum_check_flags - result of async_{xor,pq}_zero_sum operations 227 227 * @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise 228 228 * @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise 229 229 */ ··· 286 286 * pointer to the engine's metadata area 287 287 * 4. Read out the metadata from the pointer 288 288 * 289 - * Note: the two mode is not compatible and clients must use one mode for a 289 + * Warning: the two modes are not compatible and clients must use one mode for a 290 290 * descriptor. 291 291 */ 292 292 enum dma_desc_metadata_mode { ··· 594 594 * @phys: physical address of the descriptor 595 595 * @chan: target channel for this operation 596 596 * @tx_submit: accept the descriptor, assign ordered cookie and mark the 597 + * @desc_free: driver's callback function to free a resusable descriptor 598 + * after completion 597 599 * descriptor pending. To be pushed on .issue_pending() call 598 600 * @callback: routine to call after this operation is complete 601 + * @callback_result: error result from a DMA transaction 599 602 * @callback_param: general parameter to pass to the callback routine 603 + * @unmap: hook for generic DMA unmap data 600 604 * @desc_metadata_mode: core managed metadata mode to protect mixed use of 601 605 * DESC_METADATA_CLIENT or DESC_METADATA_ENGINE. Otherwise 602 606 * DESC_METADATA_NONE ··· 831 827 * @device_prep_dma_memset: prepares a memset operation 832 828 * @device_prep_dma_memset_sg: prepares a memset operation over a scatter list 833 829 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 830 + * @device_prep_peripheral_dma_vec: prepares a scatter-gather DMA transfer, 831 + * where the address and size of each segment is located in one entry of 832 + * the dma_vec array. 834 833 * @device_prep_slave_sg: prepares a slave dma operation 835 834 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio. 836 835 * The function takes a buffer of size buf_len. The callback function will
+2
include/linux/platform_data/amd_qdma.h
··· 26 26 * @max_mm_channels: Maximum number of MM DMA channels in each direction 27 27 * @device_map: DMA slave map 28 28 * @irq_index: The index of first IRQ 29 + * @dma_dev: The device pointer for dma operations 29 30 */ 30 31 struct qdma_platdata { 31 32 u32 max_mm_channels; 32 33 u32 irq_index; 33 34 struct dma_slave_map *device_map; 35 + struct device *dma_dev; 34 36 }; 35 37 36 38 #endif /* _PLATDATA_AMD_QDMA_H */