Skip to content

Commit 4431571

Browse files
P33Mpopcornmix
authored andcommitted
usb: xhci: set Input Slot Context bit in xhci_fixup_endpoint
The Renesas uPD controller is a bit more picky about validating Configure Endpoint TRBs and requires that bit 0 of the ADD field is 1. This is mentioned in xhci v1.2 s4.6.6. Also drop a redundant helper function and reject invalid endpoints. Signed-off-by: Jonathan Bell <[email protected]>
1 parent 0ad7f9f commit 4431571

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/usb/host/xhci.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,10 +1538,11 @@ static int xhci_check_ep0_maxpacket(struct xhci_hcd *xhci, struct xhci_virt_devi
15381538
* XXX: bandwidth is not recalculated. We should probably do that.
15391539
*/
15401540

1541-
static unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index)
1542-
{
1543-
return 1 << (ep_index + 1);
1544-
}
1541+
static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci,
1542+
struct xhci_container_ctx *in_ctx,
1543+
struct xhci_container_ctx *out_ctx,
1544+
struct xhci_input_control_ctx *ctrl_ctx,
1545+
u32 add_flags, u32 drop_flags);
15451546

15461547
static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
15471548
struct usb_host_endpoint *ep, int interval)
@@ -1555,10 +1556,14 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
15551556
int ret;
15561557
int ep_index;
15571558
unsigned long flags;
1558-
u32 ep_info_tmp;
1559+
u32 ep_flag, ep_info_tmp;
15591560

15601561
xhci = hcd_to_xhci(hcd);
15611562
ep_index = xhci_get_endpoint_index(&ep->desc);
1563+
ep_flag = xhci_get_endpoint_flag(&ep->desc);
1564+
1565+
if (ep_flag == SLOT_FLAG || ep_flag == EP0_FLAG)
1566+
return;
15621567

15631568
/* FS/LS interval translations */
15641569
if ((udev->speed == USB_SPEED_FULL ||
@@ -1619,8 +1624,8 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
16191624
mutex_unlock(&xhci->mutex);
16201625
return;
16211626
}
1622-
ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index);
1623-
ctrl_ctx->drop_flags = ctrl_ctx->add_flags;
1627+
xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, vdev->out_ctx,
1628+
ctrl_ctx, ep_flag, ep_flag);
16241629

16251630
spin_unlock_irqrestore(&xhci->lock, flags);
16261631

0 commit comments

Comments
 (0)