dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma
@ 2021-06-09 15:20 Olivier Dautricourt
  2021-06-09 15:20 ` [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA Olivier Dautricourt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Olivier Dautricourt @ 2021-06-09 15:20 UTC (permalink / raw)
  To: Rob Herring, Vinod Koul, Stefan Roese
  Cc: Olivier Dautricourt, dmaengine, devicetree, linux-kernel

add yaml schema for Altera mSGDMA bindings in devicetree.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Olivier Dautricourt <olivier.dautricourt@orolia.com>
---

Notes:
    Changes in v2:
     - fix reg size in dt example
     - fix dt_binding check warning
     - add list in MAINTAINERS entry

    Changes from v2 to v3:
     none

    Changes from v3 to v4:
     none

    Changes from v4 to v5:
        as per Rob's comments:
            - change compatible field from 'altr,msgdma' to
              'altr,socfpga-msgdma' to indicate that it's compatible
               with altera socfpga family.
            - describe each region separately
            - remove maxItems/minItems for reg section.
        as per Vinod's comments:
            - separate MAINTAINERS editing in another commit
            - remove description for #dma-cells
    v6:
      add description for the unique dma cell (channel id must be 0)

 .../devicetree/bindings/dma/altr,msgdma.yaml  | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/altr,msgdma.yaml

diff --git a/Documentation/devicetree/bindings/dma/altr,msgdma.yaml b/Documentation/devicetree/bindings/dma/altr,msgdma.yaml
new file mode 100644
index 000000000000..a4f9fe23dcd9
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/altr,msgdma.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/altr,msgdma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Altera mSGDMA IP core
+
+maintainers:
+  - Olivier Dautricourt <olivier.dautricourt@orolia.com>
+
+description: |
+  Altera / Intel modular Scatter-Gather Direct Memory Access (mSGDMA)
+  intellectual property (IP)
+
+allOf:
+  - $ref: "dma-controller.yaml#"
+
+properties:
+  compatible:
+    const: altr,socfpga-msgdma
+
+  reg:
+    items:
+      - description: Control and Status Register Slave Port
+      - description: Descriptor Slave Port
+      - description: Response Slave Port
+
+  reg-names:
+    items:
+      - const: csr
+      - const: desc
+      - const: resp
+
+  interrupts:
+    maxItems: 1
+
+  "#dma-cells":
+    const: 1
+    description:
+      The cell identifies the channel id (must be 0)
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    msgdma_controller: dma-controller@ff200b00 {
+        compatible = "altr,socfpga-msgdma";
+        reg = <0xff200b00 0x100>, <0xff200c00 0x100>, <0xff200d00 0x100>;
+        reg-names = "csr", "desc", "resp";
+        interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
+        #dma-cells = <1>;
+    };
--
2.31.0.rc2


--
Olivier Dautricourt


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA
  2021-06-09 15:20 [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Olivier Dautricourt
@ 2021-06-09 15:20 ` Olivier Dautricourt
  2021-06-10  5:22   ` Stefan Roese
  2021-06-09 15:21 ` [PATCH v6 3/3] dmaengine: altera-msgdma: add OF support Olivier Dautricourt
  2021-06-16 10:44 ` [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Vinod Koul
  2 siblings, 1 reply; 5+ messages in thread
From: Olivier Dautricourt @ 2021-06-09 15:20 UTC (permalink / raw)
  To: Rob Herring, Vinod Koul, Stefan Roese
  Cc: Olivier Dautricourt, dmaengine, devicetree, linux-kernel

This entry is for the standalone driver in drivers/dma/altera-msgdma.c
Add myself as 'Odd fixes' maintainer for this driver as i am currently
writing new code and have access to the hardware.
Add Stefan Roese as reviewer.

Signed-off-by: Olivier Dautricourt <olivier.dautricourt@orolia.com>
---

Notes:
    splitted commit, introduced in v5

    v6:
      add Stefan Roese as Reviewer (after consulting him)

 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b706dd20ff2b..3167d26f0718 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -783,6 +783,14 @@ M:	Ley Foon Tan <ley.foon.tan@intel.com>
 S:	Maintained
 F:	drivers/mailbox/mailbox-altera.c

+ALTERA MSGDMA IP CORE DRIVER
+M:	Olivier Dautricourt <olivier.dautricourt@orolia.com>
+R:	Stefan Roese <sr@denx.de>
+L:	dmaengine@vger.kernel.org
+S:	Odd Fixes
+F:	Documentation/devicetree/bindings/dma/altr,msgdma.yaml
+F:	drivers/dma/altera-msgdma.c
+
 ALTERA PIO DRIVER
 M:	Joyce Ooi <joyce.ooi@intel.com>
 L:	linux-gpio@vger.kernel.org
--
2.31.0.rc2


--
Olivier Dautricourt


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v6 3/3] dmaengine: altera-msgdma: add OF support
  2021-06-09 15:20 [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Olivier Dautricourt
  2021-06-09 15:20 ` [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA Olivier Dautricourt
@ 2021-06-09 15:21 ` Olivier Dautricourt
  2021-06-16 10:44 ` [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Vinod Koul
  2 siblings, 0 replies; 5+ messages in thread
From: Olivier Dautricourt @ 2021-06-09 15:21 UTC (permalink / raw)
  To: Rob Herring, Vinod Koul, Stefan Roese
  Cc: Olivier Dautricourt, dmaengine, devicetree, linux-kernel

This driver had no device tree support.

- add compatible field "altr,socfpga-msgdma"
- register dma controller with of_dma_controller_register

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Olivier Dautricourt <olivier.dautricourt@orolia.com>
---

Notes:
    Changes in v2:
        none

    Changes from v2 to v3:
        Removed CONFIG_OF #ifdef's and use if (IS_ENABLED(CONFIG_OF))
        only once.

    Changes from v3 to v4
        Reintroduce #ifdef CONFIG_OF for msgdma_match
        as it produces a unused variable warning

    Changes from v4 to v5
        - As per Rob's comments on patch 1/2:
          change compatible field from altr,msgdma to
          altr,socfpga-msgdma.
        - change commit title to fit previous commits naming
        - As per Vinod's comments:
          - use dma_get_slave_channel instead of dma_get_any_slave_channel which
            makes more sense.
          - remove if (IS_ENABLED(CONFIG_OF)) for of_dma_controller_register
            as it is taken care by the core
    v6:
        use of_dma_xlate_by_chan_id and expect the dma cell to be 0 in dt (id of
        the unique channel)
        Check ret value of of_dma_controller_register
    	-EINVAL: non-dt device on OF system
    	0 or -ENODEV: success or non-of system
    	other: fail

        call of_dma_controller_free on dettach :)

 drivers/dma/altera-msgdma.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
index 9a841ce5f0c5..0fe0676f8e1d 100644
--- a/drivers/dma/altera-msgdma.c
+++ b/drivers/dma/altera-msgdma.c
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of_dma.h>

 #include "dmaengine.h"

@@ -888,6 +889,13 @@ static int msgdma_probe(struct platform_device *pdev)
 	if (ret)
 		goto fail;

+	ret = of_dma_controller_register(pdev->dev.of_node,
+					 of_dma_xlate_by_chan_id, dma_dev);
+	if (ret == -EINVAL)
+		dev_warn(&pdev->dev, "device was not probed from DT");
+	else if (ret && ret != -ENODEV)
+		goto fail;
+
 	dev_notice(&pdev->dev, "Altera mSGDMA driver probe success\n");

 	return 0;
@@ -908,6 +916,8 @@ static int msgdma_remove(struct platform_device *pdev)
 {
 	struct msgdma_device *mdev = platform_get_drvdata(pdev);

+	if (pdev->dev.of_node)
+		of_dma_controller_free(pdev->dev.of_node);
 	dma_async_device_unregister(&mdev->dmadev);
 	msgdma_dev_remove(mdev);

@@ -916,9 +926,19 @@ static int msgdma_remove(struct platform_device *pdev)
 	return 0;
 }

+#ifdef CONFIG_OF
+static const struct of_device_id msgdma_match[] = {
+	{ .compatible = "altr,socfpga-msgdma", },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, msgdma_match);
+#endif
+
 static struct platform_driver msgdma_driver = {
 	.driver = {
 		.name = "altera-msgdma",
+		.of_match_table = of_match_ptr(msgdma_match),
 	},
 	.probe = msgdma_probe,
 	.remove = msgdma_remove,
--
2.31.0.rc2


--
Olivier Dautricourt


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA
  2021-06-09 15:20 ` [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA Olivier Dautricourt
@ 2021-06-10  5:22   ` Stefan Roese
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2021-06-10  5:22 UTC (permalink / raw)
  To: Olivier Dautricourt, Rob Herring, Vinod Koul
  Cc: dmaengine, devicetree, linux-kernel

On 09.06.21 17:20, Olivier Dautricourt wrote:
> This entry is for the standalone driver in drivers/dma/altera-msgdma.c
> Add myself as 'Odd fixes' maintainer for this driver as i am currently
> writing new code and have access to the hardware.
> Add Stefan Roese as reviewer.
> 
> Signed-off-by: Olivier Dautricourt <olivier.dautricourt@orolia.com>

Acked-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> 
> Notes:
>      splitted commit, introduced in v5
> 
>      v6:
>        add Stefan Roese as Reviewer (after consulting him)
> 
>   MAINTAINERS | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b706dd20ff2b..3167d26f0718 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -783,6 +783,14 @@ M:	Ley Foon Tan <ley.foon.tan@intel.com>
>   S:	Maintained
>   F:	drivers/mailbox/mailbox-altera.c
> 
> +ALTERA MSGDMA IP CORE DRIVER
> +M:	Olivier Dautricourt <olivier.dautricourt@orolia.com>
> +R:	Stefan Roese <sr@denx.de>
> +L:	dmaengine@vger.kernel.org
> +S:	Odd Fixes
> +F:	Documentation/devicetree/bindings/dma/altr,msgdma.yaml
> +F:	drivers/dma/altera-msgdma.c
> +
>   ALTERA PIO DRIVER
>   M:	Joyce Ooi <joyce.ooi@intel.com>
>   L:	linux-gpio@vger.kernel.org
> --
> 2.31.0.rc2
> 
> 
> --
> Olivier Dautricourt
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma
  2021-06-09 15:20 [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Olivier Dautricourt
  2021-06-09 15:20 ` [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA Olivier Dautricourt
  2021-06-09 15:21 ` [PATCH v6 3/3] dmaengine: altera-msgdma: add OF support Olivier Dautricourt
@ 2021-06-16 10:44 ` Vinod Koul
  2 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2021-06-16 10:44 UTC (permalink / raw)
  To: Olivier Dautricourt
  Cc: Rob Herring, Stefan Roese, dmaengine, devicetree, linux-kernel

On 09-06-21, 17:20, Olivier Dautricourt wrote:
> add yaml schema for Altera mSGDMA bindings in devicetree.

Applied all, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-16 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 15:20 [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Olivier Dautricourt
2021-06-09 15:20 ` [PATCH v6 2/3] MAINTAINERS: add entry for Altera mSGDMA Olivier Dautricourt
2021-06-10  5:22   ` Stefan Roese
2021-06-09 15:21 ` [PATCH v6 3/3] dmaengine: altera-msgdma: add OF support Olivier Dautricourt
2021-06-16 10:44 ` [PATCH v6 1/3] dt-bindings: dma: add schema for altera-msgdma Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).