fix pcd connect and disconnect bug

This commit is contained in:
yangkai 2012-07-23 17:39:01 +08:00
parent dd61046541
commit 1110b79123
4 changed files with 12 additions and 9 deletions

View File

@ -1498,6 +1498,9 @@ static __devinit int dwc_otg_driver_probe(struct platform_device *pdev)
dwc_otg_device->core_if->usb_mode = USB_MODE_FORCE_HOST;
#else
dwc_otg_device->core_if->usb_mode = USB_MODE_NORMAL;
#ifdef CONFIG_DWC_OTG_DEFAULT_DEVICE
dwc_otg_device->core_if->usb_mode = USB_MODE_FORCE_DEVICE;
#endif
#endif
#endif
@ -2044,16 +2047,17 @@ static __devinit int host20_driver_probe(struct platform_device *pdev)
*/
#ifdef CONFIG_ARCH_RK29
unsigned int * otg_phy_con1 = (unsigned int*)(USB_GRF_CON);
#endif
#ifdef CONFIG_ARCH_RK30
unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON2);
#endif
otgreg = * otg_phy_con1;
otgreg |= (0x01<<13); // software control
otgreg |= (0x01<<14); // exit suspend.
otgreg &= ~(0x01<<13); // software control
*otg_phy_con1 = otgreg;
#endif
#ifdef CONFIG_ARCH_RK30
unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON2);
*otg_phy_con1 = ((0x01<<2)<<16); // exit suspend.
#endif
#if 0
*otg_phy_con1 |= (0x01<<2);
*otg_phy_con1 |= (0x01<<3); // exit suspend.

View File

@ -1267,6 +1267,7 @@ int __devinit host20_hcd_init(struct device *dev)
}
#ifdef CONFIG_ARCH_RK30
dwc_otg_hcd->host_setenable = 1;
dwc_otg_hcd->connect_detect_timer.function = dwc_otg_hcd_connect_detect;
dwc_otg_hcd->connect_detect_timer.data = (unsigned long)(dwc_otg_hcd);
init_timer( &dwc_otg_hcd->connect_detect_timer);

View File

@ -1845,7 +1845,7 @@ static void dwc_otg_pcd_check_vbus_timer( unsigned long pdata )
dwc_otg_msc_unlock(_pcd);
}
/* every 500 ms open usb phy power and start 1 jiffies timer to get vbus */
if( _pcd->phy_suspend == 0 )
else if( _pcd->phy_suspend == 0 )
/* no vbus detect here , close usb phy */
dwc_otg20phy_suspend( 0 );
}

View File

@ -1053,10 +1053,8 @@ static inline void do_gadget_setup( dwc_otg_pcd_t *_pcd,
{
SPIN_UNLOCK(&_pcd->lock);
ret = _pcd->driver->setup(&_pcd->gadget, _ctrl);
if(spin_is_locked(&_pcd->lock)){
if(spin_is_locked(&_pcd->lock))
DWC_PRINT("%s warning: pcd->lock locked without unlock\n", __func__);
SPIN_UNLOCK(&_pcd->lock);
}
SPIN_LOCK(&_pcd->lock);
if (ret < 0)
{