From patchwork Sat May 6 20:15:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weitao Wang X-Patchwork-Id: 90740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1018843vqo; Sat, 6 May 2023 05:18:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57/cTzK+gofQ/vPQ24jCF9VquQp2hb2JRI9IRS/BQvTTWXTdWnMB1UNslxnhCsrRvyWjOY X-Received: by 2002:a05:6a20:4658:b0:f2:ba78:3d50 with SMTP id eb24-20020a056a20465800b000f2ba783d50mr4326940pzb.12.1683375490520; Sat, 06 May 2023 05:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683375490; cv=none; d=google.com; s=arc-20160816; b=zYvh3G162br7DWKNnrbAJKuVS+qBLMczbCISBNtamyfd4kw6sKuaRekI2vZyWOPEQZ TkL8pP9eY+6Ydt6iHa6+URdn1nNiOBGtNc73ZG1HcVpYZP8GXz6WqJLbNkaGNM9cJw5M i8mYPveMK+sKLhVF+xx7mtbDq160xCmQ253IP9l36Yd6v5RPjNUtwY2UeZBVqY41UArI rP5RvO+IyRU8uDPLEC97oNA9GwboduTrm5RsK3VzmYFui9qnUBfHiiVcHKpUSxCMe0CF EAQ11zhTiPjPxCaHBk5iBmRcAaG8+Br1zGDOc83AAt7Z7aJeONiQFab4/peTpwuUhAIv 9bfg== 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; bh=K/RwbD4Pr/LqOhcFFJt7WtgNOyUBTrUzG+RATi15a7Y=; b=DD5DUAG2jxffjYWGOSVH3nenrg6NJMikXPMoUklU9ISsM1e4KbJ7G9WD6wOYoPR/Up anzW/z4CsUFgkbGz+I8MjBrsO3hwHzRXDdhw6gaKMb0/KhKrg2c2zbIGu6LTcnX2QhHj gU0oUiLYpXb3kbET+aeuYyq8CIjW4XjpkRY8sxsBwvZgRYxgQZg1Z6CjtZTQKEH1cUSC WitHj4jT24GWzD6jlBaX1A02ExMXX0yQgw6l74PQqBnBI6H2jLqkC+piHvkcyMkoDDvT uVOkU2OBY7Ooig7zdr25HUnMEC/U/7EiBwQEbxWh7oyIOFf0xhJ1ARR1PjdQeWcXOdL2 v4XQ== 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 l3-20020a637003000000b0052c2061447dsi3970153pgc.522.2023.05.06.05.17.58; Sat, 06 May 2023 05:18:10 -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 S231916AbjEFMPr (ORCPT + 99 others); Sat, 6 May 2023 08:15:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjEFMPo (ORCPT ); Sat, 6 May 2023 08:15:44 -0400 Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E41C13849 for ; Sat, 6 May 2023 05:15:42 -0700 (PDT) X-ASG-Debug-ID: 1683375338-1eb14e6386684a0002-xx1T2L Received: from ZXSHMBX2.zhaoxin.com (ZXSHMBX2.zhaoxin.com [10.28.252.164]) by mx2.zhaoxin.com with ESMTP id gFQcimuOrWG0ULYl (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sat, 06 May 2023 20:15:39 +0800 (CST) X-Barracuda-Envelope-From: WeitaoWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHMBX2.zhaoxin.com (10.28.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sat, 6 May 2023 20:15:38 +0800 Received: from L440.zhaoxin.com (10.29.8.21) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sat, 6 May 2023 20:15:38 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 From: Weitao Wang X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.163 To: , , , CC: , , Subject: [PATCH v3 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues Date: Sun, 7 May 2023 04:15:33 +0800 X-ASG-Orig-Subj: [PATCH v3 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues Message-ID: <20230506201536.7362-2-WeitaoWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230506201536.7362-1-WeitaoWang-oc@zhaoxin.com> References: <20230506201536.7362-1-WeitaoWang-oc@zhaoxin.com> MIME-Version: 1.0 X-Originating-IP: [10.29.8.21] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Barracuda-Connect: ZXSHMBX2.zhaoxin.com[10.28.252.164] X-Barracuda-Start-Time: 1683375338 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.36:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 2123 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: 1.09 X-Barracuda-Spam-Status: No, SCORE=1.09 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=DATE_IN_FUTURE_06_12, DATE_IN_FUTURE_06_12_2 X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.108401 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.01 DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date 3.10 DATE_IN_FUTURE_06_12_2 DATE_IN_FUTURE_06_12_2 X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1765147138156663236?= X-GMAIL-MSGID: =?utf-8?q?1765147138156663236?= Add a quirk XHCI_ZHAOXIN_HOST for zhaoxin xhci to fix issues, there are two cases will be used. - add u1/u2 support. - fix xHCI root hub speed show issue in zhaoxin platform. Add a quirk XHCI_ZHAOXIN_TRB_FETCH to fix TRB prefetch issue. On Zhaoxin ZX-100 project, xHCI can't work normally after resume from system Sx state. To fix this issue, when resume from system Sx state, reinitialize xHCI instead of restore. So, Add XHCI_RESET_ON_RESUME quirk for ZX-100 to fix issue of resuming from system Sx state. Cc: stable@vger.kernel.org Signed-off-by: Weitao Wang --- drivers/usb/host/xhci-pci.c | 12 ++++++++++++ drivers/usb/host/xhci.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ddb79f23fb3b..3fd73fceb678 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -527,6 +527,18 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) xhci->quirks |= XHCI_NO_SOFT_RETRY; + if (pdev->vendor == PCI_VENDOR_ID_ZHAOXIN) { + xhci->quirks |= XHCI_LPM_SUPPORT; + xhci->quirks |= XHCI_ZHAOXIN_HOST; + + if (pdev->device == 0x9202) { + xhci->quirks |= XHCI_RESET_ON_RESUME; + xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; + } + if (pdev->device == 0x9203) + xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; + } + /* xHC spec requires PCI devices to support D3hot and D3cold */ if (xhci->hci_version >= 0x120) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 08d721921b7b..5fe1238eeb2d 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1905,6 +1905,8 @@ struct xhci_hcd { #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) +#define XHCI_ZHAOXIN_HOST BIT_ULL(45) +#define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(46) unsigned int num_active_eps; unsigned int limit_active_eps;