* [PATCH 0/3] riscv: sophgo: allow DMA multiplexer set channel number for DMA controller
@ 2025-12-12 2:05 Inochi Amaoto
2025-12-12 2:05 ` [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible Inochi Amaoto
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Inochi Amaoto @ 2025-12-12 2:05 UTC (permalink / raw)
To: Eugeniy Paltsev, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Chen Wang, Inochi Amaoto, Alexander Sverdlin,
Longbin Li, Yixun Lan, Ze Huang
Cc: Anton D . Stavinskii, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo
As the DMA controller on Sophgo CV1800 series SoC only has 8 channels,
the SoC provides a dma multiplexer to reuse the DMA channel. However,
the dma multiplexer also controlls the DMA interrupt multiplexer, which
means that the dma multiplexer needs to know the channel number.
Inochi Amaoto (3):
dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible
dmaengine: dw-axi-dmac: Add support for CV1800B DMA
riscv: dts: sophgo: cv180x: Allow the DMA multiplexer to set channel
number for DMA controller
.../bindings/dma/snps,dw-axi-dmac.yaml | 1 +
arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +-
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 23 ++++++++++++++++---
drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 +
4 files changed, 23 insertions(+), 4 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible
2025-12-12 2:05 [PATCH 0/3] riscv: sophgo: allow DMA multiplexer set channel number for DMA controller Inochi Amaoto
@ 2025-12-12 2:05 ` Inochi Amaoto
2025-12-12 18:48 ` Anton Stavinsky
2025-12-12 2:05 ` [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA Inochi Amaoto
2025-12-12 2:05 ` [PATCH 3/3] riscv: dts: sophgo: cv180x: Allow the DMA multiplexer to set channel number for DMA controller Inochi Amaoto
2 siblings, 1 reply; 9+ messages in thread
From: Inochi Amaoto @ 2025-12-12 2:05 UTC (permalink / raw)
To: Eugeniy Paltsev, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Chen Wang, Inochi Amaoto, Alexander Sverdlin,
Longbin Li, Yixun Lan, Ze Huang
Cc: Anton D . Stavinskii, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo
The DMA controller on CV1800B needs to use the DMA phandle args
as the channel number instead of hardware handshake number, so
add a new compatible for the DMA controller on CV1800B.
Change the DMA phandle args parsing logic so it can use handshake
number as channel number if necessary
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml b/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml
index a393a33c8908..0b5c8314e25e 100644
--- a/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml
+++ b/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml
@@ -20,6 +20,7 @@ properties:
enum:
- snps,axi-dma-1.01a
- intel,kmb-axi-dma
+ - sophgo,cv1800b-axi-dma
- starfive,jh7110-axi-dma
- starfive,jh8100-axi-dma
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA
2025-12-12 2:05 [PATCH 0/3] riscv: sophgo: allow DMA multiplexer set channel number for DMA controller Inochi Amaoto
2025-12-12 2:05 ` [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible Inochi Amaoto
@ 2025-12-12 2:05 ` Inochi Amaoto
2025-12-13 7:55 ` Samuel Holland
2025-12-12 2:05 ` [PATCH 3/3] riscv: dts: sophgo: cv180x: Allow the DMA multiplexer to set channel number for DMA controller Inochi Amaoto
2 siblings, 1 reply; 9+ messages in thread
From: Inochi Amaoto @ 2025-12-12 2:05 UTC (permalink / raw)
To: Eugeniy Paltsev, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Chen Wang, Inochi Amaoto, Alexander Sverdlin,
Longbin Li, Yixun Lan, Ze Huang
Cc: Anton D . Stavinskii, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo
As the DMA controller on Sophgo CV1800 series SoC only has 8 channels,
the SoC provides a dma multiplexer to reuse the DMA channel. However,
the dma multiplexer also controlls the DMA interrupt multiplexer, which
means that the dma multiplexer needs to know the channel number.
Allow the driver to use DMA phandle args as the channel number, so the
DMA multiplexer can route the DMA interrupt correctly.
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 23 ++++++++++++++++---
drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 +
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index b23536645ff7..62bf0d0dc354 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -50,6 +50,7 @@
#define AXI_DMA_FLAG_HAS_APB_REGS BIT(0)
#define AXI_DMA_FLAG_HAS_RESETS BIT(1)
#define AXI_DMA_FLAG_USE_CFG2 BIT(2)
+#define AXI_DMA_FLAG_HANDSHAKE_AS_CHAN BIT(3)
static inline void
axi_dma_iowrite32(struct axi_dma_chip *chip, u32 reg, u32 val)
@@ -1361,15 +1362,26 @@ static struct dma_chan *dw_axi_dma_of_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
{
struct dw_axi_dma *dw = ofdma->of_dma_data;
+ unsigned int handshake = dma_spec->args[0];
struct axi_dma_chan *chan;
struct dma_chan *dchan;
- dchan = dma_get_any_slave_channel(&dw->dma);
+ if (dw->hdata->use_handshake_as_channel_number) {
+ if (handshake >= dw->hdata->nr_channels)
+ return NULL;
+
+ chan = &dw->chan[handshake];
+ dchan = dma_get_slave_channel(&chan->vc.chan);
+ } else {
+ dchan = dma_get_any_slave_channel(&dw->dma);
+ }
+
if (!dchan)
return NULL;
- chan = dchan_to_axi_dma_chan(dchan);
- chan->hw_handshake_num = dma_spec->args[0];
+ if (!chan)
+ chan = dchan_to_axi_dma_chan(dchan);
+ chan->hw_handshake_num = handshake;
return dchan;
}
@@ -1508,6 +1520,8 @@ static int dw_probe(struct platform_device *pdev)
return ret;
}
+ chip->dw->hdata->use_handshake_as_channel_number = !!(flags & AXI_DMA_FLAG_HANDSHAKE_AS_CHAN);
+
chip->dw->hdata->use_cfg2 = !!(flags & AXI_DMA_FLAG_USE_CFG2);
chip->core_clk = devm_clk_get(chip->dev, "core-clk");
@@ -1663,6 +1677,9 @@ static const struct of_device_id dw_dma_of_id_table[] = {
}, {
.compatible = "intel,kmb-axi-dma",
.data = (void *)AXI_DMA_FLAG_HAS_APB_REGS,
+ }, {
+ .compatible = "sophgo,cv1800b-axi-dma",
+ .data = (void *)AXI_DMA_FLAG_HANDSHAKE_AS_CHAN,
}, {
.compatible = "starfive,jh7110-axi-dma",
.data = (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2),
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
index b842e6a8d90d..67cc199e24d1 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
@@ -34,6 +34,7 @@ struct dw_axi_dma_hcfg {
bool reg_map_8_channels;
bool restrict_axi_burst_len;
bool use_cfg2;
+ bool use_handshake_as_channel_number;
};
struct axi_dma_chan {
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] riscv: dts: sophgo: cv180x: Allow the DMA multiplexer to set channel number for DMA controller
2025-12-12 2:05 [PATCH 0/3] riscv: sophgo: allow DMA multiplexer set channel number for DMA controller Inochi Amaoto
2025-12-12 2:05 ` [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible Inochi Amaoto
2025-12-12 2:05 ` [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA Inochi Amaoto
@ 2025-12-12 2:05 ` Inochi Amaoto
2 siblings, 0 replies; 9+ messages in thread
From: Inochi Amaoto @ 2025-12-12 2:05 UTC (permalink / raw)
To: Eugeniy Paltsev, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Chen Wang, Inochi Amaoto, Alexander Sverdlin,
Longbin Li, Yixun Lan, Ze Huang
Cc: dmaengine, devicetree, linux-kernel, linux-riscv, sophgo,
Anton D. Stavinskii
Change the DMA controller compatible to the sophgo,cv1800b-axi-dma,
which supports setting DMA channel number in DMA phandle args.
Fixes: 514951a81a5e ("riscv: dts: sophgo: cv18xx: add DMA controller")
Reported-by: Anton D. Stavinskii <stavinsky@gmail.com>
Closes: https://github.com/sophgo/linux/issues/9
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/boot/dts/sophgo/cv180x.dtsi b/arch/riscv/boot/dts/sophgo/cv180x.dtsi
index 1b2b1969a648..e1b515b46466 100644
--- a/arch/riscv/boot/dts/sophgo/cv180x.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv180x.dtsi
@@ -417,7 +417,7 @@ sdhci1: mmc@4320000 {
};
dmac: dma-controller@4330000 {
- compatible = "snps,axi-dma-1.01a";
+ compatible = "sophgo,cv1800b-axi-dma";
reg = <0x04330000 0x1000>;
interrupts = <SOC_PERIPHERAL_IRQ(13) IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk CLK_SDMA_AXI>, <&clk CLK_SDMA_AXI>;
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible
2025-12-12 2:05 ` [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible Inochi Amaoto
@ 2025-12-12 18:48 ` Anton Stavinsky
2025-12-13 0:53 ` Chen Wang
0 siblings, 1 reply; 9+ messages in thread
From: Anton Stavinsky @ 2025-12-12 18:48 UTC (permalink / raw)
To: Inochi Amaoto
Cc: Eugeniy Paltsev, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Chen Wang, Alexander Sverdlin, Longbin Li,
Yixun Lan, Ze Huang, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo
> The DMA controller on CV1800B needs to use the DMA phandle args
> as the channel number instead of hardware handshake number, so
> add a new compatible for the DMA controller on CV1800B.
Thanks a lot, Inochi. I've tested on my Milk Duo 256M board.
Seems to be working with the I2S driver, which I'm working on right now.
No issues with DMA interrupts anymore, DMA router used right channel.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible
2025-12-12 18:48 ` Anton Stavinsky
@ 2025-12-13 0:53 ` Chen Wang
2025-12-16 18:05 ` Anton D. Stavinskii
0 siblings, 1 reply; 9+ messages in thread
From: Chen Wang @ 2025-12-13 0:53 UTC (permalink / raw)
To: Anton Stavinsky, Inochi Amaoto
Cc: Eugeniy Paltsev, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Alexander Sverdlin, Longbin Li, Yixun Lan,
Ze Huang, dmaengine, devicetree, linux-kernel, linux-riscv,
sophgo
On 12/13/2025 2:48 AM, Anton Stavinsky wrote:
>> The DMA controller on CV1800B needs to use the DMA phandle args
>> as the channel number instead of hardware handshake number, so
>> add a new compatible for the DMA controller on CV1800B.
> Thanks a lot, Inochi. I've tested on my Milk Duo 256M board.
> Seems to be working with the I2S driver, which I'm working on right now.
> No issues with DMA interrupts anymore, DMA router used right channel.
Thank you, Anton. Could you also add a "Tested-by" signature?
Chen.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA
2025-12-12 2:05 ` [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA Inochi Amaoto
@ 2025-12-13 7:55 ` Samuel Holland
2025-12-13 10:26 ` Inochi Amaoto
0 siblings, 1 reply; 9+ messages in thread
From: Samuel Holland @ 2025-12-13 7:55 UTC (permalink / raw)
To: Inochi Amaoto
Cc: Anton D . Stavinskii, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo, Eugeniy Paltsev, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Chen Wang, Alexander Sverdlin,
Longbin Li, Yixun Lan, Ze Huang
Hi Inochi,
On 2025-12-12 11:05 AM, Inochi Amaoto wrote:
> As the DMA controller on Sophgo CV1800 series SoC only has 8 channels,
> the SoC provides a dma multiplexer to reuse the DMA channel. However,
> the dma multiplexer also controlls the DMA interrupt multiplexer, which
typo: controls
> means that the dma multiplexer needs to know the channel number.
>
> Allow the driver to use DMA phandle args as the channel number, so the
> DMA multiplexer can route the DMA interrupt correctly.
>
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> ---
> .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 23 ++++++++++++++++---
> drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 +
> 2 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index b23536645ff7..62bf0d0dc354 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -50,6 +50,7 @@
> #define AXI_DMA_FLAG_HAS_APB_REGS BIT(0)
> #define AXI_DMA_FLAG_HAS_RESETS BIT(1)
> #define AXI_DMA_FLAG_USE_CFG2 BIT(2)
> +#define AXI_DMA_FLAG_HANDSHAKE_AS_CHAN BIT(3)
>
> static inline void
> axi_dma_iowrite32(struct axi_dma_chip *chip, u32 reg, u32 val)
> @@ -1361,15 +1362,26 @@ static struct dma_chan *dw_axi_dma_of_xlate(struct of_phandle_args *dma_spec,
> struct of_dma *ofdma)
> {
> struct dw_axi_dma *dw = ofdma->of_dma_data;
> + unsigned int handshake = dma_spec->args[0];
> struct axi_dma_chan *chan;
> struct dma_chan *dchan;
>
> - dchan = dma_get_any_slave_channel(&dw->dma);
> + if (dw->hdata->use_handshake_as_channel_number) {
> + if (handshake >= dw->hdata->nr_channels)
> + return NULL;
> +
> + chan = &dw->chan[handshake];
> + dchan = dma_get_slave_channel(&chan->vc.chan);
> + } else {
> + dchan = dma_get_any_slave_channel(&dw->dma);
> + }
> +
> if (!dchan)
> return NULL;
>
> - chan = dchan_to_axi_dma_chan(dchan);
> - chan->hw_handshake_num = dma_spec->args[0];
> + if (!chan)
When use_handshake_as_channel_number is false, chan is uninitialized here.
Regards,
Samuel
> + chan = dchan_to_axi_dma_chan(dchan);
> + chan->hw_handshake_num = handshake;
> return dchan;
> }
>
> @@ -1508,6 +1520,8 @@ static int dw_probe(struct platform_device *pdev)
> return ret;
> }
>
> + chip->dw->hdata->use_handshake_as_channel_number = !!(flags & AXI_DMA_FLAG_HANDSHAKE_AS_CHAN);
> +
> chip->dw->hdata->use_cfg2 = !!(flags & AXI_DMA_FLAG_USE_CFG2);
>
> chip->core_clk = devm_clk_get(chip->dev, "core-clk");
> @@ -1663,6 +1677,9 @@ static const struct of_device_id dw_dma_of_id_table[] = {
> }, {
> .compatible = "intel,kmb-axi-dma",
> .data = (void *)AXI_DMA_FLAG_HAS_APB_REGS,
> + }, {
> + .compatible = "sophgo,cv1800b-axi-dma",
> + .data = (void *)AXI_DMA_FLAG_HANDSHAKE_AS_CHAN,
> }, {
> .compatible = "starfive,jh7110-axi-dma",
> .data = (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2),
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
> index b842e6a8d90d..67cc199e24d1 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
> @@ -34,6 +34,7 @@ struct dw_axi_dma_hcfg {
> bool reg_map_8_channels;
> bool restrict_axi_burst_len;
> bool use_cfg2;
> + bool use_handshake_as_channel_number;
> };
>
> struct axi_dma_chan {
> --
> 2.52.0
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA
2025-12-13 7:55 ` Samuel Holland
@ 2025-12-13 10:26 ` Inochi Amaoto
0 siblings, 0 replies; 9+ messages in thread
From: Inochi Amaoto @ 2025-12-13 10:26 UTC (permalink / raw)
To: Samuel Holland, Inochi Amaoto
Cc: Anton D . Stavinskii, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo, Eugeniy Paltsev, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Chen Wang, Alexander Sverdlin,
Longbin Li, Yixun Lan, Ze Huang
On Sat, Dec 13, 2025 at 04:55:06PM +0900, Samuel Holland wrote:
> Hi Inochi,
>
> On 2025-12-12 11:05 AM, Inochi Amaoto wrote:
> > As the DMA controller on Sophgo CV1800 series SoC only has 8 channels,
> > the SoC provides a dma multiplexer to reuse the DMA channel. However,
> > the dma multiplexer also controlls the DMA interrupt multiplexer, which
>
> typo: controls
>
Thanks.
> > means that the dma multiplexer needs to know the channel number.
> >
> > Allow the driver to use DMA phandle args as the channel number, so the
> > DMA multiplexer can route the DMA interrupt correctly.
> >
> > Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> > ---
> > .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 23 ++++++++++++++++---
> > drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 +
> > 2 files changed, 21 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > index b23536645ff7..62bf0d0dc354 100644
> > --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > @@ -50,6 +50,7 @@
> > #define AXI_DMA_FLAG_HAS_APB_REGS BIT(0)
> > #define AXI_DMA_FLAG_HAS_RESETS BIT(1)
> > #define AXI_DMA_FLAG_USE_CFG2 BIT(2)
> > +#define AXI_DMA_FLAG_HANDSHAKE_AS_CHAN BIT(3)
> >
> > static inline void
> > axi_dma_iowrite32(struct axi_dma_chip *chip, u32 reg, u32 val)
> > @@ -1361,15 +1362,26 @@ static struct dma_chan *dw_axi_dma_of_xlate(struct of_phandle_args *dma_spec,
> > struct of_dma *ofdma)
> > {
> > struct dw_axi_dma *dw = ofdma->of_dma_data;
> > + unsigned int handshake = dma_spec->args[0];
> > struct axi_dma_chan *chan;
> > struct dma_chan *dchan;
> >
> > - dchan = dma_get_any_slave_channel(&dw->dma);
> > + if (dw->hdata->use_handshake_as_channel_number) {
> > + if (handshake >= dw->hdata->nr_channels)
> > + return NULL;
> > +
> > + chan = &dw->chan[handshake];
> > + dchan = dma_get_slave_channel(&chan->vc.chan);
> > + } else {
> > + dchan = dma_get_any_slave_channel(&dw->dma);
> > + }
> > +
> > if (!dchan)
> > return NULL;
> >
> > - chan = dchan_to_axi_dma_chan(dchan);
> > - chan->hw_handshake_num = dma_spec->args[0];
> > + if (!chan)
>
> When use_handshake_as_channel_number is false, chan is uninitialized here.
>
> Regards,
> Samuel
>
Thanks, I also noticed this, will fixed in the V2.
Regards,
Inochi
> > + chan = dchan_to_axi_dma_chan(dchan);
> > + chan->hw_handshake_num = handshake;
> > return dchan;
> > }
> >
> > @@ -1508,6 +1520,8 @@ static int dw_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > + chip->dw->hdata->use_handshake_as_channel_number = !!(flags & AXI_DMA_FLAG_HANDSHAKE_AS_CHAN);
> > +
> > chip->dw->hdata->use_cfg2 = !!(flags & AXI_DMA_FLAG_USE_CFG2);
> >
> > chip->core_clk = devm_clk_get(chip->dev, "core-clk");
> > @@ -1663,6 +1677,9 @@ static const struct of_device_id dw_dma_of_id_table[] = {
> > }, {
> > .compatible = "intel,kmb-axi-dma",
> > .data = (void *)AXI_DMA_FLAG_HAS_APB_REGS,
> > + }, {
> > + .compatible = "sophgo,cv1800b-axi-dma",
> > + .data = (void *)AXI_DMA_FLAG_HANDSHAKE_AS_CHAN,
> > }, {
> > .compatible = "starfive,jh7110-axi-dma",
> > .data = (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2),
> > diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
> > index b842e6a8d90d..67cc199e24d1 100644
> > --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
> > +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
> > @@ -34,6 +34,7 @@ struct dw_axi_dma_hcfg {
> > bool reg_map_8_channels;
> > bool restrict_axi_burst_len;
> > bool use_cfg2;
> > + bool use_handshake_as_channel_number;
> > };
> >
> > struct axi_dma_chan {
> > --
> > 2.52.0
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible
2025-12-13 0:53 ` Chen Wang
@ 2025-12-16 18:05 ` Anton D. Stavinskii
0 siblings, 0 replies; 9+ messages in thread
From: Anton D. Stavinskii @ 2025-12-16 18:05 UTC (permalink / raw)
To: Chen Wang
Cc: Inochi Amaoto, Eugeniy Paltsev, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Alexander Sverdlin, Longbin Li,
Yixun Lan, Ze Huang, dmaengine, devicetree, linux-kernel,
linux-riscv, sophgo
On Sat, Dec 13, 2025 at 08:53:34AM +0400, Chen Wang wrote:
>
> On 12/13/2025 2:48 AM, Anton Stavinsky wrote:
> > > The DMA controller on CV1800B needs to use the DMA phandle args
> > > as the channel number instead of hardware handshake number, so
> > > add a new compatible for the DMA controller on CV1800B.
> > Thanks a lot, Inochi. I've tested on my Milk Duo 256M board.
> > Seems to be working with the I2S driver, which I'm working on right now.
> > No issues with DMA interrupts anymore, DMA router used right channel.
>
> Thank you, Anton. Could you also add a "Tested-by" signature?
I've tested the v2 https://lore.kernel.org/all/aUF4w9sO5lmU9T6v@anton.local/ Hope this will help.
Thanks for pointing me.
>
> Chen.
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-16 18:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-12 2:05 [PATCH 0/3] riscv: sophgo: allow DMA multiplexer set channel number for DMA controller Inochi Amaoto
2025-12-12 2:05 ` [PATCH 1/3] dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible Inochi Amaoto
2025-12-12 18:48 ` Anton Stavinsky
2025-12-13 0:53 ` Chen Wang
2025-12-16 18:05 ` Anton D. Stavinskii
2025-12-12 2:05 ` [PATCH 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA Inochi Amaoto
2025-12-13 7:55 ` Samuel Holland
2025-12-13 10:26 ` Inochi Amaoto
2025-12-12 2:05 ` [PATCH 3/3] riscv: dts: sophgo: cv180x: Allow the DMA multiplexer to set channel number for DMA controller Inochi Amaoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).