Set USB1 to device mode for LS1046A

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

Set USB1 to device mode for LS1046A

431 Views
charleshuang
Senior Contributor II

Hi NXP,

We have two problem about ls1046a usb :

1. We change "dr_mode" to "peripheral" in fsl-ls1046a.dtsi, and connect our PCB and PC by USB line (Type-A to Type-A), but there are no reponse at PC side. We check GSTS register, the CURMOD is ready to set to device mode. Our usb1 dts node is as below. Is there anything else we need to modify ?

 

[GSTS Register]

    root@ls1046arom8720-s1:~# memtool md -l 0x300c118+1
    0300c118: 3e800000

[USB1 DTS]

    usb1: usb@3000000 {
    compatible = "fsl,ls1046a-dwc3", "snps,dwc3";
    reg = <0x0 0x3000000 0x0 0x10000>;
    interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
    dr_mode = "peripheral";
    snps,quirk-frame-length-adjustment = <0x20>;
    snps,dis_rxdet_inp3_quirk;
    snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>;
    usb3-lpm-capable;
    snps,dis-u1u2-when-u3-quirk;
    snps,host-vbus-glitches;
    dma-coherent;
    };

 

2. On LS1046ARDB, usb1 default is otg mode. We connect it to PC but there are no response too. How to make LS1046A to be device endpoint ?

 

BR,

Sean

Labels (2)
Tags (1)
0 Kudos
1 Reply

367 Views
yipingwang
NXP TechSupport
NXP TechSupport

Do you want to configure LS1046ARDB as Mass Storage gadget?

Please configure Linux Kernel as the following.

USB Gadget support --->
<M> USB Gadget functions configurable through
configfs
        [*] Mass storage 
<M> USB Gadget precomposed configurations
<M> Mass Storage Gadget

Device Tree update, change property dr_mode’s data from “host” to “peripheral”, add property maximum-speed = “super-speed”;
as below:
usb0: usb3@2f00000 {
compatible = "snps,dwc3";
reg = <0x0 0x2f00000 0x0 0x10000>;
interrupts = <0 60 0x4>;
dr_mode = "peripheral";
snps,quirk-frame-length-adjustment = <0x20>;
snps,dis_rxdet_inp3_quirk;
maximum-speed = “super-speed”;
};

Build kernel, then copy below ko files to an SD card.
— ./drivers/usb/gadget/libcomposite.ko
— ./drivers/usb/gadget/function/usb_f_mass_storage.ko
— ./drivers/usb/gadget/legacy/g_mass_storage.ko

root@ls1043a:/ # 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