public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: rentao.bupt@gmail.com, Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Colin Ian King <colin.king@canonical.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org,
	taoren@fb.com
Subject: Re: [PATCH 2/2] usb: gadget: aspeed: fixup usb1 device descriptor at init time
Date: Thu, 20 Feb 2020 12:39:45 +1100	[thread overview]
Message-ID: <55e77bcb37ec780094b8d226f89bd5557e30d913.camel@kernel.crashing.org> (raw)
In-Reply-To: <20200218235600.6763-3-rentao.bupt@gmail.com>

On Tue, 2020-02-18 at 15:56 -0800, rentao.bupt@gmail.com wrote:
> From: Tao Ren <rentao.bupt@gmail.com>
> 
> This patch moves fixup-usb1-device-descriptor logic from get_descriptor
> handler to "ast_vhub_fixup_dev_desc" function so the device descriptor
> is only patched once (at vhub init time).

I don't like this either. We should make ast_vhub_dev_desc and patch a
copy here too. I know today there's only one instance of the vhub in a
given SoC but that might not always be the case.

> Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> ---
>  drivers/usb/gadget/udc/aspeed-vhub/hub.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/udc/aspeed-vhub/hub.c
> index 4e3ef83283a6..b8bf54b12adc 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c
> @@ -76,13 +76,6 @@ static struct usb_device_descriptor ast_vhub_dev_desc = {
>  	.bNumConfigurations	= 1,
>  };
>  
> -/* Patches to the above when forcing USB1 mode */
> -static void ast_vhub_patch_dev_desc_usb1(struct usb_device_descriptor *desc)
> -{
> -	desc->bcdUSB = cpu_to_le16(0x0100);
> -	desc->bDeviceProtocol = 0;
> -}
> -
>  /*
>   * Configuration descriptor: same comments as above
>   * regarding handling USB1 mode.
> @@ -316,10 +309,6 @@ static int ast_vhub_rep_desc(struct ast_vhub_ep *ep,
>  	if (len > dsize)
>  		len = dsize;
>  
> -	/* Patch it if forcing USB1 */
> -	if (desc_type == USB_DT_DEVICE && ep->vhub->force_usb1)
> -		ast_vhub_patch_dev_desc_usb1(ep->buf);
> -
>  	/* Shoot it from the EP buffer */
>  	return ast_vhub_reply(ep, NULL, len);
>  }
> @@ -878,6 +867,15 @@ static void ast_vhub_fixup_dev_desc(struct ast_vhub *vhub)
>  		if (of_str[id])
>  			ast_vhub_str_array[i].s = of_str[id];
>  	}
> +
> +	/*
> +	 * Update USB Release Number and Protocol code if vhub is running
> +	 * at USB 1.x speed.
> +	 */
> +	if (vhub->force_usb1) {
> +		ast_vhub_dev_desc.bcdUSB = cpu_to_le16(0x0100);
> +		ast_vhub_dev_desc.bDeviceProtocol = 0;
> +	}
>  }
>  
>  void ast_vhub_init_hub(struct ast_vhub *vhub)


  reply	other threads:[~2020-02-20  1:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 23:55 [PATCH 0/2] usb: gadget: aspeed: allow to customize vhub device rentao.bupt
2020-02-18 23:55 ` [PATCH 1/2] usb: gadget: aspeed: allow to customize vhub device IDs/strings rentao.bupt
2020-02-20  1:38   ` Benjamin Herrenschmidt
2020-02-21  0:18     ` Tao Ren
2020-02-18 23:56 ` [PATCH 2/2] usb: gadget: aspeed: fixup usb1 device descriptor at init time rentao.bupt
2020-02-20  1:39   ` Benjamin Herrenschmidt [this message]
2020-02-21  0:20     ` Tao Ren

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=55e77bcb37ec780094b8d226f89bd5557e30d913.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=andrew@aj.id.au \
    --cc=balbi@kernel.org \
    --cc=chunfeng.yun@mediatek.com \
    --cc=colin.king@canonical.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=rentao.bupt@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.org \
    --cc=taoren@fb.com \
    /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