summaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2015-01-27 12:04:10 -0500
committerVinod Koul <vinod.koul@intel.com>2015-02-15 23:03:35 -0500
commitbe6893e1958035cbeff281b833777c5cd3fb36ad (patch)
tree093195bbad635531be5814a8d3403aef0d557865 /drivers/dma
parent3f46306127bb7d8a69078ff9ef8a5827677c2159 (diff)
dmaengine: rcar-dmac: Disable channel 0 when using IOMMU
A still unconfirmed hardware bug prevents the IPMMU microTLB 0 to be flushed correctly, resulting in memory corruption. DMAC 0 channel 0 is connected to microTLB 0 on currently supported platforms, so we can't use it with the IPMMU. As the IOMMU API operates at the device level we can't disable it selectively, so ignore channel 0 for now if the device is part of an IOMMU group. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sh/rcar-dmac.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 711da01a200b..a18d16cc4795 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1593,6 +1593,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
1593 DMA_SLAVE_BUSWIDTH_2_BYTES | DMA_SLAVE_BUSWIDTH_4_BYTES | 1593 DMA_SLAVE_BUSWIDTH_2_BYTES | DMA_SLAVE_BUSWIDTH_4_BYTES |
1594 DMA_SLAVE_BUSWIDTH_8_BYTES | DMA_SLAVE_BUSWIDTH_16_BYTES | 1594 DMA_SLAVE_BUSWIDTH_8_BYTES | DMA_SLAVE_BUSWIDTH_16_BYTES |
1595 DMA_SLAVE_BUSWIDTH_32_BYTES | DMA_SLAVE_BUSWIDTH_64_BYTES; 1595 DMA_SLAVE_BUSWIDTH_32_BYTES | DMA_SLAVE_BUSWIDTH_64_BYTES;
1596 unsigned int channels_offset = 0;
1596 struct dma_device *engine; 1597 struct dma_device *engine;
1597 struct rcar_dmac *dmac; 1598 struct rcar_dmac *dmac;
1598 struct resource *mem; 1599 struct resource *mem;
@@ -1612,6 +1613,19 @@ static int rcar_dmac_probe(struct platform_device *pdev)
1612 if (ret < 0) 1613 if (ret < 0)
1613 return ret; 1614 return ret;
1614 1615
1616 /*
1617 * A still unconfirmed hardware bug prevents the IPMMU microTLB 0 to be
1618 * flushed correctly, resulting in memory corruption. DMAC 0 channel 0
1619 * is connected to microTLB 0 on currently supported platforms, so we
1620 * can't use it with the IPMMU. As the IOMMU API operates at the device
1621 * level we can't disable it selectively, so ignore channel 0 for now if
1622 * the device is part of an IOMMU group.
1623 */
1624 if (pdev->dev.iommu_group) {
1625 dmac->n_channels--;
1626 channels_offset = 1;
1627 }
1628
1615 dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels, 1629 dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels,
1616 sizeof(*dmac->channels), GFP_KERNEL); 1630 sizeof(*dmac->channels), GFP_KERNEL);
1617 if (!dmac->channels) 1631 if (!dmac->channels)
@@ -1662,7 +1676,8 @@ static int rcar_dmac_probe(struct platform_device *pdev)
1662 INIT_LIST_HEAD(&dmac->engine.channels); 1676 INIT_LIST_HEAD(&dmac->engine.channels);
1663 1677
1664 for (i = 0; i < dmac->n_channels; ++i) { 1678 for (i = 0; i < dmac->n_channels; ++i) {
1665 ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i], i); 1679 ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i],
1680 i + channels_offset);
1666 if (ret < 0) 1681 if (ret < 0)
1667 goto error; 1682 goto error;
1668 } 1683 }