SDIO patches to put some card into into platform devices (hack) to match WL1251 driver.
authorDavid-John Willis <John.Willis@Distant-earth.com>
Mon, 22 Jun 2009 19:49:31 +0000 (20:49 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 20 Apr 2010 11:21:24 +0000 (14:21 +0300)
arch/arm/include/asm/mach/mmc.h
arch/arm/mach-omap2/hsmmc.c
arch/arm/plat-omap/include/mach/mmc.h
drivers/mmc/host/omap_hsmmc.c

index 4da332b..4df7955 100644 (file)
@@ -5,11 +5,21 @@
 #define ASMARM_MACH_MMC_H
 
 #include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
+#include <linux/mmc/sdio_func.h>
+
+struct embedded_sdio_data {
+        struct sdio_cis cis;
+        struct sdio_cccr cccr;
+        struct sdio_embedded_func *funcs;
+        int num_funcs;
+};
 
 struct mmc_platform_data {
        unsigned int ocr_mask;                  /* available voltages */
        u32 (*translate_vdd)(struct device *, unsigned int);
        unsigned int (*status)(struct device *);
+       struct embedded_sdio_data *embedded_sdio;
 };
 
 #endif
index 66d08fc..8ea5969 100644 (file)
@@ -380,9 +380,43 @@ static int hsmmc3_set_power(struct device *dev, int slot, int power_on,
        return 0;
 }
 
+/*
+ * Hack: Hardcoded WL1251 embedded data for Pandora
+ * - passed up via a dirty hack to the MMC platform data.
+ */
+
+#include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
+#include <linux/mmc/sdio_func.h>
+#include <linux/mmc/sdio_ids.h>
+
+static struct sdio_embedded_func wifi_func = {
+       .f_class        = SDIO_CLASS_WLAN,
+       .f_maxblksize   = 512,
+};
+
+static struct embedded_sdio_data pandora_wifi_emb_data = {
+       .cis    = {
+               .vendor         = 0x104c,
+               .device         = 0x9066,
+               .blksize        = 512,
+               .max_dtr        = 20000000,
+       },
+       .cccr   = {
+               .multi_block    = 0,
+               .low_speed      = 0,
+               .wide_bus       = 1,
+               .high_power     = 0,
+               .high_speed     = 0,
+       },
+       .funcs  = &wifi_func,
+       .num_funcs = 1,
+};
+
 static struct omap_mmc_platform_data mmc3_data = {
        .nr_slots                       = 1,
        .dma_mask                       = 0xffffffff,
+       .embedded_sdio                  = &pandora_wifi_emb_data,
        .slots[0] = {
                .wire4                  = 1,
                .set_power              = hsmmc3_set_power,
index 2f20789..1a10c07 100644 (file)
 
 #define OMAP_MMC_MAX_SLOTS     2
 
+#include <linux/mmc/card.h>
+#include <linux/mmc/sdio_func.h>
+
+struct embedded_sdio_data {
+        struct sdio_cis cis;
+        struct sdio_cccr cccr;
+        struct sdio_embedded_func *funcs;
+        int num_funcs;
+};
+
 struct omap_mmc_platform_data {
 
        /* number of slots per controller */
@@ -56,6 +66,8 @@ struct omap_mmc_platform_data {
 
        u64 dma_mask;
 
+       struct embedded_sdio_data *embedded_sdio;
+
        struct omap_mmc_slot_data {
 
                /*
index 79fa722..3cbe37b 100644 (file)
@@ -160,35 +160,6 @@ struct mmc_omap_host {
        struct  omap_mmc_platform_data  *pdata;
 };
 
-
-/*
- * Hack: hardcoded WL1251 embedded data
- */
-#include <linux/mmc/card.h>
-#include <linux/mmc/sdio_func.h>
-#include <linux/mmc/sdio_ids.h>
-
-static struct sdio_cis wifi_cis = {
-       .vendor         = 0x104c,
-       .device         = 0x9066,
-       .blksize        = 512,
-       /*.max_dtr      = 24000000,  Max of chip - no worky on Trout */
-       .max_dtr        = 20000000,
-};
-
-static struct sdio_cccr wifi_cccr = {
-       .multi_block    = 0,
-       .low_speed      = 0,
-       .wide_bus       = 1,
-       .high_power     = 0,
-       .high_speed     = 0,
-};
-
-static struct sdio_embedded_func wifi_func = {
-       .f_class        = SDIO_CLASS_WLAN,
-       .f_maxblksize   = 512,
-};
-
 /*
  * A hack to have fake detect events on MMC3
  * (needed for board embedded chip init)
@@ -198,9 +169,6 @@ static struct mmc_omap_host *mmc3_host;
 void omap_mmc_fake_detect_mmc3(int is_in)
 {
        if (mmc3_host) {
-               mmc_set_embedded_sdio_data(mmc3_host->mmc, &wifi_cis,
-                                       &wifi_cccr, &wifi_func, 1);
-
                printk(KERN_INFO "Sending %s event for MMC3...\n",
                        is_in ? "insert" : "remove");
                mmc3_host->carddetect = !is_in;
@@ -994,6 +962,15 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
 
        sema_init(&host->sem, 1);
 
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+       if (pdata->embedded_sdio)
+               mmc_set_embedded_sdio_data(mmc,
+                                          &pdata->embedded_sdio->cis,
+                                          &pdata->embedded_sdio->cccr,
+                                          pdata->embedded_sdio->funcs,
+                                          pdata->embedded_sdio->num_funcs);
+#endif
+
        host->iclk = clk_get(&pdev->dev, "mmchs_ick");
        if (IS_ERR(host->iclk)) {
                ret = PTR_ERR(host->iclk);