From patchwork Thu Apr 13 10:09:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?U3RhbmxleSBDaGFuZ1vmmIzogrLlvrdd?= X-Patchwork-Id: 82894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp927716vqo; Thu, 13 Apr 2023 03:23:27 -0700 (PDT) X-Google-Smtp-Source: AKy350ZriIID336obLe/EOY/kSk8+1AKHEl9DeDugJEYUrMLnlOfMTvv+Npm4ySphsXqGMWlEgWO X-Received: by 2002:a17:902:a413:b0:1a1:da3c:605f with SMTP id p19-20020a170902a41300b001a1da3c605fmr1596080plq.58.1681381407575; Thu, 13 Apr 2023 03:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681381407; cv=none; d=google.com; s=arc-20160816; b=ifXqIXih5R6fbmKxdcI+YM1aiR4L7dXomg9zhIvAv+Xl4cslFWjKXqLBtoFHWw86W6 LLw2LmAUcwAKnoy/lHWp5Lrvx4tWnv3uO412CdQfKupi8JnYCOEdaHxPF42QlZbBqETu AN/PhS1r2aHzcEr4sBF8JWrWaO3Sl+77fquWF+N1uRtp6116T45WZtDUN9Ma/IdkO3JK XSzcXz6jUIgBPz1J0iFwmvDC2+5HGZRKIAWjJKy7mS1g3zCRs1Eue71qfucz1gnElzPU Ym/AN0bLXXEXoIFPBFGJBBzHcsR2G4z0uODB7BbwW8rdzIqERDqgUwD+jAhPiGAgoY3V qceA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:authenticated-by; bh=0WlhG7UIXIyemzLdKTYeW2h3zAt/QGOeY9vV/nquJBU=; b=y08ursYTsAnh6SXFGnNPengaxlYztEQF47yonacWJrm6Nsx3nk0EtwtVVAs9OI7SuU soTr+y7B8JWgJr9aAC/9Lwq74K65oF/+b5IZ3QwoXaRcT4U7x260itMecxMq7RZH1GyV UvPYnnYpWvwlLVspu+tzInvWOwA0MyG2d9SKEXPzPccYCvibCZM3aRl4opF3/nigRv9c wpGvnlybd+7mQiKsY1JxRQ3ZU4bEv6fGT6h9OOWu2u+aIQtDW7cXNi7LzesDh5M62j3n NZi01ppq9qdIlwY9B402PPWQyPsL9RmnSU0ZocCeJrPgFA5/FvayKf/pFfSHUyhvIY3n m+Fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a63ed4d000000b005141c6761b2si1653735pgk.800.2023.04.13.03.23.14; Thu, 13 Apr 2023 03:23:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbjDMKLr (ORCPT + 99 others); Thu, 13 Apr 2023 06:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbjDMKL0 (ORCPT ); Thu, 13 Apr 2023 06:11:26 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E2E09ED1; Thu, 13 Apr 2023 03:10:50 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33DA9qNaA019713, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33DA9qNaA019713 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Thu, 13 Apr 2023 18:09:52 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Thu, 13 Apr 2023 18:09:15 +0800 Received: from RTEXH36506.realtek.com.tw (172.21.6.27) by RTEXMBS01.realtek.com.tw (172.21.6.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 13 Apr 2023 18:09:14 +0800 Received: from localhost.localdomain (172.21.252.101) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Thu, 13 Apr 2023 18:09:14 +0800 From: Stanley Chang To: Thinh Nguyen CC: Stanley Chang , Greg Kroah-Hartman , Rob Herring , "Krzysztof Kozlowski" , Felipe Balbi , , , Subject: [PATCH v3 1/2] usb: dwc3: core: add support for disabling High-speed park mode Date: Thu, 13 Apr 2023 18:09:13 +0800 Message-ID: <20230413100914.7890-1-stanley_chang@realtek.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-KSE-ServerInfo: RTEXMBS01.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762970330267592164?= X-GMAIL-MSGID: =?utf-8?q?1763056190702446739?= Setting the PARKMODE_DISABLE_HS bit in the DWC3_USB3_GUCTL1. When this bit is set to '1' all HS bus instances in park mode are disabled For some USB wifi devices, if enable this feature it will reduce the performance. Therefore, add an option for disabling HS park mode by device-tree. In Synopsys's dwc3 data book: In a few high speed devices when an IN request is sent within 900ns of the ACK of the previous packet, these devices send a NAK. When connected to these devices, if required, the software can disable the park mode if you see performance drop in your system. When park mode is disabled, pipelining of multiple packet is disabled and instead one packet at a time is requested by the scheduler. This allows up to 12 NAKs in a micro-frame and improves performance of these slow devices. Signed-off-by: Stanley Chang Acked-by: Thinh Nguyen --- v2 to v3 change: 1. Add the comment message. 2. cc the right maintainers. --- drivers/usb/dwc3/core.c | 5 +++++ drivers/usb/dwc3/core.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 476b63618511..8fbc92a5f2cb 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1233,6 +1233,9 @@ static int dwc3_core_init(struct dwc3 *dwc) if (dwc->parkmode_disable_ss_quirk) reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; + if (dwc->parkmode_disable_hs_quirk) + reg |= DWC3_GUCTL1_PARKMODE_DISABLE_HS; + if (DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) && (dwc->maximum_speed == USB_SPEED_HIGH || dwc->maximum_speed == USB_SPEED_FULL)) @@ -1555,6 +1558,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,resume-hs-terminations"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); + dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev, + "snps,parkmode-disable-hs-quirk"); dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, "snps,gfladj-refclk-lpm-sel-quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4743e918dcaf..30907ffcb3ec 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -263,6 +263,7 @@ #define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) +#define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) #define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ @@ -1102,6 +1103,8 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed * instances in park mode. + * @parkmode_disable_hs_quirk: set if we need to disable all HishSpeed + * instances in park mode. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis @@ -1318,6 +1321,7 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned resume_hs_terminations:1; unsigned parkmode_disable_ss_quirk:1; + unsigned parkmode_disable_hs_quirk:1; unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; From patchwork Thu Apr 13 10:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?U3RhbmxleSBDaGFuZ1vmmIzogrLlvrdd?= X-Patchwork-Id: 82892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp922182vqo; Thu, 13 Apr 2023 03:12:11 -0700 (PDT) X-Google-Smtp-Source: AKy350aCSSpRrBSp0LLDJbrN8bKkkraWJLtSimOYH2Q93zXwHMnDkdenuecAfhjRY6EqbXkuW7iR X-Received: by 2002:a17:906:f847:b0:94c:a077:c980 with SMTP id ks7-20020a170906f84700b0094ca077c980mr2072313ejb.69.1681380731161; Thu, 13 Apr 2023 03:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681380731; cv=none; d=google.com; s=arc-20160816; b=KMhNA0rMHnfVWK4FQlgwsUlF2sjcR26qhUuJx52XMNc+wt9LacD3AFb2DVd1EEPO8J COUQOj9BPNVetdAir6+X9ppMVTYClxRTrLsZCJCxbDiKl3l4gJOBfsxnpRQau9RbpbCQ qOnuRq80Zw+1xhTaDxn1Nxva8wmRTVWnWXz292FLBTy+S9ei28c3AZI8/m/+HTs9QEZ9 sCeWm+JKNPYsC86XhbTwRsUazvqPgHSgVw+wy5vQnZD2evWqNUTe9nynqnIX9PuG0/c2 6PXIt19LcDi6kbEZsYiwVR7FozKzCqvVnFyShJyHjnQWT7Uez15V8qEkwZAXVRiepCSq 6yyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :authenticated-by; bh=AIa0OEUv9vsqbwBmFVrWkl8v4D5z/w15/6vrnovkEbM=; b=yszNaWXiBAjYBE+neA4RGrV1XDUnY3x0yp3iqg4ICrF/7v/Wqt3ODAiU3MTv8LVfdw cYvzvj3abN2m1eOoAWIduQby4CcV52rifN9fyFsehrrGjbu/PUMjhzjMiY3BEuF/p3zg lUm1lVnIIO0fmzW/clLrkZJm8VmN+lx+VH3L4DHy1+Iz5ZSt7jXUyX/RbEmkjU9vmNyG yWjAGSZraRqEZ4szmDMZwXMrujeN3j1rJ873OxuznbFU2FG8kVU5tpYooO/i4dkEB/LC T/Ei+LQ5IIxsg79HRCe9WcFfP2aEBDEbX2/kkD8HxgDIHRep3ja1pyqX4l/m5hZpeDz4 aTqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020aa7c513000000b004fac11e70adsi1469634edq.637.2023.04.13.03.11.45; Thu, 13 Apr 2023 03:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229935AbjDMKJg (ORCPT + 99 others); Thu, 13 Apr 2023 06:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjDMKJe (ORCPT ); Thu, 13 Apr 2023 06:09:34 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B76CAF; Thu, 13 Apr 2023 03:09:31 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33DA8rVB2018677, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33DA8rVB2018677 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Thu, 13 Apr 2023 18:08:53 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Thu, 13 Apr 2023 18:09:15 +0800 Received: from RTEXH36506.realtek.com.tw (172.21.6.27) by RTEXMBS01.realtek.com.tw (172.21.6.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 13 Apr 2023 18:09:15 +0800 Received: from localhost.localdomain (172.21.252.101) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Thu, 13 Apr 2023 18:09:15 +0800 From: Stanley Chang To: Thinh Nguyen CC: Stanley Chang , Greg Kroah-Hartman , Rob Herring , "Krzysztof Kozlowski" , Felipe Balbi , , , Subject: [PATCH v3 2/2] dt-bindings: usb: snps,dwc3: Add 'snps,parkmode-disable-hs-quirk' quirk Date: Thu, 13 Apr 2023 18:09:14 +0800 Message-ID: <20230413100914.7890-2-stanley_chang@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230413100914.7890-1-stanley_chang@realtek.com> References: <20230413100914.7890-1-stanley_chang@realtek.com> MIME-Version: 1.0 X-KSE-ServerInfo: RTEXMBS01.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763055481415053614?= X-GMAIL-MSGID: =?utf-8?q?1763055481415053614?= Add a new 'snps,parkmode-disable-hs-quirk' DT quirk to dwc3 core for disable the high-speed parkmode. For some USB wifi devices, if enable this feature it will reduce the performance. Therefore, add an option for disabling HS park mode by device-tree. In Synopsys's dwc3 data book: In a few high speed devices when an IN request is sent within 900ns of the ACK of the previous packet, these devices send a NAK. When connected to these devices, if required, the software can disable the park mode if you see performance drop in your system. When park mode is disabled, pipelining of multiple packet is disabled and instead one packet at a time is requested by the scheduler. This allows up to 12 NAKs in a micro-frame and improves performance of these slow devices. Signed-off-by: Stanley Chang Acked-by: Rob Herring --- v2 to v3 change: 1. Add the comment message. 2. cc the right maintainers. --- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml index be36956af53b..45ca967b8d14 100644 --- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml +++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml @@ -232,6 +232,11 @@ properties: When set, all SuperSpeed bus instances in park mode are disabled. type: boolean + snps,parkmode-disable-hs-quirk: + description: + When set, all HighSpeed bus instances in park mode are disabled. + type: boolean + snps,dis_metastability_quirk: description: When set, disable metastability workaround. CAUTION! Use only if you are