The {cpu-family} CPU has two USB 2.0 OTG ports with integrated PHY.
USB interfaces on the ConnectCore 8M Mini
On the ConnectCore 8M Mini system-on-module the USB OTG ports are available for peripheral use.
On the ConnectCore 8M Mini 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.
-
-
-
USB_OTG2 is connected to a micro AB-type connector (next to the microSD connector).
The status of the VBUS line in the USB_OTG1 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 Mini 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 Mini 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 {cpu-family} 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 {cpu-family} USB drivers are located at drivers/usb/
.
File | Description |
---|---|
Chipidea IP core driver |
|
Chipidea peripheral driver |
|
Chipidea host driver |
|
i.MX glue layer |
|
Chipidea OTG driver |
|
Chipidea OTG HNP and SRP driver |
|
i.MX SoC abstract layer |
|
i.MX USB physical driver |
Device tree bindings and customization
The {cpu-family} USB controller device tree bindings are documented at Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
.
Example: ConnectCore 8M Mini 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:
/* USB_OTG1 connected to usb hub */
&usbotg1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbotg1>;
vbus-supply = <®_3v3_usb_hub>;
fsl,reset-gpio = <&gpio5 10 GPIO_ACTIVE_LOW>;
dr_mode = "host";
disable-over-current;
status = "okay";
};
/* USB_OTG2 connected to usb otg */
&usbotg2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbotg2>;
dr_mode = "otg";
status = "okay";
};
&iomuxc {
pinctrl_usbotg1: usbotg1grp {
fsl,pins = <
/* USB hub reset */
MX8MM_IOMUXC_ECSPI2_SCLK_GPIO5_IO10 0x16
>;
};
pinctrl_usbotg2: usbotg2grp {
fsl,pins = <
/* USB otg2 power enable */
MX8MM_IOMUXC_GPIO1_IO14_USB2_OTG_PWR 0x16
/* USB otg2 overcurrent detect */
MX8MM_IOMUXC_GPIO1_IO15_USB2_OTG_OC 0x16
>;
};
};
Configure USB as device
To use the USB_OTG1 interface as USB device, make the following change to the device tree:
diff --git a/arch/arm64/boot/dts/digi/ccimx8mmdvk.dts b/arch/arm64/boot/dts/digi/ccimx8mmdvk.dts
index df2867d65c0b..6b68f914002b 100644
--- a/arch/arm64/boot/dts/digi/ccimx8mmdvk.dts
+++ b/arch/arm64/boot/dts/digi/ccimx8mmdvk.dts
@@ -716,10 +716,9 @@
&usbotg1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbotg1>;
vbus-supply = <®_3v3_usb_hub>;
fsl,reset-gpio = <&gpio5 10 GPIO_ACTIVE_LOW>;
- dr_mode = "host";
+ dr_mode = "peripheral";
disable-over-current;
status = "okay";
};