All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] fastboot: Enable the respective speed endpoints at runtime
Date: Tue, 12 Apr 2016 15:47:30 +0200	[thread overview]
Message-ID: <20160412154730.2b64ba67@amdc2363> (raw)
In-Reply-To: <1460465509-2731-3-git-send-email-rogerq@ti.com>

Hi Roger,

> In a dual speed configuration we need to check at runtime if
> we want to enable the Full-Speed or High-Speed endpoint.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/gadget/f_fastboot.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index e1038ea..8ab187e 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -115,6 +115,15 @@ static struct usb_descriptor_header
> *fb_hs_function[] = { NULL,
>  };
>  
> +static struct usb_endpoint_descriptor *
> +fb_ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *fs,
> +	    struct usb_endpoint_descriptor *hs)
> +{
> +	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
> +		return hs;
> +	return fs;
> +}
> +
>  /*
>   * static strings, in UTF-8
>   */
> @@ -255,18 +264,19 @@ static int fastboot_set_alt(struct usb_function
> *f, struct usb_composite_dev *cdev = f->config->cdev;
>  	struct usb_gadget *gadget = cdev->gadget;
>  	struct f_fastboot *f_fb = func_to_fastboot(f);
> +	const struct usb_endpoint_descriptor *d;
>  
>  	debug("%s: func: %s intf: %d alt: %d\n",
>  	      __func__, f->name, interface, alt);
>  
> -	/* make sure we don't enable the ep twice */
>  	if (gadget->speed == USB_SPEED_HIGH) {
> -		ret = usb_ep_enable(f_fb->out_ep, &hs_ep_out);
>  		is_high_speed = true;
>  	} else {
> -		ret = usb_ep_enable(f_fb->out_ep, &fs_ep_out);
>  		is_high_speed = false;
>  	}

Very minor remark - 
Those {} are not needed.


> +
> +	d = fb_ep_desc(gadget, &fs_ep_out, &hs_ep_out);
> +	ret = usb_ep_enable(f_fb->out_ep, d);
>  	if (ret) {
>  		puts("failed to enable out ep\n");
>  		return ret;
> @@ -280,7 +290,8 @@ 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);
> +	d = fb_ep_desc(gadget, &fs_ep_in, &hs_ep_in);
> +	ret = usb_ep_enable(f_fb->in_ep, d);
>  	if (ret) {
>  		puts("failed to enable in ep\n");
>  		goto err;


Despite of that:

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2016-04-12 13:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 12:51 [U-Boot] [PATCH 0/2] uboot: fastboot: fix high speed endpoint descriptors Roger Quadros
2016-04-12 12:51 ` [U-Boot] [PATCH 1/2] fastboot: Fix wMaxPacketSize for High-Speed IN endpoint Roger Quadros
2016-04-12 13:54   ` Lukasz Majewski
2016-04-13  1:42     ` Steve Rae
2016-04-13  7:19       ` Roger Quadros
2016-04-13  2:18   ` Steve Rae
2016-04-13  2:34     ` Hong Chen
2016-04-12 12:51 ` [U-Boot] [PATCH 2/2] fastboot: Enable the respective speed endpoints at runtime Roger Quadros
2016-04-12 13:47   ` Lukasz Majewski [this message]
2016-04-13  1:43     ` Steve Rae
2016-04-13  8:30   ` [U-Boot] [PATCH v2 " Roger Quadros

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=20160412154730.2b64ba67@amdc2363 \
    --to=l.majewski@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.