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

title: Atmel High-Speed MultiMedia Card Interface (HSMCI)

description:
  The Atmel HSMCI controller provides an interface for MMC, SD, and SDIO memory
  cards.

maintainers:
  - Nicolas Ferre <nicolas.ferre@microchip.com>
  - Aubin Constans <aubin.constans@microchip.com>

allOf:
  - $ref: mmc-controller.yaml

properties:
  compatible:
    const: atmel,hsmci

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  dmas:
    maxItems: 1

  dma-names:
    const: rxtx

  clocks:
    maxItems: 1

  clock-names:
    const: mci_clk

  "#address-cells":
    const: 1
    description: Used for slot IDs.

  "#size-cells":
    const: 0

patternProperties:
  "slot@[0-2]$":
    $ref: mmc-slot.yaml
    description: A slot node representing an MMC, SD, or SDIO slot.

    properties:
      reg:
        enum: [0, 1]

    required:
      - reg
      - bus-width

    unevaluatedProperties: false

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - "#address-cells"
  - "#size-cells"

anyOf:
  - required:
      - slot@0
  - required:
      - slot@1

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/clock/at91.h>
    mmc@f0008000 {
      compatible = "atmel,hsmci";
      reg = <0xf0008000 0x600>;
      interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
      clocks = <&mci0_clk>;
      clock-names = "mci_clk";
      #address-cells = <1>;
      #size-cells = <0>;

      slot@0 {
        reg = <0>;
        bus-width = <4>;
        cd-gpios = <&pioD 15 0>;
        cd-inverted;
      };

      slot@1 {
        reg = <1>;
        bus-width = <4>;
      };
    };
...
