From 13a148e19e2d56c6bd2d190a1e2aa943c1e5fd0f Mon Sep 17 00:00:00 2001
From: wlf <wulf@rock-chips.com>
Date: Wed, 12 Mar 2014 09:10:30 +0800
Subject: [PATCH] USB: add remote wakeup and detect by otg bvalid in defconfig

---
 drivers/usb/dwc_otg_310/Kconfig             | 10 ++++++++++
 drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc_otg_310/Kconfig b/drivers/usb/dwc_otg_310/Kconfig
index e885c8afd020..a0280d9ae0a3 100755
--- a/drivers/usb/dwc_otg_310/Kconfig
+++ b/drivers/usb/dwc_otg_310/Kconfig
@@ -29,3 +29,13 @@ config DWC_OTG
 	tristate
 	depends on DWC_OTG_310	
 	default y if USB11_HOST || USB20_HOST || USB20_OTG 
+
+config DWC_REMOTE_WAKEUP
+	bool "remote wakeup support in DWC_OTG controller"
+	depends on DWC_OTG_310
+	default y if USB20_HOST || USB20_OTG
+
+config RK_USB_DETECT_BY_OTG_BVALID
+	bool "Wakeup system by OTG BVALID interrupt when USB OTG conneted"
+	depends on USB_GADGET && ARCH_ROCKCHIP
+	default y if USB20_HOST || USB20_OTG
diff --git a/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c b/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c
index 7ec0781ec6a5..0ee449f4f6fd 100755
--- a/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c
+++ b/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c
@@ -749,7 +749,7 @@ static int dwc_otg_hcd_suspend(struct usb_hcd *hcd)
 		pcgcctl.b.stoppclk = 1;//stop phy clk
 		DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32);
 	}
-#if 0 //ndef CONFIG_DWC_REMOTE_WAKEUP
+#ifndef CONFIG_DWC_REMOTE_WAKEUP
 	else{ //no device connect
 		if(pldata->phy_suspend) 
 		pldata->phy_suspend(pldata, USB_PHY_SUSPEND);
@@ -784,7 +784,7 @@ static int dwc_otg_hcd_resume(struct usb_hcd *hcd)
 		return 0;
 //#endif
 
-#if 0 //ndef CONFIG_DWC_REMOTE_WAKEUP
+#ifndef CONFIG_DWC_REMOTE_WAKEUP
 	if (pldata->clock_enable) 
 		pldata->clock_enable( pldata, 1);
 #endif
@@ -843,7 +843,7 @@ static int dwc_otg_hcd_resume(struct usb_hcd *hcd)
     	
 		mdelay(10);
 	}
-#if 0 //ndef CONFIG_DWC_REMOTE_WAKEUP
+#ifndef CONFIG_DWC_REMOTE_WAKEUP
 	else{
 		if(pldata->phy_suspend) 
 		pldata->phy_suspend( pldata, USB_PHY_ENABLED);
-- 
2.34.1