# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/tegra/nvidia,tegra20-gr3d.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NVIDIA 3D graphics engine

maintainers:
  - Thierry Reding <thierry.reding@gmail.com>
  - Jon Hunter <jonathanh@nvidia.com>

properties:
  $nodename:
    pattern: "^gr3d@[0-9a-f]+$"

  compatible:
    enum:
      - nvidia,tegra20-gr3d
      - nvidia,tegra30-gr3d
      - nvidia,tegra114-gr3d

  reg:
    maxItems: 1

  clocks:
    minItems: 1
    maxItems: 2

  clock-names:
    minItems: 1
    maxItems: 2

  resets:
    minItems: 2
    maxItems: 4

  reset-names:
    minItems: 2
    maxItems: 4

  iommus:
    minItems: 1
    maxItems: 2

  interconnects:
    minItems: 4
    maxItems: 10

  interconnect-names:
    minItems: 4
    maxItems: 10

  operating-points-v2: true

  power-domains:
    minItems: 1
    maxItems: 2

  power-domain-names:
    maxItems: 2

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: nvidia,tegra20-gr2d
    then:
      properties:
        clocks:
          items:
            - description: module clock

        clock-names:
          items:
            - const: 3d

        resets:
          items:
            - description: module reset
            - description: memory client hotflush reset

        reset-names:
          items:
            - const: 3d
            - const: mc

        iommus:
          maxItems: 1

        interconnects:
          minItems: 4
          maxItems: 4

        interconnect-names:
          minItems: 4
          maxItems: 4

        power-domains:
          items:
            - description: phandle to the TD power domain

  - if:
      properties:
        compatible:
          contains:
            const: nvidia,tegra30-gr3d
    then:
      properties:
        clocks:
          items:
            - description: primary module clock
            - description: secondary module clock

        clock-names:
          items:
            - const: 3d
            - const: 3d2

        resets:
          items:
            - description: primary module reset
            - description: secondary module reset
            - description: primary memory client hotflush reset
            - description: secondary memory client hotflush reset

        reset-names:
          items:
            - const: 3d
            - const: 3d2
            - const: mc
            - const: mc2

        iommus:
          minItems: 2
          maxItems: 2

        interconnects:
          minItems: 8
          maxItems: 8

        interconnect-names:
          minItems: 8
          maxItems: 8

        power-domains:
          items:
            - description: phandle to the TD power domain
            - description: phandle to the TD2 power domain

        power-domain-names:
          items:
            - const: 3d0
            - const: 3d1

      dependencies:
        power-domains: [ power-domain-names ]

  - if:
      properties:
        compatible:
          contains:
            const: nvidia,tegra114-gr2d
    then:
      properties:
        clocks:
          items:
            - description: module clock

        clock-names:
          items:
            - const: 3d

        resets:
          items:
            - description: module reset
            - description: memory client hotflush reset

        reset-names:
          items:
            - const: 3d
            - const: mc

        iommus:
          maxItems: 1

        interconnects:
          minItems: 10
          maxItems: 10

        interconnect-names:
          minItems: 10
          maxItems: 10

        power-domains:
          items:
            - description: phandle to the TD power domain

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/tegra20-car.h>
    #include <dt-bindings/memory/tegra20-mc.h>

    gr3d@54180000 {
        compatible = "nvidia,tegra20-gr3d";
        reg = <0x54180000 0x00040000>;
        clocks = <&tegra_car TEGRA20_CLK_GR3D>;
        resets = <&tegra_car 24>, <&mc TEGRA20_MC_RESET_3D>;
        reset-names = "3d", "mc";
    };