Commit 2f3a6b86 authored by Manjunath Goudar's avatar Manjunath Goudar Committed by Greg Kroah-Hartman

USB: EHCI: export ehci_handshake for ehci-hcd sub-drivers

In order to split ehci-hcd.c into separate modules, handshake() must be
exported. Rename the symbol to add an ehci_ prefix, to avoid any naming
clashes.
Signed-off-by: default avatarManjunath Goudar <manjunath.goudar@linaro.org>
[swarren, split Manjunath's patches more logically, limit this change
to export just handshake()]
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Tested-by: default avatarThierry Reding <thierry.reding@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 587376a1
...@@ -139,7 +139,7 @@ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci) ...@@ -139,7 +139,7 @@ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* /*
* handshake - spin reading hc until handshake completes or fails * ehci_handshake - spin reading hc until handshake completes or fails
* @ptr: address of hc register to be read * @ptr: address of hc register to be read
* @mask: bits to look at in result of read * @mask: bits to look at in result of read
* @done: value of those bits when handshake succeeds * @done: value of those bits when handshake succeeds
...@@ -155,7 +155,7 @@ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci) ...@@ -155,7 +155,7 @@ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
* before driver shutdown. But it also seems to be caused by bugs in cardbus * before driver shutdown. But it also seems to be caused by bugs in cardbus
* bridge shutdown: shutting down the bridge before the devices using it. * bridge shutdown: shutting down the bridge before the devices using it.
*/ */
static int handshake (struct ehci_hcd *ehci, void __iomem *ptr, int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
u32 mask, u32 done, int usec) u32 mask, u32 done, int usec)
{ {
u32 result; u32 result;
...@@ -172,6 +172,7 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr, ...@@ -172,6 +172,7 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
} while (usec > 0); } while (usec > 0);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
EXPORT_SYMBOL_GPL(ehci_handshake);
/* check TDI/ARC silicon is in host mode */ /* check TDI/ARC silicon is in host mode */
static int tdi_in_host_mode (struct ehci_hcd *ehci) static int tdi_in_host_mode (struct ehci_hcd *ehci)
...@@ -212,7 +213,7 @@ static int ehci_halt (struct ehci_hcd *ehci) ...@@ -212,7 +213,7 @@ static int ehci_halt (struct ehci_hcd *ehci)
spin_unlock_irq(&ehci->lock); spin_unlock_irq(&ehci->lock);
synchronize_irq(ehci_to_hcd(ehci)->irq); synchronize_irq(ehci_to_hcd(ehci)->irq);
return handshake(ehci, &ehci->regs->status, return ehci_handshake(ehci, &ehci->regs->status,
STS_HALT, STS_HALT, 16 * 125); STS_HALT, STS_HALT, 16 * 125);
} }
...@@ -251,7 +252,7 @@ static int ehci_reset (struct ehci_hcd *ehci) ...@@ -251,7 +252,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
ehci_writel(ehci, command, &ehci->regs->command); ehci_writel(ehci, command, &ehci->regs->command);
ehci->rh_state = EHCI_RH_HALTED; ehci->rh_state = EHCI_RH_HALTED;
ehci->next_statechange = jiffies; ehci->next_statechange = jiffies;
retval = handshake (ehci, &ehci->regs->command, retval = ehci_handshake(ehci, &ehci->regs->command,
CMD_RESET, 0, 250 * 1000); CMD_RESET, 0, 250 * 1000);
if (ehci->has_hostpc) { if (ehci->has_hostpc) {
...@@ -286,7 +287,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci) ...@@ -286,7 +287,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
/* wait for any schedule enables/disables to take effect */ /* wait for any schedule enables/disables to take effect */
temp = (ehci->command << 10) & (STS_ASS | STS_PSS); temp = (ehci->command << 10) & (STS_ASS | STS_PSS);
handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, temp, 16 * 125); ehci_handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, temp,
16 * 125);
/* then disable anything that's still active */ /* then disable anything that's still active */
spin_lock_irq(&ehci->lock); spin_lock_irq(&ehci->lock);
...@@ -295,7 +297,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci) ...@@ -295,7 +297,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
spin_unlock_irq(&ehci->lock); spin_unlock_irq(&ehci->lock);
/* hardware can take 16 microframes to turn off ... */ /* hardware can take 16 microframes to turn off ... */
handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, 0, 16 * 125); ehci_handshake(ehci, &ehci->regs->status, STS_ASS | STS_PSS, 0,
16 * 125);
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
...@@ -892,7 +892,7 @@ static int ehci_hub_control ( ...@@ -892,7 +892,7 @@ static int ehci_hub_control (
PORT_SUSPEND | PORT_RESUME); PORT_SUSPEND | PORT_RESUME);
ehci_writel(ehci, temp, status_reg); ehci_writel(ehci, temp, status_reg);
clear_bit(wIndex, &ehci->resuming_ports); clear_bit(wIndex, &ehci->resuming_ports);
retval = handshake(ehci, status_reg, retval = ehci_handshake(ehci, status_reg,
PORT_RESUME, 0, 2000 /* 2msec */); PORT_RESUME, 0, 2000 /* 2msec */);
if (retval != 0) { if (retval != 0) {
ehci_err(ehci, ehci_err(ehci,
...@@ -918,7 +918,7 @@ static int ehci_hub_control ( ...@@ -918,7 +918,7 @@ static int ehci_hub_control (
/* REVISIT: some hardware needs 550+ usec to clear /* REVISIT: some hardware needs 550+ usec to clear
* this bit; seems too long to spin routinely... * this bit; seems too long to spin routinely...
*/ */
retval = handshake(ehci, status_reg, retval = ehci_handshake(ehci, status_reg,
PORT_RESET, 0, 1000); PORT_RESET, 0, 1000);
if (retval != 0) { if (retval != 0) {
ehci_err (ehci, "port %d reset error %d\n", ehci_err (ehci, "port %d reset error %d\n",
......
...@@ -179,7 +179,7 @@ static int tegra_ehci_hub_control( ...@@ -179,7 +179,7 @@ static int tegra_ehci_hub_control(
* If a transaction is in progress, there may be a delay in * If a transaction is in progress, there may be a delay in
* suspending the port. Poll until the port is suspended. * suspending the port. Poll until the port is suspended.
*/ */
if (handshake(ehci, status_reg, PORT_SUSPEND, if (ehci_handshake(ehci, status_reg, PORT_SUSPEND,
PORT_SUSPEND, 5000)) PORT_SUSPEND, 5000))
pr_err("%s: timeout waiting for SUSPEND\n", __func__); pr_err("%s: timeout waiting for SUSPEND\n", __func__);
...@@ -227,9 +227,9 @@ static int tegra_ehci_hub_control( ...@@ -227,9 +227,9 @@ static int tegra_ehci_hub_control(
spin_lock_irqsave(&ehci->lock, flags); spin_lock_irqsave(&ehci->lock, flags);
/* Poll until the controller clears RESUME and SUSPEND */ /* Poll until the controller clears RESUME and SUSPEND */
if (handshake(ehci, status_reg, PORT_RESUME, 0, 2000)) if (ehci_handshake(ehci, status_reg, PORT_RESUME, 0, 2000))
pr_err("%s: timeout waiting for RESUME\n", __func__); pr_err("%s: timeout waiting for RESUME\n", __func__);
if (handshake(ehci, status_reg, PORT_SUSPEND, 0, 2000)) if (ehci_handshake(ehci, status_reg, PORT_SUSPEND, 0, 2000))
pr_err("%s: timeout waiting for SUSPEND\n", __func__); pr_err("%s: timeout waiting for SUSPEND\n", __func__);
ehci->reset_done[wIndex-1] = 0; ehci->reset_done[wIndex-1] = 0;
...@@ -511,14 +511,14 @@ static int controller_resume(struct device *dev) ...@@ -511,14 +511,14 @@ static int controller_resume(struct device *dev)
} }
/* Poll until CCS is enabled */ /* Poll until CCS is enabled */
if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, if (ehci_handshake(ehci, &hw->port_status[0], PORT_CONNECT,
PORT_CONNECT, 2000)) { PORT_CONNECT, 2000)) {
pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__);
goto restart; goto restart;
} }
/* Poll until PE is enabled */ /* Poll until PE is enabled */
if (handshake(ehci, &hw->port_status[0], PORT_PE, if (ehci_handshake(ehci, &hw->port_status[0], PORT_PE,
PORT_PE, 2000)) { PORT_PE, 2000)) {
pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__);
goto restart; goto restart;
...@@ -536,7 +536,7 @@ static int controller_resume(struct device *dev) ...@@ -536,7 +536,7 @@ static int controller_resume(struct device *dev)
writel(val, &hw->port_status[0]); writel(val, &hw->port_status[0]);
/* Wait until port suspend completes */ /* Wait until port suspend completes */
if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, if (ehci_handshake(ehci, &hw->port_status[0], PORT_SUSPEND,
PORT_SUSPEND, 1000)) { PORT_SUSPEND, 1000)) {
pr_err("%s: timeout waiting for PORT_SUSPEND\n", pr_err("%s: timeout waiting for PORT_SUSPEND\n",
__func__); __func__);
......
...@@ -800,6 +800,8 @@ struct ehci_driver_overrides { ...@@ -800,6 +800,8 @@ struct ehci_driver_overrides {
extern void ehci_init_driver(struct hc_driver *drv, extern void ehci_init_driver(struct hc_driver *drv,
const struct ehci_driver_overrides *over); const struct ehci_driver_overrides *over);
extern int ehci_setup(struct usb_hcd *hcd); extern int ehci_setup(struct usb_hcd *hcd);
extern int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
u32 mask, u32 done, int usec);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);
......
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