From de1a2419592d488a8e80bcc396c2be8ce06b71c3 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 27 Jun 2013 10:29:32 +0100 Subject: DMA-API: dma: pl08x: add dma_set_mask_and_coherent() call The DMA API requires drivers to call the appropriate dma_set_mask() functions before doing any DMA mapping. Add this required call to the AMBA PL08x driver. Acked-by: Vinod Koul Signed-off-by: Russell King --- drivers/dma/amba-pl08x.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/dma') diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index fce46c5bf1c7..e51a9832ef0d 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -2055,6 +2055,11 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) if (ret) return ret; + /* Ensure that we can do DMA */ + ret = dma_set_mask_and_coherent(&adev->dev, DMA_BIT_MASK(32)); + if (ret) + goto out_no_pl08x; + /* Create the driver state holder */ pl08x = kzalloc(sizeof(*pl08x), GFP_KERNEL); if (!pl08x) { -- cgit v1.2.3 From 64113016a456399d3fe4849a4f6593fb1cd48f53 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 27 Jun 2013 10:29:32 +0100 Subject: DMA-API: dma: pl330: add dma_set_mask_and_coherent() call The DMA API requires drivers to call the appropriate dma_set_mask() functions before doing any DMA mapping. Add this required call to the AMBA PL330 driver. Acked-by: Vinod Koul Signed-off-by: Russell King --- drivers/dma/pl330.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/dma') diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index a562d24d20bf..df8b10fd1726 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2903,6 +2903,10 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pdat = dev_get_platdata(&adev->dev); + ret = dma_set_mask_and_coherent(&adev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + /* Allocate a new DMAC and its Channels */ pdmac = devm_kzalloc(&adev->dev, sizeof(*pdmac), GFP_KERNEL); if (!pdmac) { -- cgit v1.2.3 From 24353b8bb4ecfc7f751019ee599c89d5175e12a1 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 27 Jun 2013 13:37:21 +0100 Subject: DMA-API: dma: dw_dmac.c: convert to use dma_coerce_mask_and_coherent() This code sequence: if (!pdev->dev.dma_mask) { pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); } bypasses the architectures check on the DMA mask. It can be replaced with dma_coerce_mask_and_coherent(), avoiding the direct initialization of this mask. Signed-off-by: Russell King --- drivers/dma/dw/platform.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/dma') diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index e35d97590311..453822cc4f9d 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -191,11 +191,9 @@ static int dw_probe(struct platform_device *pdev) if (IS_ERR(chip->regs)) return PTR_ERR(chip->regs); - /* Apply default dma_mask if needed */ - if (!dev->dma_mask) { - dev->dma_mask = &dev->coherent_dma_mask; - dev->coherent_dma_mask = DMA_BIT_MASK(32); - } + err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (err) + return err; pdata = dev_get_platdata(dev); if (!pdata) -- cgit v1.2.3 From 94cb0e7980e27b0a303074568de76080de06a693 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 27 Jun 2013 13:45:16 +0100 Subject: DMA-API: dma: edma.c: no need to explicitly initialize DMA masks register_platform_device_full() can setup the DMA mask provided the appropriate member is set in struct platform_device_info. So lets make that be the case. This avoids a direct reference to the DMA masks by this driver. While here, add the dma_set_mask_and_coherent() call which the DMA API requires DMA-using drivers to call. Signed-off-by: Russell King --- drivers/dma/edma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/dma') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index ff50ff4c6a57..fd5e48c29746 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -631,6 +631,10 @@ static int edma_probe(struct platform_device *pdev) struct edma_cc *ecc; int ret; + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + ecc = devm_kzalloc(&pdev->dev, sizeof(*ecc), GFP_KERNEL); if (!ecc) { dev_err(&pdev->dev, "Can't allocate controller\n"); @@ -702,11 +706,13 @@ static struct platform_device *pdev0, *pdev1; static const struct platform_device_info edma_dev_info0 = { .name = "edma-dma-engine", .id = 0, + .dma_mask = DMA_BIT_MASK(32), }; static const struct platform_device_info edma_dev_info1 = { .name = "edma-dma-engine", .id = 1, + .dma_mask = DMA_BIT_MASK(32), }; static int edma_init(void) @@ -720,8 +726,6 @@ static int edma_init(void) ret = PTR_ERR(pdev0); goto out; } - pdev0->dev.dma_mask = &pdev0->dev.coherent_dma_mask; - pdev0->dev.coherent_dma_mask = DMA_BIT_MASK(32); } if (EDMA_CTLRS == 2) { @@ -731,8 +735,6 @@ static int edma_init(void) platform_device_unregister(pdev0); ret = PTR_ERR(pdev1); } - pdev1->dev.dma_mask = &pdev1->dev.coherent_dma_mask; - pdev1->dev.coherent_dma_mask = DMA_BIT_MASK(32); } out: -- cgit v1.2.3 From 42536b9f9ce38b07ac213c5f4550301f9a0d251d Mon Sep 17 00:00:00 2001 From: Philippe Retornaz Date: Mon, 14 Oct 2013 09:45:17 +0100 Subject: ARM: 7857/1: dma: imx-sdma: setup dma mask MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dma mask is not configured in the current code. This was triggered by soc-dmaengine-pcm which allocate the dma buffers with the imx-sdma as device. This commit fix audio on imx31. Signed-off-by: Philippe Rétornaz Acked-by: Sascha Hauer Acked-by: Vinod Koul Signed-off-by: Russell King --- drivers/dma/imx-sdma.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/dma') diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index fc43603cf0bb..c1fd504cae28 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1432,6 +1432,10 @@ static int __init sdma_probe(struct platform_device *pdev) return -EINVAL; } + ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + sdma = kzalloc(sizeof(*sdma), GFP_KERNEL); if (!sdma) return -ENOMEM; -- cgit v1.2.3