Commit 6baf7e74 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman
Browse files

xhci: Pass port structure as parameter to xhci_disable_port().



Pass the port structure to xhci_disable_port() instead of
address, index, and value.

re-read the port portsc value before disabling the port.

Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20230202150505.618915-9-mathias.nyman@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2996e9fc
Loading
Loading
Loading
Loading
+15 −9
Original line number Original line Diff line number Diff line
@@ -578,13 +578,16 @@ void xhci_ring_device(struct xhci_hcd *xhci, int slot_id)
	return;
	return;
}
}


static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
static void xhci_disable_port(struct xhci_hcd *xhci, struct xhci_port *port)
		u16 wIndex, __le32 __iomem *addr, u32 port_status)
{
{
	struct usb_hcd *hcd;
	u32 portsc;

	hcd = port->rhub->hcd;

	/* Don't allow the USB core to disable SuperSpeed ports. */
	/* Don't allow the USB core to disable SuperSpeed ports. */
	if (hcd->speed >= HCD_USB3) {
	if (hcd->speed >= HCD_USB3) {
		xhci_dbg(xhci, "Ignoring request to disable "
		xhci_dbg(xhci, "Ignoring request to disable SuperSpeed port.\n");
				"SuperSpeed port.\n");
		return;
		return;
	}
	}


@@ -594,11 +597,15 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
		return;
		return;
	}
	}


	portsc = readl(port->addr);
	portsc = xhci_port_state_to_neutral(portsc);

	/* Write 1 to disable the port */
	/* Write 1 to disable the port */
	writel(port_status | PORT_PE, addr);
	writel(portsc | PORT_PE, port->addr);
	port_status = readl(addr);

	portsc = readl(port->addr);
	xhci_dbg(xhci, "disable port %d-%d, portsc: 0x%x\n",
	xhci_dbg(xhci, "disable port %d-%d, portsc: 0x%x\n",
		 hcd->self.busnum, wIndex + 1, port_status);
		 hcd->self.busnum, port->hcd_portnum + 1, portsc);
}
}


static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue,
static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue,
@@ -1601,8 +1608,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
					port->addr, temp);
					port->addr, temp);
			break;
			break;
		case USB_PORT_FEAT_ENABLE:
		case USB_PORT_FEAT_ENABLE:
			xhci_disable_port(hcd, xhci, wIndex,
			xhci_disable_port(xhci, port);
					port->addr, temp);
			break;
			break;
		case USB_PORT_FEAT_POWER:
		case USB_PORT_FEAT_POWER:
			xhci_set_port_power(xhci, port, false, &flags);
			xhci_set_port_power(xhci, port, false, &flags);