From patchwork Tue Sep 5 15:07:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Wallis X-Patchwork-Id: 9939201 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 C01DB604D3 for ; Tue, 5 Sep 2017 15:08:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0E25289A3 for ; Tue, 5 Sep 2017 15:08:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5AC1289A9; Tue, 5 Sep 2017 15:08:42 +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 0CAF0289A3 for ; Tue, 5 Sep 2017 15:08:42 +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=8f3RUeanK5TYlPkjDCzDr1hdUWYya+bOc/6LQ9A0vdw=; b=LRh xUp1zofSvhf17hKzpiBBXFVsgCDcC36NzTdyqRqyFqckZ7voKwLJrp701EXaE43EWlHUzP39yfuAE bBgYGPFUqJRZfbucL1+EqGi9fcDNxs5HxrIzrewnDuIL6w64xp1n3X78U+HLrSr8k4WkcbHvpgbaR UMzzPY7ya4yHIYeGeTWdXI+GbLoVEKN+Deuj3+oUeA41SBwI7nmZokG4L1X4sA+XME3R8qE3gIAwO TKI+DcLOAB8VFwV2znxXlqG/LJ8orYxRsgUXb8b8K3fbvp5iVe9zzOCgd/mYMPQUZaxDbR+NQrHjT c7xuJSFMpc9g/Zqoj2iCHPDwH0l5WIw==; 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 1dpFSv-0000yh-GF; Tue, 05 Sep 2017 15:08:37 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dpFSq-0000ux-L6 for linux-arm-kernel@lists.infradead.org; Tue, 05 Sep 2017 15:08:34 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2CB4360915; Tue, 5 Sep 2017 15:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1504624091; bh=pwVrPa4YNCHFTjvg0ih9GvGcHf2TPCxy+GNed5ql5AQ=; h=From:To:Cc:Subject:Date:From; b=K4gaWhKKv3m1a1G7I9rIzAFzIVMjcUEq/SnqyX55touv995tjs3+zTerymO5QHmqJ x0gflM+otFDpHTR2jVKqtXenSOYyevmtwhCCuAdEHzRTIJiGTZ147Pvb/GWH9HKnmJ +aB0QItqVDuwSilkYbywwl2vWZ7tUGYwlAiQvqfs= 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 0444960766; Tue, 5 Sep 2017 15:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1504624087; bh=pwVrPa4YNCHFTjvg0ih9GvGcHf2TPCxy+GNed5ql5AQ=; h=From:To:Cc:Subject:Date:From; b=BSaQP3vidhVkVKJ5m30w0ev2/tW5iCKYmxYkNRttWVNiTnEXfinJ4kgNiuM2gnLil +Su//OiIJefBgVW4MMsS6aFlzk+ndYUrL8Rv/XKYUSI0FRvBsn19/BITwkwXD7IO5F 9Zsv8Ds9njFKnQkBNNkUH0dmtN+Zlp2D+PjnAQLY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0444960766 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 , Vivek Gautam , linux-usb@vger.kernel.org, balbi@kernel.org, jackp@codeaurora.org, tqnguyen@apm.com Subject: [PATCH V3] usb: host: xhci-plat: allow sysdev to inherit from ACPI Date: Tue, 5 Sep 2017 11:07:39 -0400 Message-Id: <1504624059-2004-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-20170905_080832_819756_C7B0C714 X-CRM114-Status: GOOD ( 15.49 ) 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 Commit 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA configuration") updated the method determining DMA for XHCI from sysdev. However, this patch broke the ability to enumerate the FWNODE from parent ACPI devices from the child plat XHCI device. 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 Cc: stable@vger.kernel.org #4.13.x Fixes: 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA configuration") Signed-off-by: Adam Wallis --- Changes in v3: Add "fixes" to commit message per greg k-h Changes in v2: Incorporate the simplified fwnode check as suggested by Mathias drivers/usb/host/xhci-plat.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c04144b..2087407 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -186,14 +186,18 @@ static int xhci_plat_probe(struct platform_device *pdev) * 2. xhci_plat is child of a device from firmware (dwc3-plat) * 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; + for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) { + if (is_of_node(sysdev->fwnode) || + is_acpi_device_node(sysdev->fwnode)) + break; #ifdef CONFIG_PCI - else if (sysdev->parent && sysdev->parent->parent && - sysdev->parent->parent->bus == &pci_bus_type) - sysdev = sysdev->parent->parent; + else if (sysdev->bus == &pci_bus_type) + break; #endif + } + + if (!sysdev) + sysdev = &pdev->dev; /* Try to set 64-bit DMA first */ if (WARN_ON(!sysdev->dma_mask))