From patchwork Sun Apr 23 10:59:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weitao Wang X-Patchwork-Id: 86657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1999204vqo; Sat, 22 Apr 2023 20:09:58 -0700 (PDT) X-Google-Smtp-Source: AKy350ZwePMc7cTzA0y8ODRQf3QpYDNAoez5RuZ9TuAAN8BmEawGA2D+6exkfn93P119L3EdB7TV X-Received: by 2002:a05:6a00:188b:b0:63f:37b8:655 with SMTP id x11-20020a056a00188b00b0063f37b80655mr2860017pfh.20.1682219398550; Sat, 22 Apr 2023 20:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682219398; cv=none; d=google.com; s=arc-20160816; b=ilQOiz+G0m0Imv1P6vJB0rmVHIG7QUvkS9wrQFBQt1s6kxJFDmXVAnJ1TGYFcSdRgy yUavptVrTnamkWVWNX/WPS1DnI6qedc7SqB4PJfUZzZkhH1fKIjPpGFr0I7gB4BhBkkm hLIFIlhoO6TkSjEs2XS6T9A5qfOuh8WCKhXabZjIVkpUyA87TRqzHdMHY+shkpYIJNKn L+sMPXVtc1vff/7mBo46NBwbZPD6WiL5aEhIMH62k5rn/Wb6aYSuCKUds6N6kmUULAQn LeOS7LFBwrLVuwp951eO01sXpMVnU5RUTnTZGnHf58lmvAjiRvc8RhlAeaHyWAHUIUjo ZZbw== 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; bh=9xfaYBZNttOqT1E0hUKhOsGSqeFXhnPvp1jpk6MlwSk=; b=ENoYOn+5pEzwwamPp1mvrHQKJyzb2Gmorum9BABjmzN7GovyliJSG5DHbkkggh0VJn sDH1q2x2OmvZa3GHRslLjSk91tnQ+LpsamH1kAX0az2ZPqKUpXstuw2eG7f8CGiQAdFo lJy/39/Q/vHGlMpo8FXQr9OAO4c4oHbDobEPsS1AgvNaBT7bcOyUlKvURwuZh6uzOb/+ nZfIxP1pk0KjlY56semtSs+0hKPrl3lFF0k+3/+J1/YNG9VdvSpobtaBVwQ9IYHzjpVa vVAFjXkHH4KFUJ3cgfdo2v4XdoWrJq0zgyUwYUfNA/qYixOOXidOV/STcUPJZZdRg0cx cBdQ== 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 y8-20020aa79e08000000b0063d24857c5bsi8175492pfq.43.2023.04.22.20.09.44; Sat, 22 Apr 2023 20:09: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 S230154AbjDWC77 (ORCPT + 99 others); Sat, 22 Apr 2023 22:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbjDWC74 (ORCPT ); Sat, 22 Apr 2023 22:59:56 -0400 Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 910C41737 for ; Sat, 22 Apr 2023 19:59:54 -0700 (PDT) X-ASG-Debug-ID: 1682218791-1eb14e638744c60001-xx1T2L Received: from ZXSHMBX3.zhaoxin.com (ZXSHMBX3.zhaoxin.com [10.28.252.165]) by mx2.zhaoxin.com with ESMTP id wAEo9SqO79MjJgxb (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 23 Apr 2023 10:59:51 +0800 (CST) X-Barracuda-Envelope-From: WeitaoWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.165 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHMBX3.zhaoxin.com (10.28.252.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 23 Apr 2023 10:59:50 +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; Sun, 23 Apr 2023 10:59:50 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.165 From: Weitao Wang X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.163 To: , , , CC: , , Subject: [PATCH v3] UHCI:adjust zhaoxin UHCI controllers OverCurrent bit value Date: Sun, 23 Apr 2023 18:59:52 +0800 X-ASG-Orig-Subj: [PATCH v3] UHCI:adjust zhaoxin UHCI controllers OverCurrent bit value Message-ID: <20230423105952.4526-1-WeitaoWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.32.0 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: ZXSHMBX3.zhaoxin.com[10.28.252.165] X-Barracuda-Start-Time: 1682218791 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: 1541 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0002 1.0000 -2.0196 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.107798 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?1763778822045943707?= X-GMAIL-MSGID: =?utf-8?q?1763934887775849215?= OverCurrent condition is not standardized in the UHCI spec. Zhaoxin UHCI controllers report OverCurrent bit active off. In order to handle OverCurrent condition correctly, the uhci-hcd driver needs to be told to expect the active-off behavior. Suggested-by: Alan Stern Cc: stable@vger.kernel.org Signed-off-by: Weitao Wang Acked-by: Alan Stern --- v2->v3 - Change patch code style. drivers/usb/host/uhci-pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c index 3592f757fe05..7bd2fddde770 100644 --- a/drivers/usb/host/uhci-pci.c +++ b/drivers/usb/host/uhci-pci.c @@ -119,11 +119,13 @@ static int uhci_pci_init(struct usb_hcd *hcd) uhci->rh_numports = uhci_count_ports(hcd); - /* Intel controllers report the OverCurrent bit active on. - * VIA controllers report it active off, so we'll adjust the - * bit value. (It's not standardized in the UHCI spec.) + /* + * Intel controllers report the OverCurrent bit active on. VIA + * and ZHAOXIN controllers report it active off, so we'll adjust + * the bit value. (It's not standardized in the UHCI spec.) */ - if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA) + if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA || + to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_ZHAOXIN) uhci->oc_low = 1; /* HP's server management chip requires a longer port reset delay. */