From 45d41680feec279b8c6e73f7f9ffd14fd77cb965 Mon Sep 17 00:00:00 2001 From: lintao Date: Fri, 15 Aug 2014 16:54:12 +0800 Subject: [PATCH] mmc: change mmc_rescan_host usage for Rockchip turnkey customer :(( Before this patch we identify oob-wifi or sdio-irq-wifi by DTS. However wifi engineers argue that our customer is lazy to modify it event we had moentioned in release wifi configure document before and claim it again and agin. Cc: hwg Cc: gwl Signed-off-by: Shawn Lin --- drivers/mmc/core/host.c | 41 ++++++++++++++++++++++++---------------- include/linux/mmc/host.h | 2 +- net/rfkill/rfkill-wlan.c | 13 +++++++++++-- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 5dafb3b23c62..4d3d02d9b568 100755 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -604,25 +604,34 @@ EXPORT_SYMBOL(mmc_free_host); * OR, rescan host from argument. * */ -int mmc_host_rescan(struct mmc_host *host, int val) +int mmc_host_rescan(struct mmc_host *host, int val, int is_cap_sdio_irq) { - if(NULL != primary_sdio_host){ - if(!host) - host = primary_sdio_host; - else - printk("%s: mmc_host_rescan pass in host from argument!\n", mmc_hostname(host)); - } - else{ - printk("sdio: host isn't initialization successfully.\n"); - return -ENOMEDIUM; - } - - printk("%s:mmc host rescan start!\n", mmc_hostname(host)); - - if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->set_sdio_status) + if (NULL != primary_sdio_host) { + if(!host) + host = primary_sdio_host; + else + printk("%s: mmc_host_rescan pass in host from argument!\n", mmc_hostname(host)); + } else { + printk("sdio: host isn't initialization successfully.\n"); + return -ENOMEDIUM; + } + + printk("%s:mmc host rescan start!\n", mmc_hostname(host)); + + /* 0: oob 1:cap-sdio-irq */ + if (is_cap_sdio_irq == 1) { + host->caps |= MMC_CAP_SDIO_IRQ; + } else if (is_cap_sdio_irq == 0) { + host->caps &= ~MMC_CAP_SDIO_IRQ; + } else { + dev_err(&host->class_dev, "sdio: host doesn't identify oob or sdio_irq mode!\n"); + return -ENOMEDIUM; + } + + if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->set_sdio_status) host->ops->set_sdio_status(host, val); - return 0; + return 0; } EXPORT_SYMBOL(mmc_host_rescan); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index a78ce927814b..7f45c684ec0b 100755 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -396,7 +396,7 @@ int mmc_add_host(struct mmc_host *); void mmc_remove_host(struct mmc_host *); void mmc_free_host(struct mmc_host *); int mmc_of_parse(struct mmc_host *host); -int mmc_host_rescan(struct mmc_host *host, int val); +int mmc_host_rescan(struct mmc_host *host, int val, int irq_type); #ifdef CONFIG_MMC_EMBEDDED_SDIO extern void mmc_set_embedded_sdio_data(struct mmc_host *host, struct sdio_cis *cis, diff --git a/net/rfkill/rfkill-wlan.c b/net/rfkill/rfkill-wlan.c index 7ee079047048..73607702fc69 100755 --- a/net/rfkill/rfkill-wlan.c +++ b/net/rfkill/rfkill-wlan.c @@ -436,10 +436,19 @@ EXPORT_SYMBOL(rockchip_wifi_power); * *************************************************************************/ #include -extern int mmc_host_rescan(struct mmc_host *host, int val); +extern int mmc_host_rescan(struct mmc_host *host, int val, int irq_type); int rockchip_wifi_set_carddetect(int val) { - return mmc_host_rescan(NULL, val);//NULL => SDIO host + int chip, irq_type; + chip = get_wifi_chip_type(); + + /* irq_type : 0, oob; 1, cap-sdio-irq */ + if (chip == WIFI_ESP8089) + irq_type = 1; + else + irq_type = 0; + + return mmc_host_rescan(NULL, val, irq_type);//NULL => SDIO host } EXPORT_SYMBOL(rockchip_wifi_set_carddetect); -- 2.34.1