From patchwork Fri Apr 26 14:50:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 10919251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 018C31575 for ; Fri, 26 Apr 2019 14:50:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5D6428D65 for ; Fri, 26 Apr 2019 14:50:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA0E128D42; Fri, 26 Apr 2019 14:50:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E77828D42 for ; Fri, 26 Apr 2019 14:50:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726263AbfDZOuL (ORCPT ); Fri, 26 Apr 2019 10:50:11 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:5961 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOuL (ORCPT ); Fri, 26 Apr 2019 10:50:11 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Apr 2019 07:49:43 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 26 Apr 2019 07:50:10 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 26 Apr 2019 07:50:10 -0700 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:10 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:09 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 26 Apr 2019 14:50:09 +0000 Received: from jilin-desktop.nvidia.com (Not Verified[10.19.120.158]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Apr 2019 07:50:09 -0700 From: Jim Lin To: CC: , Jim Lin Subject: [PATCH 1/6] usb: hub:Extend usb_hub_clear_tt_buffer parameter Date: Fri, 26 Apr 2019 22:50:06 +0800 Message-ID: <1556290206-9393-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1556290183; bh=VQ9YrfJwsmQ+0troAPFeYUfgX6DDDEB8ACTWzHBrZC0=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=TQzQsGUz7YUAwYXzfTjWzhgbjRiCqwcF8vuaE5GNvQJ2JfHaMdee98gqc8bpvP5Mi 64rOlNoLur5deZzyjgZB4R704y9pehK8yHPTMUv9XgXLkAwtWT+1KSr3B5IVh+eg+w KjTFvIZhzMhBGIFm5BhkxXXaFk83KDj8anJr98AmVLSdqDgTfskHQywErXzSYaIvyb GTlrcirfRBX86JHCYx6u76er5NtWseb26nZ7zE82QsFwaW5BS8/q48KT4HlU+J2tTt lz2Kzlzp7tL0iIBojpNomu7by1AOWAeQsUkMjTsJnbeqGmXiAsqGDgSnHrI66aHPRD kyToOb2hyP/Zg== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Extend usb_hub_clear_tt_buffer parameter to specify device number that will have the TT state of its hub cleared. Signed-off-by: Jim Lin --- drivers/usb/core/hub.c | 5 +++-- include/linux/usb/hcd.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 15a2934dc29d..4dec054c9776 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -840,6 +840,7 @@ int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, /** * usb_hub_clear_tt_buffer - clear control/bulk TT state in high speed hub * @urb: an URB associated with the failed or incomplete split transaction + * @devnum : device number that will have the TT state of its hub cleared * * High speed HCDs use this to tell the hub driver that some split control or * bulk transaction failed in a way that requires clearing internal state of @@ -851,7 +852,7 @@ int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, * * Return: 0 if successful. A negative error code otherwise. */ -int usb_hub_clear_tt_buffer(struct urb *urb) +int usb_hub_clear_tt_buffer(struct urb *urb, int devnum) { struct usb_device *udev = urb->dev; int pipe = urb->pipe; @@ -873,7 +874,7 @@ int usb_hub_clear_tt_buffer(struct urb *urb) /* info that CLEAR_TT_BUFFER needs */ clear->tt = tt->multi ? udev->ttport : 1; clear->devinfo = usb_pipeendpoint (pipe); - clear->devinfo |= udev->devnum << 4; + clear->devinfo |= devnum << 4; clear->devinfo |= usb_pipecontrol(pipe) ? (USB_ENDPOINT_XFER_CONTROL << 11) : (USB_ENDPOINT_XFER_BULK << 11); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 695931b03684..01720f1f7d62 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -559,7 +559,7 @@ struct usb_tt_clear { struct usb_host_endpoint *ep; }; -extern int usb_hub_clear_tt_buffer(struct urb *urb); +extern int usb_hub_clear_tt_buffer(struct urb *urb, int devnum); extern void usb_ep0_reinit(struct usb_device *); /* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */ From patchwork Fri Apr 26 14:50:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 10919253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 882501575 for ; Fri, 26 Apr 2019 14:50:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78CA128D65 for ; Fri, 26 Apr 2019 14:50:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DB3928DA3; Fri, 26 Apr 2019 14:50:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FB8C28D65 for ; Fri, 26 Apr 2019 14:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbfDZOuW (ORCPT ); Fri, 26 Apr 2019 10:50:22 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:3013 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOuV (ORCPT ); Fri, 26 Apr 2019 10:50:21 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Apr 2019 07:50:27 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 26 Apr 2019 07:50:21 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 26 Apr 2019 07:50:21 -0700 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:21 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 26 Apr 2019 14:50:20 +0000 Received: from jilin-desktop.nvidia.com (Not Verified[10.19.120.158]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Apr 2019 07:50:20 -0700 From: Jim Lin To: CC: , Jim Lin Subject: [PATCH 2/6] usb: isp1760:Adjusted for usb_hub_clear_tt_buffer Date: Fri, 26 Apr 2019 22:50:18 +0800 Message-ID: <1556290218-9436-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1556290227; bh=NxQERjSCGZyhDFxGHImVNe7OVFgLr0UrsSrAMz86Ix8=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=oPvDDC/sC45alIZG5yMQWjzgcGYfp9OfpdNa2wyM00FdYGssE7vpvwU6l9YHgMonb SlCGCfMNHQsX8hgRZqIo/NoC7mzBHKXw/kJthdXrGC3x82E8BbR/GMN1gbyvVZ0alP vc749KroF3z9ogJTMNp3CaJC7KFg/ZHVqrbHPdh1XVZU57Iogjw8WX+uwPUyx4cMRF CsgJ8+iioMZyExeRAwZ6UABneBk7cmFMKV5HZ89lEd2lFVeuNppj2Xzewnpm0CojO/ NJWdTvCCB3yNieIBCeR7AZZz8WXobYZ2HRJOdpyh0L/RHEO3K8Ks5VnuTsCoEi1CCA ZbL0iJONrcMfA== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add argument for usb_hub_clear_tt_buffer to specify device number that will have the TT state of its hub cleared. Signed-off-by: Jim Lin --- drivers/usb/isp1760/isp1760-hcd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 8142c6b4c4cf..f1d68092becb 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1166,7 +1166,8 @@ static void handle_done_ptds(struct usb_hcd *hcd) (qtd->urb->status != -EPIPE) && (qtd->urb->status != -EREMOTEIO)) { qh->tt_buffer_dirty = 1; - if (usb_hub_clear_tt_buffer(qtd->urb)) + if (usb_hub_clear_tt_buffer(qtd->urb, + qtd->urb->dev->devnum)) /* Clear failed; let's hope things work anyway */ qh->tt_buffer_dirty = 0; @@ -1633,7 +1634,7 @@ static void dequeue_urb_from_qtd(struct usb_hcd *hcd, struct isp1760_qh *qh, if ((urb->dev->speed != USB_SPEED_HIGH) && urb_was_running) { qh->tt_buffer_dirty = 1; - if (usb_hub_clear_tt_buffer(urb)) + if (usb_hub_clear_tt_buffer(urb, urb->dev->devnum)) /* Clear failed; let's hope things work anyway */ qh->tt_buffer_dirty = 0; } From patchwork Fri Apr 26 14:50:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 10919255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B33014B6 for ; Fri, 26 Apr 2019 14:50:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BDE428E48 for ; Fri, 26 Apr 2019 14:50:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8026E28E46; Fri, 26 Apr 2019 14:50:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28B8328E43 for ; Fri, 26 Apr 2019 14:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726567AbfDZOub (ORCPT ); Fri, 26 Apr 2019 10:50:31 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:3022 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOub (ORCPT ); Fri, 26 Apr 2019 10:50:31 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Apr 2019 07:50:36 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 26 Apr 2019 07:50:30 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 26 Apr 2019 07:50:30 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:30 +0000 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:29 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 26 Apr 2019 14:50:29 +0000 Received: from jilin-desktop.nvidia.com (Not Verified[10.19.120.158]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Apr 2019 07:50:29 -0700 From: Jim Lin To: CC: , Jim Lin Subject: [PATCH 3/6] usb: fotg210:Adjusted for usb_hub_clear_tt_buffer Date: Fri, 26 Apr 2019 22:50:27 +0800 Message-ID: <1556290227-9480-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1556290237; bh=3FkiFNr2zoIxXp2r2T2xlqeRKWH8cfTl48gxMEQN488=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=I/kvaUzH13PQbyhYrhER5I3TZvtlc0iaPlt32BNc5h5135no/oZMc8L9LAf4Andi9 Fi0FpjYFHBIkxnsmHJd/Gu6VQY4XrdG9y1YUof9MT+lfYUkWzmI5qwqjJwAVZgsweQ bkPYlaifBylYU+c2BntcNhSpxgG52T1TTHzq7V4oPBcIvNxtOzzUhIrJj8Sha6Eks+ 7F2nSIUsfptxXGeD8VvLaolKuNm+W5uESuMOf8wLH1W2qVJwpJphUsq7my02+1jd/z bTgkYMZn2Iayvhd6u/8WJ7MFUq3XdrGPz3WGlJZ/viZokRC48kgzXX6563UlhUp0ho WkQYVDI0vKqMA== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add argument for usb_hub_clear_tt_buffer to specify device number that will have the TT state of its hub cleared. Signed-off-by: Jim Lin --- drivers/usb/host/fotg210-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index 0da68df259c8..bd29ed0fbd46 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -2123,7 +2123,7 @@ static void fotg210_clear_tt_buffer(struct fotg210_hcd *fotg210, if (urb->dev->tt->hub != fotg210_to_hcd(fotg210)->self.root_hub) { - if (usb_hub_clear_tt_buffer(urb) == 0) + if (!usb_hub_clear_tt_buffer(urb, urb->dev->devnum)) qh->clearing_tt = 1; } } From patchwork Fri Apr 26 14:50:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 10919257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E53361575 for ; Fri, 26 Apr 2019 14:50:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D524728D56 for ; Fri, 26 Apr 2019 14:50:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C979E28E46; Fri, 26 Apr 2019 14:50:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80FD428E41 for ; Fri, 26 Apr 2019 14:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726648AbfDZOun (ORCPT ); Fri, 26 Apr 2019 10:50:43 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:5987 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOun (ORCPT ); Fri, 26 Apr 2019 10:50:43 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Apr 2019 07:50:15 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 26 Apr 2019 07:50:42 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 26 Apr 2019 07:50:42 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:42 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 26 Apr 2019 14:50:42 +0000 Received: from jilin-desktop.nvidia.com (Not Verified[10.19.120.158]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Apr 2019 07:50:41 -0700 From: Jim Lin To: CC: , Jim Lin Subject: [PATCH 4/6] usb: ehci: Adjusted for usb_hub_clear_tt_buffer Date: Fri, 26 Apr 2019 22:50:39 +0800 Message-ID: <1556290239-9523-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1556290215; bh=hakNu7nmlWRRhwVrRoWCmmF4BvpmgMEUjJOZfH40V9I=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=mvC/tSy0BCim/OS5OhaITsNFD6MLHUL8mubBGIbYdqszQ8DVXJmxNpq0Q0fTTfOWK ZtajKN/7XVfk5udTTEsd2dGWfAQqAWnv0NV6l+wsHGyzHChFWuSSsTZDXb3arZVoXs Xac9zoyg9zRBuTcROvSGr+04PtDhDOcH3RJKjum24od7BVmKZhdaFq5NK0LkxonLx+ 8mzc/Ua6hBSAGGLcZpOTFQ2JIJ9zNtMVhCvEuc1SwA4Xwp77pcWP6FzFtmQtcbDeV2 8jTYBP751IOeLPc43CSVVDuatUDmU2JkSK0L+VLpJdXYkO+Xtx67LhNPa0+Xr+SNbj RqQQqHl1mJPtw== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add argument for usb_hub_clear_tt_buffer to specify device number that will have the TT state of its hub cleared. Signed-off-by: Jim Lin --- drivers/usb/host/ehci-q.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index aa2f77f1506d..9f64c260239e 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -169,7 +169,7 @@ static void ehci_clear_tt_buffer(struct ehci_hcd *ehci, struct ehci_qh *qh, if (!ehci_is_TDI(ehci) || urb->dev->tt->hub != ehci_to_hcd(ehci)->self.root_hub) { - if (usb_hub_clear_tt_buffer(urb) == 0) + if (!usb_hub_clear_tt_buffer(urb, urb->dev->devnum)) qh->clearing_tt = 1; } else { From patchwork Fri Apr 26 14:50:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 10919259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1FB11575 for ; Fri, 26 Apr 2019 14:50:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D29F028D12 for ; Fri, 26 Apr 2019 14:50:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0BF828E46; Fri, 26 Apr 2019 14:50:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89D9028D42 for ; Fri, 26 Apr 2019 14:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726224AbfDZOuy (ORCPT ); Fri, 26 Apr 2019 10:50:54 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:5995 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOux (ORCPT ); Fri, 26 Apr 2019 10:50:53 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Apr 2019 07:50:26 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 26 Apr 2019 07:50:53 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 26 Apr 2019 07:50:53 -0700 Received: from HQMAIL112.nvidia.com (172.18.146.18) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:53 +0000 Received: from HQMAIL103.nvidia.com (172.20.187.11) by HQMAIL112.nvidia.com (172.18.146.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:50:52 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 26 Apr 2019 14:50:52 +0000 Received: from jilin-desktop.nvidia.com (Not Verified[10.19.120.158]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Apr 2019 07:50:52 -0700 From: Jim Lin To: CC: , Jim Lin Subject: [PATCH 5/6] usb: dwc2: Adjusted for usb_hub_clear_tt_buffer Date: Fri, 26 Apr 2019 22:50:50 +0800 Message-ID: <1556290250-9567-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1556290226; bh=v34xjFzSvqBXRMCnwm/8i+4X+lkRZq/wrmlwB+tTkjE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=PIk3ArTS7muqB65o1mklZdn3+sigbcbqGewkqGNt4r0c5Y0/oGVExvB286AzZWkAK Pezw85SU7kBxsScACbyPqeR5onlTZD4krMuE01oJ8uFPFjVmSmhbAkvDWtEYhqHf1G Zcmze7SeM0ZmejTxVLF5ZYMafQL0cs/i8iz4wupa4anRk/4qwfUcNPlg7ar6f5ReKh 9b82oJjPl3o64UoZRRsJyolWq6WgbOXkus1Pr9BLxrD3qahKXQh5GePf0HravOKcoc dwhZihUTfjUUNu5SKOXgG8/zqtRPPulOfwzeBliITNJLcLFBwtqukPuoHPgvYA8jqA tplvNe8avmZ0A== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add argument for usb_hub_clear_tt_buffer to specify device number that will have the TT state of its hub cleared. Signed-off-by: Jim Lin --- drivers/usb/dwc2/hcd_intr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 88b5dcf3aefc..a3bb6911a62a 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -125,7 +125,7 @@ static void dwc2_hc_handle_tt_clear(struct dwc2_hsotg *hsotg, if (qtd->urb->status != -EPIPE && qtd->urb->status != -EREMOTEIO) { chan->qh->tt_buffer_dirty = 1; - if (usb_hub_clear_tt_buffer(usb_urb)) + if (usb_hub_clear_tt_buffer(usb_urb, usb_urb->dev->devnum)) /* Clear failed; let's hope things work anyway */ chan->qh->tt_buffer_dirty = 0; } From patchwork Fri Apr 26 14:50:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 10919261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F237A1515 for ; Fri, 26 Apr 2019 14:51:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0EBC28E42 for ; Fri, 26 Apr 2019 14:51:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D505628D71; Fri, 26 Apr 2019 14:51:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61EAF28E43 for ; Fri, 26 Apr 2019 14:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbfDZOvH (ORCPT ); Fri, 26 Apr 2019 10:51:07 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:11865 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOvG (ORCPT ); Fri, 26 Apr 2019 10:51:06 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 26 Apr 2019 07:51:01 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 26 Apr 2019 07:51:04 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 26 Apr 2019 07:51:04 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 26 Apr 2019 14:51:04 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 26 Apr 2019 14:51:04 +0000 Received: from jilin-desktop.nvidia.com (Not Verified[10.19.120.158]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 26 Apr 2019 07:51:04 -0700 From: Jim Lin To: CC: , Jim Lin Subject: [PATCH 6/6] usb: xhci: Add Clear_TT_Buffer Date: Fri, 26 Apr 2019 22:50:59 +0800 Message-ID: <1556290259-9610-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1556290261; bh=jsiYAGCIqxOvLaM8hSo4kuYHJAnxya8TxXxvrDmjo4A=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=jyx6t8RzYy351aWb8ZUkefzpU/FA0Vt+fKAUgIrrPfiRpWkQpptOvG6W6x15VPLNE sexUwXX9LUdVEsnt1nnKotOJGJ0vq8pFs5QpHMf/73DnKQY5VULtrv00ezn24HleJ8 JSp4ZK1h3jtLMa3BH1xOkKSRemd3lB6Gcq5bhRYk7DXimfiAfi8RZAH5zgTclWJu28 HRtMgETGKELhG7AovRd9NM/yNasp0GxaKY+XP0ng4WaJWfotP100CyLdExe82Mg0at vxL8I7QBsCgzQcxPovKlqk7UkQPQVlxVQkY8sntgOv4U4pnExgh36/BCB+wxXxMF3m HGnDHBBMOH50g== Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP USB 2.0 specification chapter 11.17.5 says "as part of endpoint halt processing for full-/low-speed endpoints connected via a TT, the host software must use the Clear_TT_Buffer request to the TT to ensure that the buffer is not in the busy state". In our case, a full-speed speaker (ConferenceCam) is behind a high- speed hub (ConferenceCam Connect), sometimes once we get STALL on a request we may continue to get STALL with the folllowing requests, like Set_Interface. After adding this fix the following Set_Interface requests will be able to get ACK successfully. Signed-off-by: Jim Lin --- drivers/usb/host/xhci-ring.c | 25 +++++++++++++++++++++++++ drivers/usb/host/xhci.c | 7 +++++++ drivers/usb/host/xhci.h | 3 +++ 3 files changed, 35 insertions(+) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9215a28dad40..ecf40db562ee 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1786,6 +1786,30 @@ struct xhci_segment *trb_in_td(struct xhci_hcd *xhci, return NULL; } +static void xhci_clear_hub_tt_buffer(struct xhci_hcd *xhci, + unsigned int slot_id, struct xhci_td *td) +{ + struct xhci_virt_device *dev; + struct xhci_slot_ctx *slot_ctx; + int devnum; + + /* + * As part of low/full-speed endpoint-halt processing + * we must clear the TT buffer (USB 2.0 specification 11.17.5). + */ + if (td->urb->dev->tt && !usb_pipeint(td->urb->pipe) && + (td->urb->dev->tt->hub != xhci_to_hcd(xhci)->self.root_hub) && + !xhci->clearing_tt) { + xhci->clearing_tt = 1; + dev = xhci->devs[slot_id]; + slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx); + devnum = (int) le32_to_cpu(slot_ctx->dev_state) & + DEV_ADDR_MASK; + if (usb_hub_clear_tt_buffer(td->urb, devnum)) + xhci->clearing_tt = 0; + } +} + static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, unsigned int slot_id, unsigned int ep_index, unsigned int stream_id, struct xhci_td *td, @@ -1804,6 +1828,7 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, if (reset_type == EP_HARD_RESET) { ep->ep_state |= EP_HARD_CLEAR_TOGGLE; xhci_cleanup_stalled_ring(xhci, ep_index, stream_id, td); + xhci_clear_hub_tt_buffer(xhci, slot_id, td); } xhci_ring_cmd_db(xhci); } diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7fa58c99f126..cb8c1048d4d3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -5132,6 +5132,12 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) } EXPORT_SYMBOL_GPL(xhci_gen_setup); +void xhci_clear_tt_buffer_complete(struct usb_hcd *hcd, + struct usb_host_endpoint *ep) +{ + hcd_to_xhci(hcd)->clearing_tt = 0; +} + static const struct hc_driver xhci_hc_driver = { .description = "xhci-hcd", .product_desc = "xHCI Host Controller", @@ -5192,6 +5198,7 @@ static const struct hc_driver xhci_hc_driver = { .enable_usb3_lpm_timeout = xhci_enable_usb3_lpm_timeout, .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout, .find_raw_port_number = xhci_find_raw_port_number, + .clear_tt_buffer_complete = xhci_clear_tt_buffer_complete, }; void xhci_init_driver(struct hc_driver *drv, diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 9334cdee382a..f786bb0992c4 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1864,6 +1864,7 @@ struct xhci_hcd { unsigned hw_lpm_support:1; /* Broken Suspend flag for SNPS Suspend resume issue */ unsigned broken_suspend:1; + unsigned clearing_tt:1; /* cached usb2 extened protocol capabilites */ u32 *ext_caps; unsigned int num_ext_caps; @@ -2052,6 +2053,8 @@ int xhci_alloc_tt_info(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_device *hdev, struct usb_tt *tt, gfp_t mem_flags); +void xhci_clear_tt_buffer_complete(struct usb_hcd *hcd, + struct usb_host_endpoint *ep); /* xHCI ring, segment, TRB, and TD functions */ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb);