Changes

Jump to: navigation, search

DESK-MX9-L/Peripherals/USB1 OTG

889 bytes added, 30 January
no edit summary
<section begin=Body/>
==Peripheral USB Host USB1 OTG == The SOM support this modality otg/host/peripheral, on DESK-MX9-L on SBCX the port are configured to peripheral.
=== Device tree configuration ===
&usbotg1 {
dr_mode = "peripheral";
hnp-disable;
srp-disable;
adp-disable;
disable-over-current;
samsung,picophy-pre-emp-curr-control = <3>;
samsung,picophy-dc-vol-level-adjust = <7>;
status = "disabled";
};
 
&usbotg2 {
dr_mode = "otg";
hnp-disable;
srp-disable;
<pre>
/ {
...
regulators {
...
reg_usb_pwr: usb_pwr {
compatible = "regulator-fixed";
regulator-name = "usb_pwr_en";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
...
};
...
};
...
&usbotg1 {
dr_mode = "peripheral";
status = "okay";
};
 
&usbotg2 {
dr_mode = "host";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usb_pwr>;
vbus-supply = <&reg_usb_pwr>;
status = "okay";
};
...
&iomuxc {
...
pinctrl_usb_pwr: usbpwrgrp {
fsl,pins = <
MX93_PAD_PDM_CLK__GPIO1_IO08 0x31e
>;
};
...
};
</pre>
===Accessing the peripheral===
 ====Linux messages at boot timeUsage with [https://www.kernel.org/doc/Documentation/usb/mass-storage.txt mass-storage] ====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.)
<pre class="workstation-terminal">
[ 1272.354409] usb 1root@desk-1mx93: new high-speed USB device number 3 using ci_hdrc~# dd if=/dev/zero of=mass_storage count=256 bs=1M256+0 records in256+0 records out[ 1272268435456 bytes (268 MB, 256 MiB) copied, 0.521077] usb-storage 1774426 s, 347 MB/sroot@desk-1mx93:1~# mkfs.0: USB Mass Storage device detectedmsdos mass_storage[ 1272mkfs.fat 4.527735] scsi host0: usb2 (2021-01-storage 131)root@desk-1mx93:1.0~# mkdir loop[ 1273.539755] scsi 0:0:0:0root@desk-mx93: Direct~# mount -Access USB SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6o loop mass_storage loop[ 12732309.550783051910] sd 0loop0:detected capacity change from 0:0:0: [sda] 60125184 512to 524288root@desk-byte logical blocksmx93: (30.8 GB~# echo "Test USB OTG with mass storage device" > loop/28usb.7 GiB)txt[ 1273.560595] sd 0:0:0:0root@desk-mx93: [sda] Write Protect is off~# umount loop[ 1273.567632] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA[ 1273.592520] sda: sda1[ 1273.601008] sd 0:0:0:0root@desk-mx93: [sda] Attached SCSI removable disk~#
</pre>
then insert the <code>g_mass_storage</code> kernel module driver enabling an Windows PC to see it as a ''removable device'' <pre class="workstation-terminal">root@desk-mx93:~# modprobe g_mass_storage removable=y file= Additional information ==mass_storage[ 2366.224448] Mass Storage Function, version: 2009/09/11[ 2366.229698] LUN: removable file: (no medium)[ 2366.234576] LUN: removable file: /home/root/mass_storage[ 2366.239928] Number of LUNs=1[ 2366.242990] g_mass_storage gadget.0: Mass Storage Gadget, version: 2009/09/11[ 2366.250151] g_mass_storage gadget.0: userspace failed to provide iSerialNumber[ 2366.257373] g_mass_storage gadget.0: g_mass_storage readyroot@desk-mx93:~#</pre>
The root file system configuration does automatically mount Once the partitionUSB cable is connected to the PC, the kernel prints the following messages:
<pre class="workstation-terminal">
root@desk[32262.935133] usb 1-mx931:~# lsblk /dev/sdanew high-speed USB device number 2 using ehci-pciNAME MAJ[32263.305571] usb 1-1:MIN RM SIZE RO TYPE MOUNTPOINTSNew USB device found, idVendor=0525, idProduct=a4a5, bcdDevice= 6.01sda 8[32263.305574] usb 1-1:New USB device strings: Mfr=3, Product=4, SerialNumber=0 [32263.305575] usb 1-1: Product: Mass Storage Gadget[32263.305577] usb 1-1: Manufacturer: Linux 6.1 28.7G 55-desk-mx9-l-5.0.0 disk +g8942d3259e9b with 4c100000.usb`[32263.337697] usb-storage 1-sda1 81:1 .0: USB Mass Storage device detected[32263.337819] usb-storage 1-1:1 28.7G 0 part /run/media/<name: Quirks match for vid 0525 pid a4a5: 10000[32263.337867] scsi host4: usb-storage 1-1:1.0[32263.337968] usbcore: registered new interface driver usb-partition>storage[32263.340492] usbcore: registered new interface driver uas[32264.367940] scsi 4:0:0:0: Direct-Access Linux File-Stor Gadget 0601 PQ: 0 ANSI: 2[32264.368435] sd 4:0:0:0: Attached scsi generic sg2 type 0[32264.385398] sd 4:0:0:0: Power-on or device reset occurred[32264.404893] sd 4:0:0:0: [sdb] 524288 512-sda1byte logical blocks: (268 MB/256 MiB)[32264.519991] sd 4:0:0:0: [sdb] Write Protect is off[32264.519993] sd 4:0:0:0: [sdb] Mode Sense: 0f 00 00 00[32264.637756] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA[32264.942269] sdb:[32265.225654] sd 4:0:0:0: [sdb] Attached SCSI removable disk
</pre>
 
The directory name mounted depend from usb name partition.
----
[[Category:AURA]] [[Category:SBCX AURA]]
dave_user
226
edits

Navigation menu