diff options
| author | zelong_666 <[email protected]> | 2026-10-08 20:00:55 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-10-08 22:05:10 +0800 |
| commit | 17ff1f0045d3ee28a604c66bebeab3a9bb7f653e (patch) | |
| tree | 1ffc18e737c755a43c92e52db3910c4441b5572f | |
| parent | 51fef88da1382a395f7e6c0e907626d9e205abdd (diff) | |
fix(port/musb): Re-arm the EP0 TX interrupt in musb_control_urb_init
The data channels re-arm their interrupt enable in their own
musb_bulk_urb_init()/musb_intr_urb_init()/musb_iso_urb_init(), but the EP0
path never did: TXIE.EP0 was only ever set once, in usb_hc_init().
usbh_kill_urb() masks the interrupt of the channel that owns the abandoned
URB, and EP0 always lives on channel 0, so aborting a single control transfer
clears TXIE.EP0 for good. Every later control transfer then completes in the
hardware but never raises an EP0 interrupt, so usbh_submit_urb() runs into
errout_timeout (-USB_ERR_TIMEOUT) and enumeration can never succeed again
until the next usb_hc_init().
Seen on a host that lost its peer in the middle of enumeration (phone reboot
or re-plug): one control transfer timed out during the port reset and every
following one repeated "Failed to get device descriptor, errorcode:-14"
forever, until the board was rebooted.
Arming TXIE.EP0 here keeps EP0 symmetric with the data channels, so a single
timed-out control transfer no longer disables EP0 for the rest of the session.
| -rw-r--r-- | port/musb/usb_hc_musb.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index 374dc2a8..50e16c02 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -351,6 +351,8 @@ void musb_control_urb_init(struct usbh_bus *bus, uint8_t chidx, struct usbh_urb HWREGB(USB_TXHUBPORT_BASE(chidx)) = 0; #endif + HWREGH(USB_BASE + MUSB_TXIE_OFFSET) |= USB_TXIE_EP0; + musb_write_packet(bus, chidx, (uint8_t *)setup, 8); HWREGB(USB_TXCSRL_BASE(chidx)) = USB_CSRL0_TXRDY | USB_CSRL0_SETUP; musb_set_active_ep(bus, old_ep_index); |
