• Home
  • Raw
  • Download

Lines Matching refs:musb

38 	struct platform_device	*musb;  member
42 #define glue_to_musb(g) platform_get_drvdata(g->musb)
50 struct musb *musb = (void *)_musb; in musb_do_idle() local
55 spin_lock_irqsave(&musb->lock, flags); in musb_do_idle()
57 switch (musb->xceiv->state) { in musb_do_idle()
60 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in musb_do_idle()
62 musb->xceiv->state = OTG_STATE_B_IDLE; in musb_do_idle()
63 MUSB_DEV_MODE(musb); in musb_do_idle()
65 musb->xceiv->state = OTG_STATE_A_IDLE; in musb_do_idle()
66 MUSB_HST_MODE(musb); in musb_do_idle()
71 if (musb->port1_status & MUSB_PORT_STAT_RESUME) { in musb_do_idle()
72 power = musb_readb(musb->mregs, MUSB_POWER); in musb_do_idle()
74 dev_dbg(musb->controller, "root port resume stopped, power %02x\n", power); in musb_do_idle()
75 musb_writeb(musb->mregs, MUSB_POWER, power); in musb_do_idle()
76 musb->is_active = 1; in musb_do_idle()
77 musb->port1_status &= ~(USB_PORT_STAT_SUSPEND in musb_do_idle()
79 musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16; in musb_do_idle()
80 usb_hcd_poll_rh_status(musb_to_hcd(musb)); in musb_do_idle()
82 musb->xceiv->state = OTG_STATE_A_HOST; in musb_do_idle()
86 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in musb_do_idle()
88 musb->xceiv->state = OTG_STATE_B_IDLE; in musb_do_idle()
90 musb->xceiv->state = OTG_STATE_A_WAIT_BCON; in musb_do_idle()
94 spin_unlock_irqrestore(&musb->lock, flags); in musb_do_idle()
98 static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout) in omap2430_musb_try_idle() argument
107 if (musb->is_active || ((musb->a_wait_bcon == 0) in omap2430_musb_try_idle()
108 && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) { in omap2430_musb_try_idle()
109 dev_dbg(musb->controller, "%s active, deleting timer\n", in omap2430_musb_try_idle()
110 otg_state_string(musb->xceiv->state)); in omap2430_musb_try_idle()
120 dev_dbg(musb->controller, "Longer idle timer already pending, ignoring\n"); in omap2430_musb_try_idle()
126 dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", in omap2430_musb_try_idle()
127 otg_state_string(musb->xceiv->state), in omap2430_musb_try_idle()
132 static void omap2430_musb_set_vbus(struct musb *musb, int is_on) in omap2430_musb_set_vbus() argument
134 struct usb_otg *otg = musb->xceiv->otg; in omap2430_musb_set_vbus()
143 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in omap2430_musb_set_vbus()
146 if (musb->xceiv->state == OTG_STATE_A_IDLE) { in omap2430_musb_set_vbus()
149 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_set_vbus()
154 while (musb_readb(musb->mregs, MUSB_DEVCTL) & 0x80) { in omap2430_musb_set_vbus()
159 dev_err(musb->controller, in omap2430_musb_set_vbus()
169 musb->is_active = 1; in omap2430_musb_set_vbus()
171 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; in omap2430_musb_set_vbus()
173 MUSB_HST_MODE(musb); in omap2430_musb_set_vbus()
176 musb->is_active = 0; in omap2430_musb_set_vbus()
183 musb->xceiv->state = OTG_STATE_B_IDLE; in omap2430_musb_set_vbus()
186 MUSB_DEV_MODE(musb); in omap2430_musb_set_vbus()
188 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_set_vbus()
190 dev_dbg(musb->controller, "VBUS %s, devctl %02x " in omap2430_musb_set_vbus()
192 otg_state_string(musb->xceiv->state), in omap2430_musb_set_vbus()
193 musb_readb(musb->mregs, MUSB_DEVCTL)); in omap2430_musb_set_vbus()
196 static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode) in omap2430_musb_set_mode() argument
198 u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in omap2430_musb_set_mode()
201 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_set_mode()
207 static inline void omap2430_low_level_exit(struct musb *musb) in omap2430_low_level_exit() argument
212 l = musb_readl(musb->mregs, OTG_FORCESTDBY); in omap2430_low_level_exit()
214 musb_writel(musb->mregs, OTG_FORCESTDBY, l); in omap2430_low_level_exit()
217 static inline void omap2430_low_level_init(struct musb *musb) in omap2430_low_level_init() argument
221 l = musb_readl(musb->mregs, OTG_FORCESTDBY); in omap2430_low_level_init()
223 musb_writel(musb->mregs, OTG_FORCESTDBY, l); in omap2430_low_level_init()
230 struct musb *musb = glue_to_musb(glue); in omap_musb_mailbox() local
233 if (!musb) { in omap_musb_mailbox()
244 struct musb *musb = glue_to_musb(glue); in omap_musb_set_mailbox() local
245 struct device *dev = musb->controller; in omap_musb_set_mailbox()
248 struct usb_otg *otg = musb->xceiv->otg; in omap_musb_set_mailbox()
255 musb->xceiv->state = OTG_STATE_A_IDLE; in omap_musb_set_mailbox()
256 musb->xceiv->last_event = USB_EVENT_ID; in omap_musb_set_mailbox()
257 if (!is_otg_enabled(musb) || musb->gadget_driver) { in omap_musb_set_mailbox()
259 usb_phy_init(musb->xceiv); in omap_musb_set_mailbox()
260 omap2430_musb_set_vbus(musb, 1); in omap_musb_set_mailbox()
268 musb->xceiv->state = OTG_STATE_B_IDLE; in omap_musb_set_mailbox()
269 musb->xceiv->last_event = USB_EVENT_VBUS; in omap_musb_set_mailbox()
270 if (musb->gadget_driver) in omap_musb_set_mailbox()
272 usb_phy_init(musb->xceiv); in omap_musb_set_mailbox()
279 musb->xceiv->last_event = USB_EVENT_NONE; in omap_musb_set_mailbox()
280 if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) in omap_musb_set_mailbox()
281 if (musb->gadget_driver) { in omap_musb_set_mailbox()
287 if (musb->xceiv->otg->set_vbus) in omap_musb_set_mailbox()
288 otg_set_vbus(musb->xceiv->otg, 0); in omap_musb_set_mailbox()
290 usb_phy_shutdown(musb->xceiv); in omap_musb_set_mailbox()
306 static int omap2430_musb_init(struct musb *musb) in omap2430_musb_init() argument
312 struct device *dev = musb->controller; in omap2430_musb_init()
318 (struct omap_musb_board_data *)musb->controller; in omap2430_musb_init()
322 musb_writel(musb->mregs, OTG_SYSCONFIG, SOFTRST); in omap2430_musb_init()
327 l = musb_readl(musb->mregs, OTG_SYSCONFIG); in omap2430_musb_init()
332 dev_err(musb->controller, "MUSB reset is taking too long\n"); in omap2430_musb_init()
342 musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); in omap2430_musb_init()
343 if (IS_ERR_OR_NULL(musb->xceiv)) { in omap2430_musb_init()
355 l = musb_readl(musb->mregs, OTG_INTERFSEL); in omap2430_musb_init()
365 musb_writel(musb->mregs, OTG_INTERFSEL, l); in omap2430_musb_init()
369 musb_readl(musb->mregs, OTG_REVISION), in omap2430_musb_init()
370 musb_readl(musb->mregs, OTG_SYSCONFIG), in omap2430_musb_init()
371 musb_readl(musb->mregs, OTG_SYSSTATUS), in omap2430_musb_init()
372 musb_readl(musb->mregs, OTG_INTERFSEL), in omap2430_musb_init()
373 musb_readl(musb->mregs, OTG_SIMENABLE)); in omap2430_musb_init()
376 setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); in omap2430_musb_init()
381 pm_runtime_put_noidle(musb->controller); in omap2430_musb_init()
390 static void omap2430_musb_enable(struct musb *musb) in omap2430_musb_enable() argument
392 static int omap2430_musb_enable(struct musb *musb) in omap2430_musb_enable()
398 struct device *dev = musb->controller; in omap2430_musb_enable()
406 usb_phy_init(musb->xceiv); in omap2430_musb_enable()
409 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in omap2430_musb_enable()
412 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_enable()
413 while (musb_readb(musb->mregs, MUSB_DEVCTL) & in omap2430_musb_enable()
425 usb_phy_init(musb->xceiv); in omap2430_musb_enable()
453 static void omap2430_musb_disable(struct musb *musb) in omap2430_musb_disable() argument
456 struct device *dev = musb->controller; in omap2430_musb_disable()
460 usb_phy_shutdown(musb->xceiv); in omap2430_musb_disable()
464 static int omap2430_musb_exit(struct musb *musb) in omap2430_musb_exit() argument
468 omap2430_low_level_exit(musb); in omap2430_musb_exit()
498 struct platform_device *musb; in omap2430_probe() local
508 musb = platform_device_alloc("musb-hdrc", -1); in omap2430_probe()
509 if (!musb) { in omap2430_probe()
514 musb->dev.parent = &pdev->dev; in omap2430_probe()
515 musb->dev.dma_mask = &omap2430_dmamask; in omap2430_probe()
516 musb->dev.coherent_dma_mask = omap2430_dmamask; in omap2430_probe()
519 glue->musb = musb; in omap2430_probe()
534 ret = platform_device_add_resources(musb, pdev->resource, in omap2430_probe()
541 ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); in omap2430_probe()
549 ret = platform_device_add(musb); in omap2430_probe()
558 platform_device_put(musb); in omap2430_probe()
569 platform_device_del(glue->musb); in omap2430_remove()
570 platform_device_put(glue->musb); in omap2430_remove()
580 struct musb *musb = glue_to_musb(glue); in omap2430_runtime_suspend() local
582 if (musb) { in omap2430_runtime_suspend()
583 musb->context.otg_interfsel = musb_readl(musb->mregs, in omap2430_runtime_suspend()
586 omap2430_low_level_exit(musb); in omap2430_runtime_suspend()
587 usb_phy_set_suspend(musb->xceiv, 1); in omap2430_runtime_suspend()
596 struct musb *musb = glue_to_musb(glue); in omap2430_runtime_resume() local
598 if (musb) { in omap2430_runtime_resume()
599 omap2430_low_level_init(musb); in omap2430_runtime_resume()
600 musb_writel(musb->mregs, OTG_INTERFSEL, in omap2430_runtime_resume()
601 musb->context.otg_interfsel); in omap2430_runtime_resume()
603 usb_phy_set_suspend(musb->xceiv, 0); in omap2430_runtime_resume()