Commit f7a9e5dd03f83cf31a85eadf8666939abe47b739
Committed by
Marek Vasut
1 parent
aab0db08c0
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
usb: hub: Update handling connect status/change in usb_scan_port()
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 <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de> Tested-by: Dinh Nguyen <dinguyen@kernel.org>
Showing 1 changed file with 9 additions and 6 deletions Side-by-side Diff
common/usb_hub.c
... | ... | @@ -405,8 +405,15 @@ |
405 | 405 | portchange = le16_to_cpu(portsts->wPortChange); |
406 | 406 | debug("Port %d Status %X Change %X\n", i + 1, portstatus, portchange); |
407 | 407 | |
408 | - /* No connection change happened, wait a bit more. */ | |
409 | - if (!(portchange & USB_PORT_STAT_C_CONNECTION)) { | |
408 | + /* | |
409 | + * No connection change happened, wait a bit more. | |
410 | + * | |
411 | + * For some situation, the hub reports no connection change but a | |
412 | + * device is connected to the port (eg: CCS bit is set but CSC is not | |
413 | + * in the PORTSC register of a root hub), ignore such case. | |
414 | + */ | |
415 | + if (!(portchange & USB_PORT_STAT_C_CONNECTION) && | |
416 | + !(portstatus & USB_PORT_STAT_CONNECTION)) { | |
410 | 417 | if (get_timer(0) >= hub->connect_timeout) { |
411 | 418 | debug("devnum=%d port=%d: timeout\n", |
412 | 419 | dev->devnum, i + 1); |
... | ... | @@ -417,10 +424,6 @@ |
417 | 424 | } |
418 | 425 | return 0; |
419 | 426 | } |
420 | - | |
421 | - /* Test if the connection came up, and if not exit */ | |
422 | - if (!(portstatus & USB_PORT_STAT_CONNECTION)) | |
423 | - return 0; | |
424 | 427 | |
425 | 428 | /* A new USB device is ready at this point */ |
426 | 429 | debug("devnum=%d port=%d: USB dev found\n", dev->devnum, i + 1); |