0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef __MAC_H__
0019 #define __MAC_H__
0020
0021 #include <linux/bits.h>
0022 #include "device.h"
0023
0024 #define REV_ID_VT3253_A0 0x00
0025 #define REV_ID_VT3253_A1 0x01
0026 #define REV_ID_VT3253_B0 0x08
0027 #define REV_ID_VT3253_B1 0x09
0028
0029
0030 #define MAC_REG_BISTCMD 0x04
0031 #define MAC_REG_BISTSR0 0x05
0032 #define MAC_REG_BISTSR1 0x06
0033 #define MAC_REG_BISTSR2 0x07
0034 #define MAC_REG_I2MCSR 0x08
0035 #define MAC_REG_I2MTGID 0x09
0036 #define MAC_REG_I2MTGAD 0x0a
0037 #define MAC_REG_I2MCFG 0x0b
0038 #define MAC_REG_I2MDIPT 0x0c
0039 #define MAC_REG_I2MDOPT 0x0e
0040 #define MAC_REG_USBSUS 0x0f
0041
0042 #define MAC_REG_LOCALID 0x14
0043 #define MAC_REG_TESTCFG 0x15
0044 #define MAC_REG_JUMPER0 0x16
0045 #define MAC_REG_JUMPER1 0x17
0046 #define MAC_REG_TMCTL 0x18
0047 #define MAC_REG_TMDATA0 0x1c
0048 #define MAC_REG_TMDATA1 0x1d
0049 #define MAC_REG_TMDATA2 0x1e
0050 #define MAC_REG_TMDATA3 0x1f
0051
0052
0053 #define MAC_REG_LRT 0x20
0054 #define MAC_REG_SRT 0x21
0055 #define MAC_REG_SIFS 0x22
0056 #define MAC_REG_DIFS 0x23
0057 #define MAC_REG_EIFS 0x24
0058 #define MAC_REG_SLOT 0x25
0059 #define MAC_REG_BI 0x26
0060 #define MAC_REG_CWMAXMIN0 0x28
0061 #define MAC_REG_LINKOFFTOTM 0x2a
0062 #define MAC_REG_SWTMOT 0x2b
0063 #define MAC_REG_RTSOKCNT 0x2c
0064 #define MAC_REG_RTSFAILCNT 0x2d
0065 #define MAC_REG_ACKFAILCNT 0x2e
0066 #define MAC_REG_FCSERRCNT 0x2f
0067
0068
0069 #define MAC_REG_TSFCNTR 0x30
0070 #define MAC_REG_NEXTTBTT 0x38
0071 #define MAC_REG_TSFOFST 0x40
0072 #define MAC_REG_TFTCTL 0x48
0073
0074
0075 #define MAC_REG_ENCFG0 0x4c
0076 #define MAC_REG_ENCFG1 0x4d
0077 #define MAC_REG_ENCFG2 0x4e
0078
0079 #define MAC_REG_CFG 0x50
0080 #define MAC_REG_TEST 0x52
0081 #define MAC_REG_HOSTCR 0x54
0082 #define MAC_REG_MACCR 0x55
0083 #define MAC_REG_RCR 0x56
0084 #define MAC_REG_TCR 0x57
0085 #define MAC_REG_IMR 0x58
0086 #define MAC_REG_ISR 0x5c
0087 #define MAC_REG_ISR1 0x5d
0088
0089
0090 #define MAC_REG_PSCFG 0x60
0091 #define MAC_REG_PSCTL 0x61
0092 #define MAC_REG_PSPWRSIG 0x62
0093 #define MAC_REG_BBCR13 0x63
0094 #define MAC_REG_AIDATIM 0x64
0095 #define MAC_REG_PWBT 0x66
0096 #define MAC_REG_WAKEOKTMR 0x68
0097 #define MAC_REG_CALTMR 0x69
0098 #define MAC_REG_SYNSPACCNT 0x6a
0099 #define MAC_REG_WAKSYNOPT 0x6b
0100
0101
0102 #define MAC_REG_BBREGCTL 0x6c
0103 #define MAC_REG_CHANNEL 0x6d
0104 #define MAC_REG_BBREGADR 0x6e
0105 #define MAC_REG_BBREGDATA 0x6f
0106 #define MAC_REG_IFREGCTL 0x70
0107 #define MAC_REG_IFDATA 0x71
0108 #define MAC_REG_ITRTMSET 0x74
0109 #define MAC_REG_PAPEDELAY 0x77
0110 #define MAC_REG_SOFTPWRCTL 0x78
0111 #define MAC_REG_SOFTPWRCTL2 0x79
0112 #define MAC_REG_GPIOCTL0 0x7a
0113 #define MAC_REG_GPIOCTL1 0x7b
0114
0115
0116 #define MAC_REG_MISCFFNDEX 0xbc
0117 #define MAC_REG_MISCFFCTL 0xbe
0118 #define MAC_REG_MISCFFDATA 0xc0
0119
0120
0121 #define MAC_REG_PAR0 0xc4
0122 #define MAC_REG_PAR4 0xc8
0123 #define MAC_REG_BSSID0 0xcc
0124 #define MAC_REG_BSSID4 0xd0
0125 #define MAC_REG_MAR0 0xd4
0126 #define MAC_REG_MAR4 0xd8
0127
0128
0129 #define MAC_REG_RSPINF_B_1 0xdC
0130 #define MAC_REG_RSPINF_B_2 0xe0
0131 #define MAC_REG_RSPINF_B_5 0xe4
0132 #define MAC_REG_RSPINF_B_11 0xe8
0133 #define MAC_REG_RSPINF_A_6 0xec
0134 #define MAC_REG_RSPINF_A_9 0xee
0135 #define MAC_REG_RSPINF_A_12 0xf0
0136 #define MAC_REG_RSPINF_A_18 0xf2
0137 #define MAC_REG_RSPINF_A_24 0xf4
0138 #define MAC_REG_RSPINF_A_36 0xf6
0139 #define MAC_REG_RSPINF_A_48 0xf8
0140 #define MAC_REG_RSPINF_A_54 0xfa
0141 #define MAC_REG_RSPINF_A_72 0xfc
0142
0143
0144 #define I2MCFG_BOUNDCTL BIT(7)
0145 #define I2MCFG_WAITCTL BIT(5)
0146 #define I2MCFG_SCLOECTL BIT(4)
0147 #define I2MCFG_WBUSYCTL BIT(3)
0148 #define I2MCFG_NORETRY BIT(2)
0149 #define I2MCFG_I2MLDSEQ BIT(1)
0150 #define I2MCFG_I2CMFAST BIT(0)
0151
0152
0153 #define I2MCSR_EEMW BIT(7)
0154 #define I2MCSR_EEMR BIT(6)
0155 #define I2MCSR_AUTOLD BIT(3)
0156 #define I2MCSR_NACK BIT(1)
0157 #define I2MCSR_DONE BIT(0)
0158
0159
0160 #define TMCTL_TSUSP BIT(2)
0161 #define TMCTL_TMD BIT(1)
0162 #define TMCTL_TE BIT(0)
0163
0164
0165 #define TFTCTL_HWUTSF BIT(7)
0166 #define TFTCTL_TBTTSYNC BIT(6)
0167 #define TFTCTL_HWUTSFEN BIT(5)
0168 #define TFTCTL_TSFCNTRRD BIT(4)
0169 #define TFTCTL_TBTTSYNCEN BIT(3)
0170 #define TFTCTL_TSFSYNCEN BIT(2)
0171 #define TFTCTL_TSFCNTRST BIT(1)
0172 #define TFTCTL_TSFCNTREN BIT(0)
0173
0174
0175 #define EN_CFG_BB_TYPE_A 0x00
0176 #define EN_CFG_BB_TYPE_B BIT(0)
0177 #define EN_CFG_BB_TYPE_G BIT(1)
0178 #define EN_CFG_BB_TYPE_MASK (EN_CFG_BB_TYPE_B | EN_CFG_BB_TYPE_G)
0179 #define EN_CFG_PROTECT_MD BIT(5)
0180
0181
0182 #define EN_CFG_BCN_SUS_IND BIT(0)
0183 #define EN_CFG_BCN_SUS_CLR BIT(1)
0184
0185
0186 #define EN_CFG_NXTBTTCFPSTR BIT(0)
0187 #define EN_CFG_BARKER_PREAM BIT(1)
0188 #define EN_CFG_PKT_BURST_MD BIT(2)
0189
0190
0191 #define CFG_TKIPOPT BIT(7)
0192 #define CFG_RXDMAOPT BIT(6)
0193 #define CFG_TMOT_SW BIT(5)
0194 #define CFG_TMOT_HWLONG BIT(4)
0195 #define CFG_TMOT_HW 0x00
0196 #define CFG_CFPENDOPT BIT(3)
0197 #define CFG_BCNSUSEN BIT(2)
0198 #define CFG_NOTXTIMEOUT BIT(1)
0199 #define CFG_NOBUFOPT BIT(0)
0200
0201
0202 #define TEST_LBEXT BIT(7)
0203 #define TEST_LBINT BIT(6)
0204 #define TEST_LBNONE 0x00
0205 #define TEST_SOFTINT BIT(5)
0206 #define TEST_CONTTX BIT(4)
0207 #define TEST_TXPE BIT(3)
0208 #define TEST_NAVDIS BIT(2)
0209 #define TEST_NOCTS BIT(1)
0210 #define TEST_NOACK BIT(0)
0211
0212
0213 #define HOSTCR_TXONST BIT(7)
0214 #define HOSTCR_RXONST BIT(6)
0215 #define HOSTCR_ADHOC BIT(5)
0216 #define HOSTCR_AP BIT(4)
0217 #define HOSTCR_TXON BIT(3)
0218 #define HOSTCR_RXON BIT(2)
0219 #define HOSTCR_MACEN BIT(1)
0220 #define HOSTCR_SOFTRST BIT(0)
0221
0222
0223 #define MACCR_SYNCFLUSHOK BIT(2)
0224 #define MACCR_SYNCFLUSH BIT(1)
0225 #define MACCR_CLRNAV BIT(0)
0226
0227
0228 #define RCR_SSID BIT(7)
0229 #define RCR_RXALLTYPE BIT(6)
0230 #define RCR_UNICAST BIT(5)
0231 #define RCR_BROADCAST BIT(4)
0232 #define RCR_MULTICAST BIT(3)
0233 #define RCR_WPAERR BIT(2)
0234 #define RCR_ERRCRC BIT(1)
0235 #define RCR_BSSID BIT(0)
0236
0237
0238 #define TCR_SYNCDCFOPT BIT(1)
0239 #define TCR_AUTOBCNTX BIT(0)
0240
0241
0242 #define ISR_GPIO3 BIT(6)
0243 #define ISR_RXNOBUF BIT(3)
0244 #define ISR_MIBNEARFULL BIT(2)
0245 #define ISR_SOFTINT BIT(1)
0246 #define ISR_FETALERR BIT(0)
0247
0248 #define LEDSTS_STS 0x06
0249 #define LEDSTS_TMLEN 0x78
0250 #define LEDSTS_OFF 0x00
0251 #define LEDSTS_ON 0x02
0252 #define LEDSTS_SLOW 0x04
0253 #define LEDSTS_INTER 0x06
0254
0255
0256 #define ISR_WATCHDOG BIT(7)
0257 #define ISR_SOFTTIMER BIT(6)
0258 #define ISR_GPIO0 BIT(5)
0259 #define ISR_TBTT BIT(4)
0260 #define ISR_RXDMA0 BIT(3)
0261 #define ISR_BNTX BIT(2)
0262 #define ISR_ACTX BIT(0)
0263
0264
0265 #define PSCFG_PHILIPMD BIT(6)
0266 #define PSCFG_WAKECALEN BIT(5)
0267 #define PSCFG_WAKETMREN BIT(4)
0268 #define PSCFG_BBPSPROG BIT(3)
0269 #define PSCFG_WAKESYN BIT(2)
0270 #define PSCFG_SLEEPSYN BIT(1)
0271 #define PSCFG_AUTOSLEEP BIT(0)
0272
0273
0274 #define PSCTL_WAKEDONE BIT(5)
0275 #define PSCTL_PS BIT(4)
0276 #define PSCTL_GO2DOZE BIT(3)
0277 #define PSCTL_LNBCN BIT(2)
0278 #define PSCTL_ALBCN BIT(1)
0279 #define PSCTL_PSEN BIT(0)
0280
0281
0282 #define PSSIG_WPE3 BIT(7)
0283 #define PSSIG_WPE2 BIT(6)
0284 #define PSSIG_WPE1 BIT(5)
0285 #define PSSIG_WRADIOPE BIT(4)
0286 #define PSSIG_SPE3 BIT(3)
0287 #define PSSIG_SPE2 BIT(2)
0288 #define PSSIG_SPE1 BIT(1)
0289 #define PSSIG_SRADIOPE BIT(0)
0290
0291
0292 #define BBREGCTL_DONE BIT(2)
0293 #define BBREGCTL_REGR BIT(1)
0294 #define BBREGCTL_REGW BIT(0)
0295
0296
0297 #define IFREGCTL_DONE BIT(2)
0298 #define IFREGCTL_IFRF BIT(1)
0299 #define IFREGCTL_REGW BIT(0)
0300
0301
0302 #define SOFTPWRCTL_RFLEOPT BIT(3)
0303 #define SOFTPWRCTL_TXPEINV BIT(1)
0304 #define SOFTPWRCTL_SWPECTI BIT(0)
0305 #define SOFTPWRCTL_SWPAPE BIT(5)
0306 #define SOFTPWRCTL_SWCALEN BIT(4)
0307 #define SOFTPWRCTL_SWRADIO_PE BIT(3)
0308 #define SOFTPWRCTL_SWPE2 BIT(2)
0309 #define SOFTPWRCTL_SWPE1 BIT(1)
0310 #define SOFTPWRCTL_SWPE3 BIT(0)
0311
0312
0313 #define GPIO3_MD BIT(5)
0314 #define GPIO3_DATA BIT(6)
0315 #define GPIO3_INTMD BIT(7)
0316
0317
0318 #define MISCFFCTL_WRITE BIT(0)
0319
0320
0321 #define MAC_LB_EXT BIT(1)
0322 #define MAC_LB_INTERNAL BIT(0)
0323 #define MAC_LB_NONE 0x00
0324
0325
0326 #define PKT_TYPE_NONE 0x00
0327 #define PKT_TYPE_ALL_MULTICAST BIT(7)
0328 #define PKT_TYPE_PROMISCUOUS BIT(6)
0329 #define PKT_TYPE_DIRECTED BIT(5)
0330 #define PKT_TYPE_BROADCAST BIT(4)
0331 #define PKT_TYPE_MULTICAST BIT(3)
0332 #define PKT_TYPE_ERROR_WPA BIT(2)
0333 #define PKT_TYPE_ERROR_CRC BIT(1)
0334 #define PKT_TYPE_BSSID BIT(0)
0335
0336 #define DEFAULT_BI 0x200
0337
0338
0339 #define MISCFIFO_KEYETRY0 32
0340 #define MISCFIFO_KEYENTRYSIZE 22
0341
0342 #define MAC_REVISION_A0 0x00
0343 #define MAC_REVISION_A1 0x01
0344
0345 struct vnt_mac_set_key {
0346 union {
0347 struct {
0348 u8 addr[ETH_ALEN];
0349 __le16 key_ctl;
0350 } write __packed;
0351 u32 swap[2];
0352 } u;
0353 u8 key[WLAN_KEY_LEN_CCMP];
0354 } __packed;
0355
0356 int vnt_mac_set_filter(struct vnt_private *priv, u64 mc_filter);
0357 int vnt_mac_shutdown(struct vnt_private *priv);
0358 int vnt_mac_set_bb_type(struct vnt_private *priv, u8 type);
0359 int vnt_mac_disable_keyentry(struct vnt_private *priv, u8 entry_idx);
0360 int vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
0361 u32 key_idx, u8 *addr, u8 *key);
0362 int vnt_mac_reg_bits_off(struct vnt_private *priv, u8 reg_ofs, u8 bits);
0363 int vnt_mac_reg_bits_on(struct vnt_private *priv, u8 reg_ofs, u8 bits);
0364 int vnt_mac_write_word(struct vnt_private *priv, u8 reg_ofs, u16 word);
0365 int vnt_mac_set_bssid_addr(struct vnt_private *priv, u8 *addr);
0366 int vnt_mac_enable_protect_mode(struct vnt_private *priv);
0367 int vnt_mac_disable_protect_mode(struct vnt_private *priv);
0368 int vnt_mac_enable_barker_preamble_mode(struct vnt_private *priv);
0369 int vnt_mac_disable_barker_preamble_mode(struct vnt_private *priv);
0370 int vnt_mac_set_beacon_interval(struct vnt_private *priv, u16 interval);
0371 int vnt_mac_set_led(struct vnt_private *privpriv, u8 state, u8 led);
0372
0373 #endif