Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757961AbdHYSCg (ORCPT ); Fri, 25 Aug 2017 14:02:36 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42386 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756731AbdHYSCd (ORCPT ); Fri, 25 Aug 2017 14:02:33 -0400 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 Cc: timur@codeaurora.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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3084 Lines: 101 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; } -- Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.