Lines Matching full:otg

21 #include <linux/usb/otg.h>
28 #define DRIVER_DESC "Marvell USB OTG transceiver driver"
33 static const char driver_name[] = "mv-otg";
52 static int mv_otg_set_vbus(struct usb_otg *otg, bool on) in mv_otg_set_vbus() argument
54 struct mv_otg *mvotg = container_of(otg->usb_phy, struct mv_otg, phy); in mv_otg_set_vbus()
61 static int mv_otg_set_host(struct usb_otg *otg, in mv_otg_set_host() argument
64 otg->host = host; in mv_otg_set_host()
69 static int mv_otg_set_peripheral(struct usb_otg *otg, in mv_otg_set_peripheral() argument
72 otg->gadget = gadget; in mv_otg_set_peripheral()
194 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_host() local
197 if (!otg->host) in mv_otg_start_host()
202 hcd = bus_to_hcd(otg->host); in mv_otg_start_host()
215 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_periphrals() local
217 if (!otg->gadget) in mv_otg_start_periphrals()
223 usb_gadget_vbus_connect(otg->gadget); in mv_otg_start_periphrals()
225 usb_gadget_vbus_disconnect(otg->gadget); in mv_otg_start_periphrals()
245 dev_dbg(&mvotg->pdev->dev, "otg enabled\n"); in mv_otg_enable_internal()
274 dev_dbg(&mvotg->pdev->dev, "otg disabled\n"); in mv_otg_disable_internal()
330 int old_state = mvotg->phy.otg->state; in mv_otg_update_state()
334 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
338 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
340 mvotg->phy.otg->state = OTG_STATE_B_PERIPHERAL; in mv_otg_update_state()
344 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
348 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
351 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VRISE; in mv_otg_update_state()
355 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
362 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
367 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
371 mvotg->phy.otg->state = OTG_STATE_A_HOST; in mv_otg_update_state()
377 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
379 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
385 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
391 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
402 struct usb_otg *otg; in mv_otg_work() local
409 otg = mvotg->phy.otg; in mv_otg_work()
410 old_state = otg->state; in mv_otg_work()
418 if (old_state != mvotg->phy.otg->state) { in mv_otg_work()
421 state_string[mvotg->phy.otg->state]); in mv_otg_work()
423 switch (mvotg->phy.otg->state) { in mv_otg_work()
425 otg->default_a = 0; in mv_otg_work()
438 otg->default_a = 1; in mv_otg_work()
445 mv_otg_set_vbus(otg, 1); in mv_otg_work()
466 mv_otg_set_vbus(otg, 0); in mv_otg_work()
535 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE in a_bus_req_store()
536 && mvotg->phy.otg->state != OTG_STATE_A_IDLE) in a_bus_req_store()
565 if (!mvotg->phy.otg->default_a) in a_clr_err_store()
601 if (!mvotg->phy.otg->default_a) in a_bus_drop_store()
665 struct usb_otg *otg; in mv_otg_probe() local
678 otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); in mv_otg_probe()
679 if (!otg) in mv_otg_probe()
693 dev_dbg(&pdev->dev, "cannot create workqueue for OTG\n"); in mv_otg_probe()
699 /* OTG common part */ in mv_otg_probe()
702 mvotg->phy.otg = otg; in mv_otg_probe()
705 otg->state = OTG_STATE_UNDEFINED; in mv_otg_probe()
706 otg->usb_phy = &mvotg->phy; in mv_otg_probe()
707 otg->set_host = mv_otg_set_host; in mv_otg_probe()
708 otg->set_peripheral = mv_otg_set_peripheral; in mv_otg_probe()
709 otg->set_vbus = mv_otg_set_vbus; in mv_otg_probe()
748 dev_err(&pdev->dev, "mv otg enable error %d\n", retval); in mv_otg_probe()
797 dev_err(&pdev->dev, "Request irq %d for OTG failed\n", in mv_otg_probe()
818 "successful probe OTG device %s clock gating.\n", in mv_otg_probe()
836 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE) { in mv_otg_suspend()
838 "OTG state is not B_IDLE, it is %d!\n", in mv_otg_suspend()
839 mvotg->phy.otg->state); in mv_otg_suspend()