From patchwork Thu Aug 31 17:54:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Wallis X-Patchwork-Id: 9932673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F3986016C for ; Thu, 31 Aug 2017 17:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4093B28A40 for ; Thu, 31 Aug 2017 17:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 357EE28A46; Thu, 31 Aug 2017 17:55:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9D6B28A49 for ; Thu, 31 Aug 2017 17:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=sBh7HXQhUIvLygwicBvobIVwXaPYZA49dPJOYa3IU6c=; b=Bl4 xvlt2qYlDrj0ZWiJsHvUJSYFzJG2QX82++3aOAxVXz6Wqx+17O82wK0nHh6eK3pqWxGESZR6KZG78 9ldsV4wnQk/g+rLn4sF6Esg+mmB6WoyDQEw9/cWcjN8me4//oR4x4XgcPODyhhma3uAuSNWFgD28T wMVJhMq8sVMuII9nbAzs38LKVBbwBFQz5B8YjJH1Z1pdDMAIV/OHjkB/Ex/ymdEHEAIBdSJYCGXxN 1e0iFMW246U7CNpDlQLnUpJ6Nlvm83VqPDkf9A9sVpneimxCyn27pjsQ5L/5KZ5kNF+m4rpgTI8S8 C9LR0xbIs7xZ4Ia6hJ+BbyMaBRRc/Ew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dnTgI-0001l2-Ud; Thu, 31 Aug 2017 17:55:06 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dnTgC-00010V-Ed for linux-arm-kernel@lists.infradead.org; Thu, 31 Aug 2017 17:55:03 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 96A9160908; Thu, 31 Aug 2017 17:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1504202079; bh=tCfJ4Yse9MLVAQA4BHf9PmlXNYsaesyBDT7cEiAig00=; h=From:To:Cc:Subject:Date:From; b=YmKIw+h/gxOxHQRThcutaXhlI4Jxr1+VVoTn9e2ybm6p5vppLxWV6UZSjYfrWMwZQ XbtsrBwsCI1I1rJLQLTWI9Sd97UpOAd7a3znLPDdpo8hcCYZY5hc3tlu0OcwiGe5FK obM2Ir5i4xMOUxXcwyR1CaS8ajGdbS7wJs2jhSZs= Received: from chromaggus.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: awallis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 794A8607A0; Thu, 31 Aug 2017 17:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1504202078; bh=tCfJ4Yse9MLVAQA4BHf9PmlXNYsaesyBDT7cEiAig00=; h=From:To:Cc:Subject:Date:From; b=GzIqN1zsF5+TP9HG183YaXZoXNljChP9xs8ftFWWIXxJGCNS6+2lfAbys+TWB4P2w QMZ6B7NZF0i1jzsnsT7X7u6eau21MrvrtR4l0mzDBuCP1IA+P0qswyszOhudLLa3+C e/5KMU01ssMxVGNUnrhKiodXwlRwUOUAW53bDnAM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 794A8607A0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=awallis@codeaurora.org From: Adam Wallis To: linux-arm-kernel@lists.infradead.org, Mathias Nyman , Greg Kroah-Hartman , Arnd Bergmann , Adam Wallis , linux-usb@vger.kernel.org, balbi@kernel.org, vivek.gautam@codeaurora.org, jackp@codeaurora.org, stable@vger.kernel.org Subject: [PATCH] usb: host: xhci-plat: allow sysdev to inherit from ACPI Date: Thu, 31 Aug 2017 13:54:17 -0400 Message-Id: <1504202057-23634-1-git-send-email-awallis@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170831_105500_649184_FB30EAAC X-CRM114-Status: GOOD ( 13.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: timur@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, xhci_plat is not set up properly when the parent device is an ACPI node. The conditions that xhci_plat_probe should satisfy are 1. xhci_plat comes from firmware 2. xhci_plat is child of a device from firmware (dwc3-plat) 3. xhci_plat is grandchild of a pci device (dwc3-pci) Case 2 is covered when the child is an OF node (by checking sysdev->parent->of_node), however, an ACPI parent will return NULL in the of_node check and will thus not result in sysdev being set to sysdev->parent [ 17.591549] xhci-hcd: probe of xhci-hcd.6.auto failed with error -5 This change adds a check for ACPI to completely allow for condition 2. This is done by first checking if the parent node is of type ACPI (e.g., dwc3-plat) and set sysdev to sysdev->parent if either of the two following conditions are met: 1: If fwnode is empty (in the case that platform_device_add_properties was not called on the allocated platform device) 2: fwnode exists but is not of type ACPI (this would happen if platform_device_add_properties was called on the allocated device. Instead of type FWNODE_ACPI, you would end up with FWNODE_PDATA) Cc: stable@vger.kernel.org # 4.12.x Signed-off-by: Adam Wallis --- drivers/usb/host/xhci-plat.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c04144b..c4ac59a 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -163,6 +163,7 @@ static int xhci_plat_probe(struct platform_device *pdev) const struct of_device_id *match; const struct hc_driver *driver; struct device *sysdev; + struct device *parent; struct xhci_hcd *xhci; struct resource *res; struct usb_hcd *hcd; @@ -187,12 +188,17 @@ static int xhci_plat_probe(struct platform_device *pdev) * 3. xhci_plat is grandchild of a pci device (dwc3-pci) */ sysdev = &pdev->dev; - if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node) - sysdev = sysdev->parent; + parent = sysdev->parent; + if (parent && !sysdev->of_node && parent->of_node) + sysdev = parent; + else if (parent && is_acpi_device_node(parent->fwnode) && + (!sysdev->fwnode || + (sysdev->fwnode && !is_acpi_device_node(sysdev->fwnode)))) + sysdev = parent; #ifdef CONFIG_PCI - else if (sysdev->parent && sysdev->parent->parent && - sysdev->parent->parent->bus == &pci_bus_type) - sysdev = sysdev->parent->parent; + else if (parent && parent->parent && + parent->parent->bus == &pci_bus_type) + sysdev = parent->parent; #endif /* Try to set 64-bit DMA first */