Root/package/ks7010/src/ks7010_sdio.c

1/*
2 * Driver for KeyStream, KS7010 based SDIO cards.
3 *
4 * ks7010_sdio.c
5 * $Id: ks7010_sdio.c 996 2009-09-14 02:54:21Z sekine $
6 *
7 * Copyright (C) 2006-2008 KeyStream Corp.
8 * Copyright (C) 2009 Renesas Technology Corp.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it undr the terms of the GNU General Public License version 2 as
12 * published by the Free Sotware Foundation.
13 */
14
15#include <linux/workqueue.h>
16#include <asm/atomic.h>
17#include <linux/mmc/card.h>
18#include <linux/mmc/sdio_func.h>
19
20#include "ks_wlan.h"
21#include "ks_wlan_ioctl.h"
22#include "ks_debug.h"
23#include "ks_hostif.h"
24
25#include "ks7010_sdio.h"
26
27#define KS7010_FUNC_NUM 1
28#define KS7010_IO_BLOCK_SIZE 512
29#define KS7010_MAX_CLOCK 25000000
30
31static int reg_net = 0;
32
33static const struct sdio_device_id if_sdio_ids[] = {
34    { SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010) },
35    { SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010) },
36    { /* all zero */ }
37};
38
39struct ks_sdio_model {
40        int model;
41        const char *firmware;
42};
43
44static struct ks_sdio_model ks_sdio_models[] = {
45        {
46                /* ks7010 */
47                .model = 0x10,
48                .firmware = "ks7010sd.rom",
49        },
50};
51
52static int ks7910_sdio_probe(struct sdio_func *function, const struct sdio_device_id *device);
53static void ks7910_sdio_remove(struct sdio_func *function);
54static void ks7010_rw_function(struct work_struct *work);
55static int ks7010_sdio_read( ks_wlan_private *priv, unsigned int address,
56                 unsigned char *buffer, int length );
57static int ks7010_sdio_write( ks_wlan_private *priv, unsigned int address,
58                  unsigned char *buffer, int length );
59#ifdef NO_FIRMWARE_CLASS
60static char *romfile = ROM_FILE;
61module_param(romfile, charp, S_IRUGO);
62#endif
63/* macro */
64
65#define inc_txqhead(priv) \
66        ( priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE )
67#define inc_txqtail(priv) \
68        ( priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE )
69#define cnt_txqbody(priv) \
70        (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE )
71
72#define inc_rxqhead(priv) \
73        ( priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE )
74#define inc_rxqtail(priv) \
75        ( priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE )
76#define cnt_rxqbody(priv) \
77        (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE )
78
79void ks_wlan_hw_sleep_doze_request(ks_wlan_private *priv)
80{
81    unsigned char rw_data;
82    int retval;
83
84    DPRINTK(4, "\n");
85
86    /* clear request */
87    atomic_set(&priv->sleepstatus.doze_request,0);
88
89    if( atomic_read(&priv->sleepstatus.status) == 0){
90        rw_data = GCR_B_DOZE;
91        retval = ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data));
92        if(retval){
93            DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
94            goto out;
95        }
96        DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data);
97        DPRINTK(3,"sleep_mode=SLP_SLEEP\n");
98        atomic_set(&priv->sleepstatus.status, 1);
99         priv->last_doze = jiffies;
100    }
101    else{
102        DPRINTK(1,"sleep_mode=%d\n",priv->sleep_mode);
103    }
104
105out:
106    priv->sleep_mode = atomic_read(&priv->sleepstatus.status);
107    return;
108}
109
110void ks_wlan_hw_sleep_wakeup_request(ks_wlan_private *priv)
111{
112    unsigned char rw_data;
113    int retval;
114
115    DPRINTK(4, "\n");
116
117    /* clear request */
118    atomic_set(&priv->sleepstatus.wakeup_request,0);
119
120    if( atomic_read(&priv->sleepstatus.status) == 1){
121        rw_data = WAKEUP_REQ;
122        retval = ks7010_sdio_write(priv, WAKEUP, &rw_data, sizeof(rw_data));
123        if(retval){
124            DPRINTK(1, " error : WAKEUP=%02X\n", rw_data);
125            goto out;
126        }
127        DPRINTK(4, "wake up : WAKEUP=%02X\n", rw_data);
128        atomic_set(&priv->sleepstatus.status, 0);
129         priv->last_wakeup = jiffies;
130        ++priv->wakeup_count;
131    }
132    else{
133        DPRINTK(1,"sleep_mode=%d\n",priv->sleep_mode);
134    }
135
136out:
137    priv->sleep_mode = atomic_read(&priv->sleepstatus.status);
138    return;
139}
140
141
142void ks_wlan_hw_wakeup_request(ks_wlan_private *priv)
143{
144    unsigned char rw_data;
145    int retval;
146
147    DPRINTK(4, "\n");
148    if(atomic_read(&priv->psstatus.status)==PS_SNOOZE){
149        rw_data = WAKEUP_REQ;
150        retval = ks7010_sdio_write(priv, WAKEUP, &rw_data, sizeof(rw_data));
151        if(retval){
152            DPRINTK(1, " error : WAKEUP=%02X\n", rw_data);
153        }
154        DPRINTK(4, "wake up : WAKEUP=%02X\n", rw_data);
155         priv->last_wakeup = jiffies;
156        ++priv->wakeup_count;
157    }
158    else{
159        DPRINTK(1,"psstatus=%d\n",atomic_read(&priv->psstatus.status));
160    }
161}
162
163int _ks_wlan_hw_power_save(ks_wlan_private *priv)
164{
165    int rc=0;
166    unsigned char rw_data;
167    int retval;
168
169    if(priv->reg.powermgt == POWMGT_ACTIVE_MODE)
170        return rc;
171
172    if(priv->reg.operation_mode == MODE_INFRASTRUCTURE &&
173       (priv->connect_status & CONNECT_STATUS_MASK)== CONNECT_STATUS){
174
175        //DPRINTK(1,"psstatus.status=%d\n",atomic_read(&priv->psstatus.status));
176    if (priv->dev_state == DEVICE_STATE_SLEEP) {
177        switch(atomic_read(&priv->psstatus.status)){
178        case PS_SNOOZE: /* 4 */
179            break;
180        default:
181            DPRINTK(5,"\n\
182                psstatus.status=%d\n\
183                psstatus.confirm_wait=%d\n\
184                psstatus.snooze_guard=%d\n\
185                cnt_txqbody=%d\n",
186                atomic_read(&priv->psstatus.status),
187                atomic_read(&priv->psstatus.confirm_wait),
188                atomic_read(&priv->psstatus.snooze_guard),
189                cnt_txqbody(priv));
190
191            if(!atomic_read(&priv->psstatus.confirm_wait)&&
192               !atomic_read(&priv->psstatus.snooze_guard)&&
193               !cnt_txqbody(priv)){
194                retval = ks7010_sdio_read(priv, INT_PENDING, &rw_data, sizeof(rw_data));
195                if(retval){
196                    DPRINTK(1, " error : INT_PENDING=%02X\n", rw_data);
197                    queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
198                    break;
199                }
200                if(!rw_data){
201                    rw_data = GCR_B_DOZE;
202                    retval = ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data));
203                    if(retval){
204                        DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
205                        queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
206                        break;
207                    }
208                    DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data);
209                    atomic_set(&priv->psstatus.status, PS_SNOOZE);
210                    DPRINTK(3,"psstatus.status=PS_SNOOZE\n");
211                }
212                else{
213                    queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
214                }
215            }
216            else{
217                queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 0);
218            }
219            break;
220        }
221    }
222
223    }
224
225    return rc;
226}
227
228int ks_wlan_hw_power_save(ks_wlan_private *priv)
229{
230    queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
231    return 0;
232}
233
234static int ks7010_sdio_read(ks_wlan_private *priv, unsigned int address,
235                unsigned char *buffer, int length)
236{
237    int rc = -1;
238    struct ks_sdio_card *card;
239
240    card = priv->ks_wlan_hw.sdio_card;
241
242    if (length == 1) /* CMD52 */
243        *buffer = sdio_readb(card->func, address, &rc);
244    else /* CMD53 multi-block transfer */
245        rc = sdio_memcpy_fromio(card->func, buffer, address, length);
246
247    if(rc != 0){
248        printk("sdio error erorr=%d size=%d\n", rc, length);
249        ++priv->sdio_error_count;
250    }else{
251        priv->sdio_error_count=0;
252    }
253
254    return rc;
255}
256
257static int ks7010_sdio_write(ks_wlan_private *priv, unsigned int address,
258                 unsigned char *buffer, int length)
259{
260    int rc = -1;
261    struct ks_sdio_card *card;
262
263    card = priv->ks_wlan_hw.sdio_card;
264
265    if (length == 1) /* CMD52 */
266        sdio_writeb(card->func, *buffer, (unsigned int) address, &rc);
267    else /* CMD53 */
268        rc = sdio_memcpy_toio(card->func, (unsigned int) address, buffer, length);
269
270    if(rc != 0){
271        printk("sdio error erorr=%d size=%d\n", rc, length);
272        ++priv->sdio_error_count;
273    }else{
274        priv->sdio_error_count=0;
275    }
276
277    return rc;
278}
279
280static int enqueue_txdev(ks_wlan_private *priv, unsigned char *p, unsigned long size,
281          void (*complete_handler)(void *arg1, void *arg2),
282          void *arg1, void *arg2 )
283{
284    struct tx_device_buffer *sp;
285
286    if (priv->dev_state < DEVICE_STATE_BOOT) {
287        kfree(p);
288        if (complete_handler != NULL)
289            (*complete_handler)(arg1, arg2);
290        return 1;
291    }
292
293    if ((TX_DEVICE_BUFF_SIZE - 1) <= cnt_txqbody(priv)) {
294        /* in case of buffer overflow */
295        DPRINTK(1,"tx buffer overflow\n");
296        kfree(p);
297        if (complete_handler != NULL)
298            (*complete_handler)(arg1, arg2);
299        return 1;
300    }
301
302    sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qtail];
303    sp->sendp = p;
304    sp->size = size;
305    sp->complete_handler = complete_handler;
306    sp->arg1 = arg1;
307    sp->arg2 = arg2;
308    inc_txqtail(priv);
309
310    return 0;
311}
312
313/* write data */
314static int write_to_device(ks_wlan_private *priv, unsigned char *buffer, unsigned long size )
315{
316    int rc,retval;
317    unsigned char rw_data;
318    struct hostif_hdr *hdr;
319    hdr = (struct hostif_hdr *)buffer;
320    rc=0;
321
322    DPRINTK(4,"size=%d\n", hdr->size);
323    if(hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event){
324        DPRINTK(1,"unknown event=%04X\n",hdr->event);
325        return 0;
326    }
327
328    retval = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size);
329    if(retval){
330        DPRINTK(1, " write error : retval=%d\n", retval);
331        return -4;
332    }
333
334    rw_data = WRITE_STATUS_BUSY;
335    retval = ks7010_sdio_write(priv, WRITE_STATUS, &rw_data, sizeof(rw_data));
336    if(retval){
337        DPRINTK(1, " error : WRITE_STATUS=%02X\n", rw_data);
338        return -3;
339    }
340
341    return 0;
342}
343
344static void tx_device_task(void *dev)
345{
346    ks_wlan_private *priv = (ks_wlan_private *)dev;
347    struct tx_device_buffer *sp;
348    int rc = 0;
349
350    DPRINTK(4, "\n");
351    if(cnt_txqbody(priv)>0 && atomic_read(&priv->psstatus.status) != PS_SNOOZE){
352        sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
353        if(priv->dev_state >= DEVICE_STATE_BOOT){
354            rc = write_to_device(priv, sp->sendp, sp->size);
355            if(rc){
356                DPRINTK(1, "write_to_device error !!(%d)\n", rc);
357                queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
358                return;
359            }
360
361        }
362        kfree(sp->sendp); /* allocated memory free */
363        if(sp->complete_handler != NULL) /* TX Complete */
364            (*sp->complete_handler)(sp->arg1, sp->arg2);
365        inc_txqhead(priv);
366
367        if(cnt_txqbody(priv)>0){
368            queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 0);
369        }
370    }
371    return;
372}
373
374int ks_wlan_hw_tx( ks_wlan_private *priv, void *p, unsigned long size,
375           void (*complete_handler)(void *arg1, void *arg2),
376           void *arg1, void *arg2 )
377{
378    int result=0;
379    struct hostif_hdr *hdr;
380    hdr = (struct hostif_hdr *)p;
381
382    if(hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event){
383        DPRINTK(1,"unknown event=%04X\n",hdr->event);
384        return 0;
385    }
386
387    /* add event to hostt buffer */
388    priv->hostt.buff[priv->hostt.qtail] = hdr->event;
389        priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;
390
391    DPRINTK(4, "event=%04X\n",hdr->event);
392    spin_lock(&priv->tx_dev.tx_dev_lock);
393    result = enqueue_txdev(priv, p, size, complete_handler, arg1, arg2);
394    spin_unlock(&priv->tx_dev.tx_dev_lock);
395
396    if(cnt_txqbody(priv)>0){
397        queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 0);
398    }
399    return result;
400}
401
402static void rx_event_task(unsigned long dev)
403{
404        ks_wlan_private *priv = (ks_wlan_private *)dev;
405    struct rx_device_buffer *rp;
406
407    DPRINTK(4,"\n");
408
409    if(cnt_rxqbody(priv) > 0 && priv->dev_state >= DEVICE_STATE_BOOT){
410        rp = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qhead];
411        hostif_receive(priv, rp->data, rp->size);
412        inc_rxqhead(priv);
413
414        if(cnt_rxqbody(priv) > 0){
415            tasklet_schedule(&priv->ks_wlan_hw.rx_bh_task);
416        }
417    }
418
419    return;
420}
421
422static void ks_wlan_hw_rx(void *dev, uint16_t size)
423{
424    ks_wlan_private *priv = (ks_wlan_private *)dev;
425    int retval;
426    struct rx_device_buffer *rx_buffer;
427    struct hostif_hdr *hdr;
428    unsigned char read_status;
429    unsigned short event=0;
430
431    DPRINTK(4,"\n");
432
433    /* receive data */
434    if (cnt_rxqbody(priv) >= (RX_DEVICE_BUFF_SIZE-1)) {
435        /* in case of buffer overflow */
436        DPRINTK(1,"rx buffer overflow \n");
437        goto error_out;
438    }
439    rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail];
440
441    retval = ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0], hif_align_size(size));
442    if(retval){
443        goto error_out;
444    }
445
446    /* length check */
447    if(size > 2046 || size == 0){
448
449        DPRINTK(5,"-INVAILED DATA dump\n");
450        print_buffer(&rx_buffer->data[0],32);
451
452        /* rx_status update */
453        read_status = READ_STATUS_IDLE;
454        retval = ks7010_sdio_write(priv, READ_STATUS, &read_status, sizeof(read_status));
455        if(retval){
456            DPRINTK(1, " error : READ_STATUS=%02X\n", read_status);
457        }
458        goto error_out;
459    }
460
461    hdr = (struct hostif_hdr *)&rx_buffer->data[0];
462    rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size);
463    event = hdr->event;
464    inc_rxqtail(priv);
465
466    /* read status update */
467    read_status = READ_STATUS_IDLE;
468    retval = ks7010_sdio_write(priv, READ_STATUS, &read_status, sizeof(read_status));
469    if(retval){
470        DPRINTK(1, " error : READ_STATUS=%02X\n", read_status);
471    }
472    DPRINTK(4, "READ_STATUS=%02X\n", read_status);
473
474    if(atomic_read(&priv->psstatus.confirm_wait)){
475        if(IS_HIF_CONF(event)){
476            DPRINTK(4, "IS_HIF_CONF true !!\n");
477            atomic_dec(&priv->psstatus.confirm_wait);
478        }
479    }
480
481    /* rx_event_task((void *)priv); */
482    tasklet_schedule(&priv->ks_wlan_hw.rx_bh_task);
483
484error_out:
485    return;
486}
487
488static void ks7010_rw_function(struct work_struct *work)
489{
490    struct hw_info_t *hw;
491    struct ks_wlan_private *priv;
492    unsigned char rw_data;
493    int retval;
494
495    hw = container_of(work, struct hw_info_t, rw_wq.work);
496    priv = container_of(hw, struct ks_wlan_private, ks_wlan_hw);
497
498    DPRINTK(4,"\n");
499
500
501     /* wiat after DOZE */
502     if(time_after(priv->last_doze + ((30*HZ)/1000), jiffies )){
503         DPRINTK(4, "wait after DOZE \n");
504        queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
505        return;
506    }
507
508    /* wiat after WAKEUP */
509    while(time_after(priv->last_wakeup + ((30*HZ)/1000), jiffies )){
510        DPRINTK(4, "wait after WAKEUP \n");
511/* queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,
512        (priv->last_wakeup + ((30*HZ)/1000) - jiffies));*/
513        printk("wake: %lu %lu\n", priv->last_wakeup + (30* HZ)/1000, jiffies);
514        msleep(30);
515    }
516
517    sdio_claim_host(priv->ks_wlan_hw.sdio_card->func);
518
519    /* power save wakeup */
520    if(atomic_read(&priv->psstatus.status)==PS_SNOOZE){
521        if(cnt_txqbody(priv)>0){
522            ks_wlan_hw_wakeup_request(priv);
523            queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 1);
524        }
525        goto err_out;
526    }
527
528    /* sleep mode doze */
529    if(atomic_read(&priv->sleepstatus.doze_request)==1){
530        ks_wlan_hw_sleep_doze_request(priv);
531        goto err_out;
532    }
533    /* sleep mode wakeup */
534    if(atomic_read(&priv->sleepstatus.wakeup_request)==1){
535        ks_wlan_hw_sleep_wakeup_request(priv);
536        goto err_out;
537    }
538
539    /* read (WriteStatus/ReadDataSize FN1:00_0014) */
540    retval = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, sizeof(rw_data));
541    if(retval){
542        DPRINTK(1, " error : WSTATUS_RSIZE=%02X psstatus=%d\n", rw_data,atomic_read(&priv->psstatus.status));
543        goto err_out;
544    }
545    DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data);
546
547    if(rw_data&RSIZE_MASK){ /* Read schedule */
548        ks_wlan_hw_rx((void *)priv, (uint16_t)(((rw_data&RSIZE_MASK)<<4)));
549    }
550    if((rw_data&WSTATUS_MASK)){
551        tx_device_task((void *)priv);
552    }
553    _ks_wlan_hw_power_save(priv);
554
555err_out:
556    sdio_release_host(priv->ks_wlan_hw.sdio_card->func);
557
558    return;
559}
560
561
562
563static void ks_sdio_interrupt(struct sdio_func *func)
564{
565    int retval;
566    struct ks_sdio_card *card;
567    ks_wlan_private *priv;
568    unsigned char status, rsize, rw_data;
569
570    card = sdio_get_drvdata(func);
571    priv = card->priv;
572    DPRINTK(4, "\n");
573    printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
574
575    if(priv->dev_state >= DEVICE_STATE_BOOT){
576        retval = ks7010_sdio_read(priv, INT_PENDING, &status, sizeof(status));
577        if(retval){
578            DPRINTK(1, "read INT_PENDING Failed!!(%d)\n",retval);
579            goto intr_out;
580        }
581        DPRINTK(4, "INT_PENDING=%02X\n", rw_data);
582
583        /* schedule task for interrupt status */
584        /* bit7 -> Write General Communication B register */
585        /* read (General Communication B register) */
586        /* bit5 -> Write Status Idle */
587        /* bit2 -> Read Status Busy */
588        if(status&INT_GCR_B || atomic_read(&priv->psstatus.status)==PS_SNOOZE){
589            retval = ks7010_sdio_read(priv, GCR_B, &rw_data, sizeof(rw_data));
590            if(retval){
591                DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
592                goto intr_out;
593            }
594            /* DPRINTK(1, "GCR_B=%02X\n", rw_data); */
595            if(rw_data == GCR_B_ACTIVE){
596                if(atomic_read(&priv->psstatus.status)==PS_SNOOZE){
597                    atomic_set(&priv->psstatus.status, PS_WAKEUP);
598                    priv->wakeup_count=0;
599                }
600                complete(&priv->psstatus.wakeup_wait);
601            }
602
603
604        }
605
606        do{
607            /* read (WriteStatus/ReadDataSize FN1:00_0014) */
608            retval = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, sizeof(rw_data));
609            if(retval){
610                DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", rw_data);
611                goto intr_out;
612            }
613            DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data);
614            rsize=rw_data&RSIZE_MASK;
615            if(rsize){ /* Read schedule */
616                ks_wlan_hw_rx((void *)priv, (uint16_t)(((rsize)<<4)));
617            }
618            if(rw_data&WSTATUS_MASK){
619#if 0
620                if(status&INT_WRITE_STATUS && !cnt_txqbody(priv)){
621                    /* dummy write for interrupt clear */
622                    rw_data =0;
623                    retval = ks7010_sdio_write(priv, DATA_WINDOW, &rw_data, sizeof(rw_data));
624                    if (retval) {
625                        DPRINTK(1, "write DATA_WINDOW Failed!!(%d)\n",retval);
626                    }
627                    status &= ~INT_WRITE_STATUS;
628                }
629                else{
630#endif
631                    if(atomic_read(&priv->psstatus.status)==PS_SNOOZE){
632                        if(cnt_txqbody(priv)){
633                            ks_wlan_hw_wakeup_request(priv);
634                            queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, &priv->ks_wlan_hw.rw_wq, 1);
635                            return;
636                        }
637                    }
638                    else{
639                        printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
640                        tx_device_task((void *)priv);
641                    }
642// }
643            }
644        }while(rsize);
645    }
646
647    printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
648
649intr_out:
650    queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 0);
651    printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
652    return;
653}
654
655static int trx_device_init( ks_wlan_private *priv )
656{
657    /* initialize values (tx) */
658    priv->tx_dev.qtail = priv->tx_dev.qhead = 0;
659
660    /* initialize values (rx) */
661    priv->rx_dev.qtail = priv->rx_dev.qhead = 0;
662
663    /* initialize spinLock (tx,rx) */
664    spin_lock_init(&priv->tx_dev.tx_dev_lock);
665    spin_lock_init(&priv->rx_dev.rx_dev_lock);
666
667    tasklet_init(&priv->ks_wlan_hw.rx_bh_task, rx_event_task, (unsigned long)priv);
668
669    return 0;
670}
671
672static void trx_device_exit( ks_wlan_private *priv )
673{
674    struct tx_device_buffer *sp;
675
676    /* tx buffer clear */
677    while (cnt_txqbody(priv)>0) {
678        sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
679        kfree(sp->sendp); /* allocated memory free */
680        if (sp->complete_handler != NULL) /* TX Complete */
681            (*sp->complete_handler)(sp->arg1, sp->arg2);
682        inc_txqhead(priv);
683    }
684
685    tasklet_kill(&priv->ks_wlan_hw.rx_bh_task);
686
687    return;
688}
689static int ks7010_sdio_update_index(ks_wlan_private *priv, u32 index)
690{
691    int rc=0;
692    int retval;
693    unsigned char *data_buf;
694    data_buf = NULL;
695
696    data_buf = kmalloc(sizeof(u32), GFP_KERNEL);
697    if(!data_buf){ rc = 1; goto error_out; }
698
699    memcpy(data_buf, &index, sizeof(index));
700    retval = ks7010_sdio_write(priv, WRITE_INDEX, data_buf, sizeof(index));
701    if(retval){ rc = 2; goto error_out; }
702
703    retval = ks7010_sdio_write(priv, READ_INDEX, data_buf, sizeof(index));
704    if(retval){ rc = 3; goto error_out; }
705error_out:
706    if(data_buf) kfree(data_buf);
707    return rc;
708}
709
710#define ROM_BUFF_SIZE (64*1024)
711static int ks7010_sdio_data_compare(ks_wlan_private *priv, u32 address,
712                    unsigned char *data, unsigned int size)
713{
714    int rc=0;
715    int retval;
716    unsigned char *read_buf;
717    read_buf = NULL;
718    read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
719    if(!read_buf){ rc = 1; goto error_out; }
720    retval = ks7010_sdio_read(priv, address, read_buf, size);
721    if(retval){ rc = 2; goto error_out; }
722    retval = memcmp(data, read_buf, size);
723
724    if(retval){
725        DPRINTK(0, "data compare error (%d) \n",retval); rc = 3; goto error_out;
726    }
727error_out:
728    if(read_buf) kfree(read_buf);
729    return rc;
730}
731#ifndef NO_FIRMWARE_CLASS
732#include <linux/firmware.h>
733#endif
734static int ks79xx_upload_firmware(ks_wlan_private *priv, struct ks_sdio_card *card)
735{
736    unsigned int size, offset, n = 0;
737    unsigned char *rom_buf;
738    unsigned char rw_data =0;
739    int retval, rc=0;
740#ifndef NO_FIRMWARE_CLASS
741    int length;
742    const struct firmware *fw_entry = NULL;
743#else
744    int orgfsuid, orgfsgid;
745    struct file *srcf;
746    mm_segment_t orgfs;
747#endif
748
749    rom_buf = NULL;
750
751    /* buffer allocate */
752    rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
753    if(!rom_buf){ rc = 3; goto error_out0; }
754
755
756    sdio_claim_host(card->func);
757
758    /* Firmware running ? */
759    retval = ks7010_sdio_read(priv, GCR_A, &rw_data, sizeof(rw_data));
760    if(rw_data == GCR_A_RUN){
761        DPRINTK( 0, "MAC firmware running ...\n");
762        rc = 0;
763        goto error_out0;
764    }
765
766#ifndef NO_FIRMWARE_CLASS
767    if(request_firmware(&fw_entry, priv->reg.rom_file, &priv->ks_wlan_hw.sdio_card->func->dev)!=0){
768        DPRINTK(1,"error request_firmware() file=%s\n", priv->reg.rom_file);
769        return 1;
770    }
771    DPRINTK(4,"success request_firmware() file=%s size=%d\n", priv->reg.rom_file, fw_entry->size);
772    length = fw_entry->size;
773#else
774    orgfsuid=current->fsuid;
775    orgfsgid=current->fsgid;
776    current->fsuid=current->fsgid=0;
777    orgfs=get_fs();
778    set_fs(KERNEL_DS);
779
780    srcf = filp_open(romfile, O_RDONLY, 0);
781    if (IS_ERR(srcf)) {
782        DPRINTK(1, "error %ld opening %s\n", -PTR_ERR(srcf),romfile);
783        rc = 1;
784        goto error_out1;
785    }
786
787        if (!(srcf->f_op && srcf->f_op->read)) {
788                DPRINTK(1, "%s does not have a read method\n", romfile);
789                rc = 2;
790                goto error_out2;
791        }
792#endif
793
794    /* Load Program */
795    n = 0;
796        do {
797#ifndef NO_FIRMWARE_CLASS
798        if(length >= ROM_BUFF_SIZE){
799            size = ROM_BUFF_SIZE;
800            length = length - ROM_BUFF_SIZE;
801        }
802        else{
803            size=length;
804            length=0;
805        }
806        DPRINTK(4, "size = %d\n",size);
807        if(size == 0) break;
808        memcpy(rom_buf,fw_entry->data+n,size);
809#else
810        /* The object must have a read method */
811        size = srcf->f_op->read(srcf, rom_buf, ROM_BUFF_SIZE, &srcf->f_pos);
812        if (size < 0) {
813            DPRINTK(1, "Read %s error %d\n", priv->reg.rom_file, -retval);
814            rc = 5;
815            goto error_out2;
816        }
817        else if (size == 0) break;
818#endif
819        /* Update write index */
820        offset = n;
821        retval = ks7010_sdio_update_index(priv, KS7010_IRAM_ADDRESS+offset);
822        if(retval){ rc = 6; goto error_out1; }
823
824        /* Write data */
825        retval = ks7010_sdio_write(priv, DATA_WINDOW, rom_buf, size);
826        if(retval){ rc = 8; goto error_out1; }
827
828        /* compare */
829        retval = ks7010_sdio_data_compare(priv, DATA_WINDOW, rom_buf, size);
830        if(retval){ rc = 9; goto error_out1; }
831        n += size;
832
833       }while(size);
834
835    /* Remap request */
836    rw_data = GCR_A_REMAP;
837    retval = ks7010_sdio_write(priv, GCR_A, &rw_data, sizeof(rw_data));
838    if(retval){
839        rc = 11;
840        goto error_out1;
841    }
842    DPRINTK( 4, " REMAP Request : GCR_A=%02X\n", rw_data);
843
844    /* Firmware running check */
845    for (n = 0; n < 50; ++n) {
846        mdelay(10);/* wait_ms(10); */
847        retval = ks7010_sdio_read(priv, GCR_A, &rw_data, sizeof(rw_data));
848        if(retval){ rc = 11; goto error_out1; }
849        if(rw_data == GCR_A_RUN) break;
850    }
851    DPRINTK(4, "firmware wakeup (%d)!!!!\n",n);
852    if ((50) <= n) {
853        DPRINTK(1, "firmware can't start\n");
854                rc = 12;
855        goto error_out1;
856    }
857
858    rc = 0;
859
860#ifdef NO_FIRMWARE_CLASS
861 error_out2:
862    retval=filp_close(srcf ,NULL);
863    if (retval)
864        DPRINTK(1, "error %d closing %s\n", -retval,priv->reg.rom_file);
865
866 error_out1:
867    set_fs(orgfs);
868    current->fsuid=orgfsuid;
869    current->fsgid=orgfsgid;
870#else
871 error_out1:
872    release_firmware(fw_entry);
873#endif
874 error_out0:
875    sdio_release_host(card->func);
876    if(rom_buf)
877        kfree(rom_buf);
878    return rc;
879}
880
881static void card_init_task(struct work_struct *work)
882{
883    struct hw_info_t *hw;
884    struct ks_wlan_private *priv;
885
886    hw = container_of(work, struct hw_info_t, init_task);
887    priv = container_of(hw, struct ks_wlan_private, ks_wlan_hw);
888
889    DPRINTK(5,"\ncard_init_task()\n");
890
891    /* init_waitqueue_head(&priv->confirm_wait); */
892    init_completion(&priv->confirm_wait);
893
894    DPRINTK(5,"init_completion()\n");
895
896    /* get mac address & firmware version */
897    hostif_sme_enqueue(priv, SME_START);
898
899    DPRINTK(5,"hostif_sme_enqueu()\n");
900
901    if(!wait_for_completion_interruptible_timeout(&priv->confirm_wait,5*HZ)){
902        DPRINTK(1,"wait time out!! SME_START\n");
903    }
904
905    if(priv->mac_address_valid && priv->version_size){
906        priv->dev_state = DEVICE_STATE_PREINIT;
907    }
908
909    hostif_sme_enqueue(priv, SME_GET_EEPROM_CKSUM);
910
911    /* load initial wireless parameter */
912    hostif_sme_enqueue(priv, SME_STOP_REQUEST);
913
914    hostif_sme_enqueue(priv, SME_RTS_THRESHOLD_REQUEST);
915    hostif_sme_enqueue(priv, SME_FRAGMENTATION_THRESHOLD_REQUEST);
916
917    hostif_sme_enqueue(priv, SME_WEP_INDEX_REQUEST);
918    hostif_sme_enqueue(priv, SME_WEP_KEY1_REQUEST);
919    hostif_sme_enqueue(priv, SME_WEP_KEY2_REQUEST);
920    hostif_sme_enqueue(priv, SME_WEP_KEY3_REQUEST);
921    hostif_sme_enqueue(priv, SME_WEP_KEY4_REQUEST);
922
923    hostif_sme_enqueue(priv, SME_WEP_FLAG_REQUEST);
924    hostif_sme_enqueue(priv, SME_RSN_ENABLED_REQUEST);
925    hostif_sme_enqueue(priv, SME_MODE_SET_REQUEST);
926    hostif_sme_enqueue(priv, SME_START_REQUEST);
927
928    if(!wait_for_completion_interruptible_timeout(&priv->confirm_wait,5*HZ)){
929        DPRINTK(1,"wait time out!! wireless parameter set\n");
930    }
931
932    if(priv->dev_state >= DEVICE_STATE_PREINIT){
933        DPRINTK(1, "DEVICE READY!!\n");
934        priv->dev_state = DEVICE_STATE_READY;
935        reg_net = register_netdev (priv->net_dev);
936        DPRINTK(3, "register_netdev=%d\n",reg_net);
937    }
938    else {
939        DPRINTK(1, "dev_state=%d\n",priv->dev_state);
940    }
941}
942
943static struct sdio_driver ks7010_sdio_driver = {
944    .name = "ks7910_sdio",
945    .id_table = if_sdio_ids,
946    .probe = ks7910_sdio_probe,
947    .remove = ks7910_sdio_remove,
948};
949
950
951extern int ks_wlan_net_start(struct net_device *dev);
952extern int ks_wlan_net_stop(struct net_device *dev);
953
954static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_id *device)
955{
956    ks_wlan_private *priv;
957    struct ks_sdio_card *card;
958    struct net_device *netdev;
959    unsigned char rw_data;
960    int i=0, ret;
961
962    DPRINTK(5, "ks7910_sdio_probe()\n");
963
964    priv = NULL;
965    netdev=NULL;
966
967
968    /* initilize ks_sdio_card */
969    card = kzalloc(sizeof(struct ks_sdio_card), GFP_KERNEL);
970    if (!card)
971        return -ENOMEM;
972
973    card->func = func;
974    card->model = 0x10;
975    spin_lock_init(&card->lock);
976
977    /* select model */
978    for (i = 0;i < ARRAY_SIZE(ks_sdio_models);i++) {
979        if (card->model == ks_sdio_models[i].model)
980            break;
981    }
982
983    if (i == ARRAY_SIZE(ks_sdio_models)) {
984        DPRINTK(5, "unkown card model 0x%x\n", card->model);
985        goto error;
986    }
987
988    card->firmware = ks_sdio_models[i].firmware;
989
990
991    /*** Initialize SDIO ***/
992    sdio_claim_host(func);
993
994    /* bus setting */
995    /* Issue config request to override clock rate */
996
997    /* function blocksize set */
998    ret = sdio_set_block_size(func, KS7010_IO_BLOCK_SIZE);
999    DPRINTK(5, "multi_block=%d sdio_set_block_size()=%d %d\n", func->card->cccr.multi_block, func->cur_blksize, ret);
1000
1001    /* Allocate the slot current */
1002
1003    /* function enable */
1004    ret = sdio_enable_func(func);
1005    DPRINTK(5, "sdio_enable_func() %d\n", ret);
1006    if (ret)
1007        goto error_free_card;
1008
1009    /* interrupt disable */
1010    sdio_writeb(func, 0, INT_ENABLE, &ret);
1011    if (ret)
1012        goto error_free_card;
1013    sdio_writeb(func, 0xff, INT_PENDING, &ret);
1014    if (ret)
1015        goto error_disable_func;
1016
1017    /* setup interrupt handler */
1018    ret = sdio_claim_irq(func, ks_sdio_interrupt);
1019    if (ret)
1020        goto error_disable_func;
1021
1022    sdio_release_host(func);
1023
1024    sdio_set_drvdata(func, card);
1025
1026    DPRINTK(5, "class = 0x%X, vendor = 0x%X, "
1027        "device = 0x%X\n",
1028        func->class, func->vendor, func->device);
1029
1030
1031    /* private memory allocate */
1032    netdev = alloc_etherdev(sizeof(*priv));
1033    if (netdev == NULL) {
1034        printk (KERN_ERR "ks79xx : Unable to alloc new net device\n");
1035        goto error_release_irq;
1036    }
1037    if (dev_alloc_name(netdev, netdev->name) < 0) {
1038        printk (KERN_ERR "ks79xx : Couldn't get name!\n");
1039        goto error_free_netdev;
1040    }
1041
1042    priv = netdev_priv(netdev);
1043
1044    card->priv = priv;
1045    SET_NETDEV_DEV(netdev, &card->func->dev); /* for create sysfs symlinks */
1046
1047    /* private memory initialize */
1048    priv->ks_wlan_hw.sdio_card = card;
1049    init_completion(&priv->ks_wlan_hw.ks7010_sdio_wait);
1050    priv->ks_wlan_hw.read_buf = NULL;
1051    priv->ks_wlan_hw.read_buf = kmalloc(RX_DATA_SIZE, GFP_KERNEL);
1052    if(!priv->ks_wlan_hw.read_buf){
1053        goto error_free_netdev;
1054    }
1055    priv->dev_state = DEVICE_STATE_PREBOOT;
1056    priv->net_dev = netdev;
1057    priv->firmware_version[0] = '\0';
1058    priv->version_size = 0;
1059    priv->last_doze = jiffies; /* set current jiffies */
1060    priv->last_wakeup = jiffies;
1061    memset(&priv->nstats, 0, sizeof(priv->nstats));
1062    memset(&priv->wstats, 0, sizeof(priv->wstats));
1063
1064    /* sleep mode */
1065    atomic_set(&priv->sleepstatus.doze_request,0);
1066    atomic_set(&priv->sleepstatus.wakeup_request,0);
1067    atomic_set(&priv->sleepstatus.wakeup_request,0);
1068
1069    trx_device_init(priv);
1070    hostif_init(priv);
1071        ks_wlan_net_start(netdev);
1072
1073    /* Read config file */
1074    ret = ks_wlan_read_config_file(priv);
1075    if (ret) {
1076        printk(KERN_ERR "ks79xx: read configuration file failed !! retern code = %d\n", ret);
1077        goto error_free_read_buf;
1078    }
1079
1080    /* Upload firmware */
1081    ret = ks79xx_upload_firmware(priv, card); /* firmware load */
1082    if(ret){
1083        printk(KERN_ERR "ks79xx: firmware load failed !! retern code = %d\n", ret);
1084        goto error_free_read_buf;
1085    }
1086
1087    /* interrupt setting */
1088    /* clear Interrupt status write (ARMtoSD_InterruptPending FN1:00_0024) */
1089    rw_data = 0xff;
1090    sdio_claim_host(func);
1091    ret = ks7010_sdio_write(priv, INT_PENDING, &rw_data, sizeof(rw_data));
1092    sdio_release_host(func);
1093    if(ret){
1094        DPRINTK(1, " error : INT_PENDING=%02X\n", rw_data);
1095    }
1096    DPRINTK(4, " clear Interrupt : INT_PENDING=%02X\n", rw_data);
1097
1098
1099    /* enable ks7010sdio interrupt (INT_GCR_B|INT_READ_STATUS|INT_WRITE_STATUS) */
1100    rw_data = (INT_GCR_B|INT_READ_STATUS|INT_WRITE_STATUS);
1101    sdio_claim_host(func);
1102    ret = ks7010_sdio_write(priv, INT_ENABLE, &rw_data, sizeof(rw_data));
1103    sdio_release_host(func);
1104    if(ret){
1105        DPRINTK(1, " error : INT_ENABLE=%02X\n", rw_data);
1106    }
1107    DPRINTK(4, " enable Interrupt : INT_ENABLE=%02X\n", rw_data);
1108    priv->dev_state = DEVICE_STATE_BOOT;
1109
1110    priv->ks_wlan_hw.ks7010sdio_wq = create_workqueue("ks7010sdio_wq");
1111    if(!priv->ks_wlan_hw.ks7010sdio_wq){
1112        DPRINTK(1, "create_workqueue failed !!\n");
1113        goto error_free_read_buf;
1114    }
1115
1116    priv->ks_wlan_hw.ks7010sdio_init = create_singlethread_workqueue("ks7010sdio_init");
1117    if(!priv->ks_wlan_hw.ks7010sdio_init){
1118        DPRINTK(1, "create_workqueue failed !!\n");
1119        goto error_free_sdio_wq;
1120    }
1121
1122    INIT_WORK(&priv->ks_wlan_hw.init_task, card_init_task);
1123    INIT_DELAYED_WORK(&priv->ks_wlan_hw.rw_wq, ks7010_rw_function);
1124
1125    queue_work(priv->ks_wlan_hw.ks7010sdio_init, &priv->ks_wlan_hw.init_task);
1126
1127    return 0;
1128
1129error_free_sdio_wq:
1130    flush_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);
1131    destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);
1132    priv->ks_wlan_hw.ks7010sdio_wq = NULL;
1133error_free_read_buf:
1134    kfree(priv->ks_wlan_hw.read_buf);
1135    priv->ks_wlan_hw.read_buf = NULL;
1136error_free_netdev:
1137    free_netdev(priv->net_dev);
1138    card->priv = NULL;
1139error_release_irq:
1140    sdio_claim_host(func);
1141    sdio_release_irq(func);
1142error_disable_func:
1143    sdio_disable_func(func);
1144error_free_card:
1145    sdio_release_host(func);
1146    sdio_set_drvdata(func, NULL);
1147    kfree(card);
1148error:
1149    return -ENODEV;
1150}
1151
1152static void ks7910_sdio_remove(struct sdio_func *func)
1153{
1154    int ret;
1155    struct ks_sdio_card *card;
1156    struct ks_wlan_private *priv;
1157    struct net_device *netdev;
1158    DPRINTK(1, "ks7910_sdio_remove()\n");
1159
1160    card = sdio_get_drvdata(func);
1161
1162    if(card == NULL)
1163        return;
1164
1165    DPRINTK(1, "priv = card->priv\n");
1166    priv = card->priv;
1167    netdev = priv->net_dev;
1168    if(priv){
1169        ks_wlan_net_stop(netdev);
1170        DPRINTK(1, "ks_wlan_net_stop\n");
1171
1172        /* interrupt disable */
1173        sdio_claim_host(func);
1174        sdio_writeb(func, 0, INT_ENABLE, &ret);
1175        sdio_writeb(func, 0xff, INT_PENDING, &ret);
1176        sdio_release_host(func);
1177        DPRINTK(1, "interrupt disable\n");
1178
1179        /* send stop request to MAC */
1180        {
1181            struct hostif_stop_request_t *pp;
1182            pp = (struct hostif_stop_request_t *)kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL );
1183            if (pp==NULL) {
1184                DPRINTK(3,"allocate memory failed..\n");
1185                return; /* to do goto ni suru*/
1186            }
1187            pp->header.size = cpu_to_le16((uint16_t)(sizeof(*pp)-sizeof(pp->header.size)));
1188            pp->header.event = cpu_to_le16((uint16_t)HIF_STOP_REQ);
1189
1190            sdio_claim_host(func);
1191            write_to_device(priv, (unsigned char *) pp, hif_align_size(sizeof(*pp)));
1192            sdio_release_host(func);
1193            kfree(pp);
1194        }
1195        DPRINTK(1, "STOP Req\n");
1196
1197        if(priv->ks_wlan_hw.ks7010sdio_wq){
1198            flush_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);
1199            destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);
1200        }
1201        DPRINTK(1, "destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);\n");
1202
1203        if(priv->ks_wlan_hw.ks7010sdio_init){
1204            flush_workqueue(priv->ks_wlan_hw.ks7010sdio_init);
1205            destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_init);
1206        }
1207        DPRINTK(1, "destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_init);\n");
1208
1209        hostif_exit(priv);
1210        DPRINTK(1, "hostif_exit\n");
1211
1212        if(!reg_net)
1213            unregister_netdev(netdev);
1214        DPRINTK(1, "unregister_netdev\n");
1215
1216        trx_device_exit(priv);
1217        if(priv->ks_wlan_hw.read_buf){
1218            kfree(priv->ks_wlan_hw.read_buf);
1219        }
1220        free_netdev(priv->net_dev);
1221        card->priv = NULL;
1222    }
1223
1224    sdio_claim_host(func);
1225    sdio_release_irq(func);
1226    DPRINTK(1, "sdio_release_irq()\n");
1227    sdio_disable_func(func);
1228    DPRINTK(1, "sdio_disable_func()\n");
1229    sdio_release_host(func);
1230
1231    sdio_set_drvdata(func, NULL);
1232
1233    kfree(card);
1234    DPRINTK(1, "kfree()\n");
1235
1236
1237    DPRINTK(5," Bye !!\n");
1238    return;
1239}
1240
1241static int __init ks7010_sdio_init( void )
1242{
1243    int status;
1244    printk(KERN_INFO "ks7010_sdio : %s %s\n" ,__DATE__,__TIME__);
1245
1246    /* register with bus driver core */
1247    status = sdio_register_driver(&ks7010_sdio_driver);
1248    if(status != 0){
1249        DPRINTK(1,"ks79xx_sdio : failed to register with bus driver, %d\n", status );
1250    }
1251    return status;
1252}
1253
1254static void __exit ks7010_sdio_exit( void )
1255{
1256    DPRINTK(5," \n");
1257    sdio_unregister_driver(&ks7010_sdio_driver);
1258    return;
1259}
1260
1261module_init(ks7010_sdio_init);
1262module_exit(ks7010_sdio_exit);
1263
1264MODULE_AUTHOR("Qi-Hardware based on KeyStream driver");
1265MODULE_DESCRIPTION("Driver for KeyStream, KS7010 based SDIO cards. ");
1266#ifdef MODULE_LICENSE
1267MODULE_LICENSE("GPL");
1268#endif
1269MODULE_SUPPORTED_DEVICE("KS7910");
1270

Archive Download this file



interactive