mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/6] usb: gadget: add usb_gadget_udc_reset function
Date: Mon, 16 Sep 2019 14:43:41 +0200	[thread overview]
Message-ID: <20190916124345.24244-2-s.trumtrar@pengutronix.de> (raw)
In-Reply-To: <20190916124345.24244-1-s.trumtrar@pengutronix.de>

Add a function to notify the udc core, that a bus reset occured.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/usb/gadget/udc-core.c | 15 +++++++++++++++
 include/usb/gadget.h          |  4 ++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index e357456098ae..096f05ed48df 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -108,6 +108,21 @@ void usb_gadget_set_state(struct usb_gadget *gadget,
 }
 EXPORT_SYMBOL_GPL(usb_gadget_set_state);
 
+/**
+ * usb_gadget_udc_reset - notifies the udc core that bus reset occurs
+ * @gadget: The gadget which bus reset occurs
+ * @driver: The gadget driver we want to notify
+ *
+ * If the udc driver has bus reset handler, it needs to call this when the bus
+ * reset occurs, it notifies the gadget driver that the bus reset occurs as
+ * well as updates gadget state.
+ */
+void usb_gadget_udc_reset(struct usb_gadget *gadget,
+		struct usb_gadget_driver *driver)
+{
+	usb_gadget_set_state(gadget, USB_STATE_DEFAULT);
+}
+EXPORT_SYMBOL_GPL(usb_gadget_udc_reset);
 /* ------------------------------------------------------------------------- */
 
 /**
diff --git a/include/usb/gadget.h b/include/usb/gadget.h
index 80418a9cd447..afa11b2d9d8a 100644
--- a/include/usb/gadget.h
+++ b/include/usb/gadget.h
@@ -1018,6 +1018,10 @@ extern void usb_gadget_set_state(struct usb_gadget *gadget,
 
 /*-------------------------------------------------------------------------*/
 
+/* utility to tell udc core that the bus reset occurs */
+extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
+				 struct usb_gadget_driver *driver);
+
 /* utility wrapping a simple endpoint selection policy */
 
 extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-09-16 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 12:43 [PATCH 1/6] barebox-wrapper: add IRQ_WAKE_THREAD Steffen Trumtrar
2019-09-16 12:43 ` Steffen Trumtrar [this message]
2019-09-16 12:43 ` [PATCH 3/6] usb/ch9.h: add USB 3.1 isoc endpoint define Steffen Trumtrar
2019-09-16 12:43 ` [PATCH 4/6] usb: dwc3: add support for gadget mode Steffen Trumtrar
2019-09-16 12:43 ` [PATCH 5/6] usb: gadget: composite: conditionally dequeue setup requests Steffen Trumtrar
2019-09-16 12:43 ` [PATCH 6/6] ARM: Layerscape: LS1046a: configure USB ports Steffen Trumtrar
2019-09-17  9:52 ` [PATCH 1/6] barebox-wrapper: add IRQ_WAKE_THREAD Sascha Hauer

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=20190916124345.24244-2-s.trumtrar@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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