162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
262306a36Sopenharmony_ci# Copyright 2023 Realtek Semiconductor Corporation
362306a36Sopenharmony_ci%YAML 1.2
462306a36Sopenharmony_ci---
562306a36Sopenharmony_ci$id: http://devicetree.org/schemas/phy/realtek,usb2phy.yaml#
662306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
762306a36Sopenharmony_ci
862306a36Sopenharmony_cititle: Realtek DHC SoCs USB 2.0 PHY
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cimaintainers:
1162306a36Sopenharmony_ci  - Stanley Chang <stanley_chang@realtek.com>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  Realtek USB 2.0 PHY support the digital home center (DHC) RTD series SoCs.
1562306a36Sopenharmony_ci  The USB 2.0 PHY driver is designed to support the XHCI controller. The SoCs
1662306a36Sopenharmony_ci  support multiple XHCI controllers. One PHY device node maps to one XHCI
1762306a36Sopenharmony_ci  controller.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci  RTD1295/RTD1619 SoCs USB
2062306a36Sopenharmony_ci  The USB architecture includes three XHCI controllers.
2162306a36Sopenharmony_ci  Each XHCI maps to one USB 2.0 PHY and map one USB 3.0 PHY on some
2262306a36Sopenharmony_ci  controllers.
2362306a36Sopenharmony_ci  XHCI controller#0 -- usb2phy -- phy#0
2462306a36Sopenharmony_ci                    |- usb3phy -- phy#0
2562306a36Sopenharmony_ci  XHCI controller#1 -- usb2phy -- phy#0
2662306a36Sopenharmony_ci  XHCI controller#2 -- usb2phy -- phy#0
2762306a36Sopenharmony_ci                    |- usb3phy -- phy#0
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci  RTD1395 SoCs USB
3062306a36Sopenharmony_ci  The USB architecture includes two XHCI controllers.
3162306a36Sopenharmony_ci  The controller#0 has one USB 2.0 PHY. The controller#1 includes two USB 2.0
3262306a36Sopenharmony_ci  PHY.
3362306a36Sopenharmony_ci  XHCI controller#0 -- usb2phy -- phy#0
3462306a36Sopenharmony_ci  XHCI controller#1 -- usb2phy -- phy#0
3562306a36Sopenharmony_ci                               |- phy#1
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci  RTD1319/RTD1619b SoCs USB
3862306a36Sopenharmony_ci  The USB architecture includes three XHCI controllers.
3962306a36Sopenharmony_ci  Each XHCI maps to one USB 2.0 PHY and map one USB 3.0 PHY on controllers#2.
4062306a36Sopenharmony_ci  XHCI controller#0 -- usb2phy -- phy#0
4162306a36Sopenharmony_ci  XHCI controller#1 -- usb2phy -- phy#0
4262306a36Sopenharmony_ci  XHCI controller#2 -- usb2phy -- phy#0
4362306a36Sopenharmony_ci                    |- usb3phy -- phy#0
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci  RTD1319d SoCs USB
4662306a36Sopenharmony_ci  The USB architecture includes three XHCI controllers.
4762306a36Sopenharmony_ci  Each xhci maps to one USB 2.0 PHY and map one USB 3.0 PHY on controllers#0.
4862306a36Sopenharmony_ci  XHCI controller#0 -- usb2phy -- phy#0
4962306a36Sopenharmony_ci                    |- usb3phy -- phy#0
5062306a36Sopenharmony_ci  XHCI controller#1 -- usb2phy -- phy#0
5162306a36Sopenharmony_ci  XHCI controller#2 -- usb2phy -- phy#0
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci  RTD1312c/RTD1315e SoCs USB
5462306a36Sopenharmony_ci  The USB architecture includes three XHCI controllers.
5562306a36Sopenharmony_ci  Each XHCI maps to one USB 2.0 PHY.
5662306a36Sopenharmony_ci  XHCI controller#0 -- usb2phy -- phy#0
5762306a36Sopenharmony_ci  XHCI controller#1 -- usb2phy -- phy#0
5862306a36Sopenharmony_ci  XHCI controller#2 -- usb2phy -- phy#0
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciproperties:
6162306a36Sopenharmony_ci  compatible:
6262306a36Sopenharmony_ci    enum:
6362306a36Sopenharmony_ci      - realtek,rtd1295-usb2phy
6462306a36Sopenharmony_ci      - realtek,rtd1312c-usb2phy
6562306a36Sopenharmony_ci      - realtek,rtd1315e-usb2phy
6662306a36Sopenharmony_ci      - realtek,rtd1319-usb2phy
6762306a36Sopenharmony_ci      - realtek,rtd1319d-usb2phy
6862306a36Sopenharmony_ci      - realtek,rtd1395-usb2phy
6962306a36Sopenharmony_ci      - realtek,rtd1395-usb2phy-2port
7062306a36Sopenharmony_ci      - realtek,rtd1619-usb2phy
7162306a36Sopenharmony_ci      - realtek,rtd1619b-usb2phy
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci  reg:
7462306a36Sopenharmony_ci    items:
7562306a36Sopenharmony_ci      - description: PHY data registers
7662306a36Sopenharmony_ci      - description: PHY control registers
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci  "#phy-cells":
7962306a36Sopenharmony_ci    const: 0
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci  nvmem-cells:
8262306a36Sopenharmony_ci    maxItems: 2
8362306a36Sopenharmony_ci    description:
8462306a36Sopenharmony_ci      Phandles to nvmem cell that contains the trimming data.
8562306a36Sopenharmony_ci      If unspecified, default value is used.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci  nvmem-cell-names:
8862306a36Sopenharmony_ci    items:
8962306a36Sopenharmony_ci      - const: usb-dc-cal
9062306a36Sopenharmony_ci      - const: usb-dc-dis
9162306a36Sopenharmony_ci    description:
9262306a36Sopenharmony_ci      The following names, which correspond to each nvmem-cells.
9362306a36Sopenharmony_ci      usb-dc-cal is the driving level for each phy specified via efuse.
9462306a36Sopenharmony_ci      usb-dc-dis is the disconnection level for each phy specified via efuse.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci  realtek,inverse-hstx-sync-clock:
9762306a36Sopenharmony_ci    description:
9862306a36Sopenharmony_ci      For one of the phys of RTD1619b SoC, the synchronous clock of the
9962306a36Sopenharmony_ci      high-speed tx must be inverted.
10062306a36Sopenharmony_ci    type: boolean
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci  realtek,driving-level:
10362306a36Sopenharmony_ci    description:
10462306a36Sopenharmony_ci      Control the magnitude of High speed Dp/Dm output swing (mV).
10562306a36Sopenharmony_ci      For a different board or port, the original magnitude maybe not meet
10662306a36Sopenharmony_ci      the specification. In this situation we can adjust the value to meet
10762306a36Sopenharmony_ci      the specification.
10862306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
10962306a36Sopenharmony_ci    default: 8
11062306a36Sopenharmony_ci    minimum: 0
11162306a36Sopenharmony_ci    maximum: 31
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci  realtek,driving-level-compensate:
11462306a36Sopenharmony_ci    description:
11562306a36Sopenharmony_ci      For RTD1315e SoC, the driving level can be adjusted by reading the
11662306a36Sopenharmony_ci      efuse table. This property provides drive compensation.
11762306a36Sopenharmony_ci      If the magnitude of High speed Dp/Dm output swing still not meet the
11862306a36Sopenharmony_ci      specification, then we can set this value to meet the specification.
11962306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/int32
12062306a36Sopenharmony_ci    default: 0
12162306a36Sopenharmony_ci    minimum: -8
12262306a36Sopenharmony_ci    maximum: 8
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci  realtek,disconnection-compensate:
12562306a36Sopenharmony_ci    description:
12662306a36Sopenharmony_ci      This adjusts the disconnection level compensation for the different
12762306a36Sopenharmony_ci      boards with different disconnection level.
12862306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/int32
12962306a36Sopenharmony_ci    default: 0
13062306a36Sopenharmony_ci    minimum: -8
13162306a36Sopenharmony_ci    maximum: 8
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_cirequired:
13462306a36Sopenharmony_ci  - compatible
13562306a36Sopenharmony_ci  - reg
13662306a36Sopenharmony_ci  - "#phy-cells"
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ciallOf:
13962306a36Sopenharmony_ci  - if:
14062306a36Sopenharmony_ci      not:
14162306a36Sopenharmony_ci        properties:
14262306a36Sopenharmony_ci          compatible:
14362306a36Sopenharmony_ci            contains:
14462306a36Sopenharmony_ci              enum:
14562306a36Sopenharmony_ci                - realtek,rtd1619b-usb2phy
14662306a36Sopenharmony_ci    then:
14762306a36Sopenharmony_ci      properties:
14862306a36Sopenharmony_ci        realtek,inverse-hstx-sync-clock: false
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci  - if:
15162306a36Sopenharmony_ci      not:
15262306a36Sopenharmony_ci        properties:
15362306a36Sopenharmony_ci          compatible:
15462306a36Sopenharmony_ci            contains:
15562306a36Sopenharmony_ci              enum:
15662306a36Sopenharmony_ci                - realtek,rtd1315e-usb2phy
15762306a36Sopenharmony_ci    then:
15862306a36Sopenharmony_ci      properties:
15962306a36Sopenharmony_ci        realtek,driving-level-compensate: false
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ciadditionalProperties: false
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ciexamples:
16462306a36Sopenharmony_ci  - |
16562306a36Sopenharmony_ci    usb-phy@13214 {
16662306a36Sopenharmony_ci        compatible = "realtek,rtd1619b-usb2phy";
16762306a36Sopenharmony_ci        reg = <0x13214 0x4>, <0x28280 0x4>;
16862306a36Sopenharmony_ci        #phy-cells = <0>;
16962306a36Sopenharmony_ci        nvmem-cells = <&otp_usb_port0_dc_cal>, <&otp_usb_port0_dc_dis>;
17062306a36Sopenharmony_ci        nvmem-cell-names = "usb-dc-cal", "usb-dc-dis";
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci        realtek,inverse-hstx-sync-clock;
17362306a36Sopenharmony_ci        realtek,driving-level = <0xa>;
17462306a36Sopenharmony_ci        realtek,disconnection-compensate = <(-1)>;
17562306a36Sopenharmony_ci    };
176