rk2928: usb: fix rk2928/2926 usb phy non-driving err
authorlyz <lyz@rock-chips.com>
Mon, 17 Dec 2012 08:00:21 +0000 (16:00 +0800)
committerlyz <lyz@rock-chips.com>
Mon, 17 Dec 2012 08:00:21 +0000 (16:00 +0800)
arch/arm/mach-rk2928/common.c
drivers/usb/dwc_otg/usbdev_rk2928.c

index 7fd56af797259ab74d203c0a003d3c8b7e34cc56..2e33b601ef7cfe91c5781dcba0f3c87ca36c05fe 100755 (executable)
@@ -129,8 +129,16 @@ void __init rk2928_map_io(void)
        rk2928_map_common_io();
 #ifdef DEBUG_UART_BASE
         #ifdef CONFIG_RK_USB_UART
-        writel_relaxed(0x007f0051, RK2928_GRF_BASE + GRF_UOC0_CON5);
-        writel_relaxed(0x34003000, RK2928_GRF_BASE + GRF_UOC1_CON4);
+        if(!(readl_relaxed(RK2928_GRF_BASE + 0x014c) & (1<<7)))//detect vbus
+        {
+            writel_relaxed(0x10001000, RK2928_GRF_BASE + GRF_UOC0_CON0);
+            writel_relaxed(0x007f0055, RK2928_GRF_BASE + GRF_UOC0_CON5);
+            writel_relaxed(0x34003000, RK2928_GRF_BASE + GRF_UOC1_CON4);
+        }   
+        else
+           {
+            writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON4);
+           }
         #else
         writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON4);
         #endif
index 6f70546cb0a0ed4c94e413b2f20d5f9e97ea010b..452001c7cd1c70a88f114fc19a59c8ffe4abf0e0 100755 (executable)
@@ -114,11 +114,14 @@ void usb20otg_phy_suspend(void* pdata, int suspend)
 {\r
     struct dwc_otg_platform_data *usbpdata=pdata;\r
     unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC0_CON5);\r
+    unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC0_CON0);\r
     if(suspend){\r
+        *otg_phy_con2 = (1<<12 | 1<<(12+16));//otg io set to High-Z state\r
         *otg_phy_con1 = 0x55 |(0x7f<<16);   // enter suspend.\r
         usbpdata->phy_status = 1;\r
     }\r
     else{\r
+        *otg_phy_con2 = 1<<(12+16);\r
         *otg_phy_con1 = (0x01<<16);    // exit suspend.\r
         usbpdata->phy_status = 0;\r
     }\r
@@ -268,11 +271,14 @@ void usb20host_phy_suspend(void* pdata, int suspend)
 {\r
     struct dwc_otg_platform_data *usbpdata=pdata;\r
     unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON5);\r
+    unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC1_CON0);\r
     if(suspend){\r
+        *otg_phy_con2 = (1 << 12 | 1 << (12+16));//host io set to High-Z state\r
         *otg_phy_con1 = 0x1D5 |(0x1ff<<16);   // enter suspend.\r
         usbpdata->phy_status = 1;\r
     }\r
     else{\r
+        *otg_phy_con2 = (1 << 12+16);//host io exit High-Z state\r
         *otg_phy_con1 = (0x01<<16);    // exit suspend.\r
         usbpdata->phy_status = 0;\r
     }\r