Devicetree
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 1/3] dt-bindings: usb: snps,dwc3: two connectors are two endpoints of one port
Date: Wed, 18 Nov 2026 09:34:57 -0600	[thread overview]
Message-ID: <20261118153457.GB1824160-robh@kernel.org> (raw)
In-Reply-To: <20261117052137.32833-2-xiaqinghuan@mail.ustc.edu.cn>

On Tue, Nov 17, 2026 at 01:21:35PM +0800, Qianhui Xu wrote:
> Rework of the v8 binding per Rob Herring's review of
> 2026-11-10 16:36Z (<20261110163640.GA85824-robh@kernel.org>):
> 
>   "ports are for separate data streams. Endpoints are for mux'ed data
>    streams. This looks like the latter, so port@0 should have 2 endpoints
>    and port@2 dropped."
> 
> and, for the GPIO property:
> 
>   "Use the gpio mux binding."
> 
> Two connectors sharing one High Speed D+/D- pair are two mux'ed data
> streams of one port, so they become endpoint@0 and endpoint@1 of port@0
> (the Super Speed lane stays port@1).  The GPIO that selects between them
> is no longer described by a private "port-select-gpios" property but by a
> "gpio-mux" controller referenced from "mux-controls", and the endpoint of
> each connector carries the mux state that reaches it.
> 
> *** AI-assistance disclosure ***
> This patch was prepared with the help of an LLM coding assistant.  The
> author reviewed every line and ran the gates quoted in the series notes.
> 
> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> ---
> 
> DRAFT: driver (3/3) still uses a GPIO and must be ported to mux_control_*
> in the same series; DTS (2/3 equivalent) must be rewritten to the new
> shape.  See README.md in this directory.

??

> 
> --- a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> +++ b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml
> @@ -13,6 +13,84 @@ description:
>    Defines the properties of the DWC3 core as being embedded in either an
>    vendor-specific implementation or as a standalone component.
>  
> +$defs:

You don't need to use $defs here.

> +  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
> +
> +    # The two connectors are two mux'ed data streams of the same High Speed
> +    # bus, so they are two endpoints of one port, not two ports: "ports"
> +    # describes the controller's own data streams (HS in port@0, SS in
> +    # port@1), and an endpoint describes one stream multiplexed onto a port.
> +    properties:
> +      '#address-cells':
> +        const: 1
> +
> +      '#size-cells':
> +        const: 0
> +
> +      endpoint@0:
> +        $ref: '#/$defs/hs-endpoint'
> +        required: [reg]
> +
> +      endpoint@1:
> +        $ref: '#/$defs/hs-endpoint'
> +        required: [reg]

These can be:

patternProperties:
  '^endpoint@[01]$':
    [everything from hs-endpoint]

> +
> +    required: ['#address-cells', '#size-cells', endpoint@0, endpoint@1]
> +
> +    # The two connectors must claim opposite mux states; requiring both
> +    # endpoints in every branch is what makes the two cases mutually
> +    # exclusive for oneOf.
> +    oneOf:
> +      - properties:
> +          endpoint@0:
> +            properties:
> +              mux-state:
> +                $ref: /schemas/types.yaml#/definitions/uint32
> +                const: 0
> +          endpoint@1:
> +            properties:
> +              mux-state:
> +                $ref: /schemas/types.yaml#/definitions/uint32
> +                const: 1
> +      - properties:
> +          endpoint@0:
> +            properties:
> +              mux-state:
> +                $ref: /schemas/types.yaml#/definitions/uint32
> +                const: 1
> +          endpoint@1:
> +            properties:
> +              mux-state:
> +                $ref: /schemas/types.yaml#/definitions/uint32
> +                const: 0
> +
>  allOf:
>    - $ref: usb-drd.yaml#
>    - if:
> @@ -26,8 +104,47 @@ 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.

Don't put driver specifics in bindings.

> +      required: [dr_mode, ports, usb-role-switch]
> +      properties:
> +        dr_mode:
> +          const: otg
> +        ports:
> +          required: [port@0]
> +          properties:
> +            port@0:
> +              $ref: '#/$defs/hs-port'

This $ref can be dropped. You already have the schema for 'port@0' 
below.

> +    else:
> +      properties:
> +        ports:
> +          properties:
> +            port@0:
> +              properties:
> +                endpoint@0:
> +                  properties:
> +                    usb-role-switch: false
> +                    mux-state: false
> +                endpoint@1:
> +                  properties:
> +                    usb-role-switch: false
> +                    mux-state: false
>  
>  properties:
> +  mux-controls:
> +    maxItems: 1
> +    description:
> +      Phandle to the multiplexer that selects which of the two connectors
> +      drives the controller's shared High Speed data bus, e.g. a
> +      "gpio-mux" controller.  Each connector is described by the endpoint@0
> +      or endpoint@1 of "port@0", and the endpoint of that connector carries
> +      its own role-switch input and the "mux-state" it is reached in.
> +
>    extcon:
>      maxItems: 1
>      deprecated: true
> @@ -411,7 +528,7 @@ properties:
>  
>      properties:
>        port@0:
> -        $ref: /schemas/graph.yaml#/properties/port
> +        $ref: '#/$defs/hs-port'

  parent reply	other threads:[~2026-11-18 15:34 UTC|newest]

Thread overview: 8+ 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 [this message]
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: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

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=20261118153457.GB1824160-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --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