diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2010-05-24 16:25:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-04 16:16:18 -0400 |
commit | 2d62f3eea98354d61f90d6b115eecf9be5f4bdfe (patch) | |
tree | bd42be1731bab339ad0376fb389f9dc5a64f04ac /drivers/usb/host | |
parent | 0c8a32dff4f9ebed3e067e52e12842d7d7e047a0 (diff) |
USB: xhci: Wait for controller to be ready after reset.
After software resets an xHCI host controller, it must wait for the
"Controller Not Ready" (CNR) bit in the status register to be cleared.
Software is not supposed to ring any doorbells or write to any registers
except the status register until this bit is cleared.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/xhci.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 40e0a0c221b8..79ccfe5f8ad0 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -116,6 +116,7 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
116 | { | 116 | { |
117 | u32 command; | 117 | u32 command; |
118 | u32 state; | 118 | u32 state; |
119 | int ret; | ||
119 | 120 | ||
120 | state = xhci_readl(xhci, &xhci->op_regs->status); | 121 | state = xhci_readl(xhci, &xhci->op_regs->status); |
121 | if ((state & STS_HALT) == 0) { | 122 | if ((state & STS_HALT) == 0) { |
@@ -130,7 +131,17 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
130 | /* XXX: Why does EHCI set this here? Shouldn't other code do this? */ | 131 | /* XXX: Why does EHCI set this here? Shouldn't other code do this? */ |
131 | xhci_to_hcd(xhci)->state = HC_STATE_HALT; | 132 | xhci_to_hcd(xhci)->state = HC_STATE_HALT; |
132 | 133 | ||
133 | return handshake(xhci, &xhci->op_regs->command, CMD_RESET, 0, 250 * 1000); | 134 | ret = handshake(xhci, &xhci->op_regs->command, |
135 | CMD_RESET, 0, 250 * 1000); | ||
136 | if (ret) | ||
137 | return ret; | ||
138 | |||
139 | xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n"); | ||
140 | /* | ||
141 | * xHCI cannot write to any doorbells or operational registers other | ||
142 | * than status until the "Controller Not Ready" flag is cleared. | ||
143 | */ | ||
144 | return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000); | ||
134 | } | 145 | } |
135 | 146 | ||
136 | 147 | ||