DESK-MX6UL-L/Peripherals/USB Host

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2021/07/20

First DESK release

2022/03/16

DESK-MX6UL-L 3.0.0 release

2023/05/04

DESK-MX6UL-L 4.0.0 release

2024/08/07

DESK-MX6UL-L 4.2.x release
2025/12/16 DESK-MX6UL-L 6.x.x release


Peripheral USB Host[edit | edit source]

The USB Host port requires to configure the USB VBUS regulator and the gpio used for enabling the 5V USB power switch.

Device tree configuration[edit | edit source]

AXEL ULite SOM[edit | edit source]

Here below is an example of device tree configuration used on standard DAVE's kit for the AXEL ULite SOM:

From imx6ul-axelulite-cb003a.dts:

        reg_usb_otg1_vbus: regulator@2 {
                compatible = "regulator-fixed";
                reg = <2>;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_usb_otg1>;
                regulator-name = "usb_otg1_vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                gpio = <&gpio1 18 GPIO_ACTIVE_HIGH>;
                enable-active-high;
        };
...
...
&usbotg1 {
        vbus-supply = <&reg_usb_otg1_vbus>;
        disable-over-current;
        dr_mode = "host";
        status = "okay";
};
...
...
&iomuxc {
        pinctrl-0 = <&pinctrl_hog_gpios>;
        imx6ul-axelulite {
...
...
                pinctrl_usb_otg1: usbotg1grp {
                        fsl,pins = <
                                MX6UL_PAD_UART1_CTS_B__GPIO1_IO18       0x10b0          /* HOST PWR */
                                MX6UL_PAD_GPIO1_IO03__GPIO1_IO03        0x10b0          /* HOST OC */
                        >;
                };
};

RIALTO SBC[edit | edit source]

Here below is an example of device tree configuration used on standard DAVE's kit for the RIALTO SBC:

From imx6ul-lynx-som0022.dtsi:

...
...
		reg_usb_otg1_vbus: regulator@2 {
			compatible = "regulator-fixed";
			reg = <2>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usb_otg1>;
			regulator-name = "usb_otg1_vbus";
			regulator-min-microvolt = <5000000>;
			regulator-max-microvolt = <5000000>;
			gpio = <&gpio2 8 GPIO_ACTIVE_HIGH>;
			enable-active-high;
			vin-supply = <&swbst_reg>;
		};

		reg_usb_otg2_vbus: regulator@3 {
			compatible = "regulator-fixed";
			reg = <3>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usb_otg2>;
			regulator-name = "usb_otg2_vbus";
			regulator-min-microvolt = <5000000>;
			regulator-max-microvolt = <5000000>;
			gpio = <&gpio2 12 GPIO_ACTIVE_HIGH>;
			enable-active-high;
		};
...
...
&usbotg1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usb_otg1_id>;
	vbus-supply = <&reg_usb_otg1_vbus>;
	dr_mode = "otg";
	srp-disable;
	hnp-disable;
	adp-disable;
	status = "disabled";
};

&usbotg2 {
	vbus-supply = <&reg_usb_otg2_vbus>;
	dr_mode = "host";
	status = "disabled";
};

...
...
&iomuxc {
...
...
		pinctrl_usb_otg1_id: usbotg1idgrp {
			fsl,pins = <
				MX6UL_PAD_GPIO1_IO00__ANATOP_OTG1_ID	0x17059
			>;
		};

		pinctrl_usb_otg1: usbotg1grp {
			fsl,pins = <
				MX6UL_PAD_JTAG_MOD__GPIO1_IO10		0x10b0 /* OTG1 PWR */
				MX6UL_PAD_UART3_RX_DATA__GPIO1_IO25	0x17059 /* OTG1_OC */
			>;
		};

		pinctrl_usb_otg1_1: usbotg1grp-1 {
			fsl,pins = <
				MX6UL_PAD_JTAG_MOD__GPIO1_IO10		0x10b0 /* OTG1 PWR */
				MX6UL_PAD_SNVS_TAMPER6__GPIO5_IO06	0x17059 /* OTG1_OC */
			>;
		};

		pinctrl_usb_otg2_1: usbotg2grp-1 {
			fsl,pins = <
				MX6UL_PAD_UART3_CTS_B__GPIO1_IO26	0x17059 /* OTG2_PWR */
				MX6UL_PAD_UART3_RTS_B__GPIO1_IO27	0x17059 /* OTG2_OC */
			>;
		};

...
...
};

From imx6ul-lynx-som0022-cb0090.dts:

...
...
&reg_usb_otg1_vbus {
	pinctrl-0 = <&pinctrl_usb_otg1_1>;
	gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
};

&reg_usb_otg2_vbus {
	pinctrl-0 = <&pinctrl_usb_otg2_1>;
	gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
};

&usbotg1 {
	disable-over-current;		// only GPIO support for OVERCURRENT in this board
	status = "okay";
};

&usbotg2 {
	disable-over-current;		// only GPIO support for OVERCURRENT in this board
	status = "okay";
};
...
...

Accessing the peripheral in AXEL ULite SOM[edit | edit source]

Linux messages at boot time[edit | edit source]

When a USB peripheral is inserted, in the following example a memory mass storage device, the kernel recognizes the device (i.e. xlass, vendor id, product id, etc.)

[   86.473658] usb 1-1: new high-speed USB device number 3 using ci_hdrc
[   86.675550] usb 1-1: New USB device found, idVendor=0781, idProduct=5571, bcdDevice= 1.27
[   86.684007] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   86.691304] usb 1-1: Product: Cruzer Fit
[   86.695450] usb 1-1: Manufacturer: SanDisk
[   86.699614] usb 1-1: SerialNumber: 4C530009810318107583
[   86.725892] usb-storage 1-1:1.0: USB Mass Storage device detected
[   86.753934] scsi host0: usb-storage 1-1:1.0
[   87.767002] scsi 0:0:0:0: Direct-Access     SanDisk  Cruzer Fit       1.27 PQ: 0 ANSI: 6
[   87.798198] sd 0:0:0:0: [sda] 15633408 512-byte logical blocks: (8.00 GB/7.45 GiB)
[   87.815358] sd 0:0:0:0: [sda] Write Protect is off
[   87.820216] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[   87.842071] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   87.896511]  sda: sda1
[   87.899997] sd 0:0:0:0: [sda] Attached SCSI removable disk

Additional information[edit | edit source]

If the root file system configuration does not automatically mount the partition, it is possible to mount the device using the following command:

root@desk-mx6ul-axelulite:~# mkdir -p /mnt/usb
root@desk-mx6ul-axelulite:~# mount /dev/sda1 /mnt/usb/
[  155.120175] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@desk-mx6ul-axelulite:~# ls -la /mnt/usb/
total 4252
drwxr-xr-x 7 root root    4096 Jan  1  1970  .
drwxr-xr-x 4 root root    4096 Dec 12 15:42  ..
drwxr-xr-x 2 root root    4096 Nov 28  2024 'System Volume Information'
-rwxr-xr-x 1 root root   50113 Dec 10 17:16  imx93-aura-som0002-cb2004.dtb
drwxr-xr-x 2 root root    4096 Dec 10 17:39  www
root@desk-mx6ul-axelulite:~#

Accessing the peripheral in RIALTO SBC[edit | edit source]

Linux messages at boot time[edit | edit source]

When a USB peripheral is inserted, in the following example a memory mass storage device, the kernel recognizes the device (i.e. class, vendor id, product id, etc.)

[ 3198.828827] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 3199.031869] usb 1-1: New USB device found, idVendor=125f, idProduct=c08a, bcdDevice= 1.00
[ 3199.031980] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3199.032042] usb 1-1: Product: ADATA USB Flash Drive
[ 3199.032086] usb 1-1: Manufacturer: ADATA
[ 3199.032131] usb 1-1: SerialNumber: 11B15033223000B1
[ 3199.051776] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 3199.084045] scsi host0: usb-storage 1-1:1.0
[ 3200.091305] scsi 0:0:0:0: Direct-Access     ADATA    USB Flash Drive  0.00 PQ: 0 ANSI: 2
[ 3200.110289] sd 0:0:0:0: [sda] 7892992 512-byte logical blocks: (4.04 GB/3.76 GiB)
[ 3200.110969] sd 0:0:0:0: [sda] Write Protect is off
[ 3200.111006] sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00
[ 3200.111582] sd 0:0:0:0: [sda] Asking for cache data failed
[ 3200.111615] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 3200.125359]  sda: sda1
[ 3200.139266] sd 0:0:0:0: [sda] Attached SCSI removable disk

Additional information[edit | edit source]

If the root file system configuration does not automatically mount the partition, it is possible to mount the device using the following command:

root@desk-mx6ul-rialto:~# mkdir -p /mnt/usb
root@desk-mx6ul-rialto:~# mount /dev/sda1 /mnt/usb
root@desk-mx6ul-rialto:~# ls -la /mnt/usb/
total 217048
drwxr-xr-x 3 root root      4096 Jan  1  1970  .
drwxr-xr-x 4 root root      4096 Apr 28 20:56  ..
drwxr-xr-x 2 root root      4096 May 29  2024 'System Volume Information'
root@desk-mx6ul-rialto:~#