Skip to content

Commit 055128e

Browse files
committed
Merge tag 'dmaengine-5.2-rc1' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine updates from Vinod Koul: - Updates to stm32 dma residue calculations - Interleave dma capability to axi-dmac and support for ZynqMP arch - Rework of channel assignment for rcar dma - Debugfs for pl330 driver - Support for Tegra186/Tegra194, refactoring for new chips and support for pause/resume - Updates to axi-dmac, bcm2835, fsl-edma, idma64, imx-sdma, rcar-dmac, stm32-dma etc - dev_get_drvdata() updates on few drivers * tag 'dmaengine-5.2-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (34 commits) dmaengine: tegra210-adma: restore channel status dmaengine: tegra210-dma: free dma controller in remove() dmaengine: tegra210-adma: add pause/resume support dmaengine: tegra210-adma: add support for Tegra186/Tegra194 Documentation: DT: Add compatibility binding for Tegra186 dmaengine: tegra210-adma: prepare for supporting newer Tegra chips dmaengine: at_xdmac: remove a stray bottom half unlock dmaengine: fsl-edma: Adjust indentation dmaengine: fsl-edma: Fix typo in Vybrid name dmaengine: stm32-dma: fix residue calculation in stm32-dma dmaengine: nbpfaxi: Use dev_get_drvdata() dmaengine: bcm-sba-raid: Use dev_get_drvdata() dmaengine: stm32-dma: Fix unsigned variable compared with zero dmaengine: stm32-dma: use platform_get_irq() dmaengine: rcar-dmac: Update copyright information dmaengine: imx-sdma: Only check ratio on parts that support 1:1 dmaengine: xgene-dma: fix spelling mistake "descripto" -> "descriptor" dmaengine: idma64: Move driver name to the header dmaengine: bcm2835: Drop duplicate capability setting. dmaengine: pl330: _stop: clear interrupt status ...
2 parents ddab533 + f33e7bb commit 055128e

23 files changed

Lines changed: 566 additions & 169 deletions

‎Documentation/devicetree/bindings/dma/adi,axi-dmac.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Required properties for adi,channels sub-node:
1818

1919
Required channel sub-node properties:
2020
- reg: Which channel this node refers to.
21-
- adi,length-width: Width of the DMA transfer length register.
2221
- adi,source-bus-width,
2322
adi,destination-bus-width: Width of the source or destination bus in bits.
2423
- adi,source-bus-type,
@@ -28,7 +27,8 @@ Required channel sub-node properties:
2827
1 (AXI_DMAC_TYPE_AXI_STREAM): Streaming AXI interface
2928
2 (AXI_DMAC_TYPE_AXI_FIFO): FIFO interface
3029

31-
Optional channel properties:
30+
Deprecated optional channel properties:
31+
- adi,length-width: Width of the DMA transfer length register.
3232
- adi,cyclic: Must be set if the channel supports hardware cyclic DMA
3333
transfers.
3434
- adi,2d: Must be set if the channel supports hardware 2D DMA transfers.

‎Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ The Tegra Audio DMA controller that is used for transferring data
44
between system memory and the Audio Processing Engine (APE).
55

66
Required properties:
7-
- compatible: Must be "nvidia,tegra210-adma".
7+
- compatible: Should contain one of the following:
8+
- "nvidia,tegra210-adma": for Tegra210
9+
- "nvidia,tegra186-adma": for Tegra186 and Tegra194
810
- reg: Should contain DMA registers location and length. This should be
911
a single entry that includes all of the per-channel registers in one
1012
contiguous bank.

‎drivers/dma/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ config AT_XDMAC
9999

100100
config AXI_DMAC
101101
tristate "Analog Devices AXI-DMAC DMA support"
102-
depends on MICROBLAZE || NIOS2 || ARCH_ZYNQ || ARCH_SOCFPGA || COMPILE_TEST
102+
depends on MICROBLAZE || NIOS2 || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_SOCFPGA || COMPILE_TEST
103103
select DMA_ENGINE
104104
select DMA_VIRTUAL_CHANNELS
105105
help

‎drivers/dma/amba-pl08x.c‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ enum pl08x_dma_chan_state {
254254
* @slave: whether this channel is a device (slave) or for memcpy
255255
* @signal: the physical DMA request signal which this channel is using
256256
* @mux_use: count of descriptors using this DMA request signal setting
257+
* @waiting_at: time in jiffies when this channel moved to waiting state
257258
*/
258259
struct pl08x_dma_chan {
259260
struct virt_dma_chan vc;
@@ -267,6 +268,7 @@ struct pl08x_dma_chan {
267268
bool slave;
268269
int signal;
269270
unsigned mux_use;
271+
unsigned long waiting_at;
270272
};
271273

272274
/**
@@ -875,6 +877,7 @@ static void pl08x_phy_alloc_and_start(struct pl08x_dma_chan *plchan)
875877
if (!ch) {
876878
dev_dbg(&pl08x->adev->dev, "no physical channel available for xfer on %s\n", plchan->name);
877879
plchan->state = PL08X_CHAN_WAITING;
880+
plchan->waiting_at = jiffies;
878881
return;
879882
}
880883

@@ -913,22 +916,29 @@ static void pl08x_phy_free(struct pl08x_dma_chan *plchan)
913916
{
914917
struct pl08x_driver_data *pl08x = plchan->host;
915918
struct pl08x_dma_chan *p, *next;
916-
919+
unsigned long waiting_at;
917920
retry:
918921
next = NULL;
922+
waiting_at = jiffies;
919923

920-
/* Find a waiting virtual channel for the next transfer. */
924+
/*
925+
* Find a waiting virtual channel for the next transfer.
926+
* To be fair, time when each channel reached waiting state is compared
927+
* to select channel that is waiting for the longest time.
928+
*/
921929
list_for_each_entry(p, &pl08x->memcpy.channels, vc.chan.device_node)
922-
if (p->state == PL08X_CHAN_WAITING) {
930+
if (p->state == PL08X_CHAN_WAITING &&
931+
p->waiting_at <= waiting_at) {
923932
next = p;
924-
break;
933+
waiting_at = p->waiting_at;
925934
}
926935

927936
if (!next && pl08x->has_slave) {
928937
list_for_each_entry(p, &pl08x->slave.channels, vc.chan.device_node)
929-
if (p->state == PL08X_CHAN_WAITING) {
938+
if (p->state == PL08X_CHAN_WAITING &&
939+
p->waiting_at <= waiting_at) {
930940
next = p;
931-
break;
941+
waiting_at = p->waiting_at;
932942
}
933943
}
934944

‎drivers/dma/at_xdmac.c‎

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ static inline int at_xdmac_csize(u32 maxburst)
308308
return csize;
309309
};
310310

311+
static inline bool at_xdmac_chan_is_peripheral_xfer(u32 cfg)
312+
{
313+
return cfg & AT_XDMAC_CC_TYPE_PER_TRAN;
314+
}
315+
311316
static inline u8 at_xdmac_get_dwidth(u32 cfg)
312317
{
313318
return (cfg & AT_XDMAC_CC_DWIDTH_MASK) >> AT_XDMAC_CC_DWIDTH_OFFSET;
@@ -389,7 +394,13 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan,
389394
at_xdmac_chan_read(atchan, AT_XDMAC_CUBC));
390395

391396
at_xdmac_chan_write(atchan, AT_XDMAC_CID, 0xffffffff);
392-
reg = AT_XDMAC_CIE_RBEIE | AT_XDMAC_CIE_WBEIE | AT_XDMAC_CIE_ROIE;
397+
reg = AT_XDMAC_CIE_RBEIE | AT_XDMAC_CIE_WBEIE;
398+
/*
399+
* Request Overflow Error is only for peripheral synchronized transfers
400+
*/
401+
if (at_xdmac_chan_is_peripheral_xfer(first->lld.mbr_cfg))
402+
reg |= AT_XDMAC_CIE_ROIE;
403+
393404
/*
394405
* There is no end of list when doing cyclic dma, we need to get
395406
* an interrupt after each periods.
@@ -1575,6 +1586,46 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan)
15751586
dmaengine_desc_get_callback_invoke(txd, NULL);
15761587
}
15771588

1589+
static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
1590+
{
1591+
struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device);
1592+
struct at_xdmac_desc *bad_desc;
1593+
1594+
/*
1595+
* The descriptor currently at the head of the active list is
1596+
* broken. Since we don't have any way to report errors, we'll
1597+
* just have to scream loudly and try to continue with other
1598+
* descriptors queued (if any).
1599+
*/
1600+
if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
1601+
dev_err(chan2dev(&atchan->chan), "read bus error!!!");
1602+
if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
1603+
dev_err(chan2dev(&atchan->chan), "write bus error!!!");
1604+
if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
1605+
dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
1606+
1607+
spin_lock_bh(&atchan->lock);
1608+
1609+
/* Channel must be disabled first as it's not done automatically */
1610+
at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
1611+
while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
1612+
cpu_relax();
1613+
1614+
bad_desc = list_first_entry(&atchan->xfers_list,
1615+
struct at_xdmac_desc,
1616+
xfer_node);
1617+
1618+
spin_unlock_bh(&atchan->lock);
1619+
1620+
/* Print bad descriptor's details if needed */
1621+
dev_dbg(chan2dev(&atchan->chan),
1622+
"%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
1623+
__func__, &bad_desc->lld.mbr_sa, &bad_desc->lld.mbr_da,
1624+
bad_desc->lld.mbr_ubc);
1625+
1626+
/* Then continue with usual descriptor management */
1627+
}
1628+
15781629
static void at_xdmac_tasklet(unsigned long data)
15791630
{
15801631
struct at_xdmac_chan *atchan = (struct at_xdmac_chan *)data;
@@ -1594,19 +1645,19 @@ static void at_xdmac_tasklet(unsigned long data)
15941645
|| (atchan->irq_status & error_mask)) {
15951646
struct dma_async_tx_descriptor *txd;
15961647

1597-
if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
1598-
dev_err(chan2dev(&atchan->chan), "read bus error!!!");
1599-
if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
1600-
dev_err(chan2dev(&atchan->chan), "write bus error!!!");
1601-
if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
1602-
dev_err(chan2dev(&atchan->chan), "request overflow error!!!");
1648+
if (atchan->irq_status & error_mask)
1649+
at_xdmac_handle_error(atchan);
16031650

16041651
spin_lock(&atchan->lock);
16051652
desc = list_first_entry(&atchan->xfers_list,
16061653
struct at_xdmac_desc,
16071654
xfer_node);
16081655
dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc);
1609-
BUG_ON(!desc->active_xfer);
1656+
if (!desc->active_xfer) {
1657+
dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting");
1658+
spin_unlock(&atchan->lock);
1659+
return;
1660+
}
16101661

16111662
txd = &desc->tx_dma_desc;
16121663

‎drivers/dma/bcm-sba-raid.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,8 +1459,7 @@ static void sba_receive_message(struct mbox_client *cl, void *msg)
14591459

14601460
static int sba_debugfs_stats_show(struct seq_file *file, void *offset)
14611461
{
1462-
struct platform_device *pdev = to_platform_device(file->private);
1463-
struct sba_device *sba = platform_get_drvdata(pdev);
1462+
struct sba_device *sba = dev_get_drvdata(file->private);
14641463

14651464
/* Write stats in file */
14661465
sba_write_stats_in_seqfile(sba, file);

‎drivers/dma/bcm2835-dma.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,6 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
891891
dma_cap_set(DMA_SLAVE, od->ddev.cap_mask);
892892
dma_cap_set(DMA_PRIVATE, od->ddev.cap_mask);
893893
dma_cap_set(DMA_CYCLIC, od->ddev.cap_mask);
894-
dma_cap_set(DMA_SLAVE, od->ddev.cap_mask);
895894
dma_cap_set(DMA_MEMCPY, od->ddev.cap_mask);
896895
od->ddev.device_alloc_chan_resources = bcm2835_dma_alloc_chan_resources;
897896
od->ddev.device_free_chan_resources = bcm2835_dma_free_chan_resources;

0 commit comments

Comments
 (0)