* [PATCH v2] dmaengine: sun6i: Set the maximum segment size
@ 2023-01-01 19:36 Samuel Holland
2023-01-18 12:07 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Samuel Holland @ 2023-01-01 19:36 UTC (permalink / raw)
To: Vinod Koul
Cc: Samuel Holland, Jernej Skrabec, Chen-Yu Tsai, dmaengine,
linux-arm-kernel, linux-kernel, linux-sunxi
The sun6i DMA engine supports segment sizes up to 2^25-1 bytes. This is
explicitly stated in newer SoC documentation (H6, D1), and it is implied
in older documentation by the 25-bit width of the "bytes left in the
current segment" register field.
Exposing the real segment size limit (instead of the 64k default)
reduces the number of SG list segments needed for a transaction.
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Tested on A64, verified that the maximum ALSA PCM period increased, and
that audio playback still worked.
Changes in v2:
- Use SZ_32M instead of DMA_BIT_MASK to make the limit more obvious
drivers/dma/sun6i-dma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index b7557f437936..30667d251e97 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -9,6 +9,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/dmapool.h>
#include <linux/interrupt.h>
@@ -1334,6 +1335,8 @@ static int sun6i_dma_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&sdc->pending);
spin_lock_init(&sdc->lock);
+ dma_set_max_seg_size(&pdev->dev, SZ_32M - 1);
+
dma_cap_set(DMA_PRIVATE, sdc->slave.cap_mask);
dma_cap_set(DMA_MEMCPY, sdc->slave.cap_mask);
dma_cap_set(DMA_SLAVE, sdc->slave.cap_mask);
--
2.37.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] dmaengine: sun6i: Set the maximum segment size
2023-01-01 19:36 [PATCH v2] dmaengine: sun6i: Set the maximum segment size Samuel Holland
@ 2023-01-18 12:07 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2023-01-18 12:07 UTC (permalink / raw)
To: Samuel Holland
Cc: Jernej Skrabec, Chen-Yu Tsai, dmaengine, linux-arm-kernel,
linux-kernel, linux-sunxi
On 01-01-23, 13:36, Samuel Holland wrote:
> The sun6i DMA engine supports segment sizes up to 2^25-1 bytes. This is
> explicitly stated in newer SoC documentation (H6, D1), and it is implied
> in older documentation by the 25-bit width of the "bytes left in the
> current segment" register field.
>
> Exposing the real segment size limit (instead of the 64k default)
> reduces the number of SG list segments needed for a transaction.
Applied, thanks
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-18 12:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-01 19:36 [PATCH v2] dmaengine: sun6i: Set the maximum segment size Samuel Holland
2023-01-18 12:07 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox