Lines Matching refs:musb

103 	struct platform_device *musb;	/* child musb pdev */  member
135 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_mod_timer() local
143 mod_timer(&musb->dev_timer, jiffies + wait); in dsps_mod_timer()
167 static void dsps_musb_enable(struct musb *musb) in dsps_musb_enable() argument
169 struct device *dev = musb->controller; in dsps_musb_enable()
172 void __iomem *reg_base = musb->ctrl_base; in dsps_musb_enable()
176 epmask = ((musb->epmask & wrp->txep_mask) << wrp->txep_shift) | in dsps_musb_enable()
177 ((musb->epmask & wrp->rxep_mask) << wrp->rxep_shift); in dsps_musb_enable()
186 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) in dsps_musb_enable()
193 static void dsps_musb_disable(struct musb *musb) in dsps_musb_disable() argument
195 struct device *dev = musb->controller; in dsps_musb_disable()
198 void __iomem *reg_base = musb->ctrl_base; in dsps_musb_disable()
203 del_timer_sync(&musb->dev_timer); in dsps_musb_disable()
207 static int dsps_check_status(struct musb *musb, void *unused) in dsps_check_status() argument
209 void __iomem *mregs = musb->mregs; in dsps_check_status()
210 struct device *dev = musb->controller; in dsps_check_status()
217 del_timer(&musb->dev_timer); in dsps_check_status()
224 dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, in dsps_check_status()
225 usb_otg_state_string(musb->xceiv->otg->state)); in dsps_check_status()
227 switch (musb->xceiv->otg->state) { in dsps_check_status()
229 if (musb->port_mode == MUSB_HOST) { in dsps_check_status()
230 musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; in dsps_check_status()
238 if (musb->port_mode == MUSB_HOST) { in dsps_check_status()
242 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); in dsps_check_status()
250 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in dsps_check_status()
251 MUSB_DEV_MODE(musb); in dsps_check_status()
253 musb->xceiv->otg->state = OTG_STATE_A_IDLE; in dsps_check_status()
254 MUSB_HST_MODE(musb); in dsps_check_status()
257 if (musb->port_mode == MUSB_PERIPHERAL) in dsps_check_status()
267 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; in dsps_check_status()
268 musb_writel(musb->ctrl_base, wrp->coreintr_set, in dsps_check_status()
280 struct musb *musb = from_timer(musb, t, dev_timer); in otg_timer() local
281 struct device *dev = musb->controller; in otg_timer()
293 spin_lock_irqsave(&musb->lock, flags); in otg_timer()
294 err = musb_queue_resume_work(musb, dsps_check_status, NULL); in otg_timer()
297 spin_unlock_irqrestore(&musb->lock, flags); in otg_timer()
302 static void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum) in dsps_musb_clear_ep_rxintr() argument
305 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); in dsps_musb_clear_ep_rxintr()
310 musb_writel(musb->ctrl_base, wrp->epintr_status, epintr); in dsps_musb_clear_ep_rxintr()
315 struct musb *musb = hci; in dsps_interrupt() local
316 void __iomem *reg_base = musb->ctrl_base; in dsps_interrupt()
317 struct device *dev = musb->controller; in dsps_interrupt()
324 spin_lock_irqsave(&musb->lock, flags); in dsps_interrupt()
328 musb->int_rx = (epintr & wrp->rxep_bitmap) >> wrp->rxep_shift; in dsps_interrupt()
329 musb->int_tx = (epintr & wrp->txep_bitmap) >> wrp->txep_shift; in dsps_interrupt()
339 musb->int_usb = (usbintr & wrp->usb_bitmap) >> wrp->usb_shift; in dsps_interrupt()
343 dev_dbg(musb->controller, "usbintr (%x) epintr(%x)\n", in dsps_interrupt()
348 void __iomem *mregs = musb->mregs; in dsps_interrupt()
352 err = musb->int_usb & MUSB_INTR_VBUSERROR; in dsps_interrupt()
365 musb->int_usb &= ~MUSB_INTR_VBUSERROR; in dsps_interrupt()
366 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; in dsps_interrupt()
370 MUSB_HST_MODE(musb); in dsps_interrupt()
371 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; in dsps_interrupt()
374 musb->is_active = 0; in dsps_interrupt()
375 MUSB_DEV_MODE(musb); in dsps_interrupt()
376 musb->xceiv->otg->state = OTG_STATE_B_IDLE; in dsps_interrupt()
380 dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", in dsps_interrupt()
382 usb_otg_state_string(musb->xceiv->otg->state), in dsps_interrupt()
388 if (musb->int_tx || musb->int_rx || musb->int_usb) in dsps_interrupt()
389 ret |= musb_interrupt(musb); in dsps_interrupt()
392 switch (musb->xceiv->otg->state) { in dsps_interrupt()
402 spin_unlock_irqrestore(&musb->lock, flags); in dsps_interrupt()
407 static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue) in dsps_musb_dbg_init() argument
412 sprintf(buf, "%s.dsps", dev_name(musb->controller)); in dsps_musb_dbg_init()
418 glue->regset.base = musb->ctrl_base; in dsps_musb_dbg_init()
424 static int dsps_musb_init(struct musb *musb) in dsps_musb_init() argument
426 struct device *dev = musb->controller; in dsps_musb_init()
439 musb->ctrl_base = reg_base; in dsps_musb_init()
442 musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, "phys", 0); in dsps_musb_init()
443 if (IS_ERR(musb->xceiv)) in dsps_musb_init()
444 return PTR_ERR(musb->xceiv); in dsps_musb_init()
446 musb->phy = devm_phy_get(dev->parent, "usb2-phy"); in dsps_musb_init()
453 if (IS_ERR(musb->phy)) { in dsps_musb_init()
454 musb->phy = NULL; in dsps_musb_init()
456 ret = phy_init(musb->phy); in dsps_musb_init()
459 ret = phy_power_on(musb->phy); in dsps_musb_init()
461 phy_exit(musb->phy); in dsps_musb_init()
466 timer_setup(&musb->dev_timer, otg_timer, 0); in dsps_musb_init()
471 musb->isr = dsps_interrupt; in dsps_musb_init()
476 musb_writel(musb->ctrl_base, wrp->phy_utmi, val); in dsps_musb_init()
484 val = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_musb_init()
488 musb_writeb(musb->mregs, MUSB_BABBLE_CTL, val); in dsps_musb_init()
493 return dsps_musb_dbg_init(musb, glue); in dsps_musb_init()
496 static int dsps_musb_exit(struct musb *musb) in dsps_musb_exit() argument
498 struct device *dev = musb->controller; in dsps_musb_exit()
501 del_timer_sync(&musb->dev_timer); in dsps_musb_exit()
502 phy_power_off(musb->phy); in dsps_musb_exit()
503 phy_exit(musb->phy); in dsps_musb_exit()
509 static int dsps_musb_set_mode(struct musb *musb, u8 mode) in dsps_musb_set_mode() argument
511 struct device *dev = musb->controller; in dsps_musb_set_mode()
514 void __iomem *ctrl_base = musb->ctrl_base; in dsps_musb_set_mode()
556 static bool dsps_sw_babble_control(struct musb *musb) in dsps_sw_babble_control() argument
561 babble_ctl = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_sw_babble_control()
562 dev_dbg(musb->controller, "babble: MUSB_BABBLE_CTL value %x\n", in dsps_sw_babble_control()
568 dev_dbg(musb->controller, "STUCK_J is %s\n", in dsps_sw_babble_control()
578 babble_ctl = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_sw_babble_control()
580 musb_writeb(musb->mregs, MUSB_BABBLE_CTL, babble_ctl); in dsps_sw_babble_control()
583 dev_dbg(musb->controller, "Set TXIDLE, wait J to clear\n"); in dsps_sw_babble_control()
585 babble_ctl = musb_readb(musb->mregs, MUSB_BABBLE_CTL); in dsps_sw_babble_control()
596 dev_dbg(musb->controller, "J not cleared, misc (%x)\n", in dsps_sw_babble_control()
607 static int dsps_musb_recover(struct musb *musb) in dsps_musb_recover() argument
609 struct device *dev = musb->controller; in dsps_musb_recover()
614 session_restart = dsps_sw_babble_control(musb); in dsps_musb_recover()
642 struct musb *musb = c->musb; in dsps_dma_controller_callback() local
643 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); in dsps_dma_controller_callback()
653 dsps_dma_controller_create(struct musb *musb, void __iomem *base) in dsps_dma_controller_create() argument
656 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); in dsps_dma_controller_create()
659 controller = cppi41_dma_controller_create(musb, base); in dsps_dma_controller_create()
729 struct platform_device *musb; in dsps_create_musb_pdev() local
751 musb = platform_device_alloc("musb-hdrc", in dsps_create_musb_pdev()
753 if (!musb) { in dsps_create_musb_pdev()
758 musb->dev.parent = dev; in dsps_create_musb_pdev()
759 musb->dev.dma_mask = &musb_dmamask; in dsps_create_musb_pdev()
760 musb->dev.coherent_dma_mask = musb_dmamask; in dsps_create_musb_pdev()
761 device_set_of_node_from_dev(&musb->dev, &parent->dev); in dsps_create_musb_pdev()
763 glue->musb = musb; in dsps_create_musb_pdev()
765 ret = platform_device_add_resources(musb, resources, in dsps_create_musb_pdev()
804 ret = platform_device_add_data(musb, &pdata, sizeof(pdata)); in dsps_create_musb_pdev()
810 ret = platform_device_add(musb); in dsps_create_musb_pdev()
818 platform_device_put(musb); in dsps_create_musb_pdev()
825 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_vbus_threaded_irq() local
827 if (!musb) in dsps_vbus_threaded_irq()
909 platform_device_unregister(glue->musb); in dsps_probe()
920 platform_device_unregister(glue->musb); in dsps_remove()
971 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_suspend() local
975 if (!musb) in dsps_suspend()
985 del_timer_sync(&musb->dev_timer); in dsps_suspend()
987 mbase = musb->ctrl_base; in dsps_suspend()
1005 struct musb *musb = platform_get_drvdata(glue->musb); in dsps_resume() local
1008 if (!musb) in dsps_resume()
1013 mbase = musb->ctrl_base; in dsps_resume()
1021 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && in dsps_resume()
1022 musb->port_mode == MUSB_OTG) in dsps_resume()