From patchwork Fri Aug 25 18:02:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Wallis X-Patchwork-Id: 9922657 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 DFFD6602BD for ; Fri, 25 Aug 2017 18:03:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE27528437 for ; Fri, 25 Aug 2017 18:03:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2A362843B; Fri, 25 Aug 2017 18:03:01 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable 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 5A40928437 for ; Fri, 25 Aug 2017 18:03:01 +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=0oFXtuvtVJnTtzRFW5AfTeUv05pPqb0fv4j+l11aiwY=; b=DYt WgWIpYeTc+blZO4698Y4nFk0kxuJoSAB5ccExK9SOs1wy8pOTcZToOnPuengUx+xRmjPhNEydMzMD 0az+Zj5Xl8DTuIw4Unsm8/yczTz+tW301Sjl48iZQfzxKa8b81wZ48emuRBle+4WumOeEgR2Fs2u1 MCeeiJ6puEK1MQiI+lOApUUvc0XQ7bvCkLQfvtT8wgnX4+s/UKrWR/koMi5JCKBUhQHh6tCyYffrY A/pwwwlMV9JLT17uVvQWXJQ0ISWo9/mwaLiq5XeB7EXmO5x2P3FkFRg/nrK0TH5wI/1GwvI4WD4Ec V2h60k6I+VxEt/Z25cfLfT1yPh0ahag==; 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 1dlIwb-0001Yl-Qz; Fri, 25 Aug 2017 18:02:57 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dlIwX-0001NR-2D for linux-arm-kernel@lists.infradead.org; Fri, 25 Aug 2017 18:02:55 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1C21860722; Fri, 25 Aug 2017 18:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503684152; bh=mZZBYg3k8C5poIeBLcJ7oR7enLbytGGF3l1YEMZdiWc=; h=From:To:Cc:Subject:Date:From; b=P0H+mmDC3+VPH8dRirN024zKRBx2Bxqp2M2yNN0HmlkKcPceh18xYe9GpTlGUI2Jj ffWLpP0W4Uzjh/Sbo9rDDWn9b+aY43jbqW+BpbgS1G3Y0Iakukv0wcY68qPizxmAeh w9RoSpMSWuRU6KV3GZO6KCkgrKS1mz3rzj/dgci0= 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 6D29860708; Fri, 25 Aug 2017 18:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503684151; bh=mZZBYg3k8C5poIeBLcJ7oR7enLbytGGF3l1YEMZdiWc=; h=From:To:Cc:Subject:Date:From; b=P9XHxARJpM+XFZUSvZvcK9oHPgWVlm2mHSM4PyD89YdC2gJvy1cPimS17Lut4wPAh D/0wyINscBsO41J/R1Hti47TPjA/xcYOiJnFAKLE9SnMiDsS/bfHFZK2+HbBtQgsal SBHGLks7PyenvBAd2CM9P0sVjU2U1RBhpTnu+7dA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6D29860708 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, Felipe Balbi , Greg Kroah-Hartman , Arnd Bergmann , Adam Wallis , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] usb: dwc3: Initialize DMA ops/mask for xhci-hcd Date: Fri, 25 Aug 2017 14:02:15 -0400 Message-Id: <1503684135-24207-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-20170825_110253_317822_87464ACC X-CRM114-Status: GOOD ( 14.14 ) 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 The dma ops from the parent DWC device are not getting passed to the child xhci-hcd device. This patch makes use of platform_device_register_full to set the DMA ops. For the DT/OF case, dma_ops were still null after the the device register, so of_dma_configure is called in only the OF case. Signed-off-by: Adam Wallis --- drivers/usb/dwc3/host.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 76f0b0d..662e9e2 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -16,6 +16,7 @@ */ #include +#include #include "core.h" @@ -56,6 +57,7 @@ int dwc3_host_init(struct dwc3 *dwc) { struct property_entry props[3]; struct platform_device *xhci; + struct platform_device_info dwc_plat_info = {}; int ret, irq; struct resource *res; struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); @@ -79,22 +81,22 @@ int dwc3_host_init(struct dwc3 *dwc) dwc->xhci_resources[1].flags = res->flags; dwc->xhci_resources[1].name = res->name; - xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); - if (!xhci) { - dev_err(dwc->dev, "couldn't allocate xHCI device\n"); - return -ENOMEM; - } + dwc_plat_info.name = "xhci-hcd"; + dwc_plat_info.parent = dwc->dev; + dwc_plat_info.res = dwc->xhci_resources; + dwc_plat_info.num_res = DWC3_XHCI_RESOURCES_NUM; + dwc_plat_info.fwnode = dwc->dev->fwnode; + dwc_plat_info.dma_mask = *dwc->dev->dma_mask; - xhci->dev.parent = dwc->dev; + xhci = platform_device_register_full(&dwc_plat_info); + if (IS_ERR(xhci)) { + dev_err(dwc->dev, "failed to register xHCI device\n"); + return PTR_ERR(xhci); + } dwc->xhci = xhci; - - ret = platform_device_add_resources(xhci, dwc->xhci_resources, - DWC3_XHCI_RESOURCES_NUM); - if (ret) { - dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); - goto err1; - } + if (dwc->dev->of_node) + of_dma_configure(&xhci->dev, dwc->dev->of_node); memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); @@ -117,7 +119,7 @@ int dwc3_host_init(struct dwc3 *dwc) ret = platform_device_add_properties(xhci, props); if (ret) { dev_err(dwc->dev, "failed to add properties to xHCI\n"); - goto err1; + goto err; } } @@ -126,19 +128,12 @@ int dwc3_host_init(struct dwc3 *dwc) phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy", dev_name(dwc->dev)); - ret = platform_device_add(xhci); - if (ret) { - dev_err(dwc->dev, "failed to register xHCI device\n"); - goto err2; - } - return 0; -err2: +err: phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", dev_name(dwc->dev)); phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", dev_name(dwc->dev)); -err1: platform_device_put(xhci); return ret; }