Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030295AbdLSKNS (ORCPT ); Tue, 19 Dec 2017 05:13:18 -0500 Received: from mail-bl2nam02on0040.outbound.protection.outlook.com ([104.47.38.40]:45153 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S937250AbdLSKMD (ORCPT ); Tue, 19 Dec 2017 05:12:03 -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 v3 3/3] usb: host: Implement workaround for Erratum A-009668 Date: Tue, 19 Dec 2017 17:52:50 +0800 Message-ID: <20171219095250.38757-3-yinbo.zhu@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171219095250.38757-1-yinbo.zhu@nxp.com> References: <20171219095250.38757-1-yinbo.zhu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131581519095014734;(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)(346002)(376002)(39860400002)(39380400002)(396003)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(16586007)(551934003)(305945005)(105606002)(356003)(5660300001)(316002)(81166006)(8936002)(2906002)(51416003)(2876002)(50226002)(106466001)(36756003)(2950100002)(48376002)(6666003)(104016004)(53936002)(1076002)(81156014)(498600001)(76176011)(77096006)(68736007)(8676002)(50466002)(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;BN1AFFO11FD031;1:k6cqY9PWA8j2thoMfvfccAbWLe4/f4Do4n5qjvsuJzkiiDKxue0FIEn5/VfGutzV1DizPU6KgluICYzuyuVHJGtkj8MSg1aD4kDNJI9Kb1BhbAsWnNGK3p87LhgZerab MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 906306ff-82be-45af-254e-08d546c8eb21 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307);SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2694;3:62yqFsoMz+W6Kj3PTD2lehght9ebdC9xI9S8eAGfWJBIvFdzQYi1NlX5OdzM6WoOjMb1SOofSczrtw0abRrz3zkraZA/r2mLiN3GhDCwXtA5tXZcVe3NHuBvk/MgGZIys+1GkmAhp8150LOMcjaoxNpqYOYWOUosDk/QC59mCsL7Totz4NafdjqWHFxr7b9DlBmPQeyhG3uI6242pdweBRShRnJbHabOf1P1Pgm601O63TUzwUWeUlq1LHvgL2SycwBRm6THnLHAvAp+evvelAD+BlS8ReRR2MJuRvtJ240GLuilqn0sIK8lbtv02KOwSVlDzqniJkqLKXmHkdOs7TwJQfktqWky1AZUvymvqAg=;25:d+VUkLLeYpZa9q7YjHFTwX460Ah7T+opjj5GbgQGxglgJ1gq0S4rw5yICZ5F1ttHJPhO63bUk1wgXiLjW/gUk6h7v5sU4H+64qFje3y3zHToYY8ghmWsd6UdcaSItxX81Zm49HCVVfXXWiYODBJfhco77wcoo0blk3OoQIHW/7kMmMs4jxTFRKW0L0LZBSYl6+NVS3nxEuD7UdA5Ok6Yza0PXuR35eFnzyP/m519h4G5YRNHOsVHNhrRfB67EcaDV7mjf9aWJZ1NJHuPiGc9/Ks0gzmPGToEA6rxTNiF5kj/i7fVPikEY9dEYY68Qi3yjIoqj9uFJ5oASQaA0FSiZw== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR03MB2694: X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2694;31:aFQPuBn2r4DTv+ksH049yTeo2xWA3ckOyXC9XMdihtliqiEXnreKRn8GoT1qD/Ivy3tVNzqaN/Jx0gFfUoi72NhdG0lVJ6A16SILoUJZ+SvCHA43MwnW9j91LqbI5dQj9ektNaZZQa1CuomYNqzrJE9SrN5zT+14FKGpSZRaEZvgngTuSfjWsf/gUNkbD1SwQpj8vf/DWEc7eKArj4T5Yzou8zHZdP68L8quTkyVMMM=;4:15s37gygJvxYzS18mg96YCMPSchBjRx28Mf2hZB/Q0gyQNaW1Ifzz4aFmU2b02/8x66FnNFbk/2GApjDHP+TrqKelydovikceMSQ6KJLCGyb2kwLT9yLGG8dTHyPC1LPN32I7PtE4NFCRGtEAhDgJblG7SxrcHewflgFFFaSgpfVVM3WodSrmIVXTwrh9OQuOdtk9uNvbnKyzFIsrZ7Q9HLWsj1G70cRhu8cqJjFFdzZYJEbZ6b7cjXTY6ffNJPjguvU6K1FrGJy2VsT0G3cyV/67gITCPSDlcQ8qgoJ+Hvfx6p04WwOZTmwKK4DdqQRAOILiI22ouzpTZx7NCoeNw== 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;CY4PR03MB2694;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GY+nink8O97f+oDd4o3C08Y0vs=;7:b/Fs6na2Cz3TzijGpe7cjG9t0vyp0uNkKxfhRaOkZ8miDPzMHGLzsMamGdHdzfSdimZZoOthRJIfSD1xZPUJFy8P61hQ5HECiBDN3mKxkLdZ0h/LD4xCko8xcs3gtJUvjjMEe52vbEi6T5DYT+2VgjRWff8t2yACPKu0FaW3mQzcTCdOs/S/tQc4UuSOV44PfxUP3mZq5mGuiKsay/TisblxabLNvCev82eTKkpasWx0ROA/Us1GfrE2YugqH0kL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 10:11:49.3454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 906306ff-82be-45af-254e-08d546c8eb21 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: 6400 Lines: 156 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 v3: Adjust the commit information. Replace "(1<<34)" with BIT(34). Update the DT properity description. Update erratum description in code comment. 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