1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33#include <linux/proc_fs.h>
34#include <linux/seq_file.h>
35
36#include "csr_wifi_hip_unifi.h"
37#include "csr_wifi_hip_unifiversion.h"
38#include "csr_wifi_hip_unifi_udi.h"
39#include "unifiio.h"
40#include "unifi_priv.h"
41
42
43
44
45
46
47
48
49
50
51static unifi_priv_t *Unifi_instances[MAX_UNIFI_DEVS];
52
53
54
55
56
57static netInterface_priv_t *Unifi_netdev_instances[MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES];
58
59
60
61
62
63
64
65#define UNIFI_DEV_NOT_IN_USE 0
66#define UNIFI_DEV_IN_USE 1
67#define UNIFI_DEV_CLEANUP 2
68static int In_use[MAX_UNIFI_DEVS];
69
70
71
72
73DEFINE_SEMAPHORE(Unifi_instance_mutex);
74
75
76
77
78DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq);
79
80#ifdef CONFIG_PROC_FS
81
82
83
84static int uf_proc_show(struct seq_file *m, void *v);
85
86#define UNIFI_DEBUG_TXT_BUFFER (8 * 1024)
87
88static int uf_proc_open(struct inode *inode, struct file *file)
89{
90 return single_open_size(file, uf_proc_show, PDE_DATA(inode),
91 UNIFI_DEBUG_TXT_BUFFER);
92}
93
94static const struct file_operations uf_proc_fops = {
95 .open = uf_proc_open,
96 .read = seq_read,
97 .llseek = seq_lseek,
98 .release = single_release,
99};
100
101#endif
102
103#ifdef CSR_WIFI_RX_PATH_SPLIT
104
105static CsrResult signal_buffer_init(unifi_priv_t * priv, int size)
106{
107 int i;
108
109 priv->rxSignalBuffer.writePointer =
110 priv->rxSignalBuffer.readPointer = 0;
111 priv->rxSignalBuffer.size = size;
112
113 for(i=0; i<size; i++)
114 {
115 priv->rxSignalBuffer.rx_buff[i].sig_len=0;
116 priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL);
117 if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL)
118 {
119 int j;
120 unifi_error(priv,"signal_buffer_init:Failed to Allocate shared memory for T-H signals \n");
121 for(j=0;j<i;j++)
122 {
123 priv->rxSignalBuffer.rx_buff[j].sig_len=0;
124 kfree(priv->rxSignalBuffer.rx_buff[j].bufptr);
125 priv->rxSignalBuffer.rx_buff[j].bufptr = NULL;
126 }
127 return -1;
128 }
129 }
130 return 0;
131}
132
133
134static void signal_buffer_free(unifi_priv_t * priv, int size)
135{
136 int i;
137
138 for(i=0; i<size; i++)
139 {
140 priv->rxSignalBuffer.rx_buff[i].sig_len=0;
141 kfree(priv->rxSignalBuffer.rx_buff[i].bufptr);
142 priv->rxSignalBuffer.rx_buff[i].bufptr = NULL;
143 }
144}
145#endif
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166int
167uf_register_netdev(unifi_priv_t *priv, int interfaceTag)
168{
169 int r;
170 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
171
172 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
173 unifi_error(priv, "uf_register_netdev bad interfaceTag\n");
174 return -EINVAL;
175 }
176
177
178
179
180
181 unifi_trace(priv, UDBG5, "uf_register_netdev: netdev %d - 0x%p\n",
182 interfaceTag, priv->netdev[interfaceTag]);
183 r = register_netdev(priv->netdev[interfaceTag]);
184 if (r) {
185 unifi_error(priv, "Failed to register net device\n");
186 return -EINVAL;
187 }
188
189
190 interfacePriv->netdev_registered = 1;
191
192#ifdef CSR_SUPPORT_SME
193
194
195
196 uf_register_inet_notifier();
197#endif
198
199 unifi_notice(priv, "unifi%d is %s\n",
200 priv->instance, priv->netdev[interfaceTag]->name);
201
202 return 0;
203}
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220void
221uf_unregister_netdev(unifi_priv_t *priv)
222{
223 int i=0;
224
225#ifdef CSR_SUPPORT_SME
226
227 uf_unregister_inet_notifier();
228#endif
229
230 for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) {
231 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
232 if (interfacePriv->netdev_registered) {
233 unifi_trace(priv, UDBG5,
234 "uf_unregister_netdev: netdev %d - 0x%p\n",
235 i, priv->netdev[i]);
236
237
238 unregister_netdev(priv->netdev[i]);
239 interfacePriv->netdev_registered = 0;
240 }
241
242 interfacePriv->interfaceMode = 0;
243
244
245 interfacePriv->queueEnabled[0] = 1;
246 interfacePriv->queueEnabled[1] = 1;
247 interfacePriv->queueEnabled[2] = 1;
248 interfacePriv->queueEnabled[3] = 1;
249 }
250
251 priv->totalInterfaceCount = 0;
252}
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277static unifi_priv_t *
278register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev)
279{
280 unifi_priv_t *priv = NULL;
281 int r = -1;
282 CsrResult csrResult;
283
284 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
285 unifi_error(priv, "register_unifi_sdio: invalid device %d\n",
286 bus_id);
287 return NULL;
288 }
289
290 down(&Unifi_instance_mutex);
291
292 if (In_use[bus_id] != UNIFI_DEV_NOT_IN_USE) {
293 unifi_error(priv, "register_unifi_sdio: device %d is already in use\n",
294 bus_id);
295 goto failed0;
296 }
297
298
299
300 priv = uf_alloc_netdevice(sdio_dev, bus_id);
301 if (priv == NULL) {
302 unifi_error(priv, "Failed to allocate driver private\n");
303 goto failed0;
304 }
305
306 priv->unifi_device = dev;
307
308 SET_NETDEV_DEV(priv->netdev[0], dev);
309
310
311 netif_carrier_off(priv->netdev[0]);
312
313
314 priv->card = unifi_alloc_card(priv->sdio, priv);
315 if (priv->card == NULL) {
316 unifi_error(priv, "Failed to allocate UniFi driver card struct.\n");
317 goto failed1;
318 }
319
320 if (Unifi_instances[bus_id]) {
321 unifi_error(priv, "Internal error: instance for slot %d is already taken\n",
322 bus_id);
323 }
324 Unifi_instances[bus_id] = priv;
325 In_use[bus_id] = UNIFI_DEV_IN_USE;
326
327
328 Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES] = netdev_priv(priv->netdev[0]);
329
330
331 csrResult = unifi_coredump_init(priv->card, (u16)coredump_max);
332 if (csrResult != CSR_RESULT_SUCCESS) {
333 unifi_error(priv, "Couldn't allocate mini-coredump buffers\n");
334 }
335
336
337 r = uf_create_device_nodes(priv, bus_id);
338 if (r) {
339 goto failed1;
340 }
341
342
343
344
345 scnprintf(priv->proc_entry_name, 64, "driver/unifi%d", priv->instance);
346
347
348
349
350 if (!proc_create_data(priv->proc_entry_name, 0, NULL,
351 &uf_proc_fops, (void *)(long)priv->instance))
352 {
353 unifi_error(priv, "unifi: can't create /proc/driver/unifi\n");
354 }
355
356
357 {
358 int i;
359 priv->totalInterfaceCount =0;
360
361 for(i=1;i<CSR_WIFI_NUM_INTERFACES;i++)
362 {
363 if( !uf_alloc_netdevice_for_other_interfaces(priv,i) )
364 {
365
366
367
368
369 unifi_error(priv, "Failed to allocate driver private for interface[%d]\n",i);
370 goto failed0;
371 }
372 else
373 {
374 SET_NETDEV_DEV(priv->netdev[i], dev);
375
376
377 netif_carrier_off(priv->netdev[i]);
378
379
380 Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES + i] = netdev_priv(priv->netdev[i]);
381 }
382 }
383
384 for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++)
385 {
386 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
387 interfacePriv->netdev_registered=0;
388 }
389 }
390
391#ifdef CSR_WIFI_RX_PATH_SPLIT
392 if (signal_buffer_init(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE))
393 {
394 unifi_error(priv,"Failed to allocate shared memory for T-H signals\n");
395 goto failed2;
396 }
397 priv->rx_workqueue = create_singlethread_workqueue("rx_workq");
398 if (priv->rx_workqueue == NULL) {
399 unifi_error(priv,"create_singlethread_workqueue failed \n");
400 goto failed3;
401 }
402 INIT_WORK(&priv->rx_work_struct, rx_wq_handler);
403#endif
404
405#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
406 if (log_hip_signals)
407 {
408 uf_register_hip_offline_debug(priv);
409 }
410#endif
411
412
413 r = uf_sme_init(priv);
414 if (r) {
415 unifi_error(priv, "SME initialisation failed.\n");
416 goto failed4;
417 }
418
419
420
421
422
423 unifi_trace(priv, UDBG1, "run UniFi helper app...\n");
424 r = uf_run_unifihelper(priv);
425 if (r) {
426 unifi_notice(priv, "unable to run UniFi helper app\n");
427
428 }
429
430 up(&Unifi_instance_mutex);
431
432 return priv;
433
434failed4:
435#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
436if (log_hip_signals)
437{
438 uf_unregister_hip_offline_debug(priv);
439}
440#endif
441#ifdef CSR_WIFI_RX_PATH_SPLIT
442 flush_workqueue(priv->rx_workqueue);
443 destroy_workqueue(priv->rx_workqueue);
444failed3:
445 signal_buffer_free(priv,CSR_WIFI_RX_SIGNAL_BUFFER_SIZE);
446failed2:
447#endif
448
449 uf_destroy_device_nodes(priv);
450failed1:
451
452 ul_deregister_client(priv->netdev_client);
453
454failed0:
455 if (priv && priv->card) {
456 unifi_coredump_free(priv->card);
457 unifi_free_card(priv->card);
458 }
459 if (priv) {
460 uf_free_netdevice(priv);
461 }
462
463 up(&Unifi_instance_mutex);
464
465 return NULL;
466}
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485static void
486ask_unifi_sdio_cleanup(unifi_priv_t *priv)
487{
488
489
490
491
492
493
494
495 In_use[priv->instance] = UNIFI_DEV_CLEANUP;
496
497 unifi_trace(NULL, UDBG5, "ask_unifi_sdio_cleanup: wake up cleanup workqueue.\n");
498 wake_up(&Unifi_cleanup_wq);
499
500}
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516static void
517cleanup_unifi_sdio(unifi_priv_t *priv)
518{
519 int priv_instance;
520 int i;
521 static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
522
523
524 uf_destroy_device_nodes(priv);
525
526
527 Unifi_instances[priv->instance] = NULL;
528
529 unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: remove_proc_entry\n");
530
531
532
533
534 remove_proc_entry(priv->proc_entry_name, 0);
535
536
537
538 if (priv->netdev_client) {
539 unifi_trace(priv, UDBG2, "Netdev client (id:%d s:0x%X) is unregistered\n",
540 priv->netdev_client->client_id, priv->netdev_client->sender_id);
541 ul_deregister_client(priv->netdev_client);
542 }
543
544
545 uf_sme_deinit(priv);
546
547#ifdef CSR_SME_USERSPACE
548 priv->smepriv = NULL;
549#endif
550
551#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
552 if (log_hip_signals)
553 {
554 uf_unregister_hip_offline_debug(priv);
555 }
556#endif
557
558
559 for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++)
560 {
561 uf_free_pending_rx_packets(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address,i);
562 uf_free_pending_rx_packets(priv, UF_CONTROLLED_PORT_Q, broadcast_address,i);
563 }
564
565
566
567
568 if (priv->card) {
569 unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: free card\n");
570 unifi_coredump_free(priv->card);
571 unifi_free_card(priv->card);
572 priv->card = NULL;
573 }
574
575
576
577
578
579
580 uf_unregister_netdev(priv);
581 priv->totalInterfaceCount = 0;
582
583
584 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
585 Unifi_netdev_instances[priv->instance * CSR_WIFI_NUM_INTERFACES + i] = NULL;
586 }
587
588 unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: uf_free_netdevice\n");
589
590
591
592
593 priv_instance = priv->instance;
594
595#ifdef CSR_WIFI_RX_PATH_SPLIT
596 flush_workqueue(priv->rx_workqueue);
597 destroy_workqueue(priv->rx_workqueue);
598 signal_buffer_free(priv,CSR_WIFI_RX_SIGNAL_BUFFER_SIZE);
599#endif
600
601
602 uf_free_netdevice(priv);
603
604
605
606
607
608
609
610 In_use[priv_instance] = UNIFI_DEV_NOT_IN_USE;
611
612 unifi_trace(NULL, UDBG5, "cleanup_unifi_sdio: DONE.\n");
613
614}
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630static void
631unregister_unifi_sdio(int bus_id)
632{
633 unifi_priv_t *priv;
634 int interfaceTag=0;
635 u8 reason = CONFIG_IND_EXIT;
636
637 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
638 unifi_error(NULL, "unregister_unifi_sdio: invalid device %d\n",
639 bus_id);
640 return;
641 }
642
643 priv = Unifi_instances[bus_id];
644 if (priv == NULL) {
645 unifi_error(priv, "unregister_unifi_sdio: device %d is not registered\n",
646 bus_id);
647 return;
648 }
649
650
651 for(interfaceTag=0;interfaceTag<priv->totalInterfaceCount;interfaceTag++)
652 {
653 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
654 if(interfacePriv->netdev_registered)
655 {
656 netif_carrier_off(priv->netdev[interfaceTag]);
657 netif_tx_stop_all_queues(priv->netdev[interfaceTag]);
658 }
659 }
660
661#ifdef CSR_NATIVE_LINUX
662
663
664
665
666
667 uf_stop_thread(priv, &priv->bh_thread);
668
669
670 if (csr_sdio_linux_remove_irq(priv->sdio)) {
671 unifi_notice(priv,
672 "csr_sdio_linux_remove_irq failed to talk to card.\n");
673 }
674
675
676 uf_abort_mlme(priv);
677#endif
678
679 ul_log_config_ind(priv, &reason, sizeof(u8));
680
681
682 unifi_remove_udi_hook(priv->card, logging_handler);
683
684 uf_put_instance(bus_id);
685
686
687
688
689
690 wait_event(Unifi_cleanup_wq, In_use[bus_id] == UNIFI_DEV_CLEANUP);
691 unifi_trace(NULL, UDBG5, "Received clean up event\n");
692
693
694 cleanup_unifi_sdio(priv);
695
696}
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712unifi_priv_t *
713uf_find_instance(int inst)
714{
715 if ((inst < 0) || (inst >= MAX_UNIFI_DEVS)) {
716 return NULL;
717 }
718 return Unifi_instances[inst];
719}
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735int
736uf_find_priv(unifi_priv_t *priv)
737{
738 int inst;
739
740 if (!priv) {
741 return -1;
742 }
743
744 for (inst = 0; inst < MAX_UNIFI_DEVS; inst++) {
745 if (Unifi_instances[inst] == priv) {
746 return inst;
747 }
748 }
749
750 return -1;
751}
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766int
767uf_find_netdev_priv(netInterface_priv_t *priv)
768{
769 int inst;
770
771 if (!priv) {
772 return -1;
773 }
774
775 for (inst = 0; inst < MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES; inst++) {
776 if (Unifi_netdev_instances[inst] == priv) {
777 return inst;
778 }
779 }
780
781 return -1;
782}
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798unifi_priv_t *
799uf_get_instance(int inst)
800{
801 unifi_priv_t *priv;
802
803 down(&Unifi_instance_mutex);
804
805 priv = uf_find_instance(inst);
806 if (priv) {
807 priv->ref_count++;
808 }
809
810 up(&Unifi_instance_mutex);
811
812 return priv;
813}
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829void
830uf_put_instance(int inst)
831{
832 unifi_priv_t *priv;
833
834 down(&Unifi_instance_mutex);
835
836 priv = uf_find_instance(inst);
837 if (priv) {
838 priv->ref_count--;
839 if (priv->ref_count == 0) {
840 ask_unifi_sdio_cleanup(priv);
841 }
842 }
843
844 up(&Unifi_instance_mutex);
845}
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866#ifdef CONFIG_PROC_FS
867static int uf_proc_show(struct seq_file *m, void *v)
868{
869 unifi_priv_t *priv;
870 int i;
871
872
873
874
875
876
877 priv = uf_find_instance((long)m->private);
878 if (!priv)
879 return 0;
880
881 seq_printf(m, "UniFi SDIO Driver: %s %s %s\n",
882 CSR_WIFI_VERSION, __DATE__, __TIME__);
883#ifdef CSR_SME_USERSPACE
884 seq_puts(m, "SME: CSR userspace ");
885#ifdef CSR_SUPPORT_WEXT
886 seq_puts(m, "with WEXT support\n");
887#else
888 seq_putc(m, '\n');
889#endif
890#endif
891#ifdef CSR_NATIVE_LINUX
892 seq_puts(m, "SME: native\n");
893#endif
894
895#ifdef CSR_SUPPORT_SME
896 seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n",
897 priv->card_info.fw_build,
898 priv->sme_versions.firmwarePatch);
899#endif
900
901 unifi_print_status(priv->card, m);
902
903 seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string);
904
905 seq_puts(m, "Last dbg16:");
906 for (i = 0; i < 8; i++)
907 seq_printf(m, " %04X", priv->last_debug_word16[i]);
908 seq_putc(m, '\n');
909 seq_puts(m, " ");
910 for (; i < 16; i++)
911 seq_printf(m, " %04X", priv->last_debug_word16[i]);
912 seq_putc(m, '\n');
913 return 0;
914}
915#endif
916
917
918
919
920static void
921uf_lx_suspend(CsrSdioFunction *sdio_ctx)
922{
923 unifi_priv_t *priv = sdio_ctx->driverData;
924 unifi_suspend(priv);
925
926 CsrSdioSuspendAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS);
927}
928
929static void
930uf_lx_resume(CsrSdioFunction *sdio_ctx)
931{
932 unifi_priv_t *priv = sdio_ctx->driverData;
933 unifi_resume(priv);
934
935 CsrSdioResumeAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS);
936}
937
938static int active_slot = MAX_UNIFI_DEVS;
939static struct device *os_devices[MAX_UNIFI_DEVS];
940
941void
942uf_add_os_device(int bus_id, struct device *os_device)
943{
944 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
945 unifi_error(NULL, "uf_add_os_device: invalid device %d\n",
946 bus_id);
947 return;
948 }
949
950 active_slot = bus_id;
951 os_devices[bus_id] = os_device;
952}
953
954void
955uf_remove_os_device(int bus_id)
956{
957 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
958 unifi_error(NULL, "uf_remove_os_device: invalid device %d\n",
959 bus_id);
960 return;
961 }
962
963 active_slot = bus_id;
964 os_devices[bus_id] = NULL;
965}
966
967static void
968uf_sdio_inserted(CsrSdioFunction *sdio_ctx)
969{
970 unifi_priv_t *priv;
971
972 unifi_trace(NULL, UDBG5, "uf_sdio_inserted(0x%p), slot_id=%d, dev=%p\n",
973 sdio_ctx, active_slot, os_devices[active_slot]);
974
975 priv = register_unifi_sdio(sdio_ctx, active_slot, os_devices[active_slot]);
976 if (priv == NULL) {
977 CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_FAILURE);
978 return;
979 }
980
981 sdio_ctx->driverData = priv;
982
983 CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS);
984}
985
986
987static void
988uf_sdio_removed(CsrSdioFunction *sdio_ctx)
989{
990 unregister_unifi_sdio(active_slot);
991 CsrSdioRemovedAcknowledge(sdio_ctx);
992}
993
994
995static void
996uf_sdio_dsr_handler(CsrSdioFunction *sdio_ctx)
997{
998 unifi_priv_t *priv = sdio_ctx->driverData;
999
1000 unifi_sdio_interrupt_handler(priv->card);
1001}
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019static CsrSdioInterruptDsrCallback
1020uf_sdio_int_handler(CsrSdioFunction *sdio_ctx)
1021{
1022 return uf_sdio_dsr_handler;
1023}
1024
1025
1026
1027
1028static CsrSdioFunctionId unifi_ids[] =
1029{
1030 {
1031 .manfId = SDIO_MANF_ID_CSR,
1032 .cardId = SDIO_CARD_ID_UNIFI_3,
1033 .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_3,
1034 .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE,
1035 },
1036 {
1037 .manfId = SDIO_MANF_ID_CSR,
1038 .cardId = SDIO_CARD_ID_UNIFI_4,
1039 .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_4,
1040 .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE,
1041 }
1042};
1043
1044
1045
1046
1047
1048static CsrSdioFunctionDriver unifi_sdioFunction_drv =
1049{
1050 .inserted = uf_sdio_inserted,
1051 .removed = uf_sdio_removed,
1052 .intr = uf_sdio_int_handler,
1053 .suspend = uf_lx_suspend,
1054 .resume = uf_lx_resume,
1055
1056 .ids = unifi_ids,
1057 .idsCount = sizeof(unifi_ids) / sizeof(unifi_ids[0])
1058};
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077int __init
1078uf_sdio_load(void)
1079{
1080 CsrResult csrResult;
1081
1082 csrResult = CsrSdioFunctionDriverRegister(&unifi_sdioFunction_drv);
1083 if (csrResult != CSR_RESULT_SUCCESS) {
1084 unifi_error(NULL, "Failed to register UniFi SDIO driver: csrResult=%d\n", csrResult);
1085 return -EIO;
1086 }
1087
1088 return 0;
1089}
1090
1091
1092
1093void __exit
1094uf_sdio_unload(void)
1095{
1096 CsrSdioFunctionDriverUnregister(&unifi_sdioFunction_drv);
1097}
1098
1099