USB OTG support in IMX6Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB OTG support in IMX6Q

6,205 Views
jemish_1990
Contributor IV

Hi All,

We are working on IMX6Q based customize board. We are working on wand board based linux kernel. Kernel variant : imx_3.14.28

IWe have USB OTG device on our board.

We want to test USB OTG in host mode and gadget mode.

Which are required modules to test USB OTG in both mode?

Which device entry it will create once modules get loaded successfully?

Which config option we need to enable in kernel config file?

Thanks,

Jemish

Labels (1)
Tags (1)
0 Kudos
4 Replies

1,857 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jemish

one can test USB with unit tests (imx-test):

folder .../mxc_usb_test

http://repository.timesys.com/buildsources/i/imx-test/imx-test-3.14.28-1.0.0/

for kernel config file refer to attached Linux Manual Chapter 41 CHIPIDEA USB Driver

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,857 Views
jemish_1990
Contributor IV

Hi Igor,

Thanks a lot for your suggestion!

Sorry for late response got stuck with some other work!

With reference manual you provided we managed to make some progress on USB-OTG but not completely.

  • I make built in support for g_mass_storage module because as .ko I am still facing some issue. Whenever I try to do insmod it always shows  "No such device!". Any suggestions for this issue?
  • With builtin support for g_mass_storage it got working in gadget (peripheral ) mode. But issue is that it is working only when I select "peripheral" dr_mode in below dtsi node. As per my understanding it should also work with "otg" dr_mode. Any suggestions?

&usbotg {

        vbus-supply = <&reg_usb_otg_vbus>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_usbotg_1>;

        disable-over-current;

        dr_mode = "otg";

        status = "okay";

};

We haven't tested in host mode yet we will keep you posted for the same.

Thanks,

Jemish

0 Kudos

1,857 Views
jemish_1990
Contributor IV

Hi Igor,

One more input from my side. What should be pin configuration settings in device tree file for USB OTG to work in both mode "host" and "gadget").

For me both modes are working individually but not simultaneously.

HOST mode pin configurations:

NOTE : With below pin configuration only HOST mode is working fine.

                reg_usb_otg_vbus: usb_otg_vbus {

                        compatible = "regulator-fixed";

                        regulator-name = "usb_otg_vbus";

                        regulator-min-microvolt = <5000000>;

                        regulator-max-microvolt = <5000000>;

                        gpio = <&gpio3 22 0>;

                        enable-active-high;

                };

        usbotg {

                pinctrl_usbotg_1: usbotggrp-1 {

                        fsl,pins = <

                                MX6QDL_PAD_GPIO_1__USB_OTG_ID   0x17059

                                MX6QDL_PAD_KEY_COL4__USB_OTG_OC 0x17059

                                MX6QDL_PAD_EIM_D22__GPIO3_IO22   0x000b0

                        >;

                };

&usbotg {

        vbus-supply = <&reg_usb_otg_vbus>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_usbotg_1>;

        disable-over-current;

        dr_mode = "otg";

        status = "okay";

}

Gadget Mode : (Comment out ID pin: Which is strange)

With below pin configuration only Gadget mode is working

        usbotg {

                pinctrl_usbotg_1: usbotggrp-1 {

                        fsl,pins = <

                              /*  MX6QDL_PAD_GPIO_1__USB_OTG_ID   0x17059 */

                                MX6QDL_PAD_KEY_COL4__USB_OTG_OC 0x17059

                                MX6QDL_PAD_EIM_D22__GPIO3_IO22   0x000b0

                        >;

                };

Please suggest.

Thanks,

Jemish

0 Kudos

1,857 Views
jemish_1990
Contributor IV

Hi Igor,

This is got resolved. This is was happening due to hardware bug.

Below are the observations.

  • ​We checked both modes (host mode and gadget mode) for USB OTG. Both are working fine individually.
  • To make host mode working pin configuration we made are logically correct.
  • To make gadget mode working we don't configure USB OTG_ID pin to  OTG_ID mode. In that case it working in gadget mode which is logically incorrect and strange.
  • By doing some more debugging I found that status bit for USB OTG ID is not changing as per mode changing (host, gadget ) . It remains "0" (host mode) all the time.
  • I am referring to BIT number  8  of register : USB_nOTGSC (0x21841A4 ) Technical Reference Manual page : 5511. This bit is read only and it must change according to connector type(Type A or Type B ). 
  • Referring to our schematics it seems that we have grounded (pull down) OTG_ID pin.
  • By removing pull down register connected with OTG_ID now this issue got resolved and OTG is working fine in both mode.

We can close this thread now.

Thanks,

Jemish

0 Kudos