Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qianhui Xu" <xiaqinghuan@mail.ustc.edu.cn>, linux-usb@vger.kernel.org
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v10 1/3] dt-bindings: usb: snps,dwc3: describe two connectors on one HS data bus
Date: Sat, 21 Nov 2026 02:40:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-226549@kernel.org> (raw)
In-Reply-To: <20261121022104.1507987-2-xiaqinghuan@mail.ustc.edu.cn>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] dt-bindings: usb: snps,dwc3: unconditional hs-port ref breaks
  non-mux port@0
- [Low] dt-bindings: usb: snps,dwc3: unaddressed maintainer feedback on
  schema style
- [Low] dt-bindings: usb: snps,dwc3: requiring dr_mode overrides
  usb-drd.yaml default
--

commit 3dfd09df6c148c2b5dd730fefdb79828ea834f98
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>

dt-bindings: usb: snps,dwc3: describe two connectors on one HS data bus

This commit updates the Synopsys DWC3 common DT binding schema to describe
two Type-C connectors sharing a High Speed data bus through a multiplexer,
adding mux-controls and two endpoint nodes under port@0 with per-connector
usb-role-switch and mux-state properties.

> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> index 6c0b8b6538246..57e3c1d9ed038 100644
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> @@ -13,6 +13,89 @@ description:
>    Defines the properties of the DWC3 core as being embedded in either an
>    vendor-specific implementation or as a standalone component.
>  
> +$defs:
> +  hs-endpoint:
> +    $ref: /schemas/graph.yaml#/$defs/endpoint-base
> +    unevaluatedProperties: false
> +
> +    properties:
> +      usb-role-switch:
> +        type: boolean
> +        description:
> +          This connector endpoint has its own USB role switch. The switch is
> +          registered against this endpoint and looked up with
> +          usb_role_switch_at_endpoint().
> +
> +      mux-state:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        enum: [0, 1]
> +        description:
> +          State of the High Speed data bus multiplexer which connects this
> +          connector to the controller.  The two connectors of one controller
> +          must use different states; the driver rejects a device tree where
> +          two connectors claim the same one.
> +
> +    dependentRequired:
> +      usb-role-switch: [mux-state]
> +      mux-state: [usb-role-switch]
> +
> +  hs-port:
> +    $ref: /schemas/graph.yaml#/$defs/port-base
> +    unevaluatedProperties: false

[ ... ]

> +      endpoint@0:
> +        $ref: '#/$defs/hs-endpoint'
> +        required: [reg, usb-role-switch, mux-state]
> +
> +      endpoint@1:
> +        $ref: '#/$defs/hs-endpoint'
> +        required: [reg, usb-role-switch, mux-state]

[ ... ]

> @@ -26,8 +109,46 @@ allOf:
>        $ref: usb.yaml#
>      else:
>        $ref: usb-xhci.yaml#
> +  - if:
> +      required: [mux-controls]
> +    then:
> +      # The mux path is only taken when the controller itself carries
> +      # "usb-role-switch": dwc3_get_dr_mode() forces dr_mode back to
> +      # peripheral, dwc3_get_extcon() skips the role-switch branch and
> +      # dwc3_drd_init() never sets the mux up without it.

[Severity: Low]
As reported by Rob Herring on v9 [1], should the local $defs be dropped in
favor of defining the endpoint schema under patternProperties for
'^endpoint@[01]$', and can the Linux driver implementation details
(usb_role_switch_at_endpoint(), dwc3_get_dr_mode(), dwc3_get_extcon(),
dwc3_drd_init(), and driver validation behavior) be removed from the
binding?

> +      required: [dr_mode, ports, usb-role-switch]
> +      properties:
> +        dr_mode:
> +          const: otg

[Severity: Low]
Does listing dr_mode in required reject DWC3 nodes with mux-controls that
omit dr_mode to rely on the default "otg" mode from usb-drd.yaml?

In usb-drd.yaml (and dwc3_get_dr_mode() when usb-role-switch is present),
dr_mode already defaults to "otg" when omitted.  Keeping dr_mode: const:
otg under properties while dropping dr_mode from required would still
reject "host" or "peripheral" without forcing board DTs to specify dr_mode
explicitly.

> +        ports:
> +          required: [port@0]
> +          properties:
> +            port@0:
> +              required: ['#address-cells', '#size-cells',
> +                         endpoint@0, endpoint@1]
> +    else:
> +      # Without a mux the High Speed port keeps the generic graph port
> +      # binding, so single-endpoint controllers are described as before.
> +      # port@0 is referenced here rather than declared once in "ports"
> +      # because the graph port forbids properties it does not know
> +      # (unevaluatedProperties: false), which would reject the per-connector
> +      # "usb-role-switch" and "mux-state" of the dual-connector form.
> +      properties:
> +        ports:
> +          properties:
> +            port@0:
> +              $ref: /schemas/graph.yaml#/properties/port

[ ... ]

> @@ -411,7 +532,7 @@ properties:
>  
>      properties:
>        port@0:
> -        $ref: /schemas/graph.yaml#/properties/port
> +        $ref: '#/$defs/hs-port'
>          description: High Speed (HS) data bus.

[Severity: Medium]
Does applying $ref: '#/$defs/hs-port' unconditionally to port@0 cause a
dtbs_check regression for single-connector DWC3 nodes without mux-controls?

In JSON Schema, unevaluatedProperties: false inside hs-port only sees
properties evaluated within hs-port itself, not properties evaluated by
the allOf else branch ($ref: /schemas/graph.yaml#/properties/port).
Because /schemas/graph.yaml#/$defs/port-base omits endpoint and hs-port
only declares endpoint@0 and endpoint@1 (both requiring usb-role-switch
and mux-state), non-mux DWC3 nodes using port@0/endpoint (such as
arch/arm64/boot/dts/qcom/sm8250.dtsi) fail validation with endpoint
rejected as unevaluated, while non-mux nodes using port@0/endpoint@0 fail
because hs-port requires usb-role-switch and mux-state that
/schemas/graph.yaml#/properties/port rejects.

Should $ref: '#/$defs/hs-port' be applied to port@0 only in the
mux-controls then branch of allOf (as described in the else branch
comment), leaving top-level port@0 with only its description?

[1] https://lore.kernel.org/r/20261118153457.GB1824160-robh@kernel.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261121022104.1507987-1-xiaqinghuan@mail.ustc.edu.cn?part=1

  reply	other threads:[~2026-11-21  2:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  5:21 [PATCH v9 0/3] usb: dwc3: support two connectors sharing one HS data bus Qianhui Xu
2026-11-17  5:21 ` [PATCH v9 1/3] dt-bindings: usb: snps,dwc3: two connectors are two endpoints of one port Qianhui Xu
2026-11-17  5:40   ` sashiko-bot
2026-11-18 15:34   ` Rob Herring
2026-11-17  5:21 ` [PATCH v9 2/3] usb: roles: look up role switches attached to a graph endpoint Qianhui Xu
2026-11-17  5:27   ` sashiko-bot
2026-11-17  5:21 ` [PATCH v9 3/3] usb: dwc3: select the shared HS data bus with a mux controller Qianhui Xu
2026-11-17  5:37   ` sashiko-bot
2026-11-18 15:27   ` Rob Herring
2026-11-21  2:21 ` [PATCH v10 0/3] usb: dwc3: support two connectors sharing one HS data bus Qianhui Xu
2026-11-21  2:21   ` [PATCH v10 1/3] dt-bindings: usb: snps,dwc3: describe two connectors on " Qianhui Xu
2026-11-21  2:40     ` sashiko-bot [this message]
2026-11-21  2:21   ` [PATCH v10 2/3] usb: roles: look up role switches attached to a graph endpoint Qianhui Xu
2026-11-21  2:21   ` [PATCH v10 3/3] usb: dwc3: select the shared HS data bus with a mux controller Qianhui Xu
2026-11-21  2:33     ` sashiko-bot
2026-11-21  2:40   ` [PATCH v10 0/3] usb: dwc3: support two connectors sharing one HS data bus sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-226549@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaqinghuan@mail.ustc.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox