aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-12-01 12:33:39 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-12-01 12:33:39 +0000
commit289a83616d6a0350175a329cea6a607a2a0cc4f3 (patch)
tree7f1161b69692ae4805aefc44f6e2724c03260bee
parent97f22eac45f2796b82c8e50642385cadd2314700 (diff)
downloadsrc-289a83616d6a0350175a329cea6a607a2a0cc4f3.tar.gz
src-289a83616d6a0350175a329cea6a607a2a0cc4f3.zip
MFC r367614:
When doing a USB alternate setting on an USB interface we need to re-configure the XHCI endpoint context. Differential Revision: https://reviews.freebsd.org/D27174 Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes: svn path=/stable/11/; revision=368210
-rw-r--r--sys/dev/usb/controller/xhci.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index b486038880f8..c2ef925d4fd3 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -4049,6 +4049,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
struct xhci_endpoint_ext *pepext;
+ struct xhci_softc *sc;
+ uint8_t index;
+ uint8_t epno;
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n",
ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode);
@@ -4065,6 +4068,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
USB_BUS_LOCK(udev->bus);
pepext->trb_halted = 1;
pepext->trb_running = 0;
+
+ /*
+ * When doing an alternate setting, except for control
+ * endpoints, we need to re-configure the XHCI endpoint
+ * context:
+ */
+ if ((edesc->bEndpointAddress & UE_ADDR) != 0) {
+ sc = XHCI_BUS2SC(udev->bus);
+ index = udev->controller_slot_id;
+ epno = XHCI_EPNO2EPID(edesc->bEndpointAddress);
+ sc->sc_hw.devs[index].ep_configured &= ~(1U << epno);
+ }
USB_BUS_UNLOCK(udev->bus);
}