* [PATCH v6 1/4] dt-bindings: dmaengine: Add SpacemiT K3 DMA compatible string
2026-05-18 3:32 [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT K3 SoC Troy Mitchell
@ 2026-05-18 3:32 ` Troy Mitchell
2026-05-18 3:32 ` [PATCH v6 2/4] dmaengine: mmp_pdma: refactor DRCMR access with helper function Troy Mitchell
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Troy Mitchell @ 2026-05-18 3:32 UTC (permalink / raw)
To: Vinod Koul, Frank Li, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Guodong Xu, Michael Turquette,
Stephen Boyd, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti
Cc: dmaengine, devicetree, linux-riscv, spacemit, linux-kernel,
linux-clk, Conor Dooley, Troy Mitchell
From: Guodong Xu <guodong@riscstar.com>
Add the "spacemit,k3-pdma" compatible string for the SpacemiT K3 SoC.
While the K3 PDMA IP reuses most of the design found on the earlier
K1 SoC, a new compatible string is required because the DRCMR
(DMA Request/Command Register) base address for extended DMA request
numbers (>= 64) differs from the K1 implementation.
Signed-off-by: Guodong Xu <guodong@riscstar.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
Documentation/devicetree/bindings/dma/spacemit,k1-pdma.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/dma/spacemit,k1-pdma.yaml b/Documentation/devicetree/bindings/dma/spacemit,k1-pdma.yaml
index ec06235baf5c..62ce6d81526b 100644
--- a/Documentation/devicetree/bindings/dma/spacemit,k1-pdma.yaml
+++ b/Documentation/devicetree/bindings/dma/spacemit,k1-pdma.yaml
@@ -14,7 +14,9 @@ allOf:
properties:
compatible:
- const: spacemit,k1-pdma
+ enum:
+ - spacemit,k1-pdma
+ - spacemit,k3-pdma
reg:
maxItems: 1
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v6 2/4] dmaengine: mmp_pdma: refactor DRCMR access with helper function
2026-05-18 3:32 [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT K3 SoC Troy Mitchell
2026-05-18 3:32 ` [PATCH v6 1/4] dt-bindings: dmaengine: Add SpacemiT K3 DMA compatible string Troy Mitchell
@ 2026-05-18 3:32 ` Troy Mitchell
2026-05-18 3:32 ` [PATCH v6 3/4] dmaengine: mmp_pdma: add SpacemiT K3 support Troy Mitchell
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Troy Mitchell @ 2026-05-18 3:32 UTC (permalink / raw)
To: Vinod Koul, Frank Li, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Guodong Xu, Michael Turquette,
Stephen Boyd, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti
Cc: dmaengine, devicetree, linux-riscv, spacemit, linux-kernel,
linux-clk, Troy Mitchell
From: Guodong Xu <guodong@riscstar.com>
Refactor the DRCMR macro into a helper function mmp_pdma_get_drcmr()
to support variable extended DRCMR base addresses across different PDMA
implementations, such as SpacemiT K3.
Signed-off-by: Guodong Xu <guodong@riscstar.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
drivers/dma/mmp_pdma.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index d12e729ee12c..6112369006ee 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -51,7 +51,9 @@
#define DCSR_CMPST BIT(10) /* The Descriptor Compare Status */
#define DCSR_EORINTR BIT(9) /* The end of Receive */
-#define DRCMR(n) ((((n) < 64) ? 0x0100 : 0x1100) + (((n) & 0x3f) << 2))
+#define DRCMR_BASE 0x0100
+#define DRCMR_EXT_BASE_DEFAULT 0x1100
+#define DRCMR_REQ_LIMIT 64
#define DRCMR_MAPVLD BIT(7) /* Map Valid (read / write) */
#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */
@@ -154,6 +156,7 @@ struct mmp_pdma_phy {
* @run_bits: Control bits in DCSR register for channel start/stop
* @dma_width: DMA addressing width in bits (32 or 64). Determines the
* DMA mask capability of the controller hardware.
+ * @drcmr_ext_base: Base DRCMR address for extended requests
*/
struct mmp_pdma_ops {
/* Hardware Register Operations */
@@ -174,6 +177,7 @@ struct mmp_pdma_ops {
/* Controller Configuration */
u32 run_bits;
u32 dma_width;
+ u32 drcmr_ext_base;
};
struct mmp_pdma_device {
@@ -195,6 +199,13 @@ struct mmp_pdma_device {
#define to_mmp_pdma_dev(dmadev) \
container_of(dmadev, struct mmp_pdma_device, device)
+static u32 mmp_pdma_get_drcmr(struct mmp_pdma_device *pdev, u32 drcmr)
+{
+ if (drcmr < DRCMR_REQ_LIMIT)
+ return DRCMR_BASE + (drcmr << 2);
+ return pdev->ops->drcmr_ext_base + ((drcmr - DRCMR_REQ_LIMIT) << 2);
+}
+
/* For 32-bit PDMA */
static void write_next_addr_32(struct mmp_pdma_phy *phy, dma_addr_t addr)
{
@@ -301,7 +312,7 @@ static void enable_chan(struct mmp_pdma_phy *phy)
pdev = to_mmp_pdma_dev(phy->vchan->chan.device);
- reg = DRCMR(phy->vchan->drcmr);
+ reg = mmp_pdma_get_drcmr(pdev, phy->vchan->drcmr);
writel(DRCMR_MAPVLD | phy->idx, phy->base + reg);
dalgn = readl(phy->base + DALGN);
@@ -437,7 +448,7 @@ static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)
return;
/* clear the channel mapping in DRCMR */
- reg = DRCMR(pchan->drcmr);
+ reg = mmp_pdma_get_drcmr(pdev, pchan->drcmr);
writel(0, pchan->phy->base + reg);
spin_lock_irqsave(&pdev->phy_lock, flags);
@@ -1179,6 +1190,7 @@ static const struct mmp_pdma_ops marvell_pdma_v1_ops = {
.get_desc_dst_addr = get_desc_dst_addr_32,
.run_bits = (DCSR_RUN),
.dma_width = 32,
+ .drcmr_ext_base = DRCMR_EXT_BASE_DEFAULT,
};
static const struct mmp_pdma_ops spacemit_k1_pdma_ops = {
@@ -1192,6 +1204,7 @@ static const struct mmp_pdma_ops spacemit_k1_pdma_ops = {
.get_desc_dst_addr = get_desc_dst_addr_64,
.run_bits = (DCSR_RUN | DCSR_LPAEEN),
.dma_width = 64,
+ .drcmr_ext_base = DRCMR_EXT_BASE_DEFAULT,
};
static const struct of_device_id mmp_pdma_dt_ids[] = {
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v6 3/4] dmaengine: mmp_pdma: add SpacemiT K3 support
2026-05-18 3:32 [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT K3 SoC Troy Mitchell
2026-05-18 3:32 ` [PATCH v6 1/4] dt-bindings: dmaengine: Add SpacemiT K3 DMA compatible string Troy Mitchell
2026-05-18 3:32 ` [PATCH v6 2/4] dmaengine: mmp_pdma: refactor DRCMR access with helper function Troy Mitchell
@ 2026-05-18 3:32 ` Troy Mitchell
2026-05-18 3:32 ` [PATCH v6 4/4] riscv: dts: spacemit: Add PDMA controller node for K3 SoC Troy Mitchell
2026-05-19 17:40 ` (subset) [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT " Vinod Koul
4 siblings, 0 replies; 7+ messages in thread
From: Troy Mitchell @ 2026-05-18 3:32 UTC (permalink / raw)
To: Vinod Koul, Frank Li, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Guodong Xu, Michael Turquette,
Stephen Boyd, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti
Cc: dmaengine, devicetree, linux-riscv, spacemit, linux-kernel,
linux-clk, Troy Mitchell
From: Guodong Xu <guodong@riscstar.com>
SpacemiT K3 reuses most of the PDMA IP design found on K1, with one
difference being the extended DRCMR base address. Add "spacemit,k3-pdma"
compatible string and define a new mmp_pdma_ops for K3 PDMA.
Signed-off-by: Guodong Xu <guodong@riscstar.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
drivers/dma/mmp_pdma.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 6112369006ee..386e85cd4882 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -52,6 +52,7 @@
#define DCSR_EORINTR BIT(9) /* The end of Receive */
#define DRCMR_BASE 0x0100
+#define DRCMR_EXT_BASE_K3 0x1000
#define DRCMR_EXT_BASE_DEFAULT 0x1100
#define DRCMR_REQ_LIMIT 64
#define DRCMR_MAPVLD BIT(7) /* Map Valid (read / write) */
@@ -1207,6 +1208,20 @@ static const struct mmp_pdma_ops spacemit_k1_pdma_ops = {
.drcmr_ext_base = DRCMR_EXT_BASE_DEFAULT,
};
+static const struct mmp_pdma_ops spacemit_k3_pdma_ops = {
+ .write_next_addr = write_next_addr_64,
+ .read_src_addr = read_src_addr_64,
+ .read_dst_addr = read_dst_addr_64,
+ .set_desc_next_addr = set_desc_next_addr_64,
+ .set_desc_src_addr = set_desc_src_addr_64,
+ .set_desc_dst_addr = set_desc_dst_addr_64,
+ .get_desc_src_addr = get_desc_src_addr_64,
+ .get_desc_dst_addr = get_desc_dst_addr_64,
+ .run_bits = (DCSR_RUN | DCSR_LPAEEN | DCSR_EORIRQEN | DCSR_EORSTOPEN),
+ .dma_width = 64,
+ .drcmr_ext_base = DRCMR_EXT_BASE_K3,
+};
+
static const struct of_device_id mmp_pdma_dt_ids[] = {
{
.compatible = "marvell,pdma-1.0",
@@ -1214,6 +1229,9 @@ static const struct of_device_id mmp_pdma_dt_ids[] = {
}, {
.compatible = "spacemit,k1-pdma",
.data = &spacemit_k1_pdma_ops
+ }, {
+ .compatible = "spacemit,k3-pdma",
+ .data = &spacemit_k3_pdma_ops
}, {
/* sentinel */
}
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v6 4/4] riscv: dts: spacemit: Add PDMA controller node for K3 SoC
2026-05-18 3:32 [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT K3 SoC Troy Mitchell
` (2 preceding siblings ...)
2026-05-18 3:32 ` [PATCH v6 3/4] dmaengine: mmp_pdma: add SpacemiT K3 support Troy Mitchell
@ 2026-05-18 3:32 ` Troy Mitchell
2026-05-21 12:51 ` Yixun Lan
2026-05-19 17:40 ` (subset) [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT " Vinod Koul
4 siblings, 1 reply; 7+ messages in thread
From: Troy Mitchell @ 2026-05-18 3:32 UTC (permalink / raw)
To: Vinod Koul, Frank Li, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Guodong Xu, Michael Turquette,
Stephen Boyd, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti
Cc: dmaengine, devicetree, linux-riscv, spacemit, linux-kernel,
linux-clk, Troy Mitchell
Add the Peripheral DMA (PDMA) controller node for the SpacemiT K3 SoC.
The PDMA controller provides general-purpose DMA capabilities for various
peripheral devices across the system to offload CPU data transfers.
Unlike the previous K1 SoC, where some DMA masters had memory addressing
limitations (e.g. restricted to the 0-4GB space) requiring a dedicated dma-bus
with dma-ranges to restrict memory allocations, the K3 DMA masters have
full memory addressing capabilities. Therefore, the PDMA node is now
instantiated directly under the main soc bus.
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
arch/riscv/boot/dts/spacemit/k3.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi
index a3a8ceddabec..cd321975fc18 100644
--- a/arch/riscv/boot/dts/spacemit/k3.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k3.dtsi
@@ -438,6 +438,17 @@ soc: soc {
dma-noncoherent;
ranges;
+ pdma: dma-controller@d4000000 {
+ compatible = "spacemit,k3-pdma";
+ reg = <0x0 0xd4000000 0x0 0x4000>;
+ clocks = <&syscon_apmu CLK_APMU_DMA>;
+ resets = <&syscon_apmu RESET_APMU_DMA>;
+ interrupts = <72 IRQ_TYPE_LEVEL_HIGH>;
+ dma-channels = <16>;
+ #dma-cells = <1>;
+ status = "disabled";
+ };
+
syscon_apbc: system-controller@d4015000 {
compatible = "spacemit,k3-syscon-apbc";
reg = <0x0 0xd4015000 0x0 0x1000>;
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v6 4/4] riscv: dts: spacemit: Add PDMA controller node for K3 SoC
2026-05-18 3:32 ` [PATCH v6 4/4] riscv: dts: spacemit: Add PDMA controller node for K3 SoC Troy Mitchell
@ 2026-05-21 12:51 ` Yixun Lan
0 siblings, 0 replies; 7+ messages in thread
From: Yixun Lan @ 2026-05-21 12:51 UTC (permalink / raw)
To: Troy Mitchell
Cc: Vinod Koul, Frank Li, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Guodong Xu, Michael Turquette, Stephen Boyd,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
dmaengine, devicetree, linux-riscv, spacemit, linux-kernel,
linux-clk
Hi Troy,
On 11:32 Mon 18 May , Troy Mitchell wrote:
> Add the Peripheral DMA (PDMA) controller node for the SpacemiT K3 SoC.
> The PDMA controller provides general-purpose DMA capabilities for various
> peripheral devices across the system to offload CPU data transfers.
>
> Unlike the previous K1 SoC, where some DMA masters had memory addressing
> limitations (e.g. restricted to the 0-4GB space) requiring a dedicated dma-bus
> with dma-ranges to restrict memory allocations, the K3 DMA masters have
> full memory addressing capabilities. Therefore, the PDMA node is now
> instantiated directly under the main soc bus.
>
> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Applied, Thanks
[4/4] riscv: dts: spacemit: Add PDMA controller node for K3 SoC
https://github.com/spacemit-com/linux/commit/3f47ca8bb3c3f4a71688451a0cb7350d3e1e1059
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (subset) [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT K3 SoC
2026-05-18 3:32 [PATCH v6 0/4] dmaengine: Add Peripheral DMA support for SpacemiT K3 SoC Troy Mitchell
` (3 preceding siblings ...)
2026-05-18 3:32 ` [PATCH v6 4/4] riscv: dts: spacemit: Add PDMA controller node for K3 SoC Troy Mitchell
@ 2026-05-19 17:40 ` Vinod Koul
4 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2026-05-19 17:40 UTC (permalink / raw)
To: Frank Li, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Guodong Xu, Michael Turquette, Stephen Boyd,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Troy Mitchell
Cc: dmaengine, devicetree, linux-riscv, spacemit, linux-kernel,
linux-clk, Conor Dooley
On Mon, 18 May 2026 11:32:40 +0800, Troy Mitchell wrote:
> This patch series introduces Peripheral DMA (PDMA) support for the
> SpacemiT K3 SoC, leveraging the existing mmp_pdma driver.
>
> The K3 PDMA IP is largely based on the design found in the previous
> SpacemiT K1 SoC, but introduces a few key architectural differences:
> 1. It features a variable extended DRCMR base address for DMA request
> numbers (>= 64) depending on the hardware implementation.
> 2. Unlike the K1 SoC, where some DMA masters had memory addressing
> limitations (requiring a dedicated dma-bus), the K3 DMA masters
> have full memory addressing capabilities.
>
> [...]
Applied, thanks!
[1/4] dt-bindings: dmaengine: Add SpacemiT K3 DMA compatible string
commit: 55620b11186c81757b05fb8e2df9ddc7127d6fd2
[2/4] dmaengine: mmp_pdma: refactor DRCMR access with helper function
commit: f46b47623e70dea8b03794a5420ffba060425e85
[3/4] dmaengine: mmp_pdma: add SpacemiT K3 support
commit: 6587b8661a0b61c2f4b260bfc9f0e9ef9de0ea2e
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread