Lines Matching refs:musb
105 struct platform_device *musb; /* child musb pdev */ member
137 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_mod_timer() local
145 mod_timer(&musb->dev_timer, jiffies + wait); in dsps_mod_timer()
169 static void dsps_musb_enable(struct musb *musb) in dsps_musb_enable() argument
171 struct device *dev = musb->controller; in dsps_musb_enable()
174 void __iomem *reg_base = musb->ctrl_base; in dsps_musb_enable()
178 epmask = ((musb->epmask & wrp->txep_mask) << wrp->txep_shift) | in dsps_musb_enable()
179 ((musb->epmask & wrp->rxep_mask) << wrp->rxep_shift); in dsps_musb_enable()
188 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) in dsps_musb_enable()
195 static void dsps_musb_disable(struct musb *musb) in dsps_musb_disable() argument
197 struct device *dev = musb->controller; in dsps_musb_disable()
200 void __iomem *reg_base = musb->ctrl_base; in dsps_musb_disable()
205 del_timer_sync(&musb->dev_timer); in dsps_musb_disable()
209 static int dsps_check_status(struct musb *musb, void *unused) in dsps_check_status() argument
211 void __iomem *mregs = musb->mregs; in dsps_check_status()
212 struct device *dev = musb->controller; in dsps_check_status()
219 del_timer(&musb->dev_timer); in dsps_check_status()
226 dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, in dsps_check_status()
227 usb_otg_state_string(musb->xceiv->otg->state)); in dsps_check_status()
229 switch (musb->xceiv->otg->state) { in dsps_check_status()
231 if (musb->port_mode == MUSB_HOST) { in dsps_check_status()
232 musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; in dsps_check_status()
240 if (musb->port_mode == MUSB_HOST) { in dsps_check_status()
244 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); in dsps_check_status()
252 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in dsps_check_status()
253 MUSB_DEV_MODE(musb); in dsps_check_status()
255 musb->xceiv->otg->state = OTG_STATE_A_IDLE; in dsps_check_status()
256 MUSB_HST_MODE(musb); in dsps_check_status()
259 if (musb->port_mode == MUSB_PERIPHERAL) in dsps_check_status()
269 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; in dsps_check_status()
270 musb_writel(musb->ctrl_base, wrp->coreintr_set, in dsps_check_status()
282 struct musb *musb = from_timer(musb, t, dev_timer); in otg_timer() local
283 struct device *dev = musb->controller; in otg_timer()
295 spin_lock_irqsave(&musb->lock, flags); in otg_timer()
296 err = musb_queue_resume_work(musb, dsps_check_status, NULL); in otg_timer()
299 spin_unlock_irqrestore(&musb->lock, flags); in otg_timer()
304 static void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum) in dsps_musb_clear_ep_rxintr() argument
307 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); in dsps_musb_clear_ep_rxintr()
312 musb_writel(musb->ctrl_base, wrp->epintr_status, epintr); in dsps_musb_clear_ep_rxintr()
317 struct musb *musb = hci; in dsps_interrupt() local
318 void __iomem *reg_base = musb->ctrl_base; in dsps_interrupt()
319 struct device *dev = musb->controller; in dsps_interrupt()
326 spin_lock_irqsave(&musb->lock, flags); in dsps_interrupt()
330 musb->int_rx = (epintr & wrp->rxep_bitmap) >> wrp->rxep_shift; in dsps_interrupt()
331 musb->int_tx = (epintr & wrp->txep_bitmap) >> wrp->txep_shift; in dsps_interrupt()
341 musb->int_usb = (usbintr & wrp->usb_bitmap) >> wrp->usb_shift; in dsps_interrupt()
345 dev_dbg(musb->controller, "usbintr (%x) epintr(%x)\n", in dsps_interrupt()
350 void __iomem *mregs = musb->mregs; in dsps_interrupt()
354 err = musb->int_usb & MUSB_INTR_VBUSERROR; in dsps_interrupt()
367 musb->int_usb &= ~MUSB_INTR_VBUSERROR; in dsps_interrupt()
368 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; in dsps_interrupt()
372 MUSB_HST_MODE(musb); in dsps_interrupt()
373 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; in dsps_interrupt()
376 musb->is_active = 0; in dsps_interrupt()
377 MUSB_DEV_MODE(musb); in dsps_interrupt()
378 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in dsps_interrupt()
382 dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", in dsps_interrupt()
384 usb_otg_state_string(musb->xceiv->otg->state), in dsps_interrupt()
390 if (musb->int_tx || musb->int_rx || musb->int_usb) in dsps_interrupt()
391 ret |= musb_interrupt(musb); in dsps_interrupt()
394 switch (musb->xceiv->otg->state) { in dsps_interrupt()
404 spin_unlock_irqrestore(&musb->lock, flags); in dsps_interrupt()
409 static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue) in dsps_musb_dbg_init() argument
414 sprintf(buf, "%s.dsps", dev_name(musb->controller)); in dsps_musb_dbg_init()
420 glue->regset.base = musb->ctrl_base; in dsps_musb_dbg_init()
426 static int dsps_musb_init(struct musb *musb) in dsps_musb_init() argument
428 struct device *dev = musb->controller; in dsps_musb_init()
441 musb->ctrl_base = reg_base; in dsps_musb_init()
444 musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, "phys", 0); in dsps_musb_init()
445 if (IS_ERR(musb->xceiv)) in dsps_musb_init()
446 return PTR_ERR(musb->xceiv); in dsps_musb_init()
448 musb->phy = devm_phy_get(dev->parent, "usb2-phy"); in dsps_musb_init()
455 if (IS_ERR(musb->phy)) { in dsps_musb_init()
456 musb->phy = NULL; in dsps_musb_init()
458 ret = phy_init(musb->phy); in dsps_musb_init()
461 ret = phy_power_on(musb->phy); in dsps_musb_init()
463 phy_exit(musb->phy); in dsps_musb_init()
468 timer_setup(&musb->dev_timer, otg_timer, 0); in dsps_musb_init()
473 musb->isr = dsps_interrupt; in dsps_musb_init()
478 musb_writel(musb->ctrl_base, wrp->phy_utmi, val); in dsps_musb_init()
486 val = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_musb_init()
490 musb_writeb(musb->mregs, MUSB_BABBLE_CTL, val); in dsps_musb_init()
495 return dsps_musb_dbg_init(musb, glue); in dsps_musb_init()
498 static int dsps_musb_exit(struct musb *musb) in dsps_musb_exit() argument
500 struct device *dev = musb->controller; in dsps_musb_exit()
503 del_timer_sync(&musb->dev_timer); in dsps_musb_exit()
504 phy_power_off(musb->phy); in dsps_musb_exit()
505 phy_exit(musb->phy); in dsps_musb_exit()
511 static int dsps_musb_set_mode(struct musb *musb, u8 mode) in dsps_musb_set_mode() argument
513 struct device *dev = musb->controller; in dsps_musb_set_mode()
516 void __iomem *ctrl_base = musb->ctrl_base; in dsps_musb_set_mode()
558 static bool dsps_sw_babble_control(struct musb *musb) in dsps_sw_babble_control() argument
563 babble_ctl = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_sw_babble_control()
564 dev_dbg(musb->controller, "babble: MUSB_BABBLE_CTL value %x\n", in dsps_sw_babble_control()
570 dev_dbg(musb->controller, "STUCK_J is %s\n", in dsps_sw_babble_control()
580 babble_ctl = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_sw_babble_control()
582 musb_writeb(musb->mregs, MUSB_BABBLE_CTL, babble_ctl); in dsps_sw_babble_control()
585 dev_dbg(musb->controller, "Set TXIDLE, wait J to clear\n"); in dsps_sw_babble_control()
587 babble_ctl = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_sw_babble_control()
598 dev_dbg(musb->controller, "J not cleared, misc (%x)\n", in dsps_sw_babble_control()
609 static int dsps_musb_recover(struct musb *musb) in dsps_musb_recover() argument
611 struct device *dev = musb->controller; in dsps_musb_recover()
616 session_restart = dsps_sw_babble_control(musb); in dsps_musb_recover()
644 struct musb *musb = c->musb; in dsps_dma_controller_callback() local
645 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); in dsps_dma_controller_callback()
655 dsps_dma_controller_create(struct musb *musb, void __iomem *base) in dsps_dma_controller_create() argument
658 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); in dsps_dma_controller_create()
661 controller = cppi41_dma_controller_create(musb, base); in dsps_dma_controller_create()
731 struct platform_device *musb; in dsps_create_musb_pdev() local
753 musb = platform_device_alloc("musb-hdrc", in dsps_create_musb_pdev()
755 if (!musb) { in dsps_create_musb_pdev()
760 musb->dev.parent = dev; in dsps_create_musb_pdev()
761 musb->dev.dma_mask = &musb_dmamask; in dsps_create_musb_pdev()
762 musb->dev.coherent_dma_mask = musb_dmamask; in dsps_create_musb_pdev()
763 device_set_of_node_from_dev(&musb->dev, &parent->dev); in dsps_create_musb_pdev()
765 glue->musb = musb; in dsps_create_musb_pdev()
767 ret = platform_device_add_resources(musb, resources, in dsps_create_musb_pdev()
806 ret = platform_device_add_data(musb, &pdata, sizeof(pdata)); in dsps_create_musb_pdev()
812 ret = platform_device_add(musb); in dsps_create_musb_pdev()
820 platform_device_put(musb); in dsps_create_musb_pdev()
827 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_vbus_threaded_irq() local
829 if (!musb) in dsps_vbus_threaded_irq()
911 platform_device_unregister(glue->musb); in dsps_probe()
922 platform_device_unregister(glue->musb); in dsps_remove()
975 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_suspend() local
979 if (!musb) in dsps_suspend()
989 del_timer_sync(&musb->dev_timer); in dsps_suspend()
991 mbase = musb->ctrl_base; in dsps_suspend()
1009 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_resume() local
1012 if (!musb) in dsps_resume()
1017 mbase = musb->ctrl_base; in dsps_resume()
1025 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && in dsps_resume()
1026 musb->port_mode == MUSB_OTG) in dsps_resume()