Skip to contentSkip to conversation

dmaengine: lgm-dma: Move platfrom data to device tree

PATCH NAK Zhu Yixin 3 participants 14 messages Jul 30, 2025 – Jul 31, 2025

Subsystems (2)
lore
Share & tools
lore

Zhu Yixin

author
#0 lore raw

PATCH 1/5 dmaengine: lgm-dma: Move platfrom data to device tree

Remove platform data and unified the setting from device tree.

---
 .../devicetree/bindings/dma/intel,ldma.yaml   |  67 ++++-
 drivers/dma/lgm/lgm-dma.c                     | 242 +++++++-----------
 2 files changed, 144 insertions(+), 165 deletions(-)
Documentation/devicetree/bindings/dma/intel,ldma.yaml +55 -12
index d6bb553a2c6f..59f928297613 100644
@@ -7,8 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Lightning Mountain centralized DMA controllers.
 
 maintainers:
-  - [email protected]
-  - [email protected]
+  - [email protected]
 
 allOf:
   - $ref: dma-controller.yaml#
@@ -16,14 +15,7 @@ allOf:
 properties:
   compatible:
     enum:
-      - intel,lgm-cdma
-      - intel,lgm-dma2tx
-      - intel,lgm-dma1rx
-      - intel,lgm-dma1tx
-      - intel,lgm-dma0tx
-      - intel,lgm-dma3
-      - intel,lgm-toe-dma30
-      - intel,lgm-toe-dma31
+      - intel,lgm-ldma
 
   reg:
     maxItems: 1
@@ -80,16 +72,62 @@ properties:
       if it is disabled, the DMA RX will still support programmable fixed burst size of 2,4,8,16.
       It only applies to RX DMA and memcopy DMA.
 
+  intel,dma-flowctrl:
+    type: boolean
+    description:
+      DMA per-channel flow control.
+
+  intel,dma-fod:
+    type: boolean
+    description:
+      DMA fetch-on-demand.
+      It should only be enabled when DMA connected to a component that can
+      provide fetch-on-demand signal to DMA.
+
+  intel,dma-desc-in-sram:
+    type: boolean
+    description:
+      DMA descriptor in sram.
+      It only affects legacy DMA(V22)
+      DMA version V31 onwards, it is always enabled and setting ignored by
+      DMA HW.
+
+  intel,dma-desc-fack:
+    type: boolean
+    description:
+      DMA descriptor fetch acknowledgement.
+      This feature only takes effects if DMA fetch-on-demand is enabled.
+
+  intel,dma-orrc:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      DMA outstanding descriptor read.
+      The maximum orrc count is 16.
+
+  intel,dma-type:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      DMA type. Only valid for DMAV31 onwards.
+      DMA type TX is 0.
+      DMA type RX is 1.
+      DMA type MCPY is 2.
+
+  intel,dma-name:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Name of the DMA.
+
 required:
   - compatible
   - reg
+  - intel,dma-name
 
 additionalProperties: false
 
 examples:
   - |
     dma0: dma-controller@e0e00000 {
-      compatible = "intel,lgm-cdma";
+      compatible = "intel,lgm-ldma";
       reg = <0xe0e00000 0x1000>;
       #dma-cells = <3>;
       dma-channels = <16>;
@@ -102,10 +140,11 @@ examples:
       intel,dma-poll-cnt = <4>;
       intel,dma-byte-en;
       intel,dma-drb;
+      intel,dma-name = "dma0";
     };
   - |
     dma3: dma-controller@ec800000 {
-      compatible = "intel,lgm-dma3";
+      compatible = "intel,lgm-ldma";
       reg = <0xec800000 0x1000>;
       clocks = <&cgu0 71>;
       resets = <&rcu0 0x10 9>;
@@ -113,4 +152,8 @@ examples:
       intel,dma-poll-cnt = <16>;
       intel,dma-byte-en;
       intel,dma-dburst-wr;
+      intel,dma-type = <2>;
+      intel,dma-desc-in-sram;
+      intel,dma-name = "dma3";
+      intel,dma-orrc = <16>;
     };
drivers/dma/lgm/lgm-dma.c +89 -153

389 lines not on this page · raw message

Signature · 1 line
2.43.5
author
#1 lore raw

PATCH 2/5 dmaengine: lgm-dma: Correct ORRC MAX counter value.

The maximum ORRC counter is 16.
Sanity check and recify the value when get from device tree.

---
 drivers/dma/lgm/lgm-dma.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/dma/lgm/lgm-dma.c +8 -7
index 93438cc9f020..ea185c5de1b2 100644
@@ -140,8 +140,7 @@
 #define DMA_VALID_DESC_FETCH_ACK	BIT(7)
 #define DMA_DFT_DRB			BIT(8)
 
-#define DMA_DFT_ORRC_CNT		16
-#define DMA_ORRC_MAX_CNT		(SZ_32 - 1)
+#define DMA_ORRC_MAX_CNT		16
 #define DMA_DFT_POLL_CNT		SZ_4
 #define DMA_DFT_BURST_V22		SZ_2
 #define DMA_BURSTL_8DW			SZ_8
@@ -406,12 +405,11 @@ static void ldma_dev_orrc_cfg(struct ldma_dev *d)
 	u32 val = 0;
 	u32 mask;
 
-	if (d->type == DMA_TYPE_RX)
+	if (d->type == DMA_TYPE_RX || !d->orrc)
 		return;
 
 	mask = DMA_ORRC_EN | DMA_ORRC_ORRCNT;
-	if (d->orrc > 0 && d->orrc <= DMA_ORRC_MAX_CNT)
-		val = DMA_ORRC_EN | FIELD_PREP(DMA_ORRC_ORRCNT, d->orrc);
+	val = DMA_ORRC_EN | FIELD_PREP(DMA_ORRC_ORRCNT, d->orrc);
 
 	spin_lock_irqsave(&d->dev_lock, flags);
 	ldma_update_bits(d, mask, val, DMA_ORRC);
@@ -946,8 +944,11 @@ static int ldma_parse_dt(struct ldma_dev *d)
 		d->pollcnt = DMA_DFT_POLL_CNT;
 
 	if (fwnode_property_read_u32(fwnode, "intel,dma-orrc",
-				     &d->orrc))
-		d->orrc = DMA_DFT_ORRC_CNT;
+				     &d->orrc)) {
+		d->orrc = 0;
+	} else if (d->orrc > DMA_ORRC_MAX_CNT) {
+		d->orrc = DMA_ORRC_MAX_CNT;
+	}
 
 	if (fwnode_property_read_u32(fwnode, "intel,dma-type",
 				     &d->type))
Signature · 1 line
2.43.5
author
#2 lore raw

PATCH 3/5 dmaengine: lgm-dma: split legacy DMA and HDMA functions

In reply to Zhu Yixin

Move legacy DMA functions into lgm-cdma.c. Move HDMA functions into lgm-hdma.c
Keep the driver flow and general functions in lgm-dma.c

---
 .../devicetree/bindings/dma/intel,ldma.yaml   |   7 +-
 drivers/dma/lgm/Makefile                      |   2 +-
 drivers/dma/lgm/lgm-cdma.c                    | 492 ++++++++++
 drivers/dma/lgm/lgm-dma.c                     | 839 ++----------------
 drivers/dma/lgm/lgm-dma.h                     | 278 ++++++
 drivers/dma/lgm/lgm-hdma.c                    | 130 +++
 6 files changed, 961 insertions(+), 787 deletions(-)
 create mode 100644 drivers/dma/lgm/lgm-cdma.c
 create mode 100644 drivers/dma/lgm/lgm-dma.h
 create mode 100644 drivers/dma/lgm/lgm-hdma.c
Documentation/devicetree/bindings/dma/intel,ldma.yaml +4 -3
index 59f928297613..f91d849edc4c 100644
@@ -15,7 +15,8 @@ allOf:
 properties:
   compatible:
     enum:
-      - intel,lgm-ldma
+      - intel,lgm-cdma
+      - intel,lgm-hdma
 
   reg:
     maxItems: 1
@@ -127,7 +128,7 @@ additionalProperties: false
 examples:
   - |
     dma0: dma-controller@e0e00000 {
-      compatible = "intel,lgm-ldma";
+      compatible = "intel,lgm-cdma";
       reg = <0xe0e00000 0x1000>;
       #dma-cells = <3>;
       dma-channels = <16>;
@@ -144,7 +145,7 @@ examples:
     };
   - |
     dma3: dma-controller@ec800000 {
-      compatible = "intel,lgm-ldma";
+      compatible = "intel,lgm-hdma";
       reg = <0xec800000 0x1000>;
       clocks = <&cgu0 71>;
       resets = <&rcu0 0x10 9>;
drivers/dma/lgm/Makefile +1 -1
index f318a8eff464..1246082253ff 100644
@@ -1,2 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_INTEL_LDMA)	+= lgm-dma.o
+obj-$(CONFIG_INTEL_LDMA)	+= lgm-dma.o lgm-cdma.o lgm-hdma.o
drivers/dma/lgm/lgm-cdma.c new file +492 -0

492 lines not on this page · raw message

drivers/dma/lgm/lgm-dma.c +56 -783

968 lines not on this page · raw message

drivers/dma/lgm/lgm-dma.h new file +278 -0

278 lines not on this page · raw message

drivers/dma/lgm/lgm-hdma.c new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
2.43.5
#3 lore raw

Re: [PATCH 3/5] dmaengine: lgm-dma: split legacy DMA and HDMA functions

Quoted 22 lines · Zhu Yixin

Move legacy DMA functions into lgm-cdma.c. Move HDMA functions into lgm-hdma.c
Keep the driver flow and general functions in lgm-dma.c

---
 .../devicetree/bindings/dma/intel,ldma.yaml   |   7 +-
 drivers/dma/lgm/Makefile                      |   2 +-
 drivers/dma/lgm/lgm-cdma.c                    | 492 ++++++++++
 drivers/dma/lgm/lgm-dma.c                     | 839 ++----------------
 drivers/dma/lgm/lgm-dma.h                     | 278 ++++++
 drivers/dma/lgm/lgm-hdma.c                    | 130 +++
 6 files changed, 961 insertions(+), 787 deletions(-)
 create mode 100644 drivers/dma/lgm/lgm-cdma.c
 create mode 100644 drivers/dma/lgm/lgm-dma.h
 create mode 100644 drivers/dma/lgm/lgm-hdma.c
Documentation/devicetree/bindings/dma/intel,ldma.yaml +0 -0
index 59f928297613..f91d849edc4c 100644

Documentation/devicetree/bindings/dma/intel,ldma.yaml allOf: · line 19

Quoted 6 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml +2 -1
@@ -15,7 +15,8 @@ allOf:
 properties:
   compatible:
     enum:
-      - intel,lgm-ldma
+      - intel,lgm-cdma
+      - intel,lgm-hdma

NAK, stop random changes to compatibles.

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

author
#4 lore raw

RE: [PATCH 3/5] dmaengine: lgm-dma: split legacy DMA and HDMA functions

Hi Krzysztof,

Quoted 24 lines · Krzysztof Kozlowski

NAK, stop random changes to compatibles.

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from - -strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Quoted 6 lines

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

I'll re-organize the patches to avoid random changes to compatibles and submit an updated version.

Best regards,
Yixin

author
#5 lore raw

PATCH 4/5 dmaengine: lgm-dma: Added HDMA software mode TX function.

In reply to Zhu Yixin

Added HDMA software mode to handle DMA TX functions.

---
 .../devicetree/bindings/dma/intel,ldma.yaml   |   6 +
 drivers/dma/lgm/lgm-cdma.c                    |  42 +-
 drivers/dma/lgm/lgm-dma.c                     | 189 +++++---
 drivers/dma/lgm/lgm-dma.h                     |  31 +-
 drivers/dma/lgm/lgm-hdma.c                    | 453 +++++++++++++++++-
 5 files changed, 608 insertions(+), 113 deletions(-)
Documentation/devicetree/bindings/dma/intel,ldma.yaml +6 -0
index f91d849edc4c..e58f1d13aee3 100644
@@ -118,6 +118,11 @@ properties:
     description:
       Name of the DMA.
 
+  intel,dma-hw-desc:
+    type: boolean
+    description:
+      DMA descriptor manupulated by Hardware.
+
 required:
   - compatible
   - reg
@@ -157,4 +162,5 @@ examples:
       intel,dma-desc-in-sram;
       intel,dma-name = "dma3";
       intel,dma-orrc = <16>;
+      intel,dma-hw-desc;
     };
drivers/dma/lgm/lgm-cdma.c +14 -28

120 lines not on this page · raw message

drivers/dma/lgm/lgm-dma.c +121 -68

363 lines not on this page · raw message

drivers/dma/lgm/lgm-dma.h +26 -5
index ff5aa5142019..d6692b80e329 100644
@@ -39,7 +39,7 @@ struct ldma_ops {
 	/* DMA interrupt init */
 	int (*dma_irq_init)(struct ldma_dev *d, struct platform_device *pdev);
 	/* DMA callback API init */
-	void (*dma_func_init)(struct dma_device *dma_dev);
+	void (*dma_func_init)(struct ldma_dev *d, struct dma_device *dma_dev);
 };
 
 struct ldma_chan {
@@ -218,6 +218,7 @@ extern struct ldma_ops hdma_ops;
 #define DMA_DBURST_WR			BIT(6)
 #define DMA_VALID_DESC_FETCH_ACK	BIT(7)
 #define DMA_DFT_DRB			BIT(8)
+#define DMA_CHAN_HW_DESC		BIT(9)
 
 #define DMA_ORRC_MAX_CNT		16
 #define DMA_DFT_POLL_CNT		SZ_4
@@ -236,12 +237,10 @@ extern struct ldma_ops hdma_ops;
 /* DMA flags */
 #define DMA_TX_CH			BIT(0)
 #define DMA_RX_CH			BIT(1)
-#define DEVICE_ALLOC_DESC		BIT(2)
-#define CHAN_IN_USE			BIT(3)
-#define DMA_HW_DESC			BIT(4)
+#define CHAN_IN_USE			BIT(2)
+#define DMA_HW_DESC			BIT(3)
 
 /* Descriptor fields */
-#define DESC_DATA_LEN			GENMASK(15, 0)
 #define DESC_BYTE_OFF			GENMASK(25, 23)
 #define DESC_EOP			BIT(28)
 #define DESC_SOP			BIT(29)
@@ -267,6 +266,28 @@ static inline struct ldma_dev *to_ldma_dev(struct dma_device *dma_dev)
 	return container_of(dma_dev, struct ldma_dev, dma_dev);
 }
 
+static inline bool ldma_chan_is_hw_desc(struct ldma_chan *c)
+{
+	return !!(c->flags & DMA_HW_DESC);
+}
+
+static inline struct ldma_dev *chan_to_ldma_dev(struct ldma_chan *c)
+{
+	return to_ldma_dev(c->vchan.chan.device);
+}
+
+static inline void
+ldma_update_bits(struct ldma_dev *d, u32 mask, u32 val, u32 ofs)
+{
+	u32 old_val, new_val;
+
+	old_val = readl(d->base +  ofs);
+	new_val = (old_val & ~mask) | (val & mask);
+
+	if (new_val != old_val)
+		writel(new_val, d->base + ofs);
+}
+
 void ldma_chan_desc_hw_cfg(struct ldma_chan *c, dma_addr_t desc_base,
 			   int desc_num);
 int ldma_terminate_all(struct dma_chan *chan);
drivers/dma/lgm/lgm-hdma.c +441 -12

532 lines not on this page · raw message

Signature · 1 line
2.43.5
#6 lore raw

Re: [PATCH 4/5] dmaengine: lgm-dma: Added HDMA software mode TX function.

Quoted 16 lines · Zhu Yixin

Added HDMA software mode to handle DMA TX functions.

---
 .../devicetree/bindings/dma/intel,ldma.yaml   |   6 +
 drivers/dma/lgm/lgm-cdma.c                    |  42 +-
 drivers/dma/lgm/lgm-dma.c                     | 189 +++++---
 drivers/dma/lgm/lgm-dma.h                     |  31 +-
 drivers/dma/lgm/lgm-hdma.c                    | 453 +++++++++++++++++-
 5 files changed, 608 insertions(+), 113 deletions(-)
Documentation/devicetree/bindings/dma/intel,ldma.yaml +0 -0
index f91d849edc4c..e58f1d13aee3 100644

Documentation/devicetree/bindings/dma/intel,ldma.yaml properties: · line 124

Quoted 7 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml +4 -0
@@ -118,6 +118,11 @@ properties:
     description:
       Name of the DMA.
 
+  intel,dma-hw-desc:
+    type: boolean
+    description:
+      DMA descriptor manupulated by Hardware.

Your commit msg explains nothing, so basically: no. Write proper commit msgs documenting hardware, not software.

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

author
#7 lore raw

RE: [PATCH 4/5] dmaengine: lgm-dma: Added HDMA software mode TX function.

Hi Krzysztof,

Quoted 25 lines · Krzysztof Kozlowski

Your commit msg explains nothing, so basically: no. Write proper commit msgs documenting hardware, not software.

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from - -strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Quoted 5 lines

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

I'll update the commit message and write proper descriptions to explain the patch functions.

Best regards,
Yixin

#8 lore raw

Re: [PATCH 4/5] dmaengine: lgm-dma: Added HDMA software mode TX function.

In reply to Zhu Yixin
kernel test robot noticed the following build warnings:

Hi Zhu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v6.16 next-20250730] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Zhu-Yixin/dmaengine-lgm-dma-Correct-ORRC-MAX-counter-value/20250730-105748
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link:    https://lore.kernel.org/r/20250730024547.3160871-4-yzhu%40maxlinear.com
patch subject: [PATCH 4/5] dmaengine: lgm-dma: Added HDMA software mode TX function.
config: i386-buildonly-randconfig-003-20250730 (https://download.01.org/0day-ci/archive/20250730/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250730/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/dma/lgm/lgm-hdma.c: In function 'hdma_irq_stat':

>> drivers/dma/lgm/lgm-hdma.c:253:27: warning: left shift count >= width of type [-Wshift-count-overflow]
     253 |         return high ? ret << 32 : ret;
         |                           ^~
   In file included from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:5,
                    from drivers/dma/lgm/lgm-hdma.c:10:
   drivers/dma/lgm/lgm-hdma.c: In function 'hdma_alloc_chan_resources':
>> drivers/dma/lgm/lgm-hdma.c:339:22: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
     339 |         dev_dbg(dev, "DMA CH: %u, phy addr: 0x%llx, desc cnt: %u\n",
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:139:49: note: in definition of macro 'dev_no_printk'
     139 |                         _dev_printk(level, dev, fmt, ##__VA_ARGS__);    \
         |                                                 ^~~
   include/linux/dev_printk.h:171:40: note: in expansion of macro 'dev_fmt'
     171 |         dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                        ^~~~~~~
   drivers/dma/lgm/lgm-hdma.c:339:9: note: in expansion of macro 'dev_dbg'
     339 |         dev_dbg(dev, "DMA CH: %u, phy addr: 0x%llx, desc cnt: %u\n",
         |         ^~~~~~~
   drivers/dma/lgm/lgm-hdma.c:339:50: note: format string is defined here
     339 |         dev_dbg(dev, "DMA CH: %u, phy addr: 0x%llx, desc cnt: %u\n",
         |                                               ~~~^
         |                                                  |
         |                                                  long long unsigned int
         |                                               %x
   drivers/dma/lgm/lgm-hdma.c: In function 'hdma_prep_slave_sg':
>> drivers/dma/lgm/lgm-hdma.c:508:29: warning: variable 'desc_hw' set but not used [-Wunused-but-set-variable]
     508 |         struct dw4_desc_hw *desc_hw;
         |                             ^~~~~~~

vim +253 drivers/dma/lgm/lgm-hdma.c

213
214 static unsigned long hdma_irq_stat(struct ldma_dev *d, int high)
215 {
216 u32 irnen, irncr, en_off, cr_off, cid;
217 unsigned long flags;
218 unsigned long ret;
219
220 spin_lock_irqsave(&d->dev_lock, flags);
221
222 hdma_get_irq_off(high, &en_off, &cr_off);
223
224 irncr = readl(d->base + cr_off);
225 irnen = readl(d->base + en_off);
226
227 if (!irncr || !irnen || !(irncr & irnen)) {
228 writel(irncr, d->base + cr_off);
229 spin_unlock_irqrestore(&d->dev_lock, flags);
230 return 0;
231 }
232
233 /* disable EOP interrupt for the channel */
234 for_each_set_bit(cid, (const unsigned long *)&irncr, d->chan_nrs) {
235 /* select DMA channel */
236 ldma_update_bits(d, DMA_CS_MASK, cid, DMA_CS);
237 /* Clear EOP interrupt status */
238 writel(readl(d->base + DMA_CIS), d->base + DMA_CIS);
239 /* Disable EOP interrupt */
240 writel(0, d->base + DMA_CIE);
241 }
242
243 /* ACK interrupt */
244 writel(irncr, d->base + cr_off);
245 irnen &= ~irncr;
246 /* Disable interrupt */
247 writel(irnen, d->base + en_off);
248
249 spin_unlock_irqrestore(&d->dev_lock, flags);
250
251 ret = irncr;
252

 > 253		return high ? ret << 32 : ret;
   254	}
   255	
   256	static irqreturn_t hdma_interrupt(int irq, void *dev_id)
   257	{
   258		struct ldma_dev *d = dev_id;
   259		struct hdma_chan *chan;
   260		u32 cid;
   261		unsigned long stat;
   262	
   263		stat = hdma_irq_stat(d, 0) | hdma_irq_stat(d, 1);
   264		if (!stat)
   265			return IRQ_HANDLED;
   266	
   267		for_each_set_bit(cid, (const unsigned long *)&stat, d->chan_nrs) {
   268			chan = (struct hdma_chan *)d->chans[cid].priv;
   269			tasklet_schedule(&chan->task);
   270		}
   271	
   272		return IRQ_HANDLED;
   273	}
   274	
   275	static int hdma_irq_init(struct ldma_dev *d, struct platform_device *pdev)
   276	{
   277		if (d->flags & DMA_CHAN_HW_DESC)
   278			return 0;
   279	
   280		d->irq = platform_get_irq(pdev, 0);
   281		if (d->irq < 0)
   282			return d->irq;
   283	
   284		return devm_request_irq(d->dev, d->irq, hdma_interrupt, 0,
   285					DRIVER_NAME, d);
   286	}
   287	
   288	/**
   289	 * Allocate DMA descriptor list
   290	 */
   291	static int hdma_alloc_chan_resources(struct dma_chan *dma_chan)
   292	{
   293		struct ldma_chan *c = to_ldma_chan(dma_chan);
   294		struct hdma_chan *chan = (struct hdma_chan *)c->priv;
   295		struct device *dev = c->vchan.chan.device->dev;
   296		struct dw4_desc_sw *desc_sw;
   297		struct dw4_desc_hw *desc_hw;
   298		size_t desc_sz;
   299		int i;
   300	
   301		/* HW allocate DMA descriptors */
   302		if (ldma_chan_is_hw_desc(c)) {
   303			c->flags |= CHAN_IN_USE;
   304			dev_dbg(dev, "desc in hw\n");
   305			return 0;
   306		}
   307	
   308		if (!c->desc_cnt) {
   309			dev_err(dev, "descriptor count is not set\n");
   310			return -EINVAL;
   311		}
   312	
   313		desc_sz = c->desc_cnt * sizeof(*desc_hw);
   314	
   315		c->desc_base = kzalloc(desc_sz, GFP_KERNEL);
   316		if (!c->desc_base)
   317			return -ENOMEM;
   318	
   319		c->desc_phys = dma_map_single(dev, c->desc_base,
   320					      desc_sz, DMA_TO_DEVICE);
   321		if (dma_mapping_error(dev, c->desc_phys)) {
   322			dev_err(dev, "dma mapping error for dma desc list\n");
   323			goto desc_err;
   324		}
   325	
   326		desc_sz = c->desc_cnt * sizeof(*desc_sw);
   327		chan->ds = kzalloc(desc_sz, GFP_KERNEL);
   328	
   329		if (!chan->ds)
   330			goto desc_err;
   331	
   332		desc_hw = (struct dw4_desc_hw *)c->desc_base;
   333		for (i = 0; i < c->desc_cnt; i++) {
   334			desc_sw = chan->ds + i;
   335			desc_sw->chan = c;
   336			desc_sw->desc_hw = desc_hw + i;
   337		}
   338	
 > 339		dev_dbg(dev, "DMA CH: %u, phy addr: 0x%llx, desc cnt: %u\n",

340 c->nr, c->desc_phys, c->desc_cnt);
341
342 ldma_chan_desc_hw_cfg(c, c->desc_phys, c->desc_cnt);
343 ldma_chan_on(c);
344
345 return c->desc_cnt;
346
347 desc_err:
348 kfree(c->desc_base);
349 return -EINVAL;
350 }
351

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author
#9 lore raw

PATCH 5/5 dmaengine: lgm_dma: Added HDMA RX interrupt handle functions.

In reply to Zhu Yixin

Enhanced tasklet function to handle HDMA RX interrupt.

---
 drivers/dma/lgm/lgm-hdma.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/dma/lgm/lgm-hdma.c +16 -4
index 198005b48d59..531d2b2f51b7 100644
@@ -31,6 +31,12 @@
 #define DESC_C			BIT(30)
 #define DESC_OWN		BIT(31)
 
+/* RX sideband information from DMA */
+struct dma_rx_data {
+	unsigned int	data_len;
+	unsigned int	chno;
+};
+
 struct dw4_desc_hw {
 	u32 dw0;
 	u32 dw1;
@@ -68,7 +74,7 @@ static int hdma_chan_init(struct ldma_dev *d, struct ldma_chan *c);
 static int hdma_irq_init(struct ldma_dev *d, struct platform_device *pdev);
 static void hdma_func_init(struct ldma_dev *d, struct dma_device *dma_dev);
 static void hdma_free_chan_resources(struct dma_chan *dma_chan);
-static void dma_tx_chan_complete(struct tasklet_struct *t);
+static void dma_chan_complete(struct tasklet_struct *t);
 
 static inline
 struct dw4_desc_sw *to_lgm_dma_dw4_desc(struct virt_dma_desc *vd)
@@ -140,8 +146,7 @@ static int hdma_chan_init(struct ldma_dev *d, struct ldma_chan *c)
 
 	c->priv = chan;
 	chan->c = c;
-	if (is_dma_chan_tx(d))
-		tasklet_setup(&chan->task, dma_tx_chan_complete);
+	tasklet_setup(&chan->task, dma_chan_complete);
 
 	return 0;
 }
@@ -177,7 +182,7 @@ void hdma_chan_int_enable(struct ldma_dev *d, struct ldma_chan *c)
 	spin_unlock_irqrestore(&d->dev_lock, flags);
 }
 
-static void dma_tx_chan_complete(struct tasklet_struct *t)
+static void dma_chan_complete(struct tasklet_struct *t)
 {
 	struct hdma_chan *chan = from_tasklet(chan, t, task);
 	struct ldma_chan *c = chan->c;
@@ -185,6 +190,7 @@ static void dma_tx_chan_complete(struct tasklet_struct *t)
 
 	/* check how many valid descriptor from DMA */
 	while (chan->prep_desc_cnt > 0) {
+		struct dma_rx_data *data;
 		struct dmaengine_desc_callback cb;
 		struct dma_async_tx_descriptor *tx;
 		struct dw4_desc_sw *desc_sw;
@@ -202,6 +208,12 @@ static void dma_tx_chan_complete(struct tasklet_struct *t)
 		tx = &desc_sw->vd.tx;
 		dmaengine_desc_get_callback(tx, &cb);
 
+		if (is_dma_chan_rx(d)) {
+			data = (struct dma_rx_data *)cb.callback_param;
+			data->data_len = FIELD_GET(DESC_DATA_LEN, desc_hw->dw3);
+			data->chno = c->nr;
+		}
+
 		dma_cookie_complete(tx);
 		chan->comp_idx = (chan->comp_idx + 1) % c->desc_cnt;
 		chan->prep_desc_cnt -= 1;
Signature · 1 line
2.43.5
#10 lore raw
In reply to Zhu Yixin
Quoted 6 lines · Zhu Yixin

Remove platform data and unified the setting from device tree.

---
 .../devicetree/bindings/dma/intel,ldma.yaml   |  67 ++++-
 drivers/dma/lgm/lgm-dma.c                     | 242 +++++++-----------

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Quoted 19 lines
 2 files changed, 144 insertions(+), 165 deletions(-)
Documentation/devicetree/bindings/dma/intel,ldma.yaml +1 -2
index d6bb553a2c6f..59f928297613 100644
@@ -7,8 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Lightning Mountain centralized DMA controllers.
 
 maintainers:
-  - [email protected]
-  - [email protected]
+  - [email protected]
 
 allOf:
   - $ref: dma-controller.yaml#
@@ -16,14 +15,7 @@ allOf:
 properties:
   compatible:

Documentation/devicetree/bindings/dma/intel,ldma.yaml allOf: · line 18

Quoted 10 lines
Documentation/devicetree/bindings/dma/intel,ldma.yaml +1 -8
     enum:
-      - intel,lgm-cdma
-      - intel,lgm-dma2tx
-      - intel,lgm-dma1rx
-      - intel,lgm-dma1tx
-      - intel,lgm-dma0tx
-      - intel,lgm-dma3
-      - intel,lgm-toe-dma30
-      - intel,lgm-toe-dma31
+      - intel,lgm-ldma

Nothing explains why you break the ABI.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

author
#11 lore raw

Hi Krzysztof,

Quoted 5 lines · Krzysztof Kozlowski

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from - -strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

I'll run checkpatch.pl --strict on patches and submit an updated version.

Quoted 18 lines · Krzysztof Kozlowski

Nothing explains why you break the ABI.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Quoted 7 lines

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

I'll include detailed comments to explain why the compatible change is required. And correct the mailing list in the next patch submission.

Best regards,
Yixin

#12 lore raw
Quoted 7 lines · Yi xin Zhu
Quoted 5 lines

Best regards,
Krzysztof

I'll include detailed comments to explain why the compatible change is required.

It is unlikely you will come with good arguments for breaking ABI. Anyway, if you keep going that way, explain in terms of ABI impact.

See also ABI docs, writing bindings and submitting patches.

Best regards,
Krzysztof

author
#13 lore raw

Hi Krzysztof,

Quoted 9 lines · Krzysztof Kozlowski

It is unlikely you will come with good arguments for breaking ABI. Anyway, if you keep going that way, explain in terms of ABI impact.

See also ABI docs, writing bindings and submitting patches.

Best regards,
Krzysztof

Okay, I'll revert that part of the changes and re-submit the patch.

Best regards,
Yixin