Skip to contentSkip to conversation

AM437x: USB DWC3: save power during system sleep

PATCH New Sekhar Nori 1 participant 3 messages Aug 31, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover AM437x: USB DWC3: save power during system sleep

Hi,

This series add support to DWC3 core to conserve power during system sleep by setting the USB DRVVBUS line to a lower power consuming state.

Tested to make sure USB host and device works on AM437x with v4.2. Tested for power savings on v4.1 kernel where there is an implementation of suspend- to-RAM for AM437x available.

Dave Gerlach (1):
ARM: dts: am437x-gp-evm: Add pinctrl states for usb

Sekhar Nori (1):
usb: dwc3: support for pinctrl state change during system sleep

 arch/arm/boot/dts/am437x-gp-evm.dts | 30 ++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.c             |  4 ++++
 2 files changed, 34 insertions(+)
Signature · 1 line
2.4.4.408.g16da57c
#1 lore raw

PATCH 1/2 usb: dwc3: support for pinctrl state change during system sleep

Add support for USB DRVVBUS pinctrl state change during suspend/resume. This helps is conserving power during system sleep.

---
 drivers/usb/dwc3/core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/dwc3/core.c +4 -0
index ff5773c66b84..a5ffa66e39fb 100644
@@ -1093,6 +1093,8 @@ static int dwc3_suspend(struct device *dev)
 	phy_exit(dwc->usb2_generic_phy);
 	phy_exit(dwc->usb3_generic_phy);
 
+	pinctrl_pm_select_sleep_state(dev);
+
 	return 0;
 }
 
@@ -1102,6 +1104,8 @@ static int dwc3_resume(struct device *dev)
 	unsigned long	flags;
 	int		ret;
 
+	pinctrl_pm_select_default_state(dev);
+
 	usb_phy_init(dwc->usb3_phy);
 	usb_phy_init(dwc->usb2_phy);
 	ret = phy_init(dwc->usb2_generic_phy);
Signature · 1 line
2.4.4.408.g16da57c
#2 lore raw

PATCH 2/2 ARM: dts: am437x-gp-evm: Add pinctrl states for usb

In reply to Sekhar Nori

From: Dave Gerlach <[email protected]>

Add pinctrl default and sleep states for each usb device. The only pin that can be controlled is USB_DRVVBUS, this must be set to MUX_MODE7 (gpio) during sleep to conserve power.

[nsekhar at ti.com: move pins to core dwc3]
---
 arch/arm/boot/dts/am437x-gp-evm.dts | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/boot/dts/am437x-gp-evm.dts +30 -0
index 84aa30c3235a..2e990a5f9e95 100644
@@ -409,6 +409,30 @@
 			0x234 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart3_rtsn.uart3_rtsn */
 		>;
 	};
+
+	usb1_pins_default: usb1_pins_default {
+		pinctrl-single,pins = <
+			0x2c0 (DS0_PULL_UP_DOWN_EN | PIN_INPUT_PULLDOWN | MUX_MODE0)
+		>;
+	};
+
+	usb1_pins_sleep: usb1_pins_sleep {
+		pinctrl-single,pins = <
+			0x2c0 (DS0_PULL_UP_DOWN_EN | PIN_INPUT_PULLDOWN | MUX_MODE7)
+		>;
+	};
+
+	usb2_pins_default: usb2_pins_default {
+		pinctrl-single,pins = <
+			0x2c4 (DS0_PULL_UP_DOWN_EN | PIN_INPUT_PULLDOWN | MUX_MODE0)
+		>;
+	};
+
+	usb2_pins_sleep: usb2_pins_sleep {
+		pinctrl-single,pins = <
+			0x2c4 (DS0_PULL_UP_DOWN_EN | PIN_INPUT_PULLDOWN | MUX_MODE7)
+		>;
+	};
 };
 
 &i2c0 {
@@ -615,6 +639,9 @@
 &usb1 {
 	dr_mode = "peripheral";
 	status = "okay";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&usb1_pins_default>;
+	pinctrl-1 = <&usb1_pins_sleep>;
 };
 
 &usb2_phy2 {
@@ -624,6 +651,9 @@
 &usb2 {
 	dr_mode = "host";
 	status = "okay";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&usb2_pins_default>;
+	pinctrl-1 = <&usb2_pins_sleep>;
 };
 
 &mac {
Signature · 1 line
2.4.4.408.g16da57c