From aa983c08c4c853213f91eecdd27b823c885c0da5 Mon Sep 17 00:00:00 2001 From: xbw Date: Wed, 23 Jan 2013 14:36:21 +0800 Subject: [PATCH] SDMMC: Eliminate some small flaws after supporting new iomux-API. --- .../mach-rk30/board-rk3168-tb-sdmmc-conifg.c | 7 ++-- arch/arm/plat-rk/rk-sdmmc-wifi.c | 35 +++++++++++++++++-- drivers/mmc/host/rk29_sdmmc.c | 8 ++--- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk3168-tb-sdmmc-conifg.c b/arch/arm/mach-rk30/board-rk3168-tb-sdmmc-conifg.c index 98b2b5baa235..551536eed7ff 100644 --- a/arch/arm/mach-rk30/board-rk3168-tb-sdmmc-conifg.c +++ b/arch/arm/mach-rk30/board-rk3168-tb-sdmmc-conifg.c @@ -41,10 +41,9 @@ /* * 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 diff --git a/arch/arm/plat-rk/rk-sdmmc-wifi.c b/arch/arm/plat-rk/rk-sdmmc-wifi.c index d03c07c9c331..740e569ed077 100644 --- a/arch/arm/plat-rk/rk-sdmmc-wifi.c +++ b/arch/arm/plat-rk/rk-sdmmc-wifi.c @@ -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 diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index 9c7a73f490cb..a06db99de93b 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -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); -- 2.34.1