Skip to content

Commit 2395c15

Browse files
committed
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 56dcdfe commit 2395c15

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
@@ -1549,10 +1549,11 @@ static int xhci_check_ep0_maxpacket(struct xhci_hcd *xhci, struct xhci_virt_devi
15491549
* XXX: bandwidth is not recalculated. We should probably do that.
15501550
*/
15511551

1552-
static unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index)
1553-
{
1554-
return 1 << (ep_index + 1);
1555-
}
1552+
static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci,
1553+
struct xhci_container_ctx *in_ctx,
1554+
struct xhci_container_ctx *out_ctx,
1555+
struct xhci_input_control_ctx *ctrl_ctx,
1556+
u32 add_flags, u32 drop_flags);
15561557

15571558
static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
15581559
struct usb_host_endpoint *ep, int interval)
@@ -1566,10 +1567,14 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
15661567
int ret;
15671568
int ep_index;
15681569
unsigned long flags;
1569-
u32 ep_info_tmp;
1570+
u32 ep_flag, ep_info_tmp;
15701571

15711572
xhci = hcd_to_xhci(hcd);
15721573
ep_index = xhci_get_endpoint_index(&ep->desc);
1574+
ep_flag = xhci_get_endpoint_flag(&ep->desc);
1575+
1576+
if (ep_flag == SLOT_FLAG || ep_flag == EP0_FLAG)
1577+
return;
15731578

15741579
/* FS/LS interval translations */
15751580
if ((udev->speed == USB_SPEED_FULL ||
@@ -1630,8 +1635,8 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
16301635
mutex_unlock(&xhci->mutex);
16311636
return;
16321637
}
1633-
ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index);
1634-
ctrl_ctx->drop_flags = ctrl_ctx->add_flags;
1638+
xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, vdev->out_ctx,
1639+
ctrl_ctx, ep_flag, ep_flag);
16351640

16361641
spin_unlock_irqrestore(&xhci->lock, flags);
16371642

0 commit comments

Comments
 (0)