fix CONFIG_MT5931(wifi) bug: on LR097
authorhwg <hwg@rock-chips.com>
Sun, 30 Dec 2012 14:37:56 +0000 (22:37 +0800)
committer陈辉 <chenhui@rock-chips.com>
Sun, 30 Dec 2012 14:39:53 +0000 (22:39 +0800)
arch/arm/configs/rk3168_LR097_defconfig
arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c
arch/arm/mach-rk30/board-rk3168-LR097.c
drivers/mtk_wcn_bt/bt_hwctl.h
drivers/mtk_wcn_bt/bt_hwctl_dev.c
drivers/mtk_wcn_bt/bt_plat_smdk.c

index 6857806ac373f1020d82d6e2cb7fcfc3dbcb086b..fe3010090e24f573c3a1bb8cec7c160d7f26bd85 100644 (file)
@@ -177,10 +177,8 @@ CONFIG_BT_HIDP=y
 CONFIG_BT_HCIUART=y
 CONFIG_BT_HCIUART_H4=y
 CONFIG_BT_HCIUART_LL=y
-CONFIG_BT_HCIBCM4325=y
-CONFIG_BT_AUTOSLEEP=y
+CONFIG_MAC80211=y
 CONFIG_RFKILL=y
-CONFIG_RFKILL_RK=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_FIRMWARE_IN_KERNEL is not set
@@ -206,7 +204,7 @@ CONFIG_PHYLIB=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN_80211=y
-CONFIG_RKWIFI=y
+CONFIG_MT5931_MT6622=y
 CONFIG_USB_USBNET=y
 CONFIG_PPP=y
 CONFIG_PPP_MULTILINK=y
@@ -260,9 +258,8 @@ CONFIG_PS_STK3171=y
 # CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_RK29=y
 CONFIG_UART0_RK29=y
-CONFIG_UART0_CTS_RTS_RK29=y
-CONFIG_UART3_RK29=y
-CONFIG_UART3_CTS_RTS_RK29=y
+CONFIG_UART0_DMA_RK29=2
+CONFIG_UART2_RK29=y
 # CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 # CONFIG_I2C_COMPAT is not set
@@ -292,8 +289,6 @@ CONFIG_RK30_PWM_REGULATOR=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_VIDEO_DEV=y
 CONFIG_SOC_CAMERA=y
-CONFIG_SOC_CAMERA_OV2659=y
-CONFIG_SOC_CAMERA_OV5642=y
 CONFIG_VIDEO_RK29=y
 CONFIG_VIDEO_RK29_CAMMEM_ION=y
 CONFIG_ION=y
index fdae0fb89ee654280585e33ea4d45f2eeaea6586..27d87a5ae542f55a98454e78724076abfa8db0f0 100755 (executable)
     #endif 
 #elif defined(CONFIG_ARCH_RK3066B)//refer to file /arch/arm/mach-rk30/include/mach/iomux-rk3066b.h
     #define WIFI_HOST_WAKE RK30_PIN3_PD2
-     
+         
     #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
         #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0            
         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW//GPIO_HIGH        
         #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
         #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO2A7_LCDC1DATA7_SMCDATA7_TRACEDATA7_NAME
         #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO2A_GPIO2A7
+    
+    #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931)
+       #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0 
+       #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
+        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO3D0_SDMMC1PWREN_MIIMD_NAME
+        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3D_GPIO3D0
+        //#define RK30SDK_WIFI_GPIO_RESET_N            RK30_PIN3_PD1
+        //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
+        //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO3D1_SDMMC1BACKENDPWR_MIIMDCLK_NAME
+        //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3D_GPIO3D1
     #endif   
 #elif defined(CONFIG_ARCH_RK2928) //refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h
     #define WIFI_HOST_WAKE RK2928_PIN3_PC0 
index 07962e6c6993801336a14cdfae2c12bb7d5baf4d..bfbbde5e9441b0a3aed73bcf0813477937ea6459 100644 (file)
@@ -1296,6 +1296,42 @@ struct platform_device rk_device_gps = {
        };
 #endif
 
+#if defined(CONFIG_MT5931_MT6622)
+static struct mt6622_platform_data mt6622_platdata = {
+    .power_gpio         = { // BT_REG_ON
+        .io             = RK30_PIN3_PC7, // set io to INVALID_GPIO for disable it
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = NULL,
+        },
+    },
+
+    .reset_gpio         = { // BT_RST
+        .io             = RK30_PIN3_PD1,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = NULL,
+        },
+    },
+
+    .irq_gpio           = {
+        .io             = RK30_PIN0_PA5,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = NULL,
+        },
+    }
+};
+
+static struct platform_device device_mt6622 = {
+    .name   = "mt6622",
+    .id     = -1,
+    .dev    = {
+        .platform_data = &mt6622_platdata,
+    },
+};     
+
+#endif
 
 static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_FB_ROCKCHIP
@@ -1348,6 +1384,9 @@ static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_GPS_RK
        &rk_device_gps,
 #endif
+#ifdef CONFIG_MT5931_MT6622
+        &device_mt6622,
+#endif
 
 };
 
@@ -2052,14 +2091,14 @@ static void __init rk30_reserve(void)
  * comments    : min arm/logic voltage
  */
 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
-       {.frequency = 312 * 1000,       .cpu_volt = 850 * 1000,         .logic_volt = 1000 * 1000},
+/*     {.frequency = 312 * 1000,       .cpu_volt = 850 * 1000,         .logic_volt = 1000 * 1000},
        {.frequency = 504 * 1000,       .cpu_volt = 900 * 1000,         .logic_volt = 1000 * 1000},
-       {.frequency = 816 * 1000,       .cpu_volt = 950 * 1000,         .logic_volt = 1000 * 1000},
-       {.frequency = 1008 * 1000,      .cpu_volt = 1025 * 1000,        .logic_volt = 1000 * 1000},
+*/     {.frequency = 816 * 1000,       .cpu_volt = 950 * 1000,         .logic_volt = 1000 * 1000},
+/*     {.frequency = 1008 * 1000,      .cpu_volt = 1025 * 1000,        .logic_volt = 1000 * 1000},
        {.frequency = 1200 * 1000,      .cpu_volt = 1100 * 1000,        .logic_volt = 1050 * 1000},
        {.frequency = 1416 * 1000,      .cpu_volt = 1200 * 1000,        .logic_volt = 1150 * 1000},
        {.frequency = 1608 * 1000,      .cpu_volt = 1300 * 1000,        .logic_volt = 1250 * 1000},
-       {.frequency = CPUFREQ_TABLE_END},
+*/     {.frequency = CPUFREQ_TABLE_END},
 };
 
 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
index 140212c04cdf714e667a7bdea168359b1d35b274..3149033007c4391e2fcd48878af7b8ea110f7d26 100755 (executable)
@@ -50,6 +50,7 @@ struct gpio_set {
 
 extern void mt_bt_gpio_init(void);
 extern void mt_bt_gpio_release(void);
+extern int  mt_bt_power_init(void);
 extern int  mt_bt_power_on(void);
 extern void mt_bt_power_off(void);
 
index 8838cb84971852481c778db452f71e7cbb21489c..d073bbc28a727154ff22ed77ec271e3583a39177 100755 (executable)
@@ -242,24 +242,32 @@ static int mt6622_probe(struct platform_device *pdev)
        return -1;
     }
     
-               if (gpio_request(pdata->power_gpio.io, "BT_PWR_EN")){
-                       printk("mt6622 power_gpio is busy!\n");
-                       return -1;
+               if(pdata->power_gpio.io != INVALID_GPIO) {
+                       if (gpio_request(pdata->power_gpio.io, "BT_PWR_EN")){
+                               printk("mt6622 power_gpio is busy!\n");
+                               return -1;
+                       }
                }
                
-               if (gpio_request(pdata->reset_gpio.io, "BT_RESET")){
-                       printk("mt6622 reset_gpio is busy!\n");
-                       gpio_free(pdata->power_gpio.io);
-                       return -1;
+               if(pdata->reset_gpio.io != INVALID_GPIO) {
+                       if (gpio_request(pdata->reset_gpio.io, "BT_RESET")){
+                               printk("mt6622 reset_gpio is busy!\n");
+                               gpio_free(pdata->power_gpio.io);
+                               return -1;
+                       }
                }
                
-               if (gpio_request(pdata->irq_gpio.io, "BT_EINT")){
-                       printk("mt6622 irq_gpio is busy!\n");
-                       gpio_free(pdata->power_gpio.io);
-                       gpio_free(pdata->reset_gpio.io);
-                       return -1;
+               if(pdata->irq_gpio.io != INVALID_GPIO) {
+                       if (gpio_request(pdata->irq_gpio.io, "BT_EINT")){
+                               printk("mt6622 irq_gpio is busy!\n");
+                               gpio_free(pdata->power_gpio.io);
+                               gpio_free(pdata->reset_gpio.io);
+                               return -1;
+                       }
                }
                
+               mt_bt_power_init();
+               
                return 0;
 }
 
@@ -270,9 +278,12 @@ static int mt6622_remove(struct platform_device *pdev)
        printk("mt6622_remove.\n");
        
        if(pdata) {
-         gpio_free(pdata->power_gpio.io);
-         gpio_free(pdata->reset_gpio.io);
-         gpio_free(pdata->irq_gpio.io);
+         if(pdata->power_gpio.io != INVALID_GPIO)
+               gpio_free(pdata->power_gpio.io);
+         if(pdata->reset_gpio.io != INVALID_GPIO)
+               gpio_free(pdata->reset_gpio.io);
+         if(pdata->irq_gpio.io != INVALID_GPIO)
+               gpio_free(pdata->irq_gpio.io);
   }
        
        return 0;
index 1d829883c0df404590e1860269fd503819c921e1..3af0cd10ec3b6c3a29e73b2d8dbb246c17e9f7df 100755 (executable)
@@ -58,8 +58,14 @@ static int irq_num = -1;
 static int mt_bt_request_irq(void)\r
 {\r
     int iRet;\r
+    int trigger = IRQF_TRIGGER_HIGH;\r
+    struct mt6622_platform_data *pdata = (struct mt6622_platform_data *)mt_bt_get_platform_data();\r
+               \r
+    if(pdata->irq_gpio.enable == GPIO_LOW)\r
+       trigger = IRQF_TRIGGER_RISING;\r
+    \r
     iRet = request_irq(irq_num, mt_bt_eirq_handler, \r
-        /*IRQF_TRIGGER_RISING*/IRQF_TRIGGER_HIGH, "BT_INT_B", NULL);\r
+        trigger, "BT_INT_B", NULL);\r
     if (iRet){\r
         printk(KERN_ALERT MODULE_TAG "request_irq IRQ%d fails, errno %d\n", irq_num, iRet);\r
     }\r
@@ -100,6 +106,38 @@ EXPORT_SYMBOL(mt_bt_disable_irq);
  *                      P O W E R   C O N T R O L                           *\r
 *****************************************************************************/\r
 \r
+int mt_bt_power_init(void)\r
+{\r
+    struct mt6622_platform_data *pdata;\r
+    \r
+    printk(KERN_INFO MODULE_TAG "mt_bt_power_init\n");\r
+    \r
+    pdata = (struct mt6622_platform_data *)mt_bt_get_platform_data();\r
+    \r
+    if(pdata) {\r
+           \r
+           // PWR_EN and RESET\r
+           /* PWR_EN set to gpio output low */\r
+           if(pdata->power_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->power_gpio.io, 0);\r
+           /* RESET set to gpio output low */\r
+           if(pdata->reset_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->reset_gpio.io, 0);\r
+           msleep(200);\r
+           \r
+           /* RESET pull up */\r
+           if(pdata->reset_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->reset_gpio.io, 1);\r
+           msleep(1000);\r
+           \r
+           //pdata->power_gpio.io = INVALID_GPIO;\r
+           pdata->reset_gpio.io = INVALID_GPIO;\r
+       }\r
+    \r
+    return 0;\r
+}\r
+EXPORT_SYMBOL(mt_bt_power_init);\r
+\r
 int mt_bt_power_on(void)\r
 {\r
     int error;\r
@@ -117,12 +155,14 @@ int mt_bt_power_on(void)
            // EINT\r
            //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(0));\r
            //--s3c_gpio_setpull(GPIO_BT_EINT_PIN, S3C_GPIO_PULL_DOWN);\r
-           gpio_direction_input(pdata->irq_gpio.io);\r
+           if(pdata->irq_gpio.io != INVALID_GPIO)\r
+               gpio_direction_input(pdata->irq_gpio.io);\r
            //gpio_pull_updown(pdata->irq_gpio->io, GPIOPullDown);\r
            /* set to EINT mode */\r
            //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(0xF));\r
            /* get irq number */\r
-           irq_num = gpio_to_irq(pdata->irq_gpio.io);\r
+           if(pdata->irq_gpio.io != INVALID_GPIO)\r
+               irq_num = gpio_to_irq(pdata->irq_gpio.io);\r
            //mt_set_gpio_mode(GPIO_BT_EINT_PIN, GPIO_BT_EINT_PIN_M_GPIO);\r
            //mt_set_gpio_pull_enable(GPIO_BT_EINT_PIN, 1);\r
            //mt_set_gpio_pull_select(GPIO_BT_EINT_PIN, GPIO_PULL_DOWN);\r
@@ -134,24 +174,31 @@ int mt_bt_power_on(void)
            \r
            // PWR_EN and RESET\r
            /* PWR_EN set to gpio output low */\r
-           gpio_direction_output(pdata->power_gpio.io, 0);\r
+           if(pdata->power_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->power_gpio.io, 0);\r
            /* RESET set to gpio output low */\r
-           gpio_direction_output(pdata->reset_gpio.io, 0);\r
+           if(pdata->reset_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->reset_gpio.io, 0);\r
            msleep(200);\r
            \r
            /* PWR_EN pull up */\r
-           gpio_direction_output(pdata->power_gpio.io, 1);\r
+           if(pdata->power_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->power_gpio.io, 1);\r
            msleep(200);\r
            /* RESET pull up */\r
-           gpio_direction_output(pdata->reset_gpio.io, 1);\r
+           if(pdata->reset_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->reset_gpio.io, 1);\r
            msleep(1000);\r
            \r
            error = mt_bt_request_irq();\r
            if (error){\r
-               gpio_direction_output(pdata->power_gpio.io, 0);\r
-               gpio_direction_output(pdata->reset_gpio.io, 0);\r
+               if(pdata->power_gpio.io != INVALID_GPIO)\r
+                       gpio_direction_output(pdata->power_gpio.io, 0);\r
+               if(pdata->reset_gpio.io != INVALID_GPIO)        \r
+                       gpio_direction_output(pdata->reset_gpio.io, 0);\r
                //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(1));\r
-               gpio_direction_output(pdata->irq_gpio.io, 0);\r
+               if(pdata->irq_gpio.io != INVALID_GPIO)\r
+                       gpio_direction_output(pdata->irq_gpio.io, 0);\r
                return error;\r
            }\r
     }\r
@@ -173,12 +220,15 @@ void mt_bt_power_off(void)
     \r
     if(pdata) {\r
            // PWR_EN and RESET\r
-           gpio_direction_output(pdata->power_gpio.io, 0);\r
-           gpio_direction_output(pdata->reset_gpio.io, 0);\r
+           if(pdata->power_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->power_gpio.io, 0);\r
+           if(pdata->reset_gpio.io != INVALID_GPIO)    \r
+               gpio_direction_output(pdata->reset_gpio.io, 0);\r
            \r
            // EINT\r
            //--s3c_gpio_cfgpin(GPIO_BT_EINT_PIN, S3C_GPIO_SFN(1));\r
-           gpio_direction_output(pdata->irq_gpio.io, 0);\r
+           if(pdata->irq_gpio.io != INVALID_GPIO)\r
+               gpio_direction_output(pdata->irq_gpio.io, 0);\r
            \r
            mt_bt_free_irq();\r
     }\r