Last active
September 22, 2017 11:49
-
-
Save daniel-thompson/bccf6dcc756751b28b0ebfbf5af1e13d to your computer and use it in GitHub Desktop.
[PATCH] usb: hub: Treat all hubs as self-powered
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f7e2c2b19ea87fd300c3732ce7c1eb93cdad03c7 Mon Sep 17 00:00:00 2001 | |
From: Daniel Thompson <daniel.thompson@linaro.org> | |
Date: Fri, 22 Sep 2017 12:40:08 +0100 | |
Subject: [PATCH] usb: hub: Treat all hubs as self-powered | |
This works around a board misconfiguration on the poplar by treating | |
all hubs as self-powered. This effectively disables all the code in the | |
kernel to prevent hubs from drawing too much power. USB sockets must be | |
current limited so physical harm is unlikely... but now an overloaded | |
bus may end up with all devices being reset (rather than than the | |
"final straw" device not working). | |
Please do not try to upstream this patch. This patch takes a "hit it | |
with a big hammer" approach and other kernel developers may point at me | |
and call me names when they read the code! | |
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> | |
--- | |
drivers/usb/core/hub.c | 2 ++ | |
1 file changed, 2 insertions(+) | |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | |
index 6e6797d145dd..ce3878651a3d 100644 | |
--- a/drivers/usb/core/hub.c | |
+++ b/drivers/usb/core/hub.c | |
@@ -1499,6 +1499,7 @@ static int hub_configure(struct usb_hub *hub, | |
hub->mA_per_port = hdev->bus_mA; | |
hub->limited_power = 1; | |
} | |
+#if 0 | |
} else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) { | |
int remaining = hdev->bus_mA - | |
hub->descriptor->bHubContrCurrent; | |
@@ -1513,6 +1514,7 @@ static int hub_configure(struct usb_hub *hub, | |
"to use all downstream ports\n"); | |
hub->mA_per_port = unit_load; /* 7.2.1 */ | |
+#endif | |
} else { /* Self-powered external hub */ | |
/* FIXME: What about battery-powered external hubs that | |
* provide less current per port? */ | |
-- | |
2.13.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment