From: Inochi Amaoto <inochiama@gmail.com>
To: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Chen Wang <chen.wang@linux.dev>,
Inochi Amaoto <inochiama@gmail.com>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Minas Harutyunyan <hminas@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Longbin Li <looong.bin@gmail.com>,
Dinh Nguyen <dinguyen@opensource.altera.com>,
Paul Zimmerman <paulz@synopsys.com>, Felipe Balbi <balbi@ti.com>
Cc: devicetree@vger.kernel.org, sophgo@lists.linux.dev,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, Yixun Lan <dlan@gentoo.org>
Subject: [PATCH 1/4] usb: dwc2: gadget: honor pullup requests in core_connect
Date: Tue, 10 Nov 2026 15:06:22 +0800 [thread overview]
Message-ID: <20261110070627.217946-2-inochiama@gmail.com> (raw)
In-Reply-To: <20261110070627.217946-1-inochiama@gmail.com>
The connector ID work initializes the peripheral controller and calls
dwc2_hsotg_core_connect() even when no gadget driver has requested a
connection. After a host-to-device role change, this clears SFTDISCON
and lets the host enumerate an unconfigured gadget.
Check enabled in the connection helper. So the device will keep
disconnect until the controller is ready
Fixes: 510ffaa48eac ("usb: dwc2: Initialize the USB core for peripheral mode")
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
drivers/usb/dwc2/gadget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6c8a9f05fff0..5c8e85493289 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3664,7 +3664,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg)
{
/* remove the soft-disconnect and let's go */
- if (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD))
+ if (hsotg->enabled &&
+ (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD)))
dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
}
--
2.56.0
WARNING: multiple messages have this Message-ID (diff)
From: Inochi Amaoto <inochiama@gmail.com>
To: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Chen Wang <chen.wang@linux.dev>,
Inochi Amaoto <inochiama@gmail.com>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Minas Harutyunyan <hminas@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Longbin Li <looong.bin@gmail.com>,
Dinh Nguyen <dinguyen@opensource.altera.com>,
Paul Zimmerman <paulz@synopsys.com>, Felipe Balbi <balbi@ti.com>
Cc: devicetree@vger.kernel.org, sophgo@lists.linux.dev,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, Yixun Lan <dlan@gentoo.org>
Subject: [PATCH 1/4] usb: dwc2: gadget: honor pullup requests in core_connect
Date: Tue, 10 Nov 2026 15:06:22 +0800 [thread overview]
Message-ID: <20261110070627.217946-2-inochiama@gmail.com> (raw)
In-Reply-To: <20261110070627.217946-1-inochiama@gmail.com>
The connector ID work initializes the peripheral controller and calls
dwc2_hsotg_core_connect() even when no gadget driver has requested a
connection. After a host-to-device role change, this clears SFTDISCON
and lets the host enumerate an unconfigured gadget.
Check enabled in the connection helper. So the device will keep
disconnect until the controller is ready
Fixes: 510ffaa48eac ("usb: dwc2: Initialize the USB core for peripheral mode")
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
drivers/usb/dwc2/gadget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6c8a9f05fff0..5c8e85493289 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3664,7 +3664,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg)
{
/* remove the soft-disconnect and let's go */
- if (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD))
+ if (hsotg->enabled &&
+ (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD)))
dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
}
--
2.56.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-11-10 7:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 7:06 [PATCH 0/4] usb: dwc2: Add USB DRD support on CV1800 Series SoC Inochi Amaoto
2026-11-10 7:06 ` Inochi Amaoto
2026-11-10 7:06 ` Inochi Amaoto [this message]
2026-11-10 7:06 ` [PATCH 1/4] usb: dwc2: gadget: honor pullup requests in core_connect Inochi Amaoto
2026-11-10 7:21 ` sashiko-bot
2026-11-10 7:06 ` [PATCH 2/4] usb: dwc2: drd: Sync the generic PHY mode with role requests Inochi Amaoto
2026-11-10 7:06 ` Inochi Amaoto
2026-11-10 7:18 ` sashiko-bot
2026-11-10 7:27 ` Inochi Amaoto
2026-11-10 7:06 ` [PATCH 3/4] usb: dwc2: Add USB DRD support on CV1800 series SoC Inochi Amaoto
2026-11-10 7:06 ` Inochi Amaoto
2026-11-10 7:27 ` sashiko-bot
2026-11-10 7:06 ` [PATCH 4/4] riscv: dts: sophgo: Enable USB role switch on Huashan PI Inochi Amaoto
2026-11-10 7:06 ` Inochi Amaoto
2026-11-10 7:14 ` sashiko-bot
2026-11-10 10:41 ` Krzysztof Kozlowski
2026-11-10 10:41 ` Krzysztof Kozlowski
2026-11-10 11:21 ` Inochi Amaoto
2026-11-10 11:21 ` Inochi Amaoto
2026-11-13 7:23 ` [PATCH 0/4] usb: dwc2: Add USB DRD support on CV1800 Series SoC Chen-Yu Yeh
2026-11-13 7:23 ` Chen-Yu Yeh
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=20261110070627.217946-2-inochiama@gmail.com \
--to=inochiama@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=balbi@ti.com \
--cc=chen.wang@linux.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dinguyen@opensource.altera.com \
--cc=dlan@gentoo.org \
--cc=gregkh@linuxfoundation.org \
--cc=hminas@synopsys.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=looong.bin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paulz@synopsys.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=sophgo@lists.linux.dev \
/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.