From patchwork Wed Nov 18 22:41:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 56954 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2836385lbb; Wed, 18 Nov 2015 14:41:29 -0800 (PST) X-Received: by 10.66.155.74 with SMTP id vu10mr5736819pab.80.1447886489727; Wed, 18 Nov 2015 14:41:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xu3si7037581pab.194.2015.11.18.14.41.29; Wed, 18 Nov 2015 14:41:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755749AbbKRWl1 (ORCPT + 4 others); Wed, 18 Nov 2015 17:41:27 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:42525 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbbKRWl1 (ORCPT ); Wed, 18 Nov 2015 17:41:27 -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 tAIMfMvT009948; Wed, 18 Nov 2015 16:41:22 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id tAIMfM7P016935; Wed, 18 Nov 2015 16:41:22 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Wed, 18 Nov 2015 16:41:22 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id tAIMfLZd012677; Wed, 18 Nov 2015 16:41:21 -0600 From: Felipe Balbi To: Robert Jarzmik CC: Robert Baldyga , Subject: Re: [4.4-rc1 regression] pxa27x_udc and suspend/resume In-Reply-To: <87k2pf7xl1.fsf@belgarion.home> References: <87si437zm8.fsf@belgarion.home> <87r3jngetk.fsf@saruman.tx.rr.com> <87oaer7ylc.fsf@belgarion.home> <87k2pf7xl1.fsf@belgarion.home> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 18 Nov 2015 16:41:18 -0600 Message-ID: <87io4zgcc1.fsf@saruman.tx.rr.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Hi, Robert Jarzmik writes: > Robert Jarzmik writes: > >> Felipe Balbi writes: >> >>> Hi, >>> >>> without any sort of logs it a bit difficult :-) Care to send some output >>> of the failure ? Are there any oopses or what exactly happens ? >> Ah well, the UDC is the only way to "speak" to the board (no UART), so I don't >> have any written feedback available. All I have are the logs displayed on the >> phone's screen in the framebuffer screen. > > I can have logs if I kinda ... revert the patch, applying the diff in [1]. > This enables the suspend/resume to work again, and I can gather the logs when > [1] is applied : > > [ 63.649528] Suspending console(s) (use no_console_suspend to debug) > [ 63.688100] PM: suspend of devices complete after 37.275 msecs > [ 63.690351] PM: late suspend of devices complete after 2.191 msecs > [ 63.692595] PM: noirq suspend of devices complete after 2.196 msecs > [ 63.694387] PM: noirq resume of devices complete after 1.482 msecs > [ 63.696711] PM: early resume of devices complete after 1.533 msecs > [ 63.802930] PM: resume of devices complete after 106.122 msecs > [ 63.804976] Restarting tasks ... > [ 63.821371] pxa27x-udc pxa27x-udc: USB reset > [ 63.822988] done. > [ 63.933666] pxa27x-udc pxa27x-udc: USB reset > [ 64.064026] g_ether gadget: full-speed config #1: CDC Subset/SAFE > [ 64.069692] pxa27x-udc pxa27x-udc: ep3:pxa_ep_enable:usb_ep ep1out-bulk already enabled, doing nothing this could be a bug in either g_ether or pxa27x... Seems like something is enabling endpoints which were already enabled. Not sure if this is pxa27x not _really_ disabling endpoints or g_ether being stupid. > [1] Stupid diff to renable the suspend/resume to work on 4.4-rc1 > rj@belgarion:~/mio_linux/kernel$ git diff > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index 3d583a10b926..2b8dcf546d03 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -267,8 +267,8 @@ static inline int usb_ep_enable(struct usb_ep *ep) > { > int ret; > > - if (ep->enabled) > - return 0; > + /* if (ep->enabled) */ > + /* return 0; */ > > ret = ep->ops->enable(ep, ep->desc); > if (ret) > @@ -295,8 +295,8 @@ static inline int usb_ep_disable(struct usb_ep *ep) > { > int ret; > > - if (!ep->enabled) > - return 0; > + /* if (!ep->enabled) */ > + /* return 0; */ yeah, so something is not disabling endpoints when they should :-) So this could be a bug with your suspend/resume callbacks. If you're going to disconnect from the bus, you need to tell the gadget driver about it, which means after disabling pullups, you should call gadget_driver->disconnect(). Can you see if this *stupid* and *untested* diff helps : I'm not 100% sure this is enough, as I'm not at all familiar with pxa27x, but that driver looks hugely unmaintained. Which device are you using for development/test ? Is it this Mio A701 ? I can't find any sources of it :-s -- balbi diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 670ac0b12f00..a08ae19ca410 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2535,6 +2535,7 @@ static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state) udc_disable(udc); udc->pullup_resume = udc->pullup_on; dplus_pullup(udc, 0); + udc->driver->disconnect(&udc->gadget); return 0; }