From patchwork Mon Jun 29 16:18:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 11631771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 943AC138C for ; Mon, 29 Jun 2020 19:34:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87CD120702 for ; Mon, 29 Jun 2020 19:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733024AbgF2Ter (ORCPT ); Mon, 29 Jun 2020 15:34:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:36628 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733146AbgF2Tb0 (ORCPT ); Mon, 29 Jun 2020 15:31:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 10D73AE78; Mon, 29 Jun 2020 16:19:00 +0000 (UTC) From: Nicolas Saenz Julienne To: f.fainelli@gmail.com, gregkh@linuxfoundation.org, robh@kernel.org, wahrenst@gmx.net, p.zabel@pengutronix.de, andy.shevchenko@gmail.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, tim.gover@raspberrypi.org, linux-pci@vger.kernel.org, helgaas@kernel.org, mathias.nyman@linux.intel.com, lorenzo.pieralisi@arm.com, Nicolas Saenz Julienne Subject: [PATCH v5 7/9] usb: host: pci-quirks: Bypass xHCI quirks for Raspberry Pi 4 Date: Mon, 29 Jun 2020 18:18:43 +0200 Message-Id: <20200629161845.6021-8-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200629161845.6021-1-nsaenzjulienne@suse.de> References: <20200629161845.6021-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The board doesn't need the quirks to be run, and takes care of its own initialization through a reset controller device. So let's bypass them. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Florian Fainelli --- Changes since v2: - Correct reference counting on parent device node Changes since v1: - Correct typos drivers/usb/host/pci-quirks.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 358015328391..977d0b6d7577 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "pci-quirks.h" #include "xhci-ext-caps.h" @@ -1244,11 +1245,27 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) static void quirk_usb_early_handoff(struct pci_dev *pdev) { + struct device_node *parent; + bool is_rpi; + /* Skip Netlogic mips SoC's internal PCI USB controller. * This device does not need/support EHCI/OHCI handoff */ if (pdev->vendor == 0x184e) /* vendor Netlogic */ return; + + /* + * Bypass the Raspberry Pi 4 controller xHCI controller, things are + * taken care of by the board's co-processor. + */ + if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { + parent = of_get_parent(pdev->bus->dev.of_node); + is_rpi = of_device_is_compatible(parent, "brcm,bcm2711-pcie"); + of_node_put(parent); + if (is_rpi) + return; + } + if (pdev->class != PCI_CLASS_SERIAL_USB_UHCI && pdev->class != PCI_CLASS_SERIAL_USB_OHCI && pdev->class != PCI_CLASS_SERIAL_USB_EHCI &&