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

title: TI OMAP Control PHY Module

maintainers:
  - Roger Quadros <rogerq@ti.com>

description:
  The TI OMAP Control PHY module is a hardware block within the system
  control module (SCM) of Texas Instruments OMAP SoCs. It provides
  centralized control over power, configuration, and auxiliary features
  for multiple on-chip PHYs. This module is essential for proper PHY
  operation in power-constrained embedded systems.

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

  compatible:
    enum:
      - ti,control-phy-otghs
      - ti,control-phy-pcie
      - ti,control-phy-pipe3
      - ti,control-phy-usb2
      - ti,control-phy-usb2-am437
      - ti,control-phy-usb2-dra7

  reg:
    minItems: 1
    maxItems: 3

  reg-names:
    minItems: 1
    maxItems: 3
    items:
      enum: [otghs_control, power, pcie_pcs, control_sma]

allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - ti,control-phy-otghs
    then:
      properties:
        reg-names:
          const: otghs_control

  - if:
      properties:
        compatible:
          contains:
            enum:
              - ti,control-phy-pcie
    then:
      properties:
        reg:
          minItems: 3

        reg-names:
          items:
            - const: power
            - const: pcie_pcs
            - const: control_sma

  - if:
      properties:
        compatible:
          contains:
            enum:
              - ti,control-phy-usb2
              - ti,control-phy-usb2-dra7
              - ti,control-phy-usb2-am437
              - ti,control-phy-pipe3
    then:
      properties:
        reg-names:
          const: power

required:
  - reg
  - compatible
  - reg-names

unevaluatedProperties: false

examples:
  - |
    phy@4a00233c {
        compatible = "ti,control-phy-otghs";
        reg = <0x4a00233c 0x4>;
        reg-names = "otghs_control";
    };
...
