Skip to contentSkip to conversation

New driver for the Loongson LS2X APB DMA Controller

PATCH RESEND Superseded Binbin Zhou 3 participants 6 messages Jun 8, 2023 – Jun 10, 2023

Subsystems (6)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Binbin Zhou

author maintainer
#0 lore raw

v2 cover New driver for the Loongson LS2X APB DMA Controller

Hi all:

This patchset introduces you to the LS2X apbdma controller.

The Loongson LS2X APB DMA controller is available on Loongson-2K chips. It is a single-channel, configurable DMA controller IP core based on the AXI bus, whose main function is to integrate DMA functionality on a chip dedicated to carrying data between memory and peripherals in APB bus (e.g. nand).

Thanks.

----
V2:
patch(1/2)
- Minor changes from Conor;
- Add Reviewed-by tag.
patch(2/2)
- Fix build errors from [email protected].

Link to V1:
https://lore.kernel.org/dmaengine/[email protected]/

Binbin Zhou (2):
dt-bindings: dmaengine: Add Loongson LS2X APB DMA controller
dmaengine: ls2x-apb: new driver for the Loongson LS2X APB DMA
controller

 .../bindings/dma/loongson,ls2x-apbdma.yaml    |  61 ++
 drivers/dma/Kconfig                           |  14 +
 drivers/dma/Makefile                          |   1 +
 drivers/dma/ls2x-apb-dma.c                    | 644 ++++++++++++++++++
 4 files changed, 720 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml
 create mode 100644 drivers/dma/ls2x-apb-dma.c
Signature · 1 line
2.39.3
author maintainer
#1 lore raw

PATCH RESEND v2 1/2 dt-bindings: dmaengine: Add Loongson LS2X APB DMA controller

Add Loongson LS2X APB DMA controller binding with DT schema format using json-schema.

---
 .../bindings/dma/loongson,ls2x-apbdma.yaml    | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml
Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +61 -0
new file mode 100644
index 000000000000..8e5643186310
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/loongson,ls2x-apbdma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson LS2X APB DMA controller
+
+description:
+  The Loongson LS2X APB DMA controller is used for transferring data
+  between system memory and the peripherals on the APB bus.
+
+maintainers:
+  - Binbin Zhou <[email protected]>
+
+allOf:
+  - $ref: dma-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: loongson,ls2k1000-apbdma
+      - items:
+          - const: loongson,ls2k0500-apbdma
+          - const: loongson,ls2k1000-apbdma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  "#dma-cells":
+    const: 1
+
+  dma-channels:
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#dma-cells"
+  - dma-channels
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    dma-controller@1fe00c00 {
+        compatible = "loongson,ls2k1000-apbdma";
+        reg = <0x1fe00c00 0x8>;
+        interrupt-parent = <&liointc1>;
+        interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+        #dma-cells = <1>;
+        dma-channels = <1>;
+    };
+
+...
Signature · 1 line
2.39.3
#2 lore raw

Re: [PATCH RESEND v2 1/2] dt-bindings: dmaengine: Add Loongson LS2X APB DMA controller

Quoted 16 lines · Binbin Zhou

Add Loongson LS2X APB DMA controller binding with DT schema format using json-schema.

Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +9 -0
+properties:
+  compatible:
+    oneOf:
+      - const: loongson,ls2k1000-apbdma
+      - items:
+          - const: loongson,ls2k0500-apbdma
+          - const: loongson,ls2k1000-apbdma
+
+  reg:

Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +10 -0
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  "#dma-cells":
+    const: 1
+
+  dma-channels:
+    const: 1

If it is const, why do you need it?

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH RESEND v2 1/2] dt-bindings: dmaengine: Add Loongson LS2X APB DMA controller

Quoted 22 lines · Krzysztof Kozlowski
Quoted 20 lines · Binbin Zhou

Add Loongson LS2X APB DMA controller binding with DT schema format using json-schema.

Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +13 -0
+properties:
+  compatible:
+    oneOf:
+      - const: loongson,ls2k1000-apbdma
+      - items:
+          - const: loongson,ls2k0500-apbdma
+          - const: loongson,ls2k1000-apbdma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
Quoted 9 lines

Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml line 37

Quoted 6 lines
Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +6 -0
+
+  "#dma-cells":
+    const: 1
+
+  dma-channels:
+    const: 1

If it is const, why do you need it?

Hi Krzysztof:

IMO, although it is a single-channel DMAC, the "dma-channels" are still needed for a more comprehensive description of the hardware.

Thanks.
Binbin

Quoted 3 lines

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH RESEND v2 1/2] dt-bindings: dmaengine: Add Loongson LS2X APB DMA controller

Quoted 33 lines · Binbin Zhou
Quoted 22 lines · Krzysztof Kozlowski
Quoted 20 lines · Binbin Zhou

Add Loongson LS2X APB DMA controller binding with DT schema format using json-schema.

Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +13 -0
+properties:
+  compatible:
+    oneOf:
+      - const: loongson,ls2k1000-apbdma
+      - items:
+          - const: loongson,ls2k0500-apbdma
+          - const: loongson,ls2k1000-apbdma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
Quoted 9 lines

Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml line 37

Quoted 6 lines
Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml new file +6 -0
+
+  "#dma-cells":
+    const: 1
+
+  dma-channels:
+    const: 1

If it is const, why do you need it?

Quoted 4 lines

Hi Krzysztof:

IMO, although it is a single-channel DMAC, the "dma-channels" are still needed for a more comprehensive description of the hardware.

How does it describe more the hardware if it is obvious and always the same? If so, why you didn't add properties like reg-io-width, dma-requests, clock-frequency, clocks (BTW, this actually is missing), dma-channel-mask and hundreds of others?

No, drop, it does not make sense.

Best regards,
Krzysztof

author maintainer
#5 lore raw

PATCH RESEND v2 2/2 dmaengine: ls2x-apb: new driver for the Loongson LS2X APB DMA controller

In reply to Binbin Zhou

The Loongson LS2X APB DMA controller is available on Loongson-2K chips.

It is a single-channel, configurable DMA controller IP core based on the AXI bus, whose main function is to integrate DMA functionality on a chip dedicated to carrying data between memory and peripherals in APB bus (e.g. nand).

---
 drivers/dma/Kconfig        |  14 +
 drivers/dma/Makefile       |   1 +
 drivers/dma/ls2x-apb-dma.c | 644 +++++++++++++++++++++++++++++++++++++
 3 files changed, 659 insertions(+)
 create mode 100644 drivers/dma/ls2x-apb-dma.c
drivers/dma/Kconfig +14 -0
index f5f422f9b850..c6019cd6c3b3 100644
@@ -376,6 +376,20 @@ config LPC18XX_DMAMUX
 	  Enable support for DMA on NXP LPC18xx/43xx platforms
 	  with PL080 and multiplexed DMA request lines.
 
+config LS2X_APB_DMA
+	tristate "Loongson LS2X APB DMA support"
+	depends on LOONGARCH || COMPILE_TEST
+	select DMA_ENGINE
+	select DMA_VIRTUAL_CHANNELS
+	help
+	  Support for the Loongson LS2X APB DMA controller driver. The
+	  DMA controller is having single DMA channel which can be
+	  configured for different peripherals like audio, nand, sdio
+	  etc which is in APB bus.
+
+	  This DMA controller transfers data from memory to peripheral fifo.
+	  It does not support memory to memory data transfer.
+
 config MCF_EDMA
 	tristate "Freescale eDMA engine support, ColdFire mcf5441x SoCs"
 	depends on M5441x || COMPILE_TEST
drivers/dma/Makefile +1 -0
index a4fd1ce29510..9b28ddb1ea3b 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_INTEL_IOATDMA) += ioat/
 obj-y += idxd/
 obj-$(CONFIG_K3_DMA) += k3dma.o
 obj-$(CONFIG_LPC18XX_DMAMUX) += lpc18xx-dmamux.o
+obj-$(CONFIG_LS2X_APB_DMA) += ls2x-apb-dma.o
 obj-$(CONFIG_MILBEAUT_HDMAC) += milbeaut-hdmac.o
 obj-$(CONFIG_MILBEAUT_XDMAC) += milbeaut-xdmac.o
 obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
drivers/dma/ls2x-apb-dma.c new file +644 -0

644 lines not on this page · raw message

Signature · 1 line
2.39.3