Commit d2f52c9e authored by Andiry Xu's avatar Andiry Xu Committed by Greg Kroah-Hartman

xHCI: test and clear RWC bit

Introduce xhci_test_and_clear_bit() to clear RWC bit in PORTSC register.
Signed-off-by: default avatarAndiry Xu <andiry.xu@amd.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c9682dff
...@@ -404,6 +404,20 @@ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, ...@@ -404,6 +404,20 @@ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array,
xhci_writel(xhci, temp, port_array[port_id]); xhci_writel(xhci, temp, port_array[port_id]);
} }
/* Test and clear port RWC bit */
void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
int port_id, u32 port_bit)
{
u32 temp;
temp = xhci_readl(xhci, port_array[port_id]);
if (temp & port_bit) {
temp = xhci_port_state_to_neutral(temp);
temp |= port_bit;
xhci_writel(xhci, temp, port_array[port_id]);
}
}
int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
u16 wIndex, char *buf, u16 wLength) u16 wIndex, char *buf, u16 wLength)
{ {
...@@ -924,12 +938,8 @@ int xhci_bus_resume(struct usb_hcd *hcd) ...@@ -924,12 +938,8 @@ int xhci_bus_resume(struct usb_hcd *hcd)
spin_lock_irqsave(&xhci->lock, flags); spin_lock_irqsave(&xhci->lock, flags);
/* Clear PLC */ /* Clear PLC */
temp = xhci_readl(xhci, port_array[port_index]); xhci_test_and_clear_bit(xhci, port_array, port_index,
if (temp & PORT_PLC) { PORT_PLC);
temp = xhci_port_state_to_neutral(temp);
temp |= PORT_PLC;
xhci_writel(xhci, temp, port_array[port_index]);
}
slot_id = xhci_find_slot_id_by_port(hcd, slot_id = xhci_find_slot_id_by_port(hcd,
xhci, port_index + 1); xhci, port_index + 1);
......
...@@ -1340,10 +1340,8 @@ static void handle_port_status(struct xhci_hcd *xhci, ...@@ -1340,10 +1340,8 @@ static void handle_port_status(struct xhci_hcd *xhci,
xhci_ring_device(xhci, slot_id); xhci_ring_device(xhci, slot_id);
xhci_dbg(xhci, "resume SS port %d finished\n", port_id); xhci_dbg(xhci, "resume SS port %d finished\n", port_id);
/* Clear PORT_PLC */ /* Clear PORT_PLC */
temp = xhci_readl(xhci, port_array[faked_port_index]); xhci_test_and_clear_bit(xhci, port_array,
temp = xhci_port_state_to_neutral(temp); faked_port_index, PORT_PLC);
temp |= PORT_PLC;
xhci_writel(xhci, temp, port_array[faked_port_index]);
} else { } else {
xhci_dbg(xhci, "resume HS port %d\n", port_id); xhci_dbg(xhci, "resume HS port %d\n", port_id);
bus_state->resume_done[faked_port_index] = jiffies + bus_state->resume_done[faked_port_index] = jiffies +
......
...@@ -1719,6 +1719,8 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, ...@@ -1719,6 +1719,8 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id,
/* 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, __le32 __iomem **port_array,
int port_id, u32 link_state); int port_id, u32 link_state);
void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
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,
char *buf, u16 wLength); char *buf, u16 wLength);
int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
......
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