1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
10 #include <linux/netdevice.h>
12 /********************************************
14 * Host Interface Defines
16 ********************************************/
19 #define HIF_SPI BIT(0)
21 /********************************************
23 * Wlan Interface Defines
25 ********************************************/
46 #define MAC_STATUS_INIT -1
47 #define MAC_STATUS_CONNECTED 1
48 #define MAC_STATUS_DISCONNECTED 0
50 struct tx_complete_data {
57 typedef void (*wilc_tx_complete_func_t)(void *, int);
59 #define WILC_TX_ERR_NO_BUF (-2)
61 /********************************************
63 * Wlan Configuration ID
65 ********************************************/
66 #define WILC_MULTICAST_TABLE_SIZE 8
67 #define MAX_SSID_LEN 33
68 #define MAX_RATES_SUPPORTED 12
77 B_ONLY_MODE = 0, /* 1, 2 M, otherwise 5, 11 M */
78 G_ONLY_MODE, /* 6,12,24 otherwise 9,18,36,48,54 */
79 G_MIXED_11B_1_MODE, /* 1,2,5.5,11 otherwise all on */
80 G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
84 G_SHORT_PREAMBLE = 0, /* Short Preamble */
85 G_LONG_PREAMBLE = 1, /* Long Preamble */
86 G_AUTO_PREAMBLE = 2, /* Auto Preamble Selection */
102 enum chip_ps_states {
104 CHIP_SLEEPING_AUTO = 1,
105 CHIP_SLEEPING_MANUAL = 2
110 ACQUIRE_AND_WAKEUP = 1,
115 RELEASE_ALLOW_SLEEP = 1,
124 WPA_AES_TKIP = 0x69, /* Aes or Tkip */
127 WPA2_AES_TKIP = 0x71, /* Aes or Tkip */
139 SITE_SURVEY_ALL_CH = 1,
157 FILTER_AP_ONLY = 0x01,
158 FILTER_STA_ONLY = 0x02
162 AUTO_PROT = 0, /* Auto */
163 NO_PROT, /* Do not use any protection */
164 ERP_PROT, /* Protect all ERP frame exchanges */
165 HT_PROT, /* Protect all HT frame exchanges */
166 GF_PROT, /* Protect all GF frame exchanges */
177 HT_ONLY_20_40MHZ_MODE,
184 DETECT_PROTECT_REPORT = 3,
188 RTS_CTS_NONHT_PROT = 0, /* RTS-CTS at non-HT rate */
189 FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
190 LSIG_TXOP_PROT, /* LSIG TXOP Protection */
191 FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
197 MIMO_MODE = 3, /* power save disable */
210 WID_TYPE_FORCE_32BIT = 0xFFFFFFFF
225 * -----------------------------------------------------------
226 * Configuration : Infrastructure Independent Access Point
227 * Values to set : 0 1 2
228 * -----------------------------------------------------------
230 WID_BSS_TYPE = 0x0000,
234 * -----------------------------------------------------------
235 * Configuration : 1 2 5.5 11 6 9 12 18 24 36 48 54
236 * Values to set : 1 2 5 11 6 9 12 18 24 36 48 54
237 * -----------------------------------------------------------
239 WID_CURRENT_TX_RATE = 0x0001,
243 * -----------------------------------------------------------
244 * Configuration(g) : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
245 * Values to set : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
246 * -----------------------------------------------------------
248 WID_CURRENT_CHANNEL = 0x0002,
252 * -----------------------------------------------------------
253 * Configuration : short long Auto
254 * Values to set : 0 1 2
255 * -----------------------------------------------------------
257 WID_PREAMBLE = 0x0003,
260 * 11g operating mode (ignored if 11g not present)
261 * -----------------------------------------------------------
262 * Configuration : HighPerf Compat(RSet #1) Compat(RSet #2)
263 * Values to set : 1 2 3
264 * -----------------------------------------------------------
266 WID_11G_OPERATING_MODE = 0x0004,
269 * Mac status (response only)
270 * -----------------------------------------------------------
271 * Configuration : disconnect connect
272 * Values to get : 0 1
273 * -----------------------------------------------------------
279 * -----------------------------------------------------------
280 * Configuration : Passive Scanning Active Scanning
281 * Values to set : 0 1
282 * -----------------------------------------------------------
284 WID_SCAN_TYPE = 0x0007,
287 * Key Id (WEP default key Id)
288 * -----------------------------------------------------------
289 * Configuration : Any value between 0 to 3
290 * Values to set : Same value. Default is 0
291 * -----------------------------------------------------------
297 * -----------------------------------------------------------
298 * Configuration : QoS Disable WMM Enable
299 * Values to set : 0 1
300 * -----------------------------------------------------------
302 WID_QOS_ENABLE = 0x000A,
306 * -----------------------------------------------------------
307 * Configuration : NO_POWERSAVE MIN_POWERSAVE MAX_POWERSAVE
308 * Values to set : 0 1 2
309 * -----------------------------------------------------------
311 WID_POWER_MANAGEMENT = 0x000B,
314 * WEP/802 11I Configuration
315 * -----------------------------------------------------------
316 * Configuration:Disable WP40 WP104 WPA-AES WPA-TKIP RSN-AES RSN-TKIP
317 * Values (0x) : 00 03 07 29 49 31 51
318 * Configuration:WPA-AES+TKIP RSN-AES+TKIP
319 * Values (0x) : 69 71
320 * -----------------------------------------------------------
322 WID_11I_MODE = 0x000C,
325 * WEP Configuration: Used in BSS STA mode only when WEP is enabled
326 * -----------------------------------------------------------
327 * Configuration : Open System Shared Key Any Type | 802.1x Auth
328 * Values (0x) : 01 02 03 | BIT2
329 * -----------------------------------------------------------
331 WID_AUTH_TYPE = 0x000D,
335 * -----------------------------------------------------------
336 * Configuration : Values to set
337 * Survey 1 Channel : 0
338 * survey all Channels : 1
339 * Disable Site Survey : 2
340 * -----------------------------------------------------------
342 WID_SITE_SURVEY = 0x000E,
346 * -----------------------------------------------------------
347 * Configuration : Any value between 1 to 255
348 * Values to set : Same value. Default is 3
349 * -----------------------------------------------------------
351 WID_LISTEN_INTERVAL = 0x000F,
355 * -----------------------------------------------------------
356 * Configuration : Any value between 1 to 255
357 * Values to set : Same value. Default is 3
358 * -----------------------------------------------------------
360 WID_DTIM_PERIOD = 0x0010,
364 * -----------------------------------------------------------
365 * Configuration : Normal Ack No Ack
366 * Values to set : 0 1
367 * -----------------------------------------------------------
369 WID_ACK_POLICY = 0x0011,
372 * Reset MAC (Set only)
373 * -----------------------------------------------------------
374 * Configuration : Don't Reset Reset No Request
375 * Values to set : 0 1 2
376 * -----------------------------------------------------------
381 * Broadcast SSID Option: Setting this will adhere to "" SSID element
382 * -----------------------------------------------------------
383 * Configuration : Enable Disable
384 * Values to set : 1 0
385 * -----------------------------------------------------------
387 WID_BCAST_SSID = 0x0015,
390 * Disconnect (Station)
391 * -----------------------------------------------------------
392 * Configuration : Association ID
393 * Values to set : Association ID
394 * -----------------------------------------------------------
396 WID_DISCONNECT = 0x0016,
400 * -----------------------------------------------------------
401 * Configuration : Sets TX Power (Higher the value greater the power)
402 * Values to set : Any value between 0 and 63 (inclusive Default 48)
403 * -----------------------------------------------------------
405 WID_TX_POWER_LEVEL_11A = 0x0018,
408 * Group Key Update Policy Selection
409 * -----------------------------------------------------------
410 * Configuration : Disabled timeBased packetBased timePacketBased
411 * Values to set : 1 2 3 4
412 * -----------------------------------------------------------
414 WID_REKEY_POLICY = 0x0019,
418 * -----------------------------------------------------------
419 * Configuration : Disallow Short Slot Allow Short Slot
420 * (Enable Only Long Slot) (Enable Short Slot if applicable)
421 * Values to set : 0 1
422 * -----------------------------------------------------------
424 WID_SHORT_SLOT_ALLOWED = 0x001A,
426 WID_PHY_ACTIVE_REG = 0x001B,
430 * -----------------------------------------------------------
431 * Configuration : Sets TX Power (Higher the value greater the power)
432 * Values to set : Any value between 0 and 63 (inclusive Default 48)
433 * -----------------------------------------------------------
435 WID_TX_POWER_LEVEL_11B = 0x001D,
439 * -----------------------------------------------------------
440 * Configuration : Request default scan
442 * -----------------------------------------------------------
444 WID_START_SCAN_REQ = 0x001E,
448 * -----------------------------------------------------------
450 * Values to get : Rssi value
451 * -----------------------------------------------------------
457 * -----------------------------------------------------------
458 * Configuration : Request to join
459 * Values to set : index of scan result
460 * -----------------------------------------------------------
462 WID_JOIN_REQ = 0x0020,
464 WID_LINKSPEED = 0x0026,
467 * Enable User Control of TX Power
468 * -----------------------------------------------------------
469 * Configuration : Disable Enable
470 * Values to set : 0 1
471 * -----------------------------------------------------------
473 WID_USER_CONTROL_ON_TX_POWER = 0x0027,
475 WID_MEMORY_ACCESS_8BIT = 0x0029,
478 * Enable Auto RX Sensitivity feature
479 * -----------------------------------------------------------
480 * Configuration : Disable Enable
481 * Values to set : 0 1
482 * -----------------------------------------------------------
484 WID_AUTO_RX_SENSITIVITY = 0x0032,
487 * Receive Buffer Based Ack
488 * -----------------------------------------------------------
489 * Configuration : Disable Enable
490 * Values to set : 0 1
491 * -----------------------------------------------------------
493 WID_DATAFLOW_CONTROL = 0x0033,
497 * -----------------------------------------------------------
498 * Configuration : Class No filter AP only Station Only
499 * Values to set : 0 1 2
500 * Configuration : Priority High Rssi Low Rssi Detect
501 * Values to set : 0 0x4 0x0
502 * Configuration : Channel filter off filter on
503 * Values to set : 0 0x10
504 * -----------------------------------------------------------
506 WID_SCAN_FILTER = 0x0036,
509 * Link Loss Threshold (measure in the beacon period)
510 * -----------------------------------------------------------
511 * Configuration : Any value between 10 and 254(Set to 255 disable)
512 * Values to set : Same value. Default is 10
513 * -----------------------------------------------------------
515 WID_LINK_LOSS_THRESHOLD = 0x0037,
517 WID_ABORT_RUNNING_SCAN = 0x003E,
519 /* NMAC Character WID list */
520 WID_WPS_START = 0x0043,
523 * Protection mode for MAC
524 * -----------------------------------------------------------
525 * Configuration : Auto No protection ERP HT GF
526 * Values to set : 0 1 2 3 4
527 * -----------------------------------------------------------
529 WID_11N_PROT_MECH = 0x0080,
532 * ERP Protection type for MAC
533 * -----------------------------------------------------------
534 * Configuration : Self-CTS RTS-CTS
535 * Values to set : 0 1
536 * -----------------------------------------------------------
538 WID_11N_ERP_PROT_TYPE = 0x0081,
542 * -----------------------------------------------------------
543 * Configuration : HT Enable HT Disable
544 * Values to set : 1 0
545 * -----------------------------------------------------------
547 WID_11N_ENABLE = 0x0082,
550 * 11n Operating mode (Note that 11g operating mode will also be
551 * used in addition to this, if this is set to HT Mixed mode)
552 * -----------------------------------------------------------
553 * Configuration : HT Mixed HT Only-20MHz HT Only-20/40MHz
554 * Values to set : 1 2 3
555 * -----------------------------------------------------------
557 WID_11N_OPERATING_MODE = 0x0083,
560 * 11n OBSS non-HT STA Detection flag
561 * -----------------------------------------------------------
562 * Configuration : Do not detect
564 * Configuration : Detect, do not protect or report
566 * Configuration : Detect, protect and do not report
568 * Configuration : Detect, protect and report to other BSS
570 * -----------------------------------------------------------
572 WID_11N_OBSS_NONHT_DETECTION = 0x0084,
575 * 11n HT Protection Type
576 * -----------------------------------------------------------
577 * Configuration : RTS-CTS First Frame Exchange at non-HT-rate
578 * Values to set : 0 1
579 * Configuration : LSIG TXOP First Frame Exchange in Mixed Fmt
580 * Values to set : 2 3
581 * -----------------------------------------------------------
583 WID_11N_HT_PROT_TYPE = 0x0085,
586 * 11n RIFS Protection Enable Flag
587 * -----------------------------------------------------------
588 * Configuration : Disable Enable
589 * Values to set : 0 1
590 * -----------------------------------------------------------
592 WID_11N_RIFS_PROT_ENABLE = 0x0086,
596 * -----------------------------------------------------------
597 * Configuration : Static Dynamic MIMO (Power Save Disabled)
598 * Values to set : 1 2 3
599 * -----------------------------------------------------------
601 WID_11N_SMPS_MODE = 0x0087,
604 * Current transmit MCS
605 * -----------------------------------------------------------
606 * Configuration : MCS Index for data rate
607 * Values to set : 0 to 7
608 * -----------------------------------------------------------
610 WID_11N_CURRENT_TX_MCS = 0x0088,
612 WID_11N_PRINT_STATS = 0x0089,
615 * 11n Short GI Enable Flag
616 * -----------------------------------------------------------
617 * Configuration : Disable Enable
618 * Values to set : 0 1
619 * -----------------------------------------------------------
621 WID_11N_SHORT_GI_ENABLE = 0x008D,
624 * 11n RIFS Enable Flag
625 * -----------------------------------------------------------
626 * Configuration : Disable Enable
627 * Values to set : 0 1
628 * -----------------------------------------------------------
630 WID_RIFS_MODE = 0x0094,
634 * -----------------------------------------------------------
635 * Configuration : Disable Self CTS Enable Self CTS
636 * Values to set : 0 1
637 * Configuration : Disable TX Abort Enable TX Abort
638 * Values to set : 2 3
639 * Configuration : Enable HW TX Abort Enable SW TX Abort
640 * Values to set : 4 5
641 * -----------------------------------------------------------
643 WID_TX_ABORT_CONFIG = 0x00A1,
645 WID_REG_TSSI_11B_VALUE = 0x00A6,
646 WID_REG_TSSI_11G_VALUE = 0x00A7,
647 WID_REG_TSSI_11N_VALUE = 0x00A8,
648 WID_TX_CALIBRATION = 0x00A9,
649 WID_DSCR_TSSI_11B_VALUE = 0x00AA,
650 WID_DSCR_TSSI_11G_VALUE = 0x00AB,
651 WID_DSCR_TSSI_11N_VALUE = 0x00AC,
654 * Immediate Block-Ack Support
655 * -----------------------------------------------------------
656 * Configuration : Disable Enable
657 * Values to set : 0 1
658 * -----------------------------------------------------------
660 WID_11N_IMMEDIATE_BA_ENABLED = 0x00AF,
664 * -----------------------------------------------------------
665 * Configuration : Disable Enable
666 * Values to set : 1 0
667 * -----------------------------------------------------------
669 WID_11N_TXOP_PROT_DISABLE = 0x00B0,
671 WID_TX_POWER_LEVEL_11N = 0x00B1,
673 /* Custom Character WID list */
674 WID_PC_TEST_MODE = 0x00C8,
675 /* SCAN Complete notification WID*/
676 WID_SCAN_COMPLETE = 0x00C9,
678 WID_DEL_BEACON = 0x00CA,
680 WID_LOG_TERMINAL_SWITCH = 0x00CD,
681 WID_TX_POWER = 0x00CE,
682 /* EMAC Short WID list */
685 * -----------------------------------------------------------
686 * Configuration : Any value between 256 to 2347
687 * Values to set : Same value. Default is 2347
688 * -----------------------------------------------------------
690 WID_RTS_THRESHOLD = 0x1000,
693 * Fragmentation Threshold
694 * -----------------------------------------------------------
695 * Configuration : Any value between 256 to 2346
696 * Values to set : Same value. Default is 2346
697 * -----------------------------------------------------------
699 WID_FRAG_THRESHOLD = 0x1001,
701 WID_SHORT_RETRY_LIMIT = 0x1002,
702 WID_LONG_RETRY_LIMIT = 0x1003,
703 WID_BEACON_INTERVAL = 0x1006,
704 WID_MEMORY_ACCESS_16BIT = 0x1008,
705 WID_RX_SENSE = 0x100B,
706 WID_ACTIVE_SCAN_TIME = 0x100C,
707 WID_PASSIVE_SCAN_TIME = 0x100D,
709 WID_SITE_SURVEY_SCAN_TIME = 0x100E,
710 WID_JOIN_START_TIMEOUT = 0x100F,
711 WID_AUTH_TIMEOUT = 0x1010,
712 WID_ASOC_TIMEOUT = 0x1011,
713 WID_11I_PROTOCOL_TIMEOUT = 0x1012,
714 WID_EAPOL_RESPONSE_TIMEOUT = 0x1013,
716 /* NMAC Short WID list */
717 WID_11N_SIG_QUAL_VAL = 0x1085,
718 WID_CCA_THRESHOLD = 0x1087,
720 /* Custom Short WID list */
722 /* EMAC Integer WID list */
723 WID_FAILED_COUNT = 0x2000,
724 WID_RETRY_COUNT = 0x2001,
725 WID_MULTIPLE_RETRY_COUNT = 0x2002,
726 WID_FRAME_DUPLICATE_COUNT = 0x2003,
727 WID_ACK_FAILURE_COUNT = 0x2004,
728 WID_RECEIVED_FRAGMENT_COUNT = 0x2005,
729 WID_MCAST_RECEIVED_FRAME_COUNT = 0x2006,
730 WID_FCS_ERROR_COUNT = 0x2007,
731 WID_SUCCESS_FRAME_COUNT = 0x2008,
732 WID_HUT_TX_COUNT = 0x200A,
733 WID_TX_FRAGMENT_COUNT = 0x200B,
734 WID_TX_MULTICAST_FRAME_COUNT = 0x200C,
735 WID_RTS_SUCCESS_COUNT = 0x200D,
736 WID_RTS_FAILURE_COUNT = 0x200E,
737 WID_WEP_UNDECRYPTABLE_COUNT = 0x200F,
738 WID_REKEY_PERIOD = 0x2010,
739 WID_REKEY_PACKET_COUNT = 0x2011,
740 WID_1X_SERV_ADDR = 0x2012,
741 WID_STACK_IP_ADDR = 0x2013,
742 WID_STACK_NETMASK_ADDR = 0x2014,
743 WID_HW_RX_COUNT = 0x2015,
744 WID_MEMORY_ADDRESS = 0x201E,
745 WID_MEMORY_ACCESS_32BIT = 0x201F,
746 WID_RF_REG_VAL = 0x2021,
748 /* NMAC Integer WID list */
749 WID_11N_PHY_ACTIVE_REG_VAL = 0x2080,
751 /* Custom Integer WID list */
752 WID_GET_INACTIVE_TIME = 0x2084,
753 WID_SET_OPERATION_MODE = 0X2086,
754 /* EMAC String WID list */
756 WID_FIRMWARE_VERSION = 0x3001,
757 WID_OPERATIONAL_RATE_SET = 0x3002,
759 WID_WEP_KEY_VALUE = 0x3004,
760 WID_11I_PSK = 0x3008,
761 WID_11E_P_ACTION_REQ = 0x3009,
763 WID_HARDWARE_VERSION = 0x300B,
764 WID_MAC_ADDR = 0x300C,
765 WID_HUT_DEST_ADDR = 0x300D,
766 WID_PHY_VERSION = 0x300F,
767 WID_SUPP_USERNAME = 0x3010,
768 WID_SUPP_PASSWORD = 0x3011,
769 WID_SITE_SURVEY_RESULTS = 0x3012,
770 WID_RX_POWER_LEVEL = 0x3013,
771 WID_DEL_ALL_RX_BA = 0x3014,
772 WID_SET_STA_MAC_INACTIVE_TIME = 0x3017,
773 WID_ADD_WEP_KEY = 0x3019,
774 WID_REMOVE_WEP_KEY = 0x301A,
775 WID_ADD_PTK = 0x301B,
776 WID_ADD_RX_GTK = 0x301C,
777 WID_ADD_TX_GTK = 0x301D,
778 WID_REMOVE_KEY = 0x301E,
779 WID_ASSOC_REQ_INFO = 0x301F,
780 WID_ASSOC_RES_INFO = 0x3020,
781 WID_MANUFACTURER = 0x3026, /*Added for CAPI tool */
782 WID_MODEL_NAME = 0x3027, /*Added for CAPI tool */
783 WID_MODEL_NUM = 0x3028, /*Added for CAPI tool */
784 WID_DEVICE_NAME = 0x3029, /*Added for CAPI tool */
785 WID_SET_DRV_HANDLER = 0x3079,
787 /* NMAC String WID list */
788 WID_11N_P_ACTION_REQ = 0x3080,
789 WID_HUT_TEST_ID = 0x3081,
790 WID_PMKID_INFO = 0x3082,
791 WID_FIRMWARE_INFO = 0x3083,
792 WID_REGISTER_FRAME = 0x3084,
793 WID_DEL_ALL_STA = 0x3085,
794 WID_REMAIN_ON_CHAN = 0x3996,
795 WID_SSID_PROBE_REQ = 0x3997,
796 WID_JOIN_REQ_EXTENDED = 0x3998,
798 WID_IP_ADDRESS = 0x3999,
800 /* Custom String WID list */
802 /* EMAC Binary WID list */
803 WID_UAPSD_CONFIG = 0x4001,
804 WID_UAPSD_STATUS = 0x4002,
805 WID_WMM_AP_AC_PARAMS = 0x4003,
806 WID_WMM_STA_AC_PARAMS = 0x4004,
807 WID_NETWORK_INFO = 0x4005,
808 WID_STA_JOIN_INFO = 0x4006,
809 WID_CONNECTED_STA_LIST = 0x4007,
811 /* NMAC Binary WID list */
812 WID_11N_AUTORATE_TABLE = 0x4080,
814 WID_SCAN_CHANNEL_LIST = 0x4084,
816 WID_INFO_ELEMENT_PROBE = 0x4085,
817 WID_INFO_ELEMENT_ASSOCIATE = 0x4086,
818 WID_ADD_STA = 0X4087,
819 WID_REMOVE_STA = 0X4088,
820 WID_EDIT_STA = 0X4089,
821 WID_ADD_BEACON = 0x408a,
823 WID_SETUP_MULTICAST_FILTER = 0x408b,
825 /* Miscellaneous WIDs */
831 int wilc_wlan_init(struct net_device *dev);
832 u32 wilc_get_chipid(struct wilc *wilc, bool update);
834 int wilc_debugfs_init(void);
835 void wilc_debugfs_remove(void);