summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2012-05-21 16:19:05 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2012-06-01 12:21:14 +0200
commit5f595cb6ebd8edddb1e253353753bf1c5433395e (patch)
treede83ca514f80dbd983a26bf7e7a0ba830ab19f28 /payloads/libpayload/drivers
parentcefec0ea8c436f36a2fd71b58364d4a65f52948a (diff)
libpayload: Add clear_feature() function to USB framework
This function will be used by the USB hub driver. Change-Id: I4d1d2e94f4442cbb636ae989e8ffd543181c4357 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1079 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r--payloads/libpayload/drivers/usb/usb.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index 1f21e6a994..1e8f24814c 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -205,22 +205,29 @@ set_configuration (usbdev_t *dev)
dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
}
-int
-clear_stall (endpoint_t *ep)
+void
+clear_feature (usbdev_t *dev, int endp, int feature, int rtype)
{
- usbdev_t *dev = ep->dev;
- int endp = ep->endpoint;
dev_req_t dr;
- dr.bmRequestType = 0;
- if (endp != 0) {
- dr.req_recp = endp_recp;
- }
+ dr.bmRequestType = rtype;
+ dr.data_dir = host_to_device;
dr.bRequest = CLEAR_FEATURE;
- dr.wValue = ENDPOINT_HALT;
+ dr.wValue = feature;
dr.wIndex = endp;
dr.wLength = 0;
dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
+}
+
+int
+clear_stall (endpoint_t *ep)
+{
+ usbdev_t *dev = ep->dev;
+ int endp = ep->endpoint;
+ int rtype = gen_bmRequestType (host_to_device, standard_type,
+ endp ? endp_recp : dev_recp);
+
+ clear_feature (dev, endp, ENDPOINT_HALT, rtype);
ep->toggle = 0;
return 0;
}