Lines Matching refs:musb
42 struct platform_device *musb; member
45 #define glue_to_musb(g) platform_get_drvdata(g->musb)
47 static void ux500_musb_set_vbus(struct musb *musb, int is_on) in ux500_musb_set_vbus() argument
56 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in ux500_musb_set_vbus()
59 if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) { in ux500_musb_set_vbus()
62 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in ux500_musb_set_vbus()
67 while (musb_readb(musb->mregs, MUSB_DEVCTL) & 0x80) { in ux500_musb_set_vbus()
70 dev_err(musb->controller, in ux500_musb_set_vbus()
77 musb->is_active = 1; in ux500_musb_set_vbus()
78 musb->xceiv->otg->default_a = 1; in ux500_musb_set_vbus()
79 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; in ux500_musb_set_vbus()
81 MUSB_HST_MODE(musb); in ux500_musb_set_vbus()
84 musb->is_active = 0; in ux500_musb_set_vbus()
89 musb->xceiv->otg->default_a = 0; in ux500_musb_set_vbus()
91 MUSB_DEV_MODE(musb); in ux500_musb_set_vbus()
93 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in ux500_musb_set_vbus()
104 dev_dbg(musb->controller, "VBUS %s, devctl %02x\n", in ux500_musb_set_vbus()
105 usb_otg_state_string(musb->xceiv->otg->state), in ux500_musb_set_vbus()
106 musb_readb(musb->mregs, MUSB_DEVCTL)); in ux500_musb_set_vbus()
112 struct musb *musb = container_of(nb, struct musb, nb); in musb_otg_notifications() local
114 dev_dbg(musb->controller, "musb_otg_notifications %ld %s\n", in musb_otg_notifications()
115 event, usb_otg_state_string(musb->xceiv->otg->state)); in musb_otg_notifications()
119 dev_dbg(musb->controller, "ID GND\n"); in musb_otg_notifications()
120 ux500_musb_set_vbus(musb, 1); in musb_otg_notifications()
123 dev_dbg(musb->controller, "VBUS Connect\n"); in musb_otg_notifications()
126 dev_dbg(musb->controller, "VBUS Disconnect\n"); in musb_otg_notifications()
127 if (is_host_active(musb)) in musb_otg_notifications()
128 ux500_musb_set_vbus(musb, 0); in musb_otg_notifications()
130 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in musb_otg_notifications()
133 dev_dbg(musb->controller, "ID float\n"); in musb_otg_notifications()
143 struct musb *musb = __hci; in ux500_musb_interrupt() local
145 spin_lock_irqsave(&musb->lock, flags); in ux500_musb_interrupt()
147 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); in ux500_musb_interrupt()
148 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); in ux500_musb_interrupt()
149 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); in ux500_musb_interrupt()
151 if (musb->int_usb || musb->int_tx || musb->int_rx) in ux500_musb_interrupt()
152 retval = musb_interrupt(musb); in ux500_musb_interrupt()
154 spin_unlock_irqrestore(&musb->lock, flags); in ux500_musb_interrupt()
159 static int ux500_musb_init(struct musb *musb) in ux500_musb_init() argument
163 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); in ux500_musb_init()
164 if (IS_ERR_OR_NULL(musb->xceiv)) { in ux500_musb_init()
169 musb->nb.notifier_call = musb_otg_notifications; in ux500_musb_init()
170 status = usb_register_notifier(musb->xceiv, &musb->nb); in ux500_musb_init()
172 dev_dbg(musb->controller, "notification register failed\n"); in ux500_musb_init()
176 musb->isr = ux500_musb_interrupt; in ux500_musb_init()
181 static int ux500_musb_exit(struct musb *musb) in ux500_musb_exit() argument
183 usb_unregister_notifier(musb->xceiv, &musb->nb); in ux500_musb_exit()
185 usb_put_phy(musb->xceiv); in ux500_musb_exit()
237 struct platform_device *musb; in ux500_probe() local
259 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); in ux500_probe()
260 if (!musb) { in ux500_probe()
278 musb->dev.parent = &pdev->dev; in ux500_probe()
279 musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; in ux500_probe()
280 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; in ux500_probe()
283 glue->musb = musb; in ux500_probe()
304 ret = platform_device_add_resources(musb, musb_resources, in ux500_probe()
311 ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); in ux500_probe()
317 ret = platform_device_add(musb); in ux500_probe()
329 platform_device_put(musb); in ux500_probe()
339 platform_device_unregister(glue->musb); in ux500_remove()
349 struct musb *musb = glue_to_musb(glue); in ux500_suspend() local
351 if (musb) in ux500_suspend()
352 usb_phy_set_suspend(musb->xceiv, 1); in ux500_suspend()
362 struct musb *musb = glue_to_musb(glue); in ux500_resume() local
371 if (musb) in ux500_resume()
372 usb_phy_set_suspend(musb->xceiv, 0); in ux500_resume()