From patchwork Fri Apr 1 07:58:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 8721621 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0099C9F38C for ; Fri, 1 Apr 2016 08:00:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56A97203B8 for ; Fri, 1 Apr 2016 08:00:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB798203A4 for ; Fri, 1 Apr 2016 08:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758444AbcDAIA3 (ORCPT ); Fri, 1 Apr 2016 04:00:29 -0400 Received: from mga03.intel.com ([134.134.136.65]:54532 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753293AbcDAIA1 (ORCPT ); Fri, 1 Apr 2016 04:00:27 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 01 Apr 2016 01:00:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,426,1455004800"; d="asc'?scan'208";a="936092079" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.36]) by fmsmga001.fm.intel.com with ESMTP; 01 Apr 2016 01:00:23 -0700 From: Felipe Balbi To: Grygorii Strashko , "Thang Q. Nguyen" Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm@lists.infradead.org, Arnd Bergmann , "Karicheri\, Muralidharan" , Peter Ujfalusi , Phong Vo , Loc Ho , patches , Santosh Shilimkar , "Ben Dooks \(embedded platforms\)" Subject: Re: [PATCH v3 2/2] usb:dwc3: pass arch data to xhci-hcd child In-Reply-To: <56FD3D2F.8070501@ti.com> References: <1457594332-7490-1-git-send-email-tqnguyen@apm.com> <1457594332-7490-3-git-send-email-tqnguyen@apm.com> <87mvpgi02f.fsf@intel.com> <56FBDA0D.4030507@ti.com> <87egashxz8.fsf@intel.com> <87k2kjgjjf.fsf@intel.com> <56FD3D2F.8070501@ti.com> User-Agent: Notmuch/0.21+96~g9bbc54b (http://notmuchmail.org) Emacs/25.0.90.3 (x86_64-pc-linux-gnu) Date: Fri, 01 Apr 2016 10:58:31 +0300 Message-ID: <871t6pahg8.fsf@intel.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, Grygorii Strashko writes: > On 03/31/2016 11:04 AM, Felipe Balbi wrote: >> "Thang Q. Nguyen" writes: >>> [ text/plain ] >>> Thanks Grygorii for information. >>> I checked but do not see dma_init_dev_from_parent is used in >>> linux-next repository. Can you give me more information for what >>> branch I can checkout to use it for USB DWC3? >> >> dma_init_dev_from_parent() is still a proposal ;-) >> > > Felipe, > > After some experiments I came up with below fix (not common, but fixes USB > case on keystone 2). if you agree with proposed fix I'll send proper > patches to fix usb_add_gadget_udc_release() and dwc3_host_init() in the same > way. > > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > index c679f63..3fe1c65 100644 > --- a/drivers/usb/dwc3/host.c > +++ b/drivers/usb/dwc3/host.c > @@ -17,6 +17,7 @@ > > #include > #include > +#include > > #include "core.h" > > @@ -35,8 +36,6 @@ int dwc3_host_init(struct dwc3 *dwc) > dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); > > xhci->dev.parent = dwc->dev; > - xhci->dev.dma_mask = dwc->dev->dma_mask; > - xhci->dev.dma_parms = dwc->dev->dma_parms; > > dwc->xhci = xhci; > > @@ -62,6 +61,12 @@ int dwc3_host_init(struct dwc3 *dwc) > phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy", > dev_name(&xhci->dev)); > > + if (!dwc->dev->of_node) { > + xhci->dev.dma_mask = dwc->dev->dma_mask; > + xhci->dev.dma_parms = dwc->dev->dma_parms; > + } else > + of_dma_configure(&xhci->dev, dwc->dev->of_node); if of_dma_configure() does what you want, why don't you just stick it in dwc3-keystone.c and let the driver continue to copy things for now ? Something like below, perhaps ? diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 2be268d2423d..a4bd7f16090f 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -39,8 +39,6 @@ #define USBSS_IRQ_COREIRQ_EN BIT(0) #define USBSS_IRQ_COREIRQ_CLR BIT(0) -static u64 kdwc3_dma_mask; - struct dwc3_keystone { struct device *dev; struct clk *clk; @@ -108,9 +106,7 @@ static int kdwc3_probe(struct platform_device *pdev) if (IS_ERR(kdwc->usbss)) return PTR_ERR(kdwc->usbss); - kdwc3_dma_mask = dma_get_mask(dev); - dev->dma_mask = &kdwc3_dma_mask; - + of_dma_configure(&kdwc->dev, node); kdwc->clk = devm_clk_get(kdwc->dev, "usb"); error = clk_prepare_enable(kdwc->clk);