Skip to contentSkip to conversation

dmaengine: Add support for AM62A SoC DMAs

PATCH Superseded Vignesh Raghavendra 3 participants 13 messages Dec 6, 2022 – Dec 12, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

cover dmaengine: Add support for AM62A SoC DMAs

This series introduces support for various DMAs on TI's AM62A SoC under K3 family of devices.

Apart from usual BCDMA and PKTDMA thats present on K3 family, AM62A has a dedicated BCDMA for camera (CSI) with only RX DMA Channels.

Patch 1 adds bindings for this new DMA instance Patch 2 fixes a bug that gets exposed due to RX only DMA Patch 3 and 4 add base support for AM62A DMA Patch 5 does BCDMA CSI RX specific enhancements.

Jai Luthra (1):
dmaengine: ti: k3-psil-am62a: Add AM62Ax PSIL and PDMA data

Vignesh Raghavendra (4):
dt-bindings: dma: ti: k3-bcdma: Add bindings for BCDMA CSI RX
dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN
dmaengine: ti: k3-udma: Add support for DMAs on AM62A SoC
dmaengine: ti: k3-udma: Add support for BCDMA CSI RX

 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  |  87 +++++---
 drivers/dma/ti/Makefile                       |   3 +-
 drivers/dma/ti/k3-psil-am62a.c                | 196 ++++++++++++++++++
 drivers/dma/ti/k3-psil-priv.h                 |   1 +
 drivers/dma/ti/k3-psil.c                      |   1 +
 drivers/dma/ti/k3-udma.c                      |  39 +++-
 6 files changed, 297 insertions(+), 30 deletions(-)
 create mode 100644 drivers/dma/ti/k3-psil-am62a.c
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH 1/5 dt-bindings: dma: ti: k3-bcdma: Add bindings for BCDMA CSI RX

AM62A SoC has a dedicated BCDMA that serves Camera Serial Interface (CSI) IP. Add new compatible for the same. Unlike system BCDMA, this instance only has RX DMA channels and lack TX or block copy channel. Thus make those properties optional. Additionally CSI RX has independent power domain, add the binding for the same.

---
 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 87 ++++++++++++++-----
 1 file changed, 63 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +63 -24
index 08627d91e607..d7b5adbb9b2e 100644
@@ -32,9 +32,66 @@ allOf:
   - $ref: /schemas/dma/dma-controller.yaml#
   - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,am62a-dmss-bcdma-csirx
+    then:
+      properties:
+        ti,sci-rm-range-bchan: false
+        ti,sci-rm-range-tchan: false
+
+        reg:
+          maxItems: 3
+
+        reg-names:
+          items:
+            - const: gcfg
+            - const: rchanrt
+            - const: ringrt
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-rchan
+        - power-domains
+
+    else:
+      properties:
+        reg:
+          maxItems: 5
+
+        reg-names:
+          items:
+            - const: gcfg
+            - const: bchanrt
+            - const: rchanrt
+            - const: tchanrt
+            - const: ringrt
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-bchan
+        - ti,sci-rm-range-tchan
+        - ti,sci-rm-range-rchan
+
 properties:
   compatible:
-    const: ti,am64-dmss-bcdma
+    enum:
+      - ti,am64-dmss-bcdma
+      - ti,am62a-dmss-bcdma-csirx
 
   "#dma-cells":
     const: 3
@@ -65,19 +122,13 @@ properties:
 
       cell 3: ASEL value for the channel
 
-  reg:
-    maxItems: 5
-
-  reg-names:
-    items:
-      - const: gcfg
-      - const: bchanrt
-      - const: rchanrt
-      - const: tchanrt
-      - const: ringrt
-
   msi-parent: true
 
+  power-domains:
+    description:
+      Power domain if available
+    maxItems: 1
+
   ti,asel:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: ASEL value for non slave channels
@@ -115,18 +166,6 @@ properties:
     items:
       maximum: 0x3f
 
-required:
-  - compatible
-  - "#dma-cells"
-  - reg
-  - reg-names
-  - msi-parent
-  - ti,sci
-  - ti,sci-dev-id
-  - ti,sci-rm-range-bchan
-  - ti,sci-rm-range-tchan
-  - ti,sci-rm-range-rchan
-
 unevaluatedProperties: false
 
 examples:
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH 1/5] dt-bindings: dma: ti: k3-bcdma: Add bindings for BCDMA CSI RX

Quoted 16 lines · Vignesh Raghavendra

AM62A SoC has a dedicated BCDMA that serves Camera Serial Interface (CSI) IP. Add new compatible for the same. Unlike system BCDMA, this instance only has RX DMA channels and lack TX or block copy channel. Thus make those properties optional. Additionally CSI RX has independent power domain, add the binding for the same.

---
 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 87 ++++++++++++++-----
 1 file changed, 63 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -0
index 08627d91e607..d7b5adbb9b2e 100644

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 34

Quoted 3 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -0
@@ -32,9 +32,66 @@ allOf:
   - $ref: /schemas/dma/dma-controller.yaml#
   - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
 

When adding if:then:, please move entire allOf after "required:" part.

Quoted 8 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +8 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,am62a-dmss-bcdma-csirx
+    then:
+      properties:
+        ti,sci-rm-range-bchan: false

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 52

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +10 -0
+        ti,sci-rm-range-tchan: false
+
+        reg:
+          maxItems: 3
+
+        reg-names:
+          items:
+            - const: gcfg
+            - const: rchanrt
+            - const: ringrt

With my changes further this can be only "maxItems: 3"

Quoted 14 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +14 -0
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-rchan
+        - power-domains
+
+    else:
+      properties:

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 76

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +10 -0
+        reg:
+          maxItems: 5
+
+        reg-names:
+          items:
+            - const: gcfg
+            - const: bchanrt
+            - const: rchanrt
+            - const: tchanrt
+            - const: ringrt

With my changes further this can be only "minItems: 5"

Quoted 9 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +9 -0
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 94

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +7 -1
+        - ti,sci-rm-range-bchan
+        - ti,sci-rm-range-tchan
+        - ti,sci-rm-range-rchan
+
 properties:
   compatible:
-    const: ti,am64-dmss-bcdma
+    enum:
+      - ti,am64-dmss-bcdma
+      - ti,am62a-dmss-bcdma-csirx

Keep some order, e.g. alphabetical. This reduces later conflicts on simultaneous edits.

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 69

Quoted 9 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -2
   "#dma-cells":
     const: 3
@@ -65,19 +122,13 @@ properties:
 
       cell 3: ASEL value for the channel
 
-  reg:
-    maxItems: 5

Keep it here with widest constrains - minItems: 3, maxItems: 5

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 77

Quoted 8 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -8
-
-  reg-names:
-    items:
-      - const: gcfg
-      - const: bchanrt
-      - const: rchanrt
-      - const: tchanrt
-      - const: ringrt

Keep the list here with minItems: 3

Quoted 16 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +5 -2
-
   msi-parent: true
 
+  power-domains:
+    description:
+      Power domain if available
+    maxItems: 1
+
   ti,asel:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: ASEL value for non slave channels
@@ -115,18 +166,6 @@ properties:
     items:
       maximum: 0x3f
 
-required:

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 128

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -10
-  - compatible
-  - "#dma-cells"
-  - reg
-  - reg-names
-  - msi-parent
-  - ti,sci
-  - ti,sci-dev-id
-  - ti,sci-rm-range-bchan
-  - ti,sci-rm-range-tchan
-  - ti,sci-rm-range-rchan

Keep required here. Customize it if needed in if:then:else.

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 171

Quoted 4 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -1
-
 unevaluatedProperties: false
 
 examples:

Best regards,
Krzysztof

author maintainer
#3 lore raw

Re: [PATCH 1/5] dt-bindings: dma: ti: k3-bcdma: Add bindings for BCDMA CSI RX

Hi Krzysztof,

Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Vignesh Raghavendra

AM62A SoC has a dedicated BCDMA that serves Camera Serial Interface (CSI) IP. Add new compatible for the same. Unlike system BCDMA, this instance only has RX DMA channels and lack TX or block copy channel. Thus make those properties optional. Additionally CSI RX has independent power domain, add the binding for the same.

---
 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 87 ++++++++++++++-----
 1 file changed, 63 insertions(+), 24 deletions(-)
Quoted 10 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 34

Quoted 8 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -0
index 08627d91e607..d7b5adbb9b2e 100644
@@ -32,9 +32,66 @@ allOf:
   - $ref: /schemas/dma/dma-controller.yaml#
   - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
 

When adding if:then:, please move entire allOf after "required:" part.

Sure, will do

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +12 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,am62a-dmss-bcdma-csirx
+    then:
+      properties:
+        ti,sci-rm-range-bchan: false
+        ti,sci-rm-range-tchan: false
+
+        reg:
+          maxItems: 3
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 52

Quoted 6 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +6 -0
+
+        reg-names:
+          items:
+            - const: gcfg
+            - const: rchanrt
+            - const: ringrt

With my changes further this can be only "maxItems: 3"

Yes, but wont that mean any of the 3 reg-names out of the 5? Would it not be better to further restrict specifically to above 3 reg-names (as thats how the IP is)

Quoted 19 lines
Quoted 19 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +18 -0
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-rchan
+        - power-domains
+
+    else:
+      properties:
+        reg:
+          maxItems: 5
+
+        reg-names:
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 76

Quoted 6 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +6 -0
+          items:
+            - const: gcfg
+            - const: bchanrt
+            - const: rchanrt
+            - const: tchanrt
+            - const: ringrt

With my changes further this can be only "minItems: 5"

Ok.

Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +13 -0
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-bchan
+        - ti,sci-rm-range-tchan
+        - ti,sci-rm-range-rchan
+
 properties:
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 94

Quoted 5 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +3 -1
   compatible:
-    const: ti,am64-dmss-bcdma
+    enum:
+      - ti,am64-dmss-bcdma
+      - ti,am62a-dmss-bcdma-csirx

Keep some order, e.g. alphabetical. This reduces later conflicts on simultaneous edits.

Will fix!

Quoted 39 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 69

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -2
   "#dma-cells":
     const: 3
@@ -65,19 +122,13 @@ properties:
 
       cell 3: ASEL value for the channel
 
-  reg:
-    maxItems: 5

Keep it here with widest constrains - minItems: 3, maxItems: 5

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 77

Quoted 8 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -8
-
-  reg-names:
-    items:
-      - const: gcfg
-      - const: bchanrt
-      - const: rchanrt
-      - const: tchanrt
-      - const: ringrt

Keep the list here with minItems: 3

Quoted 15 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +5 -1
-
   msi-parent: true
 
+  power-domains:
+    description:
+      Power domain if available
+    maxItems: 1
+
   ti,asel:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: ASEL value for non slave channels
@@ -115,18 +166,6 @@ properties:
     items:
       maximum: 0x3f
 
Quoted 13 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 128

Quoted 11 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -11
-required:
-  - compatible
-  - "#dma-cells"
-  - reg
-  - reg-names
-  - msi-parent
-  - ti,sci
-  - ti,sci-dev-id
-  - ti,sci-rm-range-bchan
-  - ti,sci-rm-range-tchan
-  - ti,sci-rm-range-rchan

Keep required here. Customize it if needed in if:then:else.

Got it, will fix accordingly...

Quoted 9 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 171

Quoted 5 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -1
-
 unevaluatedProperties: false
 
 examples:

Best regards,
Krzysztof

Thanks for the review!

Signature · 2 lines
Regards
Vignesh
#4 lore raw

Re: [PATCH 1/5] dt-bindings: dma: ti: k3-bcdma: Add bindings for BCDMA CSI RX

Quoted 50 lines · Vignesh Raghavendra

Hi Krzysztof,

Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Vignesh Raghavendra

AM62A SoC has a dedicated BCDMA that serves Camera Serial Interface (CSI) IP. Add new compatible for the same. Unlike system BCDMA, this instance only has RX DMA channels and lack TX or block copy channel. Thus make those properties optional. Additionally CSI RX has independent power domain, add the binding for the same.

---
 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 87 ++++++++++++++-----
 1 file changed, 63 insertions(+), 24 deletions(-)
Quoted 10 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 34

Quoted 8 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -0
index 08627d91e607..d7b5adbb9b2e 100644
@@ -32,9 +32,66 @@ allOf:
   - $ref: /schemas/dma/dma-controller.yaml#
   - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
 

When adding if:then:, please move entire allOf after "required:" part.

Sure, will do

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +12 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,am62a-dmss-bcdma-csirx
+    then:
+      properties:
+        ti,sci-rm-range-bchan: false
+        ti,sci-rm-range-tchan: false
+
+        reg:
+          maxItems: 3
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 52

Quoted 6 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +6 -0
+
+        reg-names:
+          items:
+            - const: gcfg
+            - const: rchanrt
+            - const: ringrt

With my changes further this can be only "maxItems: 3"

Quoted 3 lines

Yes, but wont that mean any of the 3 reg-names out of the 5? Would it not be better to further restrict specifically to above 3 reg-names (as thats how the IP is)

I thought that first three entries are the same, but they are not, so indeed keep it like you have it now.

Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +18 -0
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-rchan
+        - power-domains
+
+    else:
+      properties:
+        reg:
+          maxItems: 5
+
+        reg-names:
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 76

Quoted 6 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +6 -0
+          items:
+            - const: gcfg
+            - const: bchanrt
+            - const: rchanrt
+            - const: tchanrt
+            - const: ringrt

With my changes further this can be only "minItems: 5"

Quoted 1 line

Ok.

I was wrong, keep it.

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +13 -0
+
+      required:
+        - compatible
+        - "#dma-cells"
+        - reg
+        - reg-names
+        - msi-parent
+        - ti,sci
+        - ti,sci-dev-id
+        - ti,sci-rm-range-bchan
+        - ti,sci-rm-range-tchan
+        - ti,sci-rm-range-rchan
+
 properties:
Quoted 8 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml allOf: · line 94

Quoted 5 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +3 -1
   compatible:
-    const: ti,am64-dmss-bcdma
+    enum:
+      - ti,am64-dmss-bcdma
+      - ti,am62a-dmss-bcdma-csirx

Keep some order, e.g. alphabetical. This reduces later conflicts on simultaneous edits.

Quoted 25 lines

Will fix!

Quoted 23 lines

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 69

Quoted 10 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -2
   "#dma-cells":
     const: 3
@@ -65,19 +122,13 @@ properties:
 
       cell 3: ASEL value for the channel
 
-  reg:
-    maxItems: 5

Keep it here with widest constrains - minItems: 3, maxItems: 5

Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml properties: · line 77

Quoted 8 lines
Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml +0 -8
-
-  reg-names:
-    items:
-      - const: gcfg
-      - const: bchanrt
-      - const: rchanrt
-      - const: tchanrt
-      - const: ringrt

Keep the list here with minItems: 3

So here minItems:3, maxItems:5

Best regards,
Krzysztof

author maintainer
#5 lore raw

PATCH 2/5 dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN

In reply to Vignesh Raghavendra

Reusing loop iterator fails if BCHAN is not present as iterator is uninitialized

---
 drivers/dma/ti/k3-udma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-udma.c +1 -0
index ce8b80bb34d7..791cf6354946 100644
@@ -4758,6 +4758,7 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 		}
 	}
 
+	i = 0;
 	irq_res.desc = kcalloc(irq_res.sets, sizeof(*irq_res.desc), GFP_KERNEL);
 	if (!irq_res.desc)
 		return -ENOMEM;
Signature · 1 line
2.38.1
#6 lore raw

Re: [PATCH 2/5] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN

Quoted 13 lines · Vignesh Raghavendra

Reusing loop iterator fails if BCHAN is not present as iterator is uninitialized

---
 drivers/dma/ti/k3-udma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-udma.c +0 -0
index ce8b80bb34d7..791cf6354946 100644

drivers/dma/ti/k3-udma.c static int bcdma_setup_resources(struct udma_dev *ud) · line 4761

Quoted 4 lines
drivers/dma/ti/k3-udma.c +1 -0
@@ -4758,6 +4758,7 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 		}
 	}
 
+	i = 0;

I think this would be more appropriate:

drivers/dma/ti/k3-udma.c +2 -0
index ce8b80bb34d7..7f8737da3613 100644
@@ -4774,6 +4774,8 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 				irq_res.desc[i].num = rm_res->desc[i].num;
 			}
 		}
+	} else {
+		i = 0;
 	}
 	if (ud->tchan_cnt) {
 		rm_res = tisci_rm->rm_ranges[RM_RANGE_TCHAN];
Quoted 3 lines
drivers/dma/ti/k3-udma.c +0 -0
 	irq_res.desc = kcalloc(irq_res.sets, sizeof(*irq_res.desc), GFP_KERNEL);
 	if (!irq_res.desc)
 		return -ENOMEM;
Signature · 1 line
Péter
author maintainer
#7 lore raw

Re: [PATCH 2/5] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN

Hi Peter,

Quoted 29 lines · Péter Ujfalusi
Quoted 13 lines · Vignesh Raghavendra

Reusing loop iterator fails if BCHAN is not present as iterator is uninitialized

---
 drivers/dma/ti/k3-udma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-udma.c +0 -0
index ce8b80bb34d7..791cf6354946 100644

drivers/dma/ti/k3-udma.c static int bcdma_setup_resources(struct udma_dev *ud) · line 4761

Quoted 4 lines
drivers/dma/ti/k3-udma.c +1 -0
@@ -4758,6 +4758,7 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 		}
 	}
 
+	i = 0;

I think this would be more appropriate:

drivers/dma/ti/k3-udma.c +0 -0
index ce8b80bb34d7..7f8737da3613 100644

drivers/dma/ti/k3-udma.c static int bcdma_setup_resources(struct udma_dev *ud) · line 4781

Quoted 8 lines
drivers/dma/ti/k3-udma.c +2 -0
@@ -4774,6 +4774,8 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 				irq_res.desc[i].num = rm_res->desc[i].num;
 			}
 		}
+	} else {
+		i = 0;
 	}
 	if (ud->tchan_cnt) {
 		rm_res = tisci_rm->rm_ranges[RM_RANGE_TCHAN];

Agreed, will update in v2.

Quoted 5 lines
Quoted 3 lines
drivers/dma/ti/k3-udma.c +0 -0
 	irq_res.desc = kcalloc(irq_res.sets, sizeof(*irq_res.desc), GFP_KERNEL);
 	if (!irq_res.desc)
 		return -ENOMEM;
Signature · 2 lines
Regards
Vignesh
author maintainer
#8 lore raw

PATCH 3/5 dmaengine: ti: k3-psil-am62a: Add AM62Ax PSIL and PDMA data

In reply to Vignesh Raghavendra

From: Jai Luthra <[email protected]>

Add PSIL and PDMA data for AM62Ax SoC.

---
 drivers/dma/ti/Makefile        |   3 +-
 drivers/dma/ti/k3-psil-am62a.c | 196 +++++++++++++++++++++++++++++++++
 drivers/dma/ti/k3-psil-priv.h  |   1 +
 drivers/dma/ti/k3-psil.c       |   1 +
 4 files changed, 200 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma/ti/k3-psil-am62a.c
drivers/dma/ti/Makefile +2 -1
index b53d05b11ca5..bd1e07fda559 100644
@@ -10,6 +10,7 @@ k3-psil-lib-objs := k3-psil.o \
 		    k3-psil-j7200.o \
 		    k3-psil-am64.o \
 		    k3-psil-j721s2.o \
-		    k3-psil-am62.o
+		    k3-psil-am62.o \
+		    k3-psil-am62a.o
 obj-$(CONFIG_TI_K3_PSIL) += k3-psil-lib.o
 obj-$(CONFIG_TI_DMA_CROSSBAR) += dma-crossbar.o
drivers/dma/ti/k3-psil-am62a.c new file +196 -0

196 lines not on this page · raw message

drivers/dma/ti/k3-psil-priv.h +1 -0
index 74fa9ec02968..abd650bb7600 100644
@@ -43,5 +43,6 @@ extern struct psil_ep_map j7200_ep_map;
 extern struct psil_ep_map am64_ep_map;
 extern struct psil_ep_map j721s2_ep_map;
 extern struct psil_ep_map am62_ep_map;
+extern struct psil_ep_map am62a_ep_map;
 
 #endif /* K3_PSIL_PRIV_H_ */
drivers/dma/ti/k3-psil.c +1 -0
index 8b6533a1eeeb..2da6988a0e7b 100644
@@ -24,6 +24,7 @@ static const struct soc_device_attribute k3_soc_devices[] = {
 	{ .family = "AM64X", .data = &am64_ep_map },
 	{ .family = "J721S2", .data = &j721s2_ep_map },
 	{ .family = "AM62X", .data = &am62_ep_map },
+	{ .family = "AM62AX", .data = &am62a_ep_map },
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.38.1
author maintainer
#9 lore raw

PATCH 4/5 dmaengine: ti: k3-udma: Add support for DMAs on AM62A SoC

In reply to Vignesh Raghavendra

AM62A SoC has a BCDMA and PKTDMA as systems DMAs for service various peripherals similar to AM64 SoC. Add support for the same.

---
 drivers/dma/ti/k3-udma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-udma.c +1 -0
index 791cf6354946..19fce52a9b53 100644
@@ -4386,6 +4386,7 @@ static const struct soc_device_attribute k3_soc_devices[] = {
 	{ .family = "AM64X", .data = &am64_soc_data },
 	{ .family = "J721S2", .data = &j721e_soc_data},
 	{ .family = "AM62X", .data = &am64_soc_data },
+	{ .family = "AM62AX", .data = &am64_soc_data },
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.38.1
author maintainer
#10 lore raw

PATCH 5/5 dmaengine: ti: k3-udma: Add support for BCDMA CSI RX

In reply to Vignesh Raghavendra

BCDMA CSI RX present on AM62Ax SoC is a dedicated DMA for servicing Camera Serial Interface (CSI) IP. Add support for the same.

---
 drivers/dma/ti/k3-udma.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)
drivers/dma/ti/k3-udma.c +32 -5
index 19fce52a9b53..a8b497ed3f30 100644
@@ -135,6 +135,7 @@ struct udma_match_data {
 	u32 flags;
 	u32 statictr_z_mask;
 	u8 burst_size[3];
+	struct udma_soc_data *soc_data;
 };
 
 struct udma_soc_data {
@@ -4295,6 +4296,25 @@ static struct udma_match_data j721e_mcu_data = {
 	},
 };
 
+static struct udma_soc_data am62a_dmss_csi_soc_data = {
+	.oes = {
+		.bcdma_rchan_data = 0xe00,
+		.bcdma_rchan_ring = 0x1000,
+	},
+};
+
+static struct udma_match_data am62a_bcdma_csirx_data = {
+	.type = DMA_TYPE_BCDMA,
+	.psil_base = 0x3100,
+	.enable_memcpy_support = false,
+	.burst_size = {
+		TI_SCI_RM_UDMAP_CHAN_BURST_SIZE_64_BYTES, /* Normal Channels */
+		0, /* No H Channels */
+		0, /* No UH Channels */
+	},
+	.soc_data = &am62a_dmss_csi_soc_data,
+};
+
 static struct udma_match_data am64_bcdma_data = {
 	.type = DMA_TYPE_BCDMA,
 	.psil_base = 0x2000, /* for tchan and rchan, not applicable to bchan */
@@ -4344,6 +4364,10 @@ static const struct of_device_id udma_of_match[] = {
 		.compatible = "ti,am64-dmss-pktdma",
 		.data = &am64_pktdma_data,
 	},
+	{
+		.compatible = "ti,am62a-dmss-bcdma-csirx",
+		.data = &am62a_bcdma_csirx_data,
+	},
 	{ /* Sentinel */ },
 };
 
@@ -5272,12 +5296,15 @@ static int udma_probe(struct platform_device *pdev)
 	}
 	ud->match_data = match->data;
 
-	soc = soc_device_match(k3_soc_devices);
-	if (!soc) {
-		dev_err(dev, "No compatible SoC found\n");
-		return -ENODEV;
+	ud->soc_data = ud->match_data->soc_data;
+	if (!ud->soc_data) {
+		soc = soc_device_match(k3_soc_devices);
+		if (!soc) {
+			dev_err(dev, "No compatible SoC found\n");
+			return -ENODEV;
+		}
+		ud->soc_data = soc->data;
 	}
-	ud->soc_data = soc->data;
 
 	ret = udma_get_mmrs(pdev, ud);
 	if (ret)
Signature · 1 line
2.38.1
#11 lore raw

Re: [PATCH 5/5] dmaengine: ti: k3-udma: Add support for BCDMA CSI RX

Quoted 65 lines · Vignesh Raghavendra

BCDMA CSI RX present on AM62Ax SoC is a dedicated DMA for servicing Camera Serial Interface (CSI) IP. Add support for the same.

---
 drivers/dma/ti/k3-udma.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)
drivers/dma/ti/k3-udma.c +24 -4
index 19fce52a9b53..a8b497ed3f30 100644
@@ -135,6 +135,7 @@ struct udma_match_data {
 	u32 flags;
 	u32 statictr_z_mask;
 	u8 burst_size[3];
+	struct udma_soc_data *soc_data;
 };
 
 struct udma_soc_data {
@@ -4295,6 +4296,25 @@ static struct udma_match_data j721e_mcu_data = {
 	},
 };
 
+static struct udma_soc_data am62a_dmss_csi_soc_data = {
+	.oes = {
+		.bcdma_rchan_data = 0xe00,
+		.bcdma_rchan_ring = 0x1000,
+	},
+};
+
+static struct udma_match_data am62a_bcdma_csirx_data = {
+	.type = DMA_TYPE_BCDMA,
+	.psil_base = 0x3100,
+	.enable_memcpy_support = false,
+	.burst_size = {
+		TI_SCI_RM_UDMAP_CHAN_BURST_SIZE_64_BYTES, /* Normal Channels */
+		0, /* No H Channels */
+		0, /* No UH Channels */
+	},
+	.soc_data = &am62a_dmss_csi_soc_data,
+};
+
 static struct udma_match_data am64_bcdma_data = {
 	.type = DMA_TYPE_BCDMA,
 	.psil_base = 0x2000, /* for tchan and rchan, not applicable to bchan */
@@ -4344,6 +4364,10 @@ static const struct of_device_id udma_of_match[] = {
 		.compatible = "ti,am64-dmss-pktdma",
 		.data = &am64_pktdma_data,
 	},
+	{
+		.compatible = "ti,am62a-dmss-bcdma-csirx",
+		.data = &am62a_bcdma_csirx_data,
+	},
 	{ /* Sentinel */ },
 };
 
@@ -5272,12 +5296,15 @@ static int udma_probe(struct platform_device *pdev)
 	}
 	ud->match_data = match->data;
 
-	soc = soc_device_match(k3_soc_devices);
-	if (!soc) {
-		dev_err(dev, "No compatible SoC found\n");
-		return -ENODEV;

drivers/dma/ti/k3-udma.c static int udma_probe(struct platform_device *pdev) · line 5280

Quoted 10 lines
drivers/dma/ti/k3-udma.c +8 -1
+	ud->soc_data = ud->match_data->soc_data;
+	if (!ud->soc_data) {
+		soc = soc_device_match(k3_soc_devices);
+		if (!soc) {
+			dev_err(dev, "No compatible SoC found\n");
+			return -ENODEV;
+		}
+		ud->soc_data = soc->data;
 	}
-	ud->soc_data = soc->data;

Right, the original design was based on the promise that a DMSS will contain maximum 1 BCDMA and/or 1 PKTDMA, looks like now a DMSS have 2 BCDMAs?

The only possible issue I can see is that if in future SoCs the Output Event Offsets got shuffled for the BCDMAs, but then a new compatible for each SoC might just work.

Nice solution with minimal change! ;)

Quoted 3 lines
drivers/dma/ti/k3-udma.c +0 -0
 	ret = udma_get_mmrs(pdev, ud);
 	if (ret)
Signature · 1 line
Péter
author maintainer
#12 lore raw

Re: [PATCH 5/5] dmaengine: ti: k3-udma: Add support for BCDMA CSI RX

Quoted 74 lines · Péter Ujfalusi
Quoted 71 lines · Vignesh Raghavendra

BCDMA CSI RX present on AM62Ax SoC is a dedicated DMA for servicing Camera Serial Interface (CSI) IP. Add support for the same.

---
 drivers/dma/ti/k3-udma.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)
drivers/dma/ti/k3-udma.c +30 -4
index 19fce52a9b53..a8b497ed3f30 100644
@@ -135,6 +135,7 @@ struct udma_match_data {
 	u32 flags;
 	u32 statictr_z_mask;
 	u8 burst_size[3];
+	struct udma_soc_data *soc_data;
 };
 
 struct udma_soc_data {
@@ -4295,6 +4296,25 @@ static struct udma_match_data j721e_mcu_data = {
 	},
 };
 
+static struct udma_soc_data am62a_dmss_csi_soc_data = {
+	.oes = {
+		.bcdma_rchan_data = 0xe00,
+		.bcdma_rchan_ring = 0x1000,
+	},
+};
+
+static struct udma_match_data am62a_bcdma_csirx_data = {
+	.type = DMA_TYPE_BCDMA,
+	.psil_base = 0x3100,
+	.enable_memcpy_support = false,
+	.burst_size = {
+		TI_SCI_RM_UDMAP_CHAN_BURST_SIZE_64_BYTES, /* Normal Channels */
+		0, /* No H Channels */
+		0, /* No UH Channels */
+	},
+	.soc_data = &am62a_dmss_csi_soc_data,
+};
+
 static struct udma_match_data am64_bcdma_data = {
 	.type = DMA_TYPE_BCDMA,
 	.psil_base = 0x2000, /* for tchan and rchan, not applicable to bchan */
@@ -4344,6 +4364,10 @@ static const struct of_device_id udma_of_match[] = {
 		.compatible = "ti,am64-dmss-pktdma",
 		.data = &am64_pktdma_data,
 	},
+	{
+		.compatible = "ti,am62a-dmss-bcdma-csirx",
+		.data = &am62a_bcdma_csirx_data,
+	},
 	{ /* Sentinel */ },
 };
 
@@ -5272,12 +5296,15 @@ static int udma_probe(struct platform_device *pdev)
 	}
 	ud->match_data = match->data;
 
-	soc = soc_device_match(k3_soc_devices);
-	if (!soc) {
-		dev_err(dev, "No compatible SoC found\n");
-		return -ENODEV;
+	ud->soc_data = ud->match_data->soc_data;
+	if (!ud->soc_data) {
+		soc = soc_device_match(k3_soc_devices);
+		if (!soc) {
+			dev_err(dev, "No compatible SoC found\n");
+			return -ENODEV;
Quoted 9 lines

drivers/dma/ti/k3-udma.c static int udma_probe(struct platform_device *pdev) · line 5280

Quoted 4 lines
drivers/dma/ti/k3-udma.c +2 -1
+		}
+		ud->soc_data = soc->data;
 	}
-	ud->soc_data = soc->data;

Right, the original design was based on the promise that a DMSS will contain maximum 1 BCDMA and/or 1 PKTDMA, looks like now a DMSS have 2 BCDMAs?

Thats correct. IPs requiring dedicated B/W paths (its just CSI today) would probably have dedicated BCDMA.

Quoted 4 lines

The only possible issue I can see is that if in future SoCs the Output Event Offsets got shuffled for the BCDMAs, but then a new compatible for each SoC might just work.

We have ensured all BCDMAs for CSI follow the same offsets across the SoCs. So, this compatible should work for all BCDMA_CSIs. But yes, this can be expanded by adding new compatible is third BCDMA variant shows up (doesn't exist today though).

Quoted 1 line

Nice solution with minimal change! ;)

Thanks! appreciate the review comments.

Quoted 5 lines
Quoted 4 lines
drivers/dma/ti/k3-udma.c +0 -0
 	ret = udma_get_mmrs(pdev, ud);
 	if (ret)
Signature · 2 lines
Regards
Vignesh