aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-08-07 06:33:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:37 -0400
commitaf8c78ebbf2a15ecf9b2b6b7b051b0d4c3ba1163 (patch)
tree8f791d64357218b6ac6a97758b0eb3efb7358fcc /drivers
parent8e639c0673a9b676bb7c6bd4e50f9003bdda423e (diff)
wl1251: split spi interface into separate module
This creates a module called wl1251_spi.ko which contains just the SPI-specific code. The core remains in the module wl1251.ko. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/Kconfig17
-rw-r--r--drivers/net/wireless/wl12xx/Makefile4
-rw-r--r--drivers/net/wireless/wl12xx/wl1251.h2
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_main.c9
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_spi.c17
5 files changed, 38 insertions, 11 deletions
diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
index af31eabad18b..f8cb8b864ad2 100644
--- a/drivers/net/wireless/wl12xx/Kconfig
+++ b/drivers/net/wireless/wl12xx/Kconfig
@@ -7,15 +7,26 @@ menuconfig WL12XX
7 7
8config WL1251 8config WL1251
9 tristate "TI wl1251 support" 9 tristate "TI wl1251 support"
10 depends on WL12XX && SPI_MASTER && GENERIC_HARDIRQS 10 depends on WL12XX && GENERIC_HARDIRQS
11 select FW_LOADER 11 select FW_LOADER
12 select CRC7 12 select CRC7
13 ---help--- 13 ---help---
14 This module adds support for wireless adapters based on 14 This module adds support for wireless adapters based on
15 TI wl1251 chipset. 15 TI wl1251 chipset.
16 16
17 If you choose to build a module, it'll be called wl1251. Say N if 17 If you choose to build a module, it'll be called wl1251. Say
18 unsure. 18 N if unsure.
19
20config WL1251_SPI
21 tristate "TI wl1251 SPI support"
22 depends on WL1251 && SPI_MASTER
23 ---help---
24 This module adds support for the SPI interface of adapters using
25 TI wl1251 chipset. Select this if your platform is using
26 the SPI bus.
27
28 If you choose to build a module, it'll be called wl1251_spi.
29 Say N if unsure.
19 30
20config WL1271 31config WL1271
21 tristate "TI wl1271 support" 32 tristate "TI wl1271 support"
diff --git a/drivers/net/wireless/wl12xx/Makefile b/drivers/net/wireless/wl12xx/Makefile
index a1a15cef7351..ea0477f1d1da 100644
--- a/drivers/net/wireless/wl12xx/Makefile
+++ b/drivers/net/wireless/wl12xx/Makefile
@@ -1,8 +1,10 @@
1wl1251-objs = wl1251_main.o wl1251_spi.o wl1251_event.o \ 1wl1251-objs = wl1251_main.o wl1251_event.o \
2 wl1251_tx.o wl1251_rx.o wl1251_ps.o wl1251_cmd.o \ 2 wl1251_tx.o wl1251_rx.o wl1251_ps.o wl1251_cmd.o \
3 wl1251_acx.o wl1251_boot.o wl1251_init.o \ 3 wl1251_acx.o wl1251_boot.o wl1251_init.o \
4 wl1251_ops.o wl1251_debugfs.o wl1251_io.o 4 wl1251_ops.o wl1251_debugfs.o wl1251_io.o
5
5obj-$(CONFIG_WL1251) += wl1251.o 6obj-$(CONFIG_WL1251) += wl1251.o
7obj-$(CONFIG_WL1251_SPI) += wl1251_spi.o
6 8
7wl1271-objs = wl1271_main.o wl1271_spi.o wl1271_cmd.o \ 9wl1271-objs = wl1271_main.o wl1271_spi.o wl1271_cmd.o \
8 wl1271_event.o wl1271_tx.o wl1271_rx.o \ 10 wl1271_event.o wl1271_tx.o wl1271_rx.o \
diff --git a/drivers/net/wireless/wl12xx/wl1251.h b/drivers/net/wireless/wl12xx/wl1251.h
index df4c06d41678..ebe2c70559cd 100644
--- a/drivers/net/wireless/wl12xx/wl1251.h
+++ b/drivers/net/wireless/wl12xx/wl1251.h
@@ -291,7 +291,7 @@ struct wl1251 {
291 struct ieee80211_hw *hw; 291 struct ieee80211_hw *hw;
292 bool mac80211_registered; 292 bool mac80211_registered;
293 293
294 struct spi_device *spi; 294 void *if_priv;
295 const struct wl1251_if_operations *if_ops; 295 const struct wl1251_if_operations *if_ops;
296 296
297 void (*set_power)(bool enable); 297 void (*set_power)(bool enable);
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 74544e11f692..abe157a174c7 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -69,6 +69,7 @@ irqreturn_t wl1251_irq(int irq, void *cookie)
69 69
70 return IRQ_HANDLED; 70 return IRQ_HANDLED;
71} 71}
72EXPORT_SYMBOL_GPL(wl1251_irq);
72 73
73static int wl1251_fetch_firmware(struct wl1251 *wl) 74static int wl1251_fetch_firmware(struct wl1251 *wl)
74{ 75{
@@ -1198,6 +1199,7 @@ int wl1251_init_ieee80211(struct wl1251 *wl)
1198out: 1199out:
1199 return ret; 1200 return ret;
1200} 1201}
1202EXPORT_SYMBOL_GPL(wl1251_init_ieee80211);
1201 1203
1202#define WL1251_DEFAULT_CHANNEL 1 1204#define WL1251_DEFAULT_CHANNEL 1
1203struct ieee80211_hw *wl1251_alloc_hw(void) 1205struct ieee80211_hw *wl1251_alloc_hw(void)
@@ -1270,6 +1272,7 @@ struct ieee80211_hw *wl1251_alloc_hw(void)
1270 1272
1271 return hw; 1273 return hw;
1272} 1274}
1275EXPORT_SYMBOL_GPL(wl1251_alloc_hw);
1273 1276
1274int wl1251_free_hw(struct wl1251 *wl) 1277int wl1251_free_hw(struct wl1251 *wl)
1275{ 1278{
@@ -1292,3 +1295,9 @@ int wl1251_free_hw(struct wl1251 *wl)
1292 1295
1293 return 0; 1296 return 0;
1294} 1297}
1298EXPORT_SYMBOL_GPL(wl1251_free_hw);
1299
1300MODULE_DESCRIPTION("TI wl1251 Wireles LAN Driver Core");
1301MODULE_LICENSE("GPL");
1302MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>");
1303MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>");
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index 13e7a726dea2..5967317ef025 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -31,6 +31,11 @@
31#include "reg.h" 31#include "reg.h"
32#include "wl1251_spi.h" 32#include "wl1251_spi.h"
33 33
34static struct spi_device *wl_to_spi(struct wl1251 *wl)
35{
36 return wl->if_priv;
37}
38
34static void wl1251_spi_reset(struct wl1251 *wl) 39static void wl1251_spi_reset(struct wl1251 *wl)
35{ 40{
36 u8 *cmd; 41 u8 *cmd;
@@ -52,7 +57,7 @@ static void wl1251_spi_reset(struct wl1251 *wl)
52 t.len = WSPI_INIT_CMD_LEN; 57 t.len = WSPI_INIT_CMD_LEN;
53 spi_message_add_tail(&t, &m); 58 spi_message_add_tail(&t, &m);
54 59
55 spi_sync(wl->spi, &m); 60 spi_sync(wl_to_spi(wl), &m);
56 61
57 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); 62 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
58} 63}
@@ -106,7 +111,7 @@ static void wl1251_spi_wake(struct wl1251 *wl)
106 t.len = WSPI_INIT_CMD_LEN; 111 t.len = WSPI_INIT_CMD_LEN;
107 spi_message_add_tail(&t, &m); 112 spi_message_add_tail(&t, &m);
108 113
109 spi_sync(wl->spi, &m); 114 spi_sync(wl_to_spi(wl), &m);
110 115
111 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); 116 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
112} 117}
@@ -149,7 +154,7 @@ static void wl1251_spi_read(struct wl1251 *wl, int addr, void *buf,
149 t[2].len = len; 154 t[2].len = len;
150 spi_message_add_tail(&t[2], &m); 155 spi_message_add_tail(&t[2], &m);
151 156
152 spi_sync(wl->spi, &m); 157 spi_sync(wl_to_spi(wl), &m);
153 158
154 /* FIXME: check busy words */ 159 /* FIXME: check busy words */
155 160
@@ -182,13 +187,13 @@ static void wl1251_spi_write(struct wl1251 *wl, int addr, void *buf,
182 t[1].len = len; 187 t[1].len = len;
183 spi_message_add_tail(&t[1], &m); 188 spi_message_add_tail(&t[1], &m);
184 189
185 spi_sync(wl->spi, &m); 190 spi_sync(wl_to_spi(wl), &m);
186 191
187 wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); 192 wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd));
188 wl1251_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); 193 wl1251_dump(DEBUG_SPI, "spi_write buf -> ", buf, len);
189} 194}
190 195
191const struct wl1251_if_operations wl1251_spi_ops = { 196static const struct wl1251_if_operations wl1251_spi_ops = {
192 .read = wl1251_spi_read, 197 .read = wl1251_spi_read,
193 .write = wl1251_spi_write, 198 .write = wl1251_spi_write,
194 .reset = wl1251_spi_reset_wake, 199 .reset = wl1251_spi_reset_wake,
@@ -215,7 +220,7 @@ static int __devinit wl1251_spi_probe(struct spi_device *spi)
215 220
216 SET_IEEE80211_DEV(hw, &spi->dev); 221 SET_IEEE80211_DEV(hw, &spi->dev);
217 dev_set_drvdata(&spi->dev, wl); 222 dev_set_drvdata(&spi->dev, wl);
218 wl->spi = spi; 223 wl->if_priv = spi;
219 wl->if_ops = &wl1251_spi_ops; 224 wl->if_ops = &wl1251_spi_ops;
220 225
221 /* This is the only SPI value that we need to set here, the rest 226 /* This is the only SPI value that we need to set here, the rest