Skip to contentSkip to conversation

dmaengine: sprd: add dma mask interface in probe

PATCH Applied Kaiwei Liu 3 participants 3 messages Sep 19, 2023 – Sep 28, 2023

Subsystems (2)
lore
Share & tools
lore

Kaiwei Liu

author
#0 lore raw

PATCH v3 1/1 dmaengine: sprd: add dma mask interface in probe

In the probe of DMA, the default addressing range is 32 bits, while the actual DMA hardware addressing range used is 36 bits. So add dma_set_mask_and_coherent function to match DMA addressing range.

---
Change in V2:
-Change subject line.
Change in V3:
-Modify error message to make it more readable.

---
 drivers/dma/sprd-dma.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/dma/sprd-dma.c +9 -0
index 20c3cb1ef2f5..c371ce405f1d 100644
@@ -1115,6 +1115,15 @@ static int sprd_dma_probe(struct platform_device *pdev)
 	u32 chn_count;
 	int ret, i;
 
+	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
+	if (ret) {
+		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+		if (ret) {
+			dev_err(&pdev->dev, "unable to set coherent mask to 32\n");
+			return ret;
+		}
+	}
+
 	/* Parse new and deprecated dma-channels properties */
 	ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count);
 	if (ret)
Signature · 1 line
2.17.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 6 lines · Kaiwei Liu

In the probe of DMA, the default addressing range is 32 bits, while the actual DMA hardware addressing range used is 36 bits. So add dma_set_mask_and_coherent function to match DMA addressing range.

LGTM.

Quoted 29 lines

---
Change in V2:
-Change subject line.
Change in V3:

(quoted diff) +0 -2
-Modify error message to make it more readable.
---
  drivers/dma/sprd-dma.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/dma/sprd-dma.c +9 -0
index 20c3cb1ef2f5..c371ce405f1d 100644
@@ -1115,6 +1115,15 @@ static int sprd_dma_probe(struct platform_device *pdev)
  	u32 chn_count;
  	int ret, i;
 
+	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
+	if (ret) {
+		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+		if (ret) {
+			dev_err(&pdev->dev, "unable to set coherent mask to 32\n");
+			return ret;
+		}
+	}
+
  	/* Parse new and deprecated dma-channels properties */
  	ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count);
  	if (ret)
maintainer Applied
#2 lore raw
In reply to Kaiwei Liu
Quoted 6 lines · Kaiwei Liu

In the probe of DMA, the default addressing range is 32 bits, while the actual DMA hardware addressing range used is 36 bits. So add dma_set_mask_and_coherent function to match DMA addressing range.

Applied, thanks!

[1/1] dmaengine: sprd: add dma mask interface in probe

      commit: 47b077c21590490f5bcb8ee80c66ce7a6c201d11

Best regards,

Signature · 1 line
~Vinod