From patchwork Wed Jun 8 08:18:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 69587 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2367999qgf; Wed, 8 Jun 2016 01:19:02 -0700 (PDT) X-Received: by 10.98.21.82 with SMTP id 79mr4581425pfv.92.1465373942476; Wed, 08 Jun 2016 01:19:02 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y72si148866pff.29.2016.06.08.01.19.02; Wed, 08 Jun 2016 01:19:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756273AbcFHIS7 (ORCPT + 31 others); Wed, 8 Jun 2016 04:18:59 -0400 Received: from mail-yw0-f178.google.com ([209.85.161.178]:32998 "EHLO mail-yw0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756237AbcFHIS4 (ORCPT ); Wed, 8 Jun 2016 04:18:56 -0400 Received: by mail-yw0-f178.google.com with SMTP id g20so796553ywb.0 for ; Wed, 08 Jun 2016 01:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=C6ChUjFVgJ8LY9AkmhhMtPBHR5r6O1CqW6T6+tV1Zuo=; b=j+YsoOTG7iCyvO3d7KKL5FfjSCi4OTwxdGzk+0w6HCWfaZuebCwXrOjrJYBo8mYts7 6MX1NyBcNEBRz+/xxmjWdIR6QexHj/rNMPuv8flRYh2CCmBlCUI5n274WGpog4EPOIum 9C2tm5OOgodYxCXIMlV7jGFMYyYLz47To+wy8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=C6ChUjFVgJ8LY9AkmhhMtPBHR5r6O1CqW6T6+tV1Zuo=; b=cXvzvJs3qQHz6IACtEKOPyYbJoUfzcDoNh/JzsNPxUq5dFU8U9mkvhHT5Z5/I/8Mbx skT0q3MnKAHhpQRBbaiPNeVcKvYumdQMFVkfybGv9C42OeEbvxIGxeFG4HMoz5zvHAD5 hHdAo1piIRHvJy/rjMB6P+LgvZqNcQg9/CAUUir9atnakn3SbnMpcGF7kSejyCg1KYFo Uq8H6Gl3hw0pKeW8bpeZf6Fgo2IU6HC6lkoO22nSarFgMnd32Fr0zQ5tDK8BOcfJe5Ry yLX4uS+bFkCxLBBlUyzMhmv/oN5J1zrZBZi71M3CJAe8at8hgcokc+ZqAzgtyPI4bj3V 6JQQ== X-Gm-Message-State: ALyK8tL4A7mTubsRqRB6Gb+pMhFR5f0LGc/09Iz6NLxxZ85BOZb5AHQBap9Nf36d8SYl2CBGtM08AvfPrb+gMfmq X-Received: by 10.37.94.135 with SMTP id s129mr1903566ybb.98.1465373935699; Wed, 08 Jun 2016 01:18:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.35.1 with HTTP; Wed, 8 Jun 2016 01:18:55 -0700 (PDT) In-Reply-To: <8760tmcqir.fsf@linux.intel.com> References: <3f7a77848164a753b8918925f69aa0fd6c985850.1465192322.git.baolin.wang@linaro.org> <8760tmcqir.fsf@linux.intel.com> From: Baolin Wang Date: Wed, 8 Jun 2016 16:18:55 +0800 Message-ID: Subject: Re: [PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device To: Felipe Balbi Cc: Greg KH , Mark Brown , USB , LKML Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 6 June 2016 at 22:59, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if >> it did not call 'arch_setup_dma_ops' at device creation time, that will >> cause failure when setting the dma mask for device. >> >> Thus this patch set the xhci device dma_ops from the parent device if >> the xhci device dma_ops is 'dummy_dma_ops'. >> >> Changes since v1: >> - Add CONFIG_ARM64 macro. >> >> Signed-off-by: Baolin Wang >> --- >> drivers/usb/dwc3/host.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c >> index c679f63..edb666d 100644 >> --- a/drivers/usb/dwc3/host.c >> +++ b/drivers/usb/dwc3/host.c >> @@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc) >> return -ENOMEM; >> } >> >> +#ifdef CONFIG_ARM64 >> + if (get_dma_ops(&xhci->dev) == get_dma_ops(NULL)) >> + xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev); >> +#endif > > I don't like the ifdef and also don't like that this is done in dwc3 > itself. Seems like we need something like this done from the > platform_bus core. I've sent one patch to fix this issue in platform_bus core, and Robin explained "DMA-capable devices are real hardware, therefore don't spring out of thin air without being described in DT or ACPI." But the problem is here, how can we handle this issue to make the host work well? What about below modification? Thanks. -- Baolin.wang Best Regards diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index c679f63..f7c58f9 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -17,6 +17,7 @@ #include #include +#include #include "core.h" @@ -37,6 +38,7 @@ int dwc3_host_init(struct dwc3 *dwc) xhci->dev.parent = dwc->dev; xhci->dev.dma_mask = dwc->dev->dma_mask; xhci->dev.dma_parms = dwc->dev->dma_parms; + of_dma_configure(&xhci->dev, dwc->dev->of_node); dwc->xhci = xhci;