2022-09-17 05:35 PM
Hello!
I've got a problem configuring USB OTG on a board based on the STM32MP157C. This is actually the Odyssey board by Seeed Studio, which is not directly supported by STLinux as far as I know. Actually we have custom hardware with the STM32MP157C SOM, but since the problem is reproducible on their development board, that is easier to follow for everybody else. I have already posted this question in their support forum but would like to hear your opinion as well.
The Yocto firmware I am testing on is based on meta-st-stm32mp (openstlinux-5.10-dunfell-mp1-21-03-31). I got the same behavior with the hardknott branch which is not surprising since the kernel did not change.
This is from the device tree:
&usbh_ehci {
phys = <&usbphyc_port0>;
status = "okay";
};
&usbh_ohci{
status = "okay";
phys = <&usbphyc_port0>;
};
&usbotg_hs {
compatible = "st,stm32mp15-fsotg", "snps,dwc2";
pinctrl-names = "default";
/* configure OTG ID and full-speed data pins */
pinctrl-0 = <&usbotg_hs_pins_a &usbotg_fs_dp_dm_pins_a>;
dr_mode = "peripheral";
// vbus-supply = <&vbus_otg>;
status = "okay";
};
&usbphyc {
status = "okay";
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
st,phy-tuning = <&usb_phy_tuning>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
st,phy-tuning = <&usb_phy_tuning>;
};
The usbotg_hs is configured according to the Wiki, i.e. I am trying to activate the full-speed USB PHY, so I can use two high-speed USB host ports simultaneously with USB OTG/peripheral.
stm32mp157c-odyssey-som.dtsi is included, but it has been patched by Seeed. The regulators are as follows (at least the ones including "otg" and "usb" - I don't really understand much about that part of the hardware):
vbus_otg: pwr_sw1 {
regulator-name = "vbus_otg";
interrupts = <IT_OCP_OTG 0>;
};
vdd_usb: ldo4 {
regulator-name = "vdd_usb";
interrupts = <IT_CURLIM_LDO4 0>;
};
They also patched in this:
usb_phy_tuning: usb-phy-tuning {
st,hs-dc-level = <2>;
st,fs-rftime-tuning;
st,hs-rftime-reduction;
st,hs-current-trim = <15>;
st,hs-impedance-trim = <1>;
st,squelch-level = <3>;
st,hs-rx-offset = <2>;
st,no-lsfs-sc;
};
The kernel log contains the following:
# uname -a
Linux stm32mp1 5.10.10 #1 SMP PREEMPT Sat Jan 23 15:04:06 UTC 2021 armv7l armv7l armv7l GNU/Linux
# dmesg | grep -i 'usb\|otg'
[ 0.116607] usbcore: registered new interface driver usbfs
[ 0.116698] usbcore: registered new interface driver hub
[ 0.116775] usbcore: registered new device driver usb
[ 1.597671] usb33: supplied by regulator-dummy
[ 1.651070] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[ 1.651170] usbcore: registered new interface driver pegasus
[ 1.651256] usbcore: registered new interface driver asix
[ 1.651322] usbcore: registered new interface driver ax88179_178a
[ 1.651404] usbcore: registered new interface driver cdc_ether
[ 1.651489] usbcore: registered new interface driver smsc75xx
[ 1.651572] usbcore: registered new interface driver smsc95xx
[ 1.651638] usbcore: registered new interface driver net1080
[ 1.651702] usbcore: registered new interface driver cdc_subset
[ 1.651764] usbcore: registered new interface driver zaurus
[ 1.652034] usbcore: registered new interface driver cdc_ncm
[ 1.653206] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.653742] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.654665] usbcore: registered new interface driver usb-storage
[ 1.666519] usbcore: registered new interface driver usbhid
[ 1.666537] usbhid: USB HID core driver
[ 3.033713] dwc2 49000000.usb-otg: supply vusb_d not found, using dummy regulator
[ 3.040039] dwc2 49000000.usb-otg: supply vusb_a not found, using dummy regulator
[ 3.059805] dwc2 49000000.usb-otg: dwc2_core_reset: HANG! Soft Reset timeout GRSTCTL_CSFTRST
[ 3.067320] dwc2: probe of 49000000.usb-otg failed with error -16
[ 3.215653] vdd_usb: supplied by vin
[ 3.241790] vbus_otg: supplied by bst_out
[ 3.367847] stm32-usbphyc 5a006000.usbphyc: registered rev:1.0
[ 3.382950] ehci-platform 5800d000.usbh-ehci: EHCI Host Controller
[ 3.391177] ehci-platform 5800d000.usbh-ehci: new USB bus registered, assigned bus number 1
[ 3.406750] ehci-platform 5800d000.usbh-ehci: irq 59, io mem 0x5800d000
[ 3.442739] ehci-platform 5800d000.usbh-ehci: USB 2.0 started, EHCI 1.00
[ 3.451542] hub 1-0:1.0: USB hub found
[ 3.465121] ohci-platform 5800c000.usbh-ohci: Generic Platform OHCI controller
[ 3.470949] ohci-platform 5800c000.usbh-ohci: new USB bus registered, assigned bus number 2
[ 3.496722] ohci-platform 5800c000.usbh-ohci: irq 52, io mem 0x5800c000
[ 3.577692] hub 2-0:1.0: USB hub found
Unfortunately, there is not even an UDC controller in /sys/class/udc. As far as I understand, this is because the dwc2 driver fails ("probe of 49000000.usb-otg failed with error -16").
Creating USB gadgets via configfs subsequently cannot work.
Furthermore with this configuration, only one of the USB host ports works - the other one has power but does not detect any devices plugged in.
Perhaps somebody knows what I could try to get this to work.
2022-09-26 08:49 AM
I'm having the same issue. Is there any example where the FS-OTG works with Linux Kernel 5.10+?
2023-02-10 09:57 PM
Did you find any solution to this problem?
2023-02-13 08:37 AM
Yes. This post should shed some clarity: https://forum.seeedstudio.com/t/odyssey-stm32mp157c-cannot-activate-full-speed-usb-otg/266147/16
If you want me to post my pertinent device tree info I can do that as well.