TWR-LS1021A: USB 2.0 DR Device mode and system freeze

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

TWR-LS1021A: USB 2.0 DR Device mode and system freeze

3,694 Views
cpark
Contributor II

Hi,

I have been testing USB 2.0 DR Device mode and finally managed to get USB2 on TWR-SER2 working in device mode. (see this post for more information)

I'm seeing another problem (system freeze) when using the FSL USB2.0 UDC (USB Device Controller) and gadget driver.

It only happens when using Winusb driver on Host side.

Here is summary of what I have observed.

Case 1)

TWR-LS1021A:  g_serial.ko (gadget)

Windows PC: usbser.sys (host)

No problem in this case.  This combination works perfectly fine.

Here is a screen shot of USB Analyzer showing enumeration and data transfer are working fine. (the blue box shows data "AAAAAA\r\n" transferred from my tower board to my PC)

g_serial.png

Case 2)

TWR-LS1021A:  g_printer.ko (gadget)

Windows PC: usbprint.sys (host)

No problem in this case too.  It works fine.

Here is a screen shot of USB Analyzer.

g_printer plus usbprint.sys.png

Case 3)

TWR-LS1021A:  g_printer.ko (gadget)

Windows PC: winusb.sys (host)

This is *not* working and the LS1021A system completely locks up.  It happens consistently.

g_printer plus winusb.sys.png

We also have a PowerQUICC (MPC8347E) based product and this combination works perfectly fine on that product.

If this is not working, I won't be able to use LS1021A on our product.

Is there any code patch or hardware workaround?

Labels (1)
0 Kudos
4 Replies

1,835 Views
Pavel
NXP Employee
NXP Employee

Look at the following pages:

https://en.wikipedia.org/wiki/WinUSB

and

https://msdn.microsoft.com/en-us/library/windows/hardware/ff538820(v=vs.85).aspx

This page shows that Microsoft does not recommend using winusb as printer driver.

0 Kudos

1,835 Views
cpark
Contributor II

Pavel,

Going back to my original post, I found that it freezes in the nuke() function.

static void nuke(struct fsl_ep *ep, int status) {

      ep->stopped = 1;

      /* Flush fifo */       fsl_ep_fifo_flush(&ep->ep);

      /* Whether this eq has request linked */       while (!list_empty(&ep->queue)) {             struct fsl_req *req = NULL;

            req = list_entry(ep->queue.next, struct fsl_req, queue);             done(ep, req, status);       } }

The fsl_udc_core.c hangs when connected to Winusb host, as the while loop runs infinitely.

I also looked at the web pages you mentioned earlier.  We're using what Microsoft recommends.

Linux Printer Gadget driver is common for any types of USB gadget.  We use it as vendor specific device.

Vendor Specific (FFh)---

Recommended driver:

WinUSB (Winusb.sys)

Anyway, the lockup happens in the FSL UDC driver, not in the printer gadget driver.

To debug this issue, I added the following code into the nuke() function.

      /* Whether this eq has request linked */       while (!list_empty(&ep->queue)) {             struct fsl_req *req = NULL;

            req = list_entry(ep->queue.next, struct fsl_req, queue);

            /* === DEBUG BEGIN === */             if (req_prev == req) {                   VDBG("!!! FORCE TO EXIT THE INFINITE LOOP !!!\n");                   break;             }             req_prev = req;

            /* === DEBUG END ===  */             done(ep, req, status);       }

Here is the output.

[    0.000000] Booting Linux on physical CPU 0xf00 [    0.000000] Linux version 3.12.19-rt30+ls1+g6619b8b (chantaek@0942-Ubuntu1) (gcc version 4.8.3 20140401 (prerelease) (Linaro GCC 4.8-2014.04) ) #111 SMP Thu Feb 12 15:24:52 EST 2015 [    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=70c73c7d [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [    0.000000] Machine: Freescale LS1021A, model: LS1021A TWR Board [    0.000000] Memory policy: ECC disabled, Data cache writealloc [    0.000000] On node 0 totalpages: 262144 [    0.000000] free_area_init_node: node 0, pgdat 80515080, node_mem_map 80548000 [    0.000000]   DMA zone: 2048 pages used for memmap [    0.000000]   DMA zone: 0 pages reserved [    0.000000]   DMA zone: 262144 pages, LIFO batch:31 [    0.000000] PERCPU: Embedded 8 pages/cpu @80d55000 s8384 r8192 d16192 u32768 [    0.000000] pcpu-alloc: s8384 r8192 d16192 u32768 alloc=8*4096 [    0.000000] pcpu-alloc: [0] 0 [0] 1 [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096 [    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs nfsroot=172.16.40.43:/home/chantaek/Projects/IB/Embedded/towerFS,nolock rw ip=dhcp [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes) [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) [    0.000000] Memory: 1034032K/1048576K available (3253K kernel code, 258K rwdata, 1476K rodata, 184K init, 197K bss, 14544K reserved, 0K highmem) [    0.000000] Virtual kernel memory layout:     vector  : 0xffff0000 - 0xffff1000   (   4 kB)     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)     vmalloc : 0xc0800000 - 0xff000000   (1000 MB)     lowmem  : 0x80000000 - 0xc0000000   (1024 MB)     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)     modules : 0x7f800000 - 0x7fe00000   (   6 MB)       .text : 0x80008000 - 0x804a683c   (4731 kB)       .init : 0x804a7000 - 0x804d50c0   ( 185 kB)       .data : 0x804d6000 - 0x80516a60   ( 259 kB)        .bss : 0x80516a68 - 0x80547ea4   ( 198 kB) [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [    0.000000] Hierarchical RCU implementation. [    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2. [    0.000000] NR_IRQS:16 nr_irqs:16 16 [    0.000000] Architected cp15 timer(s) running at 12.50MHz (phys). [    0.000000] Switching to timer-based delay loop [    0.000000] sched_clock: ARM arch timer >56 bits at 12500kHz, resolution 80ns [    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms [    0.000000] Console: colour dummy device 80x30 [   30.808860] Calibrating delay loop (skipped), value calculated using timer frequency.. 25.00 BogoMIPS (lpj=125000) [   30.808875] pid_max: default: 32768 minimum: 301 [   30.809085] Mount-cache hash table entries: 512 [   30.815844] CPU: Testing write buffer coherency: ok [   30.816120] CPU0: update cpu_power 1024 [   30.816130] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00 [   30.816274] Setting up static identity map for 0x8030a810 - 0x8030a874 [   30.817529] CPU1: Booted secondary processor [   30.817557] CPU1: update cpu_power 1024 [   30.817563] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01 [   30.817666] Brought up 2 CPUs [   30.817676] SMP: Total of 2 processors activated. [   30.817683] CPU: All CPU(s) started in HYP mode. [   30.817688] CPU: Virtualization extensions available. [   30.818382] devtmpfs: initialized [   30.827206] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5 [   30.827649] regulator-dummy: no parameters [   30.827940] NET: Registered protocol family 16 [   30.828181] DMA: preallocated 256 KiB pool for atomic coherent allocations [   30.828607] cpuidle: using governor ladder [   30.828615] cpuidle: using governor menu [   30.830115] syscon 1570000.scfg: regmap [mem 0x01570000-0x0157ffff] registered [   30.831625] irq: no irq domain found for /soc/uqe@2400000/qeic@80 ! [   30.831745] irq: no irq domain found for /soc/uqe@2400000/qeic@80 ! [   30.836864] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers. [   30.836872] hw-breakpoint: maximum watchpoint size is 8 bytes. [   30.844141] bio: create slab <bio-0> at 0 [   30.847544] 3P3V: 3300 mV [   30.847641] reg-fixed-voltage 0.regulator: 3P3V supplying 3300000uV [   30.847844] vgaarb: loaded [   30.848109] SCSI subsystem initialized [   30.848271] libata version 3.00 loaded. [   30.848562] usbcore: registered new interface driver usbfs [   30.848625] usbcore: registered new interface driver hub [   30.848725] usbcore: registered new device driver usb [   30.849069] i2c i2c-0: IMX I2C adapter registered [   30.849854] i2c i2c-1: IMX I2C adapter registered [   30.850004] i2c i2c-2: of_i2c: modalias failure on /soc/i2c@21a0000/ltc2945@67 [   30.850017] i2c i2c-2: IMX I2C adapter registered [   30.850267] pps_core: LinuxPPS API ver. 1 registered [   30.850274] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [   30.850297] PTP clock support registered [   30.850720] fsl-ifc 1530000.ifc: Freescale Integrated Flash Controller [   30.851031] Advanced Linux Sound Architecture Driver Initialized. [   30.851670] Switched to clocksource arch_sys_counter [   30.859949] NET: Registered protocol family 2 [   30.860539] TCP established hash table entries: 8192 (order: 4, 65536 bytes) [   30.860660] TCP bind hash table entries: 8192 (order: 4, 65536 bytes) [   30.860775] TCP: Hash tables configured (established 8192 bind 8192) [   30.860834] TCP: reno registered [   30.860846] UDP hash table entries: 512 (order: 2, 16384 bytes) [   30.860891] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes) [   30.861167] NET: Registered protocol family 1 [   30.861451] RPC: Registered named UNIX socket transport module. [   30.861459] RPC: Registered udp transport module. [   30.861466] RPC: Registered tcp transport module. [   30.861472] RPC: Registered tcp NFSv4.1 backchannel transport module. [   30.861484] PCI: CLS 0 bytes, default 64 [   30.861878] hw perfevents: enabled with ARMv7 Cortex-A7 PMU driver, 5 counters available [   30.977326] NFS: Registering the id_resolver key type [   30.977376] Key type id_resolver registered [   30.977384] Key type id_legacy registered [   30.977423] jffs2: version 2.2. (NAND) \xffffffc2\xffffffa9 2001-2006 Red Hat, Inc. [   30.977862] msgmni has been set to 2019 [   30.979210] io scheduler noop registered [   30.979218] io scheduler deadline registered [   30.979396] io scheduler cfq registered (default) [   30.981307] layerscape-pcie 3400000.pcie: PCI host bridge to bus 0000:00 [   30.981321] pci_bus 0000:00: root bus resource [io  0x1000-0xffff] [   30.981335] pci_bus 0000:00: root bus resource [mem 0x4040000000-0x407fffffff] (bus address [0x40000000-0x7fffffff]) [   30.981347] pci_bus 0000:00: root bus resource [bus 00-ff] [   30.981387] pci 0000:00:00.0: [1957:0e0a] type 01 class 0x060400 [   30.981414] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x00ffffff] [   30.981430] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x03ffffff] [   30.981447] pci 0000:00:00.0: reg 0x38: [mem 0x00000000-0x00ffffff pref] [   30.981507] pci 0000:00:00.0: supports D1 D2 [   30.981516] pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot [   30.981838] PCI: bus0: Fast back to back transfers disabled [   30.982057] pci 0000:01:00.0: [8086:08b3] type 00 class 0x028000 [   30.982140] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00001fff 64bit] [   30.982505] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold [   30.982795] PCI: bus1: Fast back to back transfers disabled [   30.982809] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01 [   30.982910] pci 0000:00:00.0: BAR 1: assigned [mem 0x4040000000-0x4043ffffff] [   30.982925] pci 0000:00:00.0: BAR 0: assigned [mem 0x4044000000-0x4044ffffff] [   30.982940] pci 0000:00:00.0: BAR 6: assigned [mem 0x4045000000-0x4045ffffff pref] [   30.982953] pci 0000:00:00.0: BAR 8: assigned [mem 0x4046000000-0x40460fffff] [   30.982967] pci 0000:01:00.0: BAR 0: assigned [mem 0x4046000000-0x4046001fff 64bit] [   30.983017] pci 0000:00:00.0: PCI bridge to [bus 01] [   30.983030] pci 0000:00:00.0:   bridge window [mem 0x4046000000-0x40460fffff] [   32.981688] layerscape-pcie 3500000.pcie: phy link never came up [   32.981822] layerscape-pcie 3500000.pcie: PCI host bridge to bus 0001:00 [   32.981836] pci_bus 0001:00: root bus resource [io  0x10000-0x1ffff] (bus address [0x0000-0xffff]) [   32.981851] pci_bus 0001:00: root bus resource [mem 0x4840000000-0x487fffffff] (bus address [0x40000000-0x7fffffff]) [   32.981862] pci_bus 0001:00: root bus resource [bus 00-ff] [   32.981895] pci 0001:00:00.0: [1957:0e0a] type 01 class 0x060400 [   32.981919] pci 0001:00:00.0: reg 0x10: [mem 0x00000000-0x00ffffff] [   32.981936] pci 0001:00:00.0: reg 0x14: [mem 0x00000000-0x03ffffff] [   32.981953] pci 0001:00:00.0: reg 0x38: [mem 0x00000000-0x00ffffff pref] [   32.982008] pci 0001:00:00.0: supports D1 D2 [   32.982017] pci 0001:00:00.0: PME# supported from D0 D1 D2 D3hot [   32.982297] PCI: bus0: Fast back to back transfers disabled [   32.982426] PCI: bus1: Fast back to back transfers enabled [   32.982438] pci_bus 0001:01: busn_res: [bus 01-ff] end is updated to 01 [   32.982543] pci 0001:00:00.0: BAR 1: assigned [mem 0x4840000000-0x4843ffffff] [   32.982558] pci 0001:00:00.0: BAR 0: assigned [mem 0x4844000000-0x4844ffffff] [   32.982573] pci 0001:00:00.0: BAR 6: assigned [mem 0x4845000000-0x4845ffffff pref] [   32.982583] pci 0001:00:00.0: PCI bridge to [bus 01] [   32.982809] sii902x: probe of 1-0039 failed with error -1 [   32.983185] syscon 1570000.scfg: Failed to create debugfs directory [   32.988332] Console: switching to colour frame buffer device 60x34 [   32.991523] fb0: fb device registered successfully. [   32.991807] fb1: fb device registered successfully. [   32.992041] fb2: fb device registered successfully. [   32.992298] fb3: fb device registered successfully. [   33.045420] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [   33.048214] 21c0500.serial: ttyS0 at MMIO 0x21c0500 (irq = 118, base_baud = 9375000) is a 16550A_FSL64 [   33.649153] console [ttyS0] enabled [   33.652749] 21c0600.serial: ttyS1 at MMIO 0x21c0600 (irq = 118, base_baud = 9375000) is a 16550A_FSL64 [   33.661030] of_serial 2402200.ucc: clk or clock-frequency not defined [   33.666166] of_serial: probe of 2402200.ucc failed with error -2 [   33.671196] serial: Freescale lpuart driver [   33.674278] 2950000.serial: ttyLP0 at MMIO 0x2950000 (irq = 112, base_baud = 6250000) is a FSL_LPUART [   33.686570] brd: module loaded [   33.692349] loop: module loaded [   33.697360] 60000000.nor: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000089 Chip ID 0x00227e [   33.706073] Amd/Fujitsu Extended Query Table at 0x0040 [   33.709902]   Amd/Fujitsu Extended Query version 1.3. [   33.713643] number of CFI chips: 1 [   33.716112] 8 ofpart partitions found on MTD device 60000000.nor [   33.720792] Creating 8 MTD partitions on "60000000.nor": [   33.724798] 0x000000000000-0x000000020000 : "NOR bank0 RCW Image" [   33.730720] 0x000000020000-0x000000120000 : "NOR DTB Image" [   33.735936] 0x000000120000-0x000000920000 : "NOR Linux Kernel Image" [   33.741852] 0x000000920000-0x000003f20000 : "NOR Ramdisk Root File System Image" [   33.748790] 0x000003f80000-0x000004000000 : "NOR bank4 u-boot Image" [   33.754745] 0x000004000000-0x000004020000 : "NOR bank4 RCW Image" [   33.760386] 0x000004020000-0x000007f20000 : "NOR JFFS2 ROOT File System Image" [   33.767169] 0x000007f80000-0x000008000000 : "NOR bank0 u-boot Image" [   33.775184] fsl-quadspi 1550000.quadspi: found mr25h256, expected n25q128a13 [   33.780911] fsl-quadspi 1550000.quadspi: mr25h256 (32 Kbytes) [   33.786498] fsl-quadspi 1550000.quadspi: Unsupported cmd 0x03 [   33.790924] fsl-quadspi 1550000.quadspi: QuadSPI SPI NOR flash driver [   33.797957] CAN device driver interface [   33.801515] libphy: Freescale PowerQUICC MII Bus: probed [   33.807818] fsl-gianfar ethernet.4: enabled errata workarounds, flags: 0x4 [   33.824282] fsl-gianfar ethernet.4 eth0: mac: 00:04:9f:03:5c:1b [   33.828877] fsl-gianfar ethernet.4 eth0: Running with NAPI enabled [   33.833746] fsl-gianfar ethernet.4 eth0: RX BD ring size for Q[0]: 256 [   33.838945] fsl-gianfar ethernet.4 eth0: TX BD ring size for Q[0]: 256 [   33.844298] fsl-gianfar ethernet.5: enabled errata workarounds, flags: 0x4 [   33.860870] fsl-gianfar ethernet.5 eth1: mac: 00:04:9f:03:5c:1c [   33.865478] fsl-gianfar ethernet.5 eth1: Running with NAPI enabled [   33.870332] fsl-gianfar ethernet.5 eth1: RX BD ring size for Q[0]: 256 [   33.875543] fsl-gianfar ethernet.5 eth1: TX BD ring size for Q[0]: 256 [   33.880881] fsl-gianfar ethernet.6: enabled errata workarounds, flags: 0x4 [   33.897133] fsl-gianfar ethernet.6 eth2: mac: 00:04:9f:03:5c:1d [   33.901739] fsl-gianfar ethernet.6 eth2: Running with NAPI enabled [   33.906592] fsl-gianfar ethernet.6 eth2: RX BD ring size for Q[0]: 256 [   33.911800] fsl-gianfar ethernet.6 eth2: TX BD ring size for Q[0]: 256 [   33.917315] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k [   33.921833] e1000e: Copyright(c) 1999 - 2013 Intel Corporation. [   34.127250] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [   34.131434] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1 [   34.137973] xhci-hcd xhci-hcd.0.auto: irq 125, io mem 0x03100000 [   34.143691] hub 1-0:1.0: USB hub found [   34.146171] hub 1-0:1.0: 1 port detected [   34.149045] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [   34.153239] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2 [   34.160420] hub 2-0:1.0: USB hub found [   34.163008] hub 2-0:1.0: 1 port detected [   34.166501] usbcore: registered new interface driver usb-storage [   34.171566] [dr_controller_setup]  vir[qh_base] is c08b8000 phy[qh_base] is 0xbf0d8000 reg is 0xbf0d8000 [   34.171862] udc fsl-usb2-udc.0: registering UDC driver [printer] [   34.171883] printer gadget: adding config #1 'printer'/80508668 [   34.171896] printer gadget: adding 'printer'/8053d488 to config 'printer'/80508668 [   34.172145] printer gadget: Printer Gadget, version: 2007 OCT 06 [   34.176827] printer gadget: cfg 1/80508668 speeds: high full [   34.176836] printer gadget:   interface 0 = printer/8053d488 [   34.176849] printer gadget: printer ready [   34.179870] mousedev: PS/2 mouse device common for all mice [   34.184504] i2c /dev entries driver [   34.187817] imx2-wdt 2ad0000.wdog: timeout 60 sec (nowayout=0) [   34.192790] qoriq_cpufreq: Freescale PowerPC qoriq CPU frequency scaling driver [   34.198806] sdhci: Secure Digital Host Controller Interface driver [   34.203670] sdhci: Copyright(c) Pierre Ossman [   34.206704] sdhci-pltfm: SDHCI platform and OF driver helper [   34.212230] sdhci-esdhc 1560000.esdhc: Looking up vqmmc-supply from device tree [   34.212245] sdhci-esdhc 1560000.esdhc: Looking up vqmmc-supply property in node /soc/esdhc@1560000 failed [   34.212256] mmc0: no vqmmc regulator found [   34.215036] sdhci-esdhc 1560000.esdhc: Looking up vmmc-supply from device tree [   34.215048] sdhci-esdhc 1560000.esdhc: Looking up vmmc-supply property in node /soc/esdhc@1560000 failed [   34.215055] mmc0: no vmmc regulator found [   34.271688] mmc0: SDHCI controller on 1560000.esdhc [1560000.esdhc] using ADMA [   34.280008] caam 1700000.crypto: Entropy delay = 3200 [   34.283764] caam 1700000.crypto: Instantiated RNG4 SH0 [   34.310499] caam 1700000.crypto: Instantiated RNG4 SH1 [   34.314337] caam 1700000.crypto: device ID = 0x0a14030000000000 (Era 7) [   34.319622] caam 1700000.crypto: job rings = 4, qi = 0 [   34.328168] caam algorithms registered in /proc/crypto [   34.361760] caam_jr 1710000.jr: registering rng-caam [   34.371849] caam 1700000.crypto: fsl,sec-v5.3 algorithms registered in /proc/crypto [   34.378406] usbcore: registered new interface driver usbhid [   34.382672] usbhid: USB HID core driver [   34.391099] sgtl5000 1-000a: sgtl5000 revision 0x11 [   34.420990] sgtl5000 1-000a: Looking up VDDA-supply from device tree [   34.421075] sgtl5000 1-000a: Looking up VDDIO-supply from device tree [   34.421160] sgtl5000 1-000a: Looking up VDDD-supply from device tree [   34.421172] sgtl5000 1-000a: Looking up VDDD-supply property in node /soc/i2c@2190000/sgtl5000@a failed [   34.421185] sgtl5000 1-000a: Failed to get supply 'VDDD': -19 [   34.425878] 1-000a: 1200 mV normal [   34.428131] sgtl5000 1-000a: Looking up VDDA-supply from device tree [   34.428202] sgtl5000 1-000a: Looking up VDDIO-supply from device tree [   34.428266] sgtl5000 1-000a: Looking up VDDD_LDO-supply from device tree [   34.428278] sgtl5000 1-000a: Looking up VDDD_LDO-supply property in node /soc/i2c@2190000/sgtl5000@a failed [   34.428344] sgtl5000 1-000a: Using internal LDO instead of VDDD [   34.444337] vf610-sgtl5000 sound.9:  sgtl5000 <-> 2b50000.sai mapping ok [   34.454126] oprofile: using timer interrupt. [   34.457494] TCP: cubic registered [   34.459492] Initializing XFRM netlink socket [   34.462500] NET: Registered protocol family 17 [   34.465655] NET: Registered protocol family 15 [   34.468777] can: controller area network core (rev 20120528 abi 9) [   34.471801] usb 1-1: new high-speed USB device number 2 using xhci-hcd [   34.478922] NET: Registered protocol family 29 [   34.482058] can: raw protocol (rev 20120528) [   34.485123] Key type dns_resolver registered [   34.490929] regulator-dummy: disabling [   34.493510] drivers/rtc/hctosys.c: unable to open rtc device (rtc0) [   34.510456] hub 1-1:1.0: USB hub found [   34.512990] hub 1-1:1.0: 4 ports detected [   34.651849] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd [   34.671847] usb 2-1: Parent hub missing LPM exit latency info.  Power management will be impacted. [   34.683316] hub 2-1:1.0: USB hub found [   34.685797] hub 2-1:1.0: 4 ports detected [   34.811744] usb 1-1.3: new full-speed USB device number 3 using xhci-hcd [   36.492006] libphy: mdio@2d24000:02 - Link is Down [   36.495798] libphy: mdio@2d24000:00 - Link is Down [   36.499586] libphy: mdio@2d24000:01 - Link is Down [   37.492335] libphy: mdio@2d24000:00 - Link is Up - 100/Full [   37.521676] Sending DHCP requests ., OK [   38.091688] IP-Config: Got DHCP answer from 172.16.40.13, my address is 172.16.40.155 [   38.120709] IP-Config: Complete: [   38.122645]      device=eth1, hwaddr=00:04:9f:03:5c:1c, ipaddr=172.16.40.155, mask=255.255.254.0, gw=172.16.40.1 [   38.131471]      host=172.16.40.155, domain=dynatele.com, nis-domain=(none) [   38.137106]      bootserver=0.0.0.0, rootserver=172.16.40.43, rootpath= [   38.142224]      nameserver0=172.16.40.13 [   38.144917] , nameserver1=172.16.40.12 [   38.147366] ALSA device list: [   38.149018]   #0: FSL-VF610-TWR-BOARD [   38.158383] VFS: Mounted root (nfs filesystem) on device 0:14. [   38.163356] devtmpfs: mounted [   38.165252] Freeing unused kernel memory: 184K (804a7000 - 804d5000) [   38.945810] udevd[128]: starting version 182 [   40.723606] cfg80211: Calling CRDA to update world regulatory domain [   40.899631] Intel(R) Wireless WiFi driver for Linux, in-tree: [   40.904130] Copyright(c) 2003-2013 Intel Corporation [   40.907942] PCI: enabling device 0000:01:00.0 (0140 -> 0142) [   41.308671] iwlwifi 0000:01:00.0: loaded firmware version 22.1.7.0 op_mode iwlmvm [   41.547637] iwlwifi 0000:01:00.0: Detected Intel(R) Dual Band Wireless AC 3160, REV=0x164 [   41.591835] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S [   41.614702] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S [   41.850417] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'

I connect TWR-LS1021A USB to my Windows PC.

[   52.941030] printer gadget: suspend [   53.065339] printer gadget: resume [   53.065349] [fsl_udc_irq]  reset int [   53.065358] [reset_irq]  Bus reset [   53.101732] [fsl_udc_irq]  Packet int [   53.101770] [fsl_build_dtd]  length = 18 address= 0xbf940000 [   53.101787] [fsl_build_dtd]  length = 0 address= 0xbf940040 [   53.101800] [process_ep_req]  dTD transmitted successful [   53.101809] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.102636] [fsl_udc_irq]  Packet int [   53.102644] [process_ep_req]  dTD transmitted successful [   53.102652] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.105404] [fsl_udc_irq]  reset int [   53.105413] [reset_irq]  Bus reset [   53.141676] [fsl_udc_irq]  Packet int [   53.141694] [fsl_build_dtd]  length = 0 address= 0xbf940040 [   53.142637] [fsl_udc_irq]  Packet int [   53.142645] [process_ep_req]  dTD transmitted successful [   53.142652] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.167690] [fsl_udc_irq]  Packet int [   53.167712] [fsl_build_dtd]  length = 18 address= 0xbf940040 [   53.167728] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   53.167739] [process_ep_req]  dTD transmitted successful [   53.167747] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.168637] [fsl_udc_irq]  Packet int [   53.168657] [fsl_build_dtd]  length = 32 address= 0xbf940000 [   53.168670] [fsl_build_dtd]  length = 0 address= 0xbf940040 [   53.168681] [process_ep_req]  dTD transmitted successful [   53.168689] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.168700] [process_ep_req]  dTD transmitted successful [   53.168707] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.169637] [fsl_udc_irq]  Packet int [   53.169655] [fsl_build_dtd]  length = 4 address= 0xbf940040 [   53.169668] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   53.169678] [process_ep_req]  dTD transmitted successful [   53.169685] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.169695] [process_ep_req]  dTD transmitted successful [   53.169703] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.170637] [fsl_udc_irq]  Packet int [   53.170652] [fsl_build_dtd]  length = 4 address= 0xbf940000 [   53.170664] [fsl_build_dtd]  length = 0 address= 0xbf940040 [   53.170674] [process_ep_req]  dTD transmitted successful [   53.170682] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.170692] [process_ep_req]  dTD transmitted successful [   53.170700] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.171637] [fsl_udc_irq]  Packet int [   53.171653] [fsl_build_dtd]  length = 30 address= 0xbf940040 [   53.171666] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   53.171677] [process_ep_req]  dTD transmitted successful [   53.171685] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.171694] [process_ep_req]  dTD transmitted successful [   53.171702] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.172638] [fsl_udc_irq]  Packet int [   53.176179] [fsl_udc_irq]  Packet int [   53.176200] [fsl_build_dtd]  length = 18 address= 0xbf940000 [   53.176214] [fsl_build_dtd]  length = 0 address= 0xbf940040 [   53.176225] [process_ep_req]  dTD transmitted successful [   53.176233] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.177137] [fsl_udc_irq]  Packet int [   53.177156] [fsl_build_dtd]  length = 9 address= 0xbf940040 [   53.177169] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   53.177179] [process_ep_req]  dTD transmitted successful [   53.177187] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.177197] [process_ep_req]  dTD transmitted successful [   53.177205] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.178137] [fsl_udc_irq]  Packet int [   53.178152] [fsl_build_dtd]  length = 32 address= 0xbf940000 [   53.178165] [fsl_build_dtd]  length = 0 address= 0xbf940040 [   53.178175] [process_ep_req]  dTD transmitted successful [   53.178183] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.178193] [process_ep_req]  dTD transmitted successful [   53.178200] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.179137] [fsl_udc_irq]  Packet int [   53.179151] [fsl_build_dtd]  length = 2 address= 0xbf940040 [   53.179162] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   53.179172] [process_ep_req]  Request not complete [   53.179179] [dtd_complete_irq]  status of process_ep_req= 1, ep = 0 [   53.179187] [process_ep_req]  dTD transmitted successful [   53.179194] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.180137] [fsl_udc_irq]  Packet int [   53.180150] [nuke]  !!! FORCE TO EXIT THE INFINITE LOOP !!!

[   53.180163] printer gadget: high-speed config #1: printer [   53.184244] [fsl_ep_enable]  enabled ep1in (ep1in) maxpacket 512 [   53.184253] [fsl_ep_enable]  enabled ep1out (ep1out) maxpacket 512 [   53.184261] printer gadget: Using interface 0 [   53.187299] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   53.187310] [process_ep_req]  Request not complete [   53.187318] [dtd_complete_irq]  status of process_ep_req= 1, ep = 0 [   53.187353] [fsl_udc_irq]  Packet int [   53.187365] [process_ep_req]  dTD transmitted successful [   53.187379] [dtd_complete_irq]  status of process_ep_req= 0, ep = 0 [   53.229023] [fsl_udc_irq]  Packet int [   53.229038] [nuke]  !!! FORCE TO EXIT THE INFINITE LOOP !!!

[   53.229048] [fsl_ep_queue]  fsl_ep_queue, bad params [   53.229059] printer gadget: ep_queue --> -22 [   53.229068] printer gadget: setup complete --> 0, 0/9 [   53.229079] [fsl_build_dtd]  length = 0 address= 0xbf940000 [   54.499533] [fsl_udc_irq]  Packet int [   54.499550] [nuke]  !!! FORCE TO EXIT THE INFINITE LOOP !!!

[   54.499562] [fsl_ep_queue]  fsl_ep_queue, bad params [   54.499573] printer gadget: ep_queue --> -22 [   54.499584] printer gadget: setup complete --> 0, 0/9 [   54.499596] [fsl_build_dtd]  length = 0 address= 0xbf940000 root@ls1021atwr:~#

0 Kudos

1,835 Views
cpark
Contributor II

I found that the following commit is causing the TWR-LS1021A system to freeze when the USB Gadget is connected to Winusb.sys Host.

commit f79a60b8785409f5a77767780315ce6d3ea04a44

Author: Peter Chen <peter.chen@freescale.com>

Date:   Wed Feb 29 20:19:46 2012 +0800

    usb: fsl_udc_core: prime status stage once data stage has primed

   

    - For Control Read transfer, the ACK handshake on an IN transaction

    may be corrupted, so the device may not receive the ACK for data

    stage, the complete irq will not occur at this situation.

    Therefore, we need to move prime status stage from complete irq

    routine to the place where the data stage has just primed, or the

    host will never get ACK for status stage.

    The above issue has been described at USB2.0 spec chapter 8.5.3.3.

   

    - After adding prime status stage just after prime the data stage,

    there is a potential problem when the status dTD is added before the data stage

    has primed by hardware. The reason is the device's dTD descriptor has NO direction bit,

    if data stage (IN) prime hasn't finished, the status stage(OUT)

    dTD will be added at data stage dTD's Next dTD Pointer, so when the data stage

    transfer has finished, the status dTD will be primed as IN by hardware,

    then the host will never receive ACK from the device side for status stage.

   

    - Delete below code at fsl_ep_queue:

           /* Update ep0 state */

           if ((ep_index(ep) == 0))

                   udc->ep0_state = DATA_STATE_XMIT;

    the udc->ep0_state will be updated again after udc->driver->setup

    finishes.

   

    It is tested at i.mx51 bbg board with g_mass_storage, g_ether, g_serial.

   

    Signed-off-by: Peter Chen <peter.chen@freescale.com>

    Signed-off-by: Felipe Balbi <balbi@ti.com>

I don't know how to fix this problem though.  I reverted this patch and it is working fine.

0 Kudos

1,835 Views
cpark
Contributor II

Pavel,

[EDIT 2/9/2015] I managed to run the same kernel (fsl-sdk-v1.7) on my MPC8347E-based custom board and the same fsl_udc_core.c works fine on that board.     

Thanks for sharing the link.  Let me take a look at it.  Beside Winusb problem, there is more generic problem.

  • TWR-LS1021A (g_serial.ko) <----------------------------------------------> Linux Host (usbserial.ko)

                /dev/ttyGS0                                                                          /dev/ttyUSB0

          "Connect --> Data Transfer --> Disconnect --> Reconnect" works fine.

  • TWR-LS1021A (g_printer.ko) <---------------------------------------------> Linux Host (usblp.ko)

                /dev/g_printer                                                                        /dev/usblp

        "Connect ---> Data Transfer --> Disconnect --> Reconnect" causes the system to freeze.

        [EDIT 2/12/2015] The root cause of this problem is identified.  There is a deadlock in the following call flow.  It locks a spinlock twice in the IRQ routine.


    fsl_udc_irq()

    |

    + reset_irq()

      |

      + reset_queues()

        |

        + composite_disconnect()

          |

          + reset_config()

            |

            + f->disable(): printer_func_disable()

              |

              + spin_lock_irqsave(&dev->lock, flags)

              + printer_reset_interface()

                |

                + fsl_ep_disable()

                  |

                  + nuke()

                    |

                    + done()

                      |

                      + rx_complete()

                        |

                        + spin_lock_irqsave(&dev->lock, flags)

    Quick and dirty workaround:

diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c

index bf7a56b..1f507d2 100644

--- a/drivers/usb/gadget/printer.c

+++ b/drivers/usb/gadget/printer.c

@@ -1047,9 +1047,7 @@ static void printer_func_disable(struct usb_function *f)

  DBG(dev, "%s\n", __func__);

- spin_lock_irqsave(&dev->lock, flags);

  printer_reset_interface(dev);

- spin_unlock_irqrestore(&dev->lock, flags);

}

static void printer_cfg_unbind(struct usb_configuration *c)

  • PowerQUICC MPC8347E (g_printer.ko) <---------------------------------------------> Linux Host (usblp.ko)

                /dev/g_printer                                                                                      /dev/usblp

        "Connect ---> Data Transfer --> Disconnect --> Reconnect" works fine.

I searched for it and found the following link on the Linux USB mailing list.  It looks like similar problem on P2020 platform as well.

http://thread.gmane.org/gmane.linux.usb.general/56700

I really appreciate if you shed some light on this issue.

0 Kudos