From patchwork Wed Mar 26 09:43:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 27096 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E228F20062 for ; Wed, 26 Mar 2014 09:43:18 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf6461998obc.9 for ; Wed, 26 Mar 2014 02:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=6Rjvzl2eJMmR3XHef2LnmkmZQB4aXuLmAlBPtnQXOus=; b=HE2tnvuXW2yE5XzXJc2CGEMqlsfW/Q6MVpW9YDCkQgSU6NqUszbD3d1+62I/Vk7gIN eLDdy257994xCKxQrykl9UdNU4Fvfz7i+lcMXU957kHWLZJGrkywArfGIORUSKerTKrb v2tXCnSgx8fP/ifojl2q9ltyA2yjmYPOFXD7+e0U/7nMiX4AY5uD12icfUzD7YxDD7ej qBKasePrA/kgH2A7BUp9dXFnGj1Vqf5wI3H1UkUu+iZVglwqEKG0O3yDjKcDckUSVsak i5SvwM17s06PCybR2hVOnq/N/CnQJokdBG7QVzPEt39jWe2+96BNFyY367D71FlMqgiP tTiw== X-Gm-Message-State: ALoCoQn046UsNp029Tfg7sMbTrwpBKgS1eBXqvqbYgo1gN+ipK5CoUqEOgv12bEsvsb09l/q5I1o X-Received: by 10.182.230.168 with SMTP id sz8mr17392667obc.9.1395826998292; Wed, 26 Mar 2014 02:43:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.81 with SMTP id 75ls586228qgg.75.gmail; Wed, 26 Mar 2014 02:43:18 -0700 (PDT) X-Received: by 10.221.61.210 with SMTP id wx18mr159777vcb.27.1395826998124; Wed, 26 Mar 2014 02:43:18 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id rx10si4510734vdc.42.2014.03.26.02.43.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 02:43:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ik5so2139741vcb.0 for ; Wed, 26 Mar 2014 02:43:17 -0700 (PDT) X-Received: by 10.220.95.139 with SMTP id d11mr11650715vcn.21.1395826997877; Wed, 26 Mar 2014 02:43:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp32246vck; Wed, 26 Mar 2014 02:43:17 -0700 (PDT) X-Received: by 10.68.7.66 with SMTP id h2mr84353315pba.91.1395826996756; Wed, 26 Mar 2014 02:43:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wt1si13255686pbc.75.2014.03.26.02.43.16; Wed, 26 Mar 2014 02:43:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674AbaCZJnP (ORCPT + 5 others); Wed, 26 Mar 2014 05:43:15 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:50990 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750956AbaCZJnN (ORCPT ); Wed, 26 Mar 2014 05:43:13 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2Q9hDnJ026386; Wed, 26 Mar 2014 04:43:13 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2Q9hDDI027168; Wed, 26 Mar 2014 04:43:13 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 26 Mar 2014 04:43:13 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2Q9hBvS005740; Wed, 26 Mar 2014 04:43:11 -0500 From: Roger Quadros To: CC: , , , Roger Quadros Subject: [PATCH v2] usb: dwc3: core: Fix gadget for system suspend/resume Date: Wed, 26 Mar 2014 11:43:09 +0200 Message-ID: <1395826989-5405-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , During system resume, if the event buffers are not setup before the gadget controller starts then we start with invalid context and this can lead to bus access errors. This is especially true for platforms that loose the controller context during system suspend. e.g. AM437x. The following backtrace was found when the system is suspended and resumed with g_zero loaded on AM437x-evm (USB cable connected to host all the while). [ 120.981506] WARNING: CPU: 0 PID: 1656 at drivers/bus/omap_l3_noc.c:137 l3_interrupt_handler+0x198/0x28c() [ 120.981514] L3 custom error: MASTER:USB0 WR TARGET:GPMC [ 120.981638] Modules linked in: g_mass_storage usb_f_mass_storage libcomposite configfs bufferclass_ti(O) omaplfb(O) cryptodev(O) dwc3 snd_soc_evm snd_soc_omap snd_pe [ 120.981659] CPU: 0 PID: 1656 Comm: sh Tainted: G O 3.12.10-gc559824 #1 [ 120.981669] Backtrace: [ 120.981705] [] (dump_backtrace+0x0/0x10c) from [] (show_stack+0x18/0x1c) [ 120.981730] r6:c02819ac r5:00000009 r4:ec137cb8 r3:00000000 [ 120.981767] [] (show_stack+0x0/0x1c) from [] (dump_stack+0x20/0x28) [ 120.981802] [] (dump_stack+0x0/0x28) from [] (warn_slowpath_common+0x70/0x90) [ 120.981830] [] (warn_slowpath_common+0x0/0x90) from [] (warn_slowpath_fmt+0x38/0x40) [ 120.981856] r8:c0855eb0 r7:00000002 r6:f1000700 r5:00000007 r4:80080003 [ 120.981886] [] (warn_slowpath_fmt+0x0/0x40) from [] (l3_interrupt_handler+0x198/0x28c) [ 120.981900] r3:c0801ab8 r2:c06cb354 [ 120.981936] [] (l3_interrupt_handler+0x0/0x28c) from [] (handle_irq_event_percpu+0x54/0x1b8) [ 120.981962] [] (handle_irq_event_percpu+0x0/0x1b8) from [] (handle_irq_event+0x30/0x40) [ 120.981993] [] (handle_irq_event+0x0/0x40) from [] (handle_fasteoi_irq+0x74/0x128) [ 120.982006] r4:ed0056c0 r3:00000000 [ 120.982033] [] (handle_fasteoi_irq+0x0/0x128) from [] (generic_handle_irq+0x28/0x38) [ 120.982046] r4:0000002a r3:c0073fe4 [ 120.982085] [] (generic_handle_irq+0x0/0x38) from [] (handle_IRQ+0x38/0x8c) [ 120.982098] r4:c080137c r3:00000182 [ 120.982124] [] (handle_IRQ+0x0/0x8c) from [] (gic_handle_irq+0x30/0x5c) [ 120.982145] r6:ec137dd0 r5:c07ac480 r4:fa24010c r3:00000100 [ 120.982169] [] (gic_handle_irq+0x0/0x5c) from [] (__irq_svc+0x40/0x54) [ 120.982179] Exception stack(0xec137dd0 to 0xec137e18) [ 120.982195] 7dc0: 00000000 a00001d3 00000000 00000004 [ 120.982216] 7de0: a0000153 ec1d9010 c080de90 ec137e30 c080debc 00000000 ed756e44 ec137e2c [ 120.982232] 7e00: ec137de0 ec137e18 bf1150e4 bf115474 60000153 ffffffff [ 120.982253] r7:ec137e04 r6:ffffffff r5:60000153 r4:bf115474 [ 120.982327] [] (dwc3_complete+0x0/0x40 [dwc3]) from [] (dpm_complete+0xd4/0x19c) [ 120.982341] r5:ed756e10 r4:ed756e64 [ 120.982370] [] (dpm_complete+0x0/0x19c) from [] (dpm_resume_end+0x1c/0x20) [ 120.982400] [] (dpm_resume_end+0x0/0x20) from [] (suspend_devices_and_enter+0x118/0x33c) [ 120.982412] r4:c0833da4 r3:00000000 [ 120.982436] [] (suspend_devices_and_enter+0x0/0x33c) from [] (pm_suspend+0x218/0x254) [ 120.982458] [] (pm_suspend+0x0/0x254) from [] (state_store+0x70/0xc0) [ 120.982478] r6:c057a6cc r5:c06a8320 r4:00000003 r3:0000006d [ 120.982515] [] (state_store+0x0/0xc0) from [] (kobj_attr_store+0x1c/0x28) [ 120.982546] [] (kobj_attr_store+0x0/0x28) from [] (sysfs_write_file+0x170/0x1a4) [ 120.982583] [] (sysfs_write_file+0x0/0x1a4) from [] (vfs_write+0xb8/0x190) [ 120.982611] [] (vfs_write+0x0/0x190) from [] (SyS_write+0x44/0x78) [ 120.982641] [] (SyS_write+0x0/0x78) from [] (ret_fast_syscall+0x0/0x30) Signed-off-by: Roger Quadros Acked-by: Felipe Balbi --- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d001417..10aaaae 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -821,6 +821,7 @@ static void dwc3_complete(struct device *dev) spin_lock_irqsave(&dwc->lock, flags); + dwc3_event_buffers_setup(dwc); switch (dwc->dr_mode) { case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_OTG: @@ -828,7 +829,6 @@ static void dwc3_complete(struct device *dev) /* FALLTHROUGH */ case USB_DR_MODE_HOST: default: - dwc3_event_buffers_setup(dwc); break; }