Commit 6b7f40f7 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

xhci: change xhci_set_link_state() to work with port structures

Remove old iomem port array and index as parameters, just
send a ponter to a port strucure instread
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 74e6ad58
...@@ -678,16 +678,16 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci) ...@@ -678,16 +678,16 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci)
return xhci_reset(xhci); return xhci_reset(xhci);
} }
void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port,
int port_id, u32 link_state) u32 link_state)
{ {
u32 temp; u32 temp;
temp = readl(port_array[port_id]); temp = readl(port->addr);
temp = xhci_port_state_to_neutral(temp); temp = xhci_port_state_to_neutral(temp);
temp &= ~PORT_PLS_MASK; temp &= ~PORT_PLS_MASK;
temp |= PORT_LINK_STROBE | link_state; temp |= PORT_LINK_STROBE | link_state;
writel(temp, port_array[port_id]); writel(temp, port->addr);
} }
static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci, static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci,
...@@ -932,8 +932,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, ...@@ -932,8 +932,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
xhci_test_and_clear_bit(xhci, port_array, wIndex, xhci_test_and_clear_bit(xhci, port_array, wIndex,
PORT_PLC); PORT_PLC);
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, port, XDEV_U0);
XDEV_U0);
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
time_left = wait_for_completion_timeout( time_left = wait_for_completion_timeout(
...@@ -1142,7 +1141,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -1142,7 +1141,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
temp = readl(ports[wIndex]->addr); temp = readl(ports[wIndex]->addr);
if ((temp & PORT_PLS_MASK) != XDEV_U0) { if ((temp & PORT_PLS_MASK) != XDEV_U0) {
/* Resume the port to U0 first */ /* Resume the port to U0 first */
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, ports[wIndex],
XDEV_U0); XDEV_U0);
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
msleep(10); msleep(10);
...@@ -1170,7 +1169,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -1170,7 +1169,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
xhci_stop_device(xhci, slot_id, 1); xhci_stop_device(xhci, slot_id, 1);
spin_lock_irqsave(&xhci->lock, flags); spin_lock_irqsave(&xhci->lock, flags);
xhci_set_link_state(xhci, port_array, wIndex, XDEV_U3); xhci_set_link_state(xhci, ports[wIndex], XDEV_U3);
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
msleep(10); /* wait device to enter */ msleep(10); /* wait device to enter */
...@@ -1200,8 +1199,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -1200,8 +1199,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
/* Put link in RxDetect (enable port) */ /* Put link in RxDetect (enable port) */
if (link_state == USB_SS_PORT_LS_RX_DETECT) { if (link_state == USB_SS_PORT_LS_RX_DETECT) {
xhci_dbg(xhci, "Enable port %d\n", wIndex); xhci_dbg(xhci, "Enable port %d\n", wIndex);
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, ports[wIndex],
link_state); link_state);
temp = readl(ports[wIndex]->addr); temp = readl(ports[wIndex]->addr);
break; break;
} }
...@@ -1233,8 +1232,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -1233,8 +1232,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
xhci_dbg(xhci, "Enable compliance mode transition for port %d\n", xhci_dbg(xhci, "Enable compliance mode transition for port %d\n",
wIndex); wIndex);
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, ports[wIndex],
link_state); link_state);
temp = readl(ports[wIndex]->addr); temp = readl(ports[wIndex]->addr);
break; break;
} }
...@@ -1262,8 +1262,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -1262,8 +1262,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
} }
} }
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, ports[wIndex], link_state);
link_state);
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
msleep(20); /* wait device to enter */ msleep(20); /* wait device to enter */
...@@ -1357,12 +1356,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -1357,12 +1356,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
goto error; goto error;
set_bit(wIndex, &bus_state->resuming_ports); set_bit(wIndex, &bus_state->resuming_ports);
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, ports[wIndex],
XDEV_RESUME); XDEV_RESUME);
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
msleep(USB_RESUME_TIMEOUT); msleep(USB_RESUME_TIMEOUT);
spin_lock_irqsave(&xhci->lock, flags); spin_lock_irqsave(&xhci->lock, flags);
xhci_set_link_state(xhci, port_array, wIndex, xhci_set_link_state(xhci, ports[wIndex],
XDEV_U0); XDEV_U0);
clear_bit(wIndex, &bus_state->resuming_ports); clear_bit(wIndex, &bus_state->resuming_ports);
} }
...@@ -1676,8 +1675,7 @@ int xhci_bus_resume(struct usb_hcd *hcd) ...@@ -1676,8 +1675,7 @@ int xhci_bus_resume(struct usb_hcd *hcd)
/* Clear PLC to poll it later for U0 transition */ /* Clear PLC to poll it later for U0 transition */
xhci_test_and_clear_bit(xhci, port_array, port_index, xhci_test_and_clear_bit(xhci, port_array, port_index,
PORT_PLC); PORT_PLC);
xhci_set_link_state(xhci, port_array, port_index, xhci_set_link_state(xhci, ports[port_index], XDEV_U0);
XDEV_U0);
} }
} }
......
...@@ -1591,8 +1591,7 @@ static void handle_port_status(struct xhci_hcd *xhci, ...@@ -1591,8 +1591,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
bus_state->port_remote_wakeup |= 1 << hcd_portnum; bus_state->port_remote_wakeup |= 1 << hcd_portnum;
xhci_test_and_clear_bit(xhci, port_array, xhci_test_and_clear_bit(xhci, port_array,
hcd_portnum, PORT_PLC); hcd_portnum, PORT_PLC);
xhci_set_link_state(xhci, port_array, hcd_portnum, xhci_set_link_state(xhci, port, XDEV_U0);
XDEV_U0);
/* Need to wait until the next link state change /* Need to wait until the next link state change
* indicates the device is actually in U0. * indicates the device is actually in U0.
*/ */
......
...@@ -2102,8 +2102,8 @@ void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring); ...@@ -2102,8 +2102,8 @@ void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring);
unsigned int count_trbs(u64 addr, u64 len); unsigned int count_trbs(u64 addr, u64 len);
/* xHCI roothub code */ /* xHCI roothub code */
void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port,
int port_id, u32 link_state); u32 link_state);
void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
int port_id, u32 port_bit); int port_id, u32 port_bit);
int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment