2022-12-12 11:18:18

by Vignesh Raghavendra

[permalink] [raw]
Subject: [PATCH v2 0/5] 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.

v2:
Fix k3-bcdma.yaml as per Krzysztof 's comments
Address's Peter's comment on 2/5

v1: https://lore.kernel.org/dmaengine/[email protected]/

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 | 67 ++++--
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 | 41 +++-
6 files changed, 285 insertions(+), 24 deletions(-)
create mode 100644 drivers/dma/ti/k3-psil-am62a.c

--
2.38.1


2022-12-12 11:18:22

by Vignesh Raghavendra

[permalink] [raw]
Subject: [PATCH v2 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.

Signed-off-by: Vignesh Raghavendra <[email protected]>
---

v2:
reorder compatibles alphabetically
Fix reg defintion to min 3 and max 5
Keep top level constraints as is and further restrict
variants within "if-else" blocks

.../devicetree/bindings/dma/ti/k3-bcdma.yaml | 67 ++++++++++++++-----
1 file changed, 49 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
index 08627d91e607..86e8bebce3f2 100644
--- a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
+++ b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
@@ -28,13 +28,15 @@ description: |
PDMAs can be configured via BCDMA split channel's peer registers to match with
the configuration of the legacy peripheral.

-allOf:
- - $ref: /schemas/dma/dma-controller.yaml#
- - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
-
properties:
compatible:
- const: ti,am64-dmss-bcdma
+ enum:
+ - ti,am62a-dmss-bcdma-csirx
+ - ti,am64-dmss-bcdma
+
+ reg:
+ minItems: 3
+ maxItems: 5

"#dma-cells":
const: 3
@@ -65,19 +67,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
@@ -123,10 +119,45 @@ required:
- msi-parent
- ti,sci
- ti,sci-dev-id
- - ti,sci-rm-range-bchan
- - ti,sci-rm-range-tchan
- ti,sci-rm-range-rchan

+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-names:
+ items:
+ - const: gcfg
+ - const: rchanrt
+ - const: ringrt
+
+ required:
+ - power-domains
+
+ else:
+ properties:
+ reg-names:
+ items:
+ - const: gcfg
+ - const: bchanrt
+ - const: rchanrt
+ - const: tchanrt
+ - const: ringrt
+
+ required:
+ - ti,sci-rm-range-bchan
+ - ti,sci-rm-range-tchan
+
unevaluatedProperties: false

examples:
--
2.38.1

2022-12-12 11:18:36

by Vignesh Raghavendra

[permalink] [raw]
Subject: [PATCH v2 5/5] dmaengine: ti: k3-udma: Add support for BCDMA CSI RX

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

Signed-off-by: Vignesh Raghavendra <[email protected]>
---
drivers/dma/ti/k3-udma.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index c1005d17b42e..1d3d1b387b96 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -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 */ },
};

@@ -5274,12 +5298,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)
--
2.38.1

2022-12-12 12:21:54

by Krzysztof Kozlowski

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

On 12/12/2022 11:54, Vignesh Raghavendra wrote:
> 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.
>
> Signed-off-by: Vignesh Raghavendra <[email protected]>
> ---
>
> v2:
> reorder compatibles alphabetically
> Fix reg defintion to min 3 and max 5
> Keep top level constraints as is and further restrict
> variants within "if-else" blocks
>
> .../devicetree/bindings/dma/ti/k3-bcdma.yaml | 67 ++++++++++++++-----
> 1 file changed, 49 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> index 08627d91e607..86e8bebce3f2 100644
> --- a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> +++ b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> @@ -28,13 +28,15 @@ description: |
> PDMAs can be configured via BCDMA split channel's peer registers to match with
> the configuration of the legacy peripheral.
>
> -allOf:
> - - $ref: /schemas/dma/dma-controller.yaml#
> - - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
> -
> properties:
> compatible:
> - const: ti,am64-dmss-bcdma
> + enum:
> + - ti,am62a-dmss-bcdma-csirx
> + - ti,am64-dmss-bcdma
> +
> + reg:
> + minItems: 3
> + maxItems: 5
>
> "#dma-cells":
> const: 3
> @@ -65,19 +67,13 @@ properties:
>
> cell 3: ASEL value for the channel
>
> - reg:
> - maxItems: 5
> -
> - reg-names:
> - items:

reg-names with min/max items should also stay.

> - - 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
> @@ -123,10 +119,45 @@ required:
> - msi-parent
> - ti,sci
> - ti,sci-dev-id
> - - ti,sci-rm-range-bchan
> - - ti,sci-rm-range-tchan
> - ti,sci-rm-range-rchan
>
> +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
> +

missing constraints for reg

> + reg-names:
> + items:
> + - const: gcfg
> + - const: rchanrt
> + - const: ringrt
> +
> + required:
> + - power-domains
> +
> + else:
> + properties:

missing constraints for reg

> + reg-names:
> + items:
> + - const: gcfg
> + - const: bchanrt
> + - const: rchanrt
> + - const: tchanrt
> + - const: ringrt
> +
> + required:
> + - ti,sci-rm-range-bchan
> + - ti,sci-rm-range-tchan
> +
> unevaluatedProperties: false
>
> examples:

Best regards,
Krzysztof