Commit 0b3eba44 authored by Daniel Mack's avatar Daniel Mack Committed by Felipe Balbi

usb: musb: factor some host-specific functions

In particular, this introduces musb_host_resume_root_hub()and
musb_host_poke_root_hub() which will be stubbed out later.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Acked-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent c2a2759d
...@@ -483,7 +483,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -483,7 +483,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
musb->xceiv->state = OTG_STATE_A_HOST; musb->xceiv->state = OTG_STATE_A_HOST;
musb->is_active = 1; musb->is_active = 1;
usb_hcd_resume_root_hub(musb_to_hcd(musb)); musb_host_resume_root_hub(musb);
break; break;
case OTG_STATE_B_WAIT_ACON: case OTG_STATE_B_WAIT_ACON:
musb->xceiv->state = OTG_STATE_B_PERIPHERAL; musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
...@@ -500,7 +500,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -500,7 +500,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
case OTG_STATE_A_SUSPEND: case OTG_STATE_A_SUSPEND:
/* possibly DISCONNECT is upcoming */ /* possibly DISCONNECT is upcoming */
musb->xceiv->state = OTG_STATE_A_HOST; musb->xceiv->state = OTG_STATE_A_HOST;
usb_hcd_resume_root_hub(musb_to_hcd(musb)); musb_host_resume_root_hub(musb);
break; break;
case OTG_STATE_B_WAIT_ACON: case OTG_STATE_B_WAIT_ACON:
case OTG_STATE_B_PERIPHERAL: case OTG_STATE_B_PERIPHERAL:
...@@ -642,7 +642,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -642,7 +642,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
* undesired detour through A_WAIT_BCON. * undesired detour through A_WAIT_BCON.
*/ */
musb_hnp_stop(musb); musb_hnp_stop(musb);
usb_hcd_resume_root_hub(musb_to_hcd(musb)); musb_host_resume_root_hub(musb);
musb_root_disconnect(musb); musb_root_disconnect(musb);
musb_platform_try_idle(musb, jiffies musb_platform_try_idle(musb, jiffies
+ msecs_to_jiffies(musb->a_wait_bcon + msecs_to_jiffies(musb->a_wait_bcon
...@@ -732,17 +732,13 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -732,17 +732,13 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
if ((devctl & MUSB_DEVCTL_VBUS) if ((devctl & MUSB_DEVCTL_VBUS)
== (3 << MUSB_DEVCTL_VBUS_SHIFT)) { == (3 << MUSB_DEVCTL_VBUS_SHIFT)) {
musb->xceiv->state = OTG_STATE_A_HOST; musb->xceiv->state = OTG_STATE_A_HOST;
hcd->self.is_b_host = 0; if (hcd)
hcd->self.is_b_host = 0;
} }
break; break;
} }
/* poke the root hub */ musb_host_poke_root_hub(musb);
MUSB_HST_MODE(musb);
if (hcd->status_urb)
usb_hcd_poll_rh_status(hcd);
else
usb_hcd_resume_root_hub(hcd);
dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n", dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n",
usb_otg_state_string(musb->xceiv->state), devctl); usb_otg_state_string(musb->xceiv->state), devctl);
...@@ -757,7 +753,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -757,7 +753,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
switch (musb->xceiv->state) { switch (musb->xceiv->state) {
case OTG_STATE_A_HOST: case OTG_STATE_A_HOST:
case OTG_STATE_A_SUSPEND: case OTG_STATE_A_SUSPEND:
usb_hcd_resume_root_hub(musb_to_hcd(musb)); musb_host_resume_root_hub(musb);
musb_root_disconnect(musb); musb_root_disconnect(musb);
if (musb->a_wait_bcon != 0) if (musb->a_wait_bcon != 0)
musb_platform_try_idle(musb, jiffies musb_platform_try_idle(musb, jiffies
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "musb_core.h" #include "musb_core.h"
#include "musb_host.h" #include "musb_host.h"
/* MUSB HOST status 22-mar-2006 /* MUSB HOST status 22-mar-2006
* *
* - There's still lots of partial code duplication for fault paths, so * - There's still lots of partial code duplication for fault paths, so
...@@ -2608,3 +2607,17 @@ const struct hc_driver musb_hc_driver = { ...@@ -2608,3 +2607,17 @@ const struct hc_driver musb_hc_driver = {
/* .start_port_reset = NULL, */ /* .start_port_reset = NULL, */
/* .hub_irq_enable = NULL, */ /* .hub_irq_enable = NULL, */
}; };
void musb_host_resume_root_hub(struct musb *musb)
{
usb_hcd_resume_root_hub(musb_to_hcd(musb));
}
void musb_host_poke_root_hub(struct musb *musb)
{
MUSB_HST_MODE(musb);
if (musb_to_hcd(musb)->status_urb)
usb_hcd_poll_rh_status(musb_to_hcd(musb));
else
usb_hcd_resume_root_hub(musb_to_hcd(musb));
}
...@@ -89,6 +89,9 @@ extern void musb_host_tx(struct musb *, u8); ...@@ -89,6 +89,9 @@ extern void musb_host_tx(struct musb *, u8);
extern void musb_host_rx(struct musb *, u8); extern void musb_host_rx(struct musb *, u8);
extern void musb_root_disconnect(struct musb *musb); extern void musb_root_disconnect(struct musb *musb);
extern void musb_host_resume_root_hub(struct musb *musb);
extern void musb_host_poke_root_hub(struct musb *musb);
struct usb_hcd; struct usb_hcd;
extern int musb_hub_status_data(struct usb_hcd *hcd, char *buf); extern int musb_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