From patchwork Wed Nov 29 17:21:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 120040 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3358184qgn; Wed, 29 Nov 2017 09:53:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMYH7gbZrToN5E5FkQ6xqId8EdlFZXQaDLO3vCcwNWxDUJl7VdUmeDHbxiUIkOn0wxI/pu6Q X-Received: by 10.84.177.129 with SMTP id x1mr3693599plb.217.1511978009192; Wed, 29 Nov 2017 09:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511978009; cv=none; d=google.com; s=arc-20160816; b=EXtqmal0Aj+ALqRgsmLvlfgiC82WgVYot4AApwY/huoXq4+TryrfB2VKDOQk/r0UJT J+EQAo3FuszFbam3h7OAHJeSp+QpBg2myGxTHyB5m5aWoTDpLdy1BopXy1zTVlLaOlxZ 6GFMzY81/127CT8HeG5d5vCRGBZbGsrNMJRGUlr8FUwZ3qtF1v4FrNFMnB0iVlMA//vD lTlXP25DRA8RSRNRV1j8nf7BCMd3bKSaSHpaISOc36wE44Zvrepesjc58LKYhMbBy61j 1O9vnwdmqj41CWlteW9wffPvukWbsfxlmWNUChq2XcRaR1JrUPlWDUpuHGnH31cw+mXM 3R0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=rXyxLFiKHCJs7DbqhiX9IYM6hCSfc3LVrSyR1JDFnY4=; b=j22PJGqsqcxk99+t+pLFYYKex2teeXtHExZjryj1ut1Ppey+0USVr8TT32jA20ITOn y6mjRa8Uz78AtiOyUx73nCYAoG/zj+92qWC/4ilTEDwC13sM/ZLiDIQuG5gH8Dj5k3Ax g0obRFRea5NrPkJ3OKre7Ea0jN8nyGrZAxnG6pkECdGjJCZNqkVlVlkKQXGundK1/Rdg KfhQplLphVGQHnZqZKQxeWU+lCoc+6cU29qp0vNDlMwnEi74Q+E5LYq6x+02Bn0BT6yY 5158rWcjB4PDTv7OjYKx918xaGaffgiW4FcJbp0H0q1cphQWUXFVxFDamNhFyXER95Ie xg8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=ViGo4pbm; dkim=fail header.i=@verizon.com header.s=corp header.b=PluBNB78; dkim=fail header.i=@verizon.com header.s=corp header.b=u2NW+Iel; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si1598704pgz.111.2017.11.29.09.53.28; Wed, 29 Nov 2017 09:53:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=ViGo4pbm; dkim=fail header.i=@verizon.com header.s=corp header.b=PluBNB78; dkim=fail header.i=@verizon.com header.s=corp header.b=u2NW+Iel; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934990AbdK2Rx1 (ORCPT + 28 others); Wed, 29 Nov 2017 12:53:27 -0500 Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:55873 "EHLO omzsmtpe02.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933922AbdK2RWN (ORCPT ); Wed, 29 Nov 2017 12:22:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1511976133; x=1543512133; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=G/P0gdRh/4DpMLPX1+x8XII/ZdXHCqQ0qP4m/VfyJFw=; b=ViGo4pbmvuC+nVQQzqLGDFbVqQeP10lnWxLpKw7ANs+xnJCwe0VoamsZ M5zqiWQzKK3gRzWp1H3bOi4vC9wkwRcmzIOaeLm57HaUqElamq1WupE37 hROiV64mGGjdEDAVx6w6IgqxZgQ0eZqDCRKZnnalo/yEkChT+Vk4RLH9c U=; Received: from unknown (HELO fldsmtpi02.verizon.com) ([166.68.71.144]) by omzsmtpe02.verizonbusiness.com with ESMTP; 29 Nov 2017 17:22:04 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO apollo.verizonwireless.com) ([10.255.192.101]) by fldsmtpi02.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Nov 2017 17:21:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1511976089; x=1543512089; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=G/P0gdRh/4DpMLPX1+x8XII/ZdXHCqQ0qP4m/VfyJFw=; b=PluBNB78/8kEvapNGIdduQ9XTCOEku8OmQ4h1P0L1t5ya355Z8lHCycL Sfgw4wahJHovMajJTd6RhpFrPX5+Faelw0Zf7YFmcYOYSkj9V5NwXbjVg LC2T6/NkCSd9JTuF3Ls/4AFTBuvCOeNW5uHc1XbzcDKMEBkyCvmjG2ybS c=; Received: from pioneer.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.34]) by apollo.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Nov 2017 12:21:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1511976086; x=1543512086; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=G/P0gdRh/4DpMLPX1+x8XII/ZdXHCqQ0qP4m/VfyJFw=; b=u2NW+Ielx4tW42YLPCW5SfEExL0unJVOlakflIldRzViQS5JcqtwSgOv TttZLDJ8qnd/ktdXiMPR7YzyR40V38jtRbbL71zl/nDDk7fCipwOkhKCa AfCEpHWASuOV35DqqSoG3IBGJmZF0Ee+0ZCMgDKKX0Rcm4o7bhHFG7+gY Y=; From: alexander.levin@verizon.com Cc: Roger Quadros , Felipe Balbi , alexander.levin@verizon.com X-Host: pioneer.tdc.vzwcorp.com Received: from ohtwi1exh003.uswin.ad.vzwcorp.com ([10.144.218.45]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 29 Nov 2017 17:21:26 +0000 Received: from tbwexch16apd.uswin.ad.vzwcorp.com (153.114.162.40) by OHTWI1EXH003.uswin.ad.vzwcorp.com (10.144.218.45) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 29 Nov 2017 12:21:26 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by tbwexch16apd.uswin.ad.vzwcorp.com (153.114.162.40) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Wed, 29 Nov 2017 12:21:25 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Wed, 29 Nov 2017 11:21:25 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Wed, 29 Nov 2017 11:21:25 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 21/52] usb: dwc3: gadget: Fix system suspend/resume on TI platforms Thread-Topic: [PATCH AUTOSEL for 4.9 21/52] usb: dwc3: gadget: Fix system suspend/resume on TI platforms Thread-Index: AQHTaTZ3pN6y70RiAUiEwkJJmtXkew== Date: Wed, 29 Nov 2017 17:21:17 +0000 Message-ID: <20171129172100.28819-21-alexander.levin@verizon.com> References: <20171129172100.28819-1-alexander.levin@verizon.com> In-Reply-To: <20171129172100.28819-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roger Quadros [ Upstream commit 1551e35ea4189c1f7199fe278395fc94196715f2 ] On TI platforms (dra7, am437x), the DWC3_DSTS_DEVCTRLHLT bit is not set after the device controller is stopped via DWC3_DCTL_RUN_STOP. If we don't disconnect and stop the gadget, it stops working after a system resume with the trace below. There is no point in preventing gadget disconnect and gadget stop during system suspend/resume as we're going to suspend in any case, whether DEVCTRLHLT timed out or not. [ 141.727480] ------------[ cut here ]------------ [ 141.732349] WARNING: CPU: 1 PID: 2135 at drivers/usb/dwc3/gadget.c:2384 dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3] [ 141.744299] Modules linked in: usb_f_ss_lb g_zero libcomposite xhci_plat_hcd xhci_hcd usbcore dwc3 evdev udc_core m25p80 usb_common spi_nor snd_soc_davinci_mcasp snd_soc_simple_card snd_soc_edma snd_soc_tlv3e [ 141.792163] CPU: 1 PID: 2135 Comm: irq/456-dwc3 Not tainted 4.10.0-rc8 #1138 [ 141.799547] Hardware name: Generic DRA74X (Flattened Device Tree) [ 141.805940] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 141.814066] [] (show_stack) from [] (dump_stack+0xac/0xe0) [ 141.821648] [] (dump_stack) from [] (__warn+0xd8/0x104) [ 141.828955] [] (__warn) from [] (warn_slowpath_null+0x20/0x28) [ 141.836902] [] (warn_slowpath_null) from [] (dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3]) [ 141.848329] [] (dwc3_stop_active_transfer.constprop.4 [dwc3]) from [] (__dwc3_gadget_ep_disable+0x64/0x528 [dwc3]) [ 141.861034] [] (__dwc3_gadget_ep_disable [dwc3]) from [] (dwc3_gadget_ep_disable+0x3c/0xc8 [dwc3]) [ 141.872280] [] (dwc3_gadget_ep_disable [dwc3]) from [] (usb_ep_disable+0x11c/0x18c [udc_core]) [ 141.883160] [] (usb_ep_disable [udc_core]) from [] (disable_ep+0x18/0x54 [usb_f_ss_lb]) [ 141.893408] [] (disable_ep [usb_f_ss_lb]) from [] (disable_endpoints+0x18/0x50 [usb_f_ss_lb]) [ 141.904168] [] (disable_endpoints [usb_f_ss_lb]) from [] (disable_source_sink+0x2c/0x34 [usb_f_ss_lb]) [ 141.915771] [] (disable_source_sink [usb_f_ss_lb]) from [] (reset_config+0x48/0x7c [libcomposite]) [ 141.927012] [] (reset_config [libcomposite]) from [] (composite_disconnect+0x2c/0x54 [libcomposite]) [ 141.938444] [] (composite_disconnect [libcomposite]) from [] (usb_gadget_udc_reset+0x10/0x34 [udc_core]) [ 141.950237] [] (usb_gadget_udc_reset [udc_core]) from [] (dwc3_gadget_reset_interrupt+0x64/0x698 [dwc3]) [ 141.962022] [] (dwc3_gadget_reset_interrupt [dwc3]) from [] (dwc3_thread_interrupt+0x618/0x1a3c [dwc3]) [ 141.973723] [] (dwc3_thread_interrupt [dwc3]) from [] (irq_thread_fn+0x1c/0x54) [ 141.983215] [] (irq_thread_fn) from [] (irq_thread+0x120/0x1f0) [ 141.991247] [] (irq_thread) from [] (kthread+0xf8/0x138) [ 141.998641] [] (kthread) from [] (ret_from_fork+0x14/0x24) [ 142.006213] ---[ end trace b4ecfe9f175b9a9c ]--- Signed-off-by: Roger Quadros Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc3/gadget.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.11.0 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index c61ddbf94bc7..16c67120d72b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3092,15 +3092,10 @@ void dwc3_gadget_exit(struct dwc3 *dwc) int dwc3_gadget_suspend(struct dwc3 *dwc) { - int ret; - if (!dwc->gadget_driver) return 0; - ret = dwc3_gadget_run_stop(dwc, false, false); - if (ret < 0) - return ret; - + dwc3_gadget_run_stop(dwc, false, false); dwc3_disconnect_gadget(dwc); __dwc3_gadget_stop(dwc);