aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/musb_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb/musb_core.c')
-rw-r--r--drivers/usb/musb/musb_core.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c9f9024c551..99beebce855 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -552,7 +552,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
552 if (int_usb & MUSB_INTR_SESSREQ) { 552 if (int_usb & MUSB_INTR_SESSREQ) {
553 void __iomem *mbase = musb->mregs; 553 void __iomem *mbase = musb->mregs;
554 554
555 if (devctl & MUSB_DEVCTL_BDEVICE) { 555 if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS
556 && (devctl & MUSB_DEVCTL_BDEVICE)) {
556 DBG(3, "SessReq while on B state\n"); 557 DBG(3, "SessReq while on B state\n");
557 return IRQ_HANDLED; 558 return IRQ_HANDLED;
558 } 559 }
@@ -1052,6 +1053,11 @@ static void musb_shutdown(struct platform_device *pdev)
1052 clk_put(musb->clock); 1053 clk_put(musb->clock);
1053 spin_unlock_irqrestore(&musb->lock, flags); 1054 spin_unlock_irqrestore(&musb->lock, flags);
1054 1055
1056 if (!is_otg_enabled(musb) && is_host_enabled(musb))
1057 usb_remove_hcd(musb_to_hcd(musb));
1058 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
1059 musb_platform_exit(musb);
1060
1055 /* FIXME power down */ 1061 /* FIXME power down */
1056} 1062}
1057 1063
@@ -2110,12 +2116,15 @@ bad_config:
2110 * Otherwise, wait till the gadget driver hooks up. 2116 * Otherwise, wait till the gadget driver hooks up.
2111 */ 2117 */
2112 if (!is_otg_enabled(musb) && is_host_enabled(musb)) { 2118 if (!is_otg_enabled(musb) && is_host_enabled(musb)) {
2119 struct usb_hcd *hcd = musb_to_hcd(musb);
2120
2113 MUSB_HST_MODE(musb); 2121 MUSB_HST_MODE(musb);
2114 musb->xceiv->default_a = 1; 2122 musb->xceiv->default_a = 1;
2115 musb->xceiv->state = OTG_STATE_A_IDLE; 2123 musb->xceiv->state = OTG_STATE_A_IDLE;
2116 2124
2117 status = usb_add_hcd(musb_to_hcd(musb), -1, 0); 2125 status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
2118 2126
2127 hcd->self.uses_pio_for_control = 1;
2119 DBG(1, "%s mode, status %d, devctl %02x %c\n", 2128 DBG(1, "%s mode, status %d, devctl %02x %c\n",
2120 "HOST", status, 2129 "HOST", status,
2121 musb_readb(musb->mregs, MUSB_DEVCTL), 2130 musb_readb(musb->mregs, MUSB_DEVCTL),
@@ -2244,13 +2253,6 @@ static int __exit musb_remove(struct platform_device *pdev)
2244 */ 2253 */
2245 musb_exit_debugfs(musb); 2254 musb_exit_debugfs(musb);
2246 musb_shutdown(pdev); 2255 musb_shutdown(pdev);
2247#ifdef CONFIG_USB_MUSB_HDRC_HCD
2248 if (musb->board_mode == MUSB_HOST)
2249 usb_remove_hcd(musb_to_hcd(musb));
2250#endif
2251 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2252 musb_platform_exit(musb);
2253 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2254 2256
2255 musb_free(musb); 2257 musb_free(musb);
2256 iounmap(ctrl_base); 2258 iounmap(ctrl_base);
@@ -2411,9 +2413,6 @@ static int musb_suspend(struct device *dev)
2411 unsigned long flags; 2413 unsigned long flags;
2412 struct musb *musb = dev_to_musb(&pdev->dev); 2414 struct musb *musb = dev_to_musb(&pdev->dev);
2413 2415
2414 if (!musb->clock)
2415 return 0;
2416
2417 spin_lock_irqsave(&musb->lock, flags); 2416 spin_lock_irqsave(&musb->lock, flags);
2418 2417
2419 if (is_peripheral_active(musb)) { 2418 if (is_peripheral_active(musb)) {
@@ -2428,10 +2427,12 @@ static int musb_suspend(struct device *dev)
2428 2427
2429 musb_save_context(musb); 2428 musb_save_context(musb);
2430 2429
2431 if (musb->set_clock) 2430 if (musb->clock) {
2432 musb->set_clock(musb->clock, 0); 2431 if (musb->set_clock)
2433 else 2432 musb->set_clock(musb->clock, 0);
2434 clk_disable(musb->clock); 2433 else
2434 clk_disable(musb->clock);
2435 }
2435 spin_unlock_irqrestore(&musb->lock, flags); 2436 spin_unlock_irqrestore(&musb->lock, flags);
2436 return 0; 2437 return 0;
2437} 2438}
@@ -2441,13 +2442,12 @@ static int musb_resume_noirq(struct device *dev)
2441 struct platform_device *pdev = to_platform_device(dev); 2442 struct platform_device *pdev = to_platform_device(dev);
2442 struct musb *musb = dev_to_musb(&pdev->dev); 2443 struct musb *musb = dev_to_musb(&pdev->dev);
2443 2444
2444 if (!musb->clock) 2445 if (musb->clock) {
2445 return 0; 2446 if (musb->set_clock)
2446 2447 musb->set_clock(musb->clock, 1);
2447 if (musb->set_clock) 2448 else
2448 musb->set_clock(musb->clock, 1); 2449 clk_enable(musb->clock);
2449 else 2450 }
2450 clk_enable(musb->clock);
2451 2451
2452 musb_restore_context(musb); 2452 musb_restore_context(musb);
2453 2453