Skip to contentSkip to conversation

USB: host: ohci-at91: tailor power consumption

PATCH In review Nicolas Ferre 2 participants 5 messages Sep 11, 2019

Subsystems (3)
lore
Share & tools
lore

Nicolas Ferre

author maintainer
#0 lore raw

cover USB: host: ohci-at91: tailor power consumption

Following a set of experiments we found areas of improvement for OHCI power consumption (and associated USB analog cells).
This enhances the shutdown of residual power consumption in case of Linux suspend/resume and removal of the driver (when compiled as a module).

Best regards,
Nicolas

Boris Krasnovskiy (2):
USB: host: ohci-at91: completely shutdown the controller in

    at91_stop_hc()

USB: host: ohci-at91: resume: balance the clock start call

Nicolas Ferre (1):
USB: host: ohci-at91: suspend: delay needed before to stop clocks

 drivers/usb/host/ohci-at91.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH 1/3 USB: host: ohci-at91: completely shutdown the controller in at91_stop_hc()

From: Boris Krasnovskiy <[email protected]>

When removing the ohci-at91 module, the fact of not running complete shutdown of all the ports was keeping additional analog cells consuming power for no reason.
Doing Reset (OHCI_HCR) to HcCommandStatus register is the way to go, but using the OHCI controller shutdown procedure is just perfect for this.

---
 drivers/usb/host/ohci-at91.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-at91.c +1 -1
index fc35a7993b7b..cb63bcd5049a 100644
@@ -123,7 +123,7 @@ static void at91_stop_hc(struct platform_device *pdev)
 	/*
 	 * Put the USB host controller into reset.
 	 */
-	writel(0, &regs->control);
+	usb_hcd_platform_shutdown(pdev);
 
 	/*
 	 * Stop the USB clocks.
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/3 USB: host: ohci-at91: suspend: delay needed before to stop clocks

In reply to Nicolas Ferre

In order to completely remove marginal power consumption in PM suspend, we need to let the controller settle down before being stopped. In ohci_hcd_at91_drv_suspend() function, one additional delay is needed before to stop the clocks.

---
 drivers/usb/host/ohci-at91.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-at91.c +1 -0
index cb63bcd5049a..85d67fe42d59 100644
@@ -628,6 +628,7 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
 
 		/* flush the writes */
 		(void) ohci_readl (ohci, &ohci->regs->control);
+		msleep(1);
 		at91_stop_clock(ohci_at91);
 	}
 
Signature · 1 line
2.17.1
author maintainer
#3 lore raw

PATCH 3/3 USB: host: ohci-at91: resume: balance the clock start call

In reply to Nicolas Ferre

From: Boris Krasnovskiy <[email protected]>

There is a clock enable counter run away problem in resume ohci_at91. Code enables clock that was never disabled in case of non wakeup interface. That would make clock unstoppable in future.
Use proper alternative to start clocks only if they were stopped before.

---
 drivers/usb/host/ohci-at91.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +2 -2
index 85d67fe42d59..513e48397743 100644
@@ -643,8 +643,8 @@ ohci_hcd_at91_drv_resume(struct device *dev)
 
 	if (ohci_at91->wakeup)
 		disable_irq_wake(hcd->irq);
-
-	at91_start_clock(ohci_at91);
+	else
+		at91_start_clock(ohci_at91);
 
 	ohci_resume(hcd, false);
 
Signature · 1 line
2.17.1
maintainer Acked-by on the v1 series
#4 lore raw
In reply to Nicolas Ferre
Quoted 10 lines · Nicolas Ferre

Following a set of experiments we found areas of improvement for OHCI power consumption (and associated USB analog cells).
This enhances the shutdown of residual power consumption in case of Linux suspend/resume and removal of the driver (when compiled as a module).

Best regards,
Nicolas

Boris Krasnovskiy (2):
USB: host: ohci-at91: completely shutdown the controller in

Quoted 8 lines
    at91_stop_hc()

USB: host: ohci-at91: resume: balance the clock start call

Nicolas Ferre (1):
USB: host: ohci-at91: suspend: delay needed before to stop clocks

 drivers/usb/host/ohci-at91.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

For all three patches: