usb: hub: Fix usb_get_port_status() for big-endian platforms

Add missing endianness conversions to usb_get_port_status(). This
(amongst others) is necessary to enable the use of USB 3 hubs on
big-endian platforms like MIPS Octeon.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
This commit is contained in:
Aaron Williams 2021-04-06 12:10:16 +02:00 committed by Marek Vasut
parent 472fd5a35a
commit c1125bad6c

View file

@ -144,7 +144,8 @@ int usb_get_port_status(struct usb_device *dev, int port, void *data)
if (!usb_hub_is_root_hub(dev->dev) && usb_hub_is_superspeed(dev)) { if (!usb_hub_is_root_hub(dev->dev) && usb_hub_is_superspeed(dev)) {
struct usb_port_status *status = (struct usb_port_status *)data; struct usb_port_status *status = (struct usb_port_status *)data;
u16 tmp = (status->wPortStatus) & USB_SS_PORT_STAT_MASK; u16 tmp = le16_to_cpu(status->wPortStatus) &
USB_SS_PORT_STAT_MASK;
if (status->wPortStatus & USB_SS_PORT_STAT_POWER) if (status->wPortStatus & USB_SS_PORT_STAT_POWER)
tmp |= USB_PORT_STAT_POWER; tmp |= USB_PORT_STAT_POWER;
@ -152,7 +153,7 @@ int usb_get_port_status(struct usb_device *dev, int port, void *data)
USB_SS_PORT_STAT_SPEED_5GBPS) USB_SS_PORT_STAT_SPEED_5GBPS)
tmp |= USB_PORT_STAT_SUPER_SPEED; tmp |= USB_PORT_STAT_SUPER_SPEED;
status->wPortStatus = tmp; status->wPortStatus = cpu_to_le16(tmp);
} }
#endif #endif