USB as device

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB as device

1,712 Views
deepanrajanbara
Contributor IV

Hi,

We are using LX2160 based custom board in which we have configured the USB1 as pheripheral. But when we boot the board we are observing the below log.

[ 1.776208] usbcore: registered new interface driver usbfs
[ 1.776221] usbcore: registered new interface driver hub
[ 1.776238] usbcore: registered new device driver usb
[ 1.853132] usbcore: registered new interface driver r8152
[ 1.853144] usbcore: registered new interface driver asix
[ 1.853156] usbcore: registered new interface driver ax88179_178a
[ 1.853586] dwc3 3100000.usb: Adding to iommu group 0
[ 1.853648] dwc3 3100000.usb: Configuration mismatch. dr_mode forced to host
[ 1.855475] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[ 1.856207] usbcore: registered new interface driver cdc_acm
[ 1.856268] usbcore: registered new interface driver uas
[ 1.856296] usbcore: registered new interface driver usb-storage
[ 2.305889] usbcore: registered new interface driver usbhid
[ 2.305892] usbhid: USB HID core driver

Below is the dts configuration for usb1

usb0: usb@3100000 {
compatible = "fsl,lx2160a-dwc3", "snps,dwc3";
reg = <0x0 0x3100000 0x0 0x10000>;
interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "peripheral";
maximum-speed = "super-speed";
snps,quirk-frame-length-adjustment = <0x20>;
snps,dis_rxdet_inp3_quirk;
};

Please let us know , how to resolve this issue. we have also enabled all the required configuration in the kernel. But we are not able to detect as device in the PC. LSDK version used is 21.08

Thank you,

Deepanraj.A

0 Kudos
Reply
3 Replies

1,699 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the section "Mass Storage gadget" in LSDK document.

Please configure Linux Kernel as the following

yipingwang_0-1649823331248.png

In dts, change property dr_mode’s data from “host” to “peripheral”, add property maximum-speed = “super-speed”;

On the target board, execute the following command.

 # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 85352 65515 15430 81% /
devtmpfs 1940036 4 1940032 1% /dev
tmpfs 1961116 132 1960984 1% /run
tmpfs 1961116 172 1960944 1% /var/volatile
/dev/mmcblk0p1 3931136 32964 3898172 1% /run/media/mmcblk0p1
root@ls1043a:~#cd /run/media/mmcblk0p1/ # this is where you put your ko files
root@ls1043a:/run/media/mmcblk0p1/ # dd if=/dev/zero of=./test bs=1M count=500
root@ls1043a:/run/media/mmcblk0p1/ # insmod libcomposite.ko
root@ls1043a:/run/media/mmcblk0p1/ # insmod usb_f_mass_storage.ko
root@ls1043a:/run/media/mmcblk0p1/ # insmod g_mass_storage.ko file=/run/media/mmcblk0p1/test
[ 780.758286] Mass Storage Function, version: 2009/09/11
[ 780.763465] LUN: removable file: (no medium)
[ 780.767791] LUN: file: /run/media/mmcblk0p1/test
[ 780.772406] Number of LUNs=1
[ 780.775355] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 780.782322] g_mass_storage gadget: userspace failed to provide iSerialNumber
[ 780.789371] g_mass_storage gadget: g_mass_storage ready

Connect USB cable with PC and RDB board
— You can see Windows Device Manager as Linux File-Stor Gadget USB Drive.

0 Kudos
Reply

1,691 Views
deepanrajanbara
Contributor IV

Hi Yiping,

As mentioned in the below is the dts configuration.

usb0: usb@3100000 {
compatible = "fsl,lx2160a-dwc3", "snps,dwc3";
reg = <0x0 0x3100000 0x0 0x10000>;
interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "peripheral";
maximum-speed = "super-speed";
snps,quirk-frame-length-adjustment = <0x20>;
snps,dis_rxdet_inp3_quirk;
};

In our kernel we have made all the drivers as in build not configured as module.

But still we are observing that error during bootup

[ 1.853586] dwc3 3100000.usb: Adding to iommu group 0
[ 1.853648] dwc3 3100000.usb: Configuration mismatch. dr_mode forced to host

It is not able to enumerate as gadget serial.

Thanks

0 Kudos
Reply

1,664 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please compile these drivers as modules, then insert into Linux Kernel after booting up.

0 Kudos
Reply