mmc: change mmc_rescan_host usage for Rockchip turnkey customer :((
authorlintao <lintao@rock-chips.com>
Fri, 15 Aug 2014 08:54:12 +0000 (16:54 +0800)
committerlintao <lintao@rock-chips.com>
Fri, 15 Aug 2014 09:00:06 +0000 (17:00 +0800)
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 <hwg@rock-chips.com>
Cc: gwl <gwl@rock-chips.com>
Signed-off-by: Shawn Lin <lintao@rock-chips.com>
drivers/mmc/core/host.c
include/linux/mmc/host.h
net/rfkill/rfkill-wlan.c

index 5dafb3b23c621937fcc13fa6396a9de8a577916b..4d3d02d9b5687466c6a0839452488ea04bdd1424 100755 (executable)
@@ -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);
 
index a78ce927814ba76934221cc6b3a369d7e52d0e2e..7f45c684ec0bb5784ddd00f7f748d26f65a6632a 100755 (executable)
@@ -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,
index 7ee0790470485dd0dcc43e0b5bb614cfd5c6b3d2..73607702fc69cfa17f74fa3fa2997afd25a12008 100755 (executable)
@@ -436,10 +436,19 @@ EXPORT_SYMBOL(rockchip_wifi_power);
  *
  *************************************************************************/
 #include <linux/mmc/host.h>
-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);