Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp669875imu; Fri, 9 Nov 2018 04:15:55 -0800 (PST) X-Google-Smtp-Source: AJdET5cCO03CcNFRFwrMmJ7sKvnrUvXhJjg2bRdwpzwR9wc17UF6t5nv3fdsw4XfWisLhwImTaRd X-Received: by 2002:a63:5907:: with SMTP id n7mr7160443pgb.435.1541765755372; Fri, 09 Nov 2018 04:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541765755; cv=none; d=google.com; s=arc-20160816; b=H+2oTf+fhW5UTBBi9bs30xOUnCOTcZL2X94jK4U3bwG7vHSJ+HQCC+QDOJ+H7RuZBl FnxXk5FwdZMvFRiCYPKQ9uF4I6L3D1yJIZKt3A7luwbfKopavsAYRjY90LOsN2zWtcfE bAZi21ZfiMoe12wE3378inDNM/HvfhcdhkV2ePCSapmWw8TckkhILfEQ4jYOwToVUoAV D2RnDxC7C3HBrwWhIBpnOAcwesfq1L9u82KJWrV2E6HkEq/RxbE7dpKapl/2hZncCtSK TRD0pbhr4rQf6Ue4IGN3xUeH/s+YgBXZZ8GHJBna0L2p6NR2N1k4C1mDKxcJEwxmZPqY vCww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Mtv0MhXkFuh1a35otS4l3lB20Jjm1yTnaOUS0XFU9Zs=; b=DSlAttw9GnMo6BVcwf0r+93pQpvyIxlDHZq2CyrCVB/SmcSykpPy1oKzkOdMcYo/kO jB5ibEAgKX75/QqU2L4tuz/tbn6+Lurxrq+eSQzy1QnXlG5KKhx++9117LWKqCTqQ3M0 61KklOqkoMck50sVmiMWLHBmBDUbrNKT5mhRmhvPT4suA4HSYUWhvnL8EV6X8UqZZTZp ZXMBuGJSSjEbZ68QWEqSVFQ3Mbib+7RyLoKM0qvEA8Sy9VrfxF5hpjjHCy2kMJ6k2Kr9 V71hgb8139YEaeRt7GpqGbnYhl2yyuPMNoPDFlnmsg4WssCvbvOqQ583cqTY0WHtg99i 1SpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HJeieoQ0; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12-v6si5926442pgb.68.2018.11.09.04.15.33; Fri, 09 Nov 2018 04:15:55 -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=pass header.i=@gmail.com header.s=20161025 header.b=HJeieoQ0; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728130AbeKIVzR (ORCPT + 99 others); Fri, 9 Nov 2018 16:55:17 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:36756 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727560AbeKIVzR (ORCPT ); Fri, 9 Nov 2018 16:55:17 -0500 Received: by mail-vk1-f195.google.com with SMTP id u62so350469vkb.3; Fri, 09 Nov 2018 04:14:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mtv0MhXkFuh1a35otS4l3lB20Jjm1yTnaOUS0XFU9Zs=; b=HJeieoQ0UXQ72poa0nStNT9FY8U76yxqwsXNYfQS/2rYtQIbe7APBEZGVjfc5rg6G2 jOhDfhqGSsTLJCB9JIo+pAH2eS4+1Ex4H5H66NtRAt+2yQ1FH377wHVV8k5bGErNahQi W86IltjkffW1mKG4c3RPPzHRGkga+IC2kHsOAKpkMtah1cpUbPTBsDcgSQrkq5IJCZFM CTZvmCg6N97/fDRXZ8+QJAcYqh3WKs+qCjxSsCI+efsLp52jzXLRzPZuVJtq0ACbJnYe tWst1dc8WnuqKfWgFcjwiGveXRE88UBIoQ3WRM/d+QSEVGbyWIZ0AUTRBU6y8CNf7Zbo 87fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mtv0MhXkFuh1a35otS4l3lB20Jjm1yTnaOUS0XFU9Zs=; b=DxtfYiMDTXCjMHLRkWRjoAC6JsY2aFl+m0xHKuf5ns+PhCikDIHx2tkD+ZabVf+ksO AzF+ia+6I/qTO/htl056zYVy3j5XW25qItTrg5Qzs5aR4u8pfyBtyLEbw6J01qK3jPrx pHwVOYyTjTY9SPgQb2EsmmuYZre/Qu6PnkbBUQMHr3SSRXoOSkH0H6p41gcZfOr7e4jN /npgTkky7JzWm2kPJGJOioRFpPUo8z2HaJzbpe0f0JChEyjXygRx/mYZp/Q9gosslVU4 jYE3TY/1H19wIwVV2d9LKDx7qpaK5SViyyWmBDFg2i9WK1mp1wR7/KEA3jPYMgsohuxM 3qyQ== X-Gm-Message-State: AGRZ1gIc2pTQKSyRxzIZJ57dZNeVEgmRktw/Xl/dbTqBXvYSSAiDuB83 BiQxJmtejTlWdmNXV5Z2FJBtKR4+RaC4NvFs86g= X-Received: by 2002:a1f:ac4:: with SMTP id 187mr3721600vkk.31.1541765694235; Fri, 09 Nov 2018 04:14:54 -0800 (PST) MIME-Version: 1.0 References: <1541641432.32173.71.camel@mhfsdcap03> <1541750924.32173.81.camel@mhfsdcap03> In-Reply-To: <1541750924.32173.81.camel@mhfsdcap03> From: Alan Cooper Date: Fri, 9 Nov 2018 07:14:50 -0500 Message-ID: Subject: Re: [PATCH V2 2/6] usb: core: Add ability to skip phy exit on suspend and init on resume To: chunfeng yun 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 , USB list , Lu Baolu , Mark Rutland , Martin Blumenstingl , Mathias Nyman , Mathias Nyman , Mauro Carvalho Chehab , Rishabh Bhatnagar , Rob Herring , Roger Quadros Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 9, 2018 at 3:08 AM Chunfeng Yun wrote: > > 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. Unfortunately, they are not independent in our design. The PHY supplies the clock needed to read/write the OHCI, EHCI and XHCI registers. Al > > > > > 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; > > > > > > > > > > > > >