Issue with USB OTG in device mode with mass storage gadget driver in i.MX6

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with USB OTG in device mode with mass storage gadget driver in i.MX6

Jump to solution
19,274 Views
krishnanp
Contributor III

Hello there Greetings.

Kernel:3.10.9

Board: i.MX6  Solo based  custom board.

Step 1: load the mass storage driver

insmod g_mass_storage.ko file=/dev/mtdblock5

calling  msg_init+0x0/0x1c [g_mass_storage] @ 381

initcall msg_init+0x0/0x1c [g_mass_storage] returned -19 after 1549 usecs

insmod: can't insert 'g_mass_storage.ko': No such device

Step 2: dmesg

calling  msg_init+0x0/0x1c [g_mass_storage] @ 388

couldn't find an available UDC

initcall msg_init+0x0/0x1c [g_mass_storage] returned -19 after 1606 usecs

calling  msg_init+0x0/0x1c [g_mass_storage] @ 389

couldn't find an available UDC

initcall msg_init+0x0/0x1c [g_mass_storage] returned -19 after 1570 usecs

I am stuck with this error. Appreciate any pointers ...

Regards,

Krishnan.

Labels (1)
Tags (2)
1 Solution
1,701 Views
krishnanp
Contributor III

Dear Eric,

Thanks for the suggestions. It was a problem with UDC controller driver.  I have enabled chip idea hdr controller  driver in kernel

Now the  g_mass_storage works fine

USB_udc.png

root@imx6qsabrelite:/# insmod g_mass_storage.ko file=/dev/mtdblock5

calling  msg_init+0x0/0x1c [g_mass_storage] @ 421

g_mass_storage gadget: Mass Storage Function, version: 2009/09/11

g_mass_storage gadget: Number of LUNs=1

lun0: LUN: file: /dev/mtdblock5

g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11

g_mass_storage gadget: userspace failed to provide iSerialNumber

g_mass_storage gadget: g_mass_storage ready

initcall msg_init+0x0/0x1c [g_mass_storage] returned 0 after 30566 usecs

root@imx6qsabrelite:/# g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

root@imx6qsabrelite:/# g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

View solution in original post

7 Replies
1,701 Views
krishnanp
Contributor III

It looks like I have some  problem in VBUS configuration. Th USB_OTG_ID pad was left unconnected on the board.

In the dts file i have added below code to enable OTG support.

&usbotg {

        vbus-supply = <&reg_usb_otg_vbus>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_usbotg_1>;

        disable-over-current;

        status = "okay";

};


One more experiment done was compiling g_mass_storage driver statically. But at this time I am not able  change the file paramter.

In kernel configuration i have selected below options.

kconfig.png

under USB Peripheral Controller

<*> Freescale Highspeed USB DR Peripheral Controller  

I have added some debug prints in drivers/usb/gadget/udc-core.c where the probe is happening. It says probe could not find USB device controller driver.

I am  little lost  how to proceed. Any pointers/help will be much appreciated.

Thanks in advance

Krishnan

1,701 Views
krishnanp
Contributor III

Any  pointers?

0 Kudos
1,701 Views
EricNelson
Senior Contributor II

Hi Krishnan,


This may be an issue with the pad configurations for Solo.

We didn't have support for Dual-Lite/Solo in our 3.10.9 release, but USB OTG was supported on i.MX6Q:

     http://boundarydevices.com/imx6-linux-kernel-3-10-9/

We have recently tested on 3.10.17, notably on our Nitrogen6_Lite board:

     http://boundarydevices.com/mx6-linux-kernel-3-10-17-beta/

You can compare your configuration against nit6xlite_defconfig and your DTS files against
imx6dl-nit6xlite.dts in in this tree:

     linux-imx6/arch/arm/boot/dts at boundary-imx_3.10.17_1.0.0_beta · boundarydevices/linux-imx6 · GitHu...

We tested using g_ether, not g_mass_storage, but the detection and registration

should be the same.

1,701 Views
alexkuo
Contributor I

Hello Eric, 

I try to establish 1 HID and 1 mass storage at same time. 

I already have enabled "ChipIdea Highspeed Dual Role Controller", HID and mass storage features in kernel(menuconfig). But I get an error message "udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers". 

I try to modified core.c but it's not work. I have trawled through many articles with no luck. Does it have efficient way to modify USB descriptor for 1 HID and 1 Mass Storage at same time?

(imx6ull14x14evk-poky-linux-gnueabi\linux-imx\4.9.11-r0\git\drivers\usb\gadget\udc\core.c)

Thank you.

Situation 1:

Step 1: insmod g_hid.ko       <=======  HID is work normally
Step 2: insmod g_mass_storage.ko          <====== show error message
udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers


Situation 2:
Step 1: insmod g_mass_storage.ko          <======  mass storage is work normally
Step 2: insmod g_hid.ko       <=======  show error message

udc-core: couldn't find an available UDC - added [g_hid] to list of pending drivers

0 Kudos
1,701 Views
sandeep_yenugul
Contributor III

Hi, 

How did you solved this issue of udc not available.

0 Kudos
1,701 Views
marcomadrigal
Contributor III

Hi,

You can not load two gadget drivers simultaneously, for this you need to load them as a composite driver, you can do this through configfs or hardcoded on the legacy drivers. 

Regards,

-Marco

0 Kudos
1,702 Views
krishnanp
Contributor III

Dear Eric,

Thanks for the suggestions. It was a problem with UDC controller driver.  I have enabled chip idea hdr controller  driver in kernel

Now the  g_mass_storage works fine

USB_udc.png

root@imx6qsabrelite:/# insmod g_mass_storage.ko file=/dev/mtdblock5

calling  msg_init+0x0/0x1c [g_mass_storage] @ 421

g_mass_storage gadget: Mass Storage Function, version: 2009/09/11

g_mass_storage gadget: Number of LUNs=1

lun0: LUN: file: /dev/mtdblock5

g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11

g_mass_storage gadget: userspace failed to provide iSerialNumber

g_mass_storage gadget: g_mass_storage ready

initcall msg_init+0x0/0x1c [g_mass_storage] returned 0 after 30566 usecs

root@imx6qsabrelite:/# g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

root@imx6qsabrelite:/# g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

View solution in original post