All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: udc: Link otg and gadget
@ 2025-11-19 15:26 Johan Korsnes
  2025-11-19 15:32 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Korsnes @ 2025-11-19 15:26 UTC (permalink / raw)
  To: linux-usb; +Cc: Johan Korsnes, Xu Yang, Peter Chen, Greg Kroah-Hartman

Link OTG with gadget, same as other UDC drivers.

Signed-off-by: Johan Korsnes <johan.korsnes@remarkable.no>
Cc: Xu Yang <xu.yang_2@nxp.com>
Cc: Peter Chen <peter.chen@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/chipidea/udc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 64a421ae0f05..1d2f9543ea37 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -2125,6 +2125,9 @@ static int ci_udc_start(struct usb_gadget *gadget,
 
 	ci->driver = driver;
 
+	if (!IS_ERR_OR_NULL(ci->usb_phy))
+		otg_set_peripheral(ci->usb_phy->otg, &ci->gadget);
+
 	/* Start otg fsm for B-device */
 	if (ci_otg_is_fsm_mode(ci) && ci->fsm.id) {
 		ci_hdrc_otg_fsm_start(ci);
@@ -2166,6 +2169,9 @@ static int ci_udc_stop(struct usb_gadget *gadget)
 	spin_lock_irqsave(&ci->lock, flags);
 	ci->driver = NULL;
 
+	if (!IS_ERR_OR_NULL(ci->usb_phy))
+		otg_set_peripheral(ci->usb_phy->otg, NULL);
+
 	if (ci->vbus_active) {
 		hw_device_state(ci, 0);
 		spin_unlock_irqrestore(&ci->lock, flags);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-19 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 15:26 [PATCH] usb: chipidea: udc: Link otg and gadget Johan Korsnes
2025-11-19 15:32 ` Greg Kroah-Hartman
2025-11-19 16:05   ` Johan Korsnes

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.