From patchwork Wed Sep 21 11:43:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Dash X-Patchwork-Id: 9343363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9D7C607D4 for ; Wed, 21 Sep 2016 11:46:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 987922A3FD for ; Wed, 21 Sep 2016 11:46:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2142A40B; Wed, 21 Sep 2016 11:46:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE8202A3FD for ; Wed, 21 Sep 2016 11:46:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmfwz-0004ot-CI; Wed, 21 Sep 2016 11:44:29 +0000 Received: from mail-ve1eur01on0064.outbound.protection.outlook.com ([104.47.1.64] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmfwu-0004nW-BP for linux-arm-kernel@lists.infradead.org; Wed, 21 Sep 2016 11:44:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=f4A22GXEU7nA4S1xejeQ5Nnra5LTKuaUta4GOFOvdng=; b=GvfUSqx7MiucEBccs1g/iKpIIBNhLn4UAI0jV1w4ebhdqX/xFE4DVNUEc4tBFcQX3cv7npynrhI0abeu8NW9dTCRGdt4dzpNotgdhutH5t2n5Zi6UuO9k+Fr6RbNmew0DehryFA4qmEQl8Md+4Jyj+bAaOu90RNvcllkzOQTM+s= Received: from DB5PR0401MB1925.eurprd04.prod.outlook.com (10.166.10.148) by HE1PR0401MB2634.eurprd04.prod.outlook.com (10.168.148.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.2; Wed, 21 Sep 2016 11:44:00 +0000 Received: from DB5PR0401MB1925.eurprd04.prod.outlook.com ([10.166.10.148]) by DB5PR0401MB1925.eurprd04.prod.outlook.com ([10.166.10.148]) with mapi id 15.01.0639.005; Wed, 21 Sep 2016 11:43:59 +0000 From: Sriram Dash To: Arnd Bergmann Subject: RE: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Thread-Topic: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Thread-Index: AQHRnyfo8hAvuSqBeEa9c0v53Aihx5+byEYAgAAgqICAAWeLAIAAixwAgAADb4CAABurgIAAA/OAgAANzoCAAA2DgIAABMCAgAAChwCAACDQAIAAEMYAgACfpQCAAIBDAIAAAioAgAAA7ACAxohLAIAA0VKAgADBlYCABEgOgIAA+lqAgABD5ICAAU3OgIAAJbAAgAAa1ICAAFPSAIAVtPJQgAAKvACAAAI6QA== Date: Wed, 21 Sep 2016 11:43:59 +0000 Message-ID: References: <3189648.KnWLgq0lTY@wuerfel> <3596831.dckG5peiyF@wuerfel> In-Reply-To: <3596831.dckG5peiyF@wuerfel> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sriram.dash@nxp.com; x-originating-ip: [192.88.169.1] x-ms-office365-filtering-correlation-id: 968b5db9-7c86-4da8-70f7-08d3e21493da x-microsoft-exchange-diagnostics: 1; HE1PR0401MB2634; 6:B9rQyAGjq9H5ODAuavWi+cngIAlIbPsbF3pq94KX4Vwfns5e40Nqlp7Kwt5QQjVkY0nQ0mmtOJ1t5/TYgmctwSwxfzpOSKFnUJtI/2yW66GuSyRCq0OC2vbcYFYTRe35DET+figCveovZB1/Nf5ZvhKSXP2ejDokVHyzIFNggFlKTfuh9hB9fB8fd14RVJxNRQhYxGm+NY/JFUck5KJma26D7KI9kiRkTSqwnIA1QKQd5+W66W5PCfosN06iK+y6ls8qU8EBAM4l9uKDbnoe8pzE1N5OXuVnfTiR3pSYPsHxVjnpcGgKZicfaWkdaY1JZyrDSxwlXfbSYpIzFG2gaw==; 5:zEgyc9qNPBfXv3NJNAK9JOJEwM/9iCCdpZLDVKQDuCxZHGqegua1KnfFzoFLKJLfjSrA+e+NemDFQtDxFjAXMxiC3IEZbMZJdHA51Z0HskdvTD0VPL9QxcidWBKMvTVC4rklJKY3aSqyjag2e5puGA==; 24:sVBA+TcKn3d7vSsFTX6IezEmgjRGAqDbb+9uPgqgtEMoVXYz2ZniPnrGszFLlWaG5lVcflV+c9cqEsNkb992XcPQJEXNRran8fzy10fOlJE=; 7:KghCldV+jT/2/Qchji2vmeQnlr6fo9oa2QHz2pDG7gGf69QV3+Pl6d4aczPvKZAoZF4QXMBl7BH0vA/3n1TTbFkMnqiSqSBZbvCKPDFNWa5vxZ8iuwz4ZhLwm2Y/8IIhy5WOV+i9OFFz/VNCepon0bvnvXw/bcAqrrXGRfvgpNei/Ub3IrGKoAqAyC5LQjOiwyxEHpilFwPCHZoxAifsw0gHTmn5gltx/8SlvY7tEef3C48Q4EEJHLje7s8iv4m2jDhySGPjeIO+PgIFfLiG4jLqyD42vsAjFtonwFfv0DjbD4l9Wz2fFW5J4WN9Axra x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0401MB2634; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:HE1PR0401MB2634; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2634; x-forefront-prvs: 007271867D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(377454003)(24454002)(189002)(199003)(87936001)(68736007)(5890100001)(110136003)(7696004)(122556002)(5002640100001)(4326007)(575784001)(189998001)(8936002)(9686002)(86362001)(586003)(8676002)(66066001)(5660300001)(2950100001)(2906002)(81166006)(2900100001)(81156014)(10400500002)(74316002)(15975445007)(106356001)(7736002)(106116001)(19580405001)(3660700001)(105586002)(3846002)(97736004)(19580395003)(77096005)(101416001)(76576001)(93886004)(6116002)(102836003)(33656002)(305945005)(50986999)(76176999)(92566002)(54356999)(7846002)(7416002)(3280700002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0401MB2634; H:DB5PR0401MB1925.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Sep 2016 11:43:59.4609 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2634 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160921_044424_835369_63F97AFC X-CRM114-Status: GOOD ( 17.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Grygorii Strashko , Russell King - ARM Linux , Catalin Marinas , Yoshihiro Shimoda , "linux-usb@vger.kernel.org" , Sekhar Nori , lkml , Stuart Yoder , Scott Wood , David Fisher , "Thang Q. Nguyen" , Leo Li , "linux-arm-kernel@lists.infradead.org" , Suresh Gupta , Greg Kroah-Hartman , Alan Stern , Peter Chen Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP >From: Arnd Bergmann [mailto:arnd@arndb.de] >On Wednesday, September 21, 2016 11:06:47 AM CEST Sriram Dash wrote: >> >> Hello Arnd, >> >> We tried this patch on NXP platforms (ls2085 and ls1043) which use >> dwc3 controller without any glue layer. On first go, this did not >> work. But after minimal reworks mention snippet below, we are able to >> verify that the USB was working OK. >> >> drivers/usb/host/xhci-mem.c | 12 ++++++------ >> drivers/usb/host/xhci.c | 20 ++++++++++---------- >> >> - struct device *dev = xhci_to_hcd(xhci)->self.controller; >> + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; >> >> We believe the patch needs little modification to work or there might >> be chances we may have missed something. Any idea? > > >I had not tried the patch, it was just sent for clarification what I meant, so I'm glad >you got it working with just minimal changes. > >Unfortunately, I can't tell from your lines above what exactly you changed, can you >send that again as a proper patch? > Sure. ============================================================== From 8b0dea1513e9e73a11dcfa802ddc71cca11d66f8 Mon Sep 17 00:00:00 2001 From: Sriram Dash Date: Wed, 21 Sep 2016 11:39:30 +0530 Subject: [PATCH] usb: xhci: Fix the patch inherit dma configuration from parent dev Fixes the patch https://patchwork.kernel.org/patch/9319527/ ("usb: dwc3: host: inherit dma configuration from parent dev"). Signed-off-by: Sriram Dash --- drivers/usb/host/xhci-mem.c | 12 ++++++------ drivers/usb/host/xhci.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 6afe323..79608df 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -586,7 +586,7 @@ static void xhci_free_stream_ctx(struct xhci_hcd *xhci, unsigned int num_stream_ctxs, struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) { - struct device *dev = xhci_to_hcd(xhci)->self.controller; + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; size_t size = sizeof(struct xhci_stream_ctx) * num_stream_ctxs; if (size > MEDIUM_STREAM_ARRAY_SIZE) @@ -614,7 +614,7 @@ static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, unsigned int num_stream_ctxs, dma_addr_t *dma, gfp_t mem_flags) { - struct device *dev = xhci_to_hcd(xhci)->self.controller; + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; size_t size = sizeof(struct xhci_stream_ctx) * num_stream_ctxs; if (size > MEDIUM_STREAM_ARRAY_SIZE) @@ -1644,7 +1644,7 @@ void xhci_slot_copy(struct xhci_hcd *xhci, static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags) { int i; - struct device *dev = xhci_to_hcd(xhci)->self.controller; + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; int num_sp = HCS_MAX_SCRATCHPAD(xhci->hcs_params2); xhci_dbg_trace(xhci, trace_xhci_dbg_init, @@ -1716,7 +1716,7 @@ static void scratchpad_free(struct xhci_hcd *xhci) { int num_sp; int i; - struct device *dev = xhci_to_hcd(xhci)->self.controller; + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; if (!xhci->scratchpad) return; @@ -1792,7 +1792,7 @@ void xhci_free_command(struct xhci_hcd *xhci, void xhci_mem_cleanup(struct xhci_hcd *xhci) { - struct device *dev = xhci_to_hcd(xhci)->self.controller; + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; int size; int i, j, num_ports; @@ -2334,7 +2334,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) { dma_addr_t dma; - struct device *dev = xhci_to_hcd(xhci)->self.controller; + struct device *dev = xhci_to_hcd(xhci)->self.sysdev; unsigned int val, val2; u64 val_64; struct xhci_segment *seg; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 01d96c9..9a1ff09 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -231,7 +231,7 @@ static int xhci_free_msi(struct xhci_hcd *xhci) static int xhci_setup_msi(struct xhci_hcd *xhci) { int ret; - struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); + struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.sysdev); ret = pci_enable_msi(pdev); if (ret) { @@ -257,7 +257,7 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) */ static void xhci_free_irq(struct xhci_hcd *xhci) { - struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); + struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.sysdev); int ret; /* return if using legacy interrupt */ @@ -280,7 +280,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) { int i, ret = 0; struct usb_hcd *hcd = xhci_to_hcd(xhci); - struct pci_dev *pdev = to_pci_dev(hcd->self.controller); + struct pci_dev *pdev = to_pci_dev(hcd->self.sysdev); /* * calculate number of msi-x vectors supported. @@ -337,7 +337,7 @@ free_entries: static void xhci_cleanup_msix(struct xhci_hcd *xhci) { struct usb_hcd *hcd = xhci_to_hcd(xhci); - struct pci_dev *pdev = to_pci_dev(hcd->self.controller); + struct pci_dev *pdev = to_pci_dev(hcd->self.sysdev); if (xhci->quirks & XHCI_PLAT) return; @@ -376,7 +376,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) if (xhci->quirks & XHCI_PLAT) return 0; - pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); + pdev = to_pci_dev(xhci_to_hcd(xhci)->self.sysdev); /* * Some Fresco Logic host controllers advertise MSI, but fail to * generate interrupts. Don't even try to enable MSI. @@ -745,7 +745,7 @@ void xhci_shutdown(struct usb_hcd *hcd) struct xhci_hcd *xhci = hcd_to_xhci(hcd); if (xhci->quirks & XHCI_SPURIOUS_REBOOT) - usb_disable_xhci_ports(to_pci_dev(hcd->self.controller)); + usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); spin_lock_irq(&xhci->lock); xhci_halt(xhci); @@ -762,7 +762,7 @@ void xhci_shutdown(struct usb_hcd *hcd) /* Yet another workaround for spurious wakeups at shutdown with HSW */ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) - pci_set_power_state(to_pci_dev(hcd->self.controller), PCI_D3hot); + pci_set_power_state(to_pci_dev(hcd->self.sysdev), PCI_D3hot); } #ifdef CONFIG_PM @@ -3605,7 +3605,7 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) * if no devices remain. */ if (xhci->quirks & XHCI_RESET_ON_RESUME) - pm_runtime_put_noidle(hcd->self.controller); + pm_runtime_put_noidle(hcd->self.sysdev); #endif ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); @@ -3745,7 +3745,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) * suspend if there is a device attached. */ if (xhci->quirks & XHCI_RESET_ON_RESUME) - pm_runtime_get_noresume(hcd->self.controller); + pm_runtime_get_noresume(hcd->self.sysdev); #endif @@ -4834,7 +4834,7 @@ int xhci_get_frame(struct usb_hcd *hcd) int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) { struct xhci_hcd *xhci; - struct device *dev = hcd->self.controller; + struct device *dev = hcd->self.sysdev; int retval; /* Accept arbitrarily long scatter-gather lists */