From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Olivier Louvignes <olivier@mgcrea.io>
Cc: Minas Harutyunyan <hminas@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc2: gadget: Restart the gadget when a new session follows a session end
Date: Thu, 5 Nov 2026 00:23:08 +0000 [thread overview]
Message-ID: <auvJvr3oFWhB2SeR@vbox> (raw)
In-Reply-To: <20261023091832.6765-1-olivier@mgcrea.io>
On Fri, Oct 23, 2026, Olivier Louvignes wrote:
> When the B-session becomes invalid (the cable is pulled),
> dwc2_hsotg_disconnect() disconnects the gadget and leaves it in L3.
> Nothing brings it back, unless something outside the controller reports
> VBUS through usb_gadget_vbus_connect(): the next USB reset does not
> reinitialise a gadget that is not connected, and dwc2_hsotg_ep_queue()
> then refuses EP0's setup request because lx_state is not L0. Every
> enumeration after a replug fails with
>
> dwc2_hsotg_enqueue_setup: failed queue (-11)
>
> On the session request interrupt that a new session raises, start the
> gadget again when it is in L3, as dwc2_hsotg_vbus_session() does when a
> session becomes active.
>
> Seen on an Ingenic X1600 (HiBy R1) in peripheral mode with g_serial and
> no VBUS notifier. After a replug the host enumerates the gadget again
> and the serial shell comes back, without a reboot. Tested on v7.3.
>
> Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
> ---
> Tested on one board only, in peripheral mode. The alternative is for the
> platform glue to report VBUS with usb_gadget_vbus_connect() (a
> usb_role_switch or extcon notifier), which this board does not have: its
> VBUS is seen by a PMIC with no such driver. If that is the preferred
> place for this, I will look at doing it there instead. The patch is
> build-tested on 734bef548a96 (v7.3-7363) with and without gadget support.
>
> drivers/usb/dwc2/core.h | 2 ++
> drivers/usb/dwc2/core_intr.c | 3 +++
> drivers/usb/dwc2/gadget.c | 29 +++++++++++++++++++++++++++++
> 3 files changed, 34 insertions(+)
>
Please address Sashiko's feedback.
Thanks,
Thinh
next prev parent reply other threads:[~2026-11-05 0:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 9:18 [PATCH] usb: dwc2: gadget: Restart the gadget when a new session follows a session end Olivier Louvignes
2026-10-23 9:37 ` sashiko-bot
2026-11-05 0:23 ` Thinh Nguyen [this message]
2026-11-05 22:18 ` Olivier Louvignes
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=auvJvr3oFWhB2SeR@vbox \
--to=thinh.nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=hminas@synopsys.com \
--cc=linux-usb@vger.kernel.org \
--cc=olivier@mgcrea.io \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.