The i.MX8M Nano CPU has one USB 2.0 OTG port with integrated PHY.

USB interfaces on the ConnectCore 8M Nano

On the ConnectCore 8M Nano system-on-module the USB OTG port is available for peripheral use.

On the ConnectCore 8M Nano Development Kit:

  • USB_OTG1 is connected to a USB switch that selects its end point to be either:

    • the micro AB-type recovery connector (next to the USB host connectors).

    • the four-port USB hub, which at the same time makes the port available at:

      • both ports of the stackable dual USB A-type connector.

      • the PCIe connector.

      • the XBee Cellular socket.

The status of the VBUS line in the micro AB-type recovery connector determines which USB end point is selected by the switch. By default, USB lines will be connected to the USB hub.

If you have a USB cable connected to the micro-USB connector, the USB will work as a device, so any peripheral you have connected to the USB host ports won’t work.

Kernel configuration

You can manage the USB 2.0 support through the kernel configuration options:

  • Support for Host-side USB (CONFIG_USB)

  • EHCI HCD (USB 2.0) support (CONFIG_USB_EHCI_HCD)

  • ChipIdea Highspeed Dual Role Controller (CONFIG_USB_CHIPIDEA)

  • ChipIdea device controller (CONFIG_USB_CHIPIDEA_UDC)

  • ChipIdea host controller (CONFIG_USB_CHIPIDEA_HOST)

  • Freescale MXS USB PHY support (CONFIG_USB_MXS_PHY)

  • OTG support (CONFIG_USB_OTG)

All of these kernel configuration options are enabled as built-in on the default ConnectCore 8M Nano kernel configuration file.

The USB device driver provides the functionality for the USB gadget drivers. The USB gadget drivers implement one or more "functions", each providing a different capability.

The following gadget drivers are supported and enabled as loadable modules on the default ConnectCore 8M Nano kernel configuration file.

  • Mass Storage Gadget (CONFIG_USB_MASS_STORAGE)

  • Ethernet Gadget with CDC Ethernet support (CONFIG_USB_ETH)

  • Serial Gadget with ACM and CDC OBEX support (CONFIG_USB_G_SERIAL)

Gadget drivers are enabled as loadable modules because only one gadget function can be used at a time. Before using a gadget driver, you must first make sure no other gadget driver is loaded.

Kernel driver

The i.MX8M Nano universal serial bus (USB) driver implements a standard Linux driver interface to the CHIPIDEA USB-HS On-The-Go (OTG) controller. The CHIPIDEA USB controller is enhanced host controller interface (EHCI) compliant.

The i.MX8M Nano USB drivers are located at drivers/usb/.

File Description

chipidea/core.c

Chipidea IP core driver

chipidea/udc.c

Chipidea peripheral driver

chipidea/host.c

Chipidea host driver

chipidea/ci_hdrc_imx.c

i.MX glue layer

chipidea/otg.c

Chipidea OTG driver

chipidea/otg_fsm.c

Chipidea OTG HNP and SRP driver

chipidea/usbmisc_imx.c

i.MX SoC abstract layer

phy/phy-mxs-usb.c

i.MX USB physical driver

Device tree bindings and customization

The i.MX8M Nano USB controller device tree bindings are documented at Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt.

Example: ConnectCore 8M Nano Development Kit

USB_OTG1 port is configured by default to work as host. This is selected via the dr_mode property on the device tree:

ConnectCore 8M Nano Development Kit device tree
/* USB_OTG1 connected to usb hub */
&usbotg1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usbotg1>;

	vbus-supply = <&reg_3v3_usb_hub>;
	fsl,reset-gpio = <&gpio5 10 GPIO_ACTIVE_LOW>;
	dr_mode = "host";
	disable-over-current;
	status = "okay";
};


&iomuxc {
	pinctrl_usbotg1: usbotg1grp {
		fsl,pins = <
			/* USB hub reset */
			MX8MN_IOMUXC_ECSPI2_SCLK_GPIO5_IO10		0x16
		>;
	};
};

Configure USB as device

To use the USB_OTG1 interface as USB device, make the following change to the device tree:

ConnectCore 8M Nano Development Kit device tree
/* USB_OTG1 connected to usb hub */
&usbotg1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usbotg1>;

	vbus-supply = <&reg_3v3_usb_hub>;
	fsl,reset-gpio = <&gpio5 10 GPIO_ACTIVE_LOW>;
	dr_mode = "peripheral";
	disable-over-current;
	status = "okay";
};

Using the USB port

See the following topics for information on how to use the USB port.