Lines Matching refs:musb
79 struct platform_device *musb; member
83 #define glue_to_musb(g) platform_get_drvdata(g->musb)
89 static void am35x_musb_enable(struct musb *musb) in am35x_musb_enable() argument
91 static int am35x_musb_enable(struct musb *musb) in am35x_musb_enable()
94 void __iomem *reg_base = musb->ctrl_base; in am35x_musb_enable()
98 epmask = ((musb->epmask & AM35X_TX_EP_MASK) << AM35X_INTR_TX_SHIFT) | in am35x_musb_enable()
99 ((musb->epmask & AM35X_RX_EP_MASK) << AM35X_INTR_RX_SHIFT); in am35x_musb_enable()
105 if (is_otg_enabled(musb)) in am35x_musb_enable()
116 static void am35x_musb_disable(struct musb *musb) in am35x_musb_disable() argument
118 void __iomem *reg_base = musb->ctrl_base; in am35x_musb_disable()
123 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); in am35x_musb_disable()
130 static void am35x_musb_set_vbus(struct musb *musb, int is_on) in am35x_musb_set_vbus() argument
132 WARN_ON(is_on && is_peripheral_active(musb)); in am35x_musb_set_vbus()
141 struct musb *musb = (void *)_musb; in otg_timer() local
142 void __iomem *mregs = musb->mregs; in otg_timer()
151 dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, in otg_timer()
152 otg_state_string(musb->xceiv->state)); in otg_timer()
154 spin_lock_irqsave(&musb->lock, flags); in otg_timer()
155 switch (musb->xceiv->state) { in otg_timer()
158 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); in otg_timer()
160 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); in otg_timer()
162 musb->xceiv->state = OTG_STATE_B_IDLE; in otg_timer()
163 MUSB_DEV_MODE(musb); in otg_timer()
165 musb->xceiv->state = OTG_STATE_A_IDLE; in otg_timer()
166 MUSB_HST_MODE(musb); in otg_timer()
170 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; in otg_timer()
171 musb_writel(musb->ctrl_base, CORE_INTR_SRC_SET_REG, in otg_timer()
175 if (!is_peripheral_enabled(musb)) in otg_timer()
182 musb->xceiv->state = OTG_STATE_A_IDLE; in otg_timer()
187 spin_unlock_irqrestore(&musb->lock, flags); in otg_timer()
190 static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout) in am35x_musb_try_idle() argument
194 if (!is_otg_enabled(musb)) in am35x_musb_try_idle()
201 if (musb->is_active || (musb->a_wait_bcon == 0 && in am35x_musb_try_idle()
202 musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { in am35x_musb_try_idle()
203 dev_dbg(musb->controller, "%s active, deleting timer\n", in am35x_musb_try_idle()
204 otg_state_string(musb->xceiv->state)); in am35x_musb_try_idle()
211 dev_dbg(musb->controller, "Longer idle timer already pending, ignoring...\n"); in am35x_musb_try_idle()
216 dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", in am35x_musb_try_idle()
217 otg_state_string(musb->xceiv->state), in am35x_musb_try_idle()
225 struct musb *musb = hci; in am35x_musb_interrupt() local
226 void __iomem *reg_base = musb->ctrl_base; in am35x_musb_interrupt()
228 struct device *dev = musb->controller; in am35x_musb_interrupt()
231 struct usb_otg *otg = musb->xceiv->otg; in am35x_musb_interrupt()
234 (struct omap_musb_board_data *)musb->controller; in am35x_musb_interrupt()
248 spin_lock_irqsave(&musb->lock, flags); in am35x_musb_interrupt()
256 musb->int_rx = in am35x_musb_interrupt()
258 musb->int_tx = in am35x_musb_interrupt()
270 musb->int_usb = in am35x_musb_interrupt()
284 void __iomem *mregs = musb->mregs; in am35x_musb_interrupt()
288 err = is_host_enabled(musb) && (musb->int_usb & in am35x_musb_interrupt()
302 musb->int_usb &= ~MUSB_INTR_VBUSERROR; in am35x_musb_interrupt()
303 musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; in am35x_musb_interrupt()
306 } else if (is_host_enabled(musb) && drvvbus) { in am35x_musb_interrupt()
307 MUSB_HST_MODE(musb); in am35x_musb_interrupt()
309 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; in am35x_musb_interrupt()
310 portstate(musb->port1_status |= USB_PORT_STAT_POWER); in am35x_musb_interrupt()
313 musb->is_active = 0; in am35x_musb_interrupt()
314 MUSB_DEV_MODE(musb); in am35x_musb_interrupt()
316 musb->xceiv->state = OTG_STATE_B_IDLE; in am35x_musb_interrupt()
317 portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); in am35x_musb_interrupt()
321 dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", in am35x_musb_interrupt()
323 otg_state_string(musb->xceiv->state), in am35x_musb_interrupt()
330 if (musb->int_tx || musb->int_rx || musb->int_usb) in am35x_musb_interrupt()
331 ret |= musb_interrupt(musb); in am35x_musb_interrupt()
345 if (is_otg_enabled(musb) && musb->xceiv->state == OTG_STATE_B_IDLE) in am35x_musb_interrupt()
349 spin_unlock_irqrestore(&musb->lock, flags); in am35x_musb_interrupt()
355 static int am35x_musb_set_mode(struct musb *musb, u8 musb_mode) in am35x_musb_set_mode() argument
357 struct device *dev = musb->controller; in am35x_musb_set_mode()
371 static int am35x_musb_init(struct musb *musb) in am35x_musb_init() argument
374 struct device *dev = musb->controller; in am35x_musb_init()
379 (struct omap_musb_board_data *)musb->controller; in am35x_musb_init()
381 void __iomem *reg_base = musb->ctrl_base; in am35x_musb_init()
384 musb->mregs += USB_MENTOR_CORE_OFFSET; in am35x_musb_init()
393 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); in am35x_musb_init()
394 if (IS_ERR_OR_NULL(musb->xceiv)) in am35x_musb_init()
397 if (is_host_enabled(musb)) in am35x_musb_init()
398 setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); in am35x_musb_init()
414 musb->isr = am35x_musb_interrupt; in am35x_musb_init()
423 static int am35x_musb_exit(struct musb *musb) in am35x_musb_exit() argument
426 struct device *dev = musb->controller; in am35x_musb_exit()
431 (struct omap_musb_board_data *)musb->controller; in am35x_musb_exit()
435 if (is_host_enabled(musb)) in am35x_musb_exit()
444 usb_put_phy(musb->xceiv); in am35x_musb_exit()
506 struct platform_device *musb; in am35x_probe() local
520 musb = platform_device_alloc("musb-hdrc", -1); in am35x_probe()
521 if (!musb) { in am35x_probe()
552 musb->dev.parent = &pdev->dev; in am35x_probe()
553 musb->dev.dma_mask = &am35x_dmamask; in am35x_probe()
554 musb->dev.coherent_dma_mask = am35x_dmamask; in am35x_probe()
557 glue->musb = musb; in am35x_probe()
565 ret = platform_device_add_resources(musb, pdev->resource, in am35x_probe()
572 ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); in am35x_probe()
578 ret = platform_device_add(musb); in am35x_probe()
599 platform_device_put(musb); in am35x_probe()
612 platform_device_del(glue->musb); in am35x_remove()
613 platform_device_put(glue->musb); in am35x_remove()