Lines Matching full:otg

44 #define DRIVER_DESC "Freescale USB OTG Transceiver Driver"
47 static const char driver_name[] = "fsl-usb2-otg";
115 /* Operations that will be called from OTG Finite State Machine */
259 if ((fsl_otg_dev->phy.otg->state == OTG_STATE_B_SRP_INIT) && in b_srp_end()
272 if (!fsl_otg_dev->phy.otg->host->b_hnp_enable) in a_wait_enum()
460 struct usb_otg *otg = fsm->otg; in fsl_otg_start_host() local
463 container_of(otg->usb_phy, struct fsl_otg, phy); in fsl_otg_start_host()
466 if (!otg->host) in fsl_otg_start_host()
468 dev = otg->host->controller; in fsl_otg_start_host()
527 struct usb_otg *otg = fsm->otg; in fsl_otg_start_gadget() local
530 if (!otg->gadget || !otg->gadget->dev.parent) in fsl_otg_start_gadget()
534 dev = otg->gadget->dev.parent; in fsl_otg_start_gadget()
549 * to the OTG. Suspend host for OTG role detection.
551 static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) in fsl_otg_set_host() argument
555 if (!otg) in fsl_otg_set_host()
558 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); in fsl_otg_set_host()
562 otg->host = host; in fsl_otg_set_host()
570 otg->host->otg_port = fsl_otg_initdata.otg_port; in fsl_otg_set_host()
571 otg->host->is_b_host = otg_dev->fsm.id; in fsl_otg_set_host()
587 otg->state = OTG_STATE_UNDEFINED; in fsl_otg_set_host()
599 /* Called by initialization code of udc. Register udc to OTG. */
600 static int fsl_otg_set_peripheral(struct usb_otg *otg, in fsl_otg_set_peripheral() argument
605 if (!otg) in fsl_otg_set_peripheral()
608 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); in fsl_otg_set_peripheral()
615 if (!otg->default_a) in fsl_otg_set_peripheral()
616 otg->gadget->ops->vbus_draw(otg->gadget, 0); in fsl_otg_set_peripheral()
617 usb_gadget_vbus_disconnect(otg->gadget); in fsl_otg_set_peripheral()
618 otg->gadget = 0; in fsl_otg_set_peripheral()
624 otg->gadget = gadget; in fsl_otg_set_peripheral()
625 otg->gadget->is_a_peripheral = !otg_dev->fsm.id; in fsl_otg_set_peripheral()
663 static int fsl_otg_start_srp(struct usb_otg *otg) in fsl_otg_start_srp() argument
667 if (!otg || otg->state != OTG_STATE_B_IDLE) in fsl_otg_start_srp()
670 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); in fsl_otg_start_srp()
681 static int fsl_otg_start_hnp(struct usb_otg *otg) in fsl_otg_start_hnp() argument
685 if (!otg) in fsl_otg_start_hnp()
688 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); in fsl_otg_start_hnp()
702 * Interrupt handler. OTG/host/peripheral share the same int line.
703 * OTG driver clears OTGSC interrupts and leaves USB interrupts
710 struct usb_otg *otg = ((struct fsl_otg *)dev_id)->phy.otg; in fsl_otg_isr() local
716 /* Only clear otg interrupts */ in fsl_otg_isr()
721 otg->default_a = (fsm->id == 0); in fsl_otg_isr()
723 /* process OTG interrupts */ in fsl_otg_isr()
727 otg->default_a = (fsm->id == 0); in fsl_otg_isr()
734 if (otg->host) in fsl_otg_isr()
735 otg->host->is_b_host = fsm->id; in fsl_otg_isr()
736 if (otg->gadget) in fsl_otg_isr()
737 otg->gadget->is_a_peripheral = !fsm->id; in fsl_otg_isr()
772 /* Initialize the global variable fsl_otg_dev and request IRQ for OTG */
781 /* allocate space to fsl otg device */ in fsl_otg_conf()
786 fsl_otg_tc->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); in fsl_otg_conf()
787 if (!fsl_otg_tc->phy.otg) { in fsl_otg_conf()
797 pr_info("Couldn't init OTG timers\n"); in fsl_otg_conf()
802 /* Set OTG state machine operations */ in fsl_otg_conf()
805 /* initialize the otg structure */ in fsl_otg_conf()
809 fsl_otg_tc->phy.otg->usb_phy = &fsl_otg_tc->phy; in fsl_otg_conf()
810 fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host; in fsl_otg_conf()
811 fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral; in fsl_otg_conf()
812 fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp; in fsl_otg_conf()
813 fsl_otg_tc->phy.otg->start_srp = fsl_otg_start_srp; in fsl_otg_conf()
817 /* Store the otg transceiver */ in fsl_otg_conf()
820 pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n"); in fsl_otg_conf()
827 kfree(fsl_otg_tc->phy.otg); in fsl_otg_conf()
832 /* OTG Initialization */
848 fsm->otg = p_otg->phy.otg; in usb_otg_start()
885 kfree(p_otg->phy.otg); in usb_otg_start()
945 p_otg->phy.otg->state = OTG_STATE_UNDEFINED; in usb_otg_start()
948 p_otg->phy.otg->state = OTG_STATE_A_IDLE; in usb_otg_start()
954 /* enable OTG ID pin interrupt */ in usb_otg_start()
970 /* configure the OTG */ in fsl_otg_probe()
973 dev_err(&pdev->dev, "Couldn't configure OTG module\n"); in fsl_otg_probe()
977 /* start OTG */ in fsl_otg_probe()
980 dev_err(&pdev->dev, "Can't init FSL OTG device\n"); in fsl_otg_probe()
997 kfree(fsl_otg_dev->phy.otg); in fsl_otg_remove()