From patchwork Thu Jul 26 13:08:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anurag Kumar Vulisha X-Patchwork-Id: 10545883 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 E423D139A for ; Thu, 26 Jul 2018 13:09:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D30E62B1E5 for ; Thu, 26 Jul 2018 13:09:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C71652B201; Thu, 26 Jul 2018 13:09:18 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 985372B1E5 for ; Thu, 26 Jul 2018 13:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730221AbeGZOZ7 (ORCPT ); Thu, 26 Jul 2018 10:25:59 -0400 Received: from mail-eopbgr720087.outbound.protection.outlook.com ([40.107.72.87]:34777 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729820AbeGZOZ6 (ORCPT ); Thu, 26 Jul 2018 10:25:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wYNp2fPaXMhl4EzTIBRAkw75uN6SPlzrIk5ALQch+9o=; b=vfcffyIpEl+FwLiQRZcZ3H7AsnVfFMwkyV8ebVIIgwc8EBYbkwNv0hxkwcpvjVQpUNOjbax1XKXf+Zco6AYT5QuDHTPcehbk4O5+6oS55RTtJPW3Cxxp7/v1tGpORQ7eBc+ra/7ekBRcvI2lWwrHXdPtHpYrJ5kjUhUh+oaZ0Zk= Received: from MWHPR02CA0040.namprd02.prod.outlook.com (2603:10b6:301:60::29) by BL0PR02MB4452.namprd02.prod.outlook.com (2603:10b6:208:45::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.20; Thu, 26 Jul 2018 13:09:06 +0000 Received: from CY1NAM02FT063.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::203) by MWHPR02CA0040.outlook.office365.com (2603:10b6:301:60::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.16 via Frontend Transport; Thu, 26 Jul 2018 13:09:05 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by CY1NAM02FT063.mail.protection.outlook.com (10.152.75.161) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.995.12 via Frontend Transport; Thu, 26 Jul 2018 13:09:02 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:45150 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1fig0r-0008IR-UO; Thu, 26 Jul 2018 06:09:01 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1fig0m-0002AF-Pf; Thu, 26 Jul 2018 06:08:56 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w6QD8oOO028514; Thu, 26 Jul 2018 06:08:50 -0700 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fig0f-00029b-O0; Thu, 26 Jul 2018 06:08:49 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id DFC9A604BF; Thu, 26 Jul 2018 18:38:48 +0530 (IST) From: Anurag Kumar Vulisha To: , CC: , , , Anurag Kumar Vulisha Subject: [PATCH v3] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller Date: Thu, 26 Jul 2018 18:38:48 +0530 Message-ID: <1532610528-7290-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(346002)(396003)(376002)(136003)(2980300002)(438002)(189003)(199004)(426003)(90966002)(63266004)(478600001)(50226002)(8936002)(336012)(551934003)(36386004)(50466002)(48376002)(36756003)(4326008)(39060400002)(110136005)(2906002)(476003)(486006)(6266002)(54906003)(126002)(16586007)(42186006)(103686004)(47776003)(2616005)(107886003)(356003)(316002)(5660300001)(575784001)(106002)(51416003)(8676002)(81166006)(106466001)(186003)(26005)(81156014)(305945005)(52956003)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR02MB4452;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT063;1:XTLd72V80EQlgf8Hz1M0w6ol5m9w8CrVlRYx/4kx08ll26rSCiv2er983X86q2IzlHQgSnZ56UQIpu67vPZaG7foXPxatNVhw6bhyPgRjwyxdygdp+AuRtBZW0GN3jav MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01149833-b3ff-4ff8-937c-08d5f2f8f6e7 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:BL0PR02MB4452; X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4452;3:Bg1JrR9oedlQyiMlnSaag/yuvsKZmrweXTaWy034BiO+mEK4cnZmYC9kNYRAExzQg6uPujiQlq6R2L65fHDTTaDPlJGU7IqSY9lNvHwzjSN+IiScixfSXSq5uaHRs6Fb3Am3fHkoOYrLjx4hgnNrDWdyQourhdIHDNTMY9mW/HoKbf7e1+VweYOG+iOrKqEYKVVZiY5GZEtdQNK1UPMyJT65kwEYN0OsUF8DRPYAghFNQ6RGAujZW1lN3hGYx5SNnRonuA7CmO3Dx76fZ4yrRwTIc91ylsVkuM+KocNY+0b6jdos70F2dQyUdJwGFg2baqdPsYqyz7T3de5Zojk9UBo8TSrjURX6URZ+1NlBpDo=;25:1ISKXkgY27wnRHaQscrH9DVmPILEXlvtZ0lnFV0tua6Uc3/U6N0YFiBRzYFxIx+WRhO1BBQ49G3FW3XOO74grWKofdmyD3Fyeqes4uhvas7lfYeGyI1d6Mmsiq1NAFeeQQMOEz7IBF1q77h2ti48QTAt9UxssMkiMnc+BDvZJoZm4ig++aPNgRQosPCYSu7TyUlBNoBgKdJ3qFV1wlgCTLq8dlYfzaJhvg9HgJag2JF5rdrxRXpeLT52SxexM+7sMRz/3AfZCe4pLzYwUI5B2b+Rg7Xc2oMRpouvTT5maawoXbSDwR/dCCVXaA6nRbKG4X/6sYsRfBG5hODjS2KLCw== X-MS-TrafficTypeDiagnostic: BL0PR02MB4452: X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4452;31:ZNaa0Kk6DB2tERbkEl9D+PA78DK6OYdPHlXzYylZARTbtSYIP19rYinEOOQughHR7AkOxnigRyqOBg3/+KGeZEue95pByaD2T1X1G4BuiJ0sN6Df8n0mJeUcWfvWnEOSikomxKhWzuXSVhTGf5+JKT/xLDrdhxzkO8V2OCXPd0lk5bmyqMwTDsMVfqzobRS5npRT/wq25nwfWCSDTw3svYEpU2tza0w14vQiCbncSwU=;20:98OtZBUay2ZimfpunPgAqU3iIn+pF9IzMC5gJxpe8HUGIs7lnBJQ7BZrvxyN1dJVfsTvAgL1ZYFdi/iHMd2tSxeB+Acc+L02Blxny/WrHIGtjiTf8fPF5b6zNS8cM/TQq5sgGEkf7+SjuQIOch3NV0P6mFEtCWZUTpwAJW5J3Sz5eb+HkAAGMgezJ2JIOQBU7OMseu1R92tI04aZ9YTBKGg44TL983v4Lp3jCevOljWdlhxquqH/2DC25Cir8oYdfhHkpZZOhBZpatJT33HbutUFLcFj0uiHSg8EhoBUBf55ZGv9m361pHwU95Hs30iwchdIu/Rg+hLBD99rjtXPZ2jV304kvC4lRXdQMntx1t7JDgDNeV8p4iJSWbJiqV0KeiHLN2cSJm0MKggVJvDmXz7R2T5MpvGU9/9fK/vacK3czg27/LGGHpVmXafeIyS7Z4E0fxDZz14R/Ofm1YIJdTM1+JuvcezxSzeyeUObp1ITiKWywRbcu1TPdSWqOjmG X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93004095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:BL0PR02MB4452;BCL:0;PCL:0;RULEID:;SRVR:BL0PR02MB4452; X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4452;4:+LSkGMwQtXldgNZxNIXB9zEp7vG5kGeTCPHoEB3sh6KVCNU2vUSiTHXTNKNjDchcA3cyofWEO7JyDjhGTE3+hrC0BH1G5+sF8EQUfYZtUfxAqCBayFPDg27dRX7PBN7qLpTsY4w0dZ6ELdEBd4dv9PGsMDCt23zvDqUNTKLN/5HWsJNr3RfOxMuz6sqy/Wrd3pzsiZA4WMm6mxqb03VCO3XiWaIHMBvl5o6HKgNCZq5fa3tbxEK48gghIvvzyZJytfZNBDNzNGiWvgNngaTVhIVWBoVvqkq6h0KrFh1a20zj4yZBssYUoXYRXReexXaf X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: 1;BL0PR02MB4452;23:8OH0GnFTRl/XJhxOu2ZowiyaurocAlHA9jLVtyqkLWovyHFKj3bV+2kkjNXtxXFjl4aQNmKzFplIB4QKIV8WnLazGObbd0/Trovx6yKkwFYDWI5TMfDji9xNKY2xwMPJRMXiP8rAdOLMMPE1/986dkQPgMiD06F0Lgx0IrgJoPaIKiJAPAb0iAsPh5bPA+2N/59bxnbJHFpbbei8WOA5EP7mZnyyT0fKTX+RBFJo8OF+wWDiIaKz7E2ebEh1mGPuaO9kBUOUjiPIpTmsG9CfYFk1kwSkWuR2ALQWOO9n9H6uricJju0VFOPBwG6m8+1wYDFxg9XffXXyP13o7sdOjZMf52oqrNCsz4ZaGwqFaJtUcO9wQHfTshHip8JzGF7FW8103fIYOFo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amDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 13:09:02.7069 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01149833-b3ff-4ff8-937c-08d5f2f8f6e7 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4452 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 By default when core sees any transaction error(CRC or overflow) it replies with terminating retry ACK (Retry=1 and Nump == 0). Enabling this Auto Retry feature in controller, on seeing any transaction errors makes the core to send a non-terminating ACK transaction packet (that is, ACK TP with Retry=1 and Nump != 0). Doing so will give controller a chance to recover from the error condition. Signed-off-by: Anurag Kumar Vulisha --- Changes in v3: 1. As suggested by Felipe, added OTG related check 2. Corrected the multi-line commenting format Changes in v2: 1. As suggested by Rob Herring & Felipe Balbi removed the quirk logic and setting the AutoRetry bits unconditionally for hostmode --- drivers/usb/dwc3/core.c | 16 ++++++++++++++++ drivers/usb/dwc3/core.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 1038075..bc9e33c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -883,6 +883,22 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); } + if (dwc->dr_mode == USB_DR_MODE_HOST || + dwc->dr_mode == USB_DR_MODE_OTG) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL); + + /* + * Enable Auto retry Feature to make the controller operating in + * Host mode on seeing transaction errors(CRC errors or internal + * overrun scenerios) on IN transfers to reply to the device + * with a non-terminating retry ACK (i.e, an ACK transcation + * packet with Retry=1 & Nump != 0) + */ + reg |= DWC3_GUCTL_HSTINAUTORETRY; + + dwc3_writel(dwc->regs, DWC3_GUCTL, reg); + } + /* * Must config both number of packets and max burst settings to enable * RX and/or TX threshold. diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 285ce0e..92a1077 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -227,6 +227,9 @@ #define DWC3_GCTL_GBLHIBERNATIONEN BIT(1) #define DWC3_GCTL_DSBLCLKGTNG BIT(0) +/* Global User Control Register */ +#define DWC3_GUCTL_HSTINAUTORETRY BIT(14) + /* Global User Control 1 Register */ #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)