USB: support rk3168/rk3188 usb host
authorwlf <wulf@rock-chips.com>
Thu, 17 Jan 2013 08:10:07 +0000 (16:10 +0800)
committerwlf <wulf@rock-chips.com>
Thu, 17 Jan 2013 08:10:07 +0000 (16:10 +0800)
drivers/usb/dwc_otg/dwc_otg_cil.c
drivers/usb/dwc_otg/dwc_otg_hcd_queue.c
drivers/usb/dwc_otg/usbdev_rk30.c

index c61117fa15c95c062c0efcb507b8ddb89af1876c..5ea7ffa02a27d66929671fc3e0622367ca07c643 100755 (executable)
@@ -723,7 +723,7 @@ void dwc_otg_core_dev_init(dwc_otg_core_if_t *_core_if)
     dwc_write_reg32( &global_regs->dptxfsiz_dieptxf[1], 0x00100320 );  //ep3 tx fifo
     dwc_write_reg32( &global_regs->dptxfsiz_dieptxf[2], 0x00800330 );  //ep5 tx fifo
 #endif
-#ifdef CONFIG_ARCH_RK30
+#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)
        /* Configure data FIFO sizes, RK30 otg has 0x3cc dwords total */
     dwc_write_reg32( &global_regs->grxfsiz, 0x00000120 );
     dwc_write_reg32( &global_regs->gnptxfsiz, 0x00100120 );                            //ep0 tx fifo
index ae18b36a0ea966124c7c054be6c00c67d646c97f..a0b9357626584c2d4af78a6a60524ea78ab42ee9 100755 (executable)
@@ -247,7 +247,7 @@ static int periodic_channel_available(dwc_otg_hcd_t *_hcd)
         * non-periodic transactions.
         */
        int status;
-#ifdef CONFIG_ARCH_RK30
+#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)
        int num_channels;
 
        num_channels = _hcd->core_if->core_params->host_channels;
index 5cb03b98d2e7a981155fb438bdb3514db5d29f11..02aeecc5ef209cf3cafd77edfd3959b934f5e42b 100755 (executable)
 #include "usbdev_rk.h"\r
 #include "dwc_otg_regs.h" \r
 \r
-#ifdef CONFIG_ARCH_RK30\r
+#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)\r
 \r
 #define GRF_REG_BASE   RK30_GRF_BASE   \r
 #define USBOTG_SIZE    RK30_USBOTG20_SIZE\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
 #define USBGRF_SOC_STATUS0     (GRF_REG_BASE+0xac)\r
 #define USBGRF_UOC0_CON2       (GRF_REG_BASE+0x114)\r
 #define USBGRF_UOC0_CON3       (GRF_REG_BASE+0x118)\r
 #define USBGRF_UOC1_CON2       (GRF_REG_BASE+0x124)\r
 #define USBGRF_UOC1_CON3       (GRF_REG_BASE+0x128)\r
 \r
+#if defined(CONFIG_SOC_RK3066B) || defined(CONFIG_SOC_RK3108) \r
 #define RK3066B_HOST_DRV_VBUS RK30_PIN0_PD7\r
 #define RK3066B_OTG_DRV_VBUS  RK30_PIN0_PD6\r
+#elif defined(CONFIG_SOC_RK3168) || defined(CONFIG_ARCH_RK3188) \r
+#define RK3066B_HOST_DRV_VBUS RK30_PIN0_PC0\r
+#define RK3066B_OTG_DRV_VBUS  RK30_PIN3_PD5\r
+#endif\r
 \r
 #else\r
 #define USBGRF_SOC_STATUS0     (GRF_REG_BASE+0x15c)\r
@@ -101,7 +106,7 @@ void usb20otg_hw_init(void)
 {\r
 #ifndef CONFIG_USB20_HOST\r
         // close USB 2.0 HOST phy and clock\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
         unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON2);\r
         unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC1_CON3);\r
         *otg_phy_con1 =  (0x01<<2)|((0x01<<2)<<16);     //enable soft control\r
@@ -114,7 +119,7 @@ void usb20otg_hw_init(void)
         // usb phy config init\r
     \r
         // other haredware init\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
         //GPIO init\r
         gpio_request(RK3066B_OTG_DRV_VBUS, NULL);\r
         gpio_direction_output(RK3066B_OTG_DRV_VBUS, GPIO_LOW);\r
@@ -125,7 +130,7 @@ void usb20otg_hw_init(void)
 \r
 void usb20otg_phy_suspend(void* pdata, int suspend)\r
 {\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
         struct dwc_otg_platform_data *usbpdata=pdata;\r
         unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC0_CON2);\r
         unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC0_CON3);\r
@@ -191,7 +196,7 @@ int usb20otg_get_status(int id)
         unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0);\r
         switch(id)\r
         {\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
             case USB_STATUS_BVABLID:\r
                 // bvalid in grf\r
                 ret = (usbgrf_status &(1<<10));\r
@@ -224,7 +229,7 @@ int usb20otg_get_status(int id)
         return ret;\r
 }\r
  \r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
 void usb20otg_power_enable(int enable)\r
 { \r
     unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0);\r
@@ -250,7 +255,7 @@ struct dwc_otg_platform_data usb20otg_pdata = {
     .clock_init=usb20otg_clock_init,\r
     .clock_enable=usb20otg_clock_enable,\r
     .get_status=usb20otg_get_status,\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
     .power_enable=usb20otg_power_enable,\r
 #endif    \r
 };\r
@@ -284,7 +289,7 @@ void usb20host_hw_init(void)
     // usb phy config init\r
 \r
     // other haredware init\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
     gpio_request(RK3066B_HOST_DRV_VBUS, NULL);\r
     gpio_direction_output(RK3066B_HOST_DRV_VBUS, GPIO_HIGH);\r
 #else\r
@@ -293,7 +298,7 @@ void usb20host_hw_init(void)
 }\r
 void usb20host_phy_suspend(void* pdata, int suspend)\r
 { \r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
         struct dwc_otg_platform_data *usbpdata=pdata;\r
         unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON2);\r
         unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC1_CON3);\r
@@ -363,7 +368,7 @@ int usb20host_get_status(int id)
     unsigned int usbgrf_status = *(unsigned int*)(USBGRF_SOC_STATUS0);\r
     switch(id)\r
     {\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
         case USB_STATUS_BVABLID:\r
             // bvalid in grf\r
             ret = (usbgrf_status &(1<<17));\r
@@ -396,7 +401,7 @@ int usb20host_get_status(int id)
     return ret;\r
 }\r
 \r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
 void usb20host_power_enable(int enable)\r
 { \r
 \r
@@ -429,7 +434,7 @@ struct dwc_otg_platform_data usb20host_pdata = {
     .clock_init=usb20host_clock_init,\r
     .clock_enable=usb20host_clock_enable,\r
     .get_status=usb20host_get_status,\r
-#ifdef CONFIG_ARCH_RK3066B\r
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)\r
     .power_enable=usb20host_power_enable,\r
 #endif    \r
 };\r