* [PATCH 2/5] dma: add dma mask interface in probe
@ 2023-08-07 5:20 Kaiwei Liu
2023-08-07 7:50 ` Baolin Wang
0 siblings, 1 reply; 2+ messages in thread
From: Kaiwei Liu @ 2023-08-07 5:20 UTC (permalink / raw)
To: Vinod Koul, Orson Zhai, Baolin Wang, Chunyan Zhang
Cc: dmaengine, linux-kernel, kaiwei liu, Wenming Wu
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>
---
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..0e146550dfbb 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, "dma_set_mask_and_coherent failed\n");
+ return ret;
+ }
+ }
+
/* Parse new and deprecated dma-channels properties */
ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count);
if (ret)
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/5] dma: add dma mask interface in probe
2023-08-07 5:20 [PATCH 2/5] dma: add dma mask interface in probe Kaiwei Liu
@ 2023-08-07 7:50 ` Baolin Wang
0 siblings, 0 replies; 2+ messages in thread
From: Baolin Wang @ 2023-08-07 7:50 UTC (permalink / raw)
To: Kaiwei Liu, Vinod Koul, Orson Zhai, Chunyan Zhang
Cc: dmaengine, linux-kernel, kaiwei liu, Wenming Wu
On 8/7/2023 1:20 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>
> ---
> 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..0e146550dfbb 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, "dma_set_mask_and_coherent failed\n");
The error message is not readable, may be something like below?
"unable to set coherent mask to 32\n"
The changes look good to me. Chunyan and Orson, please double check the
DMA mask?
> + return ret;
> + }
> + }
> +
> /* Parse new and deprecated dma-channels properties */
> ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count);
> if (ret)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-07 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07 5:20 [PATCH 2/5] dma: add dma mask interface in probe Kaiwei Liu
2023-08-07 7:50 ` Baolin Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®