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.

使用AM3352,通过USB接口外接USB2.0设备,不能枚举USB2.0设备类型

内核版本是3.2.0.  问题详细描述如下:

插入USB设备时提示信息:

[root@zabt ]#[ 1174.200500] usb 2-1: device descriptor read/64, error -71
[ 1174.430511] usb 2-1: device descriptor read/64, error -71
[ 1174.780487] usb 2-1: device descriptor read/64, error -71
[ 1175.010498] usb 2-1: device descriptor read/64, error -71
[ 1175.262268] usb 2-1: device descriptor read/8, error -71
[ 1175.392242] usb 2-1: device descriptor read/8, error -71
[ 1175.642242] usb 2-1: device descriptor read/8, error -71
[ 1175.772247] usb 2-1: device descriptor read/8, error -71
[ 1175.880523] hub 2-0:1.0: unable to enumerate USB device on port 1

插入过程中,增加的调试信息输出如下:

[ 1174.080535] usb 2-1: new high-speed USB device number 6 using musb-hdrc
[ 1174.080566] Debug goto at drivers/usb/core/hub.c:2959 hub_port_init
[ 1174.080596] Debug goto at musb_write_fifo:272, offset(0)
[ 1174.080657] DEBUG drivers/usb/musb/musb_core.c:273 TX ep0 fifo d084ac20 count 8 buf cf587200
[ 1174.080718] DEBUG usbintr (0) epintr(1) err(0)
[ 1174.080749] DEBUG musb_interrupt ** IRQ host usb0000 tx0001 rx0000 usb0000 devctl:5d power:f0
[ 1174.080780]
[ 1174.080780] DEBUG musb_h_ep0_irq <== csr0(d084ad02) 0200, qh cf5829c0, count 0, urb cf584240, stage 1
[ 1174.080810] Debug goto at drivers/usb/musb/musb_host.c:1238, complete:0
[ 1174.080841] Debug goto at drivers/usb/musb/musb_host.c:1243, complete:0
[ 1174.080871] DEBUG ep0 STATUS, csr 0020
[ 1174.080902] Debug goto at drivers/usb/musb/ti81xx.c:1199,
[ 1174.080993] DEBUG usbintr (0) epintr(1) err(0)
[ 1174.081024] DEBUG musb_interrupt ** IRQ host usb0000 tx0001 rx0000 usb0000 devctl:5d power:f0
[ 1174.081085]
[ 1174.081085] DEBUG musb_h_ep0_irq <== csr0(d084ad02) 0210, qh cf5829c0, count 0, urb cf584240, stage 2
[ 1174.081115] Debug goto at drivers/usb/musb/musb_host.c:1186, no response, csr0 0210
[ 1174.081146] Debug goto at drivers/usb/musb/musb_host.c:1205, complete:0 Debug goto at drivers/usb/musb/musb_host.c:1238, complete:1
[ 1174.081207] Debug goto at drivers/usb/musb/musb_host.c:1272, Debug goto at drivers/usb/musb/ti81xx.c:1199,
[ 1174.081329] Debug goto at drivers/usb/core/hub.c:2997, call usb_control_msg return:-71
[ 1174.081359] Debug goto at musb_write_fifo:272, offset(0)
[ 1174.081390] DEBUG drivers/usb/musb/musb_core.c:273 TX ep0 fifo d084ac20 count 8 buf cf587200
[ 1174.081420] DEBUG usbintr (0) epintr(1) err(0)
[ 1174.081451] DEBUG musb_interrupt ** IRQ host usb0000 tx0001 rx0000 usb0000 devctl:5d power:f0
[ 1174.081512]
[ 1174.081512] DEBUG musb_h_ep0_irq <== csr0(d084ad02) 0200, qh cf5829c0, count 0, urb cf584240, stage 1
[ 1174.081542] Debug goto at drivers/usb/musb/musb_host.c:1238, complete:0
[ 1174.081573] Debug goto at drivers/usb/musb/musb_host.c:1243, complete:0
[ 1174.081604] DEBUG ep0 STATUS, csr 0020
[ 1174.081604] Debug goto at drivers/usb/musb/ti81xx.c:1199,
[ 1174.081756] DEBUG usbintr (0) epintr(1) err(0)
[ 1174.081787] DEBUG musb_interrupt ** IRQ host usb0000 tx0001 rx0000 usb0000 devctl:5d power:f0
[ 1174.081817]
[ 1174.081817] DEBUG musb_h_ep0_irq <== csr0(d084ad02) 0210, qh cf5829c0, count 0, urb cf584240, stage 2
[ 1174.081848] Debug goto at drivers/usb/musb/musb_host.c:1186, no response, csr0 0210
[ 1174.081878] Debug goto at drivers/usb/musb/musb_host.c:1205, complete:0 Debug goto at drivers/usb/musb/musb_host.c:1238, complete:1
[ 1174.081939] Debug goto at drivers/usb/musb/musb_host.c:1272, Debug goto at drivers/usb/musb/ti81xx.c:1199,
[ 1174.082031] Debug goto at drivers/usb/core/hub.c:2997, call usb_control_msg return:-71
[ 1174.082061] Debug goto at musb_write_fifo:272, offset(0)
[ 1174.082092] DEBUG drivers/usb/musb/musb_core.c:273 TX ep0 fifo d084ac20 count 8 buf cf587200
[ 1174.082153] DEBUG usbintr (0) epintr(1) err(0)
[ 1174.082183] DEBUG musb_interrupt ** IRQ host usb0000 tx0001 rx0000 usb0000 devctl:5d power:f0
[ 1174.082214]
[ 1174.082214] DEBUG musb_h_ep0_irq <== csr0(d084ad02) 0200, qh cf5829c0, count 0, urb cf584240, stage 1
[ 1174.082244] Debug goto at drivers/usb/musb/musb_host.c:1238, complete:0
[ 1174.082275] Debug goto at drivers/usb/musb/musb_host.c:1243, complete:0
[ 1174.082305] DEBUG ep0 STATUS, csr 0020
[ 1174.082336] Debug goto at drivers/usb/musb/ti81xx.c:1199,
[ 1174.082427] DEBUG usbintr (0) epintr(1) err(0)
[ 1174.082458] DEBUG musb_interrupt ** IRQ host usb0000 tx0001 rx0000 usb0000 devctl:5d power:f0
[ 1174.082519]
[ 1174.082519] DEBUG musb_h_ep0_irq <== csr0(d084ad02) 0210, qh cf5829c0, count 0, urb cf584240, stage 2
[ 1174.082550] Debug goto at drivers/usb/musb/musb_host.c:1186, no response, csr0 0210
[ 1174.082580] Debug goto at drivers/usb/musb/musb_host.c:1205, complete:0 Debug goto at drivers/usb/musb/musb_host.c:1238, complete:1
[ 1174.082641] Debug goto at drivers/usb/musb/musb_host.c:1272, Debug goto at drivers/usb/musb/ti81xx.c:1199,
[ 1174.082733] Debug goto at drivers/usb/core/hub.c:2997, call usb_control_msg return:-71
[ 1174.082763] Debug drivers/usb/core/hcd.c:477, type:00002303, speed:00000020
[ 1174.082794] Debug DeviceRequest:00008000, DeviceOutRequest:00000000
[ 1174.140380] Debug drivers/usb/core/hcd.c:477, type:0000a300, speed:00000020
[ 1174.140411] Debug DeviceRequest:00008000, DeviceOutRequest:00000000
[ 1174.140472] Debug goto drivers/usb/core/hcd.c:648,
[ 1174.140502] Debug goto at drivers/usb/core/hub.c:2117, portstatus(503)
[ 1174.140533] Debug goto at drivers/usb/core/hub.c:2129, portspeed(3)
[ 1174.200378] Debug drivers/usb/core/hcd.c:477, type:00002301, speed:00000020
[ 1174.200408] Debug DeviceRequest:00008000, DeviceOutRequest:00000000
[ 1174.200439] Enabled port 1.
[ 1174.200469] Debug goto at drivers/usb/core/hub.c:3020 hub_port_init retval:0
[ 1174.200469]
[ 1174.200500] usb 2-1: device descriptor read/64, error -71

代码修改如下:

irqreturn_t musb_h_ep0_irq(struct musb *musb)

dev_dbg(musb->controller, "<== csr0 %04x, qh %p, count %d, urb %p, stage %d\n",
csr, qh, len, urb, musb->ep0_stage);

printk("\r\nDEBUG musb_h_ep0_irq <== csr0(%08x) %04x, qh %p, count %d, urb %p, stage %d\n",
(epio+MUSB_CSR0),csr, qh, len, urb, musb->ep0_stage);

/* prepare status */
if (csr & MUSB_CSR0_H_RXSTALL) {
dev_dbg(musb->controller, "STALLING ENDPOINT\n");
status = -EPIPE;

} else if (csr & MUSB_CSR0_H_ERROR) {
dev_dbg(musb->controller, "no response, csr0 %04x\n", csr);
status = -EPROTO; printk("Debug goto at %s:%d, ",__FILE__, __LINE__);
printk(" no response, csr0 %04x\n", csr);

} else if (csr & MUSB_CSR0_H_NAKTIMEOUT) {

...