1 From 6531593a263a254edcf1effbf132ead1aa5e4654 Mon Sep 17 00:00:00 2001
2 From: David-John Willis <John.Willis@Distant-earth.com>
3 Date: Mon, 22 Jun 2009 20:49:31 +0100
4 Subject: [PATCH] SDIO patches to put some card into into platform devices (hack) to match WL1251 driver.
7 arch/arm/include/asm/mach/mmc.h | 10 ++++++
8 arch/arm/mach-omap2/board-omap3pandora.c | 50 ++++++++++++++++++++++++++++++
9 arch/arm/mach-omap2/hsmmc.c | 37 +++++++++++++++++++++-
10 arch/arm/plat-omap/include/mach/mmc.h | 12 +++++++
11 drivers/mmc/host/omap_hsmmc.c | 24 ++++++++++----
12 include/linux/mmc/host.h | 12 +++---
13 include/linux/wifi_tiwlan.h | 32 +++++++++++++++++++
14 7 files changed, 163 insertions(+), 14 deletions(-)
15 mode change 100644 => 100755 arch/arm/include/asm/mach/mmc.h
16 mode change 100644 => 100755 arch/arm/mach-omap2/board-omap3pandora.c
17 mode change 100644 => 100755 arch/arm/mach-omap2/hsmmc.c
18 mode change 100644 => 100755 arch/arm/plat-omap/include/mach/mmc.h
19 mode change 100644 => 100755 drivers/mmc/host/omap_hsmmc.c
20 mode change 100644 => 100755 include/linux/mmc/host.h
21 create mode 100755 include/linux/wifi_tiwlan.h
23 diff --git a/arch/arm/include/asm/mach/mmc.h b/arch/arm/include/asm/mach/mmc.h
26 index 4da332b..4df7955
27 --- a/arch/arm/include/asm/mach/mmc.h
28 +++ b/arch/arm/include/asm/mach/mmc.h
30 #define ASMARM_MACH_MMC_H
32 #include <linux/mmc/host.h>
33 +#include <linux/mmc/card.h>
34 +#include <linux/mmc/sdio_func.h>
36 +struct embedded_sdio_data {
37 + struct sdio_cis cis;
38 + struct sdio_cccr cccr;
39 + struct sdio_embedded_func *funcs;
43 struct mmc_platform_data {
44 unsigned int ocr_mask; /* available voltages */
45 u32 (*translate_vdd)(struct device *, unsigned int);
46 unsigned int (*status)(struct device *);
47 + struct embedded_sdio_data *embedded_sdio;
51 diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
54 index 6e4b207..031ad2d
55 --- a/arch/arm/mach-omap2/board-omap3pandora.c
56 +++ b/arch/arm/mach-omap2/board-omap3pandora.c
58 #include <linux/mtd/nand.h>
59 #include <linux/mtd/partitions.h>
61 +#include <linux/wifi_tiwlan.h>
63 #include <asm/mach-types.h>
64 #include <asm/mach/arch.h>
65 #include <asm/mach/flash.h>
67 #define GPMC_CS0_BASE 0x60
68 #define GPMC_CS_SIZE 0x30
70 +#define PANDORA_WIFI_GPIO 23
72 +extern int omap_mmc_fake_detect_mmc3(int is_in);
74 static struct mtd_partition omap3pandora_nand_partitions[] = {
77 @@ -446,12 +452,56 @@ static struct platform_device bt_device = {
81 +static int pandora_wifi_power_state;
83 +int pandora_wifi_power(int on)
85 + printk("%s: %d\n", __func__, on);
88 + gpio_set_value(PANDORA_WIFI_GPIO, 1);
91 + gpio_set_value(PANDORA_WIFI_GPIO, 0);
94 + pandora_wifi_power_state = on;
98 +static int pandora_wifi_reset_state;
100 +int pandora_wifi_reset(int on)
102 + printk("%s: %d\n", __func__, on);
103 + pandora_wifi_reset_state = on;
107 +struct wifi_platform_data pandora_wifi_control = {
108 + .set_power = pandora_wifi_power,
109 + .set_reset = pandora_wifi_reset,
110 + .set_carddetect = omap_mmc_fake_detect_mmc3,
111 + .mem_prealloc = NULL,
114 +static struct platform_device pandora_wifi = {
115 + .name = "msm_wifi", /* Hack to work with hardcode in driver */
117 + .num_resources = 0,
120 + .platform_data = &pandora_wifi_control,
124 static struct platform_device *omap3pandora_devices[] __initdata = {
125 &omap3pandora_lcd_device,
126 &omap3pandora_leds_gpio,
129 &omap3pandora_dss_device,
133 static void __init omap3pandora_init(void)
134 diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
137 index 66d08fc..80d344e
138 --- a/arch/arm/mach-omap2/hsmmc.c
139 +++ b/arch/arm/mach-omap2/hsmmc.c
140 @@ -380,13 +380,48 @@ static int hsmmc3_set_power(struct device *dev, int slot, int power_on,
145 + * Hack: Hardcoded WL1251 embedded data for Pandora
146 + * - passed up via a dirty hack to the MMC platform data.
149 +#include <linux/mmc/host.h>
150 +#include <linux/mmc/card.h>
151 +#include <linux/mmc/sdio_func.h>
152 +#include <linux/mmc/sdio_ids.h>
154 +static struct sdio_embedded_func wifi_func = {
155 + .f_class = SDIO_CLASS_WLAN,
156 + .f_maxblksize = 512,
159 +static struct embedded_sdio_data pandora_wifi_emb_data = {
164 + .max_dtr = 20000000,
173 + .funcs = &wifi_func,
178 static struct omap_mmc_platform_data mmc3_data = {
180 .dma_mask = 0xffffffff,
181 + .embedded_sdio = &pandora_wifi_emb_data,
184 .set_power = hsmmc3_set_power,
185 - .ocr_mask = MMC_VDD_165_195 | MMC_VDD_20_21,
186 + .ocr_mask = MMC_VDD_28_29,
187 .name = "third slot",
190 diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
193 index 2f20789..1a10c07
194 --- a/arch/arm/plat-omap/include/mach/mmc.h
195 +++ b/arch/arm/plat-omap/include/mach/mmc.h
198 #define OMAP_MMC_MAX_SLOTS 2
200 +#include <linux/mmc/card.h>
201 +#include <linux/mmc/sdio_func.h>
203 +struct embedded_sdio_data {
204 + struct sdio_cis cis;
205 + struct sdio_cccr cccr;
206 + struct sdio_embedded_func *funcs;
210 struct omap_mmc_platform_data {
212 /* number of slots per controller */
213 @@ -56,6 +66,8 @@ struct omap_mmc_platform_data {
217 + struct embedded_sdio_data *embedded_sdio;
219 struct omap_mmc_slot_data {
222 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
225 index c80c063..bc5c73b
226 --- a/drivers/mmc/host/omap_hsmmc.c
227 +++ b/drivers/mmc/host/omap_hsmmc.c
228 @@ -156,9 +156,9 @@ struct mmc_omap_host {
232 - * Hack: hardcoded WL1251 embedded data
233 + * Hack: hardcoded WL1251 embedded data - Should be passed in platform data,
235 -#include <linux/mmc/card.h>
236 +/*#include <linux/mmc/card.h>
237 #include <linux/mmc/sdio_func.h>
238 #include <linux/mmc/sdio_ids.h>
240 @@ -166,7 +166,6 @@ static struct sdio_cis wifi_cis = {
244 - /*.max_dtr = 24000000, Max of chip - no worky on Trout */
248 @@ -181,7 +180,8 @@ static struct sdio_cccr wifi_cccr = {
249 static struct sdio_embedded_func wifi_func = {
250 .f_class = SDIO_CLASS_WLAN,
257 * A hack to have fake detect events on MMC3
258 @@ -189,11 +189,11 @@ static struct sdio_embedded_func wifi_func = {
260 static struct mmc_omap_host *mmc3_host;
262 -void omap_mmc_fake_detect_mmc3(int is_in)
263 +int omap_mmc_fake_detect_mmc3(int is_in)
266 - mmc_set_embedded_sdio_data(mmc3_host->mmc, &wifi_cis,
267 - &wifi_cccr, &wifi_func, 1);
268 +// mmc_set_embedded_sdio_data(mmc3_host->mmc, &wifi_cis,
269 +// &wifi_cccr, &wifi_func, 1);
271 printk(KERN_INFO "Sending %s event for MMC3...\n",
272 is_in ? "insert" : "remove");
273 @@ -202,6 +202,7 @@ void omap_mmc_fake_detect_mmc3(int is_in)
275 printk(KERN_ERR "Can't scan MMC3, host not registered "
280 EXPORT_SYMBOL(omap_mmc_fake_detect_mmc3);
281 @@ -957,6 +958,15 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
283 sema_init(&host->sem, 1);
285 +#ifdef CONFIG_MMC_EMBEDDED_SDIO
286 + if (pdata->embedded_sdio)
287 + mmc_set_embedded_sdio_data(mmc,
288 + &pdata->embedded_sdio->cis,
289 + &pdata->embedded_sdio->cccr,
290 + pdata->embedded_sdio->funcs,
291 + pdata->embedded_sdio->num_funcs);
294 host->iclk = clk_get(&pdev->dev, "mmchs_ick");
295 if (IS_ERR(host->iclk)) {
296 ret = PTR_ERR(host->iclk);
297 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
300 index 6016dcb..0a47c82
301 --- a/include/linux/mmc/host.h
302 +++ b/include/linux/mmc/host.h
303 @@ -160,12 +160,12 @@ struct mmc_host {
304 struct dentry *debugfs_root;
306 #ifdef CONFIG_MMC_EMBEDDED_SDIO
308 - struct sdio_cis *cis;
309 - struct sdio_cccr *cccr;
310 - struct sdio_embedded_func *funcs;
312 - } embedded_sdio_data;
314 + struct sdio_cis *cis;
315 + struct sdio_cccr *cccr;
316 + struct sdio_embedded_func *funcs;
318 + } embedded_sdio_data;
321 unsigned long private[0] ____cacheline_aligned;
322 diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h
324 index 0000000..f4e0e3c
326 +++ b/include/linux/wifi_tiwlan.h
328 +/* include/linux/wifi_tiwlan.h
\r
330 + * Copyright (C) 2008 Google, Inc.
\r
332 + * This software is licensed under the terms of the GNU General Public
\r
333 + * License version 2, as published by the Free Software Foundation, and
\r
334 + * may be copied, distributed, and modified under those terms.
\r
336 + * This program is distributed in the hope that it will be useful,
\r
337 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
338 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
339 + * GNU General Public License for more details.
\r
342 +#ifndef _LINUX_WIFI_TIWLAN_H_
\r
343 +#define _LINUX_WIFI_TIWLAN_H_
\r
345 +#define WMPA_NUMBER_OF_SECTIONS 3
\r
346 +#define WMPA_NUMBER_OF_BUFFERS 160
\r
347 +#define WMPA_SECTION_HEADER 24
\r
348 +#define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64)
\r
349 +#define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256)
\r
350 +#define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048)
\r
352 +struct wifi_platform_data {
\r
353 + int (*set_power)(int val);
\r
354 + int (*set_reset)(int val);
\r
355 + int (*set_carddetect)(int val);
\r
356 + void *(*mem_prealloc)(int section, unsigned long size);
\r