From: Marek Vasut Date: Fri, 16 Jun 2017 16:19:02 +0200 Subject: [U-Boot] [PATCH 05/20] usb: hub: Update handling connect status/change in usb_scan_port() In-Reply-To: <1497619909-29454-6-git-send-email-bmeng.cn@gmail.com> References: <1497619909-29454-1-git-send-email-bmeng.cn@gmail.com> <1497619909-29454-6-git-send-email-bmeng.cn@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 06/16/2017 03:31 PM, Bin Meng wrote: > It was observed that on Intel MinnowMax board, when xHCI is enabled > in the BayTrail SoC, with a USB 3.0 device connected to the bottom > USB 3.0 port (mapped to xHCI root port #7), its PORTSC register is > always 0x201203 (CCS = 1, CSC = 0). The root cause of such behavior > is unknown yet. Connect status change bit is set on the same port > with a USB 2.0 device (mapped to xHCI port #1, which is a different > port on the root hub). > > With current logic in usb_scan_port(), the enumeration process will > abort if it does not detect a connect status change on a hub port. > However since a device connection status is correctly reported, the > enumeration process can still continue. > > With this change, USB device connected to the bottom blue port on > MinnowMax board can be enumerated under either SS or HS mode. > > Signed-off-by: Bin Meng I'd be slightly concerned this can break some other controllers, like the DWC2 . CCing Dinh, maybe he can test it on SoCFPGA. > --- > > common/usb_hub.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/common/usb_hub.c b/common/usb_hub.c > index ff9cd50..8279e5c 100644 > --- a/common/usb_hub.c > +++ b/common/usb_hub.c > @@ -408,8 +408,15 @@ static int usb_scan_port(struct usb_device_scan *usb_scan) > portchange = le16_to_cpu(portsts->wPortChange); > debug("Port %d Status %X Change %X\n", i + 1, portstatus, portchange); > > - /* No connection change happened, wait a bit more. */ > - if (!(portchange & USB_PORT_STAT_C_CONNECTION)) { > + /* > + * No connection change happened, wait a bit more. > + * > + * For some situation, the hub reports no connection change but a > + * device is connected to the port (eg: CCS bit is set but CSC is not > + * in the PORTSC register of a root hub), ignore such case. > + */ > + if (!(portchange & USB_PORT_STAT_C_CONNECTION) && > + !(portstatus & USB_PORT_STAT_CONNECTION)) { > if (get_timer(0) >= hub->connect_timeout) { > debug("devnum=%d port=%d: timeout\n", > dev->devnum, i + 1); > @@ -421,10 +428,6 @@ static int usb_scan_port(struct usb_device_scan *usb_scan) > return 0; > } > > - /* Test if the connection came up, and if not exit */ > - if (!(portstatus & USB_PORT_STAT_CONNECTION)) > - return 0; > - > /* A new USB device is ready at this point */ > debug("devnum=%d port=%d: USB dev found\n", dev->devnum, i + 1); > > -- Best regards, Marek Vasut