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

title: McBSP Controller for TI SoCs

maintainers:
  - Bastien Curutchet <bastien.curutchet@bootlin.com>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - ti,da850-mcbsp

  reg:
    minItems: 1
    items:
      - description: CFG registers
      - description: data registers

  reg-names:
    minItems: 1
    items:
      - const: mpu
      - const: dat

  dmas:
    items:
      - description: transmission DMA channel
      - description: reception DMA channel

  dma-names:
    items:
      - const: tx
      - const: rx

  interrupts:
    items:
      - description: RX interrupt
      - description: TX interrupt

  interrupt-names:
    items:
      - const: rx
      - const: tx

  clocks:
    minItems: 1
    items:
      - description: functional clock
      - description: external input clock for sample rate generator.

  clock-names:
    minItems: 1
    items:
      - const: fck
      - const: clks

  power-domains:
    maxItems: 1

  "#sound-dai-cells":
    const: 0

  ti,T1-framing-tx:
    $ref: /schemas/types.yaml#/definitions/flag
    description:
      If the property is present, tx data delay is set to 2 bit clock periods.
      McBSP will insert a blank period (high-impedance period) before the first
      data bit. This can be used to interface to T1-framing devices.

  ti,T1-framing-rx:
    $ref: /schemas/types.yaml#/definitions/flag
    description:
      If the property is present, rx data delay is set to 2 bit clock periods.
      McBSP will discard the bit preceding the data stream (called framing bit).
      This can be used to interface to T1-framing devices.

required:
  - "#sound-dai-cells"
  - compatible
  - reg
  - reg-names
  - dmas
  - dma-names
  - clocks

unevaluatedProperties: false

examples:
  - |
    mcbsp0@1d10000 {
      #sound-dai-cells = <0>;
      compatible = "ti,da850-mcbsp";
      pinctrl-names = "default";
      pinctrl-0 = <&mcbsp0_pins>;

      reg = <0x111000 0x1000>,
            <0x311000 0x1000>;
      reg-names = "mpu", "dat";
      interrupts = <97>, <98>;
      interrupt-names = "rx", "tx";
      dmas = <&edma0 3 1>,
             <&edma0 2 1>;
      dma-names = "tx", "rx";

      clocks = <&psc1 14>;
    };
