linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: gadget: aspeed: Don't set port enable change bit on reset
@ 2019-07-02 11:17 Herrenschmidt, Benjamin
  2019-07-06  0:44 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Herrenschmidt, Benjamin @ 2019-07-02 11:17 UTC (permalink / raw)
  To: linux-usb; +Cc: balbi, joel

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. MacOS
seems 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);
 	}
 }


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

* Re: [PATCH 1/2] usb: gadget: aspeed: Don't set port enable change bit on reset
  2019-07-02 11:17 [PATCH 1/2] usb: gadget: aspeed: Don't set port enable change bit on reset Herrenschmidt, Benjamin
@ 2019-07-06  0:44 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2019-07-06  0:44 UTC (permalink / raw)
  To: linux-usb; +Cc: Felipe Balbi, Joel Stanley

On Tue, 2019-07-02 at 21:17 +1000, Benjamin Herrenschmidt wrote:
> 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. MacOS
> seems sensitive to this and fails enumeration.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Note: I don't know if you already applied those two, so I'll add them
to a new series I'm about to post with more fixes to that driver, feel
free to drop the first two from the series if you have as they are
identical to these.


> ---
>  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);
>  	}
>  }
> 


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

end of thread, other threads:[~2019-07-06  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 11:17 [PATCH 1/2] usb: gadget: aspeed: Don't set port enable change bit on reset Herrenschmidt, Benjamin
2019-07-06  0:44 ` Benjamin Herrenschmidt

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).