aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2011-05-05 06:11:21 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-06 21:16:39 -0400
commit3df004532582d0cc721da0df28311bcedd639724 (patch)
treed9ee3de5a34e5a1dcfc4a67043336ddd7cbe1664
parent9be0392989306361d4a63a06a8ee281efbead548 (diff)
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>
-rw-r--r--drivers/usb/musb/am35x.c11
-rw-r--r--drivers/usb/musb/blackfin.c7
-rw-r--r--drivers/usb/musb/da8xx.c11
-rw-r--r--drivers/usb/musb/davinci.c5
-rw-r--r--drivers/usb/musb/musb_core.c65
-rw-r--r--drivers/usb/musb/musb_debug.h2
-rw-r--r--drivers/usb/musb/musb_gadget.c9
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/musb_virthub.c5
-rw-r--r--drivers/usb/musb/omap2430.c7
-rw-r--r--drivers/usb/musb/tusb6010.c16
-rw-r--r--include/linux/usb/otg.h7
12 files changed, 74 insertions, 73 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index d5a3da37c90c..9e6209f87d3b 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -151,7 +151,8 @@ static void otg_timer(unsigned long _musb)
151 * status change events (from the transceiver) otherwise. 151 * status change events (from the transceiver) otherwise.
152 */ 152 */
153 devctl = musb_readb(mregs, MUSB_DEVCTL); 153 devctl = musb_readb(mregs, MUSB_DEVCTL);
154 DBG(7, "Poll devctl %02x (%s)\n", devctl, otg_state_string(musb)); 154 DBG(7, "Poll devctl %02x (%s)\n", devctl,
155 otg_state_string(musb->xceiv->state));
155 156
156 spin_lock_irqsave(&musb->lock, flags); 157 spin_lock_irqsave(&musb->lock, flags);
157 switch (musb->xceiv->state) { 158 switch (musb->xceiv->state) {
@@ -202,7 +203,8 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
202 /* Never idle if active, or when VBUS timeout is not set as host */ 203 /* Never idle if active, or when VBUS timeout is not set as host */
203 if (musb->is_active || (musb->a_wait_bcon == 0 && 204 if (musb->is_active || (musb->a_wait_bcon == 0 &&
204 musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { 205 musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
205 DBG(4, "%s active, deleting timer\n", otg_state_string(musb)); 206 DBG(4, "%s active, deleting timer\n",
207 otg_state_string(musb->xceiv->state));
206 del_timer(&otg_workaround); 208 del_timer(&otg_workaround);
207 last_timer = jiffies; 209 last_timer = jiffies;
208 return; 210 return;
@@ -215,7 +217,8 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
215 last_timer = timeout; 217 last_timer = timeout;
216 218
217 DBG(4, "%s inactive, starting idle timer for %u ms\n", 219 DBG(4, "%s inactive, starting idle timer for %u ms\n",
218 otg_state_string(musb), jiffies_to_msecs(timeout - jiffies)); 220 otg_state_string(musb->xceiv->state),
221 jiffies_to_msecs(timeout - jiffies));
219 mod_timer(&otg_workaround, timeout); 222 mod_timer(&otg_workaround, timeout);
220} 223}
221 224
@@ -304,7 +307,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
304 /* NOTE: this must complete power-on within 100 ms. */ 307 /* NOTE: this must complete power-on within 100 ms. */
305 DBG(2, "VBUS %s (%s)%s, devctl %02x\n", 308 DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
306 drvvbus ? "on" : "off", 309 drvvbus ? "on" : "off",
307 otg_state_string(musb), 310 otg_state_string(musb->xceiv->state),
308 err ? " ERROR" : "", 311 err ? " ERROR" : "",
309 devctl); 312 devctl);
310 ret = IRQ_HANDLED; 313 ret = IRQ_HANDLED;
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 8e2a1ff8a35a..e141d89656e1 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -279,12 +279,13 @@ static void musb_conn_timer_handler(unsigned long _musb)
279 } 279 }
280 break; 280 break;
281 default: 281 default:
282 DBG(1, "%s state not handled\n", otg_state_string(musb)); 282 DBG(1, "%s state not handled\n",
283 otg_state_string(musb->xceiv->state));
283 break; 284 break;
284 } 285 }
285 spin_unlock_irqrestore(&musb->lock, flags); 286 spin_unlock_irqrestore(&musb->lock, flags);
286 287
287 DBG(4, "state is %s\n", otg_state_string(musb)); 288 DBG(4, "state is %s\n", otg_state_string(musb->xceiv->state));
288} 289}
289 290
290static void bfin_musb_enable(struct musb *musb) 291static void bfin_musb_enable(struct musb *musb)
@@ -308,7 +309,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on)
308 309
309 DBG(1, "VBUS %s, devctl %02x " 310 DBG(1, "VBUS %s, devctl %02x "
310 /* otg %3x conf %08x prcm %08x */ "\n", 311 /* otg %3x conf %08x prcm %08x */ "\n",
311 otg_state_string(musb), 312 otg_state_string(musb->xceiv->state),
312 musb_readb(musb->mregs, MUSB_DEVCTL)); 313 musb_readb(musb->mregs, MUSB_DEVCTL));
313} 314}
314 315
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 69a0da3c8f09..0d8984993a38 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -199,7 +199,8 @@ static void otg_timer(unsigned long _musb)
199 * status change events (from the transceiver) otherwise. 199 * status change events (from the transceiver) otherwise.
200 */ 200 */
201 devctl = musb_readb(mregs, MUSB_DEVCTL); 201 devctl = musb_readb(mregs, MUSB_DEVCTL);
202 DBG(7, "Poll devctl %02x (%s)\n", devctl, otg_state_string(musb)); 202 DBG(7, "Poll devctl %02x (%s)\n", devctl,
203 otg_state_string(musb->xceiv->state));
203 204
204 spin_lock_irqsave(&musb->lock, flags); 205 spin_lock_irqsave(&musb->lock, flags);
205 switch (musb->xceiv->state) { 206 switch (musb->xceiv->state) {
@@ -273,7 +274,8 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout)
273 /* Never idle if active, or when VBUS timeout is not set as host */ 274 /* Never idle if active, or when VBUS timeout is not set as host */
274 if (musb->is_active || (musb->a_wait_bcon == 0 && 275 if (musb->is_active || (musb->a_wait_bcon == 0 &&
275 musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { 276 musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
276 DBG(4, "%s active, deleting timer\n", otg_state_string(musb)); 277 DBG(4, "%s active, deleting timer\n",
278 otg_state_string(musb->xceiv->state));
277 del_timer(&otg_workaround); 279 del_timer(&otg_workaround);
278 last_timer = jiffies; 280 last_timer = jiffies;
279 return; 281 return;
@@ -286,7 +288,8 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout)
286 last_timer = timeout; 288 last_timer = timeout;
287 289
288 DBG(4, "%s inactive, starting idle timer for %u ms\n", 290 DBG(4, "%s inactive, starting idle timer for %u ms\n",
289 otg_state_string(musb), jiffies_to_msecs(timeout - jiffies)); 291 otg_state_string(musb->xceiv->state),
292 jiffies_to_msecs(timeout - jiffies));
290 mod_timer(&otg_workaround, timeout); 293 mod_timer(&otg_workaround, timeout);
291} 294}
292 295
@@ -365,7 +368,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
365 368
366 DBG(2, "VBUS %s (%s)%s, devctl %02x\n", 369 DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
367 drvvbus ? "on" : "off", 370 drvvbus ? "on" : "off",
368 otg_state_string(musb), 371 otg_state_string(musb->xceiv->state),
369 err ? " ERROR" : "", 372 err ? " ERROR" : "",
370 devctl); 373 devctl);
371 ret = IRQ_HANDLED; 374 ret = IRQ_HANDLED;
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index e6de097fb7e8..3661b81a9571 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -220,7 +220,8 @@ static void otg_timer(unsigned long _musb)
220 * status change events (from the transceiver) otherwise. 220 * status change events (from the transceiver) otherwise.
221 */ 221 */
222 devctl = musb_readb(mregs, MUSB_DEVCTL); 222 devctl = musb_readb(mregs, MUSB_DEVCTL);
223 DBG(7, "poll devctl %02x (%s)\n", devctl, otg_state_string(musb)); 223 DBG(7, "poll devctl %02x (%s)\n", devctl,
224 otg_state_string(musb->xceiv->state));
224 225
225 spin_lock_irqsave(&musb->lock, flags); 226 spin_lock_irqsave(&musb->lock, flags);
226 switch (musb->xceiv->state) { 227 switch (musb->xceiv->state) {
@@ -356,7 +357,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
356 davinci_musb_source_power(musb, drvvbus, 0); 357 davinci_musb_source_power(musb, drvvbus, 0);
357 DBG(2, "VBUS %s (%s)%s, devctl %02x\n", 358 DBG(2, "VBUS %s (%s)%s, devctl %02x\n",
358 drvvbus ? "on" : "off", 359 drvvbus ? "on" : "off",
359 otg_state_string(musb), 360 otg_state_string(musb->xceiv->state),
360 err ? " ERROR" : "", 361 err ? " ERROR" : "",
361 devctl); 362 devctl);
362 retval = IRQ_HANDLED; 363 retval = IRQ_HANDLED;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index f10ff00ca09e..9a280872c2b4 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -333,26 +333,6 @@ void musb_load_testpacket(struct musb *musb)
333 333
334/*-------------------------------------------------------------------------*/ 334/*-------------------------------------------------------------------------*/
335 335
336const char *otg_state_string(struct musb *musb)
337{
338 switch (musb->xceiv->state) {
339 case OTG_STATE_A_IDLE: return "a_idle";
340 case OTG_STATE_A_WAIT_VRISE: return "a_wait_vrise";
341 case OTG_STATE_A_WAIT_BCON: return "a_wait_bcon";
342 case OTG_STATE_A_HOST: return "a_host";
343 case OTG_STATE_A_SUSPEND: return "a_suspend";
344 case OTG_STATE_A_PERIPHERAL: return "a_peripheral";
345 case OTG_STATE_A_WAIT_VFALL: return "a_wait_vfall";
346 case OTG_STATE_A_VBUS_ERR: return "a_vbus_err";
347 case OTG_STATE_B_IDLE: return "b_idle";
348 case OTG_STATE_B_SRP_INIT: return "b_srp_init";
349 case OTG_STATE_B_PERIPHERAL: return "b_peripheral";
350 case OTG_STATE_B_WAIT_ACON: return "b_wait_acon";
351 case OTG_STATE_B_HOST: return "b_host";
352 default: return "UNDEFINED";
353 }
354}
355
356#ifdef CONFIG_USB_MUSB_OTG 336#ifdef CONFIG_USB_MUSB_OTG
357 337
358/* 338/*
@@ -373,12 +353,14 @@ void musb_otg_timer_func(unsigned long data)
373 break; 353 break;
374 case OTG_STATE_A_SUSPEND: 354 case OTG_STATE_A_SUSPEND:
375 case OTG_STATE_A_WAIT_BCON: 355 case OTG_STATE_A_WAIT_BCON:
376 DBG(1, "HNP: %s timeout\n", otg_state_string(musb)); 356 DBG(1, "HNP: %s timeout\n",
357 otg_state_string(musb->xceiv->state));
377 musb_platform_set_vbus(musb, 0); 358 musb_platform_set_vbus(musb, 0);
378 musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; 359 musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
379 break; 360 break;
380 default: 361 default:
381 DBG(1, "HNP: Unhandled mode %s\n", otg_state_string(musb)); 362 DBG(1, "HNP: Unhandled mode %s\n",
363 otg_state_string(musb->xceiv->state));
382 } 364 }
383 musb->ignore_disconnect = 0; 365 musb->ignore_disconnect = 0;
384 spin_unlock_irqrestore(&musb->lock, flags); 366 spin_unlock_irqrestore(&musb->lock, flags);
@@ -393,12 +375,13 @@ void musb_hnp_stop(struct musb *musb)
393 void __iomem *mbase = musb->mregs; 375 void __iomem *mbase = musb->mregs;
394 u8 reg; 376 u8 reg;
395 377
396 DBG(1, "HNP: stop from %s\n", otg_state_string(musb)); 378 DBG(1, "HNP: stop from %s\n", otg_state_string(musb->xceiv->state));
397 379
398 switch (musb->xceiv->state) { 380 switch (musb->xceiv->state) {
399 case OTG_STATE_A_PERIPHERAL: 381 case OTG_STATE_A_PERIPHERAL:
400 musb_g_disconnect(musb); 382 musb_g_disconnect(musb);
401 DBG(1, "HNP: back to %s\n", otg_state_string(musb)); 383 DBG(1, "HNP: back to %s\n",
384 otg_state_string(musb->xceiv->state));
402 break; 385 break;
403 case OTG_STATE_B_HOST: 386 case OTG_STATE_B_HOST:
404 DBG(1, "HNP: Disabling HR\n"); 387 DBG(1, "HNP: Disabling HR\n");
@@ -412,7 +395,7 @@ void musb_hnp_stop(struct musb *musb)
412 break; 395 break;
413 default: 396 default:
414 DBG(1, "HNP: Stopping in unknown state %s\n", 397 DBG(1, "HNP: Stopping in unknown state %s\n",
415 otg_state_string(musb)); 398 otg_state_string(musb->xceiv->state));
416 } 399 }
417 400
418 /* 401 /*
@@ -451,7 +434,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
451 */ 434 */
452 if (int_usb & MUSB_INTR_RESUME) { 435 if (int_usb & MUSB_INTR_RESUME) {
453 handled = IRQ_HANDLED; 436 handled = IRQ_HANDLED;
454 DBG(3, "RESUME (%s)\n", otg_state_string(musb)); 437 DBG(3, "RESUME (%s)\n", otg_state_string(musb->xceiv->state));
455 438
456 if (devctl & MUSB_DEVCTL_HM) { 439 if (devctl & MUSB_DEVCTL_HM) {
457#ifdef CONFIG_USB_MUSB_HDRC_HCD 440#ifdef CONFIG_USB_MUSB_HDRC_HCD
@@ -492,7 +475,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
492 default: 475 default:
493 WARNING("bogus %s RESUME (%s)\n", 476 WARNING("bogus %s RESUME (%s)\n",
494 "host", 477 "host",
495 otg_state_string(musb)); 478 otg_state_string(musb->xceiv->state));
496 } 479 }
497#endif 480#endif
498 } else { 481 } else {
@@ -526,7 +509,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
526 default: 509 default:
527 WARNING("bogus %s RESUME (%s)\n", 510 WARNING("bogus %s RESUME (%s)\n",
528 "peripheral", 511 "peripheral",
529 otg_state_string(musb)); 512 otg_state_string(musb->xceiv->state));
530 } 513 }
531 } 514 }
532 } 515 }
@@ -542,7 +525,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
542 return IRQ_HANDLED; 525 return IRQ_HANDLED;
543 } 526 }
544 527
545 DBG(1, "SESSION_REQUEST (%s)\n", otg_state_string(musb)); 528 DBG(1, "SESSION_REQUEST (%s)\n",
529 otg_state_string(musb->xceiv->state));
546 530
547 /* IRQ arrives from ID pin sense or (later, if VBUS power 531 /* IRQ arrives from ID pin sense or (later, if VBUS power
548 * is removed) SRP. responses are time critical: 532 * is removed) SRP. responses are time critical:
@@ -607,7 +591,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
607 } 591 }
608 592
609 DBG(1, "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n", 593 DBG(1, "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n",
610 otg_state_string(musb), 594 otg_state_string(musb->xceiv->state),
611 devctl, 595 devctl,
612 ({ char *s; 596 ({ char *s;
613 switch (devctl & MUSB_DEVCTL_VBUS) { 597 switch (devctl & MUSB_DEVCTL_VBUS) {
@@ -633,7 +617,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
633#endif 617#endif
634 if (int_usb & MUSB_INTR_SUSPEND) { 618 if (int_usb & MUSB_INTR_SUSPEND) {
635 DBG(1, "SUSPEND (%s) devctl %02x power %02x\n", 619 DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
636 otg_state_string(musb), devctl, power); 620 otg_state_string(musb->xceiv->state), devctl, power);
637 handled = IRQ_HANDLED; 621 handled = IRQ_HANDLED;
638 622
639 switch (musb->xceiv->state) { 623 switch (musb->xceiv->state) {
@@ -758,13 +742,13 @@ b_host:
758 usb_hcd_resume_root_hub(hcd); 742 usb_hcd_resume_root_hub(hcd);
759 743
760 DBG(1, "CONNECT (%s) devctl %02x\n", 744 DBG(1, "CONNECT (%s) devctl %02x\n",
761 otg_state_string(musb), devctl); 745 otg_state_string(musb->xceiv->state), devctl);
762 } 746 }
763#endif /* CONFIG_USB_MUSB_HDRC_HCD */ 747#endif /* CONFIG_USB_MUSB_HDRC_HCD */
764 748
765 if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) { 749 if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) {
766 DBG(1, "DISCONNECT (%s) as %s, devctl %02x\n", 750 DBG(1, "DISCONNECT (%s) as %s, devctl %02x\n",
767 otg_state_string(musb), 751 otg_state_string(musb->xceiv->state),
768 MUSB_MODE(musb), devctl); 752 MUSB_MODE(musb), devctl);
769 handled = IRQ_HANDLED; 753 handled = IRQ_HANDLED;
770 754
@@ -807,7 +791,7 @@ b_host:
807#endif /* GADGET */ 791#endif /* GADGET */
808 default: 792 default:
809 WARNING("unhandled DISCONNECT transition (%s)\n", 793 WARNING("unhandled DISCONNECT transition (%s)\n",
810 otg_state_string(musb)); 794 otg_state_string(musb->xceiv->state));
811 break; 795 break;
812 } 796 }
813 } 797 }
@@ -832,7 +816,8 @@ b_host:
832 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); 816 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
833 } 817 }
834 } else if (is_peripheral_capable()) { 818 } else if (is_peripheral_capable()) {
835 DBG(1, "BUS RESET as %s\n", otg_state_string(musb)); 819 DBG(1, "BUS RESET as %s\n",
820 otg_state_string(musb->xceiv->state));
836 switch (musb->xceiv->state) { 821 switch (musb->xceiv->state) {
837#ifdef CONFIG_USB_OTG 822#ifdef CONFIG_USB_OTG
838 case OTG_STATE_A_SUSPEND: 823 case OTG_STATE_A_SUSPEND:
@@ -846,8 +831,8 @@ b_host:
846 case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */ 831 case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */
847 /* never use invalid T(a_wait_bcon) */ 832 /* never use invalid T(a_wait_bcon) */
848 DBG(1, "HNP: in %s, %d msec timeout\n", 833 DBG(1, "HNP: in %s, %d msec timeout\n",
849 otg_state_string(musb), 834 otg_state_string(musb->xceiv->state),
850 TA_WAIT_BCON(musb)); 835 TA_WAIT_BCON(musb));
851 mod_timer(&musb->otg_timer, jiffies 836 mod_timer(&musb->otg_timer, jiffies
852 + msecs_to_jiffies(TA_WAIT_BCON(musb))); 837 + msecs_to_jiffies(TA_WAIT_BCON(musb)));
853 break; 838 break;
@@ -858,7 +843,7 @@ b_host:
858 break; 843 break;
859 case OTG_STATE_B_WAIT_ACON: 844 case OTG_STATE_B_WAIT_ACON:
860 DBG(1, "HNP: RESET (%s), to b_peripheral\n", 845 DBG(1, "HNP: RESET (%s), to b_peripheral\n",
861 otg_state_string(musb)); 846 otg_state_string(musb->xceiv->state));
862 musb->xceiv->state = OTG_STATE_B_PERIPHERAL; 847 musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
863 musb_g_reset(musb); 848 musb_g_reset(musb);
864 break; 849 break;
@@ -871,7 +856,7 @@ b_host:
871 break; 856 break;
872 default: 857 default:
873 DBG(1, "Unhandled BUS RESET as %s\n", 858 DBG(1, "Unhandled BUS RESET as %s\n",
874 otg_state_string(musb)); 859 otg_state_string(musb->xceiv->state));
875 } 860 }
876 } 861 }
877 } 862 }
@@ -1713,7 +1698,7 @@ musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
1713 int ret = -EINVAL; 1698 int ret = -EINVAL;
1714 1699
1715 spin_lock_irqsave(&musb->lock, flags); 1700 spin_lock_irqsave(&musb->lock, flags);
1716 ret = sprintf(buf, "%s\n", otg_state_string(musb)); 1701 ret = sprintf(buf, "%s\n", otg_state_string(musb->xceiv->state));
1717 spin_unlock_irqrestore(&musb->lock, flags); 1702 spin_unlock_irqrestore(&musb->lock, flags);
1718 1703
1719 return ret; 1704 return ret;
diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h
index 94f6973cf8f7..f958a49a0124 100644
--- a/drivers/usb/musb/musb_debug.h
+++ b/drivers/usb/musb/musb_debug.h
@@ -54,8 +54,6 @@ static inline int _dbg_level(unsigned l)
54 return musb_debug >= l; 54 return musb_debug >= l;
55} 55}
56 56
57extern const char *otg_state_string(struct musb *);
58
59#ifdef CONFIG_DEBUG_FS 57#ifdef CONFIG_DEBUG_FS
60extern int musb_init_debugfs(struct musb *musb); 58extern int musb_init_debugfs(struct musb *musb);
61extern void musb_exit_debugfs(struct musb *musb); 59extern void musb_exit_debugfs(struct musb *musb);
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 6dfbf9ffd7a6..3d799195c8b4 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1556,7 +1556,8 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
1556 status = 0; 1556 status = 0;
1557 goto done; 1557 goto done;
1558 default: 1558 default:
1559 DBG(2, "Unhandled wake: %s\n", otg_state_string(musb)); 1559 DBG(2, "Unhandled wake: %s\n",
1560 otg_state_string(musb->xceiv->state));
1560 goto done; 1561 goto done;
1561 } 1562 }
1562 1563
@@ -2039,7 +2040,7 @@ void musb_g_resume(struct musb *musb)
2039 break; 2040 break;
2040 default: 2041 default:
2041 WARNING("unhandled RESUME transition (%s)\n", 2042 WARNING("unhandled RESUME transition (%s)\n",
2042 otg_state_string(musb)); 2043 otg_state_string(musb->xceiv->state));
2043 } 2044 }
2044} 2045}
2045 2046
@@ -2069,7 +2070,7 @@ void musb_g_suspend(struct musb *musb)
2069 * A_PERIPHERAL may need care too 2070 * A_PERIPHERAL may need care too
2070 */ 2071 */
2071 WARNING("unhandled SUSPEND transition (%s)\n", 2072 WARNING("unhandled SUSPEND transition (%s)\n",
2072 otg_state_string(musb)); 2073 otg_state_string(musb->xceiv->state));
2073 } 2074 }
2074} 2075}
2075 2076
@@ -2104,7 +2105,7 @@ void musb_g_disconnect(struct musb *musb)
2104 default: 2105 default:
2105#ifdef CONFIG_USB_MUSB_OTG 2106#ifdef CONFIG_USB_MUSB_OTG
2106 DBG(2, "Unhandled disconnect %s, setting a_idle\n", 2107 DBG(2, "Unhandled disconnect %s, setting a_idle\n",
2107 otg_state_string(musb)); 2108 otg_state_string(musb->xceiv->state));
2108 musb->xceiv->state = OTG_STATE_A_IDLE; 2109 musb->xceiv->state = OTG_STATE_A_IDLE;
2109 MUSB_HST_MODE(musb); 2110 MUSB_HST_MODE(musb);
2110 break; 2111 break;
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 5eef4a8847db..07b106c7de82 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2304,7 +2304,7 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
2304 2304
2305 if (musb->is_active) { 2305 if (musb->is_active) {
2306 WARNING("trying to suspend as %s while active\n", 2306 WARNING("trying to suspend as %s while active\n",
2307 otg_state_string(musb)); 2307 otg_state_string(musb->xceiv->state));
2308 return -EBUSY; 2308 return -EBUSY;
2309 } else 2309 } else
2310 return 0; 2310 return 0;
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index 489104a5ae14..bb1247d5fd04 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -98,7 +98,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
98#endif 98#endif
99 default: 99 default:
100 DBG(1, "bogus rh suspend? %s\n", 100 DBG(1, "bogus rh suspend? %s\n",
101 otg_state_string(musb)); 101 otg_state_string(musb->xceiv->state));
102 } 102 }
103 } else if (power & MUSB_POWER_SUSPENDM) { 103 } else if (power & MUSB_POWER_SUSPENDM) {
104 power &= ~MUSB_POWER_SUSPENDM; 104 power &= ~MUSB_POWER_SUSPENDM;
@@ -208,7 +208,8 @@ void musb_root_disconnect(struct musb *musb)
208 musb->xceiv->state = OTG_STATE_B_IDLE; 208 musb->xceiv->state = OTG_STATE_B_IDLE;
209 break; 209 break;
210 default: 210 default:
211 DBG(1, "host disconnect (%s)\n", otg_state_string(musb)); 211 DBG(1, "host disconnect (%s)\n",
212 otg_state_string(musb->xceiv->state));
212 } 213 }
213} 214}
214 215
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 57a27fa954b4..d51b15adc0b0 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -114,7 +114,8 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
114 /* Never idle if active, or when VBUS timeout is not set as host */ 114 /* Never idle if active, or when VBUS timeout is not set as host */
115 if (musb->is_active || ((musb->a_wait_bcon == 0) 115 if (musb->is_active || ((musb->a_wait_bcon == 0)
116 && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) { 116 && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
117 DBG(4, "%s active, deleting timer\n", otg_state_string(musb)); 117 DBG(4, "%s active, deleting timer\n",
118 otg_state_string(musb->xceiv->state));
118 del_timer(&musb_idle_timer); 119 del_timer(&musb_idle_timer);
119 last_timer = jiffies; 120 last_timer = jiffies;
120 return; 121 return;
@@ -131,7 +132,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
131 last_timer = timeout; 132 last_timer = timeout;
132 133
133 DBG(4, "%s inactive, for idle timer for %lu ms\n", 134 DBG(4, "%s inactive, for idle timer for %lu ms\n",
134 otg_state_string(musb), 135 otg_state_string(musb->xceiv->state),
135 (unsigned long)jiffies_to_msecs(timeout - jiffies)); 136 (unsigned long)jiffies_to_msecs(timeout - jiffies));
136 mod_timer(&musb_idle_timer, timeout); 137 mod_timer(&musb_idle_timer, timeout);
137} 138}
@@ -195,7 +196,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
195 196
196 DBG(1, "VBUS %s, devctl %02x " 197 DBG(1, "VBUS %s, devctl %02x "
197 /* otg %3x conf %08x prcm %08x */ "\n", 198 /* otg %3x conf %08x prcm %08x */ "\n",
198 otg_state_string(musb), 199 otg_state_string(musb->xceiv->state),
199 musb_readb(musb->mregs, MUSB_DEVCTL)); 200 musb_readb(musb->mregs, MUSB_DEVCTL));
200} 201}
201 202
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index c47aac4a1f98..221feaaded72 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -422,7 +422,7 @@ static void musb_do_idle(unsigned long _musb)
422 && (musb->idle_timeout == 0 422 && (musb->idle_timeout == 0
423 || time_after(jiffies, musb->idle_timeout))) { 423 || time_after(jiffies, musb->idle_timeout))) {
424 DBG(4, "Nothing connected %s, turning off VBUS\n", 424 DBG(4, "Nothing connected %s, turning off VBUS\n",
425 otg_state_string(musb)); 425 otg_state_string(musb->xceiv->state));
426 } 426 }
427 /* FALLTHROUGH */ 427 /* FALLTHROUGH */
428 case OTG_STATE_A_IDLE: 428 case OTG_STATE_A_IDLE:
@@ -481,7 +481,8 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout)
481 /* Never idle if active, or when VBUS timeout is not set as host */ 481 /* Never idle if active, or when VBUS timeout is not set as host */
482 if (musb->is_active || ((musb->a_wait_bcon == 0) 482 if (musb->is_active || ((musb->a_wait_bcon == 0)
483 && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) { 483 && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
484 DBG(4, "%s active, deleting timer\n", otg_state_string(musb)); 484 DBG(4, "%s active, deleting timer\n",
485 otg_state_string(musb->xceiv->state));
485 del_timer(&musb_idle_timer); 486 del_timer(&musb_idle_timer);
486 last_timer = jiffies; 487 last_timer = jiffies;
487 return; 488 return;
@@ -498,7 +499,7 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout)
498 last_timer = timeout; 499 last_timer = timeout;
499 500
500 DBG(4, "%s inactive, for idle timer for %lu ms\n", 501 DBG(4, "%s inactive, for idle timer for %lu ms\n",
501 otg_state_string(musb), 502 otg_state_string(musb->xceiv->state),
502 (unsigned long)jiffies_to_msecs(timeout - jiffies)); 503 (unsigned long)jiffies_to_msecs(timeout - jiffies));
503 mod_timer(&musb_idle_timer, timeout); 504 mod_timer(&musb_idle_timer, timeout);
504} 505}
@@ -573,7 +574,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
573 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); 574 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
574 575
575 DBG(1, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n", 576 DBG(1, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n",
576 otg_state_string(musb), 577 otg_state_string(musb->xceiv->state),
577 musb_readb(musb->mregs, MUSB_DEVCTL), 578 musb_readb(musb->mregs, MUSB_DEVCTL),
578 musb_readl(tbase, TUSB_DEV_OTG_STAT), 579 musb_readl(tbase, TUSB_DEV_OTG_STAT),
579 conf, prcm); 580 conf, prcm);
@@ -702,13 +703,13 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
702 musb->is_active = 0; 703 musb->is_active = 0;
703 } 704 }
704 DBG(2, "vbus change, %s, otg %03x\n", 705 DBG(2, "vbus change, %s, otg %03x\n",
705 otg_state_string(musb), otg_stat); 706 otg_state_string(musb->xceiv->state), otg_stat);
706 idle_timeout = jiffies + (1 * HZ); 707 idle_timeout = jiffies + (1 * HZ);
707 schedule_work(&musb->irq_work); 708 schedule_work(&musb->irq_work);
708 709
709 } else /* A-dev state machine */ { 710 } else /* A-dev state machine */ {
710 DBG(2, "vbus change, %s, otg %03x\n", 711 DBG(2, "vbus change, %s, otg %03x\n",
711 otg_state_string(musb), otg_stat); 712 otg_state_string(musb->xceiv->state), otg_stat);
712 713
713 switch (musb->xceiv->state) { 714 switch (musb->xceiv->state) {
714 case OTG_STATE_A_IDLE: 715 case OTG_STATE_A_IDLE:
@@ -756,7 +757,8 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
756 if (int_src & TUSB_INT_SRC_OTG_TIMEOUT) { 757 if (int_src & TUSB_INT_SRC_OTG_TIMEOUT) {
757 u8 devctl; 758 u8 devctl;
758 759
759 DBG(4, "%s timer, %03x\n", otg_state_string(musb), otg_stat); 760 DBG(4, "%s timer, %03x\n",
761 otg_state_string(musb->xceiv->state), otg_stat);
760 762
761 switch (musb->xceiv->state) { 763 switch (musb->xceiv->state) {
762 case OTG_STATE_A_WAIT_VRISE: 764 case OTG_STATE_A_WAIT_VRISE:
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index bc84858b3a4d..d87f44f5b04e 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -168,6 +168,7 @@ otg_shutdown(struct otg_transceiver *otg)
168#ifdef CONFIG_USB_OTG_UTILS 168#ifdef CONFIG_USB_OTG_UTILS
169extern struct otg_transceiver *otg_get_transceiver(void); 169extern struct otg_transceiver *otg_get_transceiver(void);
170extern void otg_put_transceiver(struct otg_transceiver *); 170extern void otg_put_transceiver(struct otg_transceiver *);
171extern const char *otg_state_string(enum usb_otg_state state);
171#else 172#else
172static inline struct otg_transceiver *otg_get_transceiver(void) 173static inline struct otg_transceiver *otg_get_transceiver(void)
173{ 174{
@@ -177,6 +178,11 @@ static inline struct otg_transceiver *otg_get_transceiver(void)
177static inline void otg_put_transceiver(struct otg_transceiver *x) 178static inline void otg_put_transceiver(struct otg_transceiver *x)
178{ 179{
179} 180}
181
182static inline const char *otg_state_string(enum usb_otg_state state)
183{
184 return NULL;
185}
180#endif 186#endif
181 187
182/* Context: can sleep */ 188/* Context: can sleep */
@@ -246,6 +252,5 @@ otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
246 252
247/* for OTG controller drivers (and maybe other stuff) */ 253/* for OTG controller drivers (and maybe other stuff) */
248extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 254extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
249extern const char *otg_state_string(enum usb_otg_state state);
250 255
251#endif /* __LINUX_USB_OTG_H */ 256#endif /* __LINUX_USB_OTG_H */