Lines Matching full:fsm

58 /* FSM timers */
117 void fsl_otg_chrg_vbus(struct otg_fsm *fsm, int on) in fsl_otg_chrg_vbus() argument
153 void fsl_otg_drv_vbus(struct otg_fsm *fsm, int on) in fsl_otg_drv_vbus() argument
171 void fsl_otg_loc_conn(struct otg_fsm *fsm, int on) in fsl_otg_loc_conn() argument
190 void fsl_otg_loc_sof(struct otg_fsm *fsm, int on) in fsl_otg_loc_sof() argument
205 void fsl_otg_start_pulse(struct otg_fsm *fsm) in fsl_otg_start_pulse() argument
218 fsl_otg_add_timer(fsm, b_data_pulse_tmr); in fsl_otg_start_pulse()
235 fsl_otg_chrg_vbus(&fsl_otg_dev->fsm, 1); in fsl_otg_pulse_vbus()
237 fsl_otg_add_timer(&fsl_otg_dev->fsm, b_vbus_pulse_tmr); in fsl_otg_pulse_vbus()
242 fsl_otg_chrg_vbus(&fsl_otg_dev->fsm, 0); in b_vbus_pulse_end()
250 fsl_otg_add_timer(&fsl_otg_dev->fsm, b_srp_wait_tmr); in b_vbus_pulse_end()
259 fsl_otg_dev->fsm.b_sess_vld) in b_srp_end()
260 fsl_otg_dev->fsm.b_srp_done = 1; in b_srp_end()
272 fsl_otg_add_timer(&fsl_otg_dev->fsm, a_wait_enum_tmr); in a_wait_enum()
274 otg_statemachine(&fsl_otg_dev->fsm); in a_wait_enum()
284 int fsl_otg_init_timers(struct otg_fsm *fsm) in fsl_otg_init_timers() argument
286 /* FSM used timers */ in fsl_otg_init_timers()
288 (unsigned long)&fsm->a_wait_vrise_tmout); in fsl_otg_init_timers()
293 (unsigned long)&fsm->a_wait_bcon_tmout); in fsl_otg_init_timers()
298 (unsigned long)&fsm->a_aidl_bdis_tmout); in fsl_otg_init_timers()
303 (unsigned long)&fsm->b_ase0_brst_tmout); in fsl_otg_init_timers()
308 (unsigned long)&fsm->b_se0_srp); in fsl_otg_init_timers()
313 (unsigned long)&fsm->b_srp_done); in fsl_otg_init_timers()
318 (unsigned long)&fsm); in fsl_otg_init_timers()
343 /* FSM used timers */ in fsl_otg_uninit_timers()
393 void fsl_otg_add_timer(struct otg_fsm *fsm, void *gtimer) in fsl_otg_add_timer() argument
411 static void fsl_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) in fsl_otg_fsm_add_timer() argument
419 fsl_otg_add_timer(fsm, timer); in fsl_otg_fsm_add_timer()
423 void fsl_otg_del_timer(struct otg_fsm *fsm, void *gtimer) in fsl_otg_del_timer() argument
433 static void fsl_otg_fsm_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) in fsl_otg_fsm_del_timer() argument
441 fsl_otg_del_timer(fsm, timer); in fsl_otg_fsm_del_timer()
457 int fsl_otg_start_host(struct otg_fsm *fsm, int on) in fsl_otg_start_host() argument
459 struct usb_otg *otg = fsm->otg; in fsl_otg_start_host()
473 fsm->a_vbus_vld = in fsl_otg_start_host()
484 if (fsm->id) { in fsl_otg_start_host()
486 fsl_otg_drv_vbus(fsm, 1); in fsl_otg_start_host()
509 if (fsm->id) in fsl_otg_start_host()
511 fsl_otg_drv_vbus(fsm, 0); in fsl_otg_start_host()
524 int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) in fsl_otg_start_gadget() argument
526 struct usb_otg *otg = fsm->otg; in fsl_otg_start_gadget()
563 otg_dev->fsm.a_bus_drop = 0; in fsl_otg_set_host()
564 otg_dev->fsm.a_bus_req = 1; in fsl_otg_set_host()
570 otg->host->is_b_host = otg_dev->fsm.id; in fsl_otg_set_host()
584 struct otg_fsm *fsm = &otg_dev->fsm; in fsl_otg_set_host() local
587 fsm->protocol = PROTO_UNDEF; in fsl_otg_set_host()
593 otg_statemachine(&otg_dev->fsm); in fsl_otg_set_host()
618 otg_dev->fsm.b_bus_req = 0; in fsl_otg_set_peripheral()
619 otg_statemachine(&otg_dev->fsm); in fsl_otg_set_peripheral()
624 otg->gadget->is_a_peripheral = !otg_dev->fsm.id; in fsl_otg_set_peripheral()
626 otg_dev->fsm.b_bus_req = 1; in fsl_otg_set_peripheral()
629 pr_debug("ID pin=%d\n", otg_dev->fsm.id); in fsl_otg_set_peripheral()
630 if (otg_dev->fsm.id == 1) { in fsl_otg_set_peripheral()
631 fsl_otg_start_host(&otg_dev->fsm, 0); in fsl_otg_set_peripheral()
632 otg_drv_vbus(&otg_dev->fsm, 0); in fsl_otg_set_peripheral()
633 fsl_otg_start_gadget(&otg_dev->fsm, 1); in fsl_otg_set_peripheral()
652 struct otg_fsm *fsm = &og->fsm; in fsl_otg_event() local
654 if (fsm->id) { /* switch to gadget */ in fsl_otg_event()
655 fsl_otg_start_host(fsm, 0); in fsl_otg_event()
656 otg_drv_vbus(fsm, 0); in fsl_otg_event()
657 fsl_otg_start_gadget(fsm, 1); in fsl_otg_event()
673 otg_dev->fsm.b_bus_req = 1; in fsl_otg_start_srp()
674 otg_statemachine(&otg_dev->fsm); in fsl_otg_start_srp()
694 otg_dev->fsm.a_bus_req = 0; in fsl_otg_start_hnp()
695 otg_statemachine(&otg_dev->fsm); in fsl_otg_start_hnp()
708 struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm; in fsl_otg_isr() local
719 fsm->id = (otg_sc & OTGSC_STS_USB_ID) ? 1 : 0; in fsl_otg_isr()
720 otg->default_a = (fsm->id == 0); in fsl_otg_isr()
725 fsm->id = (otg_sc & OTGSC_STS_USB_ID) ? 1 : 0; in fsl_otg_isr()
726 otg->default_a = (fsm->id == 0); in fsl_otg_isr()
728 if (fsm->id) in fsl_otg_isr()
729 fsm->b_conn = 0; in fsl_otg_isr()
731 fsm->a_conn = 0; in fsl_otg_isr()
734 otg->host->is_b_host = fsm->id; in fsl_otg_isr()
736 otg->gadget->is_a_peripheral = !fsm->id; in fsl_otg_isr()
737 VDBG("ID int (ID is %d)\n", fsm->id); in fsl_otg_isr()
739 if (fsm->id) { /* switch to gadget */ in fsl_otg_isr()
747 fsl_otg_start_gadget(fsm, 0); in fsl_otg_isr()
748 otg_drv_vbus(fsm, 1); in fsl_otg_isr()
749 fsl_otg_start_host(fsm, 1); in fsl_otg_isr()
794 status = fsl_otg_init_timers(&fsl_otg_tc->fsm); in fsl_otg_conf()
799 mutex_init(&fsl_otg_tc->fsm.lock); in fsl_otg_conf()
802 fsl_otg_tc->fsm.ops = &fsl_otg_ops; in fsl_otg_conf()
836 struct otg_fsm *fsm; in usb_otg_start() local
843 fsm = &p_otg->fsm; in usb_otg_start()
847 fsm->otg = p_otg->phy.otg; in usb_otg_start()
945 p_otg->fsm.id = 1; in usb_otg_start()
948 p_otg->fsm.id = 0; in usb_otg_start()
951 pr_debug("initial ID pin=%d\n", p_otg->fsm.id); in usb_otg_start()