summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinda Chen <minda.chen@starfivetech.com>2023-10-10 12:10:18 +0300
committerMinda Chen <minda.chen@starfivetech.com>2023-10-10 12:23:31 +0300
commit25ce4e7598e5ed6bdc268b8444a0ea88000eeb1b (patch)
treeaa4f2b5a25be36e84a2835ea3d1fee99c5687f65
parent5a6195d02812c3fb8629276cea63a95ae79e8afa (diff)
downloadu-boot-25ce4e7598e5ed6bdc268b8444a0ea88000eeb1b.tar.xz
usb: hub: Do NOT add device if portchanged over current bit is set
USB hub should not add the usb devices if over current bit is set in portchange. For later usb_scan_port will still return with error and rescan and add device again. it will generate dulplicated device and cause crash issue. Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
-rw-r--r--common/usb_hub.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/usb_hub.c b/common/usb_hub.c
index ba11a188ca..d0f4b8c2a7 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -376,6 +376,9 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
return ret;
}
+ if (le16_to_cpu(portsts->wPortChange) & USB_PORT_STAT_C_OVERCURRENT)
+ return -EIO;
+
switch (portstatus & USB_PORT_STAT_SPEED_MASK) {
case USB_PORT_STAT_SUPER_SPEED:
speed = USB_SPEED_SUPER;