# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/rockchip,rk3399-typec-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip Type-C PHY

maintainers:
  - Heiko Stuebner <heiko@sntech.de>

properties:
  compatible:
    const: rockchip,rk3399-typec-phy

  reg:
    maxItems: 1

  clocks:
    maxItems: 2

  clock-names:
    items:
      - const: tcpdcore
      - const: tcpdphy-ref

  extcon: true

  power-domains:
    maxItems: 1

  resets:
    maxItems: 3

  reset-names:
    items:
      - const: uphy
      - const: uphy-pipe
      - const: uphy-tcphy

  rockchip,grf:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      Phandle to the syscon managing the "general register files" (GRF).

  dp-port:
    type: object
    additionalProperties: false

    properties:
      '#phy-cells':
        const: 0

      port:
        $ref: /schemas/graph.yaml#/properties/port
        description: Connection to USB Type-C connector

    required:
      - '#phy-cells'

  usb3-port:
    type: object
    additionalProperties: false

    properties:
      '#phy-cells':
        const: 0

      orientation-switch: true

      port:
        $ref: /schemas/graph.yaml#/properties/port
        description: Connection to USB Type-C connector SS port

    required:
      - '#phy-cells'

required:
  - compatible
  - reg
  - clocks
  - clock-names
  - resets
  - reset-names
  - dp-port
  - usb3-port

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/rk3399-cru.h>

    phy@ff7c0000 {
        compatible = "rockchip,rk3399-typec-phy";
        reg = <0xff7c0000 0x40000>;
        rockchip,grf = <&grf>;
        extcon = <&fusb0>;
        clocks = <&cru SCLK_UPHY0_TCPDCORE>,
           <&cru SCLK_UPHY0_TCPDPHY_REF>;
        clock-names = "tcpdcore", "tcpdphy-ref";
        resets = <&cru SRST_UPHY0>,
                 <&cru SRST_UPHY0_PIPE_L00>,
                 <&cru SRST_P_UPHY0_TCPHY>;
        reset-names = "uphy", "uphy-pipe", "uphy-tcphy";

        dp-port {
            #phy-cells = <0>;
        };

        usb3-port {
            #phy-cells = <0>;
        };
    };

...