Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2116574rwr; Sat, 6 May 2023 05:17:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LGUwsYwDkaOnv9boUdAHSnUGNdrKRfp0eUV2MK7U5MbK247/qqyUWbaL/EHN4p1WdE4S8 X-Received: by 2002:a17:902:c085:b0:1ab:d16:3c8a with SMTP id j5-20020a170902c08500b001ab0d163c8amr4122699pld.6.1683375478093; Sat, 06 May 2023 05:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683375478; cv=none; d=google.com; s=arc-20160816; b=zFnk8zpgXfiCs1EfEA2mo6dIeKUu30forAVueLkwHzqA5O+JmM63ALQebl4OCKjM4m 7v3jru7lOsOqzksyLsIFkEeKJN4nCe4EA6uykmOTq3a16rAbYjkLIdiAhA+VEWdcItYP CQXUYQg7wwn81elEArrCgoXrfL3rc62IVVG9p561zVwOOBVn31ASnA3C8czgMdCkOPHw ysIewf9YtdLPKwVIz7K4cyfEdxI0xyF72rhDCl5TKpmMymUqzRCULGu6LPz2u4ftBffq qDbrad09l4n9qjO2NbTa1kLULMULM//F3SQ65MNm3tjGgsE3D32BVzMB3r/qHeAdSaz9 19Jw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a170902ce9200b001a1ced49c70si3955015plg.369.2023.05.06.05.17.44; Sat, 06 May 2023 05:17:58 -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 S231343AbjEFMPr (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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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; -- 2.32.0