If unload ci_hdrc driver while otg fsm is running as A-device, we should
firstly clean otg fsm and stop all otg fsm timers before destroy gadget
and host.
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit
95b62fe02aee5d2a83a9eb60816ee7cfc16708e8)
static inline void ci_role_destroy(struct ci_hdrc *ci)
{
- ci_hdrc_gadget_destroy(ci);
- ci_hdrc_host_destroy(ci);
if (ci->is_otg)
ci_hdrc_otg_destroy(ci);
+ ci_hdrc_gadget_destroy(ci);
+ ci_hdrc_host_destroy(ci);
}
static void ci_get_otg_capable(struct ci_hdrc *ci)
void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci)
{
+ enum otg_fsm_timer i;
+
+ for (i = 0; i < NUM_OTG_FSM_TIMERS; i++)
+ otg_del_timer(&ci->fsm, i);
+
+ ci->enabled_otg_timer_bits = 0;
+
/* Turn off vbus if vbus is on */
if (ci->fsm.a_vbus_vld)
otg_drv_vbus(&ci->fsm, 0);