wifi: add mt5931 wifi and mt6622 bt power control
authorhwg <hwg@rock-chips.com>
Wed, 28 Nov 2012 09:20:06 +0000 (17:20 +0800)
committerhwg <hwg@rock-chips.com>
Wed, 28 Nov 2012 09:20:06 +0000 (17:20 +0800)
arch/arm/mach-rk2928/board-rk2928-sdk-sdmmc.c
arch/arm/mach-rk2928/board-rk2928-sdk.c

index 47f653fbcd6435acc78b2a0c9b49c0b33bbefde9..92a1976329eb8246cfc3d0ec0f5ca4eeeb2aa484 100755 (executable)
         #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3C_GPIO3C2
 
 
-        #elif defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
+    #elif defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
         #define RK30SDK_WIFI_GPIO_POWER_N               RK2928_PIN0_PD6
         #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW
         #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0D6_MMC1_PWREN_NAME
         #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0D_GPIO0D6
+        
+    #elif defined(CONFIG_MT5931) || defined(CONFIG_MT5931_MT6622)
+        #define RK30SDK_WIFI_GPIO_POWER_N               RK2928_PIN3_PD2
+        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH 
+        
+        #define RK30SDK_WIFI_GPIO_RESET_N               RK2928_PIN3_PD5
+        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
 
     #endif
 #endif
@@ -995,7 +1002,6 @@ static void rk29_sdmmc_gpio_open(int device_id, int on)
                 gpio_request(rksdmmc1_gpio_init.data0_gpio.io, "mmc1-data0");
                 gpio_direction_output(rksdmmc1_gpio_init.data0_gpio.io,GPIO_LOW);//set mmc1-data0 to low.
                 
-            #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC)
                 rk29_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fgpio);
                 gpio_request(rksdmmc1_gpio_init.data1_gpio.io, "mmc1-data1");
                 gpio_direction_output(rksdmmc1_gpio_init.data1_gpio.io,GPIO_LOW);//set mmc1-data1 to low.
@@ -1007,7 +1013,7 @@ static void rk29_sdmmc_gpio_open(int device_id, int on)
                 rk29_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name, rksdmmc1_gpio_init.data3_gpio.iomux.fgpio);
                 gpio_request(rksdmmc1_gpio_init.data3_gpio.io, "mmc1-data3");
                 gpio_direction_output(rksdmmc1_gpio_init.data3_gpio.io,GPIO_LOW);//set mmc1-data3 to low.
-           #endif
+
                 mdelay(100);
             }
             #endif
@@ -1445,6 +1451,13 @@ static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void
         return 0;
 }
 
+#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU)
+static int __init rk29sdk_wifi_bt_gpio_control_init(void)
+{
+    pr_info("%s: init finished\n",__func__);
+    return 0;
+}      
+#else
 static int __init rk29sdk_wifi_bt_gpio_control_init(void)
 {
     rk29sdk_init_wifi_mem();    
@@ -1470,25 +1483,13 @@ static int __init rk29sdk_wifi_bt_gpio_control_init(void)
 #endif    
 
     #if defined(CONFIG_SDMMC1_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
-    
-    rk29_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fgpio);
-    gpio_request(rksdmmc1_gpio_init.data1_gpio.io, "mmc1-data1");
-    gpio_direction_output(rksdmmc1_gpio_init.data1_gpio.io,GPIO_LOW);//set mmc1-data1 to low.
-
-    rk29_mux_api_set(rksdmmc1_gpio_init.data2_gpio.iomux.name, rksdmmc1_gpio_init.data2_gpio.iomux.fgpio);
-    gpio_request(rksdmmc1_gpio_init.data2_gpio.io, "mmc1-data2");
-    gpio_direction_output(rksdmmc1_gpio_init.data2_gpio.io,GPIO_LOW);//set mmc1-data2 to low.
-
-    rk29_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name,  rksdmmc1_gpio_init.data3_gpio.iomux.fgpio);
-    gpio_request(rksdmmc1_gpio_init.data3_gpio.io, "mmc1-data3");
-    gpio_direction_output(rksdmmc1_gpio_init.data3_gpio.io,GPIO_LOW);//set mmc1-data3 to low.
-    
     rk29_sdmmc_gpio_open(1, 0); //added by xbw at 2011-10-13
     #endif    
     pr_info("%s: init finished\n",__func__);
 
     return 0;
 }
+#endif
 
 #if (defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) )&& defined(CONFIG_ARCH_RK2928)
 static int usbwifi_power_status = 1;
index 3ffe4a8c4b9b87203c08cca1fd4091754bbcebe4..e0d22e5e0d41f137bc0e018e4183e56aa25ebf5e 100755 (executable)
@@ -714,7 +714,7 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = {
         .iomux          = {
             .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
             .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
-            .fmux       = GPIO3B_SDMMC0_DETECT_N,
+            .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
         },
     }, 
     
@@ -726,6 +726,41 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = {
  * the end of setting for SDMMC devices
 **************************************************************************************************/
 
+#if defined(CONFIG_MT5931_MT6622)
+static struct mt6622_platform_data mt6622_platdata = {
+    .power_gpio         = { // BT_REG_ON
+        .io             = RK2928_PIN3_PC2, // set io to INVALID_GPIO for disable it
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = NULL,
+        },
+    },
+
+    .reset_gpio         = { // BT_RST
+        .io             = RK2928_PIN0_PC6,
+        .enable         = GPIO_LOW,
+        .iomux          = {
+            .name       = NULL,
+        },
+    },
+
+    .irq_gpio           = {
+        .io             = RK2928_PIN3_PD3,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = NULL,
+        },
+    }
+};
+
+static struct platform_device device_mt6622 = {
+    .name   = "mt6622",
+    .id     = -1,
+    .dev    = {
+        .platform_data = &mt6622_platdata,
+    },
+};
+#endif
 
 #ifdef CONFIG_SND_SOC_RK2928
 static struct resource resources_acodec[] = {
@@ -792,6 +827,12 @@ static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_BATTERY_RK30_ADC_FAC
        &rk30_device_adc_battery,
 #endif
+#ifdef CONFIG_WIFI_CONTROL_FUNC
+       &rk29sdk_wifi_device,
+#endif
+#ifdef CONFIG_MT5931_MT6622
+       &device_mt6622,
+#endif
 };
 //i2c
 #ifdef CONFIG_I2C0_RK30