aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/host/ehci-hcd.c17
-rw-r--r--drivers/usb/host/ehci-hub.c4
-rw-r--r--drivers/usb/host/ehci-tegra.c12
-rw-r--r--drivers/usb/host/ehci.h2
4 files changed, 20 insertions, 15 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 246e124e6ac5..e8a6f3dd7357 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -139,7 +139,7 @@ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
139/*-------------------------------------------------------------------------*/ 139/*-------------------------------------------------------------------------*/
140 140
141/* 141/*
142 * handshake - spin reading hc until handshake completes or fails 142 * ehci_handshake - spin reading hc until handshake completes or fails
143 * @ptr: address of hc register to be read 143 * @ptr: address of hc register to be read
144 * @mask: bits to look at in result of read 144 * @mask: bits to look at in result of read
145 * @done: value of those bits when handshake succeeds 145 * @done: value of those bits when handshake succeeds
@@ -155,8 +155,8 @@ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
155 * before driver shutdown. But it also seems to be caused by bugs in cardbus 155 * before driver shutdown. But it also seems to be caused by bugs in cardbus
156 * bridge shutdown: shutting down the bridge before the devices using it. 156 * bridge shutdown: shutting down the bridge before the devices using it.
157 */ 157 */
158static int handshake (struct ehci_hcd *ehci, void __iomem *ptr, 158int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
159 u32 mask, u32 done, int usec) 159 u32 mask, u32 done, int usec)
160{ 160{
161 u32 result; 161 u32 result;
162 162
@@ -172,6 +172,7 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
172 } while (usec > 0); 172 } while (usec > 0);
173 return -ETIMEDOUT; 173 return -ETIMEDOUT;
174} 174}
175EXPORT_SYMBOL_GPL(ehci_handshake);
175 176
176/* check TDI/ARC silicon is in host mode */ 177/* check TDI/ARC silicon is in host mode */
177static int tdi_in_host_mode (struct ehci_hcd *ehci) 178static int tdi_in_host_mode (struct ehci_hcd *ehci)
@@ -212,7 +213,7 @@ static int ehci_halt (struct ehci_hcd *ehci)
212 spin_unlock_irq(&ehci->lock); 213 spin_unlock_irq(&ehci->lock);
213 synchronize_irq(ehci_to_hcd(ehci)->irq); 214 synchronize_irq(ehci_to_hcd(ehci)->irq);
214 215
215 return handshake(ehci, &ehci->regs->status, 216 return ehci_handshake(ehci, &ehci->regs->status,
216 STS_HALT, STS_HALT, 16 * 125); 217 STS_HALT, STS_HALT, 16 * 125);
217} 218}
218 219
@@ -251,7 +252,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
251 ehci_writel(ehci, command, &ehci->regs->command); 252 ehci_writel(ehci, command, &ehci->regs->command);
252 ehci->rh_state = EHCI_RH_HALTED; 253 ehci->rh_state = EHCI_RH_HALTED;
253 ehci->next_statechange = jiffies; 254 ehci->next_statechange = jiffies;
254 retval = handshake (ehci, &ehci->regs->command, 255 retval = ehci_handshake(ehci, &ehci->regs->command,
255 CMD_RESET, 0, 250 * 1000); 256 CMD_RESET, 0, 250 * 1000);
256 257
257 if (ehci->has_hostpc) { 258 if (ehci->has_hostpc) {
@@ -286,7 +287,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
286 287
287 /* wait for any schedule enables/disables to take effect */ 288 /* wait for any schedule enables/disables to take effect */
288 temp = (ehci->command << 10) & (STS_ASS | STS_PSS); 289 temp = (ehci->command << 10) & (STS_ASS | STS_PSS);
289 handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, temp, 16 * 125); 290 ehci_handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, temp,
291 16 * 125);
290 292
291 /* then disable anything that's still active */ 293 /* then disable anything that's still active */
292 spin_lock_irq(&ehci->lock); 294 spin_lock_irq(&ehci->lock);
@@ -295,7 +297,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
295 spin_unlock_irq(&ehci->lock); 297 spin_unlock_irq(&ehci->lock);
296 298
297 /* hardware can take 16 microframes to turn off ... */ 299 /* hardware can take 16 microframes to turn off ... */
298 handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, 0, 16 * 125); 300 ehci_handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, 0,
301 16 * 125);
299} 302}
300 303
301/*-------------------------------------------------------------------------*/ 304/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index b2f64506840b..2b702772d04d 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -892,7 +892,7 @@ static int ehci_hub_control (
892 PORT_SUSPEND | PORT_RESUME); 892 PORT_SUSPEND | PORT_RESUME);
893 ehci_writel(ehci, temp, status_reg); 893 ehci_writel(ehci, temp, status_reg);
894 clear_bit(wIndex, &ehci->resuming_ports); 894 clear_bit(wIndex, &ehci->resuming_ports);
895 retval = handshake(ehci, status_reg, 895 retval = ehci_handshake(ehci, status_reg,
896 PORT_RESUME, 0, 2000 /* 2msec */); 896 PORT_RESUME, 0, 2000 /* 2msec */);
897 if (retval != 0) { 897 if (retval != 0) {
898 ehci_err(ehci, 898 ehci_err(ehci,
@@ -918,7 +918,7 @@ static int ehci_hub_control (
918 /* REVISIT: some hardware needs 550+ usec to clear 918 /* REVISIT: some hardware needs 550+ usec to clear
919 * this bit; seems too long to spin routinely... 919 * this bit; seems too long to spin routinely...
920 */ 920 */
921 retval = handshake(ehci, status_reg, 921 retval = ehci_handshake(ehci, status_reg,
922 PORT_RESET, 0, 1000); 922 PORT_RESET, 0, 1000);
923 if (retval != 0) { 923 if (retval != 0) {
924 ehci_err (ehci, "port %d reset error %d\n", 924 ehci_err (ehci, "port %d reset error %d\n",
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 8390c870299a..289b9b83f6be 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -179,7 +179,7 @@ static int tegra_ehci_hub_control(
179 * If a transaction is in progress, there may be a delay in 179 * If a transaction is in progress, there may be a delay in
180 * suspending the port. Poll until the port is suspended. 180 * suspending the port. Poll until the port is suspended.
181 */ 181 */
182 if (handshake(ehci, status_reg, PORT_SUSPEND, 182 if (ehci_handshake(ehci, status_reg, PORT_SUSPEND,
183 PORT_SUSPEND, 5000)) 183 PORT_SUSPEND, 5000))
184 pr_err("%s: timeout waiting for SUSPEND\n", __func__); 184 pr_err("%s: timeout waiting for SUSPEND\n", __func__);
185 185
@@ -227,9 +227,9 @@ static int tegra_ehci_hub_control(
227 spin_lock_irqsave(&ehci->lock, flags); 227 spin_lock_irqsave(&ehci->lock, flags);
228 228
229 /* Poll until the controller clears RESUME and SUSPEND */ 229 /* Poll until the controller clears RESUME and SUSPEND */
230 if (handshake(ehci, status_reg, PORT_RESUME, 0, 2000)) 230 if (ehci_handshake(ehci, status_reg, PORT_RESUME, 0, 2000))
231 pr_err("%s: timeout waiting for RESUME\n", __func__); 231 pr_err("%s: timeout waiting for RESUME\n", __func__);
232 if (handshake(ehci, status_reg, PORT_SUSPEND, 0, 2000)) 232 if (ehci_handshake(ehci, status_reg, PORT_SUSPEND, 0, 2000))
233 pr_err("%s: timeout waiting for SUSPEND\n", __func__); 233 pr_err("%s: timeout waiting for SUSPEND\n", __func__);
234 234
235 ehci->reset_done[wIndex-1] = 0; 235 ehci->reset_done[wIndex-1] = 0;
@@ -511,14 +511,14 @@ static int controller_resume(struct device *dev)
511 } 511 }
512 512
513 /* Poll until CCS is enabled */ 513 /* Poll until CCS is enabled */
514 if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, 514 if (ehci_handshake(ehci, &hw->port_status[0], PORT_CONNECT,
515 PORT_CONNECT, 2000)) { 515 PORT_CONNECT, 2000)) {
516 pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); 516 pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__);
517 goto restart; 517 goto restart;
518 } 518 }
519 519
520 /* Poll until PE is enabled */ 520 /* Poll until PE is enabled */
521 if (handshake(ehci, &hw->port_status[0], PORT_PE, 521 if (ehci_handshake(ehci, &hw->port_status[0], PORT_PE,
522 PORT_PE, 2000)) { 522 PORT_PE, 2000)) {
523 pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); 523 pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__);
524 goto restart; 524 goto restart;
@@ -536,7 +536,7 @@ static int controller_resume(struct device *dev)
536 writel(val, &hw->port_status[0]); 536 writel(val, &hw->port_status[0]);
537 537
538 /* Wait until port suspend completes */ 538 /* Wait until port suspend completes */
539 if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, 539 if (ehci_handshake(ehci, &hw->port_status[0], PORT_SUSPEND,
540 PORT_SUSPEND, 1000)) { 540 PORT_SUSPEND, 1000)) {
541 pr_err("%s: timeout waiting for PORT_SUSPEND\n", 541 pr_err("%s: timeout waiting for PORT_SUSPEND\n",
542 __func__); 542 __func__);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 7c978b23520d..64f9a08e959c 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -800,6 +800,8 @@ struct ehci_driver_overrides {
800extern void ehci_init_driver(struct hc_driver *drv, 800extern void ehci_init_driver(struct hc_driver *drv,
801 const struct ehci_driver_overrides *over); 801 const struct ehci_driver_overrides *over);
802extern int ehci_setup(struct usb_hcd *hcd); 802extern int ehci_setup(struct usb_hcd *hcd);
803extern int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
804 u32 mask, u32 done, int usec);
803 805
804#ifdef CONFIG_PM 806#ifdef CONFIG_PM
805extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); 807extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);