]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/gdm72xx/gdm_sdio.c
staging:iio:adis16400: Report correct temperature scale and offset
[karo-tx-linux.git] / drivers / staging / gdm72xx / gdm_sdio.c
1 /*
2  * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  */
13
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/kernel.h>
17
18 #include <linux/mmc/core.h>
19 #include <linux/mmc/card.h>
20 #include <linux/mmc/sdio_func.h>
21 #include <linux/mmc/sdio_ids.h>
22
23 #include "gdm_sdio.h"
24 #include "gdm_wimax.h"
25 #include "sdio_boot.h"
26 #include "hci.h"
27
28 #define TYPE_A_HEADER_SIZE      4
29 #define TYPE_A_LOOKAHEAD_SIZE   16
30
31 #define MAX_NR_RX_BUF   4
32
33 #define SDU_TX_BUF_SIZE 2048
34 #define TX_BUF_SIZE             2048
35 #define TX_CHUNK_SIZE   (2048 - TYPE_A_HEADER_SIZE)
36 #define RX_BUF_SIZE             (25*1024)
37
38 #define TX_HZ   2000
39 #define TX_INTERVAL     (1000000/TX_HZ)
40
41 /*#define DEBUG*/
42
43 static int init_sdio(struct sdiowm_dev *sdev);
44 static void release_sdio(struct sdiowm_dev *sdev);
45
46 #ifdef DEBUG
47 static void hexdump(char *title, u8 *data, int len)
48 {
49         int i;
50
51         printk(KERN_DEBUG "%s: length = %d\n", title, len);
52         for (i = 0; i < len; i++) {
53                 printk(KERN_DEBUG "%02x ", data[i]);
54                 if ((i & 0xf) == 0xf)
55                         printk(KERN_DEBUG "\n");
56         }
57         printk(KERN_DEBUG "\n");
58 }
59 #endif
60
61 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
62 {
63         struct sdio_tx *t = kzalloc(sizeof(*t), GFP_ATOMIC);
64
65         if (!t)
66                 return NULL;
67
68         t->buf = kmalloc(TX_BUF_SIZE, GFP_ATOMIC);
69         if (!t->buf) {
70                 kfree(t);
71                 return NULL;
72         }
73
74         t->tx_cxt = tx;
75
76         return t;
77 }
78
79 static void free_tx_struct(struct sdio_tx *t)
80 {
81         if (t) {
82                 kfree(t->buf);
83                 kfree(t);
84         }
85 }
86
87 static struct sdio_rx *alloc_rx_struct(struct rx_cxt *rx)
88 {
89         struct sdio_rx *r = kzalloc(sizeof(*r), GFP_ATOMIC);
90
91         if (r)
92                 r->rx_cxt = rx;
93
94         return r;
95 }
96
97 static void free_rx_struct(struct sdio_rx *r)
98 {
99         kfree(r);
100 }
101
102 /* Before this function is called, spin lock should be locked. */
103 static struct sdio_tx *get_tx_struct(struct tx_cxt *tx, int *no_spc)
104 {
105         struct sdio_tx *t;
106
107         if (list_empty(&tx->free_list))
108                 return NULL;
109
110         t = list_entry(tx->free_list.prev, struct sdio_tx, list);
111         list_del(&t->list);
112
113         *no_spc = list_empty(&tx->free_list) ? 1 : 0;
114
115         return t;
116 }
117
118 /* Before this function is called, spin lock should be locked. */
119 static void put_tx_struct(struct tx_cxt *tx, struct sdio_tx *t)
120 {
121         list_add_tail(&t->list, &tx->free_list);
122 }
123
124 /* Before this function is called, spin lock should be locked. */
125 static struct sdio_rx *get_rx_struct(struct rx_cxt *rx)
126 {
127         struct sdio_rx *r;
128
129         if (list_empty(&rx->free_list))
130                 return NULL;
131
132         r = list_entry(rx->free_list.prev, struct sdio_rx, list);
133         list_del(&r->list);
134
135         return r;
136 }
137
138 /* Before this function is called, spin lock should be locked. */
139 static void put_rx_struct(struct rx_cxt *rx, struct sdio_rx *r)
140 {
141         list_add_tail(&r->list, &rx->free_list);
142 }
143
144 static int init_sdio(struct sdiowm_dev *sdev)
145 {
146         int ret = 0, i;
147         struct tx_cxt   *tx = &sdev->tx;
148         struct rx_cxt   *rx = &sdev->rx;
149         struct sdio_tx  *t;
150         struct sdio_rx  *r;
151
152         INIT_LIST_HEAD(&tx->free_list);
153         INIT_LIST_HEAD(&tx->sdu_list);
154         INIT_LIST_HEAD(&tx->hci_list);
155
156         spin_lock_init(&tx->lock);
157
158         tx->sdu_buf = kmalloc(SDU_TX_BUF_SIZE, GFP_KERNEL);
159         if (tx->sdu_buf == NULL) {
160                 printk(KERN_ERR "Failed to allocate SDU tx buffer.\n");
161                 goto fail;
162         }
163
164         for (i = 0; i < MAX_NR_SDU_BUF; i++) {
165                 t = alloc_tx_struct(tx);
166                 if (t == NULL) {
167                         ret = -ENOMEM;
168                         goto fail;
169                 }
170                 list_add(&t->list, &tx->free_list);
171         }
172
173         INIT_LIST_HEAD(&rx->free_list);
174         INIT_LIST_HEAD(&rx->req_list);
175
176         spin_lock_init(&rx->lock);
177
178         for (i = 0; i < MAX_NR_RX_BUF; i++) {
179                 r = alloc_rx_struct(rx);
180                 if (r == NULL) {
181                         ret = -ENOMEM;
182                         goto fail;
183                 }
184                 list_add(&r->list, &rx->free_list);
185         }
186
187         rx->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
188         if (rx->rx_buf == NULL) {
189                 printk(KERN_ERR "Failed to allocate rx buffer.\n");
190                 goto fail;
191         }
192
193         return 0;
194
195 fail:
196         release_sdio(sdev);
197         return ret;
198 }
199
200 static void release_sdio(struct sdiowm_dev *sdev)
201 {
202         struct tx_cxt   *tx = &sdev->tx;
203         struct rx_cxt   *rx = &sdev->rx;
204         struct sdio_tx  *t, *t_next;
205         struct sdio_rx  *r, *r_next;
206
207         kfree(tx->sdu_buf);
208
209         list_for_each_entry_safe(t, t_next, &tx->free_list, list) {
210                 list_del(&t->list);
211                 free_tx_struct(t);
212         }
213
214         list_for_each_entry_safe(t, t_next, &tx->sdu_list, list) {
215                 list_del(&t->list);
216                 free_tx_struct(t);
217         }
218
219         list_for_each_entry_safe(t, t_next, &tx->hci_list, list) {
220                 list_del(&t->list);
221                 free_tx_struct(t);
222         }
223
224         kfree(rx->rx_buf);
225
226         list_for_each_entry_safe(r, r_next, &rx->free_list, list) {
227                 list_del(&r->list);
228                 free_rx_struct(r);
229         }
230
231         list_for_each_entry_safe(r, r_next, &rx->req_list, list) {
232                 list_del(&r->list);
233                 free_rx_struct(r);
234         }
235 }
236
237 static void send_sdio_pkt(struct sdio_func *func, u8 *data, int len)
238 {
239         int n, blocks, ret, remain;
240
241         sdio_claim_host(func);
242
243         blocks = len / func->cur_blksize;
244         n = blocks * func->cur_blksize;
245         if (blocks) {
246                 ret = sdio_memcpy_toio(func, 0, data, n);
247                 if (ret < 0) {
248                         if (ret != -ENOMEDIUM)
249                                 printk(KERN_ERR "gdmwms: %s error: ret = %d\n",
250                                         __func__, ret);
251                         goto end_io;
252                 }
253         }
254
255         remain = len - n;
256         remain = (remain + 3) & ~3;
257
258         if (remain) {
259                 ret = sdio_memcpy_toio(func, 0, data + n, remain);
260                 if (ret < 0) {
261                         if (ret != -ENOMEDIUM)
262                                 printk(KERN_ERR "gdmwms: %s error: ret = %d\n",
263                                         __func__, ret);
264                         goto end_io;
265                 }
266         }
267
268 end_io:
269         sdio_release_host(func);
270 }
271
272 static void send_sdu(struct sdio_func *func, struct tx_cxt *tx)
273 {
274         struct list_head *l, *next;
275         struct hci_s *hci;
276         struct sdio_tx *t;
277         int pos, len, i, estlen, aggr_num = 0, aggr_len;
278         u8 *buf;
279         unsigned long flags;
280
281         spin_lock_irqsave(&tx->lock, flags);
282
283         pos = TYPE_A_HEADER_SIZE + HCI_HEADER_SIZE;
284         list_for_each_entry(t, &tx->sdu_list, list) {
285                 estlen = ((t->len + 3) & ~3) + 4;
286                 if ((pos + estlen) > SDU_TX_BUF_SIZE)
287                         break;
288
289                 aggr_num++;
290                 memcpy(tx->sdu_buf + pos, t->buf, t->len);
291                 memset(tx->sdu_buf + pos + t->len, 0, estlen - t->len);
292                 pos += estlen;
293         }
294         aggr_len = pos;
295
296         hci = (struct hci_s *)(tx->sdu_buf + TYPE_A_HEADER_SIZE);
297         hci->cmd_evt = H2B(WIMAX_TX_SDU_AGGR);
298         hci->length = H2B(aggr_len - TYPE_A_HEADER_SIZE - HCI_HEADER_SIZE);
299
300         spin_unlock_irqrestore(&tx->lock, flags);
301
302 #ifdef DEBUG
303         hexdump("sdio_send", tx->sdu_buf + TYPE_A_HEADER_SIZE,
304                 aggr_len - TYPE_A_HEADER_SIZE);
305 #endif
306
307         for (pos = TYPE_A_HEADER_SIZE; pos < aggr_len; pos += TX_CHUNK_SIZE) {
308                 len = aggr_len - pos;
309                 len = len > TX_CHUNK_SIZE ? TX_CHUNK_SIZE : len;
310                 buf = tx->sdu_buf + pos - TYPE_A_HEADER_SIZE;
311
312                 buf[0] = len & 0xff;
313                 buf[1] = (len >> 8) & 0xff;
314                 buf[2] = (len >> 16) & 0xff;
315                 buf[3] = (pos + len) >= aggr_len ? 0 : 1;
316                 send_sdio_pkt(func, buf, len + TYPE_A_HEADER_SIZE);
317         }
318
319         spin_lock_irqsave(&tx->lock, flags);
320
321         for (l = tx->sdu_list.next, i = 0; i < aggr_num; i++, l = next) {
322                 next = l->next;
323                 t = list_entry(l, struct sdio_tx, list);
324                 if (t->callback)
325                         t->callback(t->cb_data);
326
327                 list_del(l);
328                 put_tx_struct(t->tx_cxt, t);
329         }
330
331         do_gettimeofday(&tx->sdu_stamp);
332         spin_unlock_irqrestore(&tx->lock, flags);
333 }
334
335 static void send_hci(struct sdio_func *func, struct tx_cxt *tx,
336                         struct sdio_tx *t)
337 {
338         unsigned long flags;
339
340 #ifdef DEBUG
341         hexdump("sdio_send", t->buf + TYPE_A_HEADER_SIZE,
342                 t->len - TYPE_A_HEADER_SIZE);
343 #endif
344         send_sdio_pkt(func, t->buf, t->len);
345
346         spin_lock_irqsave(&tx->lock, flags);
347         if (t->callback)
348                 t->callback(t->cb_data);
349         free_tx_struct(t);
350         spin_unlock_irqrestore(&tx->lock, flags);
351 }
352
353 static void do_tx(struct work_struct *work)
354 {
355         struct sdiowm_dev *sdev = container_of(work, struct sdiowm_dev, ws);
356         struct sdio_func *func = sdev->func;
357         struct tx_cxt *tx = &sdev->tx;
358         struct sdio_tx *t = NULL;
359         struct timeval now, *before;
360         int is_sdu = 0;
361         long diff;
362         unsigned long flags;
363
364         spin_lock_irqsave(&tx->lock, flags);
365         if (!tx->can_send) {
366                 spin_unlock_irqrestore(&tx->lock, flags);
367                 return;
368         }
369
370         if (!list_empty(&tx->hci_list)) {
371                 t = list_entry(tx->hci_list.next, struct sdio_tx, list);
372                 list_del(&t->list);
373                 is_sdu = 0;
374         } else if (!tx->stop_sdu_tx && !list_empty(&tx->sdu_list)) {
375                 do_gettimeofday(&now);
376                 before = &tx->sdu_stamp;
377
378                 diff = (now.tv_sec - before->tv_sec) * 1000000 +
379                         (now.tv_usec - before->tv_usec);
380                 if (diff >= 0 && diff < TX_INTERVAL) {
381                         schedule_work(&sdev->ws);
382                         spin_unlock_irqrestore(&tx->lock, flags);
383                         return;
384                 }
385                 is_sdu = 1;
386         }
387
388         if (!is_sdu && t == NULL) {
389                 spin_unlock_irqrestore(&tx->lock, flags);
390                 return;
391         }
392
393         tx->can_send = 0;
394
395         spin_unlock_irqrestore(&tx->lock, flags);
396
397         if (is_sdu)
398                 send_sdu(func, tx);
399         else
400                 send_hci(func, tx, t);
401 }
402
403 static int gdm_sdio_send(void *priv_dev, void *data, int len,
404                         void (*cb)(void *data), void *cb_data)
405 {
406         struct sdiowm_dev *sdev = priv_dev;
407         struct tx_cxt *tx = &sdev->tx;
408         struct sdio_tx *t;
409         u8 *pkt = data;
410         int no_spc = 0;
411         u16 cmd_evt;
412         unsigned long flags;
413
414         BUG_ON(len > TX_BUF_SIZE - TYPE_A_HEADER_SIZE);
415
416         spin_lock_irqsave(&tx->lock, flags);
417
418         cmd_evt = (pkt[0] << 8) | pkt[1];
419         if (cmd_evt == WIMAX_TX_SDU) {
420                 t = get_tx_struct(tx, &no_spc);
421                 if (t == NULL) {
422                         /* This case must not happen. */
423                         spin_unlock_irqrestore(&tx->lock, flags);
424                         return -ENOSPC;
425                 }
426                 list_add_tail(&t->list, &tx->sdu_list);
427
428                 memcpy(t->buf, data, len);
429
430                 t->len = len;
431                 t->callback = cb;
432                 t->cb_data = cb_data;
433         } else {
434                 t = alloc_tx_struct(tx);
435                 if (t == NULL) {
436                         spin_unlock_irqrestore(&tx->lock, flags);
437                         return -ENOMEM;
438                 }
439                 list_add_tail(&t->list, &tx->hci_list);
440
441                 t->buf[0] = len & 0xff;
442                 t->buf[1] = (len >> 8) & 0xff;
443                 t->buf[2] = (len >> 16) & 0xff;
444                 t->buf[3] = 2;
445                 memcpy(t->buf + TYPE_A_HEADER_SIZE, data, len);
446
447                 t->len = len + TYPE_A_HEADER_SIZE;
448                 t->callback = cb;
449                 t->cb_data = cb_data;
450         }
451
452         if (tx->can_send)
453                 schedule_work(&sdev->ws);
454
455         spin_unlock_irqrestore(&tx->lock, flags);
456
457         if (no_spc)
458                 return -ENOSPC;
459
460         return 0;
461 }
462
463 /*
464  * Handle the HCI, WIMAX_SDU_TX_FLOW.
465  */
466 static int control_sdu_tx_flow(struct sdiowm_dev *sdev, u8 *hci_data, int len)
467 {
468         struct tx_cxt *tx = &sdev->tx;
469         u16 cmd_evt;
470         unsigned long flags;
471
472         spin_lock_irqsave(&tx->lock, flags);
473
474         cmd_evt = (hci_data[0] << 8) | (hci_data[1]);
475         if (cmd_evt != WIMAX_SDU_TX_FLOW)
476                 goto out;
477
478         if (hci_data[4] == 0) {
479 #ifdef DEBUG
480                 printk(KERN_DEBUG "WIMAX ==> STOP SDU TX\n");
481 #endif
482                 tx->stop_sdu_tx = 1;
483         } else if (hci_data[4] == 1) {
484 #ifdef DEBUG
485                 printk(KERN_DEBUG "WIMAX ==> START SDU TX\n");
486 #endif
487                 tx->stop_sdu_tx = 0;
488                 if (tx->can_send)
489                         schedule_work(&sdev->ws);
490                 /*
491                  * If free buffer for sdu tx doesn't exist, then tx queue
492                  * should not be woken. For this reason, don't pass the command,
493                  * START_SDU_TX.
494                  */
495                 if (list_empty(&tx->free_list))
496                         len = 0;
497         }
498
499 out:
500         spin_unlock_irqrestore(&tx->lock, flags);
501         return len;
502 }
503
504 static void gdm_sdio_irq(struct sdio_func *func)
505 {
506         struct phy_dev *phy_dev = sdio_get_drvdata(func);
507         struct sdiowm_dev *sdev = phy_dev->priv_dev;
508         struct tx_cxt *tx = &sdev->tx;
509         struct rx_cxt *rx = &sdev->rx;
510         struct sdio_rx *r;
511         unsigned long flags;
512         u8 val, hdr[TYPE_A_LOOKAHEAD_SIZE], *buf;
513         u32 len, blocks, n;
514         int ret, remain;
515
516         /* Check interrupt */
517         val = sdio_readb(func, 0x13, &ret);
518         if (val & 0x01)
519                 sdio_writeb(func, 0x01, 0x13, &ret);    /* clear interrupt */
520         else
521                 return;
522
523         ret = sdio_memcpy_fromio(func, hdr, 0x0, TYPE_A_LOOKAHEAD_SIZE);
524         if (ret) {
525                 printk(KERN_ERR "Cannot read from function %d\n", func->num);
526                 goto done;
527         }
528
529         len = (hdr[2] << 16) | (hdr[1] << 8) | hdr[0];
530         if (len > (RX_BUF_SIZE - TYPE_A_HEADER_SIZE)) {
531                 printk(KERN_ERR "Too big Type-A size: %d\n", len);
532                 goto done;
533         }
534
535         if (hdr[3] == 1) {      /* Ack */
536 #ifdef DEBUG
537                 u32 *ack_seq = (u32 *)&hdr[4];
538 #endif
539                 spin_lock_irqsave(&tx->lock, flags);
540                 tx->can_send = 1;
541
542                 if (!list_empty(&tx->sdu_list) || !list_empty(&tx->hci_list))
543                         schedule_work(&sdev->ws);
544                 spin_unlock_irqrestore(&tx->lock, flags);
545 #ifdef DEBUG
546                 printk(KERN_DEBUG "Ack... %0x\n", ntohl(*ack_seq));
547 #endif
548                 goto done;
549         }
550
551         memcpy(rx->rx_buf, hdr + TYPE_A_HEADER_SIZE,
552                         TYPE_A_LOOKAHEAD_SIZE - TYPE_A_HEADER_SIZE);
553
554         buf = rx->rx_buf + TYPE_A_LOOKAHEAD_SIZE - TYPE_A_HEADER_SIZE;
555         remain = len - TYPE_A_LOOKAHEAD_SIZE + TYPE_A_HEADER_SIZE;
556         if (remain <= 0)
557                 goto end_io;
558
559         blocks = remain / func->cur_blksize;
560
561         if (blocks) {
562                 n = blocks * func->cur_blksize;
563                 ret = sdio_memcpy_fromio(func, buf, 0x0, n);
564                 if (ret) {
565                         printk(KERN_ERR "Cannot read from function %d\n",
566                                 func->num);
567                         goto done;
568                 }
569                 buf += n;
570                 remain -= n;
571         }
572
573         if (remain) {
574                 ret = sdio_memcpy_fromio(func, buf, 0x0, remain);
575                 if (ret) {
576                         printk(KERN_ERR "Cannot read from function %d\n",
577                                 func->num);
578                         goto done;
579                 }
580         }
581
582 end_io:
583 #ifdef DEBUG
584         hexdump("sdio_receive", rx->rx_buf, len);
585 #endif
586         len = control_sdu_tx_flow(sdev, rx->rx_buf, len);
587
588         spin_lock_irqsave(&rx->lock, flags);
589
590         if (!list_empty(&rx->req_list)) {
591                 r = list_entry(rx->req_list.next, struct sdio_rx, list);
592                 spin_unlock_irqrestore(&rx->lock, flags);
593                 if (r->callback)
594                         r->callback(r->cb_data, rx->rx_buf, len);
595                 spin_lock_irqsave(&rx->lock, flags);
596                 list_del(&r->list);
597                 put_rx_struct(rx, r);
598         }
599
600         spin_unlock_irqrestore(&rx->lock, flags);
601
602 done:
603         sdio_writeb(func, 0x00, 0x10, &ret);    /* PCRRT */
604         if (!phy_dev->netdev)
605                 register_wimax_device(phy_dev, &func->dev);
606 }
607
608 static int gdm_sdio_receive(void *priv_dev,
609                                 void (*cb)(void *cb_data, void *data, int len),
610                                 void *cb_data)
611 {
612         struct sdiowm_dev *sdev = priv_dev;
613         struct rx_cxt *rx = &sdev->rx;
614         struct sdio_rx *r;
615         unsigned long flags;
616
617         spin_lock_irqsave(&rx->lock, flags);
618         r = get_rx_struct(rx);
619         if (r == NULL) {
620                 spin_unlock_irqrestore(&rx->lock, flags);
621                 return -ENOMEM;
622         }
623
624         r->callback = cb;
625         r->cb_data = cb_data;
626
627         list_add_tail(&r->list, &rx->req_list);
628         spin_unlock_irqrestore(&rx->lock, flags);
629
630         return 0;
631 }
632
633 static int sdio_wimax_probe(struct sdio_func *func,
634                                 const struct sdio_device_id *id)
635 {
636         int ret;
637         struct phy_dev *phy_dev = NULL;
638         struct sdiowm_dev *sdev = NULL;
639
640         printk(KERN_INFO "Found GDM SDIO VID = 0x%04x PID = 0x%04x...\n",
641                         func->vendor, func->device);
642         printk(KERN_INFO "GCT WiMax driver version %s\n", DRIVER_VERSION);
643
644         sdio_claim_host(func);
645         sdio_enable_func(func);
646         sdio_claim_irq(func, gdm_sdio_irq);
647
648         ret = sdio_boot(func);
649         if (ret)
650                 return ret;
651
652         phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
653         if (phy_dev == NULL) {
654                 ret = -ENOMEM;
655                 goto out;
656         }
657         sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
658         if (sdev == NULL) {
659                 ret = -ENOMEM;
660                 goto out;
661         }
662
663         phy_dev->priv_dev = (void *)sdev;
664         phy_dev->send_func = gdm_sdio_send;
665         phy_dev->rcv_func = gdm_sdio_receive;
666
667         ret = init_sdio(sdev);
668         if (ret < 0)
669                 goto out;
670
671         sdev->func = func;
672
673         sdio_writeb(func, 1, 0x14, &ret);       /* Enable interrupt */
674         sdio_release_host(func);
675
676         INIT_WORK(&sdev->ws, do_tx);
677
678         sdio_set_drvdata(func, phy_dev);
679 out:
680         if (ret) {
681                 kfree(phy_dev);
682                 kfree(sdev);
683         }
684
685         return ret;
686 }
687
688 static void sdio_wimax_remove(struct sdio_func *func)
689 {
690         struct phy_dev *phy_dev = sdio_get_drvdata(func);
691         struct sdiowm_dev *sdev = phy_dev->priv_dev;
692
693         if (phy_dev->netdev)
694                 unregister_wimax_device(phy_dev);
695         sdio_claim_host(func);
696         sdio_release_irq(func);
697         sdio_disable_func(func);
698         sdio_release_host(func);
699         release_sdio(sdev);
700
701         kfree(sdev);
702         kfree(phy_dev);
703 }
704
705 static const struct sdio_device_id sdio_wimax_ids[] = {
706         { SDIO_DEVICE(0x0296, 0x5347) },
707         {0}
708 };
709
710 MODULE_DEVICE_TABLE(sdio, sdio_wimax_ids);
711
712 static struct sdio_driver sdio_wimax_driver = {
713         .probe          = sdio_wimax_probe,
714         .remove         = sdio_wimax_remove,
715         .name           = "sdio_wimax",
716         .id_table       = sdio_wimax_ids,
717 };
718
719 static int __init sdio_gdm_wimax_init(void)
720 {
721         return sdio_register_driver(&sdio_wimax_driver);
722 }
723
724 static void __exit sdio_gdm_wimax_exit(void)
725 {
726         sdio_unregister_driver(&sdio_wimax_driver);
727 }
728
729 module_init(sdio_gdm_wimax_init);
730 module_exit(sdio_gdm_wimax_exit);
731
732 MODULE_VERSION(DRIVER_VERSION);
733 MODULE_DESCRIPTION("GCT WiMax SDIO Device Driver");
734 MODULE_AUTHOR("Ethan Park");
735 MODULE_LICENSE("GPL");