From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 894C1C43441 for ; Fri, 9 Nov 2018 08:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 584D120883 for ; Fri, 9 Nov 2018 08:09:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 584D120883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbeKIRsa (ORCPT ); Fri, 9 Nov 2018 12:48:30 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:9135 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728165AbeKIRs3 (ORCPT ); Fri, 9 Nov 2018 12:48:29 -0500 X-UUID: 31e1846d8d8e4210895d1c1e3f09ee99-20181109 X-UUID: 31e1846d8d8e4210895d1c1e3f09ee99-20181109 Received: from mtkcas36.mediatek.inc [(172.27.4.250)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1074849497; Fri, 09 Nov 2018 16:08:47 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS33DR.mediatek.inc (172.27.6.106) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 9 Nov 2018 16:08:45 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 9 Nov 2018 16:08:44 +0800 Message-ID: <1541750924.32173.81.camel@mhfsdcap03> Subject: Re: [PATCH V2 2/6] usb: core: Add ability to skip phy exit on suspend and init on resume From: Chunfeng Yun To: Alan Cooper CC: ": Linux Kernel Mailing List" , Alan Stern , Alban Bedel , Alex Elder , Andrew Morton , "Arnd Bergmann" , Avi Fishman , , Bjorn Andersson , "David S. Miller" , DTML , Dmitry Osipenko , "Greg Kroah-Hartman" , "Gustavo A. R. Silva" , Hans de Goede , James Hogan , Jianguo Sun , Johan Hovold , Kees Cook , USB list , Lu Baolu , "Mark Rutland" , Martin Blumenstingl , Mathias Nyman , Mathias Nyman , Mauro Carvalho Chehab , Rishabh Bhatnagar , Rob Herring , Roger Quadros Date: Fri, 9 Nov 2018 16:08:44 +0800 In-Reply-To: References: <1541641432.32173.71.camel@mhfsdcap03> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-11-08 at 17:50 -0500, Alan Cooper wrote: > On Wed, Nov 7, 2018 at 8:43 PM Chunfeng Yun wrote: > > > > hi, > > On Tue, 2018-10-30 at 18:30 -0400, Alan Cooper wrote: > > > On 10/17/18 9:46 PM, Chunfeng Yun wrote:> hi, > > > > > > > > On Wed, 2018-10-17 at 18:29 -0400, Al Cooper wrote: > > > >> Add the ability to skip calling the PHY's exit routine on suspend > > > >> and the PHY's init routine on resume. This is to handle a USB PHY > > > >> that should have it's power_off function called on suspend but > > > cannot > > > >> have it's exit function called because on exit it will disable the > > > >> PHY to the point where register accesses to the Host Controllers > > > >> using the PHY will be disabled and the host drivers will crash. > > > >> > > > >> This is enabled with the HCD flag "suspend_without_phy_exit" which > > > >> can be set from any HCD driver. > > > >> > > > >> Signed-off-by: Al Cooper > > > >> --- > > > >> drivers/usb/core/hcd.c | 8 ++++---- > > > >> drivers/usb/core/phy.c | 18 ++++++++++++------ > > > >> drivers/usb/core/phy.h | 9 ++++++--- > > > >> include/linux/usb/hcd.h | 3 +++ > > > >> 4 files changed, 25 insertions(+), 13 deletions(-) > > > >> > > > > > > > >> unsigned skip_phy_initialization:1; > > > >> > > > >> + /* Some phys don't want the phy's exit/init called on > > > suspend/resume */ > > > >> + unsigned suspend_without_phy_exit:1; > > > > As suggested before, you can skip phy's exit/init during > > > suspend/resume > > > > by enabling wakeup of hcd, so needn't add a new variable for it. > > > > > > I still need to be able to enable and disable wakeup for this driver. > > Just use device_init_wakeup(dev, true) instead of > > device_wakeup_enable(dev) for your controller driver, you can try it. > > > > Sorry for the late replay > > What about the case where sysfs is used to disable wakeup? Oh, It's a problem in this case. BTW: Why the host driver will crash when access host controller's register after power-off phy? they are usually independent. > > Al > > > > > > > > > > >> + > > > >> /* The next flag is a stopgap, to be removed when all the > > > HCDs > > > >> * support the new root-hub polling mechanism. */ > > > >> unsigned uses_new_polling:1; > > > > > > > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chunfeng Yun Subject: Re: [PATCH V2 2/6] usb: core: Add ability to skip phy exit on suspend and init on resume Date: Fri, 9 Nov 2018 16:08:44 +0800 Message-ID: <1541750924.32173.81.camel@mhfsdcap03> References: <1541641432.32173.71.camel@mhfsdcap03> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Alan Cooper Cc: ": Linux Kernel Mailing List" , Alan Stern , Alban Bedel , Alex Elder , Andrew Morton , Arnd Bergmann , Avi Fishman , bcm-kernel-feedback-list@broadcom.com, Bjorn Andersson , "David S. Miller" , DTML , Dmitry Osipenko , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Hans de Goede , James Hogan , Jianguo Sun , Johan Hovold , Kees Cook , US List-Id: devicetree@vger.kernel.org On Thu, 2018-11-08 at 17:50 -0500, Alan Cooper wrote: > On Wed, Nov 7, 2018 at 8:43 PM Chunfeng Yun wrote: > > > > hi, > > On Tue, 2018-10-30 at 18:30 -0400, Alan Cooper wrote: > > > On 10/17/18 9:46 PM, Chunfeng Yun wrote:> hi, > > > > > > > > On Wed, 2018-10-17 at 18:29 -0400, Al Cooper wrote: > > > >> Add the ability to skip calling the PHY's exit routine on suspend > > > >> and the PHY's init routine on resume. This is to handle a USB PHY > > > >> that should have it's power_off function called on suspend but > > > cannot > > > >> have it's exit function called because on exit it will disable the > > > >> PHY to the point where register accesses to the Host Controllers > > > >> using the PHY will be disabled and the host drivers will crash. > > > >> > > > >> This is enabled with the HCD flag "suspend_without_phy_exit" which > > > >> can be set from any HCD driver. > > > >> > > > >> Signed-off-by: Al Cooper > > > >> --- > > > >> drivers/usb/core/hcd.c | 8 ++++---- > > > >> drivers/usb/core/phy.c | 18 ++++++++++++------ > > > >> drivers/usb/core/phy.h | 9 ++++++--- > > > >> include/linux/usb/hcd.h | 3 +++ > > > >> 4 files changed, 25 insertions(+), 13 deletions(-) > > > >> > > > > > > > >> unsigned skip_phy_initialization:1; > > > >> > > > >> + /* Some phys don't want the phy's exit/init called on > > > suspend/resume */ > > > >> + unsigned suspend_without_phy_exit:1; > > > > As suggested before, you can skip phy's exit/init during > > > suspend/resume > > > > by enabling wakeup of hcd, so needn't add a new variable for it. > > > > > > I still need to be able to enable and disable wakeup for this driver. > > Just use device_init_wakeup(dev, true) instead of > > device_wakeup_enable(dev) for your controller driver, you can try it. > > > > Sorry for the late replay > > What about the case where sysfs is used to disable wakeup? Oh, It's a problem in this case. BTW: Why the host driver will crash when access host controller's register after power-off phy? they are usually independent. > > Al > > > > > > > > > > >> + > > > >> /* The next flag is a stopgap, to be removed when all the > > > HCDs > > > >> * support the new root-hub polling mechanism. */ > > > >> unsigned uses_new_polling:1; > > > > > > > >