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

title: Texas Instruments DMA Crossbar (DMA request router)

maintainers:
  - Vignesh Raghavendra <vigneshr@ti.com>
  - Bhargav Joshi <j.bhargav.u@gmail.com>

description:
  When requesting channel via ti,dra7-dma-crossbar, the DMA client must request
  the DMA event number as crossbar ID (input to the DMA crossbar). For
  ti,am335x-edma-crossbar the meaning of parameters of dmas for clients dmas =
  <&edma_xbar 12 0 1>; where <12> is the DMA request number, <0> is the TC the
  event should be assigned and <1> is the mux selection for in the crossbar.
  When mux 0 is used the DMA channel can be requested directly from edma node.

properties:
  compatible:
    enum:
      - ti,dra7-dma-crossbar
      - ti,am335x-edma-crossbar

  reg:
    maxItems: 1

  "#dma-cells":
    minimum: 1
    maximum: 3

  dma-requests:
    minimum: 1
    maximum: 256

  dma-masters:
    maxItems: 1

  ti,dma-safe-map:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: Safe routing value for unused request lines

  ti,reserved-dma-request-ranges:
    $ref: /schemas/types.yaml#/definitions/uint32-matrix
    description:
      DMA request ranges which should not be used when mapping xbar input to
      DMA request, they are either allocated to be used by for example the DSP
      or they are used as memcpy channels in eDMA.
    items:
      items:
        - description: starting DMA request line number
        - description: number of consecutive lines to reserve

required:
  - compatible
  - reg
  - "#dma-cells"
  - dma-requests
  - dma-masters

allOf:
  - $ref: dma-router.yaml#

  - if:
      properties:
        compatible:
          contains:
            const: ti,am335x-edma-crossbar
    then:
      properties:
        "#dma-cells":
          const: 3

    else:
      properties:
        "#dma-cells":
          enum: [1, 2]

unevaluatedProperties: false

examples:
  - |
    dma-router@4a002b78 {
        compatible = "ti,dra7-dma-crossbar";
        reg = <0x4a002b78 0xfc>;
        #dma-cells = <1>;
        dma-requests = <205>;
        ti,dma-safe-map = <0>;
        /* Protect the sDMA request ranges: 10-14 and 100-126 */
        ti,reserved-dma-request-ranges = <10 5>, <100 27>;
        dma-masters = <&sdma>;
    };