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

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] dt-bindings: usb: snps,dwc3: incomplete endpoint schema under
  port@0
- [Low] dt-bindings: usb: snps,dwc3: inter-version changelog above
  tearline
--

commit 130dcbe74a6b42db1a884410d33da8ccd5d1193b
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>

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

This commit extends the DWC3 common DT binding to describe two USB
connectors multiplexed onto the High Speed port@0 via mux-controls and
per-endpoint usb-role-switch and mux-state properties.

> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
>
> Changes since v13:
>  - [sashiko, 2026-11-23, Low] "missing maxItems: 1 on mux-controls".
>    Accepted: the shared data bus is driven by one two-state multiplexer, so
>    "mux-controls" now says "maxItems: 1" instead of leaving the number of
>    mux controllers open.

[Severity: Low]
This isn't a bug, but the "Changes since v13:" block is placed above the
"---" tearline separator, so git am records the revision changelog in the
permanent commit message.

> diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> index 6c0b8b6538246..dcfa8c3a81c51 100644
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> @@ -26,8 +26,78 @@ allOf:
>        $ref: usb.yaml#
>      else:
>        $ref: usb-xhci.yaml#
> +  - if:
> +      required: [mux-controls]
> +    then:
> +      # A multiplexed High Speed bus only makes sense when the controller is
> +      # dual-role and both connectors can switch their role independently.
> +      required: [ports, usb-role-switch]
> +      properties:
> +        dr_mode:
> +          const: otg
> +        ports:
> +          required: [port@0]
> +          properties:
> +            port@0:
> +              required: ['#address-cells', '#size-cells',
> +                         endpoint@0, endpoint@1]
> +              # A mux'ed High Speed bus has exactly two connectors, as the
> +              # two endpoints of this port; a plain "endpoint" or any further
> +              # endpoint would be a third data stream and is not described.
> +              properties:
> +                endpoint: false
> +              patternProperties:
> +                '^endpoint@[01]$':
> +                  required: [usb-role-switch, mux-state]
> +                '^endpoint@([2-9]|[1-9a-f][0-9a-f]+)$': false
> +              # The two connectors must claim opposite mux states.  Kept inside
> +              # this branch: JSON Schema evaluates "properties" of an absent
> +              # property as true, so the same "oneOf" outside the branch would
> +              # see both alternatives match when "mux-state" is not used at all.
> +              oneOf:
> +                - properties:
> +                    endpoint@0:
> +                      properties:
> +                        mux-state:
> +                          const: 0
> +                    endpoint@1:
> +                      properties:
> +                        mux-state:
> +                          const: 1
> +                - properties:
> +                    endpoint@0:
> +                      properties:
> +                        mux-state:
> +                          const: 1
> +                    endpoint@1:
> +                      properties:
> +                        mux-state:
> +                          const: 0
> +    else:
> +      # Without a mux the High Speed port keeps the generic graph port
> +      # binding, so single-connector controllers are described as before and
> +      # the per-connector properties have no meaning.
> +      properties:
> +        ports:
> +          properties:
> +            port@0:
> +              patternProperties:
> +                '^endpoint@[01]$':
> +                  properties:
> +                    usb-role-switch: false
> +                    mux-state: false

[ ... ]

> @@ -411,9 +481,37 @@ properties:
>  
>      properties:
>        port@0:
> -        $ref: /schemas/graph.yaml#/properties/port
> +        # The High Speed port carries the controller's HS data stream.  Two
> +        # receptacles sharing one HS D+/D- pair are two mux'ed data streams of
> +        # that one stream, so they are two endpoints of this port and not two
> +        # ports.  A single-connector controller describes the plain "endpoint"
> +        # of the graph binding and is unaffected.
> +        $ref: /schemas/graph.yaml#/$defs/port-base
> +        unevaluatedProperties: false
>          description: High Speed (HS) data bus.
>  
> +        patternProperties:
> +          '^endpoint@[01]$':
> +            $ref: /schemas/graph.yaml#/$defs/endpoint-base
> +            unevaluatedProperties: false

[Severity: Low]
Does switching port@0 to /schemas/graph.yaml#/$defs/port-base leave plain
port@0/endpoint nodes without unevaluatedProperties: false when
mux-controls is absent?

In dtschema, $defs/port-base validates ^endpoint(@[0-9a-f]+)?$ against
$defs/endpoint-base (which leaves unevaluatedProperties open for bindings
to extend), whereas /schemas/graph.yaml#/properties/port closes endpoints
with /schemas/graph.yaml#/properties/endpoint.  Because port@0 only adds
unevaluatedProperties: false to ^endpoint@[01]$ and the else branch does
not reference /schemas/graph.yaml#/properties/port, a plain
port@0/endpoint node (or endpoint@2+) on a single-connector controller will
accept arbitrary undocumented properties, including usb-role-switch and
mux-state.

Also, in the then branch, '^endpoint@([2-9]|[1-9a-f][0-9a-f]+)$': false
omits single-digit hex unit addresses a-f, allowing endpoint@a through
endpoint@f.

Referencing $ref: /schemas/graph.yaml#/properties/port under port@0 in the
else branch and changing [2-9] to [2-9a-f] in the then branch pattern would
close both gaps.

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

  reply	other threads:[~2026-11-25  8:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  8:12 [PATCH v15 0/3] usb: dwc3: support two connectors sharing one HS data bus Qianhui Xu
2026-11-25  8:12 ` [PATCH v15 1/3] dt-bindings: usb: snps,dwc3: describe two connectors on " Qianhui Xu
2026-11-25  8:29   ` sashiko-bot [this message]
2026-11-25  8:12 ` [PATCH v15 2/3] usb: roles: look up role switches attached to a graph endpoint Qianhui Xu
2026-11-25  8:12 ` [PATCH v15 3/3] usb: dwc3: select the shared HS data bus with a mux controller Qianhui Xu
2026-11-25  8:31 ` [PATCH v15 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-232903@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