clk_disable(ahbclk);
#endif
#endif
-//need to be checked @wlf
#ifdef CONFIG_ARCH_RK2928
#ifndef CONFIG_USB20_HOST
otg_phy_con = (unsigned int*)(USBGRF_UOC1_CON5);
dwc_otg_device->phyclk = phyclk;
dwc_otg_device->ahbclk = ahbclk;
#endif
-//need to be checked @wlf
-#if 0//def CONFIG_ARCH_RK2928
+#ifdef CONFIG_ARCH_RK2928
otg_phy_con = (unsigned int*)(USBGRF_UOC0_CON5);
cru_set_soft_reset(SOFT_RST_USBPHY0, true);
cru_set_soft_reset(SOFT_RST_OTGC0, true);
ahbclk = clk_get(NULL, "hclk_otg1");
#endif
#ifdef CONFIG_ARCH_RK2928
- ahbclk = clk_get(NULL, "hclk_otg1"); //need to be checked @wlf
+ ahbclk = clk_get(NULL, "hclk_otg1");
#endif
if (IS_ERR(ahbclk)) {
retval = PTR_ERR(ahbclk);
DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
}
#endif
-#if 0//def CONFIG_ARCH_RK2928
+#ifdef CONFIG_ARCH_RK2928
unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC0_CON5);
- if(exitsuspend && (pcd->phy_suspend == 1)) {
- clk_enable(pcd->otg_dev->ahbclk);
- clk_enable(pcd->otg_dev->phyclk);
- pcd->phy_suspend = 0;
+ if(suspend) {
*otg_phy_con1 = (0x01<<16); // exit suspend.
DWC_DEBUGPL(DBG_PCDV, "enable usb phy\n");
}
- if( !exitsuspend && (pcd->phy_suspend == 0)) {
- pcd->phy_suspend = 1;
- *otg_phy_con1 = 0x55 |(0x7f<<16); // enter suspend.
+ else{
+ *otg_phy_con1 = 0x1D5 |(0x1ff<<16); // enter suspend. enable dm,dp Pull-Down Resistor wlf @2012.8.10
udelay(3);
- clk_disable(pcd->otg_dev->phyclk);
- clk_disable(pcd->otg_dev->ahbclk);
DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
}
#endif
}
if(dwc_otg_hcd->host_setenable != dwc_otg_hcd->host_enabled){
#ifdef CONFIG_ARCH_RK30
- DWC_PRINT("%s schedule delaywork 0x%x, 0x%x\n", __func__, dwc_read_reg32(core_if->host_if->hprt0), usbgrf_status& (7<<22));
+ DWC_PRINT("%s schedule delaywork, hprt 0x%08x, grfstatus 0x%08x\n", __func__, dwc_read_reg32(core_if->host_if->hprt0), usbgrf_status& (7<<22));
#else //CONFIG_ARCH_RK2928
- DWC_PRINT("%s schedule delaywork \n", __func__, dwc_read_reg32(core_if->host_if->hprt0), usbgrf_status& (7<<12));
+ DWC_PRINT("%s schedule delaywork, hprt 0x%08x, grfstatus 0x%08x\n", __func__, dwc_read_reg32(core_if->host_if->hprt0), usbgrf_status& (7<<12));
#endif
schedule_delayed_work(&dwc_otg_hcd->host_enable_work, 8);
}
DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
}
#endif
-#if 0//def CONFIG_ARCH_RK2928
- unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC0_CON5);
- if(exitsuspend && (pcd->phy_suspend == 1)) {
- clk_enable(pcd->otg_dev->ahbclk);
- clk_enable(pcd->otg_dev->phyclk);
- pcd->phy_suspend = 0;
+#ifdef CONFIG_ARCH_RK2928
+ unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON5);
+ if(suspend) {
*otg_phy_con1 = (0x01<<16); // exit suspend.
DWC_DEBUGPL(DBG_PCDV, "enable usb phy\n");
}
- if( !exitsuspend && (pcd->phy_suspend == 0)) {
- pcd->phy_suspend = 1;
- *otg_phy_con1 = 0x55 |(0x7f<<16); // enter suspend.
+ else{
+ *otg_phy_con1 = 0x1D5 |(0x1ff<<16); // enter suspend. enable dm,dp Pull-Down Resistor wlf @2012.8.10
udelay(3);
- clk_disable(pcd->otg_dev->phyclk);
- clk_disable(pcd->otg_dev->ahbclk);
DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
}
#endif
}
if( !exitsuspend && (pcd->phy_suspend == 0)) {
pcd->phy_suspend = 1;
- *otg_phy_con1 = 0x55 |(0x7f<<16); // enter suspend.
- // *otg_phy_con1 = 0x1D5 |(0x1ff<<16); // enter suspend. enable dm,dp debug_wlf @2012.8.10
+ *otg_phy_con1 = 0x1D5 |(0x1ff<<16); // enter suspend. enable dm,dp Pull-Down Resistor wlf @2012.8.10
udelay(3);
- clk_disable(pcd->otg_dev->phyclk);
+// otg/host20 use the same phyclk, so can't disable phyclk in case host20 is used. wlf @2012.8.16
+// clk_disable(pcd->otg_dev->phyclk);
clk_disable(pcd->otg_dev->ahbclk);
DWC_DEBUGPL(DBG_PCDV, "disable usb phy\n");
}
/* if usb not connect before ,then start connect */
if( _pcd->vbus_status == 0 ) {
DWC_PRINT("********vbus detect*********************************************\n");
- dwc_otg_msc_lock(_pcd);
_pcd->vbus_status = 1;
if(_pcd->conn_en)
goto connect;
_pcd->conn_status++;
if((dwc_read_reg32((uint32_t*)((uint8_t *)_pcd->otg_dev->base + DWC_OTG_HOST_PORT_REGS_OFFSET))&0xc00) == 0xc00)
_pcd->vbus_status = 2;
+ dwc_otg20phy_suspend(0);
}
}else {
_pcd->vbus_status = 0;
- if(_pcd->conn_status)
- {
+ if(_pcd->conn_status){
_pcd->conn_status = 0;
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 );
}
return;
connect:
+ if(_pcd->conn_status==0)
+ dwc_otg_msc_lock(_pcd);
if( _pcd->phy_suspend == 1 )
dwc_otg20phy_suspend( 1 );
schedule_delayed_work( &_pcd->reconnect , 8 ); /* delay 1 jiffies */