[U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work
Matt Reimer
mreimer at sdgsystems.com
Thu Feb 19 19:25:40 CET 2015
Make fastboot work in high-speed mode by specifying separate sets
of usb_descriptor_headers for full-speed and high-speed.
Tested on s5p_ds5.
Signed-off-by: Matt Reimer <mreimer at sdgsystems.com>
---
drivers/usb/gadget/f_fastboot.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 310175a..024ef20 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -74,6 +74,15 @@ static struct usb_endpoint_descriptor fs_ep_out = {
.bInterval = 0x00,
};
+static struct usb_endpoint_descriptor hs_ep_in = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = RX_ENDPOINT_MAXIMUM_PACKET_SIZE_2_0,
+ .bInterval = 0x00,
+};
+
static struct usb_endpoint_descriptor hs_ep_out = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
@@ -94,9 +103,16 @@ static struct usb_interface_descriptor interface_desc = {
.bInterfaceProtocol = FASTBOOT_INTERFACE_PROTOCOL,
};
-static struct usb_descriptor_header *fb_runtime_descs[] = {
+static struct usb_descriptor_header *fb_fs_runtime_descs[] = {
(struct usb_descriptor_header *)&interface_desc,
(struct usb_descriptor_header *)&fs_ep_in,
+ (struct usb_descriptor_header *)&fs_ep_out,
+ NULL,
+};
+
+static struct usb_descriptor_header *fb_hs_runtime_descs[] = {
+ (struct usb_descriptor_header *)&interface_desc,
+ (struct usb_descriptor_header *)&hs_ep_in,
(struct usb_descriptor_header *)&hs_ep_out,
NULL,
};
@@ -160,6 +176,7 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
f_fb->out_ep->driver_data = c->cdev;
hs_ep_out.bEndpointAddress = fs_ep_out.bEndpointAddress;
+ hs_ep_in.bEndpointAddress = fs_ep_in.bEndpointAddress;
return 0;
}
@@ -236,7 +253,10 @@ static int fastboot_set_alt(struct usb_function *f,
}
f_fb->out_req->complete = rx_handler_command;
- ret = usb_ep_enable(f_fb->in_ep, &fs_ep_in);
+ if (gadget->speed == USB_SPEED_HIGH)
+ ret = usb_ep_enable(f_fb->in_ep, &hs_ep_in);
+ else
+ ret = usb_ep_enable(f_fb->in_ep, &fs_ep_in);
if (ret) {
puts("failed to enable in ep\n");
goto err;
@@ -277,7 +297,8 @@ static int fastboot_add(struct usb_configuration *c)
}
f_fb->usb_function.name = "f_fastboot";
- f_fb->usb_function.hs_descriptors = fb_runtime_descs;
+ f_fb->usb_function.descriptors = fb_fs_runtime_descs;
+ f_fb->usb_function.hs_descriptors = fb_hs_runtime_descs;
f_fb->usb_function.bind = fastboot_bind;
f_fb->usb_function.unbind = fastboot_unbind;
f_fb->usb_function.set_alt = fastboot_set_alt;
--
1.7.9.5
More information about the U-Boot
mailing list