cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157 USB OTG host mode with internal FS PHY issue

hcodina
Visitor

Hi,

We use the USB OTG controller in host mode with its internal FS PHY.

Our DT node is the following:

&i2c4 {
...
pmic: stpmic@33 {
compatible = "st,stpmic1";
...
regulators {
compatible = "st,stpmic1-regulators";
...
pwr_sw2-supply = <&vin>;
...
vbus_sw: pwr_sw2 {
regulator-name = "vbus_sw";
regulator-active-discharge = <1>;
};
};
};
};

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

&pinctrl {
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 */
};
};
};

This configuration was perfecly working with ST linux v5.10-stm32mp-r2.1.

We bumped ST linux to v6.6-stm32mp-r1 and issues appeared with this controller.

The device enumeration failed when a device is plugged with the following kernel traces

[ 49.310271] usb 1-1: new low-speed USB device number 2 using dwc2
[ 49.530249] usb 1-1: device descriptor read/64, error -71
[ 49.870243] usb 1-1: device descriptor read/64, error -71
[ 50.210243] usb 1-1: new low-speed USB device number 3 using dwc2
[ 50.430255] usb 1-1: device descriptor read/64, error -71
[ 50.770226] usb 1-1: device descriptor read/64, error -71
[ 50.890323] usb usb1-port1: attempt power cycle
[ 51.460226] usb 1-1: new low-speed USB device number 4 using dwc2
[ 51.900229] usb 1-1: device not accepting address 4, error -71
[ 52.120291] usb 1-1: new low-speed USB device number 5 using dwc2
[ 52.560263] usb 1-1: device not accepting address 5, error -71
[ 52.564966] usb usb1-port1: unable to enumerate USB device

Also, the USB detection leading to the enumeration is done only on the first device USB connection. When the device is unplugged and re-plugged, no detection are performed by the kernel and so no enumeration started.

On suspend/resume (PM runtime) a WARN() is triggered on resume process:

# echo +5 > /sys/class/rtc/rtc0/wakealarm && echo mem > /sys/power/state
[ 63.470362] PM: suspend entry (deep)
[ 63.473574] Filesystems sync: 0.000 seconds
[ 63.478270] Freezing user space processes
[ 63.483305] Freezing user space processes completed (elapsed 0.001 seconds)
[ 63.490040] OOM killer disabled.
[ 63.493137] Freezing remaining freezable tasks
[ 63.498836] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 63.506119] printk: Suspending console(s) (use no_console_suspend to debug)
NOTICE: CPU: STM32MP157CAC Rev.Z
NOTICE: Model: xxxxxxxx
NOTICE: BL2: v2.10-stm32mp1-r1.0(release):v2.10-stm32mp-r1-10-ga6bea6a20(a6bea6a2)
NOTICE: BL2: Built : 12:50:23, Apr 16 2025
NOTICE: get_v(b4) 1800
NOTICE: ldo3 bypass
NOTICE: pwr ddr done
NOTICE: BL2: Booting BL32
[ 63.515176] hy463x_ts 0-0038: Failed to enter suspend mode err:-6
[ 63.631633] ------------[ cut here ]------------
[ 63.631662] WARNING: CPU: 0 PID: 135 at drivers/usb/dwc2/core.c:523 dwc2_suspend+0x160/0x200
[ 63.631715] Modules linked in:
[ 63.631741] CPU: 0 PID: 135 Comm: sh Not tainted 6.6.48-gfa392e36fe98 #45
[ 63.631762] Hardware name: STM32 (Device Tree Support)
[ 63.631791] unwind_backtrace from show_stack+0x10/0x14
[ 63.631830] show_stack from dump_stack_lvl+0x40/0x4c
[ 63.631864] dump_stack_lvl from __warn+0xcc/0x15c
[ 63.631898] __warn from warn_slowpath_fmt+0x18c/0x1b0
[ 63.631925] warn_slowpath_fmt from dwc2_suspend+0x160/0x200
[ 63.631952] dwc2_suspend from dpm_run_callback+0x4c/0x178
[ 63.631979] dpm_run_callback from __device_suspend+0x11c/0x534
[ 63.632003] __device_suspend from dpm_suspend+0x114/0x324
[ 63.632029] dpm_suspend from dpm_suspend_start+0x64/0x6c
[ 63.632055] dpm_suspend_start from suspend_devices_and_enter+0xb4/0x834
[ 63.632092] suspend_devices_and_enter from pm_suspend+0x24c/0x2dc
[ 63.632127] pm_suspend from state_store+0x6c/0xc8
[ 63.632160] state_store from kernfs_fop_write_iter+0x118/0x1b4
[ 63.632199] kernfs_fop_write_iter from vfs_write+0x324/0x3f4
[ 63.632232] vfs_write from ksys_write+0xa0/0xd0
[ 63.632255] ksys_write from ret_fast_syscall+0x0/0x54
[ 63.632277] Exception stack(0xdeca5fa8 to 0xdeca5ff0)
[ 63.632296] 5fa0: 00000000 00000001 00000001 005a2260 00000004 b6f37070
[ 63.632314] 5fc0: 00000000 00000001 005a2260 00000004 0059f6bc b6f38cf0 beffb528 00000020
[ 63.632326] 5fe0: 00000000 beffb4f4 004ce500 b6e8db78
[ 63.632370] ---[ end trace 0000000000000000 ]---
[ 63.646249] Disabling non-boot CPUs ...
[ 63.647360] CPU1 killed.
[ 63.648102] Enabling non-boot CPUs ...
[ 63.649611] CPU1 is up
[ 63.913955] usb usb3: root hub lost power or was reset
[ 63.914063] usb usb2: root hub lost power or was reset
[ 64.282182] OOM killer enabled.
[ 64.285715] Restarting tasks ... done.
[ 64.292430] random: crng reseeded on system resumption
[ 64.298032] PM: suspend exit
#

Those issues seems to be a kernel regression but I didn't succeed in identifying the root cause.

Did anyone encounter this issue? Any advice or clue will be appreciated.

Best regards,

Herve

0 REPLIES 0