* [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work
@ 2015-02-19 18:25 Matt Reimer
2015-02-19 18:39 ` Marek Vasut
2015-02-19 19:20 ` Steve Rae
0 siblings, 2 replies; 3+ messages in thread
From: Matt Reimer @ 2015-02-19 18:25 UTC (permalink / raw)
To: u-boot
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@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
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work
2015-02-19 18:25 [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work Matt Reimer
@ 2015-02-19 18:39 ` Marek Vasut
2015-02-19 19:20 ` Steve Rae
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2015-02-19 18:39 UTC (permalink / raw)
To: u-boot
On Thursday, February 19, 2015 at 07:25:40 PM, Matt Reimer wrote:
> 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@sdgsystems.com>
Hi,
looks good. Please keep Lukasz on CC, since he's the USB gadget guru.
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work
2015-02-19 18:25 [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work Matt Reimer
2015-02-19 18:39 ` Marek Vasut
@ 2015-02-19 19:20 ` Steve Rae
1 sibling, 0 replies; 3+ messages in thread
From: Steve Rae @ 2015-02-19 19:20 UTC (permalink / raw)
To: u-boot
Hi Matt:
On 15-02-19 10:25 AM, Matt Reimer wrote:
> 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@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,
> +};
> +
Are you certain that you have the "in" and "out" correct?
Looking at the three existing "usb_endpoint_descriptors"
fs_ep_in
fs_ep_out
hs_ep_out
The "in" is for sending data from the device TO the host, and
the "out" is for receiving data FROM the host.
The maximum packet size changes between 1.1 and 2.0 for receiving
packets (on the "out" endpoint), but AFAIK the maximum packet size is
the same for 1.1 and 2.0 (hence the fs_ep_in is used for both fs AND hs)....
This change suggests that the maximum packet size for sending packets TO
the host has changed as well - if it has, then the define in hs_ep_in
(above) needs to be:
.wMaxPacketSize = TX_ENDPOINT_MAXIMUM_PACKET_SIZE_2_0,
in order to avoid confusion....
Thanks, Steve
> 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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-19 19:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 18:25 [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work Matt Reimer
2015-02-19 18:39 ` Marek Vasut
2015-02-19 19:20 ` Steve Rae
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox