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 <jonathan@raspberrypi.com>
This commit is contained in:
Jonathan Bell
2025-05-13 15:22:46 +01:00
committed by Dom Cobley
parent fdcad97b9c
commit ab0f651e1b

View File

@@ -1620,10 +1620,11 @@ static int xhci_check_ep0_maxpacket(struct xhci_hcd *xhci, struct xhci_virt_devi
* XXX: bandwidth is not recalculated. We should probably do that.
*/
static unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index)
{
return 1 << (ep_index + 1);
}
static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci,
struct xhci_container_ctx *in_ctx,
struct xhci_container_ctx *out_ctx,
struct xhci_input_control_ctx *ctrl_ctx,
u32 add_flags, u32 drop_flags);
static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
struct usb_host_endpoint *ep, int interval)
@@ -1637,10 +1638,14 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
int ret;
int ep_index;
unsigned long flags;
u32 ep_info_tmp;
u32 ep_flag, ep_info_tmp;
xhci = hcd_to_xhci(hcd);
ep_index = xhci_get_endpoint_index(&ep->desc);
ep_flag = xhci_get_endpoint_flag(&ep->desc);
if (ep_flag == SLOT_FLAG || ep_flag == EP0_FLAG)
return;
/* FS/LS interval translations */
if ((udev->speed == USB_SPEED_FULL ||
@@ -1701,8 +1706,8 @@ static void xhci_fixup_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
mutex_unlock(&xhci->mutex);
return;
}
ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index);
ctrl_ctx->drop_flags = ctrl_ctx->add_flags;
xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, vdev->out_ctx,
ctrl_ctx, ep_flag, ep_flag);
spin_unlock_irqrestore(&xhci->lock, flags);