usb: xhci: Fix bogus hs bulk wMaxPacketSize value

The commit e4f47e3675 ("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 <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2025-06-26 09:07:51 +08:00
committed by Tao Huang
parent 5d239fb6bc
commit a2f962c89f

View File

@@ -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);