• Hello,


    we are trying to mount USB_OTG as mass storage in iMX8X.

    Drivers which we have used for USB_OTG on iMX6 we cannot find in iMX8X. We have used following commands in iMX6:


    Code
    1. insmod /lib/modules/4.1.15-F+S/kernel/fs/configfs/configfs.ko
    2. insmod /lib/modules/4.1.15-F+S/kernel/drivers/usb/gadget/libcomposite.ko
    3. insmod /lib/modules/4.1.15-F+S/kernel/drivers/usb/gadget/function/usb_f_mass_storage.ko
    4. insmod /lib/modules/4.1.15-F+S/kernel/drivers/usb/gadget/legacy/g_mass_storage.ko iSerialNumber=123456 file=/dev/mmcblk0p1 removable=1
    5. mount /dev/mmcblk0p1 /mnt/sdcard


    Problem is there is no "configfs.ko", "libcomposite.ko" and "usb_f_mass_storage.ko" on iMX8X.


    Can you please advise us how to do it on iMX8X.


    Thank you.

  • Hello,


    usually the USB_OTG port should be able to automatically switch between USB Host and USB Device with checking the ID pin. If the ID pin is not used, the USB_OTG can be switched to function as USB Host or USB Device in the device tree under arch/arm64/boot/F+S/efusmx8x.dtsi by changing dr_mode to "host" or "peripheral".

    Code
    1. &usbotg1 {
    2. pinctrl-names = "default";
    3. pinctrl-0 = <&pinctrl_usbotg1>;
    4. fsl,usbphy = <&usbphy1>;
    5. fsl,usbmisc = <&usbmisc1 0>;
    6. over-current-active-low;
    7. dr_mode = "otg";
    8. status = "okay";
    9. };

    However, in the current kernel release 4.14.98 there seems to be a bug in the initialization of the clocks that prevent the USB phy PLL to be locked.


    The next kernel release will be on version 5.4.70 and should be out at the end of March. I already checked the USB_OTG there and it is fully functional.


    In the meantime you can try to use the USB_HOST port. The following configs should be enabled in arch/arm64/configs/fsimx8x_defconfig:

    Code
    1. CONFIG_USB_CDNS3=y
    2. CONFIG_USB_CDNS3_HOST=y
    3. CONFIG_NOP_USB_XCEIV=y

    as well as the following device tree node in arch/arm64/boot/F+S/efusmx8x.dts:

    Code
    1. &usbotg3 {
    2. dr_mode = "host";
    3. status = "okay";
    4. };


    Your F&S Support Team