| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This is part of rtl8187 OpenSource driver. |
|---|
| 3 | 4 | * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> |
|---|
| .. | .. |
|---|
| 39 | 40 | #include "ieee80211/ieee80211.h" |
|---|
| 40 | 41 | |
|---|
| 41 | 42 | #define RTL8192U |
|---|
| 42 | | -#define RTL819xU_MODULE_NAME "rtl819xU" |
|---|
| 43 | +#define RTL819XU_MODULE_NAME "rtl819xU" |
|---|
| 43 | 44 | /* HW security */ |
|---|
| 44 | 45 | #define MAX_KEY_LEN 61 |
|---|
| 45 | 46 | #define KEY_BUF_SIZE 5 |
|---|
| 46 | 47 | |
|---|
| 47 | | -#define Rx_Smooth_Factor 20 |
|---|
| 48 | +#define RX_SMOOTH_FACTOR 20 |
|---|
| 48 | 49 | #define DMESG(x, a...) |
|---|
| 49 | 50 | #define DMESGW(x, a...) |
|---|
| 50 | 51 | #define DMESGE(x, a...) |
|---|
| 51 | 52 | extern u32 rt_global_debug_component; |
|---|
| 52 | 53 | #define RT_TRACE(component, x, args...) \ |
|---|
| 53 | 54 | do { \ |
|---|
| 54 | | - if (rt_global_debug_component & component) \ |
|---|
| 55 | + if (rt_global_debug_component & (component)) \ |
|---|
| 55 | 56 | pr_debug("RTL8192U: " x "\n", ##args); \ |
|---|
| 56 | 57 | } while (0) |
|---|
| 57 | 58 | |
|---|
| .. | .. |
|---|
| 111 | 112 | do { \ |
|---|
| 112 | 113 | if ((rt_global_debug_component & (level)) == (level)) { \ |
|---|
| 113 | 114 | int i; \ |
|---|
| 114 | | - u8 *pdata = (u8 *) data; \ |
|---|
| 115 | + u8 *pdata = (u8 *)data; \ |
|---|
| 115 | 116 | pr_debug("RTL8192U: %s()\n", __func__); \ |
|---|
| 116 | 117 | for (i = 0; i < (int)(datalen); i++) { \ |
|---|
| 117 | 118 | printk("%2x ", pdata[i]); \ |
|---|
| .. | .. |
|---|
| 363 | 364 | FW_STATUS_5_READY = 5, |
|---|
| 364 | 365 | } firmware_status_e; |
|---|
| 365 | 366 | |
|---|
| 366 | | -typedef struct _rt_firmare_seg_container { |
|---|
| 367 | +typedef struct _fw_seg_container { |
|---|
| 367 | 368 | u16 seg_size; |
|---|
| 368 | 369 | u8 *seg_ptr; |
|---|
| 369 | 370 | } fw_seg_container, *pfw_seg_container; |
|---|
| 370 | 371 | typedef struct _rt_firmware { |
|---|
| 371 | 372 | firmware_status_e firmware_status; |
|---|
| 372 | | - u16 cmdpacket_frag_thresold; |
|---|
| 373 | + u16 cmdpacket_frag_threshold; |
|---|
| 373 | 374 | #define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000 |
|---|
| 374 | 375 | u8 firmware_buf[RTL8190_MAX_FIRMWARE_CODE_SIZE]; |
|---|
| 375 | 376 | u16 firmware_buf_size; |
|---|
| .. | .. |
|---|
| 798 | 799 | TXCMD_XXXX_CTRL, |
|---|
| 799 | 800 | } DCMD_TXCMD_OP; |
|---|
| 800 | 801 | |
|---|
| 802 | +enum version_819xu { |
|---|
| 803 | + VERSION_819XU_A, // A-cut |
|---|
| 804 | + VERSION_819XU_B, // B-cut |
|---|
| 805 | + VERSION_819XU_C,// C-cut |
|---|
| 806 | +}; |
|---|
| 807 | + |
|---|
| 808 | +//added for different RF type |
|---|
| 809 | +enum rt_rf_type { |
|---|
| 810 | + RF_1T2R = 0, |
|---|
| 811 | + RF_2T4R, |
|---|
| 812 | +}; |
|---|
| 813 | + |
|---|
| 801 | 814 | typedef struct r8192_priv { |
|---|
| 802 | 815 | struct usb_device *udev; |
|---|
| 803 | 816 | /* For maintain info from eeprom */ |
|---|
| .. | .. |
|---|
| 815 | 828 | /* O: rtl8192, 1: rtl8185 V B/C, 2: rtl8185 V D */ |
|---|
| 816 | 829 | short card_8192; |
|---|
| 817 | 830 | /* If TCR reports card V B/C, this discriminates */ |
|---|
| 818 | | - u8 card_8192_version; |
|---|
| 831 | + enum version_819xu card_8192_version; |
|---|
| 819 | 832 | short enable_gpio0; |
|---|
| 820 | 833 | enum card_type { |
|---|
| 821 | 834 | PCI, MINIPCI, CARDBUS, USB |
|---|
| .. | .. |
|---|
| 838 | 851 | |
|---|
| 839 | 852 | struct mutex wx_mutex; |
|---|
| 840 | 853 | |
|---|
| 841 | | - u8 rf_type; /* 0: 1T2R, 1: 2T4R */ |
|---|
| 854 | + enum rt_rf_type rf_type; /* 0: 1T2R, 1: 2T4R */ |
|---|
| 842 | 855 | RT_RF_TYPE_819xU rf_chip; |
|---|
| 843 | 856 | |
|---|
| 844 | 857 | short (*rf_set_sens)(struct net_device *dev, short sens); |
|---|
| .. | .. |
|---|
| 864 | 877 | int rx_inx; |
|---|
| 865 | 878 | #endif |
|---|
| 866 | 879 | |
|---|
| 867 | | - struct sk_buff_head rx_queue; |
|---|
| 868 | | - struct sk_buff_head skb_queue; |
|---|
| 869 | | - struct work_struct qos_activate; |
|---|
| 880 | + struct sk_buff_head rx_queue; |
|---|
| 881 | + struct sk_buff_head skb_queue; |
|---|
| 882 | + struct work_struct qos_activate; |
|---|
| 870 | 883 | short tx_urb_index; |
|---|
| 871 | 884 | atomic_t tx_pending[0x10]; /* UART_PRIORITY + 1 */ |
|---|
| 872 | 885 | |
|---|
| .. | .. |
|---|
| 1000 | 1013 | bool bis_any_nonbepkts; |
|---|
| 1001 | 1014 | bool bcurrent_turbo_EDCA; |
|---|
| 1002 | 1015 | bool bis_cur_rdlstate; |
|---|
| 1003 | | - struct timer_list fsync_timer; |
|---|
| 1016 | + struct delayed_work fsync_work; |
|---|
| 1004 | 1017 | bool bfsync_processing; /* 500ms Fsync timer is active or not */ |
|---|
| 1005 | 1018 | u32 rate_record; |
|---|
| 1006 | 1019 | u32 rateCountDiffRecord; |
|---|
| .. | .. |
|---|
| 1014 | 1027 | u8 nrxAMPDU_aggr_num; |
|---|
| 1015 | 1028 | |
|---|
| 1016 | 1029 | /* For gpio */ |
|---|
| 1017 | | - bool bHwRadioOff; |
|---|
| 1030 | + bool bHwRadioOff; |
|---|
| 1018 | 1031 | |
|---|
| 1019 | 1032 | u32 reset_count; |
|---|
| 1020 | 1033 | bool bpbc_pressed; |
|---|
| .. | .. |
|---|
| 1079 | 1092 | short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb); |
|---|
| 1080 | 1093 | short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); |
|---|
| 1081 | 1094 | |
|---|
| 1082 | | -u32 read_cam(struct net_device *dev, u8 addr); |
|---|
| 1083 | | -void write_cam(struct net_device *dev, u8 addr, u32 data); |
|---|
| 1084 | | - |
|---|
| 1085 | 1095 | int read_nic_byte(struct net_device *dev, int x, u8 *data); |
|---|
| 1086 | 1096 | int read_nic_byte_E(struct net_device *dev, int x, u8 *data); |
|---|
| 1087 | 1097 | int read_nic_dword(struct net_device *dev, int x, u32 *data); |
|---|
| .. | .. |
|---|
| 1094 | 1104 | |
|---|
| 1095 | 1105 | void rtl8192_rtx_disable(struct net_device *dev); |
|---|
| 1096 | 1106 | void rtl8192_rx_enable(struct net_device *dev); |
|---|
| 1097 | | -void rtl8192_tx_enable(struct net_device *dev); |
|---|
| 1098 | 1107 | |
|---|
| 1099 | | -void rtl8192_disassociate(struct net_device *dev); |
|---|
| 1100 | | -void rtl8185_set_rf_pins_enable(struct net_device *dev, u32 a); |
|---|
| 1101 | | - |
|---|
| 1102 | | -void rtl8192_set_anaparam(struct net_device *dev, u32 a); |
|---|
| 1103 | | -void rtl8185_set_anaparam2(struct net_device *dev, u32 a); |
|---|
| 1104 | 1108 | void rtl8192_update_msr(struct net_device *dev); |
|---|
| 1105 | 1109 | int rtl8192_down(struct net_device *dev); |
|---|
| 1106 | 1110 | int rtl8192_up(struct net_device *dev); |
|---|
| 1107 | 1111 | void rtl8192_commit(struct net_device *dev); |
|---|
| 1108 | 1112 | void rtl8192_set_chan(struct net_device *dev, short ch); |
|---|
| 1109 | | -void write_phy(struct net_device *dev, u8 adr, u8 data); |
|---|
| 1110 | | -void write_phy_cck(struct net_device *dev, u8 adr, u32 data); |
|---|
| 1111 | | -void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); |
|---|
| 1112 | | -void rtl8185_tx_antenna(struct net_device *dev, u8 ant); |
|---|
| 1113 | 1113 | void rtl8192_set_rxconf(struct net_device *dev); |
|---|
| 1114 | 1114 | void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate); |
|---|
| 1115 | 1115 | |
|---|