Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	linux-usb@vger.kernel.org, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 3/3] usb: dwc3: select the shared HS data bus with a mux controller
Date: Mon, 23 Nov 2026 09:20:36 +0100	[thread overview]
Message-ID: <2026112313-skied-crock-7374@gregkh> (raw)
In-Reply-To: <20261121132029.2379449-4-xiaqinghuan@mail.ustc.edu.cn>

On Sat, Nov 21, 2026 at 09:20:29PM +0800, Qianhui Xu wrote:
> Two connectors can share one High Speed D+/D- pair only if a multiplexer
> selects which receptacle drives the controller, and that selection has to
> follow the USB mode: leaving it to a board level GPIO means the controller
> can end up driving the data lines of the connector that is not in use, and
> a host or gadget instance cannot be torn down while its own lines are still
> selected.
> 
> A mux controller cannot be read back, so the connector in use at boot
> cannot be detected: the first mode request claims the mux for state 0
> instead.  A move of the data path to the other connector is a mode
> switch even when the role does not change, which is why it goes through
> the same worker.
> 
> mux_control_select() sleeps while waiting for the controller and
> mux_control_deselect() may sleep as well, so both are only called from
> __dwc3_set_mode() on system_freezable_wq and from dwc3_drd_exit() after the
> mode work has been drained; the role-switch set() callback keeps recording
> the request and never touches the mux.  The mux stays selected between
> switches, since the controller always drives exactly one of the two
> connectors, and it is deselected on unbind.  The arbitration,
> publication ordering and teardown rules of the per-connector role switches
> are unchanged.
> 
> *** 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>
> ---
> 
> Changes since v10:
>  - deselect the mux in dwc3_drd_exit() after the active role has been torn
>    down instead of before: mux_control_deselect() switches the shared High
>    Speed lines back to the mux' idle state, so deselecting first cuts the
>    data path off underneath a host or gadget instance that is still
>    running.  This is the order __dwc3_set_mode() already used: role exit,
>    then the data path switch.

What about all the previous versions?  Please always include them all,
right?

thanks,

greg k-h

  reply	other threads:[~2026-11-23  8:20 UTC|newest]

Thread overview: 24+ 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
2026-11-21  9:11     ` Krzysztof Kozlowski
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
2026-11-21 13:20   ` [PATCH v11 " Qianhui Xu
2026-11-21 13:20     ` [PATCH v11 1/3] dt-bindings: usb: snps,dwc3: describe two connectors on " Qianhui Xu
2026-11-21 13:31       ` sashiko-bot
2026-11-21 13:20     ` [PATCH v11 2/3] usb: roles: look up role switches attached to a graph endpoint Qianhui Xu
2026-11-21 13:20     ` [PATCH v11 3/3] usb: dwc3: select the shared HS data bus with a mux controller Qianhui Xu
2026-11-23  8:20       ` Greg Kroah-Hartman [this message]
2026-11-21 13:32     ` [PATCH v11 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=2026112313-skied-crock-7374@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.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=robh@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