Skip to content

Commit 654cc14

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 2489a96 commit 654cc14

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

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

15491550
static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
15501551
struct usb_host_endpoint *ep, int interval)
@@ -1558,10 +1559,14 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
15581559
int ret;
15591560
int ep_index;
15601561
unsigned long flags;
1561-
u32 ep_info_tmp;
1562+
u32 ep_flag, ep_info_tmp;
15621563

15631564
xhci = hcd_to_xhci(hcd);
15641565
ep_index = xhci_get_endpoint_index(&ep->desc);
1566+
ep_flag = xhci_get_endpoint_flag(&ep->desc);
1567+
1568+
if (ep_flag == SLOT_FLAG || ep_flag == EP0_FLAG)
1569+
return;
15651570

15661571
/* FS/LS interval translations */
15671572
if ((udev->speed == USB_SPEED_FULL ||
@@ -1622,8 +1627,8 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
16221627
mutex_unlock(&xhci->mutex);
16231628
return;
16241629
}
1625-
ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index);
1626-
ctrl_ctx->drop_flags = ctrl_ctx->add_flags;
1630+
xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, vdev->out_ctx,
1631+
ctrl_ctx, ep_flag, ep_flag);
16271632

16281633
spin_unlock_irqrestore(&xhci->lock, flags);
16291634

0 commit comments

Comments
 (0)