• Home
  • Raw
  • Download

Lines Matching refs:musb

48 	struct platform_device	*musb;  member
53 #define glue_to_musb(g) platform_get_drvdata(g->musb)
57 static void omap2430_musb_set_vbus(struct musb *musb, int is_on) in omap2430_musb_set_vbus() argument
59 struct usb_otg *otg = musb->xceiv->otg; in omap2430_musb_set_vbus()
67 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in omap2430_musb_set_vbus()
70 if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) { in omap2430_musb_set_vbus()
74 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_set_vbus()
79 while (musb_readb(musb->mregs, MUSB_DEVCTL) & in omap2430_musb_set_vbus()
87 dev_err(musb->controller, in omap2430_musb_set_vbus()
95 musb->is_active = 1; in omap2430_musb_set_vbus()
97 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; in omap2430_musb_set_vbus()
99 MUSB_HST_MODE(musb); in omap2430_musb_set_vbus()
102 musb->is_active = 0; in omap2430_musb_set_vbus()
109 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in omap2430_musb_set_vbus()
112 MUSB_DEV_MODE(musb); in omap2430_musb_set_vbus()
114 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_set_vbus()
116 dev_dbg(musb->controller, "VBUS %s, devctl %02x " in omap2430_musb_set_vbus()
118 usb_otg_state_string(musb->xceiv->otg->state), in omap2430_musb_set_vbus()
119 musb_readb(musb->mregs, MUSB_DEVCTL)); in omap2430_musb_set_vbus()
122 static inline void omap2430_low_level_exit(struct musb *musb) in omap2430_low_level_exit() argument
127 l = musb_readl(musb->mregs, OTG_FORCESTDBY); in omap2430_low_level_exit()
129 musb_writel(musb->mregs, OTG_FORCESTDBY, l); in omap2430_low_level_exit()
132 static inline void omap2430_low_level_init(struct musb *musb) in omap2430_low_level_init() argument
136 l = musb_readl(musb->mregs, OTG_FORCESTDBY); in omap2430_low_level_init()
138 musb_writel(musb->mregs, OTG_FORCESTDBY, l); in omap2430_low_level_init()
163 struct musb *musb = glue_to_musb(glue); in omap_musb_set_mailbox() local
165 dev_get_platdata(musb->controller); in omap_musb_set_mailbox()
167 struct usb_otg *otg = musb->xceiv->otg; in omap_musb_set_mailbox()
169 pm_runtime_get_sync(musb->controller); in omap_musb_set_mailbox()
172 dev_dbg(musb->controller, "ID GND\n"); in omap_musb_set_mailbox()
175 musb->xceiv->otg->state = OTG_STATE_A_IDLE; in omap_musb_set_mailbox()
176 musb->xceiv->last_event = USB_EVENT_ID; in omap_musb_set_mailbox()
177 if (musb->gadget_driver) { in omap_musb_set_mailbox()
180 omap2430_musb_set_vbus(musb, 1); in omap_musb_set_mailbox()
185 dev_dbg(musb->controller, "VBUS Connect\n"); in omap_musb_set_mailbox()
188 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in omap_musb_set_mailbox()
189 musb->xceiv->last_event = USB_EVENT_VBUS; in omap_musb_set_mailbox()
195 dev_dbg(musb->controller, "VBUS Disconnect\n"); in omap_musb_set_mailbox()
197 musb->xceiv->last_event = USB_EVENT_NONE; in omap_musb_set_mailbox()
198 if (musb->gadget_driver) in omap_musb_set_mailbox()
199 omap2430_musb_set_vbus(musb, 0); in omap_musb_set_mailbox()
202 otg_set_vbus(musb->xceiv->otg, 0); in omap_musb_set_mailbox()
208 dev_dbg(musb->controller, "ID float\n"); in omap_musb_set_mailbox()
210 pm_runtime_mark_last_busy(musb->controller); in omap_musb_set_mailbox()
211 pm_runtime_put_autosuspend(musb->controller); in omap_musb_set_mailbox()
212 atomic_notifier_call_chain(&musb->xceiv->notifier, in omap_musb_set_mailbox()
213 musb->xceiv->last_event, NULL); in omap_musb_set_mailbox()
229 struct musb *musb = __hci; in omap2430_musb_interrupt() local
231 spin_lock_irqsave(&musb->lock, flags); in omap2430_musb_interrupt()
233 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); in omap2430_musb_interrupt()
234 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); in omap2430_musb_interrupt()
235 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); in omap2430_musb_interrupt()
237 if (musb->int_usb || musb->int_tx || musb->int_rx) in omap2430_musb_interrupt()
238 retval = musb_interrupt(musb); in omap2430_musb_interrupt()
240 spin_unlock_irqrestore(&musb->lock, flags); in omap2430_musb_interrupt()
245 static int omap2430_musb_init(struct musb *musb) in omap2430_musb_init() argument
249 struct device *dev = musb->controller; in omap2430_musb_init()
259 musb->phy = devm_phy_get(dev->parent, "usb2-phy"); in omap2430_musb_init()
267 musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, in omap2430_musb_init()
270 musb->xceiv = devm_usb_get_phy_dev(dev, 0); in omap2430_musb_init()
271 musb->phy = devm_phy_get(dev, "usb"); in omap2430_musb_init()
274 if (IS_ERR(musb->xceiv)) { in omap2430_musb_init()
275 status = PTR_ERR(musb->xceiv); in omap2430_musb_init()
284 if (IS_ERR(musb->phy)) { in omap2430_musb_init()
286 return PTR_ERR(musb->phy); in omap2430_musb_init()
288 musb->isr = omap2430_musb_interrupt; in omap2430_musb_init()
289 phy_init(musb->phy); in omap2430_musb_init()
290 phy_power_on(musb->phy); in omap2430_musb_init()
292 l = musb_readl(musb->mregs, OTG_INTERFSEL); in omap2430_musb_init()
302 musb_writel(musb->mregs, OTG_INTERFSEL, l); in omap2430_musb_init()
306 musb_readl(musb->mregs, OTG_REVISION), in omap2430_musb_init()
307 musb_readl(musb->mregs, OTG_SYSCONFIG), in omap2430_musb_init()
308 musb_readl(musb->mregs, OTG_SYSSTATUS), in omap2430_musb_init()
309 musb_readl(musb->mregs, OTG_INTERFSEL), in omap2430_musb_init()
310 musb_readl(musb->mregs, OTG_SIMENABLE)); in omap2430_musb_init()
318 static void omap2430_musb_enable(struct musb *musb) in omap2430_musb_enable() argument
322 struct device *dev = musb->controller; in omap2430_musb_enable()
334 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in omap2430_musb_enable()
337 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in omap2430_musb_enable()
338 while (musb_readb(musb->mregs, MUSB_DEVCTL) & in omap2430_musb_enable()
358 static void omap2430_musb_disable(struct musb *musb) in omap2430_musb_disable() argument
360 struct device *dev = musb->controller; in omap2430_musb_disable()
368 static int omap2430_musb_exit(struct musb *musb) in omap2430_musb_exit() argument
370 struct device *dev = musb->controller; in omap2430_musb_exit()
373 omap2430_low_level_exit(musb); in omap2430_musb_exit()
374 phy_power_off(musb->phy); in omap2430_musb_exit()
375 phy_exit(musb->phy); in omap2430_musb_exit()
376 musb->phy = NULL; in omap2430_musb_exit()
406 struct platform_device *musb; in omap2430_probe() local
416 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); in omap2430_probe()
417 if (!musb) { in omap2430_probe()
422 musb->dev.parent = &pdev->dev; in omap2430_probe()
423 musb->dev.dma_mask = &omap2430_dmamask; in omap2430_probe()
424 musb->dev.coherent_dma_mask = omap2430_dmamask; in omap2430_probe()
427 glue->musb = musb; in omap2430_probe()
502 ret = platform_device_add_resources(musb, musb_resources, in omap2430_probe()
509 ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); in omap2430_probe()
517 ret = platform_device_add(musb); in omap2430_probe()
529 platform_device_put(musb); in omap2430_probe()
539 platform_device_unregister(glue->musb); in omap2430_remove()
550 struct musb *musb = glue_to_musb(glue); in omap2430_runtime_suspend() local
552 if (!musb) in omap2430_runtime_suspend()
555 musb->context.otg_interfsel = musb_readl(musb->mregs, in omap2430_runtime_suspend()
558 omap2430_low_level_exit(musb); in omap2430_runtime_suspend()
566 struct musb *musb = glue_to_musb(glue); in omap2430_runtime_resume() local
568 if (!musb) in omap2430_runtime_resume()
571 omap2430_low_level_init(musb); in omap2430_runtime_resume()
572 musb_writel(musb->mregs, OTG_INTERFSEL, in omap2430_runtime_resume()
573 musb->context.otg_interfsel); in omap2430_runtime_resume()