MX8 USB OTG: Difference between revisions

From Variscite Wiki
m (Admin moved page VAR-SOM-MX8X USB OTG to MX8 USB OTG without leaving a redirect)
(Add Debian Platform Customization)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use RELEASE_SUMO_V1.0_VAR-SOM-MX8X as default
<!-- Set release according to "release" parameter in URL and use RELEASE_SUMO_V1.0_VAR-SOM-MX8X as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_SUMO_V1.0_VAR-SOM-MX8X}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_SUMO_V1.0_VAR-SOM-MX8X}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} USB OTG}} {{DocImage|category1=Yocto|category2=VAR-SOM-MX8X}}[[Category:VAR-SOM-MX8]] __toc__
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} USB OTG}} {{DocImage|category1=Yocto|category2=Debian}} [[category:{{#var:HARDWARE_NAME}}]] __toc__


= Configuring the USB OTG port under Linux =
= Configuring the USB OTG port under Linux =
Line 16: Line 17:
&usbotg3 {
&usbotg3 {
- dr_mode = "otg";
- dr_mode = "otg";
+       dr_mode = "host";
+ dr_mode = "host";
extcon = <&typec_ptn5150>;
extcon = <&typec_ptn5150>;
status = "okay";
status = "okay";
Line 26: Line 27:
Note: You can read the current dr_mode value on a running target, by executing the following command:
Note: You can read the current dr_mode value on a running target, by executing the following command:
<pre>
<pre>
# cat /sys/firmware/devicetree/base/usb3@5b110000/dr_mode; echo
# cat /sys/firmware/devicetree/base/usb3@5b110000/dr_mode;
</pre>
</pre>


= Using the USB OTG port under Linux =
= Using the USB OTG port under Linux =
== As host (default) ==
== As host (default) ==
[[IMX_USB_Host|USB host]]
Refer to [[IMX_USB_Host|USB host]]


== As peripheral ==
== As peripheral ==

Latest revision as of 15:27, 6 June 2023

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release RELEASE_SUMO_V1.0_VAR-SOM-MX8X.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
VAR-SOM-MX8X USB OTG

Configuring the USB OTG port under Linux

By default, the USB OTG port is configured as OTG in the device tree, and a USB type-C receptacle is assembled on the Symphony carrier board.
To use it as host only or peripheral only you need to change the value of the dr_mode property under the USB node in the device tree.
dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"

For example:
Follow either the "Build the Linux kernel from source code" or "Customizing the Linux kernel" Wiki pages and edit the following device tree file:
arch/arm64/boot/dts/freescale/fsl-imx8qxp-var-som-common.dtsi

&usbotg3 {
-	dr_mode = "otg";
+	dr_mode = "host";
	extcon = <&typec_ptn5150>;
	status = "okay";
};

If you build the kernel manually from source code, you should build only the device trees and copy them to your SD card or eMMC.

Note: You can read the current dr_mode value on a running target, by executing the following command:

# cat /sys/firmware/devicetree/base/usb3@5b110000/dr_mode;

Using the USB OTG port under Linux

As host (default)

Refer to USB host

As peripheral

In order to use the board as a peripheral, an appropriate module needs to be loaded.
For example, there is an Ethernet gadget module called g_ether, a mass storage gadget called g_mass_storage, a serial gadget called g_serial, etc.

Example using the g_mass_storage module to expose the root partition on eMMC to a PC while booting from recovery SD card:
Connect a type-C plug to Standard-A plug cable between the board and a PC, and run the following on the board:

# umount /dev/mmcblk0p1
# modprobe g_mass_storage file=/dev/mmcblk0p1

The partition should be loaded on the PC as a mass storage device.

As OTG

With OTG, the board can be either a host, or a peripheral.
In order to use it as a host and connect a peripheral (e.g. a USB flash drive) to it, either use a peripheral with type-C connector or use type-C to type-A adapter.
In order to use it as a peripheral and connect it to a PC, for example, a cable with a type-C plug on one end and a Standard-A plug on the other is needed.