From patchwork Fri Apr 21 20:38:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weitao Wang X-Patchwork-Id: 86288 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1040656vqo; Fri, 21 Apr 2023 05:50:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YCLtXWMCW4bvBbaoN1ZujlhBjbQlEQkQwXuSQPo6VUbtFCCiuDAmBGLa50B2COdVWz2tko X-Received: by 2002:a17:90b:238f:b0:246:c223:14ab with SMTP id mr15-20020a17090b238f00b00246c22314abmr4866507pjb.41.1682081440725; Fri, 21 Apr 2023 05:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682081440; cv=none; d=google.com; s=arc-20160816; b=OgrrsgDE7pxoUBvJGETvRQjXlLpViYP1QRHwOKKpF3mC0zMMHfnOu+p0el36esCmkH l2bf0b88yWOlnh1DIXI8xGjNhjAKvu0Zgdrbzlj0LhQtxY5aN77U1TJ2LizGK4nFObt8 vaZ0t3qiroLkDUndXSYujt+RDfN8O4a0kpp668o/78rDQzYrM4A5UhW6Mfc+VPNPcGh9 HPuJLIOB8EV4j6F6U+n/H+VE+0e+/3Fr1iiMgDHCc6Mq7ZRp8ruUxGdCpyonBhZjZiJB ex3jBl9Vi9qcKxiIrN+rmZ+LiHvHelqFi2kdKOrHAj2udLr1fXbfrbXaLX2cZAEHn5DC xTeA== 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=QxtASMseYdJYgB4kf+OLOkU1y4Ptk6lZ183eXrbu/Eo=; b=0j+r9kQUnsDfD4RK+gXMQSJk2HLpDXyuFkRcOmZsKIXAmN5rJzx104+T7OLC2H1Md3 uzlXvrGzI3+8JOm7NcjTgtgP/2byZRrJjs1MlgR9+Bo+7JC1eHda+x7BbqSSlX5q91Z4 konJqJSkpWy2fVOEyE+ZzenTbAxMg8REBD37X2Idprxstib36tk1N75h/X4VNFUbwtrk Szy8+7+83e9lUec0H8w82TAPNWKamEzdKspZR5Cj6QiZJi3Jz92843nel82yOfW620fu RVfOo4beTwy8bWNsj+Zqa2P+6y1FQxPcnTmCLRKrCW3IzpNh8w68ifIqvwgJDE/QKpaH zyrg== 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 n16-20020a63ee50000000b0051805159a1csi4250719pgk.476.2023.04.21.05.50.28; Fri, 21 Apr 2023 05:50:40 -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 S231857AbjDUMjH (ORCPT + 99 others); Fri, 21 Apr 2023 08:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232070AbjDUMjE (ORCPT ); Fri, 21 Apr 2023 08:39:04 -0400 Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9186DB772 for ; Fri, 21 Apr 2023 05:38:57 -0700 (PDT) X-ASG-Debug-ID: 1682080734-1eb14e6388386f0002-xx1T2L Received: from ZXSHMBX1.zhaoxin.com (ZXSHMBX1.zhaoxin.com [10.28.252.163]) by mx2.zhaoxin.com with ESMTP id 4mOIhBGDnUpGCazL (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 21 Apr 2023 20:38:55 +0800 (CST) X-Barracuda-Envelope-From: WeitaoWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHMBX1.zhaoxin.com (10.28.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 21 Apr 2023 20:38:54 +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; Fri, 21 Apr 2023 20:38:54 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 From: Weitao Wang X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.163 To: , , , CC: , , Subject: [PATCH v2 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues Date: Sat, 22 Apr 2023 04:38:50 +0800 X-ASG-Orig-Subj: [PATCH v2 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues Message-ID: <20230421203853.387210-2-WeitaoWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230421203853.387210-1-WeitaoWang-oc@zhaoxin.com> References: <20230421203853.387210-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: ZXSHMBX1.zhaoxin.com[10.28.252.163] X-Barracuda-Start-Time: 1682080734 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: 2170 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.107724 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?1763790228796846676?= X-GMAIL-MSGID: =?utf-8?q?1763790228796846676?= 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 --- v1->v2 - Add more quirks of xhci for zhaoxin. drivers/usb/host/xhci-pci.c | 11 +++++++++++ drivers/usb/host/xhci.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 6db07ca419c3..53b7d8a1ed0a 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -334,6 +334,17 @@ 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 786002bb35db..8f8f0e91b0dc 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;