From 7faff543da105342a48e8df5e5ec1562848bffb7 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Tue, 15 Apr 2014 21:34:30 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/195401 Reviewed-by: Aaron Durbin (cherry picked from commit f7778ace68c9bee8dfab2b263e5dd054fc50c3bb) Signed-off-by: Marc Jones Reviewed-on: http://review.coreboot.org/7830 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/drivers/usb/usb.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'payloads') 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); + } } -- cgit v1.2.3