request gpio for drv_usb when usb20host_hw_init
authorlyz <lyz@rock-chips.com>
Tue, 18 Sep 2012 08:38:24 +0000 (16:38 +0800)
committerlyz <lyz@rock-chips.com>
Tue, 18 Sep 2012 08:38:24 +0000 (16:38 +0800)
drivers/usb/dwc_otg/usbdev_rk30.c

index ffb2bb4333d1ef593ae3315b5396f58694721c0b..9ac10d7e0e61bf7372031ce31a2f8bf78b54f35e 100755 (executable)
@@ -115,8 +115,11 @@ void usb20otg_hw_init(void)
     \r
         // other haredware init\r
 #ifdef CONFIG_ARCH_RK3066B\r
-    //GPIO init\r
+        //GPIO init\r
         rk30_mux_api_set(GPIO0D6_SPI1CLK_NAME, GPIO0D_GPIO0D6);\r
+        \r
+        gpio_request(RK3066B_OTG_DRV_VBUS, NULL);\r
+        gpio_direction_output(RK3066B_OTG_DRV_VBUS, GPIO_LOW);\r
 #else\r
         rk30_mux_api_set(GPIO0A5_OTGDRVVBUS_NAME, GPIO0A_OTG_DRV_VBUS);\r
 #endif\r
@@ -226,26 +229,14 @@ int usb20otg_get_status(int id)
 #ifdef CONFIG_ARCH_RK3066B\r
 void usb20otg_power_enable(int enable)\r
 { \r
-    int ret;\r
     unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0);\r
     if(0 == enable)//disable\r
     {\r
-        ret = gpio_request(RK3066B_OTG_DRV_VBUS, NULL);\r
-        if (ret != 0) \r
-        {\r
-            gpio_free(RK3066B_OTG_DRV_VBUS);\r
-        }\r
-        gpio_direction_output(RK3066B_OTG_DRV_VBUS, GPIO_HIGH);\r
         gpio_set_value(RK3066B_OTG_DRV_VBUS, GPIO_LOW); \r
 \r
     }\r
     if(1 == enable)//enable\r
     {\r
-        ret = gpio_request(RK3066B_OTG_DRV_VBUS, NULL);\r
-        if (ret != 0) {\r
-            gpio_free(RK3066B_OTG_DRV_VBUS);\r
-        }\r
-        gpio_direction_output(RK3066B_OTG_DRV_VBUS, GPIO_HIGH);\r
         gpio_set_value(RK3066B_OTG_DRV_VBUS, GPIO_HIGH); \r
     }   \r
 }\r
@@ -297,6 +288,8 @@ void usb20host_hw_init(void)
     // other haredware init\r
 #ifdef CONFIG_ARCH_RK3066B\r
     rk30_mux_api_set(GPIO0D7_SPI1CSN0_NAME, GPIO0D_GPIO0D7); \r
+    gpio_request(RK3066B_HOST_DRV_VBUS, NULL);\r
+    gpio_direction_output(RK3066B_HOST_DRV_VBUS, GPIO_HIGH);\r
 #else\r
     rk30_mux_api_set(GPIO0A6_HOSTDRVVBUS_NAME, GPIO0A_HOST_DRV_VBUS);\r
 #endif\r
@@ -409,7 +402,7 @@ int usb20host_get_status(int id)
 #ifdef CONFIG_ARCH_RK3066B\r
 void usb20host_power_enable(int enable)\r
 { \r
-    int ret;\r
+\r
     if(0 == enable)//disable\r
     {\r
         //ret = gpio_request(RK3066B_HOST_DRV_VBUS, NULL);\r
@@ -423,11 +416,6 @@ void usb20host_power_enable(int enable)
 \r
     if(1 == enable)//enable\r
     {\r
-        ret = gpio_request(RK3066B_HOST_DRV_VBUS, NULL);\r
-        if (ret != 0) {\r
-            gpio_free(RK3066B_HOST_DRV_VBUS);\r
-        }\r
-        gpio_direction_output(RK3066B_HOST_DRV_VBUS, GPIO_HIGH);\r
         gpio_set_value(RK3066B_HOST_DRV_VBUS, GPIO_HIGH);\r
         //printk("!!!!!!!!!!!!!!!!!!!!!enable host power!!!!!!!!!!!!!!!!!!\n");\r
     }   \r