Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758845AbcDAIA3 (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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,426,1455004800"; d="asc'?scan'208";a="936092079" 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 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3760 Lines: 113 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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? >>=20 >> dma_init_dev_from_parent() is still a proposal ;-) >>=20 > > 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 s= ame > 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 @@ >=20=20 > #include > #include > +#include >=20=20 > #include "core.h" >=20=20 > @@ -35,8 +36,6 @@ int dwc3_host_init(struct dwc3 *dwc) > dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); >=20=20 > xhci->dev.parent =3D dwc->dev; > - xhci->dev.dma_mask =3D dwc->dev->dma_mask; > - xhci->dev.dma_parms =3D dwc->dev->dma_parms; >=20=20 > dwc->xhci =3D xhci; >=20=20 > @@ -62,6 +61,12 @@ int dwc3_host_init(struct dwc3 *dwc) > phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy", > dev_name(&xhci->dev)); >=20=20 > + if (!dwc->dev->of_node) { > + xhci->dev.dma_mask =3D dwc->dev->dma_mask; > + xhci->dev.dma_parms =3D dwc->dev->dma_parms; > + } else=20 > + 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-keyst= one.c index 2be268d2423d..a4bd7f16090f 100644 =2D-- 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) =20 =2Dstatic u64 kdwc3_dma_mask; =2D 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); =20 =2D kdwc3_dma_mask =3D dma_get_mask(dev); =2D dev->dma_mask =3D &kdwc3_dma_mask; =2D + of_dma_configure(&kdwc->dev, node); kdwc->clk =3D devm_clk_get(kdwc->dev, "usb"); =20 error =3D clk_prepare_enable(kdwc->clk); =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW/iooAAoJEIaOsuA1yqRETZYQALZMFoH0UCrSp3Gf8r+1i2kK NmBGHQ7j5FV4hrzoiuII5aRb4L/X/sZx8Uxblm1/9TcWflJ0X6fKe5yd6O3ug34h M9DZ7NwiH5yE1fQTCoLX5Nh7rsyxClbOpt0uRzQHAmaUWxo8sIcCqvPEdOa0/WkN HqtdvleWfuaO3kAQjHmrE/7dhYDKhuLKRKgzrjhzFYJa7iHuCmrroaZRkAJ+BCYw 2g2TFYBC9hnr+uN3mUrgf4wpzbAwfiJb711UyTdepdbsYJ4wzgVMBmGE6fDzrpEg dCJwXPDCrPc768jajlYKMc/1c8IIEQUusmX84BgFsmNz9oQir+26DO0Koq12veop zl3QoNkofeQ4CS8bq1X2Qo1mg+RGx2ITl+qVSlr2qIXOLxTHvcOz8vMebACot4Vx SLE37o+Ft9P6WQJM1gmlNK+gBhOPlZbQD93sKT3AabmDlru0BLf1ocYLkD+iKMFi R9tRZysVEVeCJIfyFSiO5eeRsGwMI9UBpyhUBK5H0YJtEUJpNUUSbbKjIAVBYxqQ u5/ENLaoyoeu9XAA3RNG/STx5DRlIJJgluMxz+agWIXSuY7TukKUC/IkjsfdB8cg Rnr/nhCaX/0oaHKnWQXDFt2d/qPjoMq7esSc1kUHJu76032VGK6TcBAmrYLbQZ84 h73mZHjrICV3v3q3CGlh =TAE/ -----END PGP SIGNATURE----- --=-=-=--