sdmmc: support use sdmmc0 for wifi
authorwdc <wdc@rock-chips.com>
Tue, 15 Oct 2013 09:16:36 +0000 (17:16 +0800)
committerwdc <wdc@rock-chips.com>
Tue, 15 Oct 2013 09:17:28 +0000 (17:17 +0800)
arch/arm/plat-rk/rk-sdmmc-wifi.c
drivers/mmc/host/Kconfig

index 196df315810daf6c42a02317e47857c4cd4c3110..7117896702930f6d6de46d51ec983bd994f8c2ad 100755 (executable)
@@ -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)\r
+int rk29sdk_wifi_set_carddetect(int val)\r
+{\r
+    printk("%s:%d\n", __func__, val);\r
+    rk29sdk_wifi_mmc0_cd = val;\r
+    if (wifi_mmc0_status_cb){\r
+            wifi_mmc0_status_cb(val, wifi_mmc0_status_cb_devid);\r
+    }else {\r
+            pr_warning("%s,in mmc0 nobody to notify\n", __func__);\r
+    }\r
+    return 0; \r
+}\r
+#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 <linux/etherdevice.h>
index d9079b3aacd72c6bcc73137569e1850f4fab123e..6418ad298cd1e51f2f6772714b6b4dc9dd72c0f4 100755 (executable)
@@ -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