[错误] [cherryusb] [EHCI] 未刷新 SETUP 包缓存,导致 enumerate 失败
LOG [I/USB] EHCI HCIVERSION:0x0095 [I/USB] EHCI HCSPARAMS:0x000012 [I/USB] EHCI HCCPARAMS:0x0000 [I/USB] EHCI ppc:1, n_ports:2, n_cc:0, n_pcc:0 [I/USB] EHCI uses tt for ls/fs device [D/usbh_hub] Port change:0x04 [D/usbh_hub] Port change:0x04 [D/usbh_hub] Port 2 change [D/usbh_hub] port 2, status:0x101, change:0x01 [D/usbh_hub] Port 2, status:0x101, change:0x00 [D/usbh_hub] Port 2, status:0x101, change:0x00 [D/usbh_hub] Port 2, status:0x101, change:0x00 [D/usbh_hub] Port 2, status:0x101, change:0x00 [D/usbh_hub] Port 2, status:0x101, change:0x00 [D/usbh_hub] Port 2, status:0x503, change:0x02 [I/usbh_hub] New high-speed device on Bus 0, Hub 1, Port 2 connected [D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008 [D/usbh_core] Device rev=0200 cls=09 sub=00 proto=02 size=64 [D/usbh_core] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0002, wIndex 0x0000, wLength 0x0000 [W/usbh_core] Control transfer failed, errorcode -9, retrying… [W/usbh_core] Control transfer failed, errorcode -9, retrying… [E/usbh_core] Failed to set devaddr,errorcode:-9 [I/usbh_core] Device on Bus 0, Hub 1, Port 2 disconnected [E/usbh_hub] Port 2 enumerate fail
CODE
#if defined(CONFIG_USB_EHCI_DESC_DCACHE_ENABLE) // 刷新 SETUP 包缓存 usb_dcache_flush((uintptr_t)urb->setup, 8); #endifint usbh_submit_urb(struct usbh_urb *urb) { struct ehci_qh_hw *qh = NULL; size_t flags; int ret = 0; struct usbh_hub *hub; struct usbh_hubport *hport; struct usbh_bus *bus; if (!urb || !urb->hport || !urb->ep || !urb->hport->bus) { return -USB_ERR_INVAL; } #ifdef CONFIG_USB_DCACHE_ENABLE USB_ASSERT_MSG(!((uintptr_t)urb->setup % CONFIG_USB_ALIGN_SIZE) && !((uintptr_t)urb->transfer_buffer % CONFIG_USB_ALIGN_SIZE), "urb->setup or urb->transfer_buffer is not aligned %d", CONFIG_USB_ALIGN_SIZE); #endif bus = urb->hport->bus; /* find active hubport in roothub */ hport = urb->hport; hub = urb->hport->parent; while (!hub->is_roothub) { hport = hub->parent; hub = hub->parent->parent; } #ifdef CONFIG_USB_EHCI_WITH_OHCI if (EHCI_HCOR->portsc[hport->port - 1] & EHCI_PORTSC_OWNER) { return ohci_submit_urb(urb); } #endif if (!urb->hport->connected || !(EHCI_HCOR->portsc[hport->port - 1] & EHCI_PORTSC_CCS)) { return -USB_ERR_NOTCONN; }
…
内容来源: RT-Thread/rt-thread