summaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2014-04-15 21:34:30 -0700
committerMarc Jones <marc.jones@se-eng.com>2014-12-17 04:53:43 +0100
commit7faff543da105342a48e8df5e5ec1562848bffb7 (patch)
tree3b58cfa62ad8a0b7c312e55a047b3f6935cc338c /payloads
parentf574a327eed82ce00ea94d3f904f3dd8001d240c (diff)
libpayload: usb: Detach unused USB devices
If a payload decides not to use a USB device then the device can be detached. This prevents the device from interfering with normal operation on some platforms. Also, it aligns the behavior of usb_generic_init with class-specific init functions such as usb_msc_init, which will detach unsupported devices. BUG=None TEST=Manual on Squawks. Test recovery boot w/ USB 2.0 media, verify that media boots and no babble error is encountered. BRANCH=rambi Change-Id: I8fb30951d273e4144cda214a30a2e86df90f2c1c Original-Change-Id: Iee522344558749603defb2966e18765aa195dae2 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/195401 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit f7778ace68c9bee8dfab2b263e5dd054fc50c3bb) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Reviewed-on: http://review.coreboot.org/7830 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads')
-rw-r--r--payloads/libpayload/drivers/usb/usb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index eb23760033..25bd954ded 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -636,4 +636,9 @@ usb_generic_init (usbdev_t *dev)
if (usb_generic_create)
usb_generic_create(dev);
+
+ if (dev->data == NULL) {
+ usb_debug("Detaching device not used by payload\n");
+ usb_detach_device(dev->controller, dev->address);
+ }
}