This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x USB DMA issue

Other Parts Discussed in Thread: AM3352

Hi Sir

SDK 2.00.02 with Kernel 4.1

1. We set USB DMA enabled and have below situation 

    USB0 is connected with Cellular Module

    USB1 is connected with USB Hub and Hub is connected with TypeA and USB to UART Chip。

2. We did below test flow and got error message as below 

     a. open UART device node from USB port 

     b. write data 

     c. read data

     d.close UART device node

And we got error message from console as below 

[ 121.813394] musb_host_rx 1654: RX5 dma busy, csr 2220
[ 129.819145] musb_host_rx 1654: RX2 dma busy, csr 2020
[ 168.831798] musb_host_rx 1654: RX2 dma busy, csr 2220
[ 169.618754] musb_host_rx 1654: RX5 dma busy, csr 2220

Does TI have any suggestion ? or USB DMA mode of  AM3352 has any limitation or bug ? 

BTW, attachment is the test code and complete log message 

#include        <stdio.h>
#include        <stdlib.h>
#include      	<string.h>
#include        <fcntl.h>
#include        <errno.h>
#include        <termios.h>
#include        <time.h>
#include        <sys/types.h>
#include        <sys/socket.h>
#include        <sys/ioctl.h>
#include        <sys/select.h>
#include        <linux/if.h>


#define TEST_OK         	0
#define TEST_FAIL       	1
#define TEST_LEN                256
#define RS232_WAIT_TIME         5		// unit seconds
#define MAXPORTNUM 		64
#define TESTPORT		4

#define dbg_printf(x...)        printf(x)

// must test item
static char     sbuf[TEST_LEN], wbuf[TEST_LEN], rbuf[MAXPORTNUM][TEST_LEN];

int main ()
{
	int count;
	for (count = 1; count <=10000000; count++) {
		dbg_printf("This is the %d time test\n", count);
		test();
	}
	return 0;
}

int test(void)
{
        int             fd[MAXPORTNUM];
        int             i, j, k, ret=TEST_OK;
        int             rcnt[MAXPORTNUM];
        char            name[16];
        struct termios  termio;
        unsigned long   stime;

        // initialize the file handle
        for ( i=0; i<MAXPORTNUM; i++ ) {
                fd[i] = -1;
                rcnt[i] = 0;
        }

        // open serial port
        for ( i=0; i<TESTPORT; i++ ) {
                sprintf(name, "/dev/ttyMI%d", i);
                fd[i] = open(name, O_RDWR|O_NOCTTY);
                if ( fd[i] <= 0 ) {
                        dbg_printf("Open serial port /dev/ttyMI%d fail !\n", i);
                        ret = TEST_FAIL;
                        continue;
                }
        }

        memset(rbuf[0], -1, TEST_LEN * MAXPORTNUM);
        for ( i=0; i<TEST_LEN; i++ )
                wbuf[i] =  i;

        // initialize the serial
        termio.c_iflag = 0;
        termio.c_oflag = 0;
        termio.c_lflag = 0;
        termio.c_cflag = B115200 | CRTSCTS | CS8 | CREAD | CLOCAL;
        termio.c_cc[VMIN] = 0;
        termio.c_cc[VTIME] = 0;

        for ( i=0; i<TESTPORT; i++ ) {
                tcflush(fd[i], TCIOFLUSH);
                tcsetattr(fd[i], TCSANOW, &termio);
                tcflush(fd[i], TCIOFLUSH);
        }

        usleep(100*1000);
        for ( i=0; i<TESTPORT; i++ )
                write(fd[i], wbuf, TEST_LEN);
        stime = time(NULL);
                usleep(90 * 1000);
        while ( (unsigned long)(time(NULL)-stime) < RS232_WAIT_TIME ) {
                for ( i=0; i<TESTPORT; i++ ) {
                        if ( rcnt[i] < TEST_LEN )
                                break;
                }
                if ( i == TESTPORT )
                        break;
                for ( i=0; i<TESTPORT; i++ ) {
                        if ( (j=rcnt[i]) >= TEST_LEN )
                                continue;
                        if ( (k=read(fd[i], &rbuf[i][j], TEST_LEN-j)) <= 0 )
                                continue;
                        rcnt[i] += k;
                }
        }

        for ( i=0; i<TESTPORT; i++ ) {
                if ( rcnt[i] < TEST_LEN ) {
                        dbg_printf("Serial port %d read length error !\n", i);
                        ret = TEST_FAIL;
                        continue;
                }
                for ( j=0; j<TEST_LEN; j++ ) {
                        if ( wbuf[j] != rbuf[i][j] ) {
                                dbg_printf("Serial port %d read data error !\n", i);
                                dbg_printf("wbuf[%d]=%x,rbuf[%d][%d]=%x\n", j, wbuf[j], i, j, rbuf[i][j]);
                                ret = TEST_FAIL;
				exit (1);
                        }
                }
        }

        for ( i=0; i<MAXPORTNUM; i++ ) {
                if ( fd[i] > 0 ) {
                        tcflush(fd[i], TCIOFLUSH);
                        close(fd[i]);
                }
        }
        if( ret == TEST_OK )
                dbg_printf("serial test OK!\n");
	else
		exit;

        return ret;
}


[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.1.0-ltsi-rt-mxcore01+ (root@weshuang) (gcc version 4.9.2 ( 4.9.2-10) ) #1 SMP Wed Oct 5 14:10:48 CST 2016
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: MOXA MXcore01
[    0.000000] cma: Reserved 16 MiB at 0x9e800000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 130816
[    0.000000] free_area_init_node: node 0, pgdat c0725840, node_mem_map dfa71000
[    0.000000]   Normal zone: 1152 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 130816 pages, LIFO batch:31
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (neon )
[    0.000000] PERCPU: Embedded 12 pages/cpu @dfa3c000 s17984 r8192 d22976 u49152
[    0.000000] pcpu-alloc: s17984 r8192 d22976 u49152 alloc=12*4096
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129664
[    0.000000] Kernel command line: mac=11:22:33:44:55:66 sd=2 ver=3 console=ttyS0,115200n8 root=/dev/mmcblk1p2 rootfstype=ext4 rootwait
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 493984K/523264K available (5155K kernel code, 217K rwdata, 1592K rodata, 324K init, 271K bss, 12896K reserved, 16384K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc069efa4   (6748 kB)
      .init : 0xc069f000 - 0xc06f0000   ( 324 kB)
      .data : 0xc06f0000 - 0xc0726780   ( 218 kB)
       .bss : 0xc0729000 - 0xc076cc80   ( 272 kB)
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] OMAP clockevent source: timer2 at 25000000 Hz
[    0.000016] sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 85899345900ns
[    0.000041] clocksource timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 76450417870 ns
[    0.000054] OMAP clocksource: timer1 at 25000000 Hz
[    0.000390] Console: colour dummy device 80x30
[    0.000431] Calibrating delay loop... 795.44 BogoMIPS (lpj=3977216)
[    0.089090] pid_max: default: 32768 minimum: 301
[    0.089235] Security Framework initialized
[    0.089270] SELinux:  Initializing.
[    0.089305] SELinux:  Starting in permissive mode
[    0.089376] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.089389] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090331] Initializing cgroup subsys blkio
[    0.090360] Initializing cgroup subsys memory
[    0.090415] Initializing cgroup subsys devices
[    0.090435] Initializing cgroup subsys freezer
[    0.090459] Initializing cgroup subsys net_cls
[    0.090476] Initializing cgroup subsys perf_event
[    0.090492] Initializing cgroup subsys net_prio
[    0.090525] CPU: Testing write buffer coherency: ok
[    0.091002] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.091110] Setting up static identity map for 0x80008280 - 0x800082d8
[    0.092818] Brought up 1 CPUs
[    0.092841] SMP: Total of 1 processors activated (795.44 BogoMIPS).
[    0.092850] CPU: All CPU(s) started in SVC mode.
[    0.093729] devtmpfs: initialized
[    0.105888] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.120391] omap_hwmod: tptc0 using broken dt data from edma
[    0.120556] omap_hwmod: tptc1 using broken dt data from edma
[    0.120698] omap_hwmod: tptc2 using broken dt data from edma
[    0.125811] omap_hwmod: debugss: _wait_target_disable failed
[    0.167927] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.170127] pinctrl core: initialized pinctrl subsystem
[    0.171547] NET: Registered protocol family 16
[    0.174389] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.175244] cpuidle: using governor ladder
[    0.175261] cpuidle: using governor menu
[    0.178534] gpiochip_add: registered GPIOs 0 to 31 on device: gpio
[    0.178997] OMAP GPIO hardware version 0.1
[    0.179768] gpiochip_add: registered GPIOs 32 to 63 on device: gpio
[    0.180748] gpiochip_add: registered GPIOs 64 to 95 on device: gpio
[    0.181705] gpiochip_add: registered GPIOs 96 to 127 on device: gpio
[    0.188769] No ATAGs?
[    0.188806] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.206090] edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
[    0.206610] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator@0[0]'
[    0.207003] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixedregulator@1[0]'
[    0.209280] SCSI subsystem initialized
[    0.209700] libata version 3.00 loaded.
[    0.210117] usbcore: registered new interface driver usbfs
[    0.210204] usbcore: registered new interface driver hub
[    0.210287] usbcore: registered new device driver usb
[    0.210781] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[    0.210837] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins, deferring probe
[    0.212174] NetLabel: Initializing
[    0.212193] NetLabel:  domain hash size = 128
[    0.212199] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.212272] NetLabel:  unlabeled traffic allowed by default
[    0.212627] Switched to clocksource timer1
[    0.226653] NET: Registered protocol family 2
[    0.227650] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.227715] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    0.227790] TCP: Hash tables configured (established 4096 bind 4096)
[    0.227895] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.227921] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.228194] NET: Registered protocol family 1
[    0.229201] CPU PMU: Failed to parse /pmu/interrupt-affinity[0]
[    0.229266] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    0.231333] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.231440] audit: initializing netlink subsys (disabled)
[    0.231545] audit: type=2000 audit(0.210:1): initialized
[    0.233699] VFS: Disk quotas dquot_6.6.0
[    0.233809] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.234356] SELinux:  Registering netfilter hooks
[    0.236994] io scheduler noop registered
[    0.237018] io scheduler deadline registered (default)
[    0.237115] io scheduler cfq registered
[    0.238220] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    0.239239] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.241295] console [ttyS0] disabled
[    0.241366] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 154, base_baud = 3000000) is a 8250
[    0.861257] console [ttyS0] enabled
[    0.866356] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[    0.886857] brd: module loaded
[    0.896730] loop: module loaded
[    0.902766] m25p80 spi1.0: mx25l6405d (8192 Kbytes)
[    0.908520] 3 ofpart partitions found on MTD device spi1.0
[    0.914127] Creating 3 MTD partitions on "spi1.0":
[    0.918959] 0x000000000000-0x000000080000 : "MLO"
[    0.925229] 0x000000080000-0x000000180000 : "U-Boot"
[    0.931342] 0x000000180000-0x0000001a0000 : "U-Boot Env"
[    0.938973] PPP generic driver version 2.4.2
[    0.943839] PPP BSD Compression module registered
[    0.948579] PPP Deflate Compression module registered
[    0.953743] PPP MPPE Compression module registered
[    0.958571] NET: Registered protocol family 24
[    0.963639] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.970207] ehci-omap: OMAP-EHCI Host Controller driver
[    0.975629] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.991181] am335x-phy-driver 47401300.usb-phy: GPIO lookup for consumer reset
[    0.991209] am335x-phy-driver 47401300.usb-phy: using device tree for GPIO lookup
[    0.991228] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
[    0.991240] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
[    0.991251] am335x-phy-driver 47401300.usb-phy: using lookup tables for GPIO lookup
[    0.991265] am335x-phy-driver 47401300.usb-phy: lookup for GPIO reset failed
[    0.991278] am335x-phy-driver 47401300.usb-phy: GPIO lookup for consumer vbus-detect
[    0.991289] am335x-phy-driver 47401300.usb-phy: using device tree for GPIO lookup
[    0.991302] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpios' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
[    0.991314] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpio' property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
[    0.991325] am335x-phy-driver 47401300.usb-phy: using lookup tables for GPIO lookup
[    0.991337] am335x-phy-driver 47401300.usb-phy: lookup for GPIO vbus-detect failed
[    0.991405] 47401300.usb-phy supply vcc not found, using dummy regulator
[    1.005403] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
[    1.005424] musb-hdrc: MHDRC RTL version 2.0 
[    1.005435] musb-hdrc: setup fifo_mode 4
[    1.005458] musb-hdrc: 28/31 max ep, 16384/16384 memory
[    1.005633] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
[    1.011440] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
[    1.019773] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.026641] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.033917] usb usb1: Product: MUSB HDRC host driver
[    1.038906] usb usb1: Manufacturer: Linux 4.1.0-ltsi-rt-mxcore01+ musb-hcd
[    1.045851] usb usb1: SerialNumber: musb-hdrc.0.auto
[    1.051979] hub 1-0:1.0: USB hub found
[    1.055943] hub 1-0:1.0: 1 port detected
[    1.061159] am335x-phy-driver 47401b00.usb-phy: GPIO lookup for consumer reset
[    1.061181] am335x-phy-driver 47401b00.usb-phy: using device tree for GPIO lookup
[    1.061201] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
[    1.061214] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
[    1.061225] am335x-phy-driver 47401b00.usb-phy: using lookup tables for GPIO lookup
[    1.061239] am335x-phy-driver 47401b00.usb-phy: lookup for GPIO reset failed
[    1.061251] am335x-phy-driver 47401b00.usb-phy: GPIO lookup for consumer vbus-detect
[    1.061262] am335x-phy-driver 47401b00.usb-phy: using device tree for GPIO lookup
[    1.061274] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpios' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
[    1.061285] of_get_named_gpiod_flags: can't parse 'vbus-detect-gpio' property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
[    1.061296] am335x-phy-driver 47401b00.usb-phy: using lookup tables for GPIO lookup
[    1.061308] am335x-phy-driver 47401b00.usb-phy: lookup for GPIO vbus-detect failed
[    1.061367] 47401b00.usb-phy supply vcc not found, using dummy regulator
[    1.075233] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
[    1.075253] musb-hdrc: MHDRC RTL version 2.0 
[    1.075263] musb-hdrc: setup fifo_mode 4
[    1.075282] musb-hdrc: 28/31 max ep, 16384/16384 memory
[    1.075440] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.081248] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
[    1.089546] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    1.096426] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.103706] usb usb2: Product: MUSB HDRC host driver
[    1.108694] usb usb2: Manufacturer: Linux 4.1.0-ltsi-rt-mxcore01+ musb-hcd
[    1.115629] usb usb2: SerialNumber: musb-hdrc.1.auto
[    1.121622] hub 2-0:1.0: USB hub found
[    1.125563] hub 2-0:1.0: 1 port detected
[    1.130502] i2c /dev entries driver
[    1.134983] omap_hsmmc 48060000.mmc: GPIO lookup for consumer cd
[    1.135000] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
[    1.135019] of_get_named_gpiod_flags: can't parse 'cd-gpios' property of node '/ocp/mmc@48060000[0]'
[    1.135031] of_get_named_gpiod_flags: can't parse 'cd-gpio' property of node '/ocp/mmc@48060000[0]'
[    1.135043] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
[    1.135056] omap_hsmmc 48060000.mmc: lookup for GPIO cd failed
[    1.135070] omap_hsmmc 48060000.mmc: GPIO lookup for consumer wp
[    1.135080] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
[    1.135092] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@48060000[0]'
[    1.135103] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@48060000[0]'
[    1.135113] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
[    1.135124] omap_hsmmc 48060000.mmc: lookup for GPIO wp failed
[    1.172920] omap_hsmmc 481d8000.mmc: GPIO lookup for consumer cd
[    1.172944] omap_hsmmc 481d8000.mmc: using device tree for GPIO lookup
[    1.172977] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/ocp/mmc@481d8000[0]' - status (0)
[    1.173052] omap_hsmmc 481d8000.mmc: Got CD GPIO
[    1.177706] omap_hsmmc 481d8000.mmc: GPIO lookup for consumer wp
[    1.177718] omap_hsmmc 481d8000.mmc: using device tree for GPIO lookup
[    1.177731] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp/mmc@481d8000[0]'
[    1.177743] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp/mmc@481d8000[0]'
[    1.177754] omap_hsmmc 481d8000.mmc: using lookup tables for GPIO lookup
[    1.177766] omap_hsmmc 481d8000.mmc: lookup for GPIO wp failed
[    1.213409] ledtrig-cpu: registered to indicate activity on CPUs
[    1.219837] oprofile: using arm/armv7
[    1.224024] Initializing XFRM netlink socket
[    1.228505] NET: Registered protocol family 10
[    1.234923] NET: Registered protocol family 17
[    1.239440] NET: Registered protocol family 15
[    1.244054] Key type dns_resolver registered
[    1.248987] ThumbEE CPU extension supported.
[    1.253370] Registering SWP/SWPB emulation handler
[    1.266173] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.276381] mmc0: new high speed SDHC card at address 97a2
[    1.282752] mmcblk0: mmc0:97a2 SE08G 7.28 GiB 
[    1.289283]  mmcblk0: p1
[    1.322661] rtc-ds1374 0-0068: rtc core: registered ds1374 as rtc0
[    1.328926] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    1.348876] mmc1: MAN_BKOPS_EN bit is not set
[    1.353936] gpiochip_find_base: found new base at 496
[    1.354114] gpiochip_add: registered GPIOs 496 to 511 on device: pca9535
[    1.354887] gpiochip_find_base: found new base at 480
[    1.355076] gpiochip_add: registered GPIOs 480 to 495 on device: pca9535
[    1.355847] gpiochip_find_base: found new base at 464
[    1.355995] gpiochip_add: registered GPIOs 464 to 479 on device: pca9535
[    1.356814] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 400 kHz
[    1.377627] mmc1: new high speed MMC card at address 0001
[    1.383838] mmcblk1: mmc1:0001 Q2J55L 7.09 GiB 
[    1.388616] mmcblk1boot0: mmc1:0001 Q2J55L partition 1 16.0 MiB
[    1.394923] mmcblk1boot1: mmc1:0001 Q2J55L partition 2 16.0 MiB
[    1.402473]  mmcblk1: p1 p2 p3
[    1.422625] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    1.428765] davinci_mdio 4a101000.mdio: detected phy mask 7ffffffd
[    1.436320] libphy: 4a101000.mdio: probed
[    1.440368] davinci_mdio 4a101000.mdio: phy[31]: device 4a101000.mdio:1f, driver Marvell 88E1118
[    1.449887] cpsw 4a100000.ethernet: Missing slave[0] phy_id property
[    1.456507] cpsw 4a100000.ethernet: Detected MACID = 00:90:e8:00:00:45
[    1.465470] rtc-ds1374 0-0068: setting system clock to 2016-11-15 03:23:52 UTC (1479180232)
[    1.480991] vbat: disabling
[    1.487031] EXT4-fs (mmcblk1p2): INFO: recovery required on readonly filesystem
[    1.494501] EXT4-fs (mmcblk1p2): write access will be enabled during recovery
[    1.533207] usb 2-1: new high-speed USB device number 2 using musb-hdrc
[    1.570288] EXT4-fs (mmcblk1p2): recovery complete
[    1.576117] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.584406] VFS: Mounted root (ext4 filesystem) readonly on device 179:10.
[    1.596788] devtmpfs: mounted
[    1.600272] Freeing unused kernel memory: 324K (c069f000 - c06f0000)
[    1.674210] usb 2-1: New USB device found, idVendor=05e3, idProduct=0610
[    1.680968] usb 2-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    1.688220] usb 2-1: Product: USB2.0 Hub
[    1.693700] hub 2-1:1.0: USB hub found
[    1.697895] hub 2-1:1.0: 2 ports detected
[    1.827193] random: systemd urandom read with 18 bits of entropy available
[    1.839265] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[    1.853397] systemd[1]: Detected architecture 'arm'.
[    1.929791] systemd[1]: Inserted module 'autofs4'
[    1.936719] systemd[1]: Set hostname to <Moxa>.
[    1.982835] usb 2-1.1: new high-speed USB device number 3 using musb-hdrc
[    2.146978] usb 2-1.1: New USB device found, idVendor=0403, idProduct=6011
[    2.154010] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.161355] usb 2-1.1: Product: USB <-> Serial Converter
[    2.166718] usb 2-1.1: Manufacturer: FTDI
[    2.272772] usb 2-1.2: new high-speed USB device number 4 using musb-hdrc
[    2.363719] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
[    2.380903] usb 2-1.2: New USB device found, idVendor=054c, idProduct=05ba
[    2.387923] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.395290] usb 2-1.2: Product: Storage Media
[    2.399669] usb 2-1.2: Manufacturer: Sony
[    2.403717] usb 2-1.2: SerialNumber: CB4001202110003834
[    2.411321] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    2.419842] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.427749] systemd[1]: Expecting device dev-ttyS0.device...
[    2.452872] systemd[1]: Starting Remote File Systems (Pre).
[    2.472788] systemd[1]: Reached target Remote File Systems (Pre).
[    2.479074] systemd[1]: Starting Encrypted Volumes.
[    2.502760] systemd[1]: Reached target Encrypted Volumes.
[    2.508458] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.
[    2.542772] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.552441] systemd[1]: Starting Dispatch Password Requests to Console Directory Watch.
[    2.560993] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[    2.569167] systemd[1]: Starting Paths.
[    2.592739] systemd[1]: Reached target Paths.
[    2.597216] systemd[1]: Starting Swap.
[    2.612741] systemd[1]: Reached target Swap.
[    2.617139] systemd[1]: Starting Root Slice.
[    2.632758] systemd[1]: Created slice Root Slice.
[    2.637594] systemd[1]: Starting User and Session Slice.
[    2.662764] systemd[1]: Created slice User and Session Slice.
[    2.668655] systemd[1]: Starting Delayed Shutdown Socket.
[    2.692773] systemd[1]: Listening on Delayed Shutdown Socket.
[    2.698657] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[    2.722762] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    2.729871] systemd[1]: Starting Journal Socket (/dev/log).
[    2.752767] systemd[1]: Listening on Journal Socket (/dev/log).
[    2.758878] systemd[1]: Starting udev Kernel Socket.
[    2.782758] systemd[1]: Listening on udev Kernel Socket.
[    2.788245] systemd[1]: Starting udev Control Socket.
[    2.812764] systemd[1]: Listening on udev Control Socket.
[    2.818340] systemd[1]: Starting Journal Socket.
[    2.842767] systemd[1]: Listening on Journal Socket.
[    2.847979] systemd[1]: Starting System Slice.
[    2.872788] systemd[1]: Created slice System Slice.
[    2.877936] systemd[1]: Starting File System Check on Root Device...
[    2.906416] systemd[1]: Starting system-getty.slice.
[    2.933171] systemd[1]: Created slice system-getty.slice.
[    2.938772] systemd[1]: Starting system-serial\x2dgetty.slice.
[    2.947785] systemd[1]: Created slice system-serial\x2dgetty.slice.
[    2.963241] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[    2.979565] systemd[1]: Mounting Debug File System...
[    3.017347] systemd[1]: Started Set Up Additional Binary Formats.
[    3.049741] systemd[1]: Starting Load Kernel Modules...
[    3.077243] systemd[1]: Mounted Huge Pages File System.
[    3.100428] systemd[1]: Mounting POSIX Message Queue File System...
[    3.125861] systemd[1]: Starting udev Coldplug all Devices...
[    3.151038] fuse init (API version 7.23)
[    3.166268] systemd[1]: Starting Journal Service...
[    3.253115] systemd[1]: Started Journal Service.
[    3.891193] EXT4-fs (mmcblk1p2): re-mounted. Opts: errors=remount-ro
[    4.131643] systemd-udevd[102]: starting version 215
[    4.515262] systemd-journald[84]: Received request to flush runtime journal from PID 1
[    4.767237] lm75 0-0048: hwmon0: sensor 'lm75'
[    4.816619] lm75 2-0048: hwmon1: sensor 'lm75'
[    4.873440] lm75 2-0049: hwmon2: sensor 'lm75'
[    4.908687] ds1374_wdt: Watchdog timer initial timeout 60 sec
[    4.914633] ds1374_wdt: Common mode
[    5.444498] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[    5.470781] usbcore: registered new interface driver usbserial
[    5.476947] usbcore: registered new interface driver usbserial_generic
[    5.483658] usbserial: USB Serial support registered for generic
[    5.507410] usbcore: registered new interface driver ftdi_sio
[    5.513473] usbserial: USB Serial support registered for FTDI USB Serial Device
[    5.521120] ftdi_sio 2-1.1:1.0: FTDI USB Serial Device converter detected
[    5.528270] usb 2-1.1: Detected FT4232H
[    5.624698] scsi host0: usb-storage 2-1.2:1.0
[    5.629830] usbcore: registered new interface driver usb-storage
[    5.678186] CAN device driver interface
[    5.730895] c_can_platform 481d0000.can: c_can_platform device registered (regs=fa1d0000, irq=160)
[    5.775479] usb 2-1.1: FTDI USB Serial Device converter now attached to ttyUSB0
[    5.783128] ftdi_sio 2-1.1:1.1: FTDI USB Serial Device converter detected
[    5.790154] usb 2-1.1: Detected FT4232H
[    5.999089] usb 2-1.1: FTDI USB Serial Device converter now attached to ttyUSB1
[    6.006779] ftdi_sio 2-1.1:1.2: FTDI USB Serial Device converter detected
[    6.013891] usb 2-1.1: Detected FT4232H
[    6.163021] usb 2-1.1: FTDI USB Serial Device converter now attached to ttyUSB2
[    6.170609] ftdi_sio 2-1.1:1.3: FTDI USB Serial Device converter detected
[    6.177745] usb 2-1.1: Detected FT4232H
[    6.361676] usb 2-1.1: FTDI USB Serial Device converter now attached to ttyUSB3
[    6.573188] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
[    6.579004] omap-sham 53100000.sham: initialization failed.
[    6.584766] omap-sham: probe of 53100000.sham failed with error -22
[    6.592955] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
[    6.623959] scsi 0:0:0:0: Direct-Access     Sony     Storage Media    0100 PQ: 0 ANSI: 4
[    6.680467] sd 0:0:0:0: [sda] 31297536 512-byte logical blocks: (16.0 GB/14.9 GiB)
[    6.729588] sd 0:0:0:0: [sda] Write Protect is off
[    6.734584] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[    6.780057] sd 0:0:0:0: [sda] No Caching mode page found
[    6.785599] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    6.903732] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    7.005941]  sda: sda1
[    7.044250] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    7.300824] random: nonblocking pool is initialized
[    7.814049] EXT4-fs (sda): no journal found
[    8.157925] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    8.515553] net eth0: initializing cpsw version 1.12 (0)
[    8.522764] libphy: PHY  not found
[    8.526190] net eth0: phy  not found on slave 0
[    8.603582] net eth0: phy found : id is : 0x1410e11
[    8.614342] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    9.868053] EXT4-fs (mmcblk1p2): resizing filesystem from 93696 to 1818368 blocks
[   10.009888] EXT4-fs (mmcblk1p2): resized filesystem to 1818368
[   12.603975] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   12.612050] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[  121.813394] musb_host_rx 1654: RX5 dma busy, csr 2220
[  129.819145] musb_host_rx 1654: RX2 dma busy, csr 2020
[  168.831798] musb_host_rx 1654: RX2 dma busy, csr 2220
[  169.618754] musb_host_rx 1654: RX5 dma busy, csr 2220
[  303.422169] musb_host_rx 1654: RX3 dma busy, csr 2020
[  342.235840] musb_host_rx 1654: RX2 dma busy, csr 2020
[  344.192769] musb_host_rx 1654: RX3 dma busy, csr 2220
[  494.336656] musb_host_rx 1654: RX2 dma busy, csr 2020
[  595.943147] musb_host_rx 1654: RX5 dma busy, csr 2020
[ 1068.457980] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1081.727536] musb_host_rx 1654: RX4 dma busy, csr 2220
[ 1091.487219] musb_host_rx 1654: RX2 dma busy, csr 2220
[ 1110.217581] musb_host_rx 1654: RX2 dma busy, csr 2220
[ 1139.086573] musb_host_rx 1654: RX2 dma busy, csr 2020
[ 1168.152576] musb_host_rx 1654: RX2 dma busy, csr 2220
[ 1175.767310] musb_host_rx 1654: RX5 dma busy, csr 2220
[ 1241.684058] musb_host_rx 1654: RX5 dma busy, csr 2020
[ 1371.767614] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1375.674482] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1456.028766] musb_host_rx 1654: RX2 dma busy, csr 2220
[ 1458.376669] musb_host_rx 1654: RX3 dma busy, csr 2220
[ 1469.888258] musb_host_rx 1654: RX4 dma busy, csr 2220
[ 1489.592589] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1505.012086] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1510.870891] musb_host_rx 1654: RX2 dma busy, csr 2020
[ 1540.322850] musb_host_rx 1654: RX5 dma busy, csr 2220
[ 1555.342374] musb_host_rx 1654: RX2 dma busy, csr 2020
[ 1599.621848] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1621.076118] musb_host_rx 1654: RX3 dma busy, csr 2020
[ 1652.867042] musb_host_rx 1654: RX2 dma busy, csr 2020
[ 1667.697529] musb_host_rx 1654: RX2 dma busy, csr 2220

BR

Yimin

  • The USB experts have been notified. They will respond here.
  • Hi,

    Is the UART device on USB1 high-speed or full-speed device? What is the chipset? Its VID:PID? What is the VID:PID of the hub?

    Do you observe any data corruption other than the 'rx dma busy' messages?

  • Hi,

    USB Hub Chip: GL852G 

    USB to UART Chip: FT4232HL

    There are 4 UART ports from FT4232HL.

    I sent data from port1 to port2, port3 to port4 with RS232 Mode baud rate 115200.

    For a while, p2 and port4 received the wrong data and  I got only "musb_host_rx 1654: RX5 dma busy, csr 2220" message from console.

    Does TI have any suggestion? Thank you very much.

  • Wes,

    Wes Huang said:
    For a while, p2 and port4 received the wrong data and  I got only "musb_host_rx 1654: RX5 dma busy, csr 2220" message from console.

    Does the wrong data happen in the test code you posted or in your real project?

    I observed the 'dma busy' message with your test code, but no wrong data.

    The 'dma busy' happens when closing the uart ports, but it seems to be harmless.

    The USB trace shows FT4232H only transmits upto 14 bytes even it received 256 bytes data with your test code, DMA doesn't improve performance in this case which only has small RX usb packets. So one way to work around this issue is to disable CPPI DMA, is this acceptable in your project?

  • Wes,

    the following two patches should fix the 'dma busy' problem. Please test it and let me know.

    From 73842246caab12aec68e11f3fa341abffe899431 Mon Sep 17 00:00:00 2001
    From: Bin Liu <b-liu@ti.com>
    Date: Wed, 23 Nov 2016 11:37:12 -0600
    Subject: [PATCH 1/2] usb: musb: core: add clear_ep_rxintr() to
     musb_platform_ops
    
    During dma teardown for dequque urb, musb might generate bogus rx ep
    interrupt even when the rx fifo is flushed. As mentioned in the current
    inline comment, clearing ep interrupt in the teardown path avoids the
    bogus interrupt.
    
    Before this change, any of the follow log messages could happen when
    musb load is high.
    
    	musb_host_rx 1853: BOGUS RX2 ready, csr 0000, count 0
    
    	musb_host_rx 1936: RX3 dma busy, csr 2020
    
    Signed-off-by: Bin Liu <b-liu@ti.com>
    
    Conflicts:
    	drivers/usb/musb/musb_core.h
    ---
     drivers/usb/musb/musb_core.h |  6 ++++++
     drivers/usb/musb/musb_host.c | 10 ++++------
     2 files changed, 10 insertions(+), 6 deletions(-)
    
    diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
    index 3877249a8b2d..318bb8709350 100644
    --- a/drivers/usb/musb/musb_core.h
    +++ b/drivers/usb/musb/musb_core.h
    @@ -205,6 +205,7 @@ struct musb_platform_ops {
     	int	(*adjust_channel_params)(struct dma_channel *channel,
     				u16 packet_sz, u8 *mode,
     				dma_addr_t *dma_addr, u32 *len);
    +	void	(*clear_ep_rxintr)(struct musb *musb, int epnum);
     };
     
     /*
    @@ -590,4 +591,9 @@ static inline int musb_platform_exit(struct musb *musb)
     	return musb->ops->exit(musb);
     }
     
    +static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum)
    +{
    +	if (musb->ops->clear_ep_rxintr)
    +		musb->ops->clear_ep_rxintr(musb, epnum);
    +}
     #endif	/* __MUSB_CORE_H__ */
    diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
    index d6a16fba8934..d29b1d31c58c 100644
    --- a/drivers/usb/musb/musb_host.c
    +++ b/drivers/usb/musb/musb_host.c
    @@ -2273,12 +2273,11 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
     	int			is_in = usb_pipein(urb->pipe);
     	int			status = 0;
     	u16			csr;
    +	struct dma_channel	*dma = NULL;
     
     	musb_ep_select(regs, hw_end);
     
     	if (is_dma_capable()) {
    -		struct dma_channel	*dma;
    -
     		dma = is_in ? ep->rx_channel : ep->tx_channel;
     		if (dma) {
     			status = ep->musb->dma_controller->channel_abort(dma);
    @@ -2295,10 +2294,9 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
     		/* giveback saves bulk toggle */
     		csr = musb_h_flush_rxfifo(ep, 0);
     
    -		/* REVISIT we still get an irq; should likely clear the
    -		 * endpoint's irq status here to avoid bogus irqs.
    -		 * clearing that status is platform-specific...
    -		 */
    +		/* clear the endpoint's irq status here to avoid bogus irqs */
    +		if (is_dma_capable() && dma)
    +			musb_platform_clear_ep_rxintr(musb, ep->epnum);
     	} else if (ep->epnum) {
     		musb_h_tx_flush_fifo(ep);
     		csr = musb_readw(epio, MUSB_TXCSR);
    -- 
    1.9.1
    
    

    From 8c0e1c2fc0063790795803c6c0b222a5eccaa5b6 Mon Sep 17 00:00:00 2001
    From: Bin Liu <b-liu@ti.com>
    Date: Wed, 23 Nov 2016 12:21:24 -0600
    Subject: [PATCH 2/2] usb: musb: dsps: implement clear_ep_rxintr() callback
    
    This is for avoiding rx ep bogus interrupt during CPPI channel teardown
    when musb load is high.
    
    Signed-off-by: Bin Liu <b-liu@ti.com>
    ---
     drivers/usb/musb/musb_dsps.c | 12 ++++++++++++
     1 file changed, 12 insertions(+)
    
    diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
    index dcac5e7f19e0..fad6d5b92df9 100644
    --- a/drivers/usb/musb/musb_dsps.c
    +++ b/drivers/usb/musb/musb_dsps.c
    @@ -301,6 +301,17 @@ static void otg_timer(unsigned long _musb)
     	spin_unlock_irqrestore(&musb->lock, flags);
     }
     
    +void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum)
    +{
    +	u32 epintr;
    +	struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
    +	const struct dsps_musb_wrapper *wrp = glue->wrp;
    +
    +	/* musb->lock might already been held */
    +	epintr = (1 << epnum) << wrp->rxep_shift;
    +	musb_writel(musb->ctrl_base, wrp->epintr_status, epintr);
    +}
    +
     static irqreturn_t dsps_interrupt(int irq, void *hci)
     {
     	struct musb  *musb = hci;
    @@ -647,6 +658,7 @@ static struct musb_platform_ops dsps_ops = {
     	.try_idle	= dsps_musb_try_idle,
     	.set_mode	= dsps_musb_set_mode,
     	.recover	= dsps_musb_recover,
    +	.clear_ep_rxintr = dsps_musb_clear_ep_rxintr,
     };
     
     static u64 musb_dmamask = DMA_BIT_MASK(32);
    -- 
    1.9.1
    
    

    The following patches are not related to this issue, but are important fixes backported from v4.4. Please consider to apply them as well.

    From 34c69dbf7e9c9911cdcdd02cdfb43305a3b170d5 Mon Sep 17 00:00:00 2001
    From: Andrew Goodbody <andrew.goodbody@cambrionix.com>
    Date: Tue, 31 May 2016 10:05:27 -0500
    Subject: [PATCH 1/3] usb: musb: Stop bulk endpoint while queue is rotated
    
    commit 7b2c17f829545df27a910e8d82e133c21c9a8c9c upstream.
    
    Ensure that the endpoint is stopped by clearing REQPKT before
    clearing DATAERR_NAKTIMEOUT before rotating the queue on the
    dedicated bulk endpoint.
    This addresses an issue where a race could result in the endpoint
    receiving data before it was reprogrammed resulting in a warning
    about such data from musb_rx_reinit before it was thrown away.
    The data thrown away was a valid packet that had been correctly
    ACKed which meant the host and device got out of sync.
    
    Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
    Signed-off-by: Bin Liu <b-liu@ti.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
     drivers/usb/musb/musb_host.c | 8 +++++++-
     1 file changed, 7 insertions(+), 1 deletion(-)
    
    diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
    index c3d5fc9dfb5b..643a15588ce7 100644
    --- a/drivers/usb/musb/musb_host.c
    +++ b/drivers/usb/musb/musb_host.c
    @@ -950,9 +950,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep,
     	if (is_in) {
     		dma = is_dma_capable() ? ep->rx_channel : NULL;
     
    -		/* clear nak timeout bit */
    +		/*
    +		 * Need to stop the transaction by clearing REQPKT first
    +		 * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED
    +		 * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2
    +		 */
     		rx_csr = musb_readw(epio, MUSB_RXCSR);
     		rx_csr |= MUSB_RXCSR_H_WZC_BITS;
    +		rx_csr &= ~MUSB_RXCSR_H_REQPKT;
    +		musb_writew(epio, MUSB_RXCSR, rx_csr);
     		rx_csr &= ~MUSB_RXCSR_DATAERROR;
     		musb_writew(epio, MUSB_RXCSR, rx_csr);
     
    -- 
    1.9.1
    
    

    From 28a3cad74cc76395c720f1a7add22858b47dcaf5 Mon Sep 17 00:00:00 2001
    From: Andrew Goodbody <andrew.goodbody@cambrionix.com>
    Date: Tue, 31 May 2016 10:05:26 -0500
    Subject: [PATCH 2/3] usb: musb: Ensure rx reinit occurs for shared_fifo
     endpoints
    
    commit f3eec0cf784e0d6c47822ca6b66df3d5812af7e6 upstream.
    
    shared_fifo endpoints would only get a previous tx state cleared
    out, the rx state was only cleared for non shared_fifo endpoints
    Change this so that the rx state is cleared for all endpoints.
    This addresses an issue that resulted in rx packets being dropped
    silently.
    
    Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
    Signed-off-by: Bin Liu <b-liu@ti.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
     drivers/usb/musb/musb_host.c | 13 ++++++-------
     1 file changed, 6 insertions(+), 7 deletions(-)
    
    diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
    index 643a15588ce7..06853d7c89fd 100644
    --- a/drivers/usb/musb/musb_host.c
    +++ b/drivers/usb/musb/musb_host.c
    @@ -583,14 +583,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)
     		musb_writew(ep->regs, MUSB_TXCSR, 0);
     
     	/* scrub all previous state, clearing toggle */
    -	} else {
    -		csr = musb_readw(ep->regs, MUSB_RXCSR);
    -		if (csr & MUSB_RXCSR_RXPKTRDY)
    -			WARNING("rx%d, packet/%d ready?\n", ep->epnum,
    -				musb_readw(ep->regs, MUSB_RXCOUNT));
    -
    -		musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
     	}
    +	csr = musb_readw(ep->regs, MUSB_RXCSR);
    +	if (csr & MUSB_RXCSR_RXPKTRDY)
    +		WARNING("rx%d, packet/%d ready?\n", ep->epnum,
    +			musb_readw(ep->regs, MUSB_RXCOUNT));
    +
    +	musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
     
     	/* target addr and (for multipoint) hub addr/port */
     	if (musb->is_multipoint) {
    -- 
    1.9.1
    
    

  • Wes,

    Please download the patches from the e2e post, not from the URLs in your notification email. The patch #2 has been updated in the post above, so the URL in the notification email is out of date.

  • Hi Bin,

    Thank you!

    I think the "musb_host_rx 1654: RX5 dma busy, csr 2220" problem was fixed.

    But I still got the wrong data with the re_open_serial_test.c test code.

    This is the 1789 time test
    serial test OK!
    This is the 1790 time test
    serial test OK!
    This is the 1791 time test
    serial test OK!
    This is the 1792 time test
    serial test OK!
    This is the 1793 time test
    serial test OK!
    This is the 1794 time test
    serial test OK!
    This is the 1795 time test
    serial test OK!
    This is the 1796 time test
    serial test OK!
    This is the 1797 time test
    Serial port 3 read data error !
    wbuf[1]=1,rbuf[3][1]=0

    When I changed the USB mode from DMA to PIO mode, It is solved.

    Do you have any suggestion?

    Thank you very much!

  • Wes, thanks for the update. I will take a look at the data error soon.

  • Wes,

    I captured a usbmon log while the read data error happened, but the log looks good, no data corruption in rx packets. So it seems to be a bug in your test code, or in kernel ftdi driver.

    To capture usbmon log:

    # cat /sys/kernel/debug/usb/usbmon/2u > usbmon-2u.log

    For usbmon information, please refer to kernel doc: Documentation/usb/usbmon.txt