Lines Matching refs:musb
16 #include <linux/usb/musb-ux500.h>
29 struct platform_device *musb;
32 #define glue_to_musb(g) platform_get_drvdata(g->musb)
34 static void ux500_musb_set_vbus(struct musb *musb, int is_on)
43 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
46 if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) {
49 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
51 * Wait for the musb to set as A device to enable the
54 while (musb_readb(musb->mregs, MUSB_DEVCTL) & 0x80) {
57 dev_err(musb->controller,
64 musb->is_active = 1;
65 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
67 MUSB_HST_MODE(musb);
70 musb->is_active = 0;
76 MUSB_DEV_MODE(musb);
78 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
89 dev_dbg(musb->controller, "VBUS %s, devctl %02x\n",
90 usb_otg_state_string(musb->xceiv->otg->state),
91 musb_readb(musb->mregs, MUSB_DEVCTL));
97 struct musb *musb = container_of(nb, struct musb, nb);
99 dev_dbg(musb->controller, "musb_otg_notifications %ld %s\n",
100 event, usb_otg_state_string(musb->xceiv->otg->state));
104 dev_dbg(musb->controller, "ID GND\n");
105 ux500_musb_set_vbus(musb, 1);
108 dev_dbg(musb->controller, "VBUS Connect\n");
111 dev_dbg(musb->controller, "VBUS Disconnect\n");
112 if (is_host_active(musb))
113 ux500_musb_set_vbus(musb, 0);
115 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
118 dev_dbg(musb->controller, "ID float\n");
128 struct musb *musb = __hci;
130 spin_lock_irqsave(&musb->lock, flags);
132 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
133 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
134 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
136 if (musb->int_usb || musb->int_tx || musb->int_rx)
137 retval = musb_interrupt(musb);
139 spin_unlock_irqrestore(&musb->lock, flags);
144 static int ux500_musb_init(struct musb *musb)
148 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
149 if (IS_ERR_OR_NULL(musb->xceiv)) {
154 musb->nb.notifier_call = musb_otg_notifications;
155 status = usb_register_notifier(musb->xceiv, &musb->nb);
157 dev_dbg(musb->controller, "notification register failed\n");
161 musb->isr = ux500_musb_interrupt;
166 static int ux500_musb_exit(struct musb *musb)
168 usb_unregister_notifier(musb->xceiv, &musb->nb);
170 usb_put_phy(musb->xceiv);
222 struct platform_device *musb;
244 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
245 if (!musb) {
246 dev_err(&pdev->dev, "failed to allocate musb device\n");
263 musb->dev.parent = &pdev->dev;
264 musb->dev.dma_mask = &pdev->dev.coherent_dma_mask;
265 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
268 glue->musb = musb;
289 ret = platform_device_add_resources(musb, musb_resources,
296 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
302 ret = platform_device_add(musb);
304 dev_err(&pdev->dev, "failed to register musb device\n");
314 platform_device_put(musb);
324 platform_device_unregister(glue->musb);
334 struct musb *musb = glue_to_musb(glue);
336 if (musb)
337 usb_phy_set_suspend(musb->xceiv, 1);
347 struct musb *musb = glue_to_musb(glue);
356 if (musb)
357 usb_phy_set_suspend(musb->xceiv, 0);
366 { .compatible = "stericsson,db8500-musb", },
376 .name = "musb-ux500",