cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1: USB OTG: wake up when USB plugged/unplugged

QuentinWit
Associate

Hello,

I am currently using a STM32MP157C. The OTG controller is used to add a USB device port with the OTG FS PHY transceiver.

The signals connected are:

  • OTG_FS_DP
  • OTG_FS_DM
  • OTG_VBUS

I made the following configuration in the device tree:

 

usbotg_no_id_pin: usbotg-no-id-pin {};
usbotg_fs_dp_dm_pins_a: usbotg-fs-dp-dm-0 {
	pins {
		pinmux = <STM32_PINMUX('A', 11, ANALOG)>, // OTG_FS_DM
			<STM32_PINMUX('A', 12, ANALOG)>; // OTG_FS_DP
	};
};

&usbotg_hs{
	status = "okay";
	compatible = "st,stm32mp15-fsotg", "snps,dwc2";
	pinctrl-names = "default";
	pinctrl-0 = <&usbotg_no_id_pin &usbotg_fs_dp_dm_pins_a>;
	dr_mode = "peripheral";
	usb-role-switch;
	snps,need-phy-for-wake
	role-switch-default-mode = "peripheral";
};

 

The USB device port is working correctly with the gadget serial driver.

Once the board is suspended (with echo mem > /sys/power/state), I would like to wake it up when I plug or unplug an USB host. Or in others words, when a voltage modification is detected on VBUS. Does some one know if this is possible ?

According to the reference manual (RM0436, p3118): "OTG_WKUP becomes active (high state) when resume condition occurs during L1 SLEEP or L2 SUSPEND states.". Should I understand that this is the only way to wake up the STM32MP1 with the OTG controller ?

Thank you for any help you can give,

Quentin

 

0 REPLIES 0