From: yangkai Date: Sat, 2 Jun 2012 08:11:23 +0000 (+0800) Subject: fix one of mtp cancel bug X-Git-Tag: firefly_0821_release~9142^2~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=82534e37d4747fefea7b9c313bf0e163cf9df627;p=firefly-linux-kernel-4.4.55.git fix one of mtp cancel bug --- diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd.c b/drivers/usb/dwc_otg/dwc_otg_pcd.c index 22e9a3fb39cc..db676878088c 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd.c @@ -722,6 +722,9 @@ static int dwc_otg_pcd_ep_dequeue(struct usb_ep *_ep, dwc_otg_pcd_ep_t *ep; dwc_otg_pcd_t *pcd; unsigned long flags; + volatile depctl_data_t depctl = {.d32 = 0}; + + dwc_otg_dev_out_ep_regs_t *out_regs; DWC_DEBUGPL(DBG_PCDV,"%s(%p,%p)\n", __func__, _ep, _req); @@ -766,7 +769,14 @@ static int dwc_otg_pcd_ep_dequeue(struct usb_ep *_ep, { req = 0; } - + + // kevery@20120602 NAK out request before new queue request + if(!ep->dwc_ep.is_in){ + out_regs = GET_CORE_IF(pcd)->dev_if->out_ep_regs[ep->dwc_ep.num]; + depctl.d32 = dwc_read_reg32(&(out_regs->doepctl)); + depctl.b.snak = 1; + dwc_write_reg32( &(out_regs->doepctl), depctl.d32 ); + } SPIN_UNLOCK_IRQRESTORE(&pcd->lock, flags); return req ? 0 : -EOPNOTSUPP; @@ -1978,7 +1988,10 @@ void dwc_otg_pcd_start_vbus_timer( dwc_otg_pcd_t * _pcd ) int dwc_vbus_status( void ) { dwc_otg_pcd_t *pcd = s_pcd; - return pcd->vbus_status ; + if(!pcd) + return 0; + else + return pcd->vbus_status ; } EXPORT_SYMBOL(dwc_vbus_status);