rk3066: support mt5931 wifi and mt6622 bt power control
authorhwg <hwg@rock-chips.com>
Wed, 19 Dec 2012 12:01:33 +0000 (20:01 +0800)
committerhwg <hwg@rock-chips.com>
Wed, 19 Dec 2012 12:01:33 +0000 (20:01 +0800)
arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c
arch/arm/mach-rk30/board-rk30-sdk.c

index 73f6a6c4108529cbfcb80913ebea8d4ca9d88061..c3e0a3a66caf0ca305543a1beb64e9ef9cbba128 100755 (executable)
     #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
     #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO3D1_SDMMC1BACKENDPWR_NAME
     #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3D_GPIO3D1
+    
+    #elif defined(CONFIG_MT5931) || defined(CONFIG_MT5931_MT6622)
+    //power
+    #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PC6 //RK30_PIN3_PD0       // huweiguo          
+    #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH                   
+    //reset
+    #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN3_PD1       // huweiguo 
+    #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH    
 
     #elif defined(CONFIG_MT6620)
         #if !defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
@@ -1065,7 +1073,7 @@ 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)
+            #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) || defined(CONFIG_MT5931) || defined(CONFIG_MT5931_MT6622)
                 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.
@@ -1541,6 +1549,7 @@ static int __init rk29sdk_wifi_bt_gpio_control_init(void)
 
     #if defined(CONFIG_SDMMC1_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
     
+    #if !defined(CONFIG_MT5931) && !defined(CONFIG_MT5931_MT6622)  
     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.
@@ -1552,6 +1561,7 @@ static int __init rk29sdk_wifi_bt_gpio_control_init(void)
     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
     
     rk29_sdmmc_gpio_open(1, 0); //added by xbw at 2011-10-13
     #endif    
index fe9ffddfbb3b916525dfd543ce3e21a9df43a3bf..3342297f52af4459a63e3f14e46bc4a1b8911394 100755 (executable)
@@ -1305,6 +1305,42 @@ static struct platform_device device_rfkill_rk = {
 };
 #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_LOW,
+        .iomux          = {
+            .name       = NULL,
+        },
+    },
+
+    .irq_gpio           = {
+        .io             = RK30_PIN6_PA7,
+        .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
        &device_fb,
@@ -1361,6 +1397,9 @@ static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_RFKILL_RK
        &device_rfkill_rk,
 #endif
+#ifdef CONFIG_MT5931_MT6622
+       &device_mt6622,
+#endif
 };
 
 // i2c