linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linux USB List <linux-usb@vger.kernel.org>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Greg KH <gregkh@linuxfoundation.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH v3 01/10] usb: gadget: aspeed: Don't set port enable change bit on reset
Date: Fri, 26 Jul 2019 15:05:30 +1000	[thread overview]
Message-ID: <20190726050539.7875-2-benh@kernel.crashing.org> (raw)
In-Reply-To: <20190726050539.7875-1-benh@kernel.crashing.org>

This bit should be only set when the port enable goes down, for
example, on errors. Not when it gets set after a port reset. Some
USB stacks seem to be sensitive to this and fails enumeration.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/usb/gadget/udc/aspeed-vhub/hub.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/udc/aspeed-vhub/hub.c
index 7c040f56100e..0755115fd90d 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c
@@ -449,8 +449,15 @@ static void ast_vhub_change_port_stat(struct ast_vhub *vhub,
 		       USB_PORT_STAT_C_OVERCURRENT |
 		       USB_PORT_STAT_C_RESET |
 		       USB_PORT_STAT_C_L1;
-		p->change |= chg;
 
+		/*
+		 * We only set USB_PORT_STAT_C_ENABLE if we are disabling
+		 * the port as per USB spec, otherwise MacOS gets upset
+		 */
+		if (p->status & USB_PORT_STAT_ENABLE)
+			chg &= ~USB_PORT_STAT_C_ENABLE;
+
+		p->change = chg;
 		ast_vhub_update_hub_ep1(vhub, port);
 	}
 }
-- 
2.17.1


  reply	other threads:[~2019-07-26  5:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  5:05 [PATCH 00/10] usb: gadget: aspeed: Bug fixes Benjamin Herrenschmidt
2019-07-26  5:05 ` Benjamin Herrenschmidt [this message]
2019-07-26  5:05 ` [PATCH v3 02/10] usb: gadget: aspeed: Cleanup EP0 state on port reset Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 03/10] usb: gadget: aspeed: Fix EP0 stall handling Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 04/10] usb: gadget: aspeed: Don't reject requests on suspended devices Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 05/10] usb: gadget: aspeed: Check suspend/resume callback existence Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 06/10] usb: gadget: aspeed: Rework the reset logic Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 07/10] usb: gadget: aspeed: Remove unused "suspended" flag Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 08/10] usb: gadget: aspeed: Improve debugging when nuking Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 09/10] usb: Add definitions for the USB2.0 hub TT requests Benjamin Herrenschmidt
2019-07-26  5:05 ` [PATCH v3 10/10] usb: gadget: aspeed: Implement dummy " Benjamin Herrenschmidt

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=20190726050539.7875-2-benh@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).