linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/4] usb: musb: gadget, stay IDLE without gadget driver
Date: Wed, 16 Oct 2013 14:51:09 +0200	[thread overview]
Message-ID: <1381927872-8181-2-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1381927872-8181-1-git-send-email-mpa@pengutronix.de>

If there is no gadget driver musb should stay in B_IDLE state.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/usb/musb/musb_core.c   |  3 ---
 drivers/usb/musb/musb_gadget.c | 14 ++++++++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 18e877f..7d40dec 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -831,12 +831,9 @@ b_host:
 			case OTG_STATE_B_WAIT_ACON:
 				dev_dbg(musb->controller, "HNP: RESET (%s), to b_peripheral\n",
 					usb_otg_state_string(musb->xceiv->state));
-				musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
 				musb_g_reset(musb);
 				break;
 			case OTG_STATE_B_IDLE:
-				musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
-				/* FALLTHROUGH */
 			case OTG_STATE_B_PERIPHERAL:
 				musb_g_reset(musb);
 				break;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index b19ed21..fddda5d 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -2113,10 +2113,20 @@ __acquires(musb->lock)
 	 * or else after HNP, as A-Device
 	 */
 	if (devctl & MUSB_DEVCTL_BDEVICE) {
-		musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+		if (!musb->gadget_driver) {
+			musb->is_active = 0;
+			musb->xceiv->state = OTG_STATE_B_IDLE;
+		} else {
+			musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+		}
 		musb->g.is_a_peripheral = 0;
 	} else {
-		musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
+		if (!musb->gadget_driver) {
+			musb->is_active = 0;
+			musb->xceiv->state = OTG_STATE_A_IDLE;
+		} else {
+			musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
+		}
 		musb->g.is_a_peripheral = 1;
 	}
 
-- 
1.8.4.rc3

  reply	other threads:[~2013-10-16 12:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 12:51 [PATCH v3 0/0] usb: musb bugfixes Markus Pargmann
2013-10-16 12:51 ` Markus Pargmann [this message]
2013-10-16 12:51 ` [PATCH v3 2/4] usb: musb: Bugfix of_node assignment Markus Pargmann
2013-10-16 12:51 ` [PATCH v3 3/4] usb: musb: dsps, debugfs files Markus Pargmann
2013-10-16 12:51 ` [PATCH v3 4/4] usb: musb: dsps, use devm_kzalloc Markus Pargmann
2013-11-05 11:11 ` [PATCH v3 0/0] usb: musb bugfixes Markus Pargmann

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=1381927872-8181-2-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).