]> bbs.cooldavid.org Git - net-next-2.6.git/blob - drivers/misc/iwmc3200top/main.c
02b3dadc8abd9b5aa3909208375636bb197b88be
[net-next-2.6.git] / drivers / misc / iwmc3200top / main.c
1 /*
2  * iwmc3200top - Intel Wireless MultiCom 3200 Top Driver
3  * drivers/misc/iwmc3200top/main.c
4  *
5  * Copyright (C) 2009 Intel Corporation. All rights reserved.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version
9  * 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  *
21  *
22  * Author Name: Maxim Grabarnik <maxim.grabarnink@intel.com>
23  *  -
24  *
25  */
26
27 #include <linux/module.h>
28 #include <linux/init.h>
29 #include <linux/kernel.h>
30 #include <linux/debugfs.h>
31 #include <linux/mmc/sdio_ids.h>
32 #include <linux/mmc/sdio_func.h>
33 #include <linux/mmc/sdio.h>
34
35 #include "iwmc3200top.h"
36 #include "log.h"
37 #include "fw-msg.h"
38 #include "debugfs.h"
39
40
41 #define DRIVER_DESCRIPTION "Intel(R) IWMC 3200 Top Driver"
42 #define DRIVER_COPYRIGHT "Copyright (c) 2008 Intel Corporation."
43
44 #define DRIVER_VERSION  "0.1.62"
45
46 MODULE_DESCRIPTION(DRIVER_DESCRIPTION);
47 MODULE_VERSION(DRIVER_VERSION);
48 MODULE_LICENSE("GPL");
49 MODULE_AUTHOR(DRIVER_COPYRIGHT);
50
51 /*
52  * This workers main task is to wait for OP_OPR_ALIVE
53  * from TOP FW until ALIVE_MSG_TIMOUT timeout is elapsed.
54  * When OP_OPR_ALIVE received it will issue
55  * a call to "bus_rescan_devices".
56  */
57 static void iwmct_rescan_worker(struct work_struct *ws)
58 {
59         struct iwmct_priv *priv;
60         int ret;
61
62         priv = container_of(ws, struct iwmct_priv, bus_rescan_worker);
63
64         LOG_INFO(priv, FW_MSG, "Calling bus_rescan\n");
65
66         ret = bus_rescan_devices(priv->func->dev.bus);
67         if (ret < 0)
68                 LOG_INFO(priv, FW_DOWNLOAD, "bus_rescan_devices FAILED!!!\n");
69 }
70
71 static void op_top_message(struct iwmct_priv *priv, struct top_msg *msg)
72 {
73         switch (msg->hdr.opcode) {
74         case OP_OPR_ALIVE:
75                 LOG_INFO(priv, FW_MSG, "Got ALIVE from device, wake rescan\n");
76                 queue_work(priv->bus_rescan_wq, &priv->bus_rescan_worker);
77                 break;
78         default:
79                 LOG_INFO(priv, FW_MSG, "Received msg opcode 0x%X\n",
80                         msg->hdr.opcode);
81                 break;
82         }
83 }
84
85
86 static void handle_top_message(struct iwmct_priv *priv, u8 *buf, int len)
87 {
88         struct top_msg *msg;
89
90         msg = (struct top_msg *)buf;
91
92         if (msg->hdr.type != COMM_TYPE_D2H) {
93                 LOG_ERROR(priv, FW_MSG,
94                         "Message from TOP with invalid message type 0x%X\n",
95                         msg->hdr.type);
96                 return;
97         }
98
99         if (len < sizeof(msg->hdr)) {
100                 LOG_ERROR(priv, FW_MSG,
101                         "Message from TOP is too short for message header "
102                         "received %d bytes, expected at least %zd bytes\n",
103                         len, sizeof(msg->hdr));
104                 return;
105         }
106
107         if (len < le16_to_cpu(msg->hdr.length) + sizeof(msg->hdr)) {
108                 LOG_ERROR(priv, FW_MSG,
109                         "Message length (%d bytes) is shorter than "
110                         "in header (%d bytes)\n",
111                         len, le16_to_cpu(msg->hdr.length));
112                 return;
113         }
114
115         switch (msg->hdr.category) {
116         case COMM_CATEGORY_OPERATIONAL:
117                 op_top_message(priv, (struct top_msg *)buf);
118                 break;
119
120         case COMM_CATEGORY_DEBUG:
121         case COMM_CATEGORY_TESTABILITY:
122         case COMM_CATEGORY_DIAGNOSTICS:
123                 iwmct_log_top_message(priv, buf, len);
124                 break;
125
126         default:
127                 LOG_ERROR(priv, FW_MSG,
128                         "Message from TOP with unknown category 0x%X\n",
129                         msg->hdr.category);
130                 break;
131         }
132 }
133
134 int iwmct_send_hcmd(struct iwmct_priv *priv, u8 *cmd, u16 len)
135 {
136         int ret;
137         u8 *buf;
138
139         LOG_INFOEX(priv, FW_MSG, "Sending hcmd:\n");
140
141         /* add padding to 256 for IWMC */
142         ((struct top_msg *)cmd)->hdr.flags |= CMD_FLAG_PADDING_256;
143
144         LOG_HEXDUMP(FW_MSG, cmd, len);
145
146         if (len > FW_HCMD_BLOCK_SIZE) {
147                 LOG_ERROR(priv, FW_MSG, "size %d exceeded hcmd max size %d\n",
148                           len, FW_HCMD_BLOCK_SIZE);
149                 return -1;
150         }
151
152         buf = kzalloc(FW_HCMD_BLOCK_SIZE, GFP_KERNEL);
153         if (!buf) {
154                 LOG_ERROR(priv, FW_MSG, "kzalloc error, buf size %d\n",
155                           FW_HCMD_BLOCK_SIZE);
156                 return -1;
157         }
158
159         memcpy(buf, cmd, len);
160
161         sdio_claim_host(priv->func);
162         ret = sdio_memcpy_toio(priv->func, IWMC_SDIO_DATA_ADDR, buf,
163                                FW_HCMD_BLOCK_SIZE);
164         sdio_release_host(priv->func);
165
166         kfree(buf);
167         return ret;
168 }
169
170 int iwmct_tx(struct iwmct_priv *priv, unsigned int addr,
171         void *src, int count)
172 {
173         int ret;
174
175         sdio_claim_host(priv->func);
176         ret = sdio_memcpy_toio(priv->func, addr, src, count);
177         sdio_release_host(priv->func);
178
179         return ret;
180 }
181
182 static void iwmct_irq_read_worker(struct work_struct *ws)
183 {
184         struct iwmct_priv *priv;
185         struct iwmct_work_struct *read_req;
186         __le32 *buf = NULL;
187         int ret;
188         int iosize;
189         u32 barker;
190         bool is_barker;
191
192         priv = container_of(ws, struct iwmct_priv, isr_worker);
193
194         LOG_INFO(priv, IRQ, "enter iwmct_irq_read_worker %p\n", ws);
195
196         /* --------------------- Handshake with device -------------------- */
197         sdio_claim_host(priv->func);
198
199         /* all list manipulations have to be protected by
200          * sdio_claim_host/sdio_release_host */
201         if (list_empty(&priv->read_req_list)) {
202                 LOG_ERROR(priv, IRQ, "read_req_list empty in read worker\n");
203                 goto exit_release;
204         }
205
206         read_req = list_entry(priv->read_req_list.next,
207                               struct iwmct_work_struct, list);
208
209         list_del(&read_req->list);
210         iosize = read_req->iosize;
211         kfree(read_req);
212
213         buf = kzalloc(iosize, GFP_KERNEL);
214         if (!buf) {
215                 LOG_ERROR(priv, IRQ, "kzalloc error, buf size %d\n", iosize);
216                 goto exit_release;
217         }
218
219         LOG_INFO(priv, IRQ, "iosize=%d, buf=%p, func=%d\n",
220                                 iosize, buf, priv->func->num);
221
222         /* read from device */
223         ret = sdio_memcpy_fromio(priv->func, buf, IWMC_SDIO_DATA_ADDR, iosize);
224         if (ret) {
225                 LOG_ERROR(priv, IRQ, "error %d reading buffer\n", ret);
226                 goto exit_release;
227         }
228
229         LOG_HEXDUMP(IRQ, (u8 *)buf, iosize);
230
231         barker = le32_to_cpu(buf[0]);
232
233         /* Verify whether it's a barker and if not - treat as regular Rx */
234         if (barker == IWMC_BARKER_ACK ||
235             (barker & BARKER_DNLOAD_BARKER_MSK) == IWMC_BARKER_REBOOT) {
236
237                 /* Valid Barker is equal on first 4 dwords */
238                 is_barker = (buf[1] == buf[0]) &&
239                             (buf[2] == buf[0]) &&
240                             (buf[3] == buf[0]);
241
242                 if (!is_barker) {
243                         LOG_WARNING(priv, IRQ,
244                                 "Potentially inconsistent barker "
245                                 "%08X_%08X_%08X_%08X\n",
246                                 le32_to_cpu(buf[0]), le32_to_cpu(buf[1]),
247                                 le32_to_cpu(buf[2]), le32_to_cpu(buf[3]));
248                 }
249         } else {
250                 is_barker = false;
251         }
252
253         /* Handle Top CommHub message */
254         if (!is_barker) {
255                 sdio_release_host(priv->func);
256                 handle_top_message(priv, (u8 *)buf, iosize);
257                 goto exit;
258         } else if (barker == IWMC_BARKER_ACK) { /* Handle barkers */
259                 if (atomic_read(&priv->dev_sync) == 0) {
260                         LOG_ERROR(priv, IRQ,
261                                   "ACK barker arrived out-of-sync\n");
262                         goto exit_release;
263                 }
264
265                 /* Continuing to FW download (after Sync is completed)*/
266                 atomic_set(&priv->dev_sync, 0);
267                 LOG_INFO(priv, IRQ, "ACK barker arrived "
268                                 "- starting FW download\n");
269         } else { /* REBOOT barker */
270                 LOG_INFO(priv, IRQ, "Recieved reboot barker: %x\n", barker);
271                 priv->barker = barker;
272
273                 if (barker & BARKER_DNLOAD_SYNC_MSK) {
274                         /* Send the same barker back */
275                         ret = sdio_memcpy_toio(priv->func, IWMC_SDIO_DATA_ADDR,
276                                                buf, iosize);
277                         if (ret) {
278                                 LOG_ERROR(priv, IRQ,
279                                          "error %d echoing barker\n", ret);
280                                 goto exit_release;
281                         }
282                         LOG_INFO(priv, IRQ, "Echoing barker to device\n");
283                         atomic_set(&priv->dev_sync, 1);
284                         goto exit_release;
285                 }
286
287                 /* Continuing to FW download (without Sync) */
288                 LOG_INFO(priv, IRQ, "No sync requested "
289                                     "- starting FW download\n");
290         }
291
292         sdio_release_host(priv->func);
293
294
295         LOG_INFO(priv, IRQ, "barker download request 0x%x is:\n", priv->barker);
296         LOG_INFO(priv, IRQ, "*******  Top FW %s requested ********\n",
297                         (priv->barker & BARKER_DNLOAD_TOP_MSK) ? "was" : "not");
298         LOG_INFO(priv, IRQ, "*******  GPS FW %s requested ********\n",
299                         (priv->barker & BARKER_DNLOAD_GPS_MSK) ? "was" : "not");
300         LOG_INFO(priv, IRQ, "*******  BT FW %s requested ********\n",
301                         (priv->barker & BARKER_DNLOAD_BT_MSK) ? "was" : "not");
302
303         if (priv->dbg.fw_download)
304                 iwmct_fw_load(priv);
305         else
306                 LOG_ERROR(priv, IRQ, "FW download not allowed\n");
307
308         goto exit;
309
310 exit_release:
311         sdio_release_host(priv->func);
312 exit:
313         kfree(buf);
314         LOG_INFO(priv, IRQ, "exit iwmct_irq_read_worker\n");
315 }
316
317 static void iwmct_irq(struct sdio_func *func)
318 {
319         struct iwmct_priv *priv;
320         int val, ret;
321         int iosize;
322         int addr = IWMC_SDIO_INTR_GET_SIZE_ADDR;
323         struct iwmct_work_struct *read_req;
324
325         priv = sdio_get_drvdata(func);
326
327         LOG_INFO(priv, IRQ, "enter iwmct_irq\n");
328
329         /* read the function's status register */
330         val = sdio_readb(func, IWMC_SDIO_INTR_STATUS_ADDR, &ret);
331
332         LOG_INFO(priv, IRQ, "iir value = %d, ret=%d\n", val, ret);
333
334         if (!val) {
335                 LOG_ERROR(priv, IRQ, "iir = 0, exiting ISR\n");
336                 goto exit_clear_intr;
337         }
338
339
340         /*
341          * read 2 bytes of the transaction size
342          * IMPORTANT: sdio transaction size has to be read before clearing
343          * sdio interrupt!!!
344          */
345         val = sdio_readb(priv->func, addr++, &ret);
346         iosize = val;
347         val = sdio_readb(priv->func, addr++, &ret);
348         iosize += val << 8;
349
350         LOG_INFO(priv, IRQ, "READ size %d\n", iosize);
351
352         if (iosize == 0) {
353                 LOG_ERROR(priv, IRQ, "READ size %d, exiting ISR\n", iosize);
354                 goto exit_clear_intr;
355         }
356
357         /* allocate a work structure to pass iosize to the worker */
358         read_req = kzalloc(sizeof(struct iwmct_work_struct), GFP_KERNEL);
359         if (!read_req) {
360                 LOG_ERROR(priv, IRQ, "failed to allocate read_req, exit ISR\n");
361                 goto exit_clear_intr;
362         }
363
364         INIT_LIST_HEAD(&read_req->list);
365         read_req->iosize = iosize;
366
367         list_add_tail(&priv->read_req_list, &read_req->list);
368
369         /* clear the function's interrupt request bit (write 1 to clear) */
370         sdio_writeb(func, 1, IWMC_SDIO_INTR_CLEAR_ADDR, &ret);
371
372         queue_work(priv->wq, &priv->isr_worker);
373
374         LOG_INFO(priv, IRQ, "exit iwmct_irq\n");
375
376         return;
377
378 exit_clear_intr:
379         /* clear the function's interrupt request bit (write 1 to clear) */
380         sdio_writeb(func, 1, IWMC_SDIO_INTR_CLEAR_ADDR, &ret);
381 }
382
383
384 static int blocks;
385 module_param(blocks, int, 0604);
386 MODULE_PARM_DESC(blocks, "max_blocks_to_send");
387
388 static int dump;
389 module_param(dump, bool, 0604);
390 MODULE_PARM_DESC(dump, "dump_hex_content");
391
392 static int jump = 1;
393 module_param(jump, bool, 0604);
394
395 static int direct = 1;
396 module_param(direct, bool, 0604);
397
398 static int checksum = 1;
399 module_param(checksum, bool, 0604);
400
401 static int fw_download = 1;
402 module_param(fw_download, bool, 0604);
403
404 static int block_size = IWMC_SDIO_BLK_SIZE;
405 module_param(block_size, int, 0404);
406
407 static int download_trans_blks = IWMC_DEFAULT_TR_BLK;
408 module_param(download_trans_blks, int, 0604);
409
410 static int rubbish_barker;
411 module_param(rubbish_barker, bool, 0604);
412
413 #ifdef CONFIG_IWMC3200TOP_DEBUG
414 static int log_level[LOG_SRC_MAX];
415 static unsigned int log_level_argc;
416 module_param_array(log_level, int, &log_level_argc, 0604);
417 MODULE_PARM_DESC(log_level, "log_level");
418
419 static int log_level_fw[FW_LOG_SRC_MAX];
420 static unsigned int log_level_fw_argc;
421 module_param_array(log_level_fw, int, &log_level_fw_argc, 0604);
422 MODULE_PARM_DESC(log_level_fw, "log_level_fw");
423 #endif
424
425 void iwmct_dbg_init_params(struct iwmct_priv *priv)
426 {
427 #ifdef CONFIG_IWMC3200TOP_DEBUG
428         int i;
429
430         for (i = 0; i < log_level_argc; i++) {
431                 dev_notice(&priv->func->dev, "log_level[%d]=0x%X\n",
432                                                 i, log_level[i]);
433                 iwmct_log_set_filter((log_level[i] >> 8) & 0xFF,
434                                log_level[i] & 0xFF);
435         }
436         for (i = 0; i < log_level_fw_argc; i++) {
437                 dev_notice(&priv->func->dev, "log_level_fw[%d]=0x%X\n",
438                                                 i, log_level_fw[i]);
439                 iwmct_log_set_fw_filter((log_level_fw[i] >> 8) & 0xFF,
440                                   log_level_fw[i] & 0xFF);
441         }
442 #endif
443
444         priv->dbg.blocks = blocks;
445         LOG_INFO(priv, INIT, "blocks=%d\n", blocks);
446         priv->dbg.dump = (bool)dump;
447         LOG_INFO(priv, INIT, "dump=%d\n", dump);
448         priv->dbg.jump = (bool)jump;
449         LOG_INFO(priv, INIT, "jump=%d\n", jump);
450         priv->dbg.direct = (bool)direct;
451         LOG_INFO(priv, INIT, "direct=%d\n", direct);
452         priv->dbg.checksum = (bool)checksum;
453         LOG_INFO(priv, INIT, "checksum=%d\n", checksum);
454         priv->dbg.fw_download = (bool)fw_download;
455         LOG_INFO(priv, INIT, "fw_download=%d\n", fw_download);
456         priv->dbg.block_size = block_size;
457         LOG_INFO(priv, INIT, "block_size=%d\n", block_size);
458         priv->dbg.download_trans_blks = download_trans_blks;
459         LOG_INFO(priv, INIT, "download_trans_blks=%d\n", download_trans_blks);
460 }
461
462 /*****************************************************************************
463  *
464  * sysfs attributes
465  *
466  *****************************************************************************/
467 static ssize_t show_iwmct_fw_version(struct device *d,
468                                   struct device_attribute *attr, char *buf)
469 {
470         struct iwmct_priv *priv = dev_get_drvdata(d);
471         return sprintf(buf, "%s\n", priv->dbg.label_fw);
472 }
473 static DEVICE_ATTR(cc_label_fw, S_IRUGO, show_iwmct_fw_version, NULL);
474
475 #ifdef CONFIG_IWMC3200TOP_DEBUG
476 static DEVICE_ATTR(log_level, S_IWUSR | S_IRUGO,
477                    show_iwmct_log_level, store_iwmct_log_level);
478 static DEVICE_ATTR(log_level_fw, S_IWUSR | S_IRUGO,
479                    show_iwmct_log_level_fw, store_iwmct_log_level_fw);
480 #endif
481
482 static struct attribute *iwmct_sysfs_entries[] = {
483         &dev_attr_cc_label_fw.attr,
484 #ifdef CONFIG_IWMC3200TOP_DEBUG
485         &dev_attr_log_level.attr,
486         &dev_attr_log_level_fw.attr,
487 #endif
488         NULL
489 };
490
491 static struct attribute_group iwmct_attribute_group = {
492         .name = NULL,           /* put in device directory */
493         .attrs = iwmct_sysfs_entries,
494 };
495
496
497 static int iwmct_probe(struct sdio_func *func,
498                            const struct sdio_device_id *id)
499 {
500         struct iwmct_priv *priv;
501         int ret;
502         int val = 1;
503         int addr = IWMC_SDIO_INTR_ENABLE_ADDR;
504
505         dev_dbg(&func->dev, "enter iwmct_probe\n");
506
507         dev_dbg(&func->dev, "IRQ polling period id %u msecs, HZ is %d\n",
508                 jiffies_to_msecs(2147483647), HZ);
509
510         priv = kzalloc(sizeof(struct iwmct_priv), GFP_KERNEL);
511         if (!priv) {
512                 dev_err(&func->dev, "kzalloc error\n");
513                 return -ENOMEM;
514         }
515         priv->func = func;
516         sdio_set_drvdata(func, priv);
517
518
519         /* create drivers work queue */
520         priv->wq = create_workqueue(DRV_NAME "_wq");
521         priv->bus_rescan_wq = create_workqueue(DRV_NAME "_rescan_wq");
522         INIT_WORK(&priv->bus_rescan_worker, iwmct_rescan_worker);
523         INIT_WORK(&priv->isr_worker, iwmct_irq_read_worker);
524
525         init_waitqueue_head(&priv->wait_q);
526
527         sdio_claim_host(func);
528         /* FIXME: Remove after it is fixed in the Boot ROM upgrade */
529         func->enable_timeout = 10;
530
531         /* In our HW, setting the block size also wakes up the boot rom. */
532         ret = sdio_set_block_size(func, priv->dbg.block_size);
533         if (ret) {
534                 LOG_ERROR(priv, INIT,
535                         "sdio_set_block_size() failure: %d\n", ret);
536                 goto error_sdio_enable;
537         }
538
539         ret = sdio_enable_func(func);
540         if (ret) {
541                 LOG_ERROR(priv, INIT, "sdio_enable_func() failure: %d\n", ret);
542                 goto error_sdio_enable;
543         }
544
545         /* init reset and dev_sync states */
546         atomic_set(&priv->reset, 0);
547         atomic_set(&priv->dev_sync, 0);
548
549         /* init read req queue */
550         INIT_LIST_HEAD(&priv->read_req_list);
551
552         /* process configurable parameters */
553         iwmct_dbg_init_params(priv);
554         ret = sysfs_create_group(&func->dev.kobj, &iwmct_attribute_group);
555         if (ret) {
556                 LOG_ERROR(priv, INIT, "Failed to register attributes and "
557                          "initialize module_params\n");
558                 goto error_dev_attrs;
559         }
560
561         iwmct_dbgfs_register(priv, DRV_NAME);
562
563         if (!priv->dbg.direct && priv->dbg.download_trans_blks > 8) {
564                 LOG_INFO(priv, INIT,
565                          "Reducing transaction to 8 blocks = 2K (from %d)\n",
566                          priv->dbg.download_trans_blks);
567                 priv->dbg.download_trans_blks = 8;
568         }
569         priv->trans_len = priv->dbg.download_trans_blks * priv->dbg.block_size;
570         LOG_INFO(priv, INIT, "Transaction length = %d\n", priv->trans_len);
571
572         ret = sdio_claim_irq(func, iwmct_irq);
573         if (ret) {
574                 LOG_ERROR(priv, INIT, "sdio_claim_irq() failure: %d\n", ret);
575                 goto error_claim_irq;
576         }
577
578
579         /* Enable function's interrupt */
580         sdio_writeb(priv->func, val, addr, &ret);
581         if (ret) {
582                 LOG_ERROR(priv, INIT, "Failure writing to "
583                           "Interrupt Enable Register (%d): %d\n", addr, ret);
584                 goto error_enable_int;
585         }
586
587         sdio_release_host(func);
588
589         LOG_INFO(priv, INIT, "exit iwmct_probe\n");
590
591         return ret;
592
593 error_enable_int:
594         sdio_release_irq(func);
595 error_claim_irq:
596         sdio_disable_func(func);
597 error_dev_attrs:
598         iwmct_dbgfs_unregister(priv->dbgfs);
599         sysfs_remove_group(&func->dev.kobj, &iwmct_attribute_group);
600 error_sdio_enable:
601         sdio_release_host(func);
602         return ret;
603 }
604
605 static void iwmct_remove(struct sdio_func *func)
606 {
607         struct iwmct_work_struct *read_req;
608         struct iwmct_priv *priv = sdio_get_drvdata(func);
609
610         priv = sdio_get_drvdata(func);
611
612         LOG_INFO(priv, INIT, "enter\n");
613
614         sdio_claim_host(func);
615         sdio_release_irq(func);
616         sdio_release_host(func);
617
618         /* Safely destroy osc workqueue */
619         destroy_workqueue(priv->bus_rescan_wq);
620         destroy_workqueue(priv->wq);
621
622         sdio_claim_host(func);
623         sdio_disable_func(func);
624         sysfs_remove_group(&func->dev.kobj, &iwmct_attribute_group);
625         iwmct_dbgfs_unregister(priv->dbgfs);
626         sdio_release_host(func);
627
628         /* free read requests */
629         while (!list_empty(&priv->read_req_list)) {
630                 read_req = list_entry(priv->read_req_list.next,
631                         struct iwmct_work_struct, list);
632
633                 list_del(&read_req->list);
634                 kfree(read_req);
635         }
636
637         kfree(priv);
638 }
639
640
641 static const struct sdio_device_id iwmct_ids[] = {
642         /* Intel Wireless MultiCom 3200 Top Driver */
643         { SDIO_DEVICE(SDIO_VENDOR_ID_INTEL, 0x1404)},
644         { },    /* Terminating entry */
645 };
646
647 MODULE_DEVICE_TABLE(sdio, iwmct_ids);
648
649 static struct sdio_driver iwmct_driver = {
650         .probe          = iwmct_probe,
651         .remove         = iwmct_remove,
652         .name           = DRV_NAME,
653         .id_table       = iwmct_ids,
654 };
655
656 static int __init iwmct_init(void)
657 {
658         int rc;
659
660         /* Default log filter settings */
661         iwmct_log_set_filter(LOG_SRC_ALL, LOG_SEV_FILTER_RUNTIME);
662         iwmct_log_set_filter(LOG_SRC_FW_MSG, LOG_SEV_FILTER_ALL);
663         iwmct_log_set_fw_filter(LOG_SRC_ALL, FW_LOG_SEV_FILTER_RUNTIME);
664
665         rc = sdio_register_driver(&iwmct_driver);
666
667         return rc;
668 }
669
670 static void __exit iwmct_exit(void)
671 {
672         sdio_unregister_driver(&iwmct_driver);
673 }
674
675 module_init(iwmct_init);
676 module_exit(iwmct_exit);
677