1 From d0e67607c9eba9423b65875da2c732ed690a2292 Mon Sep 17 00:00:00 2001
2 From: David-John Willis <John.Willis@Distant-earth.com>
3 Date: Sun, 30 Aug 2009 19:31:31 +0100
4 Subject: [PATCH 2/2] Add a very basic platform driver module to bring up the SDIO WiFi so that the platform stuff is no longer hacked into the WL1251 driver (TODO: Clean up and move somewhere more mainline friendly).
7 arch/arm/mach-omap2/Kconfig | 5 ++
8 arch/arm/mach-omap2/Makefile | 1 +
9 arch/arm/mach-omap2/board-omap3pandora-wifi.c | 89 +++++++++++++++++++++++++
10 3 files changed, 95 insertions(+), 0 deletions(-)
11 mode change 100644 => 100755 arch/arm/mach-omap2/Kconfig
12 mode change 100644 => 100755 arch/arm/mach-omap2/Makefile
13 create mode 100755 arch/arm/mach-omap2/board-omap3pandora-wifi.c
15 diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
18 index fd62c7e..9f6f7a2
19 --- a/arch/arm/mach-omap2/Kconfig
20 +++ b/arch/arm/mach-omap2/Kconfig
21 @@ -130,6 +130,11 @@ config MACH_OVERO
22 config MACH_OMAP3_PANDORA
24 depends on ARCH_OMAP3 && ARCH_OMAP34XX
26 +config OMAP3_PANDORA_WIFI
27 + depends on MACH_OMAP3_PANDORA
29 + tristate "OpenPandora Wifi GPIO driver"
31 config OMAP_TICK_GPTIMER
32 int "GPTIMER used for system tick timer"
33 diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
36 index e6e16bb..8ba0ad9
37 --- a/arch/arm/mach-omap2/Makefile
38 +++ b/arch/arm/mach-omap2/Makefile
39 @@ -83,6 +83,7 @@ obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \
43 +obj-$(CONFIG_OMAP3_PANDORA_WIFI) += board-omap3pandora-wifi.o
46 obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
47 diff --git a/arch/arm/mach-omap2/board-omap3pandora-wifi.c b/arch/arm/mach-omap2/board-omap3pandora-wifi.c
49 index 0000000..2968340
51 +++ b/arch/arm/mach-omap2/board-omap3pandora-wifi.c
54 + * board-omap3pandora-wifi.c
56 + * WiFi setup (SDIO) for Pandora handheld console
57 + * Author: John Willis <John.Willis@Distant-earth.com>
59 + * Based on /arch/arm/mach-msm/msm_wifi.c
61 + * This program is free software; you can redistribute it and/or
62 + * modify it under the terms of the GNU General Public License
63 + * version 2 as published by the Free Software Foundation.
65 + * This program is distributed in the hope that it will be useful, but
66 + * WITHOUT ANY WARRANTY; without even the implied warranty of
67 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
68 + * General Public License for more details.
70 + * You should have received a copy of the GNU General Public License
71 + * along with this program; if not, write to the Free Software
72 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
77 +#include <linux/platform_device.h>
78 +#include <linux/wifi_tiwlan.h>
80 +static int wifi_probe(struct platform_device *pdev)
82 + struct wifi_platform_data *wifi_ctrl =
83 + (struct wifi_platform_data *)(pdev->dev.platform_data);
85 + printk(KERN_DEBUG "Pandora WiFi: Probe started\n");
90 + if (wifi_ctrl->set_power)
91 + wifi_ctrl->set_power(1); /* Power On */
92 + if (wifi_ctrl->set_reset)
93 + wifi_ctrl->set_reset(0); /* Reset clear */
94 + if (wifi_ctrl->set_carddetect)
95 + wifi_ctrl->set_carddetect(1); /* CardDetect (0->1) */
97 + printk(KERN_DEBUG "Pandora WiFi: Probe done\n");
101 +static int wifi_remove(struct platform_device *pdev)
103 + struct wifi_platform_data *wifi_ctrl =
104 + (struct wifi_platform_data *)(pdev->dev.platform_data);
106 + printk(KERN_DEBUG "Pandora WiFi: Remove started\n");
110 + if (wifi_ctrl->set_carddetect)
111 + wifi_ctrl->set_carddetect(0); /* CardDetect (1->0) */
112 + if (wifi_ctrl->set_reset)
113 + wifi_ctrl->set_reset(1); /* Reset active */
114 + if (wifi_ctrl->set_power)
115 + wifi_ctrl->set_power(0); /* Power Off */
117 + printk(KERN_DEBUG "Pandora WiFi: Remove finished\n");
121 +static struct platform_driver wifi_device = {
122 + .probe = wifi_probe,
123 + .remove = wifi_remove,
125 + .name = "pandora_wifi",
129 +static int __init pandora_wifi_sdio_init(void)
131 + return platform_driver_register(&wifi_device);
134 +static void __exit pandora_wifi_sdio_exit(void)
136 + platform_driver_unregister(&wifi_device);
139 +module_init(pandora_wifi_sdio_init);
140 +module_exit(pandora_wifi_sdio_exit);
141 +MODULE_LICENSE("GPL");