Message ID | 1535795683-3788-1-git-send-email-stefan.wahren@i2se.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RFC] usb: dwc2: power off during shutdown | expand |
Hi Stefan, On 9/1/2018 1:55 PM, Stefan Wahren wrote: > Currently USB consumes a lot of power after shutting down a Raspberry Pi 3 > (example setup with Ethernet and a keyboard connected). So power off > USB on shutdown. > > Measured on Raspberry Pi 3B with 4.19rc1/multi_v7_defconfig (HDMI, Ethernet > and a keyboard connected) > > Before patch: 2.450 W > After patch: 2.090 W > Could you please elaborate. Power measurements done after shutdown? Why your setup continue consume power after shutdown? Maybe its sleep/hibernation mode? dwc2 core in your platform which type of power optimization supports: partial power down, hibernation or extended hibernation? Please provide me GHWCFG4 register value of your core. Thanks, Minas > Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> > --- > drivers/usb/dwc2/platform.c | 31 +++++++++++-------------------- > 1 file changed, 11 insertions(+), 20 deletions(-) > > diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > index 9a53a58..eeba40a 100644 > --- a/drivers/usb/dwc2/platform.c > +++ b/drivers/usb/dwc2/platform.c > @@ -304,17 +304,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) > } > > /** > - * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the > - * DWC_otg driver > + * dwc2_driver_shutdown() - Called on device shutdown > * > * @dev: Platform device > - * > - * This routine is called, for example, when the rmmod command is executed. The > - * device may or may not be electrically present. If it is present, the driver > - * stops device processing. Any resources used on behalf of this device are > - * freed. > */ > -static int dwc2_driver_remove(struct platform_device *dev) > +static void dwc2_driver_shutdown(struct platform_device *dev) > { > struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); > > @@ -329,27 +323,24 @@ static int dwc2_driver_remove(struct platform_device *dev) > > reset_control_assert(hsotg->reset); > reset_control_assert(hsotg->reset_ecc); > - > - return 0; > } > > /** > - * dwc2_driver_shutdown() - Called on device shutdown > + * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the > + * DWC_otg driver > * > * @dev: Platform device > * > - * In specific conditions (involving usb hubs) dwc2 devices can create a > - * lot of interrupts, even to the point of overwhelming devices running > - * at low frequencies. Some devices need to do special clock handling > - * at shutdown-time which may bring the system clock below the threshold > - * of being able to handle the dwc2 interrupts. Disabling dwc2-irqs > - * prevents reboots/poweroffs from getting stuck in such cases. > + * This routine is called, for example, when the rmmod command is executed. The > + * device may or may not be electrically present. If it is present, the driver > + * stops device processing. Any resources used on behalf of this device are > + * freed. > */ > -static void dwc2_driver_shutdown(struct platform_device *dev) > +static int dwc2_driver_remove(struct platform_device *dev) > { > - struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); > + dwc2_driver_shutdown(dev); > > - disable_irq(hsotg->irq); > + return 0; > } > > /** >
Hi Minas, > Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> hat am 5. September 2018 um 10:37 geschrieben: > > > Hi Stefan, > > On 9/1/2018 1:55 PM, Stefan Wahren wrote: > > Currently USB consumes a lot of power after shutting down a Raspberry Pi 3 > > (example setup with Ethernet and a keyboard connected). So power off > > USB on shutdown. > > > > Measured on Raspberry Pi 3B with 4.19rc1/multi_v7_defconfig (HDMI, Ethernet > > and a keyboard connected) > > > > Before patch: 2.450 W > > After patch: 2.090 W > > > > Could you please elaborate. Power measurements done after shutdown? I did the following: sudo halt wait until "System halted" appears on the screen "measured" the current value displayed on my PSU You are right that not the same as poweroff. But in even in poweroff the board consumes 0.6 W, but in this case USB is powered down. > Why > your setup continue consume power after shutdown? The BCM2835 SoC has a GPU and a ARM core. Linux is running only on the ARM core. The GPU is usually running a close source firmware, which is started at first during boot und runs all the time. > Maybe its > sleep/hibernation mode? There isn't much implementation of power management for BCM2835 yet. So i wanted to start with USB. Even for sleep/hibernation the consumption is much too high. Because the system consumes in idle 1.6 W. > > dwc2 core in your platform which type of power optimization supports: > partial power down, hibernation or extended hibernation? Please provide > me GHWCFG4 register value of your core. AFAIK all RPis use the same USB IP core: GHWCFG4 = 0x1ff00020 Stefan
Hi Stefan, On 9/5/2018 10:42 PM, Stefan Wahren wrote: > Hi Minas, > >> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> hat am 5. September 2018 um 10:37 geschrieben: >> >> >> Hi Stefan, >> >> On 9/1/2018 1:55 PM, Stefan Wahren wrote: >>> Currently USB consumes a lot of power after shutting down a Raspberry Pi 3 >>> (example setup with Ethernet and a keyboard connected). So power off >>> USB on shutdown. >>> >>> Measured on Raspberry Pi 3B with 4.19rc1/multi_v7_defconfig (HDMI, Ethernet >>> and a keyboard connected) >>> >>> Before patch: 2.450 W >>> After patch: 2.090 W >>> >> >> Could you please elaborate. Power measurements done after shutdown? > > I did the following: > > sudo halt > wait until "System halted" appears on the screen > "measured" the current value displayed on my PSU > > You are right that not the same as poweroff. But in even in poweroff the board consumes 0.6 W, but in this case USB is powered down. > >> Why >> your setup continue consume power after shutdown? > > The BCM2835 SoC has a GPU and a ARM core. Linux is running only on the ARM core. The GPU is usually running a close source firmware, which is started at first during boot und runs all the time. > >> Maybe its >> sleep/hibernation mode? > > There isn't much implementation of power management for BCM2835 yet. So i wanted to start with USB. > Even for sleep/hibernation the consumption is much too high. Because the system consumes in idle 1.6 W. > >> >> dwc2 core in your platform which type of power optimization supports: >> partial power down, hibernation or extended hibernation? Please provide >> me GHWCFG4 register value of your core. > > AFAIK all RPis use the same USB IP core: > > GHWCFG4 = 0x1ff00020 Ok, your core doesn't support any power optimization mode. > > Stefan > 1. Could you please explain what is real/physical cause of power saving after your patch: VBUS off, PHY clock stop or any other? 2. Can USB detect remote wake-up signaling from connected keyboard/ethernet before and after your patch? Thanks, Minas
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 9a53a58..eeba40a 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -304,17 +304,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) } /** - * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the - * DWC_otg driver + * dwc2_driver_shutdown() - Called on device shutdown * * @dev: Platform device - * - * This routine is called, for example, when the rmmod command is executed. The - * device may or may not be electrically present. If it is present, the driver - * stops device processing. Any resources used on behalf of this device are - * freed. */ -static int dwc2_driver_remove(struct platform_device *dev) +static void dwc2_driver_shutdown(struct platform_device *dev) { struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); @@ -329,27 +323,24 @@ static int dwc2_driver_remove(struct platform_device *dev) reset_control_assert(hsotg->reset); reset_control_assert(hsotg->reset_ecc); - - return 0; } /** - * dwc2_driver_shutdown() - Called on device shutdown + * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the + * DWC_otg driver * * @dev: Platform device * - * In specific conditions (involving usb hubs) dwc2 devices can create a - * lot of interrupts, even to the point of overwhelming devices running - * at low frequencies. Some devices need to do special clock handling - * at shutdown-time which may bring the system clock below the threshold - * of being able to handle the dwc2 interrupts. Disabling dwc2-irqs - * prevents reboots/poweroffs from getting stuck in such cases. + * This routine is called, for example, when the rmmod command is executed. The + * device may or may not be electrically present. If it is present, the driver + * stops device processing. Any resources used on behalf of this device are + * freed. */ -static void dwc2_driver_shutdown(struct platform_device *dev) +static int dwc2_driver_remove(struct platform_device *dev) { - struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); + dwc2_driver_shutdown(dev); - disable_irq(hsotg->irq); + return 0; } /**
Currently USB consumes a lot of power after shutting down a Raspberry Pi 3 (example setup with Ethernet and a keyboard connected). So power off USB on shutdown. Measured on Raspberry Pi 3B with 4.19rc1/multi_v7_defconfig (HDMI, Ethernet and a keyboard connected) Before patch: 2.450 W After patch: 2.090 W Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> --- drivers/usb/dwc2/platform.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-)