Lines Matching defs:musb
24 #include <linux/usb/musb.h>
33 struct platform_device *musb;
41 #define glue_to_musb(g) platform_get_drvdata(g->musb)
45 static inline void omap2430_low_level_exit(struct musb *musb)
50 l = musb_readl(musb->mregs, OTG_FORCESTDBY);
52 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
55 static inline void omap2430_low_level_init(struct musb *musb)
59 l = musb_readl(musb->mregs, OTG_FORCESTDBY);
61 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
69 pr_err("%s: musb core is not yet initialized\n", __func__);
75 pr_err("%s: musb core is not yet ready\n", __func__);
93 struct musb *musb = glue_to_musb(glue);
96 pm_runtime_get_sync(musb->controller);
98 dev_dbg(musb->controller, "VBUS %s, devctl %02x\n",
99 usb_otg_state_string(musb->xceiv->otg->state),
100 musb_readb(musb->mregs, MUSB_DEVCTL));
104 dev_dbg(musb->controller, "ID GND\n");
105 switch (musb->xceiv->otg->state) {
107 error = musb_set_host(musb);
110 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
119 otg_set_vbus(musb->xceiv->otg, 1);
122 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
123 musb->xceiv->last_event = USB_EVENT_ID;
124 if (musb->gadget_driver) {
127 otg_set_vbus(musb->xceiv->otg, 1);
134 dev_dbg(musb->controller, "VBUS Connect\n");
136 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
137 musb->xceiv->last_event = USB_EVENT_VBUS;
143 dev_dbg(musb->controller, "VBUS Disconnect\n");
145 musb->xceiv->last_event = USB_EVENT_NONE;
146 musb_set_peripheral(musb);
147 otg_set_vbus(musb->xceiv->otg, 0);
152 dev_dbg(musb->controller, "ID float\n");
154 pm_runtime_mark_last_busy(musb->controller);
155 pm_runtime_put_autosuspend(musb->controller);
156 atomic_notifier_call_chain(&musb->xceiv->notifier,
157 musb->xceiv->last_event, NULL);
173 struct musb *musb = __hci;
175 spin_lock_irqsave(&musb->lock, flags);
177 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
178 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
179 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
181 if (musb->int_usb || musb->int_tx || musb->int_rx)
182 retval = musb_interrupt(musb);
184 spin_unlock_irqrestore(&musb->lock, flags);
189 static int omap2430_musb_init(struct musb *musb)
193 struct device *dev = musb->controller;
201 musb->phy = devm_phy_get(dev->parent, "usb2-phy");
203 /* We can't totally remove musb->xceiv as of now because
204 * musb core uses xceiv.state and xceiv.otg. Once we have
209 musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0);
211 if (IS_ERR(musb->xceiv)) {
212 status = PTR_ERR(musb->xceiv);
221 if (IS_ERR(musb->phy)) {
223 return PTR_ERR(musb->phy);
225 musb->isr = omap2430_musb_interrupt;
226 phy_init(musb->phy);
227 phy_power_on(musb->phy);
229 l = musb_readl(musb->mregs, OTG_INTERFSEL);
239 musb_writel(musb->mregs, OTG_INTERFSEL, l);
243 musb_readl(musb->mregs, OTG_REVISION),
244 musb_readl(musb->mregs, OTG_SYSCONFIG),
245 musb_readl(musb->mregs, OTG_SYSSTATUS),
246 musb_readl(musb->mregs, OTG_INTERFSEL),
247 musb_readl(musb->mregs, OTG_SIMENABLE));
252 static void omap2430_musb_enable(struct musb *musb)
254 struct device *dev = musb->controller;
262 static void omap2430_musb_disable(struct musb *musb)
264 struct device *dev = musb->controller;
272 static int omap2430_musb_exit(struct musb *musb)
274 struct device *dev = musb->controller;
277 omap2430_low_level_exit(musb);
278 phy_power_off(musb->phy);
279 phy_exit(musb->phy);
280 musb->phy = NULL;
307 struct platform_device *musb;
323 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
324 if (!musb)
327 musb->dev.parent = &pdev->dev;
328 musb->dev.dma_mask = &omap2430_dmamask;
329 musb->dev.coherent_dma_mask = omap2430_dmamask;
339 device_set_of_node_from_dev(&musb->dev, &pdev->dev);
344 glue->musb = musb;
398 ret = platform_device_add_resources(musb, pdev->resource, pdev->num_resources);
439 ret = platform_device_add_resources(musb, musb_res, i);
446 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
454 ret = platform_device_add(musb);
456 dev_err(&pdev->dev, "failed to register musb device\n");
468 platform_device_put(musb);
477 platform_device_unregister(glue->musb);
488 struct musb *musb = glue_to_musb(glue);
490 if (!musb)
493 musb->context.otg_interfsel = musb_readl(musb->mregs,
496 omap2430_low_level_exit(musb);
499 phy_power_off(musb->phy);
500 phy_exit(musb->phy);
511 struct musb *musb = glue_to_musb(glue);
513 if (!musb)
517 phy_init(musb->phy);
518 phy_power_on(musb->phy);
521 omap2430_low_level_init(musb);
522 musb_writel(musb->mregs, OTG_INTERFSEL,
523 musb->context.otg_interfsel);
525 /* Wait for musb to get oriented. Otherwise we can get babble */
537 struct musb *musb = glue_to_musb(glue);
539 phy_power_off(musb->phy);
540 phy_exit(musb->phy);
574 struct musb *musb = glue_to_musb(glue);
576 phy_init(musb->phy);
577 phy_power_on(musb->phy);
600 .compatible = "ti,omap4-musb"
603 .compatible = "ti,omap3-musb"
614 .name = "musb-omap2430",