Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3537299imm; Wed, 5 Sep 2018 01:38:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZceCPzjKAvywevNIWKkp10dFOxSuH6aS5kg9Jekc07XQ726/9iEp05RwE8tJBPPUBd+m/L X-Received: by 2002:a63:5b63:: with SMTP id l35-v6mr35630001pgm.50.1536136710931; Wed, 05 Sep 2018 01:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536136710; cv=none; d=google.com; s=arc-20160816; b=zup2v28KVZXl0B/sBLodMCl8KlKuRLVaQUjtqWfRKSRb/VI3VtaZcPeT2MLphply12 xtjzzlaEXxgEZjOeMnwbNwd7JtD7mKATsjD8DgNTD3YisEN7Boh7hcfdklZ7wYylXC18 tOp23wLSreYFe80wBOsd1bxyjks3240/2smGsk+ny1EWB+dBWITLzHfeGRnFqTd4e3nU Svw9tTnYeB+rSxDtW7EcncJhtKKbJ7SrM5uOlVvKEv9mwo1UTjWf7xnToFoifOBkB8jF 085hEHOWRV1TJkCGrGmclgr0nNwMKpEncouxcPhZrCipGBC641EiDLqQw4Bems8ICdBd 8Xtg== 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:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=iUN7EN4WD7X44s0HeEDeQgK8/F4+Bpy6F2yr+0M61nQ=; b=LAiULdij4FLrXqErGDHYUrbfQgx1w+93F2Vdf2y+wB02PAFbsEcmgViPrx347MI3WK xENCwRMeW+fgOcil3xLqwJ+GgKLjGVnqUmueFGhHLQLrt2G+uBBCNsYpXRENsZvfRaLQ mV+YJT3nKzbGAJvy3VjXQPlPby9nTAyziYW+oZsGXv4G4JDMeiAPVZs9hH8tUMpAQWPH dCrTs4q9cAOUha904chQnE2Aujbq5wmqkZ4+4xpdTprlecZ9zVa3iWQPAEsxjrV285hr ASiG78cOWrBg34Vdk08L1m/lJCIsHzUXrrLPYKXHkYY1pFPX1OtSaqtyrarzi0PMfydB Iy+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=IXcnuG+U; 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=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w20-v6si1379762pgf.434.2018.09.05.01.38.14; Wed, 05 Sep 2018 01:38:30 -0700 (PDT) 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=@synopsys.com header.s=mail header.b=IXcnuG+U; 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=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727972AbeIENGR (ORCPT + 99 others); Wed, 5 Sep 2018 09:06:17 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:41684 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727100AbeIENGR (ORCPT ); Wed, 5 Sep 2018 09:06:17 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 606BE24E0F33; Wed, 5 Sep 2018 01:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1536136629; bh=QjTKifEaDupr5m7A2b1QDO8t6pxxdbnahqgqXSK1zTA=; h=From:To:CC:Subject:Date:References:From; b=IXcnuG+Um1vX7K2eWjEJGn2I+3cs/BkXeRDXOO8TSw90uC4l/unvwMllnXW2MNkf2 cn4+s0xwJ+bZbN7gnt2378g75PQoZ/25YH2eCFmldWO/JOnEGXiW3eLZXVnkZ8HnEU vc3mOfU+lOPDBIeOMR9OH844s6War6z2SCdh6erkwMhI6yfvQamAyko/aIExQ5JRxt hBVpG4BmZcCSqmgW+xqOO6F8ymxN2RylCu2WHUSGcoXuU5mOnhulW6Fc5LZeKkwb9n 103+xCSHql15DPo6kR9vt7WVVY0hjh0YRMqMcPLBixY27rwlL0KgJc/L0f0ZcnnVPg kGidKMOwh0eyg== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 165C13A38; Wed, 5 Sep 2018 01:37:09 -0700 (PDT) Received: from AM04WEHTCA.internal.synopsys.com (10.116.16.190) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 5 Sep 2018 01:37:07 -0700 Received: from AM04WEMBXA.internal.synopsys.com ([fe80::79c3:55f2:1f20:5bf4]) by am04wehtca.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Wed, 5 Sep 2018 12:37:05 +0400 From: Minas Harutyunyan To: Stefan Wahren , Minas Harutyunyan CC: Grigor Tovmasyan , Doug Anderson , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH RFC] usb: dwc2: power off during shutdown Thread-Topic: [PATCH RFC] usb: dwc2: power off during shutdown Thread-Index: AQHUQdnrerw4ENQnyUeZCj/DHLE7ag== Date: Wed, 5 Sep 2018 08:37:03 +0000 Message-ID: <410670D7E743164D87FA6160E7907A56013A761B2B@am04wembxa.internal.synopsys.com> References: <1535795683-3788-1-git-send-email-stefan.wahren@i2se.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.57] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stefan,=0A= =0A= On 9/1/2018 1:55 PM, Stefan Wahren wrote:=0A= > Currently USB consumes a lot of power after shutting down a Raspberry Pi = 3=0A= > (example setup with Ethernet and a keyboard connected). So power off=0A= > USB on shutdown.=0A= > =0A= > Measured on Raspberry Pi 3B with 4.19rc1/multi_v7_defconfig (HDMI, Ethern= et=0A= > and a keyboard connected)=0A= > =0A= > Before patch: 2.450 W=0A= > After patch: 2.090 W=0A= > =0A= =0A= Could you please elaborate. Power measurements done after shutdown? Why =0A= your setup continue consume power after shutdown? Maybe its =0A= sleep/hibernation mode?=0A= =0A= dwc2 core in your platform which type of power optimization supports: =0A= partial power down, hibernation or extended hibernation? Please provide =0A= me GHWCFG4 register value of your core.=0A= =0A= Thanks,=0A= Minas=0A= =0A= > Signed-off-by: Stefan Wahren =0A= > ---=0A= > drivers/usb/dwc2/platform.c | 31 +++++++++++--------------------=0A= > 1 file changed, 11 insertions(+), 20 deletions(-)=0A= > =0A= > diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c=0A= > index 9a53a58..eeba40a 100644=0A= > --- a/drivers/usb/dwc2/platform.c=0A= > +++ b/drivers/usb/dwc2/platform.c=0A= > @@ -304,17 +304,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg = *hsotg)=0A= > }=0A= > =0A= > /**=0A= > - * dwc2_driver_remove() - Called when the DWC_otg core is unregistered w= ith the=0A= > - * DWC_otg driver=0A= > + * dwc2_driver_shutdown() - Called on device shutdown=0A= > *=0A= > * @dev: Platform device=0A= > - *=0A= > - * This routine is called, for example, when the rmmod command is execut= ed. The=0A= > - * device may or may not be electrically present. If it is present, the = driver=0A= > - * stops device processing. Any resources used on behalf of this device = are=0A= > - * freed.=0A= > */=0A= > -static int dwc2_driver_remove(struct platform_device *dev)=0A= > +static void dwc2_driver_shutdown(struct platform_device *dev)=0A= > {=0A= > struct dwc2_hsotg *hsotg =3D platform_get_drvdata(dev);=0A= > =0A= > @@ -329,27 +323,24 @@ static int dwc2_driver_remove(struct platform_devic= e *dev)=0A= > =0A= > reset_control_assert(hsotg->reset);=0A= > reset_control_assert(hsotg->reset_ecc);=0A= > -=0A= > - return 0;=0A= > }=0A= > =0A= > /**=0A= > - * dwc2_driver_shutdown() - Called on device shutdown=0A= > + * dwc2_driver_remove() - Called when the DWC_otg core is unregistered w= ith the=0A= > + * DWC_otg driver=0A= > *=0A= > * @dev: Platform device=0A= > *=0A= > - * In specific conditions (involving usb hubs) dwc2 devices can create a= =0A= > - * lot of interrupts, even to the point of overwhelming devices running= =0A= > - * at low frequencies. Some devices need to do special clock handling=0A= > - * at shutdown-time which may bring the system clock below the threshold= =0A= > - * of being able to handle the dwc2 interrupts. Disabling dwc2-irqs=0A= > - * prevents reboots/poweroffs from getting stuck in such cases.=0A= > + * This routine is called, for example, when the rmmod command is execut= ed. The=0A= > + * device may or may not be electrically present. If it is present, the = driver=0A= > + * stops device processing. Any resources used on behalf of this device = are=0A= > + * freed.=0A= > */=0A= > -static void dwc2_driver_shutdown(struct platform_device *dev)=0A= > +static int dwc2_driver_remove(struct platform_device *dev)=0A= > {=0A= > - struct dwc2_hsotg *hsotg =3D platform_get_drvdata(dev);=0A= > + dwc2_driver_shutdown(dev);=0A= > =0A= > - disable_irq(hsotg->irq);=0A= > + return 0;=0A= > }=0A= > =0A= > /**=0A= > =0A= =0A=