From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967247AbdAKOUR (ORCPT ); Wed, 11 Jan 2017 09:20:17 -0500 Received: from mga04.intel.com ([192.55.52.120]:5206 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934475AbdAKOUP (ORCPT ); Wed, 11 Jan 2017 09:20:15 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="212144150" Subject: Re: [PATCH v5 4/6] usb: xhci: use bus->sysdev for DMA configuration To: Sriram Dash , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org References: <1479383028-27701-1-git-send-email-sriram.dash@nxp.com> <1479383028-27701-5-git-send-email-sriram.dash@nxp.com> Cc: mathias.nyman@intel.com, gregkh@linuxfoundation.org, suresh.gupta@nxp.com, felipe.balbi@linux.intel.com, stern@rowland.harvard.edu, pku.leo@gmail.com, Arnd Bergmann From: Mathias Nyman Message-ID: <58763F69.6040807@linux.intel.com> Date: Wed, 11 Jan 2017 16:21:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1479383028-27701-5-git-send-email-sriram.dash@nxp.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17.11.2016 13:43, Sriram Dash wrote: > From: Arnd Bergmann > > For xhci-hcd platform device, all the DMA parameters are not > configured properly, notably dma ops for dwc3 devices. So, set > the dma for xhci from sysdev. sysdev is pointing to device that > is known to the system firmware or hardware. > > Signed-off-by: Arnd Bergmann > Signed-off-by: Sriram Dash > Tested-by: Baolin Wang > --- ... > + /* > + * sysdev must point to a device that is known to the system firmware > + * or PCI hardware. We handle these three cases here: > + * 1. xhci_plat comes from firmware > + * 2. xhci_plat is child of a device from firmware (dwc3-plat) > + * 3. xhci_plat is grandchild of a pci device (dwc3-pci) > + */ > + sysdev = &pdev->dev; > + if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node) > + sysdev = sysdev->parent; > +#ifdef CONFIG_PCI > + else if (sysdev->parent && sysdev->parent->parent && > + sysdev->parent->parent->bus == &pci_bus_type) > + sysdev = sysdev->parent->parent; > +#endif > + Not maybe the the ideal situation here, and looks really tailored to make PCI dwc3 controllers with xhci support work. Was there some reason child devices can't automatically inherit the dma mask from the parents, forcing us to dig it from grandparents? Anyway, looks like the dwc3 part is already in 4.10-rc, If Greg and Alan want to take this series that's fine by me I haven't tested that it won't break anything on PCI XHCI controllers though -Mathias