Hi,
On the IMX8ULP EVK9, I’m able to use eMMC as a USB mass storage device using the following steps:
modprobe libcomposite
cd /sys/kernel/config/usb_gadget/
mkdir g1
cd g1
# Basic device descriptor info
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice
echo 0x0200 > bcdUSB
mkdir strings/0x409
echo "1234567890" > strings/0x409/serialnumber
echo "NXP" > strings/0x409/manufacturer
echo "i.MX8ULP Mass Storage" > strings/0x409/product
# Create configuration
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "Mass Storage Config" > configs/c.1/strings/0x409/configuration
# Add mass storage function
mkdir functions/mass_storage.0
echo 1 > functions/mass_storage.0/stall
echo 0 > functions/mass_storage.0/lun.0/ro
echo 0 > functions/mass_storage.0/lun.0/nofua
echo /dev/mmcblk0p3 > functions/mass_storage.0/lun.0/file
# Bind the function to the config
ln -s functions/mass_storage.0 configs/c.1/
# Bind USB device to UDC
ls /sys/class/udc # This gives you the UDC name, like 49000000.usb
echo ci_hdrc.0 > UDC
This works fine on the EVK and my PC detects the USB storage.
However, on my custom board, I follow the exact same steps but USB storage is not detected on the PC.
My custom board only connects USB D+, D-, and USB_ID lines. I have set USB_ID with a pull-up. On the EVK, they also have USB_VBUS_DETECT and USB_OC pins, but in my custom board those pins are floating and not used.
Do I need to modify the Yocto Device Tree (DTS) to ignore or disable the USB_VBUS_DETECT and USB_OC pins?
Here is my current USB node in the DTS:
&usbotg1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&pinctrl_otgid1>;
pinctrl-1 = <&pinctrl_otgid1>;
dr_mode = "otg";
hnp-disable;
srp-disable;
adp-disable;
over-current-active-low;
status = "okay";
};
Do I need to update anything else in the DTS or kernel to make this work on my custom board?
Thanks in advance!
Regards
Yash Parekh