Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp253261pxf; Thu, 8 Apr 2021 02:14:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynZLRZKX19oLbFm9aQIFNRyAmrKWPN3L6lb8LJ2DckVVleY31CzIHVBOx5XPrh1amf/qNu X-Received: by 2002:a17:90a:a395:: with SMTP id x21mr7241161pjp.95.1617873276204; Thu, 08 Apr 2021 02:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617873276; cv=none; d=google.com; s=arc-20160816; b=n92WQBy7Uq3Oq5yhVk4sEaNlisbDO0ZiVruCFSworvUqKYoetOYdL8rXv8D6Y1laLl mCNNymPEda/nxJ2fRE0pPEP99WwJdJUoNl2/tv5M7/uMjNaig1+RjjadaWPOIsutMt5w ru+3npAgR2cZP5pfgKANXosZegFenMlwOxh0K1gjkmZxgTRzibjrzUPGU0V4jiOLQWJj 3JGI3sfFUDyLAbLpcBHiO4iZRV2pG/93DSjNRIWyG+HqJPGkMIcD1bjmKQSA039minM8 hmy6nBQnmZlyAUYDu0GueWNCR2RsPMRPi8xacPYA++7iO9S8sJMAr2T8dpdboO8WPUnW 49PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=c+qC9QiCWx9/Y8cVTrFKxokEnWeG6SCbft8kywqeARE=; b=ptZfEweYhWWVc+S67iSq56GvgqCSqfqlz736G9PE89J+2nW5M602Wo4sMXbqujiwMO itpdw2IuTHK6sXHONp8H0Yqa6SJni8PB/8EX/bFnSGRspobmiPQQ+k6RmO4iEG4MUor8 ppUFTFZHH7Mgmzx+2pbBH4DvKgS5s5zt7J2MPnuxEoiAwcRGJjWhQ6dbrjnULO+PwRBc fOET6bB4uivS0uG+6WXdmj19Ch+xstazFKRhsxrrAxdM45pJDZswAheNuT61iM58FtSp IniutgIAvFhOvCCf3pq3ZWg1ezCP5a6291MabDjP1rIAfj43TUOgVqmHficIBvz4SCO+ 3T3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si25727719pgm.170.2021.04.08.02.14.24; Thu, 08 Apr 2021 02:14:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbhDHJMs (ORCPT + 99 others); Thu, 8 Apr 2021 05:12:48 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:16085 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbhDHJMl (ORCPT ); Thu, 8 Apr 2021 05:12:41 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FGFpc6fQ2z1BFyw; Thu, 8 Apr 2021 17:10:16 +0800 (CST) Received: from huawei.com (10.67.165.24) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Thu, 8 Apr 2021 17:12:21 +0800 From: Longfang Liu To: , , , CC: , , , , Subject: [PATCH] USB:ehci:fix ehci hardware problem Date: Thu, 8 Apr 2021 17:09:45 +0800 Message-ID: <1617872985-42735-4-git-send-email-liulongfang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1617872985-42735-1-git-send-email-liulongfang@huawei.com> References: <1617872985-42735-1-git-send-email-liulongfang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When rebooting the EHCI driver, ehci_shutdown() will be called. if the sbrn flag is 0, ehci_shutdown() will return directly. Kunpeng920's EHCI hardware does not define the SBRN register, which cause its value to default to 0. The sbrn flag being 0 will cause the EHCI interrupt signal to not be turned off after reboot. An interrupt that is not closed will cause an exception to the device sharing the interrupt. Currently, Kunpeng920's EHCI hardware has this problem. We hope to solve this problem by skipping reading the sbrn register value. On the EHCI hardware of the next-generation Kunpeng930, we will define this SBRN register in accordance with the controller standard. Signed-off-by: Longfang Liu --- drivers/usb/host/ehci-pci.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 3c3820a..738d773 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -47,6 +47,31 @@ static inline bool is_bypassed_id(struct pci_dev *pdev) return !!pci_match_id(bypass_pci_id_table, pdev); } +static const struct usb_sbrn_whitelist_entry { + unsigned short vendor; + unsigned short device; +} usb_sbrn_whitelist[] = { + /* STMICRO ConneXT has no sbrn register */ + {PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_USB_HOST}, + /* HUAWEI sbrn register is undefined */ + {PCI_VENDOR_ID_HUAWEI, 0xa239}, + {} +}; + +static bool usb_sbrn_whitelist_check(struct pci_dev *pdev) +{ + const struct usb_sbrn_whitelist_entry *entry; + unsigned short vendor = pdev->vendor; + unsigned short device = pdev->device; + + for (entry = usb_sbrn_whitelist; entry->vendor; entry++) { + if (vendor == entry->vendor && device == entry->device) + return true; + } + + return false; +} + /* * 0x84 is the offset of in/out threshold register, * and it is the same offset as the register of 'hostpc'. @@ -288,10 +313,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) } /* Serial Bus Release Number is at PCI 0x60 offset */ - if (pdev->vendor == PCI_VENDOR_ID_STMICRO - && pdev->device == PCI_DEVICE_ID_STMICRO_USB_HOST) - ; /* ConneXT has no sbrn register */ - else + if (!usb_sbrn_whitelist_check(pdev)) pci_read_config_byte(pdev, 0x60, &ehci->sbrn); /* Keep this around for a while just in case some EHCI -- 2.8.1