Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939107AbdLSKfx (ORCPT ); Tue, 19 Dec 2017 05:35:53 -0500 Received: from mail-bl2nam02on0050.outbound.protection.outlook.com ([104.47.38.50]:30787 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932699AbdLSKf2 (ORCPT ); Tue, 19 Dec 2017 05:35:28 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: To: Felipe Balbi , Greg Kroah-Hartman , Mathias Nyman , "open list:DESIGNWARE USB3 DRD IP DRIVER" , open list CC: , , , "yinbo . zhu" Subject: [PATCH v4 3/3] usb: host: Implement workaround for Erratum A-009668 Date: Tue, 19 Dec 2017 18:16:18 +0800 Message-ID: <20171219101618.45650-3-yinbo.zhu@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171219101618.45650-1-yinbo.zhu@nxp.com> References: <20171219101618.45650-1-yinbo.zhu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131581533144968959;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(336005)(39860400002)(376002)(346002)(39380400002)(396003)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(16586007)(551934003)(305945005)(105606002)(356003)(5660300001)(81166006)(316002)(8936002)(2906002)(51416003)(2876002)(50226002)(106466001)(36756003)(2950100002)(48376002)(104016004)(6666003)(53936002)(1076002)(81156014)(498600001)(76176011)(77096006)(68736007)(50466002)(8676002)(54906003)(47776003)(4326008)(8656006)(575784001)(110136005)(97736004)(59450400001)(86362001)(85426001)(86152003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR03MB2694;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD042;1:vAMWDLlYiP44QXSL9Wu+G7wzodA2tPyWp319znQaNb/1cNlVOo3JqbhiQWzpS6SnSPtK4e090oDzK4t5EZnvI8rpi1BEuy/BKXp43Wrn+9mUhvVOnslR5eBqn3c/IxaM MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76a3e622-5c13-45d6-6eff-08d546cc3092 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307);SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2694;3:wzoqN/zp5L5Mim2OZpGftNXzhe8J33/S5WAa5+3mizwstSjjuShZg+AFNjmRisdAktBYHM/y9G5VkL90FkasXt15lMtBkWZm7uGw965XoxS6iBrBIhKinaOfy3ReXEcA3A+S7fhxHNFvi+JICIU4o/Dfx6R4I252KRQsc75yKTC0M91eCzgLB+z0CCrNrGEIG0LjCW7VH7loLfuIE3JkkOMdfXSsECvyqhsciTs5wjYUHvf1FpA580S/sCLOyWS9QvHedtBCxGPvRcHrcumPIwQypKZyrGrU1VXaaogLAsHF5AHxqatFMEhVqPZH7BOxzSMQZbePnVsPkfcngOB0vIvD5+Hd3lmoGU0JYQODWCg=;25:XAjLmXzVqJpVz1y+OTBSNgLYlEzvDPyIT8+JzqEhxzmm3AuAhxF9Yzm1ckcrn5KLnW/cRfb0bu/yTVpLz22cUuckDLMxjGhYvimJ4/lN8Ro1OJZwG+jbszbzUp5M9wn7ADGCHXGf+Iio48u99u5aEwPxr3vN8oFOmayXBhHXf1KBJaBcAY5EVgCknbPAutPZpbDYT6ftEc8ziyK2BekzT+UZuHLtiwp8m8lYH6po183EHVE8K/ngZK2OcLMS2w4ZyVPtEALYxzUJpAIJWZjZwnqdxSu/rA4iahzKu11nE8Ye8uy7nIHMiZaZ5wLqM6a6i1d+8YYb7kUoOzW3FwhXIQ== X-MS-TrafficTypeDiagnostic: CY4PR03MB2694: X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2694;31:6tWK2qLPsaA+rw7RVKJ73JPO8oO7zqpqkrUr8/yuDASchohMm2MRNoKaAeZlbN8cAOixMakKotS7oYW9Eub5+tQIR6Trm/+ApwyISa/UBzXuT5K9MxcRtshhdIWHJZSt2bABxu8/c7OhNj0tUyVUEnBajDF8ooHfw4PgpJidKQ8DTxBfHnqm3aXsKoYyihIcLLAJUniF9IfZWwZ0VEIQGgQ9LoK2rDDbf97fihDoQ1Y=;4:V72Sn1cAu1JWTB88yCAw022ntv0CpWbaPb9KDaOIYucjie14jqjsVCSvAcjAK72xKuOxdQE6olzmFSdj7+KCXUURJVtwel0MQ+3X3weFXqYtJth0BYYikmB8tiNECQcC8lsJWimsm4migMLeXONwsWhwloifQOQzSmvNSs6/x2dm+9StbeSIiOUDXcT9C6aQttnD3dY2rYgyeJTGOahUUfGybzBS2aJ/lcSNu8lo2Y+QYbVvdmUAzPy6SNaysjK/V2baI+/XLrzG4mAsW9A5024ScJQX0LWCCFXS0GrfMmCEEFMqr8SQALvUYNi49jEd6xvDctaMR8fNmYqQstcbEg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231023)(10201501046)(6055026)(6096035)(20161123561025)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123559100)(20161123565025)(201708071742011);SRVR:CY4PR03MB2694;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:CY4PR03MB2694; X-Forefront-PRVS: 052670E5A4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR03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kQZ/Ac8XHMlVVB5QoW/ni8k=;7:rgV39+2IFzUL3gjtoNZzCfy4caSj57w2I+xEpCXqFigeYtvKhPYVBmntLWwq+0uz/Z2jQRUvuu94wgt39XhTGWhL8HnIOaaSZyo45/cseyJ+Gt7K7PLTkzO3TnnTfqsmV69Oqfyat0MK8NbviTbmffKLgziFJH75eGqg3c/NgZMwPwZJyY68oSPJxQAfVCJ3XD99p4ay7BQkDvOph0uO9ugiDqb7m58pHT4Z3xHUdyU2gRYntcRwKwf83h/HpI7Y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 10:35:14.3252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76a3e622-5c13-45d6-6eff-08d546cc3092 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2694 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6240 Lines: 153 From: yinbo.zhu This issue is observed in USB 2.0 mode when the USB 3.0 host controller is connected to a FS/LS device via a hub. The host controller issues start-split (SSPLIT) and (CSPLIT) tokens to accomplish a split-transaction. A split-transaction consists of a SSPLIT token, token/data consists of a SSPLIT token, token/data packets, CSPLIT token and token/data/handshake packets. A SSPLIT token is issued by the host controller to the hub followed by token/data/ handshake packets. The hub then relays the token/data/ handshake packets to the FS /LS device. Sometime later, the host controller issues a CSPLIT token followed by the same token/data/handshake packets to the hub to complete the split-transaction. As an example scenario, when the xHCI driver issues an Address device command with BSR=0, the host controller sends SETUP(SET_ADDRESS) tokens on the USB as part of splittransactions. If the host controller receives a NYET response from the hub for the CSPLIT SETUP, it means that the split-transaction has not yet been completed or the hub is not able to handle the split transaction. In such a case, the host controller keeps retrying the splittransactions until such time an ACK response is received from the hub for the CSPLIT SETUP token . If the split-transactions do not complete in a time bound manner, the xHCI driver may issue a Stop Endpoint Command. The host controller does not service the Stop Endpoint Command and eventually the xHCI driver times out waiting for the Stop Endpoint Command to complete. Impact: Stop Endpoint Command does not complete. Workaround: Instead of issuing a Stop Endpoint Command, issue a Disable Slot Command with the corresponding slot ID. Alternately, you can issue an Address Device Command with BSR=1. Configs Affected: LS1012A-R1.0, LS1012A-R2.0, LS1021-20-22A-R1.0, LS1021-20-22A-R2.0, LS1043-23A-R1.0, LS1043-23A-R1.1, LS1046-26A-R1.0, LS1088-48A-R1.0, LS2080-40A-R1.0, LS2081A-R1.1, LS2085-45A-R1.0, LS2088-48A-R1.0, LS2088-48A-R1.1, LX2160-2120-2080A-R1.0. Signed-off-by: yinbo zhu --- Change in v4: Remove the point in "yinbo.zhu" drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 3 +++ drivers/usb/host/xhci-plat.c | 3 +++ drivers/usb/host/xhci.c | 12 ++++++++++++ drivers/usb/host/xhci.h | 1 + 6 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 863f2c0..90b097c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1059,6 +1059,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,quirk_reverse_in_out"); dwc->quirk_stop_transfer_in_block = device_property_read_bool(dev, "snps,quirk_stop_transfer_in_block"); + dwc->quirk_stop_ep_in_u1 = device_property_read_bool(dev, + "snps,quirk_stop_ep_in_u1"); device_property_read_u8(dev, "snps,tx_de_emphasis", &tx_de_emphasis); device_property_read_string(dev, "snps,hsphy_interface", diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 6276678..b55a443 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -860,6 +860,7 @@ struct dwc3_scratchpad_array { * @quirk_reverse_in_out: prevent tx fifo reverse the data direction * @quirk_stop_transfer_in_block: prevent block transmission from being * interrupted + * @quirk_stop_ep_in_u1: replace stop commad with disable slot command * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */ @@ -1014,6 +1015,7 @@ struct dwc3 { unsigned tx_de_emphasis:2; unsigned quirk_reverse_in_out:1; unsigned quirk_stop_transfer_in_block:1; + unsigned quirk_stop_ep_in_u1:1; u16 imod_interval; }; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 78cb7bb..0a34274 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -96,6 +96,9 @@ int dwc3_host_init(struct dwc3 *dwc) if (dwc->quirk_stop_transfer_in_block) props[prop_idx++].name = "quirk-stop-transfer-in-block"; + if (dwc->quirk_stop_ep_in_u1) + props[prop_idx++].name = "quirk-stop-ep-in-u1"; + if (dwc->usb3_lpm_capable) props[prop_idx++].name = "usb3-lpm-capable"; diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 35e0fc8..49d6cb4 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -273,6 +273,9 @@ static int xhci_plat_probe(struct platform_device *pdev) "quirk-stop-transfer-in-block")) xhci->quirks |= XHCI_STOP_TRANSFER_IN_BLOCK; + if (device_property_read_bool(&pdev->dev, "quirk-stop-ep-in-u1")) + xhci->quirks |= XHCI_STOP_EP_IN_U1; + if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped")) xhci->quirks |= XHCI_BROKEN_PORT_PED; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5141856..20c9af4 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1521,6 +1521,18 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) xhci_ring_cmd_db(xhci); } + /* + *erratum A-009668: Stop Endpoint Command does not complete. + *Workaround: Instead of issuing a Stop Endpoint Command, + *issue a Disable Slot Command with the corresponding slot ID. + *Alternately, you can issue an Address Device Command with + *BSR=1 + */ + if ((urb->dev->speed <= USB_SPEED_HIGH) && + (xhci->quirks & XHCI_STOP_EP_IN_U1)) { + xhci_queue_slot_control(xhci, command, TRB_DISABLE_SLOT, + urb->dev->slot_id); + } } done: spin_unlock_irqrestore(&xhci->lock, flags); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index db10ee4..22ba752 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1821,6 +1821,7 @@ struct xhci_hcd { #define XHCI_MISSING_CAS (1 << 24) #define XHCI_REVERSE_IN_OUT BIT(32) #define XHCI_STOP_TRANSFER_IN_BLOCK BIT(33) +#define XHCI_STOP_EP_IN_U1 BIT(34) /* For controller with a broken Port Disable implementation */ #define XHCI_BROKEN_PORT_PED (1 << 25) #define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26) -- 1.7.1