omap3-pandora-kernel: Rebase patches for latest GIT head.
[openpandora.oe.git] / recipes / linux / omap3-pandora-kernel / 0002-Add-a-very-basic-platform-driver-module-to-bring-up-.patch
1 From b245ef5af21a973bda2f8496fd493fac0a771455 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/4] 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).
5
6 ---
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
14
15 diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
16 old mode 100644
17 new mode 100755
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
23         bool "OMAP3 Pandora"
24         depends on ARCH_OMAP3 && ARCH_OMAP34XX
25 +       
26 +config OMAP3_PANDORA_WIFI
27 +       depends on MACH_OMAP3_PANDORA
28 +       default m
29 +       tristate "OpenPandora Wifi GPIO driver"
30  
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
34 old mode 100644
35 new mode 100755
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 \
40                                            hsmmc.o \
41                                            usb-musb.o \
42                                            usb-ehci.o
43 +obj-$(CONFIG_OMAP3_PANDORA_WIFI)       += board-omap3pandora-wifi.o                                       
44  
45  # TUSB 6010 chips
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
48 new file mode 100755
49 index 0000000..2968340
50 --- /dev/null
51 +++ b/arch/arm/mach-omap2/board-omap3pandora-wifi.c
52 @@ -0,0 +1,89 @@
53 +/*
54 + * board-omap3pandora-wifi.c
55 + *
56 + * WiFi setup (SDIO) for Pandora handheld console
57 + * Author: John Willis <John.Willis@Distant-earth.com>
58 + *
59 + * Based on /arch/arm/mach-msm/msm_wifi.c
60 + *
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.
64 + *
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.
69 + *
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
73 + * 02110-1301 USA
74 + *
75 + */
76 +
77 +#include <linux/platform_device.h>
78 +#include <linux/wifi_tiwlan.h>
79 +
80 +static int wifi_probe(struct platform_device *pdev)
81 +{
82 +       struct wifi_platform_data *wifi_ctrl =
83 +               (struct wifi_platform_data *)(pdev->dev.platform_data);
84 +
85 +       printk(KERN_DEBUG "Pandora WiFi: Probe started\n");
86 +
87 +       if (!wifi_ctrl)
88 +               return -ENODEV;
89 +
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) */
96 +
97 +       printk(KERN_DEBUG "Pandora WiFi: Probe done\n");
98 +       return 0;
99 +}
100 +
101 +static int wifi_remove(struct platform_device *pdev)
102 +{
103 +       struct wifi_platform_data *wifi_ctrl =
104 +               (struct wifi_platform_data *)(pdev->dev.platform_data);
105 +
106 +       printk(KERN_DEBUG "Pandora WiFi: Remove started\n");
107 +       if (!wifi_ctrl)
108 +               return -ENODEV;
109 +
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 */
116 +
117 +       printk(KERN_DEBUG "Pandora WiFi: Remove finished\n");
118 +       return 0;
119 +}
120 +
121 +static struct platform_driver wifi_device = {
122 +       .probe          = wifi_probe,
123 +       .remove         = wifi_remove,
124 +       .driver         = {
125 +       .name   = "pandora_wifi",
126 +       },
127 +};
128 +
129 +static int __init pandora_wifi_sdio_init(void)
130 +{
131 +       return platform_driver_register(&wifi_device);
132 +}
133 +
134 +static void __exit pandora_wifi_sdio_exit(void)
135 +{
136 +       platform_driver_unregister(&wifi_device);
137 +}
138 +
139 +module_init(pandora_wifi_sdio_init);
140 +module_exit(pandora_wifi_sdio_exit);
141 +MODULE_LICENSE("GPL");
142 -- 
143 1.6.3.1
144