From a2f962c89f65425fb8303d4edd26f3abcd5612c5 Mon Sep 17 00:00:00 2001 From: William Wu Date: Thu, 26 Jun 2025 09:07:51 +0800 Subject: [PATCH] usb: xhci: Fix bogus hs bulk wMaxPacketSize value The commit e4f47e3675e6 ("USB: xHCI: override bogus bulk wMaxPacketSize values") said that some xHCI controllers can't handle a HS bulk endpoint having a wMaxPacketSize value smaller than 512, which is forbidden by the USB spec. And it changes the max_packet value to 512, which allows the controller to use the endpoint properly. Actually, the xHCI version 1.1 can support to handle a HS bulk endpoint having a wMaxPacketSize value smaller than 512, and some HS devices (e.g. USB Printer VID:PID= 0x154F:0x154F) bulk endpoints actually only support a maximum transmission of 64 bytes. If we changes the maximum packet value to 512, these devices are unable to receive data properly. So this patch allows xHCI controller above version 1.0 to support HS bulk max packet smaller than 512. Change-Id: Ic93efb890e1df2b3313d3cfc5dbbe602a7146b2e Signed-off-by: William Wu --- drivers/usb/host/xhci-mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 88402cf424d1..f2e6f792bb02 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1472,7 +1472,8 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, err_count = 3; /* HS bulk max packet should be 512, FS bulk supports 8, 16, 32 or 64 */ if (usb_endpoint_xfer_bulk(&ep->desc)) { - if (udev->speed == USB_SPEED_HIGH) + /* xHCI 1.1 can support HS bulk max packet smaller than 512 */ + if (udev->speed == USB_SPEED_HIGH && xhci->hci_version < 0x110) max_packet = 512; if (udev->speed == USB_SPEED_FULL) { max_packet = rounddown_pow_of_two(max_packet);