From patchwork Wed Nov 12 14:58:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 40679 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BD16324493 for ; Wed, 12 Nov 2014 14:58:33 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c41sf8208405eek.4 for ; Wed, 12 Nov 2014 06:58:32 -0800 (PST) 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=0O8NxadWc7Uxqh8TQkbFtIV19SlHV8cRS8/N65zOybo=; b=c4Rl052M6Hkqp5KUCtidVE52mYdQu0noZqxw86/Wb2tcjZQ/cP/+QK2T0/yv55ErXx 3q3U3STw+zxRKmOGQEFeYEtGawEKAiC/5BuQPhE7x2IlDqveTbgBnnEbZB8eTwCshVCt dUOE58XjepJNcLc1m/VseUiUiYojf2Z9cN4OG+rgyNV1BZckKPIV18Pn9hysV/8SQaWQ FzBGRYXt0h6gy9v02y4ewpP6S998DSHhBWzizfDye94oyHvHoTIrPwIu777mjvtHP4G5 ufz0TI1M0ZOuWhCEMEsdiTRRoCraVfq5p7gfEaM81wdX/ynllw9gTddy/7eYdJKK3sLT UZSA== X-Gm-Message-State: ALoCoQkgF20/7zi056xc3BgXc92SW4rh6tAsvi0sHTrkiRuvsKy57eWSJ2jZpMrFfjo9DaR0t3vV X-Received: by 10.152.42.171 with SMTP id p11mr8002435lal.4.1415804312872; Wed, 12 Nov 2014 06:58:32 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.135 with SMTP id jo7ls726298lab.108.gmail; Wed, 12 Nov 2014 06:58:32 -0800 (PST) X-Received: by 10.152.204.230 with SMTP id lb6mr30142487lac.35.1415804312405; Wed, 12 Nov 2014 06:58:32 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id gd7si35166222lbc.83.2014.11.12.06.58.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 06:58:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so2692946lbi.22 for ; Wed, 12 Nov 2014 06:58:32 -0800 (PST) X-Received: by 10.152.5.38 with SMTP id p6mr42355655lap.44.1415804311915; Wed, 12 Nov 2014 06:58:31 -0800 (PST) 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.112.184.201 with SMTP id ew9csp437662lbc; Wed, 12 Nov 2014 06:58:31 -0800 (PST) X-Received: by 10.66.186.101 with SMTP id fj5mr18264135pac.145.1415804310383; Wed, 12 Nov 2014 06:58:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si23155228pdh.7.2014.11.12.06.58.27 for ; Wed, 12 Nov 2014 06:58:30 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899AbaKLO6Z (ORCPT + 25 others); Wed, 12 Nov 2014 09:58:25 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:49615 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752409AbaKLO6W (ORCPT ); Wed, 12 Nov 2014 09:58:22 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id sACEwLiF004354; Wed, 12 Nov 2014 08:58:21 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id sACEwLok012830; Wed, 12 Nov 2014 08:58:21 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 12 Nov 2014 08:58:20 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id sACEwJJv018695; Wed, 12 Nov 2014 08:58:19 -0600 From: Roger Quadros To: CC: , , , Roger Quadros Subject: [PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume Date: Wed, 12 Nov 2014 16:58:16 +0200 Message-ID: <1415804296-28980-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) 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: , On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature. We need to stop the gadget controller while system suspend else it results in L3 Bus errors on resume with broken USB gadget on J6-evm. [ 55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x31c() [ 55.718232] 44000000.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC (Idle): Data Access in User mode during Functional access [ 55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite configfs xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap omap_remoteproc [ 55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.19-02011-g3ece3ca-dirty #658 [ 55.718290] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 55.718302] [] (show_stack) from [] (dump_stack+0x78/0x94) [ 55.718315] [] (dump_stack) from [] (warn_slowpath_common+0x6c/0x90) [ 55.718325] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) [ 55.718336] [] (warn_slowpath_fmt) from [] (l3_interrupt_handler+0x224/0x31c) [ 55.718348] [] (l3_interrupt_handler) from [] (handle_irq_event_percpu+0x5c/0x23c) [ 55.718358] [] (handle_irq_event_percpu) from [] (handle_irq_event+0x3c/0x5c) [ 55.718367] [] (handle_irq_event) from [] (handle_fasteoi_irq+0x98/0x158) [ 55.718377] [] (handle_fasteoi_irq) from [] (generic_handle_irq+0x20/0x30) [ 55.718385] [] (generic_handle_irq) from [] (handle_IRQ+0x4c/0xb0) [ 55.718393] [] (handle_IRQ) from [] (gic_handle_irq+0x28/0x5c) [ 55.718402] [] (gic_handle_irq) from [] (__irq_svc+0x44/0x5c) [ 55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0) [ 55.718412] 1f60: 00000001 00000001 00000000 00000000 c09c0000 00000000 [ 55.718418] 1f80: c09c0000 c09c0000 c0a7a1e4 c09c8938 c09c89b4 00000000 60000093 c09c1fb0 [ 55.718423] 1fa0: c008a2e4 c00926cc 60000013 ffffffff [ 55.718433] [] (__irq_svc) from [] (cpu_startup_entry+0x100/0x1f4) [ 55.718444] [] (cpu_startup_entry) from [] (start_kernel+0x324/0x388) Signed-off-by: Roger Quadros --- drivers/usb/dwc3/gadget.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3818b26..bc15b54 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc) { if (dwc->pullups_connected) { dwc3_gadget_disable_irq(dwc); - dwc3_gadget_run_stop(dwc, true, true); + if (dwc->has_hibernation) { + dwc3_gadget_run_stop(dwc, true, true); + } else { + dwc3_gadget_run_stop(dwc, false, true); + /* remember to connect back on resume */ + dwc->pullups_connected = true; + } } return 0;