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