xhci: Do not drop and add bits in xhci

Drop and Add bits reset the data toggle for high-speed devices in XHCI.
The toggle bit represents the sequence number in USB 2.0 transfers. However,
a device can only recognize that the toggle bit has been reset while in
the HALT state. As a result, the host and device toggle values may
become mismatched, causing xHCI to reject the packet. This issue was
observed while testing the EZ-USB FX2 device.

The transfer may then return to the original value after a
bi-directional TD because the toggle field is only one bit wide. This
explains the reson that we can only receive packets bi-transfer in some
case. Therefore, we do not reset the toggle bit here.

Reviewed by:    adrian
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57146
This commit is contained in:
ShengYi Hung committed 2026-05-22 15:41:07 +08:00
1 parent 0c85df0065
commit 28d85db46b
1 file changed
+9 -5
+9 -5
View File
@@ -3898,10 +3898,8 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer)
*/
switch (xhci_get_endpoint_state(udev, epno)) {
case XHCI_EPCTX_0_EPSTATE_DISABLED:
drop = 0;
break;
case XHCI_EPCTX_0_EPSTATE_STOPPED:
drop = 1;
drop = 0;
break;
case XHCI_EPCTX_0_EPSTATE_HALTED:
err = xhci_cmd_reset_ep(sc, 0, epno, index);
@@ -3910,9 +3908,15 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer)
DPRINTF("Could not reset endpoint %u\n", epno);
break;
default:
drop = 1;
/*
* xHCI spec 4.6.8:
* The Drop and Add operation resets the toggle bit, which can
* cause a toggle mismatch between the device and host. As a
* result, xHCI may refuse to receive or process the packet.
*/
err = xhci_cmd_stop_ep(sc, 0, epno, index);
if (err != 0)
drop = (err != 0);
if (drop)
DPRINTF("Could not stop endpoint %u\n", epno);
break;
}