[{"id":1773266,"web_url":"http://patchwork.ozlabs.org/comment/1773266/","msgid":"<3eb65a17-769b-a206-fe4d-1843d5fa2a59@denx.de>","list_archive_url":null,"date":"2017-09-22T05:02:45","subject":"Re: [U-Boot] [PATCH 08/14] usb: xhci: Fix max packet size for full\n\tspeed device endpoint 0","submitter":{"id":13,"url":"http://patchwork.ozlabs.org/api/people/13/","name":"Stefan Roese","email":"sr@denx.de"},"content":"On 18.09.2017 15:40, Bin Meng wrote:\n> In xhci_check_maxpacket(), the control endpoint 0 max packet size\n> is wrongly taken from the interface's endpoint descriptor. However\n> the default endpoint 0 does not come with an endpoint descriptor\n> hence is not included in the interface structure. Change to use\n> epmaxpacketin[0] instead.\n> \n> The other bug in this routine is that when setting max packet size\n> to the xHC endpoint 0 context, it does not clear its previous value\n> at all before programming a new one.\n> \n> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>\n> ---\n> \n>   drivers/usb/host/xhci.c | 8 +++-----\n>   1 file changed, 3 insertions(+), 5 deletions(-)\n> \n> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c\n> index 4b3d58d..ec82fa6 100644\n> --- a/drivers/usb/host/xhci.c\n> +++ b/drivers/usb/host/xhci.c\n> @@ -546,16 +546,13 @@ int xhci_check_maxpacket(struct usb_device *udev)\n>   \tint max_packet_size;\n>   \tint hw_max_packet_size;\n>   \tint ret = 0;\n> -\tstruct usb_interface *ifdesc;\n> -\n> -\tifdesc = &udev->config.if_desc[0];\n>   \n>   \tout_ctx = ctrl->devs[slot_id]->out_ctx;\n>   \txhci_inval_cache((uintptr_t)out_ctx->bytes, out_ctx->size);\n>   \n>   \tep_ctx = xhci_get_ep_ctx(ctrl, out_ctx, ep_index);\n>   \thw_max_packet_size = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx->ep_info2));\n> -\tmax_packet_size = usb_endpoint_maxp(&ifdesc->ep_desc[0]);\n> +\tmax_packet_size = udev->epmaxpacketin[0];\n>   \tif (hw_max_packet_size != max_packet_size) {\n>   \t\tdebug(\"Max Packet Size for ep 0 changed.\\n\");\n>   \t\tdebug(\"Max packet size in usb_device = %d\\n\", max_packet_size);\n> @@ -567,7 +564,8 @@ int xhci_check_maxpacket(struct usb_device *udev)\n>   \t\t\t\tctrl->devs[slot_id]->out_ctx, ep_index);\n>   \t\tin_ctx = ctrl->devs[slot_id]->in_ctx;\n>   \t\tep_ctx = xhci_get_ep_ctx(ctrl, in_ctx, ep_index);\n> -\t\tep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK);\n> +\t\tep_ctx->ep_info2 &= cpu_to_le32(~((0xffff & MAX_PACKET_MASK)\n> +\t\t\t\t\t\t<< MAX_PACKET_SHIFT));\n>   \t\tep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size));\n>   \n>   \t\t/*\n> \n\nReviewed-by: Stefan Roese <sr@denx.de>\nTested-by: Stefan Roese <sr@denx.de>\n\nThanks,\nStefan","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xz1Zc4FtRz9sPm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 15:03:04 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 268E7C21C29; Fri, 22 Sep 2017 05:02:56 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 13C6DC21C29;\n\tFri, 22 Sep 2017 05:02:55 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid CE11DC21C29; Fri, 22 Sep 2017 05:02:53 +0000 (UTC)","from mx1.mailbox.org (mx1.mailbox.org [80.241.60.212])\n\tby lists.denx.de (Postfix) with ESMTPS id 94256C21C26\n\tfor <u-boot@lists.denx.de>; Fri, 22 Sep 2017 05:02:53 +0000 (UTC)","from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mx1.mailbox.org (Postfix) with ESMTPS id 783E645996;\n\tFri, 22 Sep 2017 07:02:53 +0200 (CEST)","from smtp1.mailbox.org ([80.241.60.240])\n\tby spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de\n\t[80.241.56.117]) (amavisd-new, port 10030)\n\twith ESMTP id xCPbUfolFuZX; Fri, 22 Sep 2017 07:02:46 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW\n\tautolearn=unavailable autolearn_force=no version=3.4.0","X-Virus-Scanned":"amavisd-new at heinlein-support.de","To":"Bin Meng <bmeng.cn@gmail.com>, Marek Vasut <marex@denx.de>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","References":"<1505742050-5697-1-git-send-email-bmeng.cn@gmail.com>\n\t<1505742050-5697-9-git-send-email-bmeng.cn@gmail.com>","From":"Stefan Roese <sr@denx.de>","Message-ID":"<3eb65a17-769b-a206-fe4d-1843d5fa2a59@denx.de>","Date":"Fri, 22 Sep 2017 07:02:45 +0200","MIME-Version":"1.0","In-Reply-To":"<1505742050-5697-9-git-send-email-bmeng.cn@gmail.com>","Content-Language":"en-US","Subject":"Re: [U-Boot] [PATCH 08/14] usb: xhci: Fix max packet size for full\n\tspeed device endpoint 0","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]