From patchwork Mon Nov 11 18:28:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179119 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7063301ilf; Mon, 11 Nov 2019 11:06:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwZTx4KSMoX6Shgi7eklNe8CjzM8FN8icnbh8IhsyOoVHe/r9pveeHW7gg1TuONgGQN2OYl X-Received: by 2002:aa7:d552:: with SMTP id u18mr28363498edr.86.1573499191693; Mon, 11 Nov 2019 11:06:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573499191; cv=none; d=google.com; s=arc-20160816; b=mD/0jbZdECHKrkqCtUFCztAhC0npayr1iQIuHxUdaLkaPgef95hThhVYR595SCdKgq oZCZ4SkHYjERW/nk76COfRSa8fFdJPuqJTd/0WZ26V4MFsfEsdtR8OE1CyKDwoJ1yO5i JAIvR7q5TrdJfQlBpgUCG/UgsSrlrZajk72keEG9Kx+NPC9rPp1Aix8ENP9/iZ6ybtPK aD65axK/8W6gF+w6ZsdWhW9ku4gAUXrM++gtMUdA+TCr/Br0mE1HwqK/QdrFbkOLf1QN 4gHhIOacaqEL4jsfeaCsP11EwoASz6mJzOXszq9rTHbO8Ae45CZn4K/E9SPb5czKZIkD eAzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DC0PhSJxIjRe1R59I7B230fHR9f0ZRLbBZoAA+c52Sw=; b=pNj9FzL0bbI5+3ZCt69RNC0nq38TnrVIsa//qamd77lLwomEBp4T76SaYzc2ElEUwM cdd2KY4SZOP+sR/AUPtszKz8KCnM7FqXln/HTCerwqzvc89nXc0om+E4c0EB4dg/MpM3 Y/8wlg+u4UhJpPKfCTZCZ6DSRFTXvWpnqUqQHlDtKpfA3DfT8/T3ghLUx6mnpFkV+V2p 7Y7/IsKKRkyFBPmsivQXomBw2bsmutGR0Mn8KVw1f6B9M4kL8I8Uz5ClgBD9yGgdsQBM NPwiEmes6Wr7SNIhQDKJVxG/mD7fS3zdapFBbVS/JAqVCf/8JXP99wiCjd8xknH474+H WKDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ascod6o9; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c53si11573749eda.396.2019.11.11.11.06.30; Mon, 11 Nov 2019 11:06:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ascod6o9; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727439AbfKKTG3 (ORCPT + 14 others); Mon, 11 Nov 2019 14:06:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:57854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728028AbfKKSiv (ORCPT ); Mon, 11 Nov 2019 13:38:51 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 927592196E; Mon, 11 Nov 2019 18:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497530; bh=mK+Elh+tbvp7chd+lajcYCegHw9TYGBbrnx4TCYxMNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ascod6o9QoLFL3UkvfiA0vwBLnDjznDZA6tFsKU0Ro/jYIM1k57P67ofYS/RWQowK Af8nNfa4C3oj6sICBPKtR89nOjdDe09RHnKCv07iiJIPGUzz9FUmCzGQ4Tf1CZddVo +0NU0gEjtwYI3sEwwckvdce7L1Thw3APkurkDW0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Roger Quadros , Felipe Balbi , Mathieu Poirier Subject: [PATCH 4.14 046/105] usb: dwc3: Allow disabling of metastability workaround Date: Mon, 11 Nov 2019 19:28:16 +0100 Message-Id: <20191111181441.392248271@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181421.390326245@linuxfoundation.org> References: <20191111181421.390326245@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roger Quadros commit 42bf02ec6e420e541af9a47437d0bdf961ca2972 upstream Some platforms (e.g. TI's DRA7 USB2 instance) have more trouble with the metastability workaround as it supports only a High-Speed PHY and the PHY can enter into an Erratic state [1] when the controller is set in SuperSpeed mode as part of the metastability workaround. This causes upto 2 seconds delay in enumeration on DRA7's USB2 instance in gadget mode. If these platforms can be better off without the workaround, provide a device tree property to suggest that so the workaround is avoided. [1] Device mode enumeration trace showing PHY Erratic Error. irq/90-dwc3-969 [000] d... 52.323145: dwc3_event: event (00000901): Erratic Error [U0] irq/90-dwc3-969 [000] d... 52.560646: dwc3_event: event (00000901): Erratic Error [U0] irq/90-dwc3-969 [000] d... 52.798144: dwc3_event: event (00000901): Erratic Error [U0] Signed-off-by: Roger Quadros Signed-off-by: Felipe Balbi Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c | 3 +++ drivers/usb/dwc3/core.h | 3 +++ drivers/usb/dwc3/gadget.c | 6 ++++-- 4 files changed, 12 insertions(+), 2 deletions(-) --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -47,6 +47,8 @@ Optional properties: from P0 to P1/P2/P3 without delay. - snps,dis-tx-ipgap-linecheck-quirk: when set, disable u2mac linestate check during HS transmit. + - snps,dis_metastability_quirk: when set, disable metastability workaround. + CAUTION: use only if you are absolutely sure of it. - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal utmi_l1_suspend_n, false when asserts utmi_sleep_n - snps,hird-threshold: HIRD threshold --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1115,6 +1115,9 @@ static void dwc3_get_properties(struct d device_property_read_u32(dev, "snps,quirk-frame-length-adjustment", &dwc->fladj); + dwc->dis_metastability_quirk = device_property_read_bool(dev, + "snps,dis_metastability_quirk"); + dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis; --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -869,6 +869,7 @@ struct dwc3_scratchpad_array { * 1 - -3.5dB de-emphasis * 2 - No de-emphasis * 3 - Reserved + * @dis_metastability_quirk: set to disable metastability quirk. * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */ @@ -1025,6 +1026,8 @@ struct dwc3 { unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; + unsigned dis_metastability_quirk:1; + u16 imod_interval; }; --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2034,7 +2034,8 @@ static void dwc3_gadget_set_speed(struct * STAR#9000525659: Clock Domain Crossing on DCTL in * USB 2.0 Mode */ - if (dwc->revision < DWC3_REVISION_220A) { + if (dwc->revision < DWC3_REVISION_220A && + !dwc->dis_metastability_quirk) { reg |= DWC3_DCFG_SUPERSPEED; } else { switch (speed) { @@ -3265,7 +3266,8 @@ int dwc3_gadget_init(struct dwc3 *dwc) * is less than super speed because we don't have means, yet, to tell * composite.c that we are USB 2.0 + LPM ECN. */ - if (dwc->revision < DWC3_REVISION_220A) + if (dwc->revision < DWC3_REVISION_220A && + !dwc->dis_metastability_quirk) dev_info(dwc->dev, "changing max_speed on rev %08x\n", dwc->revision); From patchwork Mon Nov 11 18:28:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179163 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7641604ilf; Mon, 11 Nov 2019 21:34:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxDk51XVxIL3vqBdJRZOP1OHKmohLPuaG2dwo+kuOxPg+oybwWEsiZnUxJzvPjA7o0I3ynp X-Received: by 2002:a17:906:7e41:: with SMTP id z1mr26189364ejr.63.1573536841654; Mon, 11 Nov 2019 21:34:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573536841; cv=none; d=google.com; s=arc-20160816; b=zNB0sJFzjG8g5VSmBOr/Ix0SZTijMjIDcTA5h+N5dBc+KVLzUq1yEijl3PKOOQiVmB 36a4R9lJr0jgmZMqYsEL8BXEAUhz9btPojk2GPcbxlek38QQKrfq/14kiScypNbQJ49N kkVx8DDrbWDF4g9RS2qLZ4OBlU/5fjIeDsNp1S2qs7HHHbYlP2LZU6ImHaaBaVdToVxL AB1fC/5Og4y/mLEhfbklsXUj+5XXYXr8mD/6DUVhynq4mZuA2U8iAe147KZ0htTEJWLZ eet2bVDHKi/JyUL6Zil/2yukAKZc8cTne5c2GcDbxzVH6O8LmCsQoJ9DquJ1Ok7tkFxP dQHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ye/XKmpeecD3DWQWXrJj/txhyaxOkkHA/IPpk4KLlZU=; b=iw4fRNxsvgKwGcA4twFSa3U9A3rY5wBw8frF+h0b3kluhg8bNowH+sGK9BpGJ/lzhR 2n6sjno5/ZfZ8m8+mDoCVlYaey8mEcAR840kSCdQ9EqIavdLlNO9MTsKRpVl+QFy9HiP OYbT0OlxAAZZ5T3J4yCFXv01O8aJR/vSgjQr7Vd3/ulz0N3owhAJpePJRfyNzq2h45ee kZ1V9dvm2nCpjI6niqtzrULBC6kqHJtrDqJ31AMG17LR8ipNCPkKpTTwHUJsT3HFP2Rd P4RHhqufgVNa1yVvOJeDLdg3C8s+/Zyk6pj7zW9YsETpXUqnrTVqS8Q703rANmygA4Zo FP/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rrw9OoBo; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gs14si10706727ejb.347.2019.11.11.21.34.01; Mon, 11 Nov 2019 21:34:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rrw9OoBo; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725881AbfKLFeA (ORCPT + 14 others); Tue, 12 Nov 2019 00:34:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:60760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfKLFeA (ORCPT ); Tue, 12 Nov 2019 00:34:00 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 879C12084F; Tue, 12 Nov 2019 05:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573536840; bh=sbnFXAjpbcwJnf2+mH5IsFebJvwzJN37XivvkMyt/50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rrw9OoBoJJsfH217xuK/dIynZd/Lg3JslxJZPFFOu+cHhG9k+6kIM0nBggDw4x4G0 cRUqK3qLEBrT44fRfisxQOXG8+2cSiGBD+8JHqN6tT7EhpPwCfqnia3993/K2k8qKR Nw05FMp4nIvID6V0U5M+CJ/5OXz/Z+jJcBv5Xg44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roger Quadros , Felipe Balbi , Tony Lindgren Subject: [PATCH 4.14 061/105] ARM: dts: dra7: Disable USB metastability workaround for USB2 Date: Mon, 11 Nov 2019 19:28:31 +0100 Message-Id: <20191111181444.963730015@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181421.390326245@linuxfoundation.org> References: <20191111181421.390326245@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roger Quadros commit b8c9c6fa2002b8fd4a9710f76f80f99c6046d48c upstream. The metastability workaround causes Erratic errors [1] on the HighSpeed USB PHY which can cause upto 2 seconds delay in enumerating to a USB host while in Gadget mode. Disable the Run/Stop metastability workaround to avoid this ill effect. We are aware that this opens up the opportunity for Run/Stop metastability, however this issue has never been observed in TI releases so we think that Run/Stop metastability is a lesser evil than the PHY Erratic errors. So disable it. [1] USB controller trace during gadget enumeration irq/90-dwc3-969 [000] d... 52.323145: dwc3_event: event (00000901): Erratic Error [U0] irq/90-dwc3-969 [000] d... 52.560646: dwc3_event: event (00000901): Erratic Error [U0] irq/90-dwc3-969 [000] d... 52.798144: dwc3_event: event (00000901): Erratic Error [U0] Signed-off-by: Roger Quadros Acked-by: Felipe Balbi Signed-off-by: Tony Lindgren Signed-off-by: Greg Kroah-Hartman --- arch/arm/boot/dts/dra7.dtsi | 1 + 1 file changed, 1 insertion(+) --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi @@ -1540,6 +1540,7 @@ dr_mode = "otg"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; + snps,dis_metastability_quirk; }; };