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>
This commit is contained in:
Shawn Nematbakhsh 2014-04-15 21:34:30 -07:00 committed by Marc Jones
parent f574a327ee
commit 7faff543da
1 changed files with 5 additions and 0 deletions

View File

@ -636,4 +636,9 @@ usb_generic_init (usbdev_t *dev)
if (usb_generic_create) if (usb_generic_create)
usb_generic_create(dev); usb_generic_create(dev);
if (dev->data == NULL) {
usb_debug("Detaching device not used by payload\n");
usb_detach_device(dev->controller, dev->address);
}
} }