cancel
Showing results for 
Search instead for 
Did you mean: 

USB OTG FS in low power mode

g_marques
Associate II

Hi, 

I'm using a STM32MPU157C with linux 6.6, uboot, OP-TEE 4.0 and TF-A 2.10 and I have a Device Tree (for linux and uboot) which declares the USB OTG node as following :

 

&usbotg_hs {
	compatible = "st,stm32mp15-fsotg", "snps,dwc2";
	pinctrl-names = "default";
	dr_mode = "host";
	pinctrl-0 = <&usbotg_hs_pins &usbotg_fs_dp_dm_pins>;
	vbus-supply = <&vbus_sw>;
	/delete-property/ wakeup-source;
};

usbotg_hs_pins: usbotg-hs-0 {
	pins {
		pinmux = <STM32_PINMUX('A', 10, ANALOG)>; /* OTG_ID */
	};
};
	usbotg_fs_dp_dm_pins: usbotg-fs-dp-dm-0 {
	pins {
		pinmux = <STM32_PINMUX('A', 11, ANALOG)>, /* OTG_FS_DM */
			 <STM32_PINMUX('A', 12, ANALOG)>; /* OTG_FS_DP */
	};
};

I explicitly use it in FS as a Host and remove the wakeup-source declared by the stm32mpu151.dtsi.

My problem is that I can see that when entering in suspend, there is a difference of ~4-5mW in power consumption depending on if the USB node is enabled or not in the device tree. I can't figure out why. (and I'm sure the MPU goes into STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR

If I understand well, default pins are already in their lowest power mode (ANALOG) and the linux dwc2 driver do handle all deactivation of clocks and power rails. 

Did I miss something ? 

Any help is more than welcome,

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Christophe Guibout ,

Thanks for your help :) 

I checked VddUSB and it is disabled when in suspend.

I also checked the application note you gave me and it made me go further into the USB operation mode. This helped me to find the source of the problem.

The culprit is the VBUS that stays connected in suspend. Indeed, I use a STPMIC to power the system and I use its PWR_SW output to power the VBUS signal of USB devices. As I understand, because my usb_otg node is forced in host, the dwc2 driver enables PWR_SW at boot, but never disables it again because it needs it to do autodetection on USB line. When I disabled the USB_OTG node, the VUSB is not needed for detection so it is disabled at suspend.

If I go further in dwc2 driver, when going in suspend in Linux, it goes to suspend for the USB OTG also and does not disable the VUSB. It only disables it if the driver goes through the "stop" path.

I tried to force PWR_SW to be disabled at suspend but without success. Indeed, I added

&vbus_sw {
	standby-ddr-sr {
		regulator-off-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

in my ATF DT and removed the default wakeup-source property present in the OTG device node but VBUS is still enabled in suspend. 

I even tried to remove the vbus-supply property from the node (I also use the same supply for the two other USB ports, so it's enabled at boot but they don't keep it enabled in suspend as they don't do auto-detect). It works when entering in suspend for the first time but when trying to resume it crashes without any logs...

BTW, the initial topic problem is solved, Thank you again for your help :) 

Best regards, 

Gabriel 

 

 

 

 

View solution in original post

2 REPLIES 2
Christophe Guibout
ST Employee

Hello @g_marques,

 

According to my understanding, pins are set in analog in STOP mode, but are OFF is STANDBY. Here, it seems you are in STANDBY as you confirmed the SoC mode is STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR.

 

According with AN5260 Application note, "VDD_USB is enabled in Run, LP-stop and LPLV-stop modes if a USB peripheral is connected to the application. It can be disabled if no USB peripheral is connected. VDD_USB is disabled in Standby and in Off mode."

 

Do you have a peripheral connected on it ?

I would suggest to check if VddUSB is still there in STANDBY to confirm if the issue comes from here.

Feel free to have a look into AN5260, you could find some informations that I miss.

 

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Christophe Guibout ,

Thanks for your help :) 

I checked VddUSB and it is disabled when in suspend.

I also checked the application note you gave me and it made me go further into the USB operation mode. This helped me to find the source of the problem.

The culprit is the VBUS that stays connected in suspend. Indeed, I use a STPMIC to power the system and I use its PWR_SW output to power the VBUS signal of USB devices. As I understand, because my usb_otg node is forced in host, the dwc2 driver enables PWR_SW at boot, but never disables it again because it needs it to do autodetection on USB line. When I disabled the USB_OTG node, the VUSB is not needed for detection so it is disabled at suspend.

If I go further in dwc2 driver, when going in suspend in Linux, it goes to suspend for the USB OTG also and does not disable the VUSB. It only disables it if the driver goes through the "stop" path.

I tried to force PWR_SW to be disabled at suspend but without success. Indeed, I added

&vbus_sw {
	standby-ddr-sr {
		regulator-off-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

in my ATF DT and removed the default wakeup-source property present in the OTG device node but VBUS is still enabled in suspend. 

I even tried to remove the vbus-supply property from the node (I also use the same supply for the two other USB ports, so it's enabled at boot but they don't keep it enabled in suspend as they don't do auto-detect). It works when entering in suspend for the first time but when trying to resume it crashes without any logs...

BTW, the initial topic problem is solved, Thank you again for your help :) 

Best regards, 

Gabriel