SDMMC: Eliminate some small flaws after supporting new iomux-API.
authorxbw <xbw@rock-chips.com>
Wed, 23 Jan 2013 06:36:21 +0000 (14:36 +0800)
committerxbw <xbw@rock-chips.com>
Wed, 23 Jan 2013 06:36:21 +0000 (14:36 +0800)
arch/arm/mach-rk30/board-rk3168-tb-sdmmc-conifg.c
arch/arm/plat-rk/rk-sdmmc-wifi.c
drivers/mmc/host/rk29_sdmmc.c

index 98b2b5baa235d85f85bb5eca40c0cba4a5afd368..551536eed7ffe1cb204c7e8077e92b027a00f119 100644 (file)
 
 /*
 * define the card-detect-pin.
-* define reset-pin
 */
 #define RK29SDK_SD_CARD_DETECT_N                RK30_PIN3_PB0  //According to your own project to set the value of card-detect-pin.
-#define RK29SDK_SD_CARD_INSERT_LEVEL            GPIO_LOW         // set the voltage of insert-card. Please pay attention to the default setting.
+#define RK29SDK_SD_CARD_INSERT_LEVEL            GPIO_LOW       // set the voltage of insert-card. Please pay attention to the default setting.
 
 /*
 * Define wifi module's power and reset gpio, and gpio sensitive level.
@@ -85,7 +84,9 @@
        #endif
 
 #elif defined(CONFIG_MT6620)
-    #define COMBO_MODULE_MT6620_CDT    1  //- 1--use Cdtech chip; 0--unuse CDT chip
+    #define COMBO_MODULE_MT6620_CDT    1  // to control antsel2,antsel3 and gps_lan foot when using AcSip or Cdtech chip. 
+                                             //- 1--use Cdtech chip; 0--unuse CDT chip
+
     //power, PMU_EN
     #define RK30SDK_WIFI_GPIO_POWER_N                   RK30_PIN3_PC7            
     #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE        GPIO_HIGH        
index d03c07c9c331bba80547fe20e36587b98c26f3e2..740e569ed07739c0d80164e0b03d422c3c509185 100644 (file)
@@ -368,16 +368,22 @@ 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)  
+    #if !defined(CONFIG_MT5931) && !defined(CONFIG_MT5931_MT6622)
+    #if !(!!SDMMC_USE_NEW_IOMUX_API)
     rk29_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fgpio);
+    #endif
     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.
 
+    #if !(!!SDMMC_USE_NEW_IOMUX_API)
     rk29_mux_api_set(rksdmmc1_gpio_init.data2_gpio.iomux.name, rksdmmc1_gpio_init.data2_gpio.iomux.fgpio);
+    #endif
     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.
 
+    #if !(!!SDMMC_USE_NEW_IOMUX_API)
     rk29_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name,  rksdmmc1_gpio_init.data3_gpio.iomux.fgpio);
+    #endif
     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
@@ -561,7 +567,7 @@ static int rk29sdk_wifi_combo_module_gpio_init(void)
         rk30_mux_api_set(rk_platform_wifi_gpio.ANTSEL3.iomux.name, rk_platform_wifi_gpio.ANTSEL3.iomux.fgpio);
         #endif
     gpio_request(rk_platform_wifi_gpio.ANTSEL3.io, "combo-ANTSEL3");
-    gpio_direction_output(rk_platform_wifi_gpio.ANTSEL3.io, rk_platform_wifi_gpio.ANTSEL3.enable);
+    gpio_direction_output(rk_platform_wifi_gpio.ANTSEL3.io, !(rk_platform_wifi_gpio.ANTSEL3.enable));
     #endif
 
     //GPS_LAN
@@ -583,6 +589,18 @@ int rk29sdk_wifi_combo_module_power(int on)
 {
      if(on)
     {
+        #ifdef RK30SDK_WIFI_GPIO_ANTSEL2
+        gpio_direction_output(rk_platform_wifi_gpio.ANTSEL2.io, rk_platform_wifi_gpio.ANTSEL2.enable);
+        #endif
+
+        #ifdef RK30SDK_WIFI_GPIO_ANTSEL3
+        gpio_direction_output(rk_platform_wifi_gpio.ANTSEL3.io, rk_platform_wifi_gpio.ANTSEL3.enable);
+        #endif
+
+        #ifdef RK30SDK_WIFI_GPIO_GPS_LAN
+        gpio_direction_output(rk_platform_wifi_gpio.GPS_LAN.io, rk_platform_wifi_gpio.GPS_LAN.enable);
+        #endif
+    
     #ifdef RK30SDK_WIFI_GPIO_VCCIO_WL
         gpio_set_value(rk_platform_wifi_gpio.vddio.io, rk_platform_wifi_gpio.vddio.enable);
         mdelay(10);
@@ -597,6 +615,19 @@ int rk29sdk_wifi_combo_module_power(int on)
         gpio_set_value(rk_platform_wifi_gpio.power_n.io, !(rk_platform_wifi_gpio.power_n.enable) );        
         mdelay(10);
 
+        #ifdef RK30SDK_WIFI_GPIO_ANTSEL2
+        //Because the foot is pulled low, therefore, continue to remain low
+        gpio_direction_output(rk_platform_wifi_gpio.ANTSEL2.io, rk_platform_wifi_gpio.ANTSEL2.enable);
+        #endif
+
+        #ifdef RK30SDK_WIFI_GPIO_ANTSEL3
+        gpio_direction_output(rk_platform_wifi_gpio.ANTSEL3.io, !(rk_platform_wifi_gpio.ANTSEL3.enable));
+        #endif
+        
+        #ifdef RK30SDK_WIFI_GPIO_GPS_LAN
+        gpio_direction_output(rk_platform_wifi_gpio.GPS_LAN.io, !(rk_platform_wifi_gpio.GPS_LAN.enable));
+        #endif
+
         #ifdef RK30SDK_WIFI_GPIO_VCCIO_WL      
         gpio_set_value(rk_platform_wifi_gpio.vddio.io, !(rk_platform_wifi_gpio.vddio.enable));
         #endif
index 9c7a73f490cb2051292fda08662e2f1a91f6599f..a06db99de93b1ed21ede82b42fdce62509466acb 100755 (executable)
@@ -3456,8 +3456,6 @@ static void rk29_sdmmc_detect_change_work(struct work_struct *work)
        int ret;
     struct rk29_sdmmc *host =  container_of(work, struct rk29_sdmmc, work.work);
 
-    rk29_sdmmc_hw_init(host);
-
     rk28_send_wakeup_key();
        rk29_sdmmc_detect_change(host);                  
 }
@@ -3959,7 +3957,9 @@ static int rk29_sdmmc_sdcard_suspend(struct rk29_sdmmc *host)
        int ret = 0;
 #if !defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO)
     rk29_sdmmc_enable_irq(host,false);
-    #if !(!!SDMMC_USE_NEW_IOMUX_API)
+    #if (defined(SDMMC_USE_NEW_IOMUX_API) && SDMMC_USE_NEW_IOMUX_API)
+    //need not to change mode to gpio.
+    #else
     rk29_mux_api_set(host->det_pin.iomux.name, host->det_pin.iomux.fgpio);
     #endif
        gpio_request(host->det_pin.io, "sd_detect");
@@ -3984,7 +3984,7 @@ static void rk29_sdmmc_sdcard_resume(struct rk29_sdmmc *host)
        disable_irq_wake(host->gpio_irq);
        free_irq(host->gpio_irq,host);
        gpio_free(host->det_pin.io);
-       #if SDMMC_USE_NEW_IOMUX_API
+       #if (defined(SDMMC_USE_NEW_IOMUX_API)&& SDMMC_USE_NEW_IOMUX_API)
        iomux_set(MMC0_DETN);
        #else
     rk29_mux_api_set(host->det_pin.iomux.name, host->det_pin.iomux.fmux);