diff options
| author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2016-01-07 15:51:13 -0800 | 
|---|---|---|
| committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2016-01-07 15:51:13 -0800 | 
| commit | abaee091a18c19ccd86feb1c8374585d82e96777 (patch) | |
| tree | 01602bae73e1278c3d98dafe1c269049927c58ce /drivers/usb/chipidea/udc.c | |
| parent | a2746fb16e41b7c8f02aa4d2605ecce97abbebbd (diff) | |
| parent | 3f8d6f2a0797e8c650a47e5c1b5c2601a46f4293 (diff) | |
Merge branch 'jejb-scsi' into misc
Diffstat (limited to 'drivers/usb/chipidea/udc.c')
| -rw-r--r-- | drivers/usb/chipidea/udc.c | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8223fe73ea85..391a1225b0ba 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1751,6 +1751,22 @@ static int ci_udc_start(struct usb_gadget *gadget,  	return retval;  } +static void ci_udc_stop_for_otg_fsm(struct ci_hdrc *ci) +{ +	if (!ci_otg_is_fsm_mode(ci)) +		return; + +	mutex_lock(&ci->fsm.lock); +	if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { +		ci->fsm.a_bidl_adis_tmout = 1; +		ci_hdrc_otg_fsm_start(ci); +	} else if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { +		ci->fsm.protocol = PROTO_UNDEF; +		ci->fsm.otg->state = OTG_STATE_UNDEFINED; +	} +	mutex_unlock(&ci->fsm.lock); +} +  /**   * ci_udc_stop: unregister a gadget driver   */ @@ -1775,6 +1791,7 @@ static int ci_udc_stop(struct usb_gadget *gadget)  	ci->driver = NULL;  	spin_unlock_irqrestore(&ci->lock, flags); +	ci_udc_stop_for_otg_fsm(ci);  	return 0;  }  | 
