aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndiry Xu <andiry.xu@amd.com>2011-09-23 17:19:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-26 18:51:09 -0400
commitd2f52c9e585bbb1a3c164e02b8dcd0d996c67353 (patch)
treedbf01ea79e8d869e3ab3493cea8e2b1801d193bc /drivers
parentc9682dffceb4bb3bdf6df4c0c87c4b887b03f5b7 (diff)
xHCI: test and clear RWC bit
Introduce xhci_test_and_clear_bit() to clear RWC bit in PORTSC register. Signed-off-by: Andiry Xu <andiry.xu@amd.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/host/xhci-hub.c22
-rw-r--r--drivers/usb/host/xhci-ring.c6
-rw-r--r--drivers/usb/host/xhci.h2
3 files changed, 20 insertions, 10 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index ef03c18a0128..d7be6d7324d3 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -404,6 +404,20 @@ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array,
404 xhci_writel(xhci, temp, port_array[port_id]); 404 xhci_writel(xhci, temp, port_array[port_id]);
405} 405}
406 406
407/* Test and clear port RWC bit */
408void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
409 int port_id, u32 port_bit)
410{
411 u32 temp;
412
413 temp = xhci_readl(xhci, port_array[port_id]);
414 if (temp & port_bit) {
415 temp = xhci_port_state_to_neutral(temp);
416 temp |= port_bit;
417 xhci_writel(xhci, temp, port_array[port_id]);
418 }
419}
420
407int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, 421int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
408 u16 wIndex, char *buf, u16 wLength) 422 u16 wIndex, char *buf, u16 wLength)
409{ 423{
@@ -924,12 +938,8 @@ int xhci_bus_resume(struct usb_hcd *hcd)
924 spin_lock_irqsave(&xhci->lock, flags); 938 spin_lock_irqsave(&xhci->lock, flags);
925 939
926 /* Clear PLC */ 940 /* Clear PLC */
927 temp = xhci_readl(xhci, port_array[port_index]); 941 xhci_test_and_clear_bit(xhci, port_array, port_index,
928 if (temp & PORT_PLC) { 942 PORT_PLC);
929 temp = xhci_port_state_to_neutral(temp);
930 temp |= PORT_PLC;
931 xhci_writel(xhci, temp, port_array[port_index]);
932 }
933 943
934 slot_id = xhci_find_slot_id_by_port(hcd, 944 slot_id = xhci_find_slot_id_by_port(hcd,
935 xhci, port_index + 1); 945 xhci, port_index + 1);
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 0ef4f20c7f41..30b357781671 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1340,10 +1340,8 @@ static void handle_port_status(struct xhci_hcd *xhci,
1340 xhci_ring_device(xhci, slot_id); 1340 xhci_ring_device(xhci, slot_id);
1341 xhci_dbg(xhci, "resume SS port %d finished\n", port_id); 1341 xhci_dbg(xhci, "resume SS port %d finished\n", port_id);
1342 /* Clear PORT_PLC */ 1342 /* Clear PORT_PLC */
1343 temp = xhci_readl(xhci, port_array[faked_port_index]); 1343 xhci_test_and_clear_bit(xhci, port_array,
1344 temp = xhci_port_state_to_neutral(temp); 1344 faked_port_index, PORT_PLC);
1345 temp |= PORT_PLC;
1346 xhci_writel(xhci, temp, port_array[faked_port_index]);
1347 } else { 1345 } else {
1348 xhci_dbg(xhci, "resume HS port %d\n", port_id); 1346 xhci_dbg(xhci, "resume HS port %d\n", port_id);
1349 bus_state->resume_done[faked_port_index] = jiffies + 1347 bus_state->resume_done[faked_port_index] = jiffies +
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 92eba69b9239..fa921cbbe872 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1719,6 +1719,8 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id,
1719/* xHCI roothub code */ 1719/* xHCI roothub code */
1720void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, 1720void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array,
1721 int port_id, u32 link_state); 1721 int port_id, u32 link_state);
1722void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
1723 int port_id, u32 port_bit);
1722int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, 1724int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
1723 char *buf, u16 wLength); 1725 char *buf, u16 wLength);
1724int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); 1726int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);