Skip to content

Commit 36d8cbd

Browse files
committed
Merge branch 'fixes' into next
2 parents 9602a84 + 362f1bf commit 36d8cbd

File tree

12 files changed

+82
-34
lines changed

12 files changed

+82
-34
lines changed

drivers/dma/amd/qdma/qdma.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <linux/bitfield.h>
88
#include <linux/bitops.h>
99
#include <linux/dmaengine.h>
10+
#include <linux/dma-mapping.h>
1011
#include <linux/module.h>
1112
#include <linux/mod_devicetable.h>
12-
#include <linux/dma-map-ops.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/platform_data/amd_qdma.h>
1515
#include <linux/regmap.h>
@@ -496,18 +496,9 @@ static int qdma_device_verify(struct qdma_device *qdev)
496496

497497
static int qdma_device_setup(struct qdma_device *qdev)
498498
{
499-
struct device *dev = &qdev->pdev->dev;
500499
u32 ring_sz = QDMA_DEFAULT_RING_SIZE;
501500
int ret = 0;
502501

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-
511502
ret = qdma_setup_fmap_context(qdev);
512503
if (ret) {
513504
qdma_err(qdev, "Failed setup fmap context");
@@ -552,11 +543,12 @@ static void qdma_free_queue_resources(struct dma_chan *chan)
552543
{
553544
struct qdma_queue *queue = to_qdma_queue(chan);
554545
struct qdma_device *qdev = queue->qdev;
555-
struct device *dev = qdev->dma_dev.dev;
546+
struct qdma_platdata *pdata;
556547

557548
qdma_clear_queue_context(queue);
558549
vchan_free_chan_resources(&queue->vchan);
559-
dma_free_coherent(dev, queue->ring_size * QDMA_MM_DESC_SIZE,
550+
pdata = dev_get_platdata(&qdev->pdev->dev);
551+
dma_free_coherent(pdata->dma_dev, queue->ring_size * QDMA_MM_DESC_SIZE,
560552
queue->desc_base, queue->dma_desc_base);
561553
}
562554

@@ -569,15 +561,17 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
569561
struct qdma_queue *queue = to_qdma_queue(chan);
570562
struct qdma_device *qdev = queue->qdev;
571563
struct qdma_ctxt_sw_desc desc;
564+
struct qdma_platdata *pdata;
572565
size_t size;
573566
int ret;
574567

575568
ret = qdma_clear_queue_context(queue);
576569
if (ret)
577570
return ret;
578571

572+
pdata = dev_get_platdata(&qdev->pdev->dev);
579573
size = queue->ring_size * QDMA_MM_DESC_SIZE;
580-
queue->desc_base = dma_alloc_coherent(qdev->dma_dev.dev, size,
574+
queue->desc_base = dma_alloc_coherent(pdata->dma_dev, size,
581575
&queue->dma_desc_base,
582576
GFP_KERNEL);
583577
if (!queue->desc_base) {
@@ -592,7 +586,7 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
592586
if (ret) {
593587
qdma_err(qdev, "Failed to setup SW desc ctxt for %s",
594588
chan->name);
595-
dma_free_coherent(qdev->dma_dev.dev, size, queue->desc_base,
589+
dma_free_coherent(pdata->dma_dev, size, queue->desc_base,
596590
queue->dma_desc_base);
597591
return ret;
598592
}
@@ -952,8 +946,9 @@ static int qdma_init_error_irq(struct qdma_device *qdev)
952946

953947
static int qdmam_alloc_qintr_rings(struct qdma_device *qdev)
954948
{
955-
u32 ctxt[QDMA_CTXT_REGMAP_LEN];
949+
struct qdma_platdata *pdata = dev_get_platdata(&qdev->pdev->dev);
956950
struct device *dev = &qdev->pdev->dev;
951+
u32 ctxt[QDMA_CTXT_REGMAP_LEN];
957952
struct qdma_intr_ring *ring;
958953
struct qdma_ctxt_intr intr_ctxt;
959954
u32 vector;
@@ -973,7 +968,8 @@ static int qdmam_alloc_qintr_rings(struct qdma_device *qdev)
973968
ring->msix_id = qdev->err_irq_idx + i + 1;
974969
ring->ridx = i;
975970
ring->color = 1;
976-
ring->base = dmam_alloc_coherent(dev, QDMA_INTR_RING_SIZE,
971+
ring->base = dmam_alloc_coherent(pdata->dma_dev,
972+
QDMA_INTR_RING_SIZE,
977973
&ring->dev_base, GFP_KERNEL);
978974
if (!ring->base) {
979975
qdma_err(qdev, "Failed to alloc intr ring %d", i);

drivers/dma/apple-admac.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ static int admac_alloc_sram_carveout(struct admac_data *ad,
153153
{
154154
struct admac_sram *sram;
155155
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);
156158

157159
if (dir == DMA_MEM_TO_DEV)
158160
sram = &ad->txcache;
@@ -912,12 +914,7 @@ static int admac_probe(struct platform_device *pdev)
912914
goto free_irq;
913915
}
914916

915-
ad->txcache.size = readl_relaxed(ad->base + REG_TX_SRAM_SIZE);
916-
ad->rxcache.size = readl_relaxed(ad->base + REG_RX_SRAM_SIZE);
917-
918917
dev_info(&pdev->dev, "Audio DMA Controller\n");
919-
dev_info(&pdev->dev, "imprint %x TX cache %u RX cache %u\n",
920-
readl_relaxed(ad->base + REG_IMPRINT), ad->txcache.size, ad->rxcache.size);
921918

922919
return 0;
923920

drivers/dma/at_xdmac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,8 @@ at_xdmac_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
13631363
return NULL;
13641364

13651365
desc = at_xdmac_memset_create_desc(chan, atchan, dest, len, value);
1366+
if (!desc)
1367+
return NULL;
13661368
list_add_tail(&desc->desc_node, &desc->descs_list);
13671369

13681370
desc->tx_dma_desc.cookie = -EBUSY;

drivers/dma/dw/acpi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
1010
{
11+
struct dw_dma *dw = to_dw_dma(chan->device);
12+
struct dw_dma_chip_pdata *data = dev_get_drvdata(dw->dma.dev);
1113
struct acpi_dma_spec *dma_spec = param;
1214
struct dw_dma_slave slave = {
1315
.dma_dev = dma_spec->dev,
1416
.src_id = dma_spec->slave_id,
1517
.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,
1820
};
1921

2022
return dw_dma_filter(chan, &slave);

drivers/dma/dw/internal.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ struct dw_dma_chip_pdata {
5151
int (*probe)(struct dw_dma_chip *chip);
5252
int (*remove)(struct dw_dma_chip *chip);
5353
struct dw_dma_chip *chip;
54+
u8 m_master;
55+
u8 p_master;
5456
};
5557

5658
static __maybe_unused const struct dw_dma_chip_pdata dw_dma_chip_pdata = {
5759
.probe = dw_dma_probe,
5860
.remove = dw_dma_remove,
61+
.m_master = 0,
62+
.p_master = 1,
5963
};
6064

6165
static const struct dw_dma_platform_data idma32_pdata = {
@@ -72,6 +76,8 @@ static __maybe_unused const struct dw_dma_chip_pdata idma32_chip_pdata = {
7276
.pdata = &idma32_pdata,
7377
.probe = idma32_dma_probe,
7478
.remove = idma32_dma_remove,
79+
.m_master = 0,
80+
.p_master = 0,
7581
};
7682

7783
static const struct dw_dma_platform_data xbar_pdata = {
@@ -88,6 +94,8 @@ static __maybe_unused const struct dw_dma_chip_pdata xbar_chip_pdata = {
8894
.pdata = &xbar_pdata,
8995
.probe = idma32_dma_probe,
9096
.remove = idma32_dma_remove,
97+
.m_master = 0,
98+
.p_master = 0,
9199
};
92100

93101
#endif /* _DMA_DW_INTERNAL_H */

drivers/dma/dw/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
5656
if (ret)
5757
return ret;
5858

59-
dw_dma_acpi_controller_register(chip->dw);
60-
6159
pci_set_drvdata(pdev, data);
6260

61+
dw_dma_acpi_controller_register(chip->dw);
62+
6363
return 0;
6464
}
6565

drivers/dma/fsl-edma-common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct fsl_edma_chan {
168168
struct work_struct issue_worker;
169169
struct platform_device *pdev;
170170
struct device *pd_dev;
171+
struct device_link *pd_dev_link;
171172
u32 srcid;
172173
struct clk *clk;
173174
int priority;

drivers/dma/fsl-edma-main.c

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,33 @@ static const struct of_device_id fsl_edma_dt_ids[] = {
524524
};
525525
MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids);
526526

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+
527551
static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma)
528552
{
529553
struct fsl_edma_chan *fsl_chan;
530-
struct device_link *link;
531554
struct device *pd_chan;
532555
struct device *dev;
533556
int i;
@@ -543,15 +566,16 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng
543566
pd_chan = dev_pm_domain_attach_by_id(dev, i);
544567
if (IS_ERR_OR_NULL(pd_chan)) {
545568
dev_err(dev, "Failed attach pd %d\n", i);
546-
return -EINVAL;
569+
goto detach;
547570
}
548571

549-
link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS |
572+
fsl_chan->pd_dev_link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS |
550573
DL_FLAG_PM_RUNTIME |
551574
DL_FLAG_RPM_ACTIVE);
552-
if (!link) {
575+
if (!fsl_chan->pd_dev_link) {
553576
dev_err(dev, "Failed to add device_link to %d\n", i);
554-
return -EINVAL;
577+
dev_pm_domain_detach(pd_chan, false);
578+
goto detach;
555579
}
556580

557581
fsl_chan->pd_dev = pd_chan;
@@ -562,6 +586,10 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng
562586
}
563587

564588
return 0;
589+
590+
detach:
591+
fsl_edma3_detach_pd(fsl_edma);
592+
return -EINVAL;
565593
}
566594

567595
static int fsl_edma_probe(struct platform_device *pdev)
@@ -647,6 +675,9 @@ static int fsl_edma_probe(struct platform_device *pdev)
647675
ret = fsl_edma3_attach_pd(pdev, fsl_edma);
648676
if (ret)
649677
return ret;
678+
ret = devm_add_action_or_reset(&pdev->dev, devm_fsl_edma3_detach_pd, fsl_edma);
679+
if (ret)
680+
return ret;
650681
}
651682

652683
if (drvdata->flags & FSL_EDMA_DRV_TCD64)

drivers/dma/loongson2-apb-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define LDMA_ASK_VALID BIT(2)
3232
#define LDMA_START BIT(3) /* DMA start operation */
3333
#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 */
3535

3636
/* Bitfields in ndesc_addr field of HW descriptor */
3737
#define LDMA_DESC_EN BIT(0) /*1: The next descriptor is valid */

drivers/dma/mv_xor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,7 @@ static int mv_xor_probe(struct platform_device *pdev)
13881388
irq = irq_of_parse_and_map(np, 0);
13891389
if (!irq) {
13901390
ret = -ENODEV;
1391+
of_node_put(np);
13911392
goto err_channel_add;
13921393
}
13931394

@@ -1396,6 +1397,7 @@ static int mv_xor_probe(struct platform_device *pdev)
13961397
if (IS_ERR(chan)) {
13971398
ret = PTR_ERR(chan);
13981399
irq_dispose_mapping(irq);
1400+
of_node_put(np);
13991401
goto err_channel_add;
14001402
}
14011403

0 commit comments

Comments
 (0)