All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 08/14] usb: xhci: Fix max packet size for full speed device endpoint 0
Date: Fri, 22 Sep 2017 07:02:45 +0200	[thread overview]
Message-ID: <3eb65a17-769b-a206-fe4d-1843d5fa2a59@denx.de> (raw)
In-Reply-To: <1505742050-5697-9-git-send-email-bmeng.cn@gmail.com>

On 18.09.2017 15:40, Bin Meng wrote:
> In xhci_check_maxpacket(), the control endpoint 0 max packet size
> is wrongly taken from the interface's endpoint descriptor. However
> the default endpoint 0 does not come with an endpoint descriptor
> hence is not included in the interface structure. Change to use
> epmaxpacketin[0] instead.
> 
> The other bug in this routine is that when setting max packet size
> to the xHC endpoint 0 context, it does not clear its previous value
> at all before programming a new one.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>   drivers/usb/host/xhci.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 4b3d58d..ec82fa6 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -546,16 +546,13 @@ int xhci_check_maxpacket(struct usb_device *udev)
>   	int max_packet_size;
>   	int hw_max_packet_size;
>   	int ret = 0;
> -	struct usb_interface *ifdesc;
> -
> -	ifdesc = &udev->config.if_desc[0];
>   
>   	out_ctx = ctrl->devs[slot_id]->out_ctx;
>   	xhci_inval_cache((uintptr_t)out_ctx->bytes, out_ctx->size);
>   
>   	ep_ctx = xhci_get_ep_ctx(ctrl, out_ctx, ep_index);
>   	hw_max_packet_size = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx->ep_info2));
> -	max_packet_size = usb_endpoint_maxp(&ifdesc->ep_desc[0]);
> +	max_packet_size = udev->epmaxpacketin[0];
>   	if (hw_max_packet_size != max_packet_size) {
>   		debug("Max Packet Size for ep 0 changed.\n");
>   		debug("Max packet size in usb_device = %d\n", max_packet_size);
> @@ -567,7 +564,8 @@ int xhci_check_maxpacket(struct usb_device *udev)
>   				ctrl->devs[slot_id]->out_ctx, ep_index);
>   		in_ctx = ctrl->devs[slot_id]->in_ctx;
>   		ep_ctx = xhci_get_ep_ctx(ctrl, in_ctx, ep_index);
> -		ep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK);
> +		ep_ctx->ep_info2 &= cpu_to_le32(~((0xffff & MAX_PACKET_MASK)
> +						<< MAX_PACKET_SHIFT));
>   		ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size));
>   
>   		/*
> 

Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

  reply	other threads:[~2017-09-22  5:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 13:40 [U-Boot] [PATCH 00/14] usb: xhci: Add interrupt transfer support and full speed device support Bin Meng
2017-09-18 13:40 ` [U-Boot] [PATCH 01/14] dm: usb: Fix broken usb_stop() Bin Meng
2017-09-22  4:56   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 02/14] dm: usb: Remove no longer needed blk_unbind_all() Bin Meng
2017-09-22  4:57   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 03/14] usb: xhci: Don't assume LS/FS devices are always behind a HS hub Bin Meng
2017-09-22  4:58   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 04/14] usb: Handle audio extension endpoint descriptor in usb_parse_config() Bin Meng
2017-09-22  4:59   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 05/14] usb: xhci: Add interrupt transfer support Bin Meng
2017-09-22  5:00   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 06/14] usb: Only get 64 bytes device descriptor for full speed devices Bin Meng
2017-09-22  5:01   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 07/14] usb: Read device descriptor after device is addressed for xHCI Bin Meng
2017-09-22  5:01   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 08/14] usb: xhci: Fix max packet size for full speed device endpoint 0 Bin Meng
2017-09-22  5:02   ` Stefan Roese [this message]
2017-09-18 13:40 ` [U-Boot] [PATCH 09/14] usb: hub: Clear port reset before usb_hub_port_connect_change() Bin Meng
2017-09-22  5:03   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 10/14] usb: hub: Clear BH reset status change for a 3.0 hub Bin Meng
2017-09-22  5:04   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 11/14] usb: xhci: Honor endpoint's interval Bin Meng
2017-09-22  5:06   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 12/14] usb: xhci: Program max burst size for endpoint Bin Meng
2017-09-22  5:11   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 13/14] usb: xhci: Set 'Error Count' to 0 for isoch endpoints Bin Meng
2017-09-22  5:12   ` Stefan Roese
2017-09-18 13:40 ` [U-Boot] [PATCH 14/14] usb: xhci: Set 'Average TRB Length' to 8 for control endpoints Bin Meng
2017-09-22  5:13   ` Stefan Roese
2017-09-18 15:13 ` [U-Boot] [PATCH 00/14] usb: xhci: Add interrupt transfer support and full speed device support Marek Vasut
2017-09-18 15:26   ` Stefan Roese
2017-09-18 15:33     ` Marek Vasut
2017-09-18 15:38     ` Stefan Roese
2017-09-19  1:38       ` Bin Meng
2017-09-19  4:54         ` Stefan Roese
2017-09-19  4:58           ` Bin Meng

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=3eb65a17-769b-a206-fe4d-1843d5fa2a59@denx.de \
    --to=sr@denx.de \
    --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.