# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/dma/fsl,elo-dma.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Freescale Elo DMA Controller

maintainers:
  - J. Neuschäfer <j.ne@posteo.net>

description:
  This is a little-endian 4-channel DMA controller, used in Freescale mpc83xx
  series chips such as mpc8315, mpc8349, mpc8379 etc.

properties:
  compatible:
    items:
      - enum:
          - fsl,mpc8313-dma
          - fsl,mpc8315-dma
          - fsl,mpc8323-dma
          - fsl,mpc8347-dma
          - fsl,mpc8349-dma
          - fsl,mpc8360-dma
          - fsl,mpc8377-dma
          - fsl,mpc8378-dma
          - fsl,mpc8379-dma
      - const: fsl,elo-dma

  reg:
    items:
      - description:
          DMA General Status Register, i.e. DGSR which contains status for
          all the 4 DMA channels.

  cell-index:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: Controller index. 0 for controller @ 0x8100.

  ranges: true

  "#address-cells":
    const: 1

  "#size-cells":
    const: 1

  interrupts:
    maxItems: 1
    description: Controller interrupt.

required:
  - compatible
  - reg

patternProperties:
  "^dma-channel@[0-9a-f]+$":
    type: object
    additionalProperties: false

    properties:
      compatible:
        oneOf:
          # native DMA channel
          - items:
              - enum:
                  - fsl,mpc8315-dma-channel
                  - fsl,mpc8323-dma-channel
                  - fsl,mpc8347-dma-channel
                  - fsl,mpc8349-dma-channel
                  - fsl,mpc8360-dma-channel
                  - fsl,mpc8377-dma-channel
                  - fsl,mpc8378-dma-channel
                  - fsl,mpc8379-dma-channel
              - const: fsl,elo-dma-channel

          # audio DMA channel, see fsl,ssi.yaml
          - const: fsl,ssi-dma-channel

      reg:
        maxItems: 1

      cell-index:
        description: DMA channel index starts at 0.

      interrupts:
        maxItems: 1
        description:
          Per-channel interrupt. Only necessary if no controller interrupt has
          been provided.

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>

    dma@82a8 {
        compatible = "fsl,mpc8349-dma", "fsl,elo-dma";
        reg = <0x82a8 4>;
        #address-cells = <1>;
        #size-cells = <1>;
        ranges = <0 0x8100 0x1a4>;
        interrupts = <71 IRQ_TYPE_LEVEL_LOW>;
        cell-index = <0>;

        dma-channel@0 {
            compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
            reg = <0 0x80>;
            cell-index = <0>;
            interrupts = <71 IRQ_TYPE_LEVEL_LOW>;
        };

        dma-channel@80 {
            compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
            reg = <0x80 0x80>;
            cell-index = <1>;
            interrupts = <71 IRQ_TYPE_LEVEL_LOW>;
        };

        dma-channel@100 {
            compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
            reg = <0x100 0x80>;
            cell-index = <2>;
            interrupts = <71 IRQ_TYPE_LEVEL_LOW>;
        };

        dma-channel@180 {
            compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel";
            reg = <0x180 0x80>;
            cell-index = <3>;
            interrupts = <71 IRQ_TYPE_LEVEL_LOW>;
        };
    };

...
