usb: gadget: aspeed: Don't set port enable change bit on reset
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 26 Jul 2019 05:05:30 +0000 (15:05 +1000)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 12 Aug 2019 05:54:48 +0000 (08:54 +0300)
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>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/aspeed-vhub/hub.c

index 7c040f56100e4491891405382869a5ed93177007..0755115fd90df3b4359d6f5c4f02eb13be896ff9 100644 (file)
@@ -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);
        }
 }