Skip to contentSkip to conversation

dw_dmac: apply default dma_mask if needed

PATCH Applied Andy Shevchenko 2 participants 2 messages Feb 14, 2013 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dw_dmac: apply default dma_mask if needed

In some cases we got the device without dma_mask configured. We have to apply the default value to avoid crashes during memory mapping.

---
Since v1:
- rebased on top of recent next branch from Vinod

 drivers/dma/dw_dmac.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/dma/dw_dmac.c +6 -0
index 6694676..4c83f18 100644
@@ -1661,6 +1661,12 @@ static int dw_probe(struct platform_device *pdev)
 	if (!regs)
 		return -EBUSY;
 
+	/* Apply default dma_mask if needed */
+	if (!pdev->dev.dma_mask) {
+		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+	}
+
 	dw_params = dma_read_byaddr(regs, DW_PARAMS);
 	autocfg = dw_params >> DW_PARAMS_EN & 0x1;
 
Signature · 1 line
1.7.10.4
Applied
#1 lore raw
Quoted 5 lines · Andy Shevchenko

In some cases we got the device without dma_mask configured. We have to apply the default value to avoid crashes during memory mapping.

Applied, thanks

Quoted 26 lines

---
Since v1:
- rebased on top of recent next branch from Vinod

 drivers/dma/dw_dmac.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/dma/dw_dmac.c +6 -0
index 6694676..4c83f18 100644
@@ -1661,6 +1661,12 @@ static int dw_probe(struct platform_device *pdev)
 	if (!regs)
 		return -EBUSY;
 
+	/* Apply default dma_mask if needed */
+	if (!pdev->dev.dma_mask) {
+		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+		pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+	}
+
 	dw_params = dma_read_byaddr(regs, DW_PARAMS);
 	autocfg = dw_params >> DW_PARAMS_EN & 0x1;
 
Signature · 1 line
1.7.10.4