libpayload/generic_hub: Detect port disconnect after reset
If a port disconnects after a reset we should abort any initialization on the port. This might mean the device has re-enumerated as a 3.0 device so the hub should be scanned again. BUG=b:76831439 TEST=Verified USB-C devices that get detected correctly in depthcharge. Change-Id: Iad899544684312df1bef08d69b5c7f41eac3a21c Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://review.coreboot.org/27477 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
5fed693a52
commit
1b43ad7149
|
@ -157,6 +157,15 @@ generic_hub_attach_dev(usbdev_t *const dev, const int port)
|
||||||
if (hub->ops->reset_port) {
|
if (hub->ops->reset_port) {
|
||||||
if (hub->ops->reset_port(dev, port) < 0)
|
if (hub->ops->reset_port(dev, port) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (!hub->ops->port_connected(dev, port)) {
|
||||||
|
usb_debug(
|
||||||
|
"generic_hub: Port %d disconnected after "
|
||||||
|
"reset. Possibly upgraded, rescan required.\n",
|
||||||
|
port);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* after reset the port will be enabled automatically */
|
/* after reset the port will be enabled automatically */
|
||||||
const int ret = generic_hub_wait_for_port(
|
const int ret = generic_hub_wait_for_port(
|
||||||
/* time out after 1,000 * 10us = 10ms */
|
/* time out after 1,000 * 10us = 10ms */
|
||||||
|
|
Loading…
Reference in New Issue