AnsweredAssumed Answered

g_mass_storage is not working on i.mx6q

Question asked by JUNG CHUL on Apr 24, 2019
Latest reply on Apr 28, 2019 by jimmychan

My env is imx6q, kernel 4.9.11 (evm board + windows7 pc)

I run modprobe, it looks like no problem. but when i plugged otg cable, no action occurs.

What should I check more? thank you.

 

> script

FILE=/dev/shm/20M

dd if=/dev/zero of=$FILE bs=1M count=20

 

# mkfs, mount test

modprobe g_mass_storage file=$FILE stall=0 removable=1

 

 

> my log

[ 114.613542] udc ci_hdrc.0: registering UDC driver [g_mass_storage]
[ 114.613610] Mass Storage Function, version: 2009/09/11
[ 114.617508] LUN: removable file: (no medium)
[ 114.620730] lun0: open backing file: /dev/shm/20M
[ 114.620743] LUN: removable file: /dev/shm/20M
[ 114.623819] Number of LUNs=1
[ 114.625413] g_mass_storage gadget: adding config #1 'Linux File-Backed Storage'/7f03c63c
[ 114.625425] g_mass_storage gadget: adding 'Mass Storage Function'/d8ce5a80 to config 'Linux File-Backed Storage'/7f03c63c
[ 114.625571] g_mass_storage gadget: I/O thread pid: 466
[ 114.625596] g_mass_storage gadget: cfg 1/7f03c63c speeds: high full
[ 114.625604] g_mass_storage gadget: interface 0 = Mass Storage Function/d8ce5a80
[ 114.625618] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 114.631416] g_mass_storage gadget: g_mass_storage ready

 

> file system

root@localhost:~> lsmod
Module Size Used by
g_mass_storage 4516 0
usb_f_mass_storage 43408 2 g_mass_storage
libcomposite 46541 2 g_mass_storage,usb_f_mass_storage
configfs 28232 3 usb_f_mass_storage,libcomposite
mxc_dcic 6640 0

 

root@localhost:/lib/modules/4.9.11-g4eb3de5-dirty/kernel/drivers/usb/gadget/function>
total 360
drwxrwxr-x 2 localhost tracing 4096 Apr 24 09:19 .
drwxrwxr-x 4 localhost tracing 4096 Apr 24 09:19 ..
-rw-rw-r-- 1 localhost  tracing 24228 Apr 24 09:19 u_ether.ko
-rw-rw-r-- 1 localhost tracing 21792 Apr 24 09:19 u_serial.ko
-rw-rw-r-- 1 localhost tracing 13864 Apr 24 09:19 usb_f_acm.ko
-rw-rw-r-- 1 localhost tracing 17868 Apr 24 09:19 usb_f_ecm.ko
-rw-rw-r-- 1 localhost tracing 13196 Apr 24 09:19 usb_f_ecm_subset.ko
-rw-rw-r-- 1 localhost tracing 16484 Apr 24 09:19 usb_f_eem.ko
-rw-rw-r-- 1 localhost tracing 52828 Apr 24 09:19 usb_f_fs.ko
-rw-rw-r-- 1 localhost tracing 64676 Apr 24 09:19 usb_f_mass_storage.ko
-rw-rw-r-- 1 localhost tracing 27316 Apr 24 09:19 usb_f_ncm.ko
-rw-rw-r-- 1 localhost tracing 10760 Apr 24 09:19 usb_f_obex.ko
-rw-rw-r-- 1 localhost tracing 33904 Apr 24 09:19 usb_f_rndis.ko
-rw-rw-r-- 1 localhost tracing 9620 Apr 24 09:19 usb_f_serial.ko
-rw-rw-r-- 1 localhost tracing 25232 Apr 24 09:19 usb_f_ss_lb.ko

 

root@localhost:/lib/modules/4.9.11-g4eb3de5-dirty/kernel/drivers/usb/gadget/legacy>
total 112
drwxrwxr-x 2 localhost tracing 4096 Apr 24 09:19 .
drwxrwxr-x 4 localhost tracing 4096 Apr 24 09:19 ..
-rw-rw-r-- 1 localhost tracing 13372 Apr 24 09:19 g_ether.ko
-rw-rw-r-- 1 localhost tracing 13320 Apr 24 09:19 g_mass_storage.ko
-rw-rw-r-- 1 localhost tracing 10864 Apr 24 09:19 g_ncm.ko
-rw-rw-r-- 1 localhost tracing 11380 Apr 24 09:19 g_serial.ko
-rw-rw-r-- 1 localhost tracing 16268 Apr 24 09:19 g_zero.ko
-rw-rw-r-- 1 localhost tracing 31932 Apr 24 09:19 gadgetfs.ko

 

> kernel config


309 CONFIG_USB=y
310 CONFIG_USB_OTG_WHITELIST=y
311 CONFIG_USB_EHCI_HCD=y
312 CONFIG_USB_EHCI_MXC=y
313 CONFIG_USB_HCD_TEST_MODE=y
314 CONFIG_USB_ACM=m
315 CONFIG_USB_STORAGE=y
316 CONFIG_USB_CHIPIDEA=y
317 CONFIG_USB_CHIPIDEA_UDC=y
318 CONFIG_USB_CHIPIDEA_HOST=y
319 CONFIG_USB_SERIAL=m
320 CONFIG_USB_SERIAL_GENERIC=y
321 CONFIG_USB_SERIAL_FTDI_SIO=m
322 CONFIG_USB_SERIAL_OPTION=m
323 CONFIG_USB_TEST=m
324 CONFIG_USB_EHSET_TEST_FIXTURE=y
325 CONFIG_NOP_USB_XCEIV=y
326 CONFIG_USB_MXS_PHY=y
327 CONFIG_USB_GADGET=y
328 CONFIG_USB_CONFIGFS=m
329 CONFIG_USB_CONFIGFS_SERIAL=y
330 CONFIG_USB_CONFIGFS_ACM=y
331 CONFIG_USB_CONFIGFS_OBEX=y
332 CONFIG_USB_CONFIGFS_NCM=y
333 CONFIG_USB_CONFIGFS_ECM=y
334 CONFIG_USB_CONFIGFS_ECM_SUBSET=y
335 CONFIG_USB_CONFIGFS_RNDIS=y
336 CONFIG_USB_CONFIGFS_EEM=y
337 CONFIG_USB_CONFIGFS_MASS_STORAGE=y
338 CONFIG_USB_CONFIGFS_F_LB_SS=y
339 CONFIG_USB_CONFIGFS_F_FS=y
340 CONFIG_USB_ZERO=m
341 CONFIG_USB_ETH=m
342 CONFIG_USB_G_NCM=m
343 CONFIG_USB_GADGETFS=m
344 CONFIG_USB_MASS_STORAGE=m
345 CONFIG_USB_G_SERIAL=m

 

465 CONFIG_USB_OTG=y
466 CONFIG_USB_OTG_FSM=y
467 CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
468 CONFIG_USB_GADGET_DEBUG=y
469 CONFIG_USB_GADGET_VERBOSE=y
470 CONFIG_USB_MV_UDC=y
471 CONFIG_USB_XHCI_HCD=y
472 CONFIG_USB_XHCI_PLATFORM=y

 

> my dts

&usbotg {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_usbotg>;
    disable-over-current;
    srp-disable;
    hnp-disable;
    adp-disable;
    status = "okay";
};
        pinctrl_usbotg: usbotggrp {
            fsl,pins = <
                MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID   0x17059
            >;
        };

Outcomes