Skip to contentSkip to conversation

Add Intel LGM soc DMA support

PATCH Superseded Amireddy Mallikarjuna reddy 4 participants 10 messages Jul 9, 2020 – Jul 21, 2020

Subsystems (2)

v4 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add Intel LGM soc DMA support

Add DMA controller driver for Lightning Mountain(LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any DPlus compliant peripheral to/from the memory. A memory to memory copy capability can also be configured.
This ldma driver is used for configure the device and channnels for data and control paths.

These controllers provide DMA capabilities for a variety of on-chip devices such as SSC, HSNAND and GSWIP.

-------------
Future Plans:
-------------
LGM SOC also supports Hardware Memory Copy engine.
The role of the HW Memory copy engine is to offload memory copy operations from the CPU.

Amireddy Mallikarjuna reddy (2):
dt-bindings: dma: Add bindings for intel LGM SOC Add Intel LGM soc DMA support.

 .../devicetree/bindings/dma/intel,ldma.yaml        |  416 +++++
 drivers/dma/Kconfig                                |    2 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/lgm/Kconfig                            |    9 +
 drivers/dma/lgm/Makefile                           |    2 +
 drivers/dma/lgm/lgm-dma.c                          | 1941 ++++++++++++++++++++
 include/linux/dma/lgm_dma.h                        |   27 +
 7 files changed, 2398 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/intel,ldma.yaml
 create mode 100644 drivers/dma/lgm/Kconfig
 create mode 100644 drivers/dma/lgm/Makefile
 create mode 100644 drivers/dma/lgm/lgm-dma.c
 create mode 100644 include/linux/dma/lgm_dma.h
Signature · 1 line
2.11.0
#1 lore raw

PATCH v4 1/2 dt-bindings: dma: Add bindings for intel LGM SOC

Add DT bindings YAML schema for DMA controller driver of Lightning Mountain(LGM) SoC.

---
v1:
- Initial version.

v2:
- Fix bot errors.

v3:
- No change.

v4:
- Address Thomas langer comments

---
 .../devicetree/bindings/dma/intel,ldma.yaml        | 416 +++++++++++++++++++++
 1 file changed, 416 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/intel,ldma.yaml
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +416 -0
new file mode 100644
index 000000000000..7f666b9812e4
@@ -0,0 +1,416 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/intel,ldma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lightning Mountain centralized low speed DMA and high speed DMA controllers.
+
+maintainers:
+  - [email protected]
+  - [email protected]
+
+properties:
+ $nodename:
+   pattern: "^dma(@.*)?$"
+
+ "#dma-cells":
+   const: 1
+
+ compatible:
+  anyOf:
+   - const: intel,lgm-cdma
+   - const: intel,lgm-dma2tx
+   - const: intel,lgm-dma1rx
+   - const: intel,lgm-dma1tx
+   - const: intel,lgm-dma0tx
+   - const: intel,lgm-dma3
+   - const: intel,lgm-toe-dma30
+   - const: intel,lgm-toe-dma31
+
+ reg:
+  maxItems: 1
+
+ clocks:
+  maxItems: 1
+
+ resets:
+  maxItems: 1
+
+ interrupts:
+  maxItems: 1
+
+ intel,dma-poll-cnt:
+   $ref: /schemas/types.yaml#definitions/uint32
+   description:
+     DMA descriptor polling counter. It may need fine tune according
+     to the system application scenario.
+
+ intel,dma-byte-en:
+   type: boolean
+   description:
+     DMA byte enable is only valid for DMA write(RX).
+     Byte enable(1) means DMA write will be based on the number of dwords
+     instead of the whole burst.
+
+ intel,dma-drb:
+    type: boolean
+    description:
+      DMA descriptor read back to make sure data and desc synchronization.
+
+ intel,dma-burst:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       Specifiy the DMA burst size(in dwords), the valid value will be 8, 16, 32.
+       Default is 16 for data path dma, 32 is for memcopy DMA.
+
+ intel,dma-polling-cnt:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA descriptor polling counter. It may need fine tune according to
+       the system application scenario.
+
+ intel,dma-desc-in-sram:
+    type: boolean
+    description:
+       DMA descritpors in SRAM or not. Some old controllers descriptors
+       can be in DRAM or SRAM. The new ones are all in SRAM.
+
+ intel,dma-orrc:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA outstanding read counter. The maximum value is 16, and it may
+       need fine tune according to the system application scenarios.
+
+ intel,dma-dburst-wr:
+    type: boolean
+    description:
+       Enable RX dynamic burst write. It only applies to RX DMA and memcopy DMA.
+
+
+ dma-ports:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA port.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-ports@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5]
+              description:
+                 Which port this node refers to.
+
+            intel,name:
+              $ref: /schemas/types.yaml#definitions/string-array
+              description:
+                 Port name of each DMA port.
+
+            intel,chans:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The channels included on this port. Format is channel start
+                 number and how many channels on this port.
+
+            intel,burst:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port burst size, the valid value will be
+                 2, 4, 8. Default is 2 for data path dma.
+
+            intel,txwgt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the port transmit weight for QoS purpose. The valid
+                 value is 1~7. Default value is 1.
+
+            intel,endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port endiannes conversion due to SoC endianness difference.
+
+          required:
+            - reg
+            - intel,name
+            - intel,chans
+
+
+ dma-channels:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA channel.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-channels@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
+              description:
+                 Which channel this node refers to.
+
+            intel,desc_num:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel maximum descriptor number. The max value is 255.
+
+            intel,pkt_sz:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Channel buffer packet size. It must be power of 2.
+                 The maximum size is 4096.
+
+            intel,desc-rx-nonpost:
+              type: boolean
+              description:
+                 Write non-posted type for DMA RX last data beat of every descriptor.
+
+            intel,data-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel data endianness configuration according to SoC requirement.
+
+            intel,desc-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel descriptor endianness configuration according to SoC requirement.
+
+            intel,data-endian-en:
+              type: boolean
+              description:
+                 Per channel data endianness enabled.
+
+            intel,desc-endian-en:
+              type: boolean
+              description:
+                 Per channel descriptor endianness enabled.
+
+            intel,byte-offset:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel byte offset(0~128).
+
+            intel,hdr-mode:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The first parameter is header mode size, the second
+                 parameter is checksum enable or disable. If enabled,
+                 header mode size is ignored. If disabled, header mode
+                 size must be provided.
+
+            intel,non-arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel non arbitration counter while polling
+
+            intel,arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel arbitration counter while polling.
+                 arb_cnt must be greater than non_arb_cnt
+
+            intel,pkt-drop:
+              type: boolean
+              description:
+                 Channel packet drop enabled or disabled.
+
+            intel,hw-desc:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 Per channel dma hardware descriptor configuration.
+                 The first parameter is descriptor physical address and the
+                 second parameter hardware descriptor number.
+
+          required:
+            - reg
+
+required:
+ - compatible
+ - reg
+ - '#dma-cells'
+
+examples:
+ - |
+   dma0: dma@e0e00000 {
+     compatible = "intel,lgm-cdma";
+     reg = <0xe0e00000 0x1000>;
+     #dma-cells = <1>;
+     interrupt-parent = <&ioapic1>;
+     interrupts = <82 1>;
+     resets = <&rcu0 0x30 0>;
+     reset-names = "ctrl";
+     clocks = <&cgu0 80>;
+     intel,dma-poll-cnt = <4>;
+     intel,dma-byte-en;
+     intel,dma-drb;
+     dma-ports {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-ports@0 {
+           reg = <0>;
+           intel,name = "SPI0";
+           intel,chans = <0 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@1 {
+           reg = <1>;
+           intel,name = "SPI1";
+           intel,chans = <2 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@2 {
+           reg = <2>;
+           intel,name = "SPI2";
+           intel,chans = <4 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@3 {
+           reg = <3>;
+           intel,name = "SPI3";
+           intel,chans = <6 2>;
+           intel,burst = <2>;
+           intel,endian = <0>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@4 {
+           reg = <4>;
+           intel,name = "HSNAND";
+           intel,chans = <8 2>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@5 {
+           reg = <5>;
+           intel,name = "PCM";
+           intel,chans = <10 6>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+     };
+     dma-channels {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-channels@0 {
+           reg = <0>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@1 {
+           reg = <1>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@2 {
+           reg = <2>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@3 {
+           reg = <3>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@4 {
+           reg = <4>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@5 {
+           reg = <5>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@6 {
+           reg = <6>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@7 {
+           reg = <7>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@8 {
+           reg = <8>;
+       };
+       dma-channels@9 {
+           reg = <9>;
+       };
+       dma-channels@10 {
+           reg = <10>;
+       };
+       dma-channels@11 {
+           reg = <11>;
+       };
+       dma-channels@12 {
+           reg = <12>;
+       };
+       dma-channels@13 {
+           reg = <13>;
+       };
+       dma-channels@14 {
+           reg = <14>;
+       };
+       dma-channels@15 {
+           reg = <15>;
+       };
+     };
+   };
+ - |
+   dma3: dma@ec800000 {
+     compatible = "intel,lgm-dma3";
+     reg = <0xec800000 0x1000>;
+     clocks = <&cgu0 71>;
+     resets = <&rcu0 0x10 9>;
+     #dma-cells = <1>;
+     intel,dma-burst = <32>;
+     intel,dma-polling-cnt = <16>;
+     intel,dma-desc-in-sram;
+     intel,dma-orrc = <16>;
+     intel,dma-byte-en;
+     intel,dma-dburst-wr;
+     dma-channels {
+         #address-cells = <1>;
+         #size-cells = <0>;
+
+         dma-channels@12 {
+             reg = <12>;
+             intel,pkt_sz = <4096>;
+             intel,desc-rx-nonpost;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+             intel,hw-desc = <0x20000000 8>;
+         };
+         dma-channels@13 {
+             reg = <13>;
+             intel,pkt-drop;
+             intel,pkt_sz = <4096>;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+         };
+     };
+   };
Signature · 1 line
2.11.0
#6 lore raw

PATCH v4 2/2 Add Intel LGM soc DMA support.

In reply to Amireddy Mallikarjuna reddy

Add DMA controller driver for Lightning Mountain(LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any DPlus compliant peripheral to/from the memory. A memory to memory copy capability can also be configured.

This ldma driver is used for configure the device and channnels for data and control paths.

---
v1:
- Initial version.

v2:
- Fix device tree bot issues, correspondign driver changes done.
- Fix kerntel test robot warnings.
--------------------------------------------------------

Quoted 1 line
Quoted 1 line

drivers/dma/lgm/lgm-dma.c:729:5: warning: no previous prototype for function 'intel_dma_chan_desc_cfg' [-Wmissing-prototypes]

int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
^
drivers/dma/lgm/lgm-dma.c:729:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
^
static
1 warning generated.

vim +/intel_dma_chan_desc_cfg +729 drivers/dma/lgm/lgm-dma.c

    728
Quoted 1 line

729 int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,

    730                             int desc_num)
    731 {
    732         return ldma_chan_desc_cfg(to_ldma_chan(chan), desc_base, desc_num);
    733 }
    734 EXPORT_SYMBOL_GPL(intel_dma_chan_desc_cfg);
    735

---------------------------------------------------------------

v3:
- Fix smatch warning.
----------------------------------------------------------------
smatch warnings:
drivers/dma/lgm/lgm-dma.c:1306 ldma_cfg_init() error: uninitialized symbol 'ret'.

----------------------------------------------------------------

v4:
- Address Thomas Langer comments in dtbinding and corresponding driver side changes.

---
 drivers/dma/Kconfig         |    2 +
 drivers/dma/Makefile        |    1 +
 drivers/dma/lgm/Kconfig     |    9 +
 drivers/dma/lgm/Makefile    |    2 +
 drivers/dma/lgm/lgm-dma.c   | 1941 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/dma/lgm_dma.h |   27 +
 6 files changed, 1982 insertions(+)
 create mode 100644 drivers/dma/lgm/Kconfig
 create mode 100644 drivers/dma/lgm/Makefile
 create mode 100644 drivers/dma/lgm/lgm-dma.c
 create mode 100644 include/linux/dma/lgm_dma.h
drivers/dma/Kconfig +2 -0
index de41d7928bff..caeaf12fd524 100644
@@ -737,6 +737,8 @@ source "drivers/dma/ti/Kconfig"
 
 source "drivers/dma/fsl-dpaa2-qdma/Kconfig"
 
+source "drivers/dma/lgm/Kconfig"
+
 # clients
 comment "DMA Clients"
 	depends on DMA_ENGINE
drivers/dma/Makefile +1 -0
index e60f81331d4c..0b899b076f4e 100644
@@ -83,6 +83,7 @@ obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
 obj-$(CONFIG_ZX_DMA) += zx_dma.o
 obj-$(CONFIG_ST_FDMA) += st_fdma.o
 obj-$(CONFIG_FSL_DPAA2_QDMA) += fsl-dpaa2-qdma/
+obj-$(CONFIG_INTEL_LDMA) += lgm/
 
 obj-y += mediatek/
 obj-y += qcom/
drivers/dma/lgm/Kconfig new file +9 -0
new file mode 100644
index 000000000000..bdb5b0d91afb
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config INTEL_LDMA
+	bool "Lightning Mountain centralized low speed DMA and high speed DMA controllers"
+	select DMA_ENGINE
+	select DMA_VIRTUAL_CHANNELS
+	help
+	  Enable support for intel Lightning Mountain SOC DMA controllers.
+	  These controllers provide DMA capabilities for a variety of on-chip
+	  devices such as SSC, HSNAND and GSWIP.
drivers/dma/lgm/Makefile new file +2 -0
new file mode 100644
index 000000000000..f318a8eff464
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_INTEL_LDMA)	+= lgm-dma.o
drivers/dma/lgm/lgm-dma.c new file +1941 -0

1,941 lines not on this page · raw message

include/linux/dma/lgm_dma.h new file +27 -0
new file mode 100644
index 000000000000..3a2ee6ad0710
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016 ~ 2019 Intel Corporation.
+ */
+#ifndef LGM_DMA_H
+#define LGM_DMA_H
+
+#include <linux/types.h>
+#include <linux/dmaengine.h>
+
+/*!
+ * \fn int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
+ *                                 int desc_num)
+ * \brief Configure low level channel descriptors
+ * \param[in] chan   pointer to DMA channel that the client is using
+ * \param[in] desc_base   descriptor base physical address
+ * \param[in] desc_num   number of descriptors
+ * \return   0 on success
+ * \return   kernel bug reported on failure
+ *
+ * This function configure the low level channel descriptors. It will be
+ * used by CBM whose descriptor is not DDR, actually some registers.
+ */
+int intel_dma_chan_desc_cfg(struct dma_chan *chan, dma_addr_t desc_base,
+			    int desc_num);
+
+#endif /* LGM_DMA_H */
Signature · 1 line
2.11.0
#2 lore raw

RE: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

In reply to Amireddy Mallikarjuna reddy
Quoted 24 lines

-----Original Message-----
From: [email protected] <devicetree- [email protected]> On Behalf Of Amireddy Mallikarjuna reddy
Sent: Donnerstag, 9. Juli 2020 08:01
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Shevchenko, Andriy <[email protected]>; [email protected]; Kim, Cheol Yong <[email protected]>; Wu, Qiming <[email protected]>; [email protected]; Amireddy Mallikarjuna reddy <[email protected]>
Subject: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

Add DT bindings YAML schema for DMA controller driver of Lightning Mountain(LGM) SoC.

Signed-off-by: Amireddy Mallikarjuna reddy
<[email protected]>
---
v1:
- Initial version.

Quoted 8 lines

v2:
- Fix bot errors.

v3:
- No change.

v4:
- Address Thomas langer comments

Please read my comments again and then respond about the topics you ignored. I added some hints below again.

Thanks.

Quoted 22 lines
---
 .../devicetree/bindings/dma/intel,ldma.yaml        | 416
+++++++++++++++++++++
 1 file changed, 416 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/dma/intel,ldma.yaml

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
new file mode 100644
index 000000000000..7f666b9812e4
@@ -0,0 +1,416 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/intel,ldma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lightning Mountain centralized low speed DMA and high speed DMA

controllers.

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 15

Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +8 -0
+
+maintainers:
+  - [email protected]
+  - [email protected]
+
+properties:
+ $nodename:
+   pattern: "^dma(@.*)?$"

Please explain the difference to the common dma binding.

Quoted 4 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +4 -0
+
+ "#dma-cells":
+   const: 1
+

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +10 -0
+ compatible:
+  anyOf:
+   - const: intel,lgm-cdma
+   - const: intel,lgm-dma2tx
+   - const: intel,lgm-dma1rx
+   - const: intel,lgm-dma1tx
+   - const: intel,lgm-dma0tx
+   - const: intel,lgm-dma3
+   - const: intel,lgm-toe-dma30
+   - const: intel,lgm-toe-dma31

Please explain why you need so many different compatible strings.

Quoted 405 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +24 -0
+
+ reg:
+  maxItems: 1
+
+ clocks:
+  maxItems: 1
+
+ resets:
+  maxItems: 1
+
+ interrupts:
+  maxItems: 1
+
+ intel,dma-poll-cnt:
+   $ref: /schemas/types.yaml#definitions/uint32
+   description:
+     DMA descriptor polling counter. It may need fine tune according
+     to the system application scenario.
+
+ intel,dma-byte-en:
+   type: boolean
+   description:
+     DMA byte enable is only valid for DMA write(RX).
+     Byte enable(1) means DMA write will be based on the number of

dwords

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+     instead of the whole burst.
+
+ intel,dma-drb:
+    type: boolean
+    description:
+      DMA descriptor read back to make sure data and desc

synchronization.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+ intel,dma-burst:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       Specifiy the DMA burst size(in dwords), the valid value will be

8, 16, 32.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+       Default is 16 for data path dma, 32 is for memcopy DMA.
+
+ intel,dma-polling-cnt:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA descriptor polling counter. It may need fine tune according

to

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +12 -0
+       the system application scenario.
+
+ intel,dma-desc-in-sram:
+    type: boolean
+    description:
+       DMA descritpors in SRAM or not. Some old controllers descriptors
+       can be in DRAM or SRAM. The new ones are all in SRAM.
+
+ intel,dma-orrc:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA outstanding read counter. The maximum value is 16, and it

may

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+       need fine tune according to the system application scenarios.
+
+ intel,dma-dburst-wr:
+    type: boolean
+    description:
+       Enable RX dynamic burst write. It only applies to RX DMA and

memcopy DMA.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +32 -0
+
+
+ dma-ports:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA port.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-ports@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5]
+              description:
+                 Which port this node refers to.
+
+            intel,name:
+              $ref: /schemas/types.yaml#definitions/string-array
+              description:
+                 Port name of each DMA port.
+
+            intel,chans:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The channels included on this port. Format is channel

start

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 number and how many channels on this port.
+
+            intel,burst:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port burst size, the valid value will

be

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 2, 4, 8. Default is 2 for data path dma.
+
+            intel,txwgt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the port transmit weight for QoS purpose. The

valid

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 value is 1~7. Default value is 1.
+
+            intel,endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port endiannes conversion due to SoC

endianness difference.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +25 -0
+
+          required:
+            - reg
+            - intel,name
+            - intel,chans
+
+
+ dma-channels:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA channel.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-channels@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,

14, 15]

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+              description:
+                 Which channel this node refers to.
+
+            intel,desc_num:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel maximum descriptor number. The max value

is 255.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +11 -0
+
+            intel,pkt_sz:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Channel buffer packet size. It must be power of 2.
+                 The maximum size is 4096.
+
+            intel,desc-rx-nonpost:
+              type: boolean
+              description:
+                 Write non-posted type for DMA RX last data beat of

every descriptor.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,data-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel data endianness configuration according to

SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,desc-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel descriptor endianness configuration

according to SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +45 -0
+
+            intel,data-endian-en:
+              type: boolean
+              description:
+                 Per channel data endianness enabled.
+
+            intel,desc-endian-en:
+              type: boolean
+              description:
+                 Per channel descriptor endianness enabled.
+
+            intel,byte-offset:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel byte offset(0~128).
+
+            intel,hdr-mode:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The first parameter is header mode size, the second
+                 parameter is checksum enable or disable. If enabled,
+                 header mode size is ignored. If disabled, header mode
+                 size must be provided.
+
+            intel,non-arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel non arbitration counter while polling
+
+            intel,arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel arbitration counter while polling.
+                 arb_cnt must be greater than non_arb_cnt
+
+            intel,pkt-drop:
+              type: boolean
+              description:
+                 Channel packet drop enabled or disabled.
+
+            intel,hw-desc:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 Per channel dma hardware descriptor configuration.
+                 The first parameter is descriptor physical address and

the

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +180 -1
+                 second parameter hardware descriptor number.
+
+          required:
+            - reg
+
+required:
+ - compatible
+ - reg
+ - '#dma-cells'
+
+examples:
+ - |
+   dma0: dma@e0e00000 {
+     compatible = "intel,lgm-cdma";
+     reg = <0xe0e00000 0x1000>;
+     #dma-cells = <1>;
+     interrupt-parent = <&ioapic1>;
+     interrupts = <82 1>;
+     resets = <&rcu0 0x30 0>;
+     reset-names = "ctrl";
+     clocks = <&cgu0 80>;
+     intel,dma-poll-cnt = <4>;
+     intel,dma-byte-en;
+     intel,dma-drb;
+     dma-ports {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-ports@0 {
+           reg = <0>;
+           intel,name = "SPI0";
+           intel,chans = <0 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@1 {
+           reg = <1>;
+           intel,name = "SPI1";
+           intel,chans = <2 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@2 {
+           reg = <2>;
+           intel,name = "SPI2";
+           intel,chans = <4 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@3 {
+           reg = <3>;
+           intel,name = "SPI3";
+           intel,chans = <6 2>;
+           intel,burst = <2>;
+           intel,endian = <0>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@4 {
+           reg = <4>;
+           intel,name = "HSNAND";
+           intel,chans = <8 2>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@5 {
+           reg = <5>;
+           intel,name = "PCM";
+           intel,chans = <10 6>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+     };
+     dma-channels {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-channels@0 {
+           reg = <0>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@1 {
+           reg = <1>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@2 {
+           reg = <2>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@3 {
+           reg = <3>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@4 {
+           reg = <4>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@5 {
+           reg = <5>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@6 {
+           reg = <6>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@7 {
+           reg = <7>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@8 {
+           reg = <8>;
+       };
+       dma-channels@9 {
+           reg = <9>;
+       };
+       dma-channels@10 {
+           reg = <10>;
+       };
+       dma-channels@11 {
+           reg = <11>;
+       };
+       dma-channels@12 {
+           reg = <12>;
+       };
+       dma-channels@13 {
+           reg = <13>;
+       };
+       dma-channels@14 {
+           reg = <14>;
+       };
+       dma-channels@15 {
+           reg = <15>;
+       };
+     };
+   };
+ - |
+   dma3: dma@ec800000 {
+     compatible = "intel,lgm-dma3";
+     reg = <0xec800000 0x1000>;
+     clocks = <&cgu0 71>;
+     resets = <&rcu0 0x10 9>;
+     #dma-cells = <1>;
+     intel,dma-burst = <32>;
+     intel,dma-polling-cnt = <16>;
+     intel,dma-desc-in-sram;
+     intel,dma-orrc = <16>;
+     intel,dma-byte-en;
+     intel,dma-dburst-wr;
+     dma-channels {
+         #address-cells = <1>;
+         #size-cells = <0>;
+
+         dma-channels@12 {
+             reg = <12>;
+             intel,pkt_sz = <4096>;
+             intel,desc-rx-nonpost;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+             intel,hw-desc = <0x20000000 8>;
+         };
+         dma-channels@13 {
+             reg = <13>;
+             intel,pkt-drop;
+             intel,pkt_sz = <4096>;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+         };
+     };
+   };
--

2.11.0

#7 lore raw

Re: [PATCH v4 2/2] Add Intel LGM soc DMA support.

In reply to Amireddy Mallikarjuna reddy
Quoted 10 lines · Amireddy Mallikarjuna reddy

Add DMA controller driver for Lightning Mountain(LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any DPlus compliant peripheral to/from the memory. A memory to memory copy capability can also be configured.

This ldma driver is used for configure the device and channnels for data and control paths.

+#include "../virt-dma.h"

I didn't find any evidence this driver utilizes virt-dma API in full. For example, there is a virt_dma_desc structure and descriptor management around it. Why don't you use it?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Re: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

In reply to Langer, Thomas

Hi Thomas,

Thanks for the review. My comments inline.

Quoted 59 lines · Thomas
Quoted 23 lines

-----Original Message-----
From: [email protected] <devicetree- [email protected]> On Behalf Of Amireddy Mallikarjuna reddy
Sent: Donnerstag, 9. Juli 2020 08:01
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Shevchenko, Andriy <[email protected]>; [email protected]; Kim, Cheol Yong <[email protected]>; Wu, Qiming <[email protected]>; [email protected]; Amireddy Mallikarjuna reddy <[email protected]>
Subject: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

Add DT bindings YAML schema for DMA controller driver of Lightning Mountain(LGM) SoC.

Signed-off-by: Amireddy Mallikarjuna reddy
<[email protected]>
---
v1:
- Initial version.

Quoted 8 lines

v2:
- Fix bot errors.

v3:
- No change.

v4:
- Address Thomas langer comments

Please read my comments again and then respond about the topics you ignored. I added some hints below again.

Thanks.

Quoted 23 lines
---
  .../devicetree/bindings/dma/intel,ldma.yaml        | 416
+++++++++++++++++++++
  1 file changed, 416 insertions(+)

create mode 100644
Documentation/devicetree/bindings/dma/intel,ldma.yaml

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
new file mode 100644
index 000000000000..7f666b9812e4
@@ -0,0 +1,416 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/intel,ldma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lightning Mountain centralized low speed DMA and high speed DMA

controllers.
+

Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 15

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+maintainers:
+  - [email protected]
+  - [email protected]
+
+properties:
+ $nodename:
+   pattern: "^dma(@.*)?$"

Please explain the difference to the common dma binding.

No difference. we can use "^dma-controller(@.*)?$" as in the common binding.
Its My bad. I missed the changes to include in this patch. Surely update in the upcoming patch.

Quoted 16 lines
Quoted 5 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +4 -0
+
+ "#dma-cells":
+   const: 1
+

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +10 -0
+ compatible:
+  anyOf:
+   - const: intel,lgm-cdma
+   - const: intel,lgm-dma2tx
+   - const: intel,lgm-dma1rx
+   - const: intel,lgm-dma1tx
+   - const: intel,lgm-dma0tx
+   - const: intel,lgm-dma3
+   - const: intel,lgm-toe-dma30
+   - const: intel,lgm-toe-dma31

Please explain why you need so many different compatible strings.

This hw dma has 7 DMA instances.
Some for datapath, some for memcpy  and some for TOE.
Some for TX only, some for RX only, and some for TX/RX(memcpy and ToE).

dma TX/RX type we considered as driver specific data of each instance and used different compatible strings for each instance. And also idea is in future if any driver specific data of any particular instance we can handle.

Here if dma name and type(tx or rx) will be accepted as devicetree attributes then we can move .name = "toe_dma31", & .type = DMA_TYPE_MCPY to devicetree. So that the compatible strings can be limited to two. intel,lgm-cdma & intel,lgm-hdma .

please suggest us the better proposal.

Quoted 406 lines
Quoted 406 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +24 -0
+
+ reg:
+  maxItems: 1
+
+ clocks:
+  maxItems: 1
+
+ resets:
+  maxItems: 1
+
+ interrupts:
+  maxItems: 1
+
+ intel,dma-poll-cnt:
+   $ref: /schemas/types.yaml#definitions/uint32
+   description:
+     DMA descriptor polling counter. It may need fine tune according
+     to the system application scenario.
+
+ intel,dma-byte-en:
+   type: boolean
+   description:
+     DMA byte enable is only valid for DMA write(RX).
+     Byte enable(1) means DMA write will be based on the number of

dwords

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+     instead of the whole burst.
+
+ intel,dma-drb:
+    type: boolean
+    description:
+      DMA descriptor read back to make sure data and desc

synchronization.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+ intel,dma-burst:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       Specifiy the DMA burst size(in dwords), the valid value will be

8, 16, 32.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+       Default is 16 for data path dma, 32 is for memcopy DMA.
+
+ intel,dma-polling-cnt:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA descriptor polling counter. It may need fine tune according

to

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +12 -0
+       the system application scenario.
+
+ intel,dma-desc-in-sram:
+    type: boolean
+    description:
+       DMA descritpors in SRAM or not. Some old controllers descriptors
+       can be in DRAM or SRAM. The new ones are all in SRAM.
+
+ intel,dma-orrc:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA outstanding read counter. The maximum value is 16, and it

may

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+       need fine tune according to the system application scenarios.
+
+ intel,dma-dburst-wr:
+    type: boolean
+    description:
+       Enable RX dynamic burst write. It only applies to RX DMA and

memcopy DMA.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +32 -0
+
+
+ dma-ports:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA port.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-ports@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5]
+              description:
+                 Which port this node refers to.
+
+            intel,name:
+              $ref: /schemas/types.yaml#definitions/string-array
+              description:
+                 Port name of each DMA port.
+
+            intel,chans:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The channels included on this port. Format is channel

start

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 number and how many channels on this port.
+
+            intel,burst:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port burst size, the valid value will

be

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 2, 4, 8. Default is 2 for data path dma.
+
+            intel,txwgt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the port transmit weight for QoS purpose. The

valid

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 value is 1~7. Default value is 1.
+
+            intel,endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port endiannes conversion due to SoC

endianness difference.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +25 -0
+
+          required:
+            - reg
+            - intel,name
+            - intel,chans
+
+
+ dma-channels:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA channel.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-channels@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,

14, 15]

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+              description:
+                 Which channel this node refers to.
+
+            intel,desc_num:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel maximum descriptor number. The max value

is 255.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +11 -0
+
+            intel,pkt_sz:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Channel buffer packet size. It must be power of 2.
+                 The maximum size is 4096.
+
+            intel,desc-rx-nonpost:
+              type: boolean
+              description:
+                 Write non-posted type for DMA RX last data beat of

every descriptor.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,data-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel data endianness configuration according to

SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,desc-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel descriptor endianness configuration

according to SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +45 -0
+
+            intel,data-endian-en:
+              type: boolean
+              description:
+                 Per channel data endianness enabled.
+
+            intel,desc-endian-en:
+              type: boolean
+              description:
+                 Per channel descriptor endianness enabled.
+
+            intel,byte-offset:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel byte offset(0~128).
+
+            intel,hdr-mode:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The first parameter is header mode size, the second
+                 parameter is checksum enable or disable. If enabled,
+                 header mode size is ignored. If disabled, header mode
+                 size must be provided.
+
+            intel,non-arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel non arbitration counter while polling
+
+            intel,arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel arbitration counter while polling.
+                 arb_cnt must be greater than non_arb_cnt
+
+            intel,pkt-drop:
+              type: boolean
+              description:
+                 Channel packet drop enabled or disabled.
+
+            intel,hw-desc:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 Per channel dma hardware descriptor configuration.
+                 The first parameter is descriptor physical address and

the

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +180 -1
+                 second parameter hardware descriptor number.
+
+          required:
+            - reg
+
+required:
+ - compatible
+ - reg
+ - '#dma-cells'
+
+examples:
+ - |
+   dma0: dma@e0e00000 {
+     compatible = "intel,lgm-cdma";
+     reg = <0xe0e00000 0x1000>;
+     #dma-cells = <1>;
+     interrupt-parent = <&ioapic1>;
+     interrupts = <82 1>;
+     resets = <&rcu0 0x30 0>;
+     reset-names = "ctrl";
+     clocks = <&cgu0 80>;
+     intel,dma-poll-cnt = <4>;
+     intel,dma-byte-en;
+     intel,dma-drb;
+     dma-ports {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-ports@0 {
+           reg = <0>;
+           intel,name = "SPI0";
+           intel,chans = <0 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@1 {
+           reg = <1>;
+           intel,name = "SPI1";
+           intel,chans = <2 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@2 {
+           reg = <2>;
+           intel,name = "SPI2";
+           intel,chans = <4 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@3 {
+           reg = <3>;
+           intel,name = "SPI3";
+           intel,chans = <6 2>;
+           intel,burst = <2>;
+           intel,endian = <0>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@4 {
+           reg = <4>;
+           intel,name = "HSNAND";
+           intel,chans = <8 2>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@5 {
+           reg = <5>;
+           intel,name = "PCM";
+           intel,chans = <10 6>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+     };
+     dma-channels {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-channels@0 {
+           reg = <0>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@1 {
+           reg = <1>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@2 {
+           reg = <2>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@3 {
+           reg = <3>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@4 {
+           reg = <4>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@5 {
+           reg = <5>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@6 {
+           reg = <6>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@7 {
+           reg = <7>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@8 {
+           reg = <8>;
+       };
+       dma-channels@9 {
+           reg = <9>;
+       };
+       dma-channels@10 {
+           reg = <10>;
+       };
+       dma-channels@11 {
+           reg = <11>;
+       };
+       dma-channels@12 {
+           reg = <12>;
+       };
+       dma-channels@13 {
+           reg = <13>;
+       };
+       dma-channels@14 {
+           reg = <14>;
+       };
+       dma-channels@15 {
+           reg = <15>;
+       };
+     };
+   };
+ - |
+   dma3: dma@ec800000 {
+     compatible = "intel,lgm-dma3";
+     reg = <0xec800000 0x1000>;
+     clocks = <&cgu0 71>;
+     resets = <&rcu0 0x10 9>;
+     #dma-cells = <1>;
+     intel,dma-burst = <32>;
+     intel,dma-polling-cnt = <16>;
+     intel,dma-desc-in-sram;
+     intel,dma-orrc = <16>;
+     intel,dma-byte-en;
+     intel,dma-dburst-wr;
+     dma-channels {
+         #address-cells = <1>;
+         #size-cells = <0>;
+
+         dma-channels@12 {
+             reg = <12>;
+             intel,pkt_sz = <4096>;
+             intel,desc-rx-nonpost;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+             intel,hw-desc = <0x20000000 8>;
+         };
+         dma-channels@13 {
+             reg = <13>;
+             intel,pkt-drop;
+             intel,pkt_sz = <4096>;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+         };
+     };
+   };
--

2.11.0

#8 lore raw

Re: [PATCH v4 2/2] Add Intel LGM soc DMA support.

In reply to Andy Shevchenko

Thanks for the review Andy. My comments inline.

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Amireddy Mallikarjuna reddy

Add DMA controller driver for Lightning Mountain(LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any DPlus compliant peripheral to/from the memory. A memory to memory copy capability can also be configured.

Quoted 6 lines
Quoted 3 lines

This ldma driver is used for configure the device and channnels for data and control paths.
+#include "../virt-dma.h"

I didn't find any evidence this driver utilizes virt-dma API in full. For example, there is a virt_dma_desc structure and descriptor management around it. Why don't you use it?

Lgm dma soc has its own hardware descriptor.
and each dma channel is associated with a peripheral, it is one to one mapping between channel and associated peripheral.

Quoted 1 line
#9 lore raw

Re: [PATCH v4 2/2] Add Intel LGM soc DMA support.

Quoted 11 lines · MallikarjunaX
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · Amireddy Mallikarjuna reddy

Add DMA controller driver for Lightning Mountain(LGM) family of SoCs.

The main function of the DMA controller is the transfer of data from/to any DPlus compliant peripheral to/from the memory. A memory to memory copy capability can also be configured.

This ldma driver is used for configure the device and channnels for data and control paths.
+#include "../virt-dma.h"

Quoted 6 lines
Quoted 3 lines

I didn't find any evidence this driver utilizes virt-dma API in full. For example, there is a virt_dma_desc structure and descriptor management around it. Why don't you use it?

Lgm dma soc has its own hardware descriptor.
and each dma channel is associated with a peripheral, it is one to one mapping between channel and associated peripheral.

And this neither objects nor answers to my question.

Hint: above mentioned structure is an abstraction of hardware descriptors for easier management in Linux kernel.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw

Re: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

In reply to Reddy, MallikarjunaX
Quoted 100 lines · MallikarjunaX

Hi Thomas,

Thanks for the review. My comments inline.

Quoted 59 lines · Thomas
Quoted 23 lines

-----Original Message-----
From: [email protected] <devicetree- [email protected]> On Behalf Of Amireddy Mallikarjuna reddy
Sent: Donnerstag, 9. Juli 2020 08:01
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Shevchenko, Andriy <[email protected]>; [email protected]; Kim, Cheol Yong <[email protected]>; Wu, Qiming <[email protected]>; [email protected]; Amireddy Mallikarjuna reddy <[email protected]>
Subject: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

Add DT bindings YAML schema for DMA controller driver of Lightning Mountain(LGM) SoC.

Signed-off-by: Amireddy Mallikarjuna reddy
<[email protected]>
---
v1:
- Initial version.

Quoted 8 lines

v2:
- Fix bot errors.

v3:
- No change.

v4:
- Address Thomas langer comments

Please read my comments again and then respond about the topics you ignored. I added some hints below again.

Thanks.

Quoted 23 lines
---
  .../devicetree/bindings/dma/intel,ldma.yaml        | 416
+++++++++++++++++++++
  1 file changed, 416 insertions(+)

create mode 100644
Documentation/devicetree/bindings/dma/intel,ldma.yaml

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
new file mode 100644
index 000000000000..7f666b9812e4
@@ -0,0 +1,416 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/intel,ldma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lightning Mountain centralized low speed DMA and high speed DMA

controllers.
+

Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 15

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+maintainers:
+  - [email protected]
+  - [email protected]
+
+properties:
+ $nodename:
+   pattern: "^dma(@.*)?$"

Please explain the difference to the common dma binding.

No difference. we can use "^dma-controller(@.*)?$" as in the common binding. Its My bad. I missed the changes to include in this patch. Surely update in the upcoming patch.

Quoted 16 lines
Quoted 5 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +4 -0
+
+ "#dma-cells":
+   const: 1
+

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +10 -0
+ compatible:
+  anyOf:
+   - const: intel,lgm-cdma
+   - const: intel,lgm-dma2tx
+   - const: intel,lgm-dma1rx
+   - const: intel,lgm-dma1tx
+   - const: intel,lgm-dma0tx
+   - const: intel,lgm-dma3
+   - const: intel,lgm-toe-dma30
+   - const: intel,lgm-toe-dma31

Please explain why you need so many different compatible strings.

This hw dma has 7 DMA instances.
Some for datapath, some for memcpy  and some for TOE.
Some for TX only, some for RX only, and some for TX/RX(memcpy and ToE).

dma TX/RX type we considered as driver specific data of each instance and used different compatible strings for each instance.
And also idea is in future if any driver specific data of any particular instance we can handle.

Quoted 4 lines

Here if dma name and type(tx or rx) will be accepted as devicetree attributes then we can move .name = "toe_dma31", & .type = DMA_TYPE_MCPY to devicetree. So that the compatible strings can be limited to two. intel,lgm-cdma & intel,lgm-hdma .

Different compatibles are okay if the instances are different and we don't have properties to describe the differences.

For some of what you have in this binding, I think it should be part of the consumer cells.

Quoted 36 lines

please suggest us the better proposal.

Quoted 34 lines
Quoted 34 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +24 -0
+
+ reg:
+  maxItems: 1
+
+ clocks:
+  maxItems: 1
+
+ resets:
+  maxItems: 1
+
+ interrupts:
+  maxItems: 1
+
+ intel,dma-poll-cnt:
+   $ref: /schemas/types.yaml#definitions/uint32
+   description:
+     DMA descriptor polling counter. It may need fine tune according
+     to the system application scenario.
+
+ intel,dma-byte-en:
+   type: boolean
+   description:
+     DMA byte enable is only valid for DMA write(RX).
+     Byte enable(1) means DMA write will be based on the number of

dwords

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+     instead of the whole burst.
+
+ intel,dma-drb:
+    type: boolean
+    description:
+      DMA descriptor read back to make sure data and desc

synchronization.
+

Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 67

Quoted 8 lines

+ intel,dma-burst:

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +3 -0
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       Specifiy the DMA burst size(in dwords), the valid value will be

8, 16, 32.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +3 -0
+       Default is 16 for data path dma, 32 is for memcopy DMA.
+
+ intel,dma-polling-cnt:

What's the difference with intel,dma-poll-cnt?

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +3 -0
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA descriptor polling counter. It may need fine tune according

to

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +12 -0
+       the system application scenario.
+
+ intel,dma-desc-in-sram:
+    type: boolean
+    description:
+       DMA descritpors in SRAM or not. Some old controllers descriptors
+       can be in DRAM or SRAM. The new ones are all in SRAM.
+
+ intel,dma-orrc:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA outstanding read counter. The maximum value is 16, and it

may

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+       need fine tune according to the system application scenarios.
+
+ intel,dma-dburst-wr:
+    type: boolean
+    description:
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 94

Quoted 8 lines

+ Enable RX dynamic burst write. It only applies to RX DMA and
memcopy DMA.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+
+
+ dma-ports:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA port.

What's a DMA port?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +13 -0
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-ports@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 115

Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +8 -0
+                - enum: [0, 1, 2, 3, 4, 5]
+              description:
+                 Which port this node refers to.
+
+            intel,name:
+              $ref: /schemas/types.yaml#definitions/string-array
+              description:
+                 Port name of each DMA port.

Why do you need this?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,chans:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The channels included on this port. Format is channel

start
+ number and how many channels on this port.

We already have standard properties for defining channels.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,burst:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port burst size, the valid value will

be
+ 2, 4, 8. Default is 2 for data path dma.

This would normally be in the consumer cells.

Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,txwgt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the port transmit weight for QoS purpose. The

valid

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 value is 1~7. Default value is 1.
+
+            intel,endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port endiannes conversion due to SoC

endianness difference.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +25 -0
+
+          required:
+            - reg
+            - intel,name
+            - intel,chans
+
+
+ dma-channels:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA channel.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-channels@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,

14, 15]

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+              description:
+                 Which channel this node refers to.
+
+            intel,desc_num:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel maximum descriptor number. The max value

is 255.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +11 -0
+
+            intel,pkt_sz:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Channel buffer packet size. It must be power of 2.
+                 The maximum size is 4096.
+
+            intel,desc-rx-nonpost:
+              type: boolean
+              description:
+                 Write non-posted type for DMA RX last data beat of

every descriptor.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,data-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel data endianness configuration according to

SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,desc-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel descriptor endianness configuration

according to SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +39 -0
+
+            intel,data-endian-en:
+              type: boolean
+              description:
+                 Per channel data endianness enabled.
+
+            intel,desc-endian-en:
+              type: boolean
+              description:
+                 Per channel descriptor endianness enabled.
+
+            intel,byte-offset:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel byte offset(0~128).
+
+            intel,hdr-mode:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The first parameter is header mode size, the second
+                 parameter is checksum enable or disable. If enabled,
+                 header mode size is ignored. If disabled, header mode
+                 size must be provided.
+
+            intel,non-arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel non arbitration counter while polling
+
+            intel,arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel arbitration counter while polling.
+                 arb_cnt must be greater than non_arb_cnt
+
+            intel,pkt-drop:
+              type: boolean
+              description:
+                 Channel packet drop enabled or disabled.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+
+            intel,hw-desc:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 Per channel dma hardware descriptor configuration.
+                 The first parameter is descriptor physical address and

the
+ second parameter hardware descriptor number.

All/most of these seem like client/consumer settings.

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +25 -0
+
+          required:
+            - reg
+
+required:
+ - compatible
+ - reg
+ - '#dma-cells'
+
+examples:
+ - |
+   dma0: dma@e0e00000 {
+     compatible = "intel,lgm-cdma";
+     reg = <0xe0e00000 0x1000>;
+     #dma-cells = <1>;
+     interrupt-parent = <&ioapic1>;
+     interrupts = <82 1>;
+     resets = <&rcu0 0x30 0>;
+     reset-names = "ctrl";
+     clocks = <&cgu0 80>;
+     intel,dma-poll-cnt = <4>;
+     intel,dma-byte-en;
+     intel,dma-drb;
+     dma-ports {
+       #address-cells = <1>;
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 270

Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +8 -0
+       #size-cells = <0>;
+
+       dma-ports@0 {
+           reg = <0>;
+           intel,name = "SPI0";
+           intel,chans = <0 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;

Yeah, based on the names, it definitely seems like these belong as cells in 'dmas' properties.

Quoted 148 lines
Quoted 148 lines
Quoted 148 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +146 -1
+       };
+       dma-ports@1 {
+           reg = <1>;
+           intel,name = "SPI1";
+           intel,chans = <2 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@2 {
+           reg = <2>;
+           intel,name = "SPI2";
+           intel,chans = <4 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@3 {
+           reg = <3>;
+           intel,name = "SPI3";
+           intel,chans = <6 2>;
+           intel,burst = <2>;
+           intel,endian = <0>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@4 {
+           reg = <4>;
+           intel,name = "HSNAND";
+           intel,chans = <8 2>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@5 {
+           reg = <5>;
+           intel,name = "PCM";
+           intel,chans = <10 6>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+     };
+     dma-channels {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-channels@0 {
+           reg = <0>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@1 {
+           reg = <1>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@2 {
+           reg = <2>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@3 {
+           reg = <3>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@4 {
+           reg = <4>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@5 {
+           reg = <5>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@6 {
+           reg = <6>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@7 {
+           reg = <7>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@8 {
+           reg = <8>;
+       };
+       dma-channels@9 {
+           reg = <9>;
+       };
+       dma-channels@10 {
+           reg = <10>;
+       };
+       dma-channels@11 {
+           reg = <11>;
+       };
+       dma-channels@12 {
+           reg = <12>;
+       };
+       dma-channels@13 {
+           reg = <13>;
+       };
+       dma-channels@14 {
+           reg = <14>;
+       };
+       dma-channels@15 {
+           reg = <15>;
+       };
+     };
+   };
+ - |
+   dma3: dma@ec800000 {
+     compatible = "intel,lgm-dma3";
+     reg = <0xec800000 0x1000>;
+     clocks = <&cgu0 71>;
+     resets = <&rcu0 0x10 9>;
+     #dma-cells = <1>;
+     intel,dma-burst = <32>;
+     intel,dma-polling-cnt = <16>;
+     intel,dma-desc-in-sram;
+     intel,dma-orrc = <16>;
+     intel,dma-byte-en;
+     intel,dma-dburst-wr;
+     dma-channels {
+         #address-cells = <1>;
+         #size-cells = <0>;
+
+         dma-channels@12 {
+             reg = <12>;
+             intel,pkt_sz = <4096>;
+             intel,desc-rx-nonpost;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+             intel,hw-desc = <0x20000000 8>;
+         };
+         dma-channels@13 {
+             reg = <13>;
+             intel,pkt-drop;
+             intel,pkt_sz = <4096>;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+         };
+     };
+   };
--

2.11.0

#5 lore raw

Re: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

Thanks Rob for the review. Please see my comments inline.

Quoted 144 lines · Rob Herring
Quoted 98 lines · MallikarjunaX

Hi Thomas,

Thanks for the review. My comments inline.

Quoted 58 lines · Thomas
Quoted 22 lines

-----Original Message-----
From: [email protected] <devicetree- [email protected]> On Behalf Of Amireddy Mallikarjuna reddy
Sent: Donnerstag, 9. Juli 2020 08:01
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Shevchenko, Andriy <[email protected]>; [email protected]; Kim, Cheol Yong <[email protected]>; Wu, Qiming <[email protected]>; [email protected]; Amireddy Mallikarjuna reddy <[email protected]>
Subject: [PATCH v4 1/2] dt-bindings: dma: Add bindings for intel LGM SOC

Add DT bindings YAML schema for DMA controller driver of Lightning Mountain(LGM) SoC.

Signed-off-by: Amireddy Mallikarjuna reddy
<[email protected]>
---
v1:
- Initial version.

Quoted 8 lines

v2:
- Fix bot errors.

v3:
- No change.

v4:
- Address Thomas langer comments

Please read my comments again and then respond about the topics you ignored. I added some hints below again.

Thanks.

Quoted 23 lines
---
   .../devicetree/bindings/dma/intel,ldma.yaml        | 416
+++++++++++++++++++++
   1 file changed, 416 insertions(+)

create mode 100644
Documentation/devicetree/bindings/dma/intel,ldma.yaml

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
new file mode 100644
index 000000000000..7f666b9812e4
@@ -0,0 +1,416 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/intel,ldma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lightning Mountain centralized low speed DMA and high speed DMA

controllers.
+

Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 15

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+maintainers:
+  - [email protected]
+  - [email protected]
+
+properties:
+ $nodename:
+   pattern: "^dma(@.*)?$"

Please explain the difference to the common dma binding.

No difference. we can use "^dma-controller(@.*)?$" as in the common binding. Its My bad. I missed the changes to include in this patch. Surely update in the upcoming patch.

Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+
+ "#dma-cells":
+   const: 1
+
+ compatible:
+  anyOf:
+   - const: intel,lgm-cdma
Quoted 8 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 29

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+   - const: intel,lgm-dma2tx
+   - const: intel,lgm-dma1rx
+   - const: intel,lgm-dma1tx
+   - const: intel,lgm-dma0tx
+   - const: intel,lgm-dma3
+   - const: intel,lgm-toe-dma30
+   - const: intel,lgm-toe-dma31

Please explain why you need so many different compatible strings.

This hw dma has 7 DMA instances.
Some for datapath, some for memcpy  and some for TOE.
Some for TX only, some for RX only, and some for TX/RX(memcpy and ToE).

dma TX/RX type we considered as driver specific data of each instance and used different compatible strings for each instance.
And also idea is in future if any driver specific data of any particular instance we can handle.

Quoted 4 lines

Here if dma name and type(tx or rx) will be accepted as devicetree attributes then we can move .name = "toe_dma31", & .type = DMA_TYPE_MCPY to devicetree. So that the compatible strings can be limited to two. intel,lgm-cdma & intel,lgm-hdma .

Different compatibles are okay if the instances are different and we don't have properties to describe the differences.

For some of what you have in this binding, I think it should be part of the consumer cells.

Quoted 35 lines

please suggest us the better proposal.

Quoted 34 lines
Quoted 34 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +24 -0
+
+ reg:
+  maxItems: 1
+
+ clocks:
+  maxItems: 1
+
+ resets:
+  maxItems: 1
+
+ interrupts:
+  maxItems: 1
+
+ intel,dma-poll-cnt:
+   $ref: /schemas/types.yaml#definitions/uint32
+   description:
+     DMA descriptor polling counter. It may need fine tune according
+     to the system application scenario.
+
+ intel,dma-byte-en:
+   type: boolean
+   description:
+     DMA byte enable is only valid for DMA write(RX).
+     Byte enable(1) means DMA write will be based on the number of

dwords

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+     instead of the whole burst.
+
+ intel,dma-drb:
+    type: boolean
+    description:
+      DMA descriptor read back to make sure data and desc

synchronization.
+
+ intel,dma-burst:

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 67

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +3 -0
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       Specifiy the DMA burst size(in dwords), the valid value will be

8, 16, 32.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +3 -0
+       Default is 16 for data path dma, 32 is for memcopy DMA.
+
+ intel,dma-polling-cnt:

What's the difference with intel,dma-poll-cnt?

This is redundant. I will remove it.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +3 -0
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA descriptor polling counter. It may need fine tune according

to

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +12 -0
+       the system application scenario.
+
+ intel,dma-desc-in-sram:
+    type: boolean
+    description:
+       DMA descritpors in SRAM or not. Some old controllers descriptors
+       can be in DRAM or SRAM. The new ones are all in SRAM.
+
+ intel,dma-orrc:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+       DMA outstanding read counter. The maximum value is 16, and it

may

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+       need fine tune according to the system application scenarios.
+
+ intel,dma-dburst-wr:
+    type: boolean
+    description:
+       Enable RX dynamic burst write. It only applies to RX DMA and
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 94

Quoted 7 lines

memcopy DMA.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+
+
+ dma-ports:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA port.

What's a DMA port?

DMA port represent the peripheral.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +14 -0
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-ports@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5]
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 115

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+              description:
+                 Which port this node refers to.
+
+            intel,name:
+              $ref: /schemas/types.yaml#definitions/string-array
+              description:
+                 Port name of each DMA port.

Why do you need this?

we are using port name for
1. compare with name and and enable port configurations dynamically when it is enabled from devicetree.
2. for debug purpose.

Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,chans:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The channels included on this port. Format is channel

start
+ number and how many channels on this port.

We already have standard properties for defining channels.

I think you are reffering to 'dma-channels' property. This represents Number of DMA channels supported by the controller.

intel,chans attribute represents channels starting number and number of channels in this port. intel,chans = <channel starting number, number of channels in this port>

Quoted 157 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,burst:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port burst size, the valid value will

be
+ 2, 4, 8. Default is 2 for data path dma.

This would normally be in the consumer cells.

Quoted 110 lines
Quoted 110 lines
Quoted 110 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,txwgt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the port transmit weight for QoS purpose. The

valid

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+                 value is 1~7. Default value is 1.
+
+            intel,endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Specify the DMA port endiannes conversion due to SoC

endianness difference.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +25 -0
+
+          required:
+            - reg
+            - intel,name
+            - intel,chans
+
+
+ dma-channels:
+    type: object
+    description:
+       This sub-node must contain a sub-node for each DMA channel.
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^dma-channels@[0-9]+$":
+          type: object
+
+          properties:
+            reg:
+              items:
+                - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,

14, 15]

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +7 -0
+              description:
+                 Which channel this node refers to.
+
+            intel,desc_num:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel maximum descriptor number. The max value

is 255.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +11 -0
+
+            intel,pkt_sz:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Channel buffer packet size. It must be power of 2.
+                 The maximum size is 4096.
+
+            intel,desc-rx-nonpost:
+              type: boolean
+              description:
+                 Write non-posted type for DMA RX last data beat of

every descriptor.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,data-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel data endianness configuration according to

SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +5 -0
+
+            intel,desc-endian:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel descriptor endianness configuration

according to SoC requirement.

Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +39 -0
+
+            intel,data-endian-en:
+              type: boolean
+              description:
+                 Per channel data endianness enabled.
+
+            intel,desc-endian-en:
+              type: boolean
+              description:
+                 Per channel descriptor endianness enabled.
+
+            intel,byte-offset:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel byte offset(0~128).
+
+            intel,hdr-mode:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 The first parameter is header mode size, the second
+                 parameter is checksum enable or disable. If enabled,
+                 header mode size is ignored. If disabled, header mode
+                 size must be provided.
+
+            intel,non-arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel non arbitration counter while polling
+
+            intel,arb-cnt:
+              $ref: /schemas/types.yaml#/definitions/uint32
+              description:
+                 Per channel arbitration counter while polling.
+                 arb_cnt must be greater than non_arb_cnt
+
+            intel,pkt-drop:
+              type: boolean
+              description:
+                 Channel packet drop enabled or disabled.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+
+            intel,hw-desc:
+              $ref: /schemas/types.yaml#/definitions/uint32-array
+              description:
+                 Per channel dma hardware descriptor configuration.
+                 The first parameter is descriptor physical address and

the
+ second parameter hardware descriptor number.

All/most of these seem like client/consumer settings.

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +27 -0
+
+          required:
+            - reg
+
+required:
+ - compatible
+ - reg
+ - '#dma-cells'
+
+examples:
+ - |
+   dma0: dma@e0e00000 {
+     compatible = "intel,lgm-cdma";
+     reg = <0xe0e00000 0x1000>;
+     #dma-cells = <1>;
+     interrupt-parent = <&ioapic1>;
+     interrupts = <82 1>;
+     resets = <&rcu0 0x30 0>;
+     reset-names = "ctrl";
+     clocks = <&cgu0 80>;
+     intel,dma-poll-cnt = <4>;
+     intel,dma-byte-en;
+     intel,dma-drb;
+     dma-ports {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

Documentation/devicetree/bindings/dma/intel,ldma.yaml line 270

Quoted 6 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +6 -0
+       dma-ports@0 {
+           reg = <0>;
+           intel,name = "SPI0";
+           intel,chans = <0 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;

Yeah, based on the names, it definitely seems like these belong as cells in 'dmas' properties.

ok.
If we move these attributes to dmas, we need to configure these dynamically from driver side when client request for channel.

Both port and channel mapping is needed for dma slave configuration and also the available channels reading from device-tree dynamically instead of reading from registers. So port & channel id's and descriptor information will keep in the child nodes and other attributes like burst, txwgt will move to 'dmas'.

Quoted 148 lines
Quoted 148 lines
Quoted 148 lines
Quoted 148 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml new file +146 -1
+       };
+       dma-ports@1 {
+           reg = <1>;
+           intel,name = "SPI1";
+           intel,chans = <2 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@2 {
+           reg = <2>;
+           intel,name = "SPI2";
+           intel,chans = <4 2>;
+           intel,burst = <2>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@3 {
+           reg = <3>;
+           intel,name = "SPI3";
+           intel,chans = <6 2>;
+           intel,burst = <2>;
+           intel,endian = <0>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@4 {
+           reg = <4>;
+           intel,name = "HSNAND";
+           intel,chans = <8 2>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+       dma-ports@5 {
+           reg = <5>;
+           intel,name = "PCM";
+           intel,chans = <10 6>;
+           intel,burst = <8>;
+           intel,txwgt = <1>;
+       };
+     };
+     dma-channels {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       dma-channels@0 {
+           reg = <0>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@1 {
+           reg = <1>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@2 {
+           reg = <2>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@3 {
+           reg = <3>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@4 {
+           reg = <4>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@5 {
+           reg = <5>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@6 {
+           reg = <6>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@7 {
+           reg = <7>;
+           intel,desc_num = <1>;
+       };
+       dma-channels@8 {
+           reg = <8>;
+       };
+       dma-channels@9 {
+           reg = <9>;
+       };
+       dma-channels@10 {
+           reg = <10>;
+       };
+       dma-channels@11 {
+           reg = <11>;
+       };
+       dma-channels@12 {
+           reg = <12>;
+       };
+       dma-channels@13 {
+           reg = <13>;
+       };
+       dma-channels@14 {
+           reg = <14>;
+       };
+       dma-channels@15 {
+           reg = <15>;
+       };
+     };
+   };
+ - |
+   dma3: dma@ec800000 {
+     compatible = "intel,lgm-dma3";
+     reg = <0xec800000 0x1000>;
+     clocks = <&cgu0 71>;
+     resets = <&rcu0 0x10 9>;
+     #dma-cells = <1>;
+     intel,dma-burst = <32>;
+     intel,dma-polling-cnt = <16>;
+     intel,dma-desc-in-sram;
+     intel,dma-orrc = <16>;
+     intel,dma-byte-en;
+     intel,dma-dburst-wr;
+     dma-channels {
+         #address-cells = <1>;
+         #size-cells = <0>;
+
+         dma-channels@12 {
+             reg = <12>;
+             intel,pkt_sz = <4096>;
+             intel,desc-rx-nonpost;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+             intel,hw-desc = <0x20000000 8>;
+         };
+         dma-channels@13 {
+             reg = <13>;
+             intel,pkt-drop;
+             intel,pkt_sz = <4096>;
+             intel,data-endian = <0>;
+             intel,desc-endian = <0>;
+             intel,data-endian-en;
+             intel,desc-endian-en;
+             intel,byte-offset = <0>;
+             intel,hdr-mode = <128 0>;
+             intel,non-arb-cnt = <0>;
+             intel,arb-cnt = <0>;
+         };
+     };
+   };
--

2.11.0