public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Steve Rae <srae@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: gadget: fastboot: make high-speed work
Date: Thu, 19 Feb 2015 11:20:10 -0800	[thread overview]
Message-ID: <54E6376A.9000809@broadcom.com> (raw)
In-Reply-To: <1424370340-63530-1-git-send-email-mreimer@sdgsystems.com>

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;
>

      parent reply	other threads:[~2015-02-19 19:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54E6376A.9000809@broadcom.com \
    --to=srae@broadcom.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox