diff mbox series

[V3] dmaengine: sprd: add dma mask interface in probe

Message ID 20230919073801.25054-1-kaiwei.liu@unisoc.com (mailing list archive)
State Accepted
Commit 47b077c21590490f5bcb8ee80c66ce7a6c201d11
Headers show
Series [V3] dmaengine: sprd: add dma mask interface in probe | expand

Commit Message

Kaiwei Liu Sept. 19, 2023, 7:38 a.m. UTC
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.

Signed-off-by: Kaiwei Liu <kaiwei.liu@unisoc.com>
---
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(+)

Comments

Baolin Wang Sept. 20, 2023, 8:12 a.m. UTC | #1
On 9/19/2023 3:38 PM, Kaiwei Liu wrote:
> 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.
> 
> Signed-off-by: Kaiwei Liu <kaiwei.liu@unisoc.com>

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
> 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(+)
> 
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 20c3cb1ef2f5..c371ce405f1d 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -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)
Vinod Koul Sept. 28, 2023, 11:56 a.m. UTC | #2
On Tue, 19 Sep 2023 15:38:01 +0800, Kaiwei Liu wrote:
> 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,
diff mbox series

Patch

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 20c3cb1ef2f5..c371ce405f1d 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -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)