From: wdc Date: Tue, 15 Oct 2013 09:16:36 +0000 (+0800) Subject: sdmmc: support use sdmmc0 for wifi X-Git-Tag: firefly_0821_release~6561 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2be96faf89014e20486aa418c77b70bf12ed4094;p=firefly-linux-kernel-4.4.55.git sdmmc: support use sdmmc0 for wifi --- diff --git a/arch/arm/plat-rk/rk-sdmmc-wifi.c b/arch/arm/plat-rk/rk-sdmmc-wifi.c index 196df315810d..711789670293 100755 --- a/arch/arm/plat-rk/rk-sdmmc-wifi.c +++ b/arch/arm/plat-rk/rk-sdmmc-wifi.c @@ -246,6 +246,14 @@ struct rksdmmc_gpio_wifi_moudle rk_platform_wifi_gpio = { #ifdef CONFIG_WIFI_CONTROL_FUNC +#if defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD) +static int rk29sdk_wifi_mmc0_status(struct device *dev); +static int rk29sdk_wifi_mmc0_status_register(void (*callback)(int card_presend, void *dev_id), void *dev_id); +static int rk29sdk_wifi_mmc0_cd = 0; /* wifi virtual 'card detect' status */ +static void (*wifi_mmc0_status_cb)(int card_present, void *dev_id); +static void *wifi_mmc0_status_cb_devid; +#endif + #define PREALLOC_WLAN_SEC_NUM 4 #define PREALLOC_WLAN_BUF_NUM 160 #define PREALLOC_WLAN_SECTION_HEADER 24 @@ -322,6 +330,23 @@ err_skb_alloc: return -ENOMEM; } + +#if defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD) +static int rk29sdk_wifi_mmc0_status(struct device *dev) + +{ + return rk29sdk_wifi_mmc0_cd; +} + +static int rk29sdk_wifi_mmc0_status_register(void (*callback)(int card_present, void *dev_id), void *dev_id) +{ + if(wifi_mmc0_status_cb) + return -EAGAIN; + wifi_mmc0_status_cb = callback; + wifi_mmc0_status_cb_devid = dev_id; + return 0; +} +#else static int rk29sdk_wifi_status(struct device *dev) { return rk29sdk_wifi_cd; @@ -335,6 +360,7 @@ static int rk29sdk_wifi_status_register(void (*callback)(int card_present, void wifi_status_cb_devid = dev_id; return 0; } +#endif static int __init rk29sdk_wifi_bt_gpio_control_init(void) { @@ -498,6 +524,19 @@ static int rk29sdk_wifi_reset(int on) return 0; } +#if defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD) +int rk29sdk_wifi_set_carddetect(int val) +{ + printk("%s:%d\n", __func__, val); + rk29sdk_wifi_mmc0_cd = val; + if (wifi_mmc0_status_cb){ + wifi_mmc0_status_cb(val, wifi_mmc0_status_cb_devid); + }else { + pr_warning("%s,in mmc0 nobody to notify\n", __func__); + } + return 0; +} +#else int rk29sdk_wifi_set_carddetect(int val) { pr_info("%s:%d\n", __func__, val); @@ -509,6 +548,7 @@ int rk29sdk_wifi_set_carddetect(int val) } return 0; } +#endif EXPORT_SYMBOL(rk29sdk_wifi_set_carddetect); #include diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index d9079b3aacd7..6418ad298cd1 100755 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -49,13 +49,13 @@ if SDMMC_RK29 If you say No, then detect the card by register interrupt. -# config USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD -# depends on SDMMC0_RK29 -# bool "Switch the driver SDMMC0 for the debug of wifi_develop_board." -# default n -# help -# In order to debug the Wifi development board using SD interface, -# we can switch the driver SDMMC0. + config USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD + depends on SDMMC0_RK29 + bool "Switch the driver SDMMC0 for the debug of wifi_develop_board." + default n + help + In order to debug the Wifi development board using SD interface, + we can switch the driver SDMMC0. config SDMMC1_RK29