usb: fix building musb drivers
Commit 3dacdf11
"usb: factor out state_string() on otg drivers"
broke building musb drivers since there is already another
otg_state_string() function in musb drivers, but with different
prototype. Fix musb drivers to use common otg_state_string(), too.
Also provide a nop for otg_state_string() if CONFIG_USB_OTG_UTILS
is not defined.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
9be0392989
commit
3df0045325
@ -151,7 +151,8 @@ static void otg_timer(unsigned long _musb)
|
|||||||
* status change events (from the transceiver) otherwise.
|
* status change events (from the transceiver) otherwise.
|
||||||
*/
|
*/
|
||||||
devctl = musb_readb(mregs, MUSB_DEVCTL);
|
devctl = musb_readb(mregs, MUSB_DEVCTL);
|
||||||
DBG(7, "Poll devctl %02x (%s)\n", devctl, otg_state_string(musb));
|
DBG(7, "Poll devctl %02x (%s)\n", devctl,
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
|
|
||||||
spin_lock_irqsave(&musb->lock, flags);
|
spin_lock_irqsave(&musb->lock, flags);
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
@ -202,7 +203,8 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
/* Never idle if active, or when VBUS timeout is not set as host */
|
/* Never idle if active, or when VBUS timeout is not set as host */
|
||||||
if (musb->is_active || (musb->a_wait_bcon == 0 &&
|
if (musb->is_active || (musb->a_wait_bcon == 0 &&
|
||||||
musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
|
musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
|
||||||
DBG(4, "%s active, deleting timer\n", otg_state_string(musb));
|
DBG(4, "%s active, deleting timer\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
del_timer(&otg_workaround);
|
del_timer(&otg_workaround);
|
||||||
last_timer = jiffies;
|
last_timer = jiffies;
|
||||||
return;
|
return;
|
||||||
@ -215,7 +217,8 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
last_timer = timeout;
|
last_timer = timeout;
|
||||||
|
|
||||||
DBG(4, "%s inactive, starting idle timer for %u ms\n",
|
DBG(4, "%s inactive, starting idle timer for %u ms\n",
|
||||||
otg_state_string(musb), jiffies_to_msecs(timeout - jiffies));
|
otg_state_string(musb->xceiv->state),
|
||||||
|
jiffies_to_msecs(timeout - jiffies));
|
||||||
mod_timer(&otg_workaround, timeout);
|
mod_timer(&otg_workaround, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +307,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
|
|||||||
/* NOTE: this must complete power-on within 100 ms. */
|
/* NOTE: this must complete power-on within 100 ms. */
|
||||||
DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
|
DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
|
||||||
drvvbus ? "on" : "off",
|
drvvbus ? "on" : "off",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
err ? " ERROR" : "",
|
err ? " ERROR" : "",
|
||||||
devctl);
|
devctl);
|
||||||
ret = IRQ_HANDLED;
|
ret = IRQ_HANDLED;
|
||||||
|
@ -279,12 +279,13 @@ static void musb_conn_timer_handler(unsigned long _musb)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG(1, "%s state not handled\n", otg_state_string(musb));
|
DBG(1, "%s state not handled\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&musb->lock, flags);
|
spin_unlock_irqrestore(&musb->lock, flags);
|
||||||
|
|
||||||
DBG(4, "state is %s\n", otg_state_string(musb));
|
DBG(4, "state is %s\n", otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bfin_musb_enable(struct musb *musb)
|
static void bfin_musb_enable(struct musb *musb)
|
||||||
@ -308,7 +309,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on)
|
|||||||
|
|
||||||
DBG(1, "VBUS %s, devctl %02x "
|
DBG(1, "VBUS %s, devctl %02x "
|
||||||
/* otg %3x conf %08x prcm %08x */ "\n",
|
/* otg %3x conf %08x prcm %08x */ "\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
musb_readb(musb->mregs, MUSB_DEVCTL));
|
musb_readb(musb->mregs, MUSB_DEVCTL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,8 @@ static void otg_timer(unsigned long _musb)
|
|||||||
* status change events (from the transceiver) otherwise.
|
* status change events (from the transceiver) otherwise.
|
||||||
*/
|
*/
|
||||||
devctl = musb_readb(mregs, MUSB_DEVCTL);
|
devctl = musb_readb(mregs, MUSB_DEVCTL);
|
||||||
DBG(7, "Poll devctl %02x (%s)\n", devctl, otg_state_string(musb));
|
DBG(7, "Poll devctl %02x (%s)\n", devctl,
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
|
|
||||||
spin_lock_irqsave(&musb->lock, flags);
|
spin_lock_irqsave(&musb->lock, flags);
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
@ -273,7 +274,8 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
/* Never idle if active, or when VBUS timeout is not set as host */
|
/* Never idle if active, or when VBUS timeout is not set as host */
|
||||||
if (musb->is_active || (musb->a_wait_bcon == 0 &&
|
if (musb->is_active || (musb->a_wait_bcon == 0 &&
|
||||||
musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
|
musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
|
||||||
DBG(4, "%s active, deleting timer\n", otg_state_string(musb));
|
DBG(4, "%s active, deleting timer\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
del_timer(&otg_workaround);
|
del_timer(&otg_workaround);
|
||||||
last_timer = jiffies;
|
last_timer = jiffies;
|
||||||
return;
|
return;
|
||||||
@ -286,7 +288,8 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
last_timer = timeout;
|
last_timer = timeout;
|
||||||
|
|
||||||
DBG(4, "%s inactive, starting idle timer for %u ms\n",
|
DBG(4, "%s inactive, starting idle timer for %u ms\n",
|
||||||
otg_state_string(musb), jiffies_to_msecs(timeout - jiffies));
|
otg_state_string(musb->xceiv->state),
|
||||||
|
jiffies_to_msecs(timeout - jiffies));
|
||||||
mod_timer(&otg_workaround, timeout);
|
mod_timer(&otg_workaround, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +368,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
|
|||||||
|
|
||||||
DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
|
DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
|
||||||
drvvbus ? "on" : "off",
|
drvvbus ? "on" : "off",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
err ? " ERROR" : "",
|
err ? " ERROR" : "",
|
||||||
devctl);
|
devctl);
|
||||||
ret = IRQ_HANDLED;
|
ret = IRQ_HANDLED;
|
||||||
|
@ -220,7 +220,8 @@ static void otg_timer(unsigned long _musb)
|
|||||||
* status change events (from the transceiver) otherwise.
|
* status change events (from the transceiver) otherwise.
|
||||||
*/
|
*/
|
||||||
devctl = musb_readb(mregs, MUSB_DEVCTL);
|
devctl = musb_readb(mregs, MUSB_DEVCTL);
|
||||||
DBG(7, "poll devctl %02x (%s)\n", devctl, otg_state_string(musb));
|
DBG(7, "poll devctl %02x (%s)\n", devctl,
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
|
|
||||||
spin_lock_irqsave(&musb->lock, flags);
|
spin_lock_irqsave(&musb->lock, flags);
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
@ -356,7 +357,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
|
|||||||
davinci_musb_source_power(musb, drvvbus, 0);
|
davinci_musb_source_power(musb, drvvbus, 0);
|
||||||
DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
|
DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
|
||||||
drvvbus ? "on" : "off",
|
drvvbus ? "on" : "off",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
err ? " ERROR" : "",
|
err ? " ERROR" : "",
|
||||||
devctl);
|
devctl);
|
||||||
retval = IRQ_HANDLED;
|
retval = IRQ_HANDLED;
|
||||||
|
@ -333,26 +333,6 @@ void musb_load_testpacket(struct musb *musb)
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
const char *otg_state_string(struct musb *musb)
|
|
||||||
{
|
|
||||||
switch (musb->xceiv->state) {
|
|
||||||
case OTG_STATE_A_IDLE: return "a_idle";
|
|
||||||
case OTG_STATE_A_WAIT_VRISE: return "a_wait_vrise";
|
|
||||||
case OTG_STATE_A_WAIT_BCON: return "a_wait_bcon";
|
|
||||||
case OTG_STATE_A_HOST: return "a_host";
|
|
||||||
case OTG_STATE_A_SUSPEND: return "a_suspend";
|
|
||||||
case OTG_STATE_A_PERIPHERAL: return "a_peripheral";
|
|
||||||
case OTG_STATE_A_WAIT_VFALL: return "a_wait_vfall";
|
|
||||||
case OTG_STATE_A_VBUS_ERR: return "a_vbus_err";
|
|
||||||
case OTG_STATE_B_IDLE: return "b_idle";
|
|
||||||
case OTG_STATE_B_SRP_INIT: return "b_srp_init";
|
|
||||||
case OTG_STATE_B_PERIPHERAL: return "b_peripheral";
|
|
||||||
case OTG_STATE_B_WAIT_ACON: return "b_wait_acon";
|
|
||||||
case OTG_STATE_B_HOST: return "b_host";
|
|
||||||
default: return "UNDEFINED";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_USB_MUSB_OTG
|
#ifdef CONFIG_USB_MUSB_OTG
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -373,12 +353,14 @@ void musb_otg_timer_func(unsigned long data)
|
|||||||
break;
|
break;
|
||||||
case OTG_STATE_A_SUSPEND:
|
case OTG_STATE_A_SUSPEND:
|
||||||
case OTG_STATE_A_WAIT_BCON:
|
case OTG_STATE_A_WAIT_BCON:
|
||||||
DBG(1, "HNP: %s timeout\n", otg_state_string(musb));
|
DBG(1, "HNP: %s timeout\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
musb_platform_set_vbus(musb, 0);
|
musb_platform_set_vbus(musb, 0);
|
||||||
musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
|
musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG(1, "HNP: Unhandled mode %s\n", otg_state_string(musb));
|
DBG(1, "HNP: Unhandled mode %s\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
musb->ignore_disconnect = 0;
|
musb->ignore_disconnect = 0;
|
||||||
spin_unlock_irqrestore(&musb->lock, flags);
|
spin_unlock_irqrestore(&musb->lock, flags);
|
||||||
@ -393,12 +375,13 @@ void musb_hnp_stop(struct musb *musb)
|
|||||||
void __iomem *mbase = musb->mregs;
|
void __iomem *mbase = musb->mregs;
|
||||||
u8 reg;
|
u8 reg;
|
||||||
|
|
||||||
DBG(1, "HNP: stop from %s\n", otg_state_string(musb));
|
DBG(1, "HNP: stop from %s\n", otg_state_string(musb->xceiv->state));
|
||||||
|
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
case OTG_STATE_A_PERIPHERAL:
|
case OTG_STATE_A_PERIPHERAL:
|
||||||
musb_g_disconnect(musb);
|
musb_g_disconnect(musb);
|
||||||
DBG(1, "HNP: back to %s\n", otg_state_string(musb));
|
DBG(1, "HNP: back to %s\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
break;
|
break;
|
||||||
case OTG_STATE_B_HOST:
|
case OTG_STATE_B_HOST:
|
||||||
DBG(1, "HNP: Disabling HR\n");
|
DBG(1, "HNP: Disabling HR\n");
|
||||||
@ -412,7 +395,7 @@ void musb_hnp_stop(struct musb *musb)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG(1, "HNP: Stopping in unknown state %s\n",
|
DBG(1, "HNP: Stopping in unknown state %s\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -451,7 +434,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||||||
*/
|
*/
|
||||||
if (int_usb & MUSB_INTR_RESUME) {
|
if (int_usb & MUSB_INTR_RESUME) {
|
||||||
handled = IRQ_HANDLED;
|
handled = IRQ_HANDLED;
|
||||||
DBG(3, "RESUME (%s)\n", otg_state_string(musb));
|
DBG(3, "RESUME (%s)\n", otg_state_string(musb->xceiv->state));
|
||||||
|
|
||||||
if (devctl & MUSB_DEVCTL_HM) {
|
if (devctl & MUSB_DEVCTL_HM) {
|
||||||
#ifdef CONFIG_USB_MUSB_HDRC_HCD
|
#ifdef CONFIG_USB_MUSB_HDRC_HCD
|
||||||
@ -492,7 +475,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||||||
default:
|
default:
|
||||||
WARNING("bogus %s RESUME (%s)\n",
|
WARNING("bogus %s RESUME (%s)\n",
|
||||||
"host",
|
"host",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -526,7 +509,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||||||
default:
|
default:
|
||||||
WARNING("bogus %s RESUME (%s)\n",
|
WARNING("bogus %s RESUME (%s)\n",
|
||||||
"peripheral",
|
"peripheral",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,7 +525,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG(1, "SESSION_REQUEST (%s)\n", otg_state_string(musb));
|
DBG(1, "SESSION_REQUEST (%s)\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
|
|
||||||
/* IRQ arrives from ID pin sense or (later, if VBUS power
|
/* IRQ arrives from ID pin sense or (later, if VBUS power
|
||||||
* is removed) SRP. responses are time critical:
|
* is removed) SRP. responses are time critical:
|
||||||
@ -607,7 +591,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBG(1, "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n",
|
DBG(1, "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
devctl,
|
devctl,
|
||||||
({ char *s;
|
({ char *s;
|
||||||
switch (devctl & MUSB_DEVCTL_VBUS) {
|
switch (devctl & MUSB_DEVCTL_VBUS) {
|
||||||
@ -633,7 +617,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
|
|||||||
#endif
|
#endif
|
||||||
if (int_usb & MUSB_INTR_SUSPEND) {
|
if (int_usb & MUSB_INTR_SUSPEND) {
|
||||||
DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
|
DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
|
||||||
otg_state_string(musb), devctl, power);
|
otg_state_string(musb->xceiv->state), devctl, power);
|
||||||
handled = IRQ_HANDLED;
|
handled = IRQ_HANDLED;
|
||||||
|
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
@ -758,13 +742,13 @@ b_host:
|
|||||||
usb_hcd_resume_root_hub(hcd);
|
usb_hcd_resume_root_hub(hcd);
|
||||||
|
|
||||||
DBG(1, "CONNECT (%s) devctl %02x\n",
|
DBG(1, "CONNECT (%s) devctl %02x\n",
|
||||||
otg_state_string(musb), devctl);
|
otg_state_string(musb->xceiv->state), devctl);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_USB_MUSB_HDRC_HCD */
|
#endif /* CONFIG_USB_MUSB_HDRC_HCD */
|
||||||
|
|
||||||
if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) {
|
if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) {
|
||||||
DBG(1, "DISCONNECT (%s) as %s, devctl %02x\n",
|
DBG(1, "DISCONNECT (%s) as %s, devctl %02x\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
MUSB_MODE(musb), devctl);
|
MUSB_MODE(musb), devctl);
|
||||||
handled = IRQ_HANDLED;
|
handled = IRQ_HANDLED;
|
||||||
|
|
||||||
@ -807,7 +791,7 @@ b_host:
|
|||||||
#endif /* GADGET */
|
#endif /* GADGET */
|
||||||
default:
|
default:
|
||||||
WARNING("unhandled DISCONNECT transition (%s)\n",
|
WARNING("unhandled DISCONNECT transition (%s)\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -832,7 +816,8 @@ b_host:
|
|||||||
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
|
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
|
||||||
}
|
}
|
||||||
} else if (is_peripheral_capable()) {
|
} else if (is_peripheral_capable()) {
|
||||||
DBG(1, "BUS RESET as %s\n", otg_state_string(musb));
|
DBG(1, "BUS RESET as %s\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
#ifdef CONFIG_USB_OTG
|
#ifdef CONFIG_USB_OTG
|
||||||
case OTG_STATE_A_SUSPEND:
|
case OTG_STATE_A_SUSPEND:
|
||||||
@ -846,8 +831,8 @@ b_host:
|
|||||||
case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */
|
case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */
|
||||||
/* never use invalid T(a_wait_bcon) */
|
/* never use invalid T(a_wait_bcon) */
|
||||||
DBG(1, "HNP: in %s, %d msec timeout\n",
|
DBG(1, "HNP: in %s, %d msec timeout\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
TA_WAIT_BCON(musb));
|
TA_WAIT_BCON(musb));
|
||||||
mod_timer(&musb->otg_timer, jiffies
|
mod_timer(&musb->otg_timer, jiffies
|
||||||
+ msecs_to_jiffies(TA_WAIT_BCON(musb)));
|
+ msecs_to_jiffies(TA_WAIT_BCON(musb)));
|
||||||
break;
|
break;
|
||||||
@ -858,7 +843,7 @@ b_host:
|
|||||||
break;
|
break;
|
||||||
case OTG_STATE_B_WAIT_ACON:
|
case OTG_STATE_B_WAIT_ACON:
|
||||||
DBG(1, "HNP: RESET (%s), to b_peripheral\n",
|
DBG(1, "HNP: RESET (%s), to b_peripheral\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
|
musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
|
||||||
musb_g_reset(musb);
|
musb_g_reset(musb);
|
||||||
break;
|
break;
|
||||||
@ -871,7 +856,7 @@ b_host:
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG(1, "Unhandled BUS RESET as %s\n",
|
DBG(1, "Unhandled BUS RESET as %s\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1713,7 +1698,7 @@ musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
|
|||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
spin_lock_irqsave(&musb->lock, flags);
|
spin_lock_irqsave(&musb->lock, flags);
|
||||||
ret = sprintf(buf, "%s\n", otg_state_string(musb));
|
ret = sprintf(buf, "%s\n", otg_state_string(musb->xceiv->state));
|
||||||
spin_unlock_irqrestore(&musb->lock, flags);
|
spin_unlock_irqrestore(&musb->lock, flags);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -54,8 +54,6 @@ static inline int _dbg_level(unsigned l)
|
|||||||
return musb_debug >= l;
|
return musb_debug >= l;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const char *otg_state_string(struct musb *);
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
extern int musb_init_debugfs(struct musb *musb);
|
extern int musb_init_debugfs(struct musb *musb);
|
||||||
extern void musb_exit_debugfs(struct musb *musb);
|
extern void musb_exit_debugfs(struct musb *musb);
|
||||||
|
@ -1556,7 +1556,8 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
|
|||||||
status = 0;
|
status = 0;
|
||||||
goto done;
|
goto done;
|
||||||
default:
|
default:
|
||||||
DBG(2, "Unhandled wake: %s\n", otg_state_string(musb));
|
DBG(2, "Unhandled wake: %s\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2039,7 +2040,7 @@ void musb_g_resume(struct musb *musb)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARNING("unhandled RESUME transition (%s)\n",
|
WARNING("unhandled RESUME transition (%s)\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2069,7 +2070,7 @@ void musb_g_suspend(struct musb *musb)
|
|||||||
* A_PERIPHERAL may need care too
|
* A_PERIPHERAL may need care too
|
||||||
*/
|
*/
|
||||||
WARNING("unhandled SUSPEND transition (%s)\n",
|
WARNING("unhandled SUSPEND transition (%s)\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2104,7 +2105,7 @@ void musb_g_disconnect(struct musb *musb)
|
|||||||
default:
|
default:
|
||||||
#ifdef CONFIG_USB_MUSB_OTG
|
#ifdef CONFIG_USB_MUSB_OTG
|
||||||
DBG(2, "Unhandled disconnect %s, setting a_idle\n",
|
DBG(2, "Unhandled disconnect %s, setting a_idle\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
musb->xceiv->state = OTG_STATE_A_IDLE;
|
musb->xceiv->state = OTG_STATE_A_IDLE;
|
||||||
MUSB_HST_MODE(musb);
|
MUSB_HST_MODE(musb);
|
||||||
break;
|
break;
|
||||||
|
@ -2304,7 +2304,7 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
|
|||||||
|
|
||||||
if (musb->is_active) {
|
if (musb->is_active) {
|
||||||
WARNING("trying to suspend as %s while active\n",
|
WARNING("trying to suspend as %s while active\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -98,7 +98,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
|
|||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
DBG(1, "bogus rh suspend? %s\n",
|
DBG(1, "bogus rh suspend? %s\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
} else if (power & MUSB_POWER_SUSPENDM) {
|
} else if (power & MUSB_POWER_SUSPENDM) {
|
||||||
power &= ~MUSB_POWER_SUSPENDM;
|
power &= ~MUSB_POWER_SUSPENDM;
|
||||||
@ -208,7 +208,8 @@ void musb_root_disconnect(struct musb *musb)
|
|||||||
musb->xceiv->state = OTG_STATE_B_IDLE;
|
musb->xceiv->state = OTG_STATE_B_IDLE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG(1, "host disconnect (%s)\n", otg_state_string(musb));
|
DBG(1, "host disconnect (%s)\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,8 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
/* Never idle if active, or when VBUS timeout is not set as host */
|
/* Never idle if active, or when VBUS timeout is not set as host */
|
||||||
if (musb->is_active || ((musb->a_wait_bcon == 0)
|
if (musb->is_active || ((musb->a_wait_bcon == 0)
|
||||||
&& (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
|
&& (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
|
||||||
DBG(4, "%s active, deleting timer\n", otg_state_string(musb));
|
DBG(4, "%s active, deleting timer\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
del_timer(&musb_idle_timer);
|
del_timer(&musb_idle_timer);
|
||||||
last_timer = jiffies;
|
last_timer = jiffies;
|
||||||
return;
|
return;
|
||||||
@ -131,7 +132,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
last_timer = timeout;
|
last_timer = timeout;
|
||||||
|
|
||||||
DBG(4, "%s inactive, for idle timer for %lu ms\n",
|
DBG(4, "%s inactive, for idle timer for %lu ms\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
(unsigned long)jiffies_to_msecs(timeout - jiffies));
|
(unsigned long)jiffies_to_msecs(timeout - jiffies));
|
||||||
mod_timer(&musb_idle_timer, timeout);
|
mod_timer(&musb_idle_timer, timeout);
|
||||||
}
|
}
|
||||||
@ -195,7 +196,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
|
|||||||
|
|
||||||
DBG(1, "VBUS %s, devctl %02x "
|
DBG(1, "VBUS %s, devctl %02x "
|
||||||
/* otg %3x conf %08x prcm %08x */ "\n",
|
/* otg %3x conf %08x prcm %08x */ "\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
musb_readb(musb->mregs, MUSB_DEVCTL));
|
musb_readb(musb->mregs, MUSB_DEVCTL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ static void musb_do_idle(unsigned long _musb)
|
|||||||
&& (musb->idle_timeout == 0
|
&& (musb->idle_timeout == 0
|
||||||
|| time_after(jiffies, musb->idle_timeout))) {
|
|| time_after(jiffies, musb->idle_timeout))) {
|
||||||
DBG(4, "Nothing connected %s, turning off VBUS\n",
|
DBG(4, "Nothing connected %s, turning off VBUS\n",
|
||||||
otg_state_string(musb));
|
otg_state_string(musb->xceiv->state));
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case OTG_STATE_A_IDLE:
|
case OTG_STATE_A_IDLE:
|
||||||
@ -481,7 +481,8 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
/* Never idle if active, or when VBUS timeout is not set as host */
|
/* Never idle if active, or when VBUS timeout is not set as host */
|
||||||
if (musb->is_active || ((musb->a_wait_bcon == 0)
|
if (musb->is_active || ((musb->a_wait_bcon == 0)
|
||||||
&& (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
|
&& (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
|
||||||
DBG(4, "%s active, deleting timer\n", otg_state_string(musb));
|
DBG(4, "%s active, deleting timer\n",
|
||||||
|
otg_state_string(musb->xceiv->state));
|
||||||
del_timer(&musb_idle_timer);
|
del_timer(&musb_idle_timer);
|
||||||
last_timer = jiffies;
|
last_timer = jiffies;
|
||||||
return;
|
return;
|
||||||
@ -498,7 +499,7 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout)
|
|||||||
last_timer = timeout;
|
last_timer = timeout;
|
||||||
|
|
||||||
DBG(4, "%s inactive, for idle timer for %lu ms\n",
|
DBG(4, "%s inactive, for idle timer for %lu ms\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
(unsigned long)jiffies_to_msecs(timeout - jiffies));
|
(unsigned long)jiffies_to_msecs(timeout - jiffies));
|
||||||
mod_timer(&musb_idle_timer, timeout);
|
mod_timer(&musb_idle_timer, timeout);
|
||||||
}
|
}
|
||||||
@ -573,7 +574,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
|
|||||||
musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
|
musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
|
||||||
|
|
||||||
DBG(1, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n",
|
DBG(1, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n",
|
||||||
otg_state_string(musb),
|
otg_state_string(musb->xceiv->state),
|
||||||
musb_readb(musb->mregs, MUSB_DEVCTL),
|
musb_readb(musb->mregs, MUSB_DEVCTL),
|
||||||
musb_readl(tbase, TUSB_DEV_OTG_STAT),
|
musb_readl(tbase, TUSB_DEV_OTG_STAT),
|
||||||
conf, prcm);
|
conf, prcm);
|
||||||
@ -702,13 +703,13 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
|
|||||||
musb->is_active = 0;
|
musb->is_active = 0;
|
||||||
}
|
}
|
||||||
DBG(2, "vbus change, %s, otg %03x\n",
|
DBG(2, "vbus change, %s, otg %03x\n",
|
||||||
otg_state_string(musb), otg_stat);
|
otg_state_string(musb->xceiv->state), otg_stat);
|
||||||
idle_timeout = jiffies + (1 * HZ);
|
idle_timeout = jiffies + (1 * HZ);
|
||||||
schedule_work(&musb->irq_work);
|
schedule_work(&musb->irq_work);
|
||||||
|
|
||||||
} else /* A-dev state machine */ {
|
} else /* A-dev state machine */ {
|
||||||
DBG(2, "vbus change, %s, otg %03x\n",
|
DBG(2, "vbus change, %s, otg %03x\n",
|
||||||
otg_state_string(musb), otg_stat);
|
otg_state_string(musb->xceiv->state), otg_stat);
|
||||||
|
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
case OTG_STATE_A_IDLE:
|
case OTG_STATE_A_IDLE:
|
||||||
@ -756,7 +757,8 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
|
|||||||
if (int_src & TUSB_INT_SRC_OTG_TIMEOUT) {
|
if (int_src & TUSB_INT_SRC_OTG_TIMEOUT) {
|
||||||
u8 devctl;
|
u8 devctl;
|
||||||
|
|
||||||
DBG(4, "%s timer, %03x\n", otg_state_string(musb), otg_stat);
|
DBG(4, "%s timer, %03x\n",
|
||||||
|
otg_state_string(musb->xceiv->state), otg_stat);
|
||||||
|
|
||||||
switch (musb->xceiv->state) {
|
switch (musb->xceiv->state) {
|
||||||
case OTG_STATE_A_WAIT_VRISE:
|
case OTG_STATE_A_WAIT_VRISE:
|
||||||
|
@ -168,6 +168,7 @@ otg_shutdown(struct otg_transceiver *otg)
|
|||||||
#ifdef CONFIG_USB_OTG_UTILS
|
#ifdef CONFIG_USB_OTG_UTILS
|
||||||
extern struct otg_transceiver *otg_get_transceiver(void);
|
extern struct otg_transceiver *otg_get_transceiver(void);
|
||||||
extern void otg_put_transceiver(struct otg_transceiver *);
|
extern void otg_put_transceiver(struct otg_transceiver *);
|
||||||
|
extern const char *otg_state_string(enum usb_otg_state state);
|
||||||
#else
|
#else
|
||||||
static inline struct otg_transceiver *otg_get_transceiver(void)
|
static inline struct otg_transceiver *otg_get_transceiver(void)
|
||||||
{
|
{
|
||||||
@ -177,6 +178,11 @@ static inline struct otg_transceiver *otg_get_transceiver(void)
|
|||||||
static inline void otg_put_transceiver(struct otg_transceiver *x)
|
static inline void otg_put_transceiver(struct otg_transceiver *x)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const char *otg_state_string(enum usb_otg_state state)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Context: can sleep */
|
/* Context: can sleep */
|
||||||
@ -246,6 +252,5 @@ otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
|
|||||||
|
|
||||||
/* for OTG controller drivers (and maybe other stuff) */
|
/* for OTG controller drivers (and maybe other stuff) */
|
||||||
extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
|
extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
|
||||||
extern const char *otg_state_string(enum usb_otg_state state);
|
|
||||||
|
|
||||||
#endif /* __LINUX_USB_OTG_H */
|
#endif /* __LINUX_USB_OTG_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user