blob: 92caa7ce6053efc1c36227553b03b05e61844cbe [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
Alexey Dobriyana6b7a402011-06-06 10:43:46 +000024#include <linux/interrupt.h>
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +020025#include <linux/irq.h>
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030026#include <linux/module.h>
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027#include <linux/crc7.h>
28#include <linux/spi/spi.h>
Ohad Ben-Cohenc1f9a092010-09-16 13:16:02 +020029#include <linux/wl12xx.h>
Felipe Balbi0969d672011-10-05 09:29:13 +030030#include <linux/platform_device.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090031#include <linux/slab.h>
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030032
Shahar Levi00d20102010-11-08 11:20:10 +000033#include "wl12xx.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030034#include "wl12xx_80211.h"
Shahar Levi00d20102010-11-08 11:20:10 +000035#include "io.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030036
Shahar Levi00d20102010-11-08 11:20:10 +000037#include "reg.h"
Teemu Paasikivi760d9692010-02-22 08:38:25 +020038
39#define WSPI_CMD_READ 0x40000000
40#define WSPI_CMD_WRITE 0x00000000
41#define WSPI_CMD_FIXED 0x20000000
42#define WSPI_CMD_BYTE_LENGTH 0x1FFE0000
43#define WSPI_CMD_BYTE_LENGTH_OFFSET 17
44#define WSPI_CMD_BYTE_ADDR 0x0001FFFF
45
46#define WSPI_INIT_CMD_CRC_LEN 5
47
48#define WSPI_INIT_CMD_START 0x00
49#define WSPI_INIT_CMD_TX 0x40
50/* the extra bypass bit is sampled by the TNET as '1' */
51#define WSPI_INIT_CMD_BYPASS_BIT 0x80
52#define WSPI_INIT_CMD_FIXEDBUSY_LEN 0x07
53#define WSPI_INIT_CMD_EN_FIXEDBUSY 0x80
54#define WSPI_INIT_CMD_DIS_FIXEDBUSY 0x00
55#define WSPI_INIT_CMD_IOD 0x40
56#define WSPI_INIT_CMD_IP 0x20
57#define WSPI_INIT_CMD_CS 0x10
58#define WSPI_INIT_CMD_WS 0x08
59#define WSPI_INIT_CMD_WSPI 0x01
60#define WSPI_INIT_CMD_END 0x01
61
62#define WSPI_INIT_CMD_LEN 8
63
64#define HW_ACCESS_WSPI_FIXED_BUSY_LEN \
65 ((WL1271_BUSY_WORD_LEN - 4) / sizeof(u32))
66#define HW_ACCESS_WSPI_INIT_CMD_MASK 0
67
Ido Yariv5c57a902010-09-30 13:28:26 +020068/* HW limitation: maximum possible chunk size is 4095 bytes */
69#define WSPI_MAX_CHUNK_SIZE 4092
70
71#define WSPI_MAX_NUM_OF_CHUNKS (WL1271_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE)
72
Felipe Balbib65019f2011-10-04 23:36:47 +030073struct wl12xx_spi_glue {
74 struct device *dev;
Felipe Balbi0969d672011-10-05 09:29:13 +030075 struct platform_device *core;
Felipe Balbib65019f2011-10-04 23:36:47 +030076};
77
Felipe Balbia390e852011-10-06 10:07:44 +030078static void wl12xx_spi_reset(struct device *child)
Teemu Paasikivi8197b712010-02-22 08:38:23 +020079{
Felipe Balbia390e852011-10-06 10:07:44 +030080 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030081 u8 *cmd;
82 struct spi_transfer t;
83 struct spi_message m;
84
85 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
86 if (!cmd) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +030087 dev_err(child->parent,
88 "could not allocate cmd for spi reset\n");
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030089 return;
90 }
91
92 memset(&t, 0, sizeof(t));
93 spi_message_init(&m);
94
95 memset(cmd, 0xff, WSPI_INIT_CMD_LEN);
96
97 t.tx_buf = cmd;
98 t.len = WSPI_INIT_CMD_LEN;
99 spi_message_add_tail(&t, &m);
100
Felipe Balbib65019f2011-10-04 23:36:47 +0300101 spi_sync(to_spi_device(glue->dev), &m);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300102
Dan Carpenter0dd38662010-12-21 07:00:13 +0300103 kfree(cmd);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300104}
105
Felipe Balbia390e852011-10-06 10:07:44 +0300106static void wl12xx_spi_init(struct device *child)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300107{
Felipe Balbia390e852011-10-06 10:07:44 +0300108 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300109 u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd;
110 struct spi_transfer t;
111 struct spi_message m;
112
113 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
114 if (!cmd) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300115 dev_err(child->parent,
116 "could not allocate cmd for spi init\n");
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300117 return;
118 }
119
120 memset(crc, 0, sizeof(crc));
121 memset(&t, 0, sizeof(t));
122 spi_message_init(&m);
123
124 /*
125 * Set WSPI_INIT_COMMAND
126 * the data is being send from the MSB to LSB
127 */
128 cmd[2] = 0xff;
129 cmd[3] = 0xff;
130 cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX;
131 cmd[0] = 0;
132 cmd[7] = 0;
133 cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3;
134 cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN;
135
136 if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0)
137 cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY;
138 else
139 cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY;
140
141 cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS
142 | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS;
143
144 crc[0] = cmd[1];
145 crc[1] = cmd[0];
146 crc[2] = cmd[7];
147 crc[3] = cmd[6];
148 crc[4] = cmd[5];
149
150 cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1;
151 cmd[4] |= WSPI_INIT_CMD_END;
152
153 t.tx_buf = cmd;
154 t.len = WSPI_INIT_CMD_LEN;
155 spi_message_add_tail(&t, &m);
156
Felipe Balbib65019f2011-10-04 23:36:47 +0300157 spi_sync(to_spi_device(glue->dev), &m);
Kulikov Vasiliybb123612010-07-31 20:33:59 +0400158 kfree(cmd);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300159}
160
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300161#define WL1271_BUSY_WORD_TIMEOUT 1000
162
Felipe Balbia390e852011-10-06 10:07:44 +0300163static int wl12xx_spi_read_busy(struct device *child)
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300164{
Felipe Balbia390e852011-10-06 10:07:44 +0300165 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
166 struct wl1271 *wl = dev_get_drvdata(child);
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300167 struct spi_transfer t[1];
168 struct spi_message m;
169 u32 *busy_buf;
170 int num_busy_bytes = 0;
171
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300172 /*
173 * Read further busy words from SPI until a non-busy word is
174 * encountered, then read the data itself into the buffer.
175 */
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300176
177 num_busy_bytes = WL1271_BUSY_WORD_TIMEOUT;
178 busy_buf = wl->buffer_busyword;
179 while (num_busy_bytes) {
180 num_busy_bytes--;
181 spi_message_init(&m);
182 memset(t, 0, sizeof(t));
183 t[0].rx_buf = busy_buf;
184 t[0].len = sizeof(u32);
Juuso Oikarinen259da432010-03-26 12:53:18 +0200185 t[0].cs_change = true;
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300186 spi_message_add_tail(&t[0], &m);
Felipe Balbib65019f2011-10-04 23:36:47 +0300187 spi_sync(to_spi_device(glue->dev), &m);
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300188
Juuso Oikarinen259da432010-03-26 12:53:18 +0200189 if (*busy_buf & 0x1)
190 return 0;
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300191 }
192
193 /* The SPI bus is unresponsive, the read failed. */
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300194 dev_err(child->parent, "SPI read busy-word timeout!\n");
Juuso Oikarinen259da432010-03-26 12:53:18 +0200195 return -ETIMEDOUT;
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300196}
197
Felipe Balbia390e852011-10-06 10:07:44 +0300198static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
Juuso Oikarinen259da432010-03-26 12:53:18 +0200199 size_t len, bool fixed)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300200{
Felipe Balbia390e852011-10-06 10:07:44 +0300201 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
202 struct wl1271 *wl = dev_get_drvdata(child);
Ido Yariv5c57a902010-09-30 13:28:26 +0200203 struct spi_transfer t[2];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300204 struct spi_message m;
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300205 u32 *busy_buf;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300206 u32 *cmd;
Ido Yariv5c57a902010-09-30 13:28:26 +0200207 u32 chunk_len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300208
Ido Yariv5c57a902010-09-30 13:28:26 +0200209 while (len > 0) {
210 chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300211
Ido Yariv5c57a902010-09-30 13:28:26 +0200212 cmd = &wl->buffer_cmd;
213 busy_buf = wl->buffer_busyword;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300214
Ido Yariv5c57a902010-09-30 13:28:26 +0200215 *cmd = 0;
216 *cmd |= WSPI_CMD_READ;
217 *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) &
218 WSPI_CMD_BYTE_LENGTH;
219 *cmd |= addr & WSPI_CMD_BYTE_ADDR;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300220
Ido Yariv5c57a902010-09-30 13:28:26 +0200221 if (fixed)
222 *cmd |= WSPI_CMD_FIXED;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300223
Ido Yariv5c57a902010-09-30 13:28:26 +0200224 spi_message_init(&m);
225 memset(t, 0, sizeof(t));
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300226
Ido Yariv5c57a902010-09-30 13:28:26 +0200227 t[0].tx_buf = cmd;
228 t[0].len = 4;
229 t[0].cs_change = true;
230 spi_message_add_tail(&t[0], &m);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300231
Ido Yariv5c57a902010-09-30 13:28:26 +0200232 /* Busy and non busy words read */
233 t[1].rx_buf = busy_buf;
234 t[1].len = WL1271_BUSY_WORD_LEN;
235 t[1].cs_change = true;
236 spi_message_add_tail(&t[1], &m);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300237
Felipe Balbib65019f2011-10-04 23:36:47 +0300238 spi_sync(to_spi_device(glue->dev), &m);
Ido Yariv5c57a902010-09-30 13:28:26 +0200239
240 if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) &&
Felipe Balbia390e852011-10-06 10:07:44 +0300241 wl12xx_spi_read_busy(child)) {
Ido Yariv5c57a902010-09-30 13:28:26 +0200242 memset(buf, 0, chunk_len);
243 return;
244 }
245
246 spi_message_init(&m);
247 memset(t, 0, sizeof(t));
248
249 t[0].rx_buf = buf;
250 t[0].len = chunk_len;
251 t[0].cs_change = true;
252 spi_message_add_tail(&t[0], &m);
253
Felipe Balbib65019f2011-10-04 23:36:47 +0300254 spi_sync(to_spi_device(glue->dev), &m);
Ido Yariv5c57a902010-09-30 13:28:26 +0200255
Ido Yariv5c57a902010-09-30 13:28:26 +0200256 if (!fixed)
257 addr += chunk_len;
258 buf += chunk_len;
259 len -= chunk_len;
Juuso Oikarinen259da432010-03-26 12:53:18 +0200260 }
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300261}
262
Felipe Balbia390e852011-10-06 10:07:44 +0300263static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf,
264 size_t len, bool fixed)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300265{
Felipe Balbia390e852011-10-06 10:07:44 +0300266 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
Ido Yariv5c57a902010-09-30 13:28:26 +0200267 struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300268 struct spi_message m;
Ido Yariv5c57a902010-09-30 13:28:26 +0200269 u32 commands[WSPI_MAX_NUM_OF_CHUNKS];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300270 u32 *cmd;
Ido Yariv5c57a902010-09-30 13:28:26 +0200271 u32 chunk_len;
272 int i;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300273
Ido Yariv5c57a902010-09-30 13:28:26 +0200274 WARN_ON(len > WL1271_AGGR_BUFFER_SIZE);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300275
276 spi_message_init(&m);
277 memset(t, 0, sizeof(t));
278
Ido Yariv5c57a902010-09-30 13:28:26 +0200279 cmd = &commands[0];
280 i = 0;
281 while (len > 0) {
282 chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300283
Ido Yariv5c57a902010-09-30 13:28:26 +0200284 *cmd = 0;
285 *cmd |= WSPI_CMD_WRITE;
286 *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) &
287 WSPI_CMD_BYTE_LENGTH;
288 *cmd |= addr & WSPI_CMD_BYTE_ADDR;
289
290 if (fixed)
291 *cmd |= WSPI_CMD_FIXED;
292
293 t[i].tx_buf = cmd;
294 t[i].len = sizeof(*cmd);
295 spi_message_add_tail(&t[i++], &m);
296
297 t[i].tx_buf = buf;
298 t[i].len = chunk_len;
299 spi_message_add_tail(&t[i++], &m);
300
Ido Yariv5c57a902010-09-30 13:28:26 +0200301 if (!fixed)
302 addr += chunk_len;
303 buf += chunk_len;
304 len -= chunk_len;
305 cmd++;
306 }
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300307
Felipe Balbib65019f2011-10-04 23:36:47 +0300308 spi_sync(to_spi_device(glue->dev), &m);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300309}
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200310
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200311static struct wl1271_if_operations spi_ops = {
Felipe Balbia390e852011-10-06 10:07:44 +0300312 .read = wl12xx_spi_raw_read,
313 .write = wl12xx_spi_raw_write,
314 .reset = wl12xx_spi_reset,
315 .init = wl12xx_spi_init,
Luciano Coelhoa81159e2011-03-14 14:05:13 +0200316 .set_block_size = NULL,
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200317};
318
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200319static int __devinit wl1271_probe(struct spi_device *spi)
320{
Felipe Balbib65019f2011-10-04 23:36:47 +0300321 struct wl12xx_spi_glue *glue;
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200322 struct wl12xx_platform_data *pdata;
Felipe Balbi0969d672011-10-05 09:29:13 +0300323 struct resource res[1];
Felipe Balbib65019f2011-10-04 23:36:47 +0300324 int ret = -ENOMEM;
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200325
326 pdata = spi->dev.platform_data;
327 if (!pdata) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300328 dev_err(&spi->dev, "no platform data\n");
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200329 return -ENODEV;
330 }
331
Felipe Balbia390e852011-10-06 10:07:44 +0300332 pdata->ops = &spi_ops;
333
Felipe Balbib65019f2011-10-04 23:36:47 +0300334 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
335 if (!glue) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300336 dev_err(&spi->dev, "can't allocate glue\n");
Felipe Balbib65019f2011-10-04 23:36:47 +0300337 goto out;
338 }
339
Felipe Balbib65019f2011-10-04 23:36:47 +0300340 glue->dev = &spi->dev;
Felipe Balbib65019f2011-10-04 23:36:47 +0300341
342 spi_set_drvdata(spi, glue);
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200343
344 /* This is the only SPI value that we need to set here, the rest
345 * comes from the board-peripherals file */
346 spi->bits_per_word = 32;
347
348 ret = spi_setup(spi);
349 if (ret < 0) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300350 dev_err(glue->dev, "spi_setup failed\n");
Felipe Balbia390e852011-10-06 10:07:44 +0300351 goto out_free_glue;
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200352 }
353
Luciano Coelhoccb62002011-10-07 15:54:15 +0300354 glue->core = platform_device_alloc("wl12xx", -1);
Felipe Balbi0969d672011-10-05 09:29:13 +0300355 if (!glue->core) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300356 dev_err(glue->dev, "can't allocate platform_device\n");
Felipe Balbi0969d672011-10-05 09:29:13 +0300357 ret = -ENOMEM;
Felipe Balbia390e852011-10-06 10:07:44 +0300358 goto out_free_glue;
Felipe Balbi0969d672011-10-05 09:29:13 +0300359 }
360
361 glue->core->dev.parent = &spi->dev;
362
363 memset(res, 0x00, sizeof(res));
364
365 res[0].start = spi->irq;
366 res[0].flags = IORESOURCE_IRQ;
367 res[0].name = "irq";
368
369 ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
370 if (ret) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300371 dev_err(glue->dev, "can't add resources\n");
Felipe Balbi0969d672011-10-05 09:29:13 +0300372 goto out_dev_put;
373 }
374
375 ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata));
376 if (ret) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300377 dev_err(glue->dev, "can't add platform data\n");
Felipe Balbi0969d672011-10-05 09:29:13 +0300378 goto out_dev_put;
379 }
380
381 ret = platform_device_add(glue->core);
382 if (ret) {
Luciano Coelhoe5d36252011-10-07 14:33:29 +0300383 dev_err(glue->dev, "can't register platform device\n");
Felipe Balbi0969d672011-10-05 09:29:13 +0300384 goto out_dev_put;
385 }
386
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200387 return 0;
388
Felipe Balbi0969d672011-10-05 09:29:13 +0300389out_dev_put:
390 platform_device_put(glue->core);
391
Felipe Balbib65019f2011-10-04 23:36:47 +0300392out_free_glue:
393 kfree(glue);
394out:
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200395 return ret;
396}
397
398static int __devexit wl1271_remove(struct spi_device *spi)
399{
Felipe Balbib65019f2011-10-04 23:36:47 +0300400 struct wl12xx_spi_glue *glue = spi_get_drvdata(spi);
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200401
Felipe Balbi0969d672011-10-05 09:29:13 +0300402 platform_device_del(glue->core);
403 platform_device_put(glue->core);
Felipe Balbib65019f2011-10-04 23:36:47 +0300404 kfree(glue);
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200405
406 return 0;
407}
408
409
410static struct spi_driver wl1271_spi_driver = {
411 .driver = {
Luciano Coelho7fdd50d2010-03-26 12:53:10 +0200412 .name = "wl1271_spi",
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200413 .owner = THIS_MODULE,
414 },
415
416 .probe = wl1271_probe,
417 .remove = __devexit_p(wl1271_remove),
418};
419
420static int __init wl1271_init(void)
421{
Felipe Balbiba2274c2011-05-14 00:26:23 +0300422 return spi_register_driver(&wl1271_spi_driver);
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200423}
424
425static void __exit wl1271_exit(void)
426{
427 spi_unregister_driver(&wl1271_spi_driver);
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200428}
429
430module_init(wl1271_init);
431module_exit(wl1271_exit);
432
433MODULE_LICENSE("GPL");
Luciano Coelho5245e3a2011-03-30 21:31:39 +0300434MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
Teemu Paasikivi2d5e82b2010-02-22 08:38:21 +0200435MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
Arik Nemtsovc302b2c2011-08-17 10:45:48 +0300436MODULE_FIRMWARE(WL127X_FW_NAME);
Shahar Levi5aa42342011-03-06 16:32:07 +0200437MODULE_FIRMWARE(WL128X_FW_NAME);
Ameya Palandef148cfd2010-07-05 17:12:38 +0300438MODULE_ALIAS("spi:wl1271");