1 From 5800973aa82858036239b232e16d63796ba0de95 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 1/4] 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 88bc884..6585a15
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 @@ -489,6 +495,49 @@ 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,
127 @@ -496,6 +545,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
129 &omap3pandora_dss_device,
134 static void __init omap3pandora_init(void)
135 diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
138 index 66d08fc..80d344e
139 --- a/arch/arm/mach-omap2/hsmmc.c
140 +++ b/arch/arm/mach-omap2/hsmmc.c
141 @@ -380,13 +380,48 @@ static int hsmmc3_set_power(struct device *dev, int slot, int power_on,
146 + * Hack: Hardcoded WL1251 embedded data for Pandora
147 + * - passed up via a dirty hack to the MMC platform data.
150 +#include <linux/mmc/host.h>
151 +#include <linux/mmc/card.h>
152 +#include <linux/mmc/sdio_func.h>
153 +#include <linux/mmc/sdio_ids.h>
155 +static struct sdio_embedded_func wifi_func = {
156 + .f_class = SDIO_CLASS_WLAN,
157 + .f_maxblksize = 512,
160 +static struct embedded_sdio_data pandora_wifi_emb_data = {
165 + .max_dtr = 20000000,
174 + .funcs = &wifi_func,
179 static struct omap_mmc_platform_data mmc3_data = {
181 .dma_mask = 0xffffffff,
182 + .embedded_sdio = &pandora_wifi_emb_data,
185 .set_power = hsmmc3_set_power,
186 - .ocr_mask = MMC_VDD_165_195 | MMC_VDD_20_21,
187 + .ocr_mask = MMC_VDD_28_29,
188 .name = "third slot",
191 diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
194 index 2f20789..1a10c07
195 --- a/arch/arm/plat-omap/include/mach/mmc.h
196 +++ b/arch/arm/plat-omap/include/mach/mmc.h
199 #define OMAP_MMC_MAX_SLOTS 2
201 +#include <linux/mmc/card.h>
202 +#include <linux/mmc/sdio_func.h>
204 +struct embedded_sdio_data {
205 + struct sdio_cis cis;
206 + struct sdio_cccr cccr;
207 + struct sdio_embedded_func *funcs;
211 struct omap_mmc_platform_data {
213 /* number of slots per controller */
214 @@ -56,6 +66,8 @@ struct omap_mmc_platform_data {
218 + struct embedded_sdio_data *embedded_sdio;
220 struct omap_mmc_slot_data {
223 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
226 index c80c063..bc5c73b
227 --- a/drivers/mmc/host/omap_hsmmc.c
228 +++ b/drivers/mmc/host/omap_hsmmc.c
229 @@ -156,9 +156,9 @@ struct mmc_omap_host {
233 - * Hack: hardcoded WL1251 embedded data
234 + * Hack: hardcoded WL1251 embedded data - Should be passed in platform data,
236 -#include <linux/mmc/card.h>
237 +/*#include <linux/mmc/card.h>
238 #include <linux/mmc/sdio_func.h>
239 #include <linux/mmc/sdio_ids.h>
241 @@ -166,7 +166,6 @@ static struct sdio_cis wifi_cis = {
245 - /*.max_dtr = 24000000, Max of chip - no worky on Trout */
249 @@ -181,7 +180,8 @@ static struct sdio_cccr wifi_cccr = {
250 static struct sdio_embedded_func wifi_func = {
251 .f_class = SDIO_CLASS_WLAN,
258 * A hack to have fake detect events on MMC3
259 @@ -189,11 +189,11 @@ static struct sdio_embedded_func wifi_func = {
261 static struct mmc_omap_host *mmc3_host;
263 -void omap_mmc_fake_detect_mmc3(int is_in)
264 +int omap_mmc_fake_detect_mmc3(int is_in)
267 - mmc_set_embedded_sdio_data(mmc3_host->mmc, &wifi_cis,
268 - &wifi_cccr, &wifi_func, 1);
269 +// mmc_set_embedded_sdio_data(mmc3_host->mmc, &wifi_cis,
270 +// &wifi_cccr, &wifi_func, 1);
272 printk(KERN_INFO "Sending %s event for MMC3...\n",
273 is_in ? "insert" : "remove");
274 @@ -202,6 +202,7 @@ void omap_mmc_fake_detect_mmc3(int is_in)
276 printk(KERN_ERR "Can't scan MMC3, host not registered "
281 EXPORT_SYMBOL(omap_mmc_fake_detect_mmc3);
282 @@ -957,6 +958,15 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
284 sema_init(&host->sem, 1);
286 +#ifdef CONFIG_MMC_EMBEDDED_SDIO
287 + if (pdata->embedded_sdio)
288 + mmc_set_embedded_sdio_data(mmc,
289 + &pdata->embedded_sdio->cis,
290 + &pdata->embedded_sdio->cccr,
291 + pdata->embedded_sdio->funcs,
292 + pdata->embedded_sdio->num_funcs);
295 host->iclk = clk_get(&pdev->dev, "mmchs_ick");
296 if (IS_ERR(host->iclk)) {
297 ret = PTR_ERR(host->iclk);
298 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
301 index 6016dcb..0a47c82
302 --- a/include/linux/mmc/host.h
303 +++ b/include/linux/mmc/host.h
304 @@ -160,12 +160,12 @@ struct mmc_host {
305 struct dentry *debugfs_root;
307 #ifdef CONFIG_MMC_EMBEDDED_SDIO
309 - struct sdio_cis *cis;
310 - struct sdio_cccr *cccr;
311 - struct sdio_embedded_func *funcs;
313 - } embedded_sdio_data;
315 + struct sdio_cis *cis;
316 + struct sdio_cccr *cccr;
317 + struct sdio_embedded_func *funcs;
319 + } embedded_sdio_data;
322 unsigned long private[0] ____cacheline_aligned;
323 diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h
325 index 0000000..f4e0e3c
327 +++ b/include/linux/wifi_tiwlan.h
329 +/* include/linux/wifi_tiwlan.h
\r
331 + * Copyright (C) 2008 Google, Inc.
\r
333 + * This software is licensed under the terms of the GNU General Public
\r
334 + * License version 2, as published by the Free Software Foundation, and
\r
335 + * may be copied, distributed, and modified under those terms.
\r
337 + * This program is distributed in the hope that it will be useful,
\r
338 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
339 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
340 + * GNU General Public License for more details.
\r
343 +#ifndef _LINUX_WIFI_TIWLAN_H_
\r
344 +#define _LINUX_WIFI_TIWLAN_H_
\r
346 +#define WMPA_NUMBER_OF_SECTIONS 3
\r
347 +#define WMPA_NUMBER_OF_BUFFERS 160
\r
348 +#define WMPA_SECTION_HEADER 24
\r
349 +#define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64)
\r
350 +#define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256)
\r
351 +#define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048)
\r
353 +struct wifi_platform_data {
\r
354 + int (*set_power)(int val);
\r
355 + int (*set_reset)(int val);
\r
356 + int (*set_carddetect)(int val);
\r
357 + void *(*mem_prealloc)(int section, unsigned long size);
\r