cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP15 ECO 5.0 USB gadget: couldn't find an available UDC

debugging
Senior III

Custom SMT32MP15 board connected via the micro USB to a host PC. This board has HDMI via an RGB to HDMI chip but here PA10 is only used for USB OTG-ID)  (there was another post on this about HDMI). Build kernel from ECO 5.0.  The Gadget functions worked fine with ECO 1.

On the host PC lsusb shows : ID 1d6b:0104 Linux Foundation Multifunction Composite Gadget

This would seems the gadget driver is working the  board is in device mode. (right ?)

ls /sys/kernel/debug/usb/49000000.usb-otg/
dr_mode ep1in ep2in ep3in ep4in ep5in ep6in ep7in ep8in fifo params state
ep0 ep1out ep2out ep3out ep4out ep5out ep6out ep7out ep8out hw_params regdump testmode

Board  dts  entries:  (based on the board entries form ECO 1.0 and ST Wiki)

Note: only added this in the kerne; dts, not in uboot.

 
&usbotg_hs
{
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
pinctrl-names = "default";
pinctrl-0 = <&usbotg_hs_pins_a>;
dr_mode = "otg";
phy-names = "usb2-phy";
// Note enabling usb-role-switch cause Linux Foundation Multifunction Composite Gadget NOT appear on the host
//usb-role-switch;
vbus-supply = <&vbus_otg>;
// added because kernel boot showed these were not found. vbus-otg seemed not enough
vusb_d = <&vdd_usb>;
vusb_a = <&vdd_usb>;
//vbus-supply = <&vdd_usb>;
g-rx-fifo-size = <256>;
g-np-tx-fifo-size = <32>;
g-tx-fifo-size = <128 128 128 128 64 32 16 16>;
status = "okay";
};

in pinctrl section user code  (the board with ECO 1 used this entry for PA10)

usbotg_hs_pins_a: usbotg_hs-0 {
pins {
pinmux = <STM32_PINMUX('A', 10, ANALOG)>; /* OTG_ID */
};
};

ls /sys/class/udc/49000000.usb-otg
a_alt_hnp_support b_hnp_enable device is_a_peripheral is_selfpowered power srp subsystem
a_hnp_support current_speed function is_otg maximum_speed soft_connect state uevent

 

After creating all the gadget file systems entries

root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo 0x1235 > idVendor
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo 0x800c > idProduct
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# mkdir strings/0x409
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo 1234567890 > strings/0x409/serialnumber
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo Manufacturer_1 > strings/0x409/manufacturer
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo Product > strings/0x409/product
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# mkdir configs/c.1
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# mkdir configs/c.1/strings/0x409
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo "Conf 1" > configs/c.1/strings/0x409/configuration
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo 120 > configs/c.1/MaxPower
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# ls configs/c.1
MaxPower bmAttributes strings
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# ln -s functions/midi.usb0 configs/c.1
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# ln -s functions/midi.usb1 configs/c.1
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# name="$(ls /sys/class/udc)"
root@stm32mp1:/sys/kernel/config/usb_gadget/g2# echo $name > UDC
[ 288.583969] UDC core: g2: couldn't find an available UDC or it's busy
sh: write error: Device or resource busy

root@stm32mp1:/sys/kernel/config/usb_gadget/g2# ls /sys/class/udc
49000000.usb-otg

 

in dmesg this was found:

[ 16.422555] dwc2 49000000.usb-otg: bound driver configfs-gadget.g1

moving the the gadget folder

cat UDC
49000000.usb-otg
root@stm32mp1:/sys/kernel/config/usb_gadget/g1# echo "" >UDC
root@stm32mp1:/sys/kernel/config/usb_gadget/g1# echo "49000000.usb-otg" > UDC
[ 1691.036019] stm32mp157-pinctrl soc:pinctrl@50002000: pin PA10 already requested by 49000000.usb-otg; cannot claim for gadget.0
[ 1691.046283] stm32mp157-pinctrl soc:pinctrl@50002000: pin-10 (gadget.0) status -22
[ 1691.053497] stm32mp157-pinctrl soc:pinctrl@50002000: could not request pin 10 (PA10) from group PA10 on device soc:pinctrl@50002000
[ 1691.065508] configfs-gadget.g1 gadget.0: Error applying setting, reverse things back
[ 1691.073372] UDC core: g1: couldn't find an available UDC or it's busy
sh: write error: Device or resource busy
root@stm32mp1:/sys/kernel/config/usb_gadget/g1

 

Any ideas what/how to debug the root cause ?

 

0 REPLIES 0