Lines Matching refs:musb
23 #include <linux/usb/musb.h>
32 struct platform_device *musb;
37 #define glue_to_musb(g) platform_get_drvdata(g->musb)
41 static inline void omap2430_low_level_exit(struct musb *musb)
46 l = musb_readl(musb->mregs, OTG_FORCESTDBY);
48 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
51 static inline void omap2430_low_level_init(struct musb *musb)
55 l = musb_readl(musb->mregs, OTG_FORCESTDBY);
57 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
65 pr_err("%s: musb core is not yet initialized\n", __func__);
71 pr_err("%s: musb core is not yet ready\n", __func__);
89 struct musb *musb = glue_to_musb(glue);
92 pm_runtime_get_sync(musb->controller);
94 dev_dbg(musb->controller, "VBUS %s, devctl %02x\n",
95 usb_otg_state_string(musb->xceiv->otg->state),
96 musb_readb(musb->mregs, MUSB_DEVCTL));
100 dev_dbg(musb->controller, "ID GND\n");
101 switch (musb->xceiv->otg->state) {
103 error = musb_set_host(musb);
106 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
115 otg_set_vbus(musb->xceiv->otg, 1);
118 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
119 musb->xceiv->last_event = USB_EVENT_ID;
120 if (musb->gadget_driver) {
123 otg_set_vbus(musb->xceiv->otg, 1);
130 dev_dbg(musb->controller, "VBUS Connect\n");
132 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
133 musb->xceiv->last_event = USB_EVENT_VBUS;
139 dev_dbg(musb->controller, "VBUS Disconnect\n");
141 musb->xceiv->last_event = USB_EVENT_NONE;
142 musb_set_peripheral(musb);
143 otg_set_vbus(musb->xceiv->otg, 0);
148 dev_dbg(musb->controller, "ID float\n");
150 pm_runtime_mark_last_busy(musb->controller);
151 pm_runtime_put_autosuspend(musb->controller);
152 atomic_notifier_call_chain(&musb->xceiv->notifier,
153 musb->xceiv->last_event, NULL);
169 struct musb *musb = __hci;
171 spin_lock_irqsave(&musb->lock, flags);
173 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
174 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
175 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
177 if (musb->int_usb || musb->int_tx || musb->int_rx)
178 retval = musb_interrupt(musb);
180 spin_unlock_irqrestore(&musb->lock, flags);
185 static int omap2430_musb_init(struct musb *musb)
189 struct device *dev = musb->controller;
197 musb->phy = devm_phy_get(dev->parent, "usb2-phy");
199 /* We can't totally remove musb->xceiv as of now because
200 * musb core uses xceiv.state and xceiv.otg. Once we have
205 musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0);
207 if (IS_ERR(musb->xceiv)) {
208 status = PTR_ERR(musb->xceiv);
217 if (IS_ERR(musb->phy)) {
219 return PTR_ERR(musb->phy);
221 musb->isr = omap2430_musb_interrupt;
222 phy_init(musb->phy);
223 phy_power_on(musb->phy);
225 l = musb_readl(musb->mregs, OTG_INTERFSEL);
235 musb_writel(musb->mregs, OTG_INTERFSEL, l);
239 musb_readl(musb->mregs, OTG_REVISION),
240 musb_readl(musb->mregs, OTG_SYSCONFIG),
241 musb_readl(musb->mregs, OTG_SYSSTATUS),
242 musb_readl(musb->mregs, OTG_INTERFSEL),
243 musb_readl(musb->mregs, OTG_SIMENABLE));
248 static void omap2430_musb_enable(struct musb *musb)
250 struct device *dev = musb->controller;
258 static void omap2430_musb_disable(struct musb *musb)
260 struct device *dev = musb->controller;
268 static int omap2430_musb_exit(struct musb *musb)
270 struct device *dev = musb->controller;
273 omap2430_low_level_exit(musb);
274 phy_power_off(musb->phy);
275 phy_exit(musb->phy);
276 musb->phy = NULL;
304 struct platform_device *musb;
319 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
320 if (!musb) {
321 dev_err(&pdev->dev, "failed to allocate musb device\n");
325 musb->dev.parent = &pdev->dev;
326 musb->dev.dma_mask = &omap2430_dmamask;
327 musb->dev.coherent_dma_mask = omap2430_dmamask;
330 glue->musb = musb;
402 ret = platform_device_add_resources(musb, musb_resources,
409 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
417 ret = platform_device_add(musb);
419 dev_err(&pdev->dev, "failed to register musb device\n");
429 platform_device_put(musb);
439 platform_device_unregister(glue->musb);
450 struct musb *musb = glue_to_musb(glue);
452 if (!musb)
455 musb->context.otg_interfsel = musb_readl(musb->mregs,
458 omap2430_low_level_exit(musb);
460 phy_power_off(musb->phy);
461 phy_exit(musb->phy);
469 struct musb *musb = glue_to_musb(glue);
471 if (!musb)
474 phy_init(musb->phy);
475 phy_power_on(musb->phy);
477 omap2430_low_level_init(musb);
478 musb_writel(musb->mregs, OTG_INTERFSEL,
479 musb->context.otg_interfsel);
481 /* Wait for musb to get oriented. Otherwise we can get babble */
500 .compatible = "ti,omap4-musb"
503 .compatible = "ti,omap3-musb"
514 .name = "musb-omap2430",