From 0a48052022cd0baf2abdcd8f1b994f6c6c4bfb8c Mon Sep 17 00:00:00 2001 From: yangkai Date: Wed, 5 Sep 2012 18:16:52 +0800 Subject: [PATCH] usb clock update --- drivers/usb/dwc_otg/dwc_otg_pcd.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd.c b/drivers/usb/dwc_otg/dwc_otg_pcd.c index 31fae318a416..25dfd65c35e0 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd.c @@ -1778,7 +1778,7 @@ static void dwc_otg_pcd_check_vbus_timer( unsigned long data ) _pcd->vbus_status = 1; if(_pcd->conn_en) goto connect; - else{ + else if( pldata->phy_status == USB_PHY_ENABLED ){ // not connect, suspend phy pldata->phy_suspend(pldata, USB_PHY_SUSPEND); udelay(3); @@ -1797,9 +1797,11 @@ static void dwc_otg_pcd_check_vbus_timer( unsigned long data ) _pcd->vbus_status = 2; // not connect, suspend phy - pldata->phy_suspend(pldata, USB_PHY_SUSPEND); - udelay(3); - pldata->clock_enable( pldata, 0); + if( pldata->phy_status == USB_PHY_ENABLED ){ + pldata->phy_suspend(pldata, USB_PHY_SUSPEND); + udelay(3); + pldata->clock_enable( pldata, 0); + } } }else { _pcd->vbus_status = 0; @@ -1807,7 +1809,7 @@ static void dwc_otg_pcd_check_vbus_timer( unsigned long data ) _pcd->conn_status = 0; dwc_otg_msc_unlock(_pcd); } - else if( pldata->phy_status == 0 ){ + else if( pldata->phy_status == USB_PHY_ENABLED ){ /* no vbus detect here , close usb phy */ pldata->phy_suspend(pldata, USB_PHY_SUSPEND); udelay(3); @@ -1821,8 +1823,10 @@ static void dwc_otg_pcd_check_vbus_timer( unsigned long data ) connect: if(_pcd->conn_status==0) dwc_otg_msc_lock(_pcd); - pldata->clock_enable( pldata, 1); - pldata->phy_suspend(pldata, USB_PHY_ENABLED); + if( pldata->phy_status){ + pldata->clock_enable( pldata, 1); + pldata->phy_suspend(pldata, USB_PHY_ENABLED); + } schedule_delayed_work( &_pcd->reconnect , 8 ); /* delay 1 jiffies */ _pcd->check_vbus_timer.expires = jiffies + (HZ<<1); /* 1 s */ add_timer(&_pcd->check_vbus_timer); @@ -1968,7 +1972,7 @@ int dwc_otg_pcd_init(struct device *dev) pcd->vbus_status = 0; pcd->phy_suspend = 0; if(dwc_otg_is_device_mode(core_if)) - mod_timer(&pcd->check_vbus_timer, jiffies+(HZ<<2)); // delay 16 S + mod_timer(&pcd->check_vbus_timer, jiffies+(HZ<<4)); // delay 16 S return 0; } /** -- 2.34.1