if_runreg.h revision 259546
1135380Sglebius/* $OpenBSD: rt2860reg.h,v 1.19 2009/05/18 19:25:07 damien Exp $ */ 2144017Sglebius 3135380Sglebius/*- 4135380Sglebius * Copyright (c) 2007 5135380Sglebius * Damien Bergamini <damien.bergamini@free.fr> 6135380Sglebius * 7135380Sglebius * Permission to use, copy, modify, and distribute this software for any 8135380Sglebius * purpose with or without fee is hereby granted, provided that the above 9135380Sglebius * copyright notice and this permission notice appear in all copies. 10135380Sglebius * 11135380Sglebius * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12135380Sglebius * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13135380Sglebius * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14135380Sglebius * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15135380Sglebius * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16135380Sglebius * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17135380Sglebius * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18135380Sglebius * 19135380Sglebius * $FreeBSD: head/sys/dev/usb/wlan/if_runreg.h 259546 2013-12-18 08:39:12Z kevlo $ 20135380Sglebius */ 21135380Sglebius 22135380Sglebius#ifndef _IF_RUNREG_H_ 23135380Sglebius#define _IF_RUNREG_H_ 24135380Sglebius 25135380Sglebius#define RT2860_CONFIG_NO 1 26135380Sglebius#define RT2860_IFACE_INDEX 0 27135380Sglebius 28135380Sglebius#define RT3070_OPT_14 0x0114 29135380Sglebius 30135380Sglebius/* SCH/DMA registers */ 31135380Sglebius#define RT2860_INT_STATUS 0x0200 32135380Sglebius#define RT2860_INT_MASK 0x0204 33135380Sglebius#define RT2860_WPDMA_GLO_CFG 0x0208 34135380Sglebius#define RT2860_WPDMA_RST_IDX 0x020c 35135380Sglebius#define RT2860_DELAY_INT_CFG 0x0210 36135380Sglebius#define RT2860_WMM_AIFSN_CFG 0x0214 37135380Sglebius#define RT2860_WMM_CWMIN_CFG 0x0218 38135380Sglebius#define RT2860_WMM_CWMAX_CFG 0x021c 39135380Sglebius#define RT2860_WMM_TXOP0_CFG 0x0220 40135380Sglebius#define RT2860_WMM_TXOP1_CFG 0x0224 41135380Sglebius#define RT2860_GPIO_CTRL 0x0228 42135380Sglebius#define RT2860_MCU_CMD_REG 0x022c 43135380Sglebius#define RT2860_TX_BASE_PTR(qid) (0x0230 + (qid) * 16) 44135380Sglebius#define RT2860_TX_MAX_CNT(qid) (0x0234 + (qid) * 16) 45135380Sglebius#define RT2860_TX_CTX_IDX(qid) (0x0238 + (qid) * 16) 46135380Sglebius#define RT2860_TX_DTX_IDX(qid) (0x023c + (qid) * 16) 47135380Sglebius#define RT2860_RX_BASE_PTR 0x0290 48135380Sglebius#define RT2860_RX_MAX_CNT 0x0294 49223788Sglebius#define RT2860_RX_CALC_IDX 0x0298 50135380Sglebius#define RT2860_FS_DRX_IDX 0x029c 51135380Sglebius#define RT2860_USB_DMA_CFG 0x02a0 /* RT2870 only */ 52135380Sglebius#define RT2860_US_CYC_CNT 0x02a4 53135380Sglebius 54135380Sglebius/* PBF registers */ 55236808Smelifaro#define RT2860_SYS_CTRL 0x0400 56236808Smelifaro#define RT2860_HOST_CMD 0x0404 57135380Sglebius#define RT2860_PBF_CFG 0x0408 58135380Sglebius#define RT2860_MAX_PCNT 0x040c 59236808Smelifaro#define RT2860_BUF_CTRL 0x0410 60236808Smelifaro#define RT2860_MCU_INT_STA 0x0414 61236808Smelifaro#define RT2860_MCU_INT_ENA 0x0418 62236808Smelifaro#define RT2860_TXQ_IO(qid) (0x041c + (qid) * 4) 63223788Sglebius#define RT2860_RX0Q_IO 0x0424 64236808Smelifaro#define RT2860_BCN_OFFSET0 0x042c 65236808Smelifaro#define RT2860_BCN_OFFSET1 0x0430 66236808Smelifaro#define RT2860_TXRXQ_STA 0x0434 67236808Smelifaro#define RT2860_TXRXQ_PCNT 0x0438 68236808Smelifaro#define RT2860_PBF_DBG 0x043c 69236808Smelifaro#define RT2860_CAP_CTRL 0x0440 70236808Smelifaro 71236808Smelifaro/* RT3070 registers */ 72236808Smelifaro#define RT3070_RF_CSR_CFG 0x0500 73236808Smelifaro#define RT3070_EFUSE_CTRL 0x0580 74236808Smelifaro#define RT3070_EFUSE_DATA0 0x0590 75144017Sglebius#define RT3070_EFUSE_DATA1 0x0594 76135380Sglebius#define RT3070_EFUSE_DATA2 0x0598 77144017Sglebius#define RT3070_EFUSE_DATA3 0x059c 78144017Sglebius#define RT3070_LDO_CFG0 0x05d4 79144017Sglebius#define RT3070_GPIO_SWITCH 0x05dc 80236808Smelifaro 81236808Smelifaro/* RT5592 registers */ 82223788Sglebius#define RT5592_DEBUG_INDEX 0x05e8 83223788Sglebius 84223788Sglebius/* MAC registers */ 85223788Sglebius#define RT2860_ASIC_VER_ID 0x1000 86223824Spluknet#define RT2860_MAC_SYS_CTRL 0x1004 87223788Sglebius#define RT2860_MAC_ADDR_DW0 0x1008 88223824Spluknet#define RT2860_MAC_ADDR_DW1 0x100c 89223824Spluknet#define RT2860_MAC_BSSID_DW0 0x1010 90223824Spluknet#define RT2860_MAC_BSSID_DW1 0x1014 91223788Sglebius#define RT2860_MAX_LEN_CFG 0x1018 92223788Sglebius#define RT2860_BBP_CSR_CFG 0x101c 93223824Spluknet#define RT2860_RF_CSR_CFG0 0x1020 94223788Sglebius#define RT2860_RF_CSR_CFG1 0x1024 95223824Spluknet#define RT2860_RF_CSR_CFG2 0x1028 96223788Sglebius#define RT2860_LED_CFG 0x102c 97223824Spluknet 98135380Sglebius/* undocumented registers */ 99135380Sglebius#define RT2860_DEBUG 0x10f4 100135380Sglebius 101135380Sglebius/* MAC Timing control registers */ 102135380Sglebius#define RT2860_XIFS_TIME_CFG 0x1100 103223788Sglebius#define RT2860_BKOFF_SLOT_CFG 0x1104 104135380Sglebius#define RT2860_NAV_TIME_CFG 0x1108 105135380Sglebius#define RT2860_CH_TIME_CFG 0x110c 106135380Sglebius#define RT2860_PBF_LIFE_TIMER 0x1110 107140413Sglebius#define RT2860_BCN_TIME_CFG 0x1114 108140413Sglebius#define RT2860_TBTT_SYNC_CFG 0x1118 109135380Sglebius#define RT2860_TSF_TIMER_DW0 0x111c 110135380Sglebius#define RT2860_TSF_TIMER_DW1 0x1120 111236808Smelifaro#define RT2860_TBTT_TIMER 0x1124 112223788Sglebius#define RT2860_INT_TIMER_CFG 0x1128 113135380Sglebius#define RT2860_INT_TIMER_EN 0x112c 114135380Sglebius#define RT2860_CH_IDLE_TIME 0x1130 115135380Sglebius 116135380Sglebius/* MAC Power Save configuration registers */ 117141393Sglebius#define RT2860_MAC_STATUS_REG 0x1200 118135380Sglebius#define RT2860_PWR_PIN_CFG 0x1204 119135380Sglebius#define RT2860_AUTO_WAKEUP_CFG 0x1208 120135380Sglebius 121135380Sglebius/* MAC TX configuration registers */ 122135380Sglebius#define RT2860_EDCA_AC_CFG(aci) (0x1300 + (aci) * 4) 123135380Sglebius#define RT2860_EDCA_TID_AC_MAP 0x1310 124135380Sglebius#define RT2860_TX_PWR_CFG(ridx) (0x1314 + (ridx) * 4) 125135380Sglebius#define RT2860_TX_PIN_CFG 0x1328 126135380Sglebius#define RT2860_TX_BAND_CFG 0x132c 127135380Sglebius#define RT2860_TX_SW_CFG0 0x1330 128135380Sglebius#define RT2860_TX_SW_CFG1 0x1334 129135380Sglebius#define RT2860_TX_SW_CFG2 0x1338 130135380Sglebius#define RT2860_TXOP_THRES_CFG 0x133c 131135380Sglebius#define RT2860_TXOP_CTRL_CFG 0x1340 132223788Sglebius#define RT2860_TX_RTS_CFG 0x1344 133223788Sglebius#define RT2860_TX_TIMEOUT_CFG 0x1348 134135380Sglebius#define RT2860_TX_RTY_CFG 0x134c 135135380Sglebius#define RT2860_TX_LINK_CFG 0x1350 136135380Sglebius#define RT2860_HT_FBK_CFG0 0x1354 137135380Sglebius#define RT2860_HT_FBK_CFG1 0x1358 138135380Sglebius#define RT2860_LG_FBK_CFG0 0x135c 139135380Sglebius#define RT2860_LG_FBK_CFG1 0x1360 140135380Sglebius#define RT2860_CCK_PROT_CFG 0x1364 141135380Sglebius#define RT2860_OFDM_PROT_CFG 0x1368 142135380Sglebius#define RT2860_MM20_PROT_CFG 0x136c 143135380Sglebius#define RT2860_MM40_PROT_CFG 0x1370 144135380Sglebius#define RT2860_GF20_PROT_CFG 0x1374 145135380Sglebius#define RT2860_GF40_PROT_CFG 0x1378 146135380Sglebius#define RT2860_EXP_CTS_TIME 0x137c 147135380Sglebius#define RT2860_EXP_ACK_TIME 0x1380 148135380Sglebius 149135380Sglebius/* MAC RX configuration registers */ 150135380Sglebius#define RT2860_RX_FILTR_CFG 0x1400 151135380Sglebius#define RT2860_AUTO_RSP_CFG 0x1404 152135380Sglebius#define RT2860_LEGACY_BASIC_RATE 0x1408 153135380Sglebius#define RT2860_HT_BASIC_RATE 0x140c 154135380Sglebius#define RT2860_HT_CTRL_CFG 0x1410 155135380Sglebius#define RT2860_SIFS_COST_CFG 0x1414 156135380Sglebius#define RT2860_RX_PARSER_CFG 0x1418 157135380Sglebius 158135380Sglebius/* MAC Security configuration registers */ 159135380Sglebius#define RT2860_TX_SEC_CNT0 0x1500 160135380Sglebius#define RT2860_RX_SEC_CNT0 0x1504 161135380Sglebius#define RT2860_CCMP_FC_MUTE 0x1508 162135380Sglebius 163135380Sglebius/* MAC HCCA/PSMP configuration registers */ 164135380Sglebius#define RT2860_TXOP_HLDR_ADDR0 0x1600 165135380Sglebius#define RT2860_TXOP_HLDR_ADDR1 0x1604 166135380Sglebius#define RT2860_TXOP_HLDR_ET 0x1608 167135380Sglebius#define RT2860_QOS_CFPOLL_RA_DW0 0x160c 168135380Sglebius#define RT2860_QOS_CFPOLL_A1_DW1 0x1610 169135380Sglebius#define RT2860_QOS_CFPOLL_QC 0x1614 170135380Sglebius 171135380Sglebius/* MAC Statistics Counters */ 172135380Sglebius#define RT2860_RX_STA_CNT0 0x1700 173135380Sglebius#define RT2860_RX_STA_CNT1 0x1704 174140413Sglebius#define RT2860_RX_STA_CNT2 0x1708 175135380Sglebius#define RT2860_TX_STA_CNT0 0x170c 176135380Sglebius#define RT2860_TX_STA_CNT1 0x1710 177223788Sglebius#define RT2860_TX_STA_CNT2 0x1714 178140413Sglebius#define RT2860_TX_STAT_FIFO 0x1718 179135380Sglebius 180223824Spluknet/* RX WCID search table */ 181135380Sglebius#define RT2860_WCID_ENTRY(wcid) (0x1800 + (wcid) * 8) 182223824Spluknet 183223824Spluknet#define RT2860_FW_BASE 0x2000 184223824Spluknet#define RT2870_FW_BASE 0x3000 185223788Sglebius 186223788Sglebius/* Pair-wise key table */ 187223788Sglebius#define RT2860_PKEY(wcid) (0x4000 + (wcid) * 32) 188223788Sglebius 189223788Sglebius/* IV/EIV table */ 190223788Sglebius#define RT2860_IVEIV(wcid) (0x6000 + (wcid) * 8) 191223788Sglebius 192223788Sglebius/* WCID attribute table */ 193223788Sglebius#define RT2860_WCID_ATTR(wcid) (0x6800 + (wcid) * 4) 194223788Sglebius 195223788Sglebius/* Shared Key Table */ 196144017Sglebius#define RT2860_SKEY(vap, kidx) (0x6c00 + (vap) * 128 + (kidx) * 32) 197144017Sglebius 198144017Sglebius/* Shared Key Mode */ 199236808Smelifaro#define RT2860_SKEY_MODE_0_7 0x7000 200236808Smelifaro#define RT2860_SKEY_MODE_8_15 0x7004 201236808Smelifaro#define RT2860_SKEY_MODE_16_23 0x7008 202223824Spluknet#define RT2860_SKEY_MODE_24_31 0x700c 203223788Sglebius 204223788Sglebius/* Shared Memory between MCU and host */ 205223788Sglebius#define RT2860_H2M_MAILBOX 0x7010 206223788Sglebius#define RT2860_H2M_MAILBOX_CID 0x7014 207223788Sglebius#define RT2860_H2M_MAILBOX_STATUS 0x701c 208223788Sglebius#define RT2860_H2M_INTSRC 0x7024 209223824Spluknet#define RT2860_H2M_BBPAGENT 0x7028 210223788Sglebius#define RT2860_BCN_BASE(vap) (0x7800 + (vap) * 512) 211223824Spluknet 212223788Sglebius 213223788Sglebius/* possible flags for register RT2860_PCI_EECTRL */ 214223788Sglebius#define RT2860_C (1 << 0) 215223788Sglebius#define RT2860_S (1 << 1) 216223788Sglebius#define RT2860_D (1 << 2) 217223788Sglebius#define RT2860_SHIFT_D 2 218223824Spluknet#define RT2860_Q (1 << 3) 219223788Sglebius#define RT2860_SHIFT_Q 3 220223788Sglebius 221223824Spluknet/* possible flags for registers INT_STATUS/INT_MASK */ 222223788Sglebius#define RT2860_TX_COHERENT (1 << 17) 223223788Sglebius#define RT2860_RX_COHERENT (1 << 16) 224223788Sglebius#define RT2860_MAC_INT_4 (1 << 15) 225223788Sglebius#define RT2860_MAC_INT_3 (1 << 14) 226223788Sglebius#define RT2860_MAC_INT_2 (1 << 13) 227223788Sglebius#define RT2860_MAC_INT_1 (1 << 12) 228223788Sglebius#define RT2860_MAC_INT_0 (1 << 11) 229135380Sglebius#define RT2860_TX_RX_COHERENT (1 << 10) 230135380Sglebius#define RT2860_MCU_CMD_INT (1 << 9) 231223788Sglebius#define RT2860_TX_DONE_INT5 (1 << 8) 232223788Sglebius#define RT2860_TX_DONE_INT4 (1 << 7) 233135380Sglebius#define RT2860_TX_DONE_INT3 (1 << 6) 234135380Sglebius#define RT2860_TX_DONE_INT2 (1 << 5) 235135380Sglebius#define RT2860_TX_DONE_INT1 (1 << 4) 236223788Sglebius#define RT2860_TX_DONE_INT0 (1 << 3) 237223788Sglebius#define RT2860_RX_DONE_INT (1 << 2) 238135380Sglebius#define RT2860_TX_DLY_INT (1 << 1) 239135380Sglebius#define RT2860_RX_DLY_INT (1 << 0) 240135380Sglebius 241135380Sglebius/* possible flags for register WPDMA_GLO_CFG */ 242223788Sglebius#define RT2860_HDR_SEG_LEN_SHIFT 8 243135380Sglebius#define RT2860_BIG_ENDIAN (1 << 7) 244135380Sglebius#define RT2860_TX_WB_DDONE (1 << 6) 245135380Sglebius#define RT2860_WPDMA_BT_SIZE_SHIFT 4 246135380Sglebius#define RT2860_WPDMA_BT_SIZE16 0 247135380Sglebius#define RT2860_WPDMA_BT_SIZE32 1 248135380Sglebius#define RT2860_WPDMA_BT_SIZE64 2 249223788Sglebius#define RT2860_WPDMA_BT_SIZE128 3 250223788Sglebius#define RT2860_RX_DMA_BUSY (1 << 3) 251223788Sglebius#define RT2860_RX_DMA_EN (1 << 2) 252223788Sglebius#define RT2860_TX_DMA_BUSY (1 << 1) 253135380Sglebius#define RT2860_TX_DMA_EN (1 << 0) 254135380Sglebius 255223788Sglebius/* possible flags for register DELAY_INT_CFG */ 256135380Sglebius#define RT2860_TXDLY_INT_EN (1U << 31) 257223788Sglebius#define RT2860_TXMAX_PINT_SHIFT 24 258223788Sglebius#define RT2860_TXMAX_PTIME_SHIFT 16 259135380Sglebius#define RT2860_RXDLY_INT_EN (1 << 15) 260135380Sglebius#define RT2860_RXMAX_PINT_SHIFT 8 261223788Sglebius#define RT2860_RXMAX_PTIME_SHIFT 0 262135380Sglebius 263135380Sglebius/* possible flags for register GPIO_CTRL */ 264223824Spluknet#define RT2860_GPIO_D_SHIFT 8 265135380Sglebius#define RT2860_GPIO_O_SHIFT 0 266223824Spluknet 267223788Sglebius/* possible flags for register USB_DMA_CFG */ 268223788Sglebius#define RT2860_USB_TX_BUSY (1U << 31) 269135380Sglebius#define RT2860_USB_RX_BUSY (1 << 30) 270135380Sglebius#define RT2860_USB_EPOUT_VLD_SHIFT 24 271135380Sglebius#define RT2860_USB_TX_EN (1 << 23) 272135380Sglebius#define RT2860_USB_RX_EN (1 << 22) 273135380Sglebius#define RT2860_USB_RX_AGG_EN (1 << 21) 274135380Sglebius#define RT2860_USB_TXOP_HALT (1 << 20) 275223788Sglebius#define RT2860_USB_TX_CLEAR (1 << 19) 276223788Sglebius#define RT2860_USB_PHY_WD_EN (1 << 16) 277223788Sglebius#define RT2860_USB_PHY_MAN_RST (1 << 15) 278135380Sglebius#define RT2860_USB_RX_AGG_LMT(x) ((x) << 8) /* in unit of 1KB */ 279236808Smelifaro#define RT2860_USB_RX_AGG_TO(x) ((x) & 0xff) /* in unit of 33ns */ 280236808Smelifaro 281223788Sglebius/* possible flags for register US_CYC_CNT */ 282223788Sglebius#define RT2860_TEST_EN (1 << 24) 283223788Sglebius#define RT2860_TEST_SEL_SHIFT 16 284135380Sglebius#define RT2860_BT_MODE_EN (1 << 8) 285135380Sglebius#define RT2860_US_CYC_CNT_SHIFT 0 286236808Smelifaro 287135380Sglebius/* possible flags for register SYS_CTRL */ 288135380Sglebius#define RT2860_HST_PM_SEL (1 << 16) 289135380Sglebius#define RT2860_CAP_MODE (1 << 14) 290135380Sglebius#define RT2860_PME_OEN (1 << 13) 291135380Sglebius#define RT2860_CLKSELECT (1 << 12) 292135380Sglebius#define RT2860_PBF_CLK_EN (1 << 11) 293135380Sglebius#define RT2860_MAC_CLK_EN (1 << 10) 294135380Sglebius#define RT2860_DMA_CLK_EN (1 << 9) 295135380Sglebius#define RT2860_MCU_READY (1 << 7) 296135380Sglebius#define RT2860_ASY_RESET (1 << 4) 297135380Sglebius#define RT2860_PBF_RESET (1 << 3) 298223824Spluknet#define RT2860_MAC_RESET (1 << 2) 299135380Sglebius#define RT2860_DMA_RESET (1 << 1) 300223788Sglebius#define RT2860_MCU_RESET (1 << 0) 301223788Sglebius 302223788Sglebius/* possible values for register HOST_CMD */ 303144017Sglebius#define RT2860_MCU_CMD_SLEEP 0x30 304223788Sglebius#define RT2860_MCU_CMD_WAKEUP 0x31 305223788Sglebius#define RT2860_MCU_CMD_LEDS 0x50 306223788Sglebius#define RT2860_MCU_CMD_LED_RSSI 0x51 307223788Sglebius#define RT2860_MCU_CMD_LED1 0x52 308223788Sglebius#define RT2860_MCU_CMD_LED2 0x53 309223788Sglebius#define RT2860_MCU_CMD_LED3 0x54 310223788Sglebius#define RT2860_MCU_CMD_RFRESET 0x72 311223788Sglebius#define RT2860_MCU_CMD_ANTSEL 0x73 312223788Sglebius#define RT2860_MCU_CMD_BBP 0x80 313236808Smelifaro#define RT2860_MCU_CMD_PSLEVEL 0x83 314236808Smelifaro 315223788Sglebius/* possible flags for register PBF_CFG */ 316223788Sglebius#define RT2860_TX1Q_NUM_SHIFT 21 317223788Sglebius#define RT2860_TX2Q_NUM_SHIFT 16 318223788Sglebius#define RT2860_NULL0_MODE (1 << 15) 319223788Sglebius#define RT2860_NULL1_MODE (1 << 14) 320236808Smelifaro#define RT2860_RX_DROP_MODE (1 << 13) 321223788Sglebius#define RT2860_TX0Q_MANUAL (1 << 12) 322223788Sglebius#define RT2860_TX1Q_MANUAL (1 << 11) 323223788Sglebius#define RT2860_TX2Q_MANUAL (1 << 10) 324223788Sglebius#define RT2860_RX0Q_MANUAL (1 << 9) 325223788Sglebius#define RT2860_HCCA_EN (1 << 8) 326223788Sglebius#define RT2860_TX0Q_EN (1 << 4) 327223788Sglebius#define RT2860_TX1Q_EN (1 << 3) 328223788Sglebius#define RT2860_TX2Q_EN (1 << 2) 329223788Sglebius#define RT2860_RX0Q_EN (1 << 1) 330223788Sglebius 331223788Sglebius/* possible flags for register BUF_CTRL */ 332223788Sglebius#define RT2860_WRITE_TXQ(qid) (1 << (11 - (qid))) 333223788Sglebius#define RT2860_NULL0_KICK (1 << 7) 334223824Spluknet#define RT2860_NULL1_KICK (1 << 6) 335223788Sglebius#define RT2860_BUF_RESET (1 << 5) 336223788Sglebius#define RT2860_READ_TXQ(qid) (1 << (3 - (qid)) 337223788Sglebius#define RT2860_READ_RX0Q (1 << 0) 338144017Sglebius 339144017Sglebius/* possible flags for registers MCU_INT_STA/MCU_INT_ENA */ 340144017Sglebius#define RT2860_MCU_MAC_INT_8 (1 << 24) 341144017Sglebius#define RT2860_MCU_MAC_INT_7 (1 << 23) 342144017Sglebius#define RT2860_MCU_MAC_INT_6 (1 << 22) 343223788Sglebius#define RT2860_MCU_MAC_INT_4 (1 << 20) 344223788Sglebius#define RT2860_MCU_MAC_INT_3 (1 << 19) 345223788Sglebius#define RT2860_MCU_MAC_INT_2 (1 << 18) 346144017Sglebius#define RT2860_MCU_MAC_INT_1 (1 << 17) 347223788Sglebius#define RT2860_MCU_MAC_INT_0 (1 << 16) 348223788Sglebius#define RT2860_DTX0_INT (1 << 11) 349223788Sglebius#define RT2860_DTX1_INT (1 << 10) 350223788Sglebius#define RT2860_DTX2_INT (1 << 9) 351144017Sglebius#define RT2860_DRX0_INT (1 << 8) 352144017Sglebius#define RT2860_HCMD_INT (1 << 7) 353144017Sglebius#define RT2860_N0TX_INT (1 << 6) 354144017Sglebius#define RT2860_N1TX_INT (1 << 5) 355144017Sglebius#define RT2860_BCNTX_INT (1 << 4) 356144017Sglebius#define RT2860_MTX0_INT (1 << 3) 357144017Sglebius#define RT2860_MTX1_INT (1 << 2) 358144017Sglebius#define RT2860_MTX2_INT (1 << 1) 359144017Sglebius#define RT2860_MRX0_INT (1 << 0) 360144017Sglebius 361144017Sglebius/* possible flags for register TXRXQ_PCNT */ 362144017Sglebius#define RT2860_RX0Q_PCNT_MASK 0xff000000 363144017Sglebius#define RT2860_TX2Q_PCNT_MASK 0x00ff0000 364144017Sglebius#define RT2860_TX1Q_PCNT_MASK 0x0000ff00 365144017Sglebius#define RT2860_TX0Q_PCNT_MASK 0x000000ff 366144017Sglebius 367144017Sglebius/* possible flags for register CAP_CTRL */ 368144017Sglebius#define RT2860_CAP_ADC_FEQ (1U << 31) 369144017Sglebius#define RT2860_CAP_START (1 << 30) 370144017Sglebius#define RT2860_MAN_TRIG (1 << 29) 371144017Sglebius#define RT2860_TRIG_OFFSET_SHIFT 16 372144017Sglebius#define RT2860_START_ADDR_SHIFT 0 373144017Sglebius 374144017Sglebius/* possible flags for register RF_CSR_CFG */ 375223824Spluknet#define RT3070_RF_KICK (1 << 17) 376144017Sglebius#define RT3070_RF_WRITE (1 << 16) 377223788Sglebius 378135380Sglebius/* possible flags for register EFUSE_CTRL */ 379223788Sglebius#define RT3070_SEL_EFUSE (1U << 31) 380223788Sglebius#define RT3070_EFSROM_KICK (1 << 30) 381223788Sglebius#define RT3070_EFSROM_AIN_MASK 0x03ff0000 382223788Sglebius#define RT3070_EFSROM_AIN_SHIFT 16 383223788Sglebius#define RT3070_EFSROM_MODE_MASK 0x000000c0 384223788Sglebius#define RT3070_EFUSE_AOUT_MASK 0x0000003f 385223788Sglebius 386223788Sglebius/* possible flag for register DEBUG_INDEX */ 387223788Sglebius#define RT5592_SEL_XTAL (1U << 31) 388223788Sglebius 389223788Sglebius/* possible flags for register MAC_SYS_CTRL */ 390223788Sglebius#define RT2860_RX_TS_EN (1 << 7) 391223788Sglebius#define RT2860_WLAN_HALT_EN (1 << 6) 392223788Sglebius#define RT2860_PBF_LOOP_EN (1 << 5) 393223788Sglebius#define RT2860_CONT_TX_TEST (1 << 4) 394223788Sglebius#define RT2860_MAC_RX_EN (1 << 3) 395223788Sglebius#define RT2860_MAC_TX_EN (1 << 2) 396223788Sglebius#define RT2860_BBP_HRST (1 << 1) 397223788Sglebius#define RT2860_MAC_SRST (1 << 0) 398223788Sglebius 399223788Sglebius/* possible flags for register MAC_BSSID_DW1 */ 400223788Sglebius#define RT2860_MULTI_BCN_NUM_SHIFT 18 401223788Sglebius#define RT2860_MULTI_BSSID_MODE_SHIFT 16 402223788Sglebius 403223788Sglebius/* possible flags for register MAX_LEN_CFG */ 404223788Sglebius#define RT2860_MIN_MPDU_LEN_SHIFT 16 405223788Sglebius#define RT2860_MAX_PSDU_LEN_SHIFT 12 406223788Sglebius#define RT2860_MAX_PSDU_LEN8K 0 407223788Sglebius#define RT2860_MAX_PSDU_LEN16K 1 408223788Sglebius#define RT2860_MAX_PSDU_LEN32K 2 409223788Sglebius#define RT2860_MAX_PSDU_LEN64K 3 410223788Sglebius#define RT2860_MAX_MPDU_LEN_SHIFT 0 411223788Sglebius 412223788Sglebius/* possible flags for registers BBP_CSR_CFG/H2M_BBPAGENT */ 413223788Sglebius#define RT2860_BBP_RW_PARALLEL (1 << 19) 414223788Sglebius#define RT2860_BBP_PAR_DUR_112_5 (1 << 18) 415223788Sglebius#define RT2860_BBP_CSR_KICK (1 << 17) 416223788Sglebius#define RT2860_BBP_CSR_READ (1 << 16) 417223788Sglebius#define RT2860_BBP_ADDR_SHIFT 8 418223788Sglebius#define RT2860_BBP_DATA_SHIFT 0 419223788Sglebius 420135380Sglebius/* possible flags for register RF_CSR_CFG0 */ 421135380Sglebius#define RT2860_RF_REG_CTRL (1U << 31) 422135380Sglebius#define RT2860_RF_LE_SEL1 (1 << 30) 423135380Sglebius#define RT2860_RF_LE_STBY (1 << 29) 424135380Sglebius#define RT2860_RF_REG_WIDTH_SHIFT 24 425135380Sglebius#define RT2860_RF_REG_0_SHIFT 0 426135380Sglebius 427/* possible flags for register RF_CSR_CFG1 */ 428#define RT2860_RF_DUR_5 (1 << 24) 429#define RT2860_RF_REG_1_SHIFT 0 430 431/* possible flags for register LED_CFG */ 432#define RT2860_LED_POL (1 << 30) 433#define RT2860_Y_LED_MODE_SHIFT 28 434#define RT2860_G_LED_MODE_SHIFT 26 435#define RT2860_R_LED_MODE_SHIFT 24 436#define RT2860_LED_MODE_OFF 0 437#define RT2860_LED_MODE_BLINK_TX 1 438#define RT2860_LED_MODE_SLOW_BLINK 2 439#define RT2860_LED_MODE_ON 3 440#define RT2860_SLOW_BLK_TIME_SHIFT 16 441#define RT2860_LED_OFF_TIME_SHIFT 8 442#define RT2860_LED_ON_TIME_SHIFT 0 443 444/* possible flags for register XIFS_TIME_CFG */ 445#define RT2860_BB_RXEND_EN (1 << 29) 446#define RT2860_EIFS_TIME_SHIFT 20 447#define RT2860_OFDM_XIFS_TIME_SHIFT 16 448#define RT2860_OFDM_SIFS_TIME_SHIFT 8 449#define RT2860_CCK_SIFS_TIME_SHIFT 0 450 451/* possible flags for register BKOFF_SLOT_CFG */ 452#define RT2860_CC_DELAY_TIME_SHIFT 8 453#define RT2860_SLOT_TIME 0 454 455/* possible flags for register NAV_TIME_CFG */ 456#define RT2860_NAV_UPD (1U << 31) 457#define RT2860_NAV_UPD_VAL_SHIFT 16 458#define RT2860_NAV_CLR_EN (1 << 15) 459#define RT2860_NAV_TIMER_SHIFT 0 460 461/* possible flags for register CH_TIME_CFG */ 462#define RT2860_EIFS_AS_CH_BUSY (1 << 4) 463#define RT2860_NAV_AS_CH_BUSY (1 << 3) 464#define RT2860_RX_AS_CH_BUSY (1 << 2) 465#define RT2860_TX_AS_CH_BUSY (1 << 1) 466#define RT2860_CH_STA_TIMER_EN (1 << 0) 467 468/* possible values for register BCN_TIME_CFG */ 469#define RT2860_TSF_INS_COMP_SHIFT 24 470#define RT2860_BCN_TX_EN (1 << 20) 471#define RT2860_TBTT_TIMER_EN (1 << 19) 472#define RT2860_TSF_SYNC_MODE_SHIFT 17 473#define RT2860_TSF_SYNC_MODE_DIS 0 474#define RT2860_TSF_SYNC_MODE_STA 1 475#define RT2860_TSF_SYNC_MODE_IBSS 2 476#define RT2860_TSF_SYNC_MODE_HOSTAP 3 477#define RT2860_TSF_TIMER_EN (1 << 16) 478#define RT2860_BCN_INTVAL_SHIFT 0 479 480/* possible flags for register TBTT_SYNC_CFG */ 481#define RT2860_BCN_CWMIN_SHIFT 20 482#define RT2860_BCN_AIFSN_SHIFT 16 483#define RT2860_BCN_EXP_WIN_SHIFT 8 484#define RT2860_TBTT_ADJUST_SHIFT 0 485 486/* possible flags for register INT_TIMER_CFG */ 487#define RT2860_GP_TIMER_SHIFT 16 488#define RT2860_PRE_TBTT_TIMER_SHIFT 0 489 490/* possible flags for register INT_TIMER_EN */ 491#define RT2860_GP_TIMER_EN (1 << 1) 492#define RT2860_PRE_TBTT_INT_EN (1 << 0) 493 494/* possible flags for register MAC_STATUS_REG */ 495#define RT2860_RX_STATUS_BUSY (1 << 1) 496#define RT2860_TX_STATUS_BUSY (1 << 0) 497 498/* possible flags for register PWR_PIN_CFG */ 499#define RT2860_IO_ADDA_PD (1 << 3) 500#define RT2860_IO_PLL_PD (1 << 2) 501#define RT2860_IO_RA_PE (1 << 1) 502#define RT2860_IO_RF_PE (1 << 0) 503 504/* possible flags for register AUTO_WAKEUP_CFG */ 505#define RT2860_AUTO_WAKEUP_EN (1 << 15) 506#define RT2860_SLEEP_TBTT_NUM_SHIFT 8 507#define RT2860_WAKEUP_LEAD_TIME_SHIFT 0 508 509/* possible flags for register TX_PIN_CFG */ 510#define RT2860_TRSW_POL (1 << 19) 511#define RT2860_TRSW_EN (1 << 18) 512#define RT2860_RFTR_POL (1 << 17) 513#define RT2860_RFTR_EN (1 << 16) 514#define RT2860_LNA_PE_G1_POL (1 << 15) 515#define RT2860_LNA_PE_A1_POL (1 << 14) 516#define RT2860_LNA_PE_G0_POL (1 << 13) 517#define RT2860_LNA_PE_A0_POL (1 << 12) 518#define RT2860_LNA_PE_G1_EN (1 << 11) 519#define RT2860_LNA_PE_A1_EN (1 << 10) 520#define RT2860_LNA_PE1_EN (RT2860_LNA_PE_A1_EN | RT2860_LNA_PE_G1_EN) 521#define RT2860_LNA_PE_G0_EN (1 << 9) 522#define RT2860_LNA_PE_A0_EN (1 << 8) 523#define RT2860_LNA_PE0_EN (RT2860_LNA_PE_A0_EN | RT2860_LNA_PE_G0_EN) 524#define RT2860_PA_PE_G1_POL (1 << 7) 525#define RT2860_PA_PE_A1_POL (1 << 6) 526#define RT2860_PA_PE_G0_POL (1 << 5) 527#define RT2860_PA_PE_A0_POL (1 << 4) 528#define RT2860_PA_PE_G1_EN (1 << 3) 529#define RT2860_PA_PE_A1_EN (1 << 2) 530#define RT2860_PA_PE_G0_EN (1 << 1) 531#define RT2860_PA_PE_A0_EN (1 << 0) 532 533/* possible flags for register TX_BAND_CFG */ 534#define RT2860_5G_BAND_SEL_N (1 << 2) 535#define RT2860_5G_BAND_SEL_P (1 << 1) 536#define RT2860_TX_BAND_SEL (1 << 0) 537 538/* possible flags for register TX_SW_CFG0 */ 539#define RT2860_DLY_RFTR_EN_SHIFT 24 540#define RT2860_DLY_TRSW_EN_SHIFT 16 541#define RT2860_DLY_PAPE_EN_SHIFT 8 542#define RT2860_DLY_TXPE_EN_SHIFT 0 543 544/* possible flags for register TX_SW_CFG1 */ 545#define RT2860_DLY_RFTR_DIS_SHIFT 16 546#define RT2860_DLY_TRSW_DIS_SHIFT 8 547#define RT2860_DLY_PAPE_DIS SHIFT 0 548 549/* possible flags for register TX_SW_CFG2 */ 550#define RT2860_DLY_LNA_EN_SHIFT 24 551#define RT2860_DLY_LNA_DIS_SHIFT 16 552#define RT2860_DLY_DAC_EN_SHIFT 8 553#define RT2860_DLY_DAC_DIS_SHIFT 0 554 555/* possible flags for register TXOP_THRES_CFG */ 556#define RT2860_TXOP_REM_THRES_SHIFT 24 557#define RT2860_CF_END_THRES_SHIFT 16 558#define RT2860_RDG_IN_THRES 8 559#define RT2860_RDG_OUT_THRES 0 560 561/* possible flags for register TXOP_CTRL_CFG */ 562#define RT2860_EXT_CW_MIN_SHIFT 16 563#define RT2860_EXT_CCA_DLY_SHIFT 8 564#define RT2860_EXT_CCA_EN (1 << 7) 565#define RT2860_LSIG_TXOP_EN (1 << 6) 566#define RT2860_TXOP_TRUN_EN_MIMOPS (1 << 4) 567#define RT2860_TXOP_TRUN_EN_TXOP (1 << 3) 568#define RT2860_TXOP_TRUN_EN_RATE (1 << 2) 569#define RT2860_TXOP_TRUN_EN_AC (1 << 1) 570#define RT2860_TXOP_TRUN_EN_TIMEOUT (1 << 0) 571 572/* possible flags for register TX_RTS_CFG */ 573#define RT2860_RTS_FBK_EN (1 << 24) 574#define RT2860_RTS_THRES_SHIFT 8 575#define RT2860_RTS_RTY_LIMIT_SHIFT 0 576 577/* possible flags for register TX_TIMEOUT_CFG */ 578#define RT2860_TXOP_TIMEOUT_SHIFT 16 579#define RT2860_RX_ACK_TIMEOUT_SHIFT 8 580#define RT2860_MPDU_LIFE_TIME_SHIFT 4 581 582/* possible flags for register TX_RTY_CFG */ 583#define RT2860_TX_AUTOFB_EN (1 << 30) 584#define RT2860_AGG_RTY_MODE_TIMER (1 << 29) 585#define RT2860_NAG_RTY_MODE_TIMER (1 << 28) 586#define RT2860_LONG_RTY_THRES_SHIFT 16 587#define RT2860_LONG_RTY_LIMIT_SHIFT 8 588#define RT2860_SHORT_RTY_LIMIT_SHIFT 0 589 590/* possible flags for register TX_LINK_CFG */ 591#define RT2860_REMOTE_MFS_SHIFT 24 592#define RT2860_REMOTE_MFB_SHIFT 16 593#define RT2860_TX_CFACK_EN (1 << 12) 594#define RT2860_TX_RDG_EN (1 << 11) 595#define RT2860_TX_MRQ_EN (1 << 10) 596#define RT2860_REMOTE_UMFS_EN (1 << 9) 597#define RT2860_TX_MFB_EN (1 << 8) 598#define RT2860_REMOTE_MFB_LT_SHIFT 0 599 600/* possible flags for registers *_PROT_CFG */ 601#define RT2860_RTSTH_EN (1 << 26) 602#define RT2860_TXOP_ALLOW_GF40 (1 << 25) 603#define RT2860_TXOP_ALLOW_GF20 (1 << 24) 604#define RT2860_TXOP_ALLOW_MM40 (1 << 23) 605#define RT2860_TXOP_ALLOW_MM20 (1 << 22) 606#define RT2860_TXOP_ALLOW_OFDM (1 << 21) 607#define RT2860_TXOP_ALLOW_CCK (1 << 20) 608#define RT2860_TXOP_ALLOW_ALL (0x3f << 20) 609#define RT2860_PROT_NAV_SHORT (1 << 18) 610#define RT2860_PROT_NAV_LONG (2 << 18) 611#define RT2860_PROT_CTRL_RTS_CTS (1 << 16) 612#define RT2860_PROT_CTRL_CTS (2 << 16) 613 614/* possible flags for registers EXP_{CTS,ACK}_TIME */ 615#define RT2860_EXP_OFDM_TIME_SHIFT 16 616#define RT2860_EXP_CCK_TIME_SHIFT 0 617 618/* possible flags for register RX_FILTR_CFG */ 619#define RT2860_DROP_CTRL_RSV (1 << 16) 620#define RT2860_DROP_BAR (1 << 15) 621#define RT2860_DROP_BA (1 << 14) 622#define RT2860_DROP_PSPOLL (1 << 13) 623#define RT2860_DROP_RTS (1 << 12) 624#define RT2860_DROP_CTS (1 << 11) 625#define RT2860_DROP_ACK (1 << 10) 626#define RT2860_DROP_CFEND (1 << 9) 627#define RT2860_DROP_CFACK (1 << 8) 628#define RT2860_DROP_DUPL (1 << 7) 629#define RT2860_DROP_BC (1 << 6) 630#define RT2860_DROP_MC (1 << 5) 631#define RT2860_DROP_VER_ERR (1 << 4) 632#define RT2860_DROP_NOT_MYBSS (1 << 3) 633#define RT2860_DROP_UC_NOME (1 << 2) 634#define RT2860_DROP_PHY_ERR (1 << 1) 635#define RT2860_DROP_CRC_ERR (1 << 0) 636 637/* possible flags for register AUTO_RSP_CFG */ 638#define RT2860_CTRL_PWR_BIT (1 << 7) 639#define RT2860_BAC_ACK_POLICY (1 << 6) 640#define RT2860_CCK_SHORT_EN (1 << 4) 641#define RT2860_CTS_40M_REF_EN (1 << 3) 642#define RT2860_CTS_40M_MODE_EN (1 << 2) 643#define RT2860_BAC_ACKPOLICY_EN (1 << 1) 644#define RT2860_AUTO_RSP_EN (1 << 0) 645 646/* possible flags for register SIFS_COST_CFG */ 647#define RT2860_OFDM_SIFS_COST_SHIFT 8 648#define RT2860_CCK_SIFS_COST_SHIFT 0 649 650/* possible flags for register TXOP_HLDR_ET */ 651#define RT2860_TXOP_ETM1_EN (1 << 25) 652#define RT2860_TXOP_ETM0_EN (1 << 24) 653#define RT2860_TXOP_ETM_THRES_SHIFT 16 654#define RT2860_TXOP_ETO_EN (1 << 8) 655#define RT2860_TXOP_ETO_THRES_SHIFT 1 656#define RT2860_PER_RX_RST_EN (1 << 0) 657 658/* possible flags for register TX_STAT_FIFO */ 659#define RT2860_TXQ_MCS_SHIFT 16 660#define RT2860_TXQ_WCID_SHIFT 8 661#define RT2860_TXQ_ACKREQ (1 << 7) 662#define RT2860_TXQ_AGG (1 << 6) 663#define RT2860_TXQ_OK (1 << 5) 664#define RT2860_TXQ_PID_SHIFT 1 665#define RT2860_TXQ_VLD (1 << 0) 666 667/* possible flags for register WCID_ATTR */ 668#define RT2860_MODE_NOSEC 0 669#define RT2860_MODE_WEP40 1 670#define RT2860_MODE_WEP104 2 671#define RT2860_MODE_TKIP 3 672#define RT2860_MODE_AES_CCMP 4 673#define RT2860_MODE_CKIP40 5 674#define RT2860_MODE_CKIP104 6 675#define RT2860_MODE_CKIP128 7 676#define RT2860_RX_PKEY_EN (1 << 0) 677 678/* possible flags for register H2M_MAILBOX */ 679#define RT2860_H2M_BUSY (1 << 24) 680#define RT2860_TOKEN_NO_INTR 0xff 681 682/* possible flags for MCU command RT2860_MCU_CMD_LEDS */ 683#define RT2860_LED_RADIO (1 << 13) 684#define RT2860_LED_LINK_2GHZ (1 << 14) 685#define RT2860_LED_LINK_5GHZ (1 << 15) 686 687/* possible flags for RT3020 RF register 1 */ 688#define RT3070_RF_BLOCK (1 << 0) 689#define RT3070_PLL_PD (1 << 1) 690#define RT3070_RX0_PD (1 << 2) 691#define RT3070_TX0_PD (1 << 3) 692#define RT3070_RX1_PD (1 << 4) 693#define RT3070_TX1_PD (1 << 5) 694 695/* possible flags for RT3020 RF register 15 */ 696#define RT3070_TX_LO2 (1 << 3) 697 698/* possible flags for RT3020 RF register 17 */ 699#define RT3070_TX_LO1 (1 << 3) 700 701/* possible flags for RT3020 RF register 20 */ 702#define RT3070_RX_LO1 (1 << 3) 703 704/* possible flags for RT3020 RF register 21 */ 705#define RT3070_RX_LO2 (1 << 3) 706 707/* Possible flags for RT5390 RF register 2. */ 708#define RT5390_RESCAL (1 << 7) 709 710/* Possible flags for RT5390 RF register 3. */ 711#define RT5390_VCOCAL (1 << 7) 712 713/* Possible flags for RT5390 RF register 38. */ 714#define RT5390_RX_LO1 (1 << 5) 715 716/* Possible flags for RT5390 RF register 39. */ 717#define RT5390_RX_LO2 (1 << 7) 718 719/* Possible flags for RT5390 BBP register 4. */ 720#define RT5390_MAC_IF_CTRL (1 << 6) 721 722/* Possible flags for RT5390 BBP register 105. */ 723#define RT5390_MLD (1 << 2) 724#define RT5390_EN_SIG_MODULATION (1 << 3) 725 726/* RT2860 TX descriptor */ 727struct rt2860_txd { 728 uint32_t sdp0; /* Segment Data Pointer 0 */ 729 uint16_t sdl1; /* Segment Data Length 1 */ 730#define RT2860_TX_BURST (1 << 15) 731#define RT2860_TX_LS1 (1 << 14) /* SDP1 is the last segment */ 732 733 uint16_t sdl0; /* Segment Data Length 0 */ 734#define RT2860_TX_DDONE (1 << 15) 735#define RT2860_TX_LS0 (1 << 14) /* SDP0 is the last segment */ 736 737 uint32_t sdp1; /* Segment Data Pointer 1 */ 738 uint8_t reserved[3]; 739 uint8_t flags; 740#define RT2860_TX_QSEL_SHIFT 1 741#define RT2860_TX_QSEL_MGMT (0 << 1) 742#define RT2860_TX_QSEL_HCCA (1 << 1) 743#define RT2860_TX_QSEL_EDCA (2 << 1) 744#define RT2860_TX_WIV (1 << 0) 745} __packed; 746 747/* RT2870 TX descriptor */ 748struct rt2870_txd { 749 uint16_t len; 750 uint8_t pad; 751 uint8_t flags; 752} __packed; 753 754/* TX Wireless Information */ 755struct rt2860_txwi { 756 uint8_t flags; 757#define RT2860_TX_MPDU_DSITY_SHIFT 5 758#define RT2860_TX_AMPDU (1 << 4) 759#define RT2860_TX_TS (1 << 3) 760#define RT2860_TX_CFACK (1 << 2) 761#define RT2860_TX_MMPS (1 << 1) 762#define RT2860_TX_FRAG (1 << 0) 763 764 uint8_t txop; 765#define RT2860_TX_TXOP_HT 0 766#define RT2860_TX_TXOP_PIFS 1 767#define RT2860_TX_TXOP_SIFS 2 768#define RT2860_TX_TXOP_BACKOFF 3 769 770 uint16_t phy; 771#define RT2860_PHY_MODE 0xc000 772#define RT2860_PHY_CCK (0 << 14) 773#define RT2860_PHY_OFDM (1 << 14) 774#define RT2860_PHY_HT (2 << 14) 775#define RT2860_PHY_HT_GF (3 << 14) 776#define RT2860_PHY_SGI (1 << 8) 777#define RT2860_PHY_BW40 (1 << 7) 778#define RT2860_PHY_MCS 0x7f 779#define RT2860_PHY_SHPRE (1 << 3) 780 781 uint8_t xflags; 782#define RT2860_TX_BAWINSIZE_SHIFT 2 783#define RT2860_TX_NSEQ (1 << 1) 784#define RT2860_TX_ACK (1 << 0) 785 786 uint8_t wcid; /* Wireless Client ID */ 787 uint16_t len; 788#define RT2860_TX_PID_SHIFT 12 789 790 uint32_t iv; 791 uint32_t eiv; 792} __packed; 793 794/* RT2860 RX descriptor */ 795struct rt2860_rxd { 796 uint32_t sdp0; 797 uint16_t sdl1; /* unused */ 798 uint16_t sdl0; 799#define RT2860_RX_DDONE (1 << 15) 800#define RT2860_RX_LS0 (1 << 14) 801 802 uint32_t sdp1; /* unused */ 803 uint32_t flags; 804#define RT2860_RX_DEC (1 << 16) 805#define RT2860_RX_AMPDU (1 << 15) 806#define RT2860_RX_L2PAD (1 << 14) 807#define RT2860_RX_RSSI (1 << 13) 808#define RT2860_RX_HTC (1 << 12) 809#define RT2860_RX_AMSDU (1 << 11) 810#define RT2860_RX_MICERR (1 << 10) 811#define RT2860_RX_ICVERR (1 << 9) 812#define RT2860_RX_CRCERR (1 << 8) 813#define RT2860_RX_MYBSS (1 << 7) 814#define RT2860_RX_BC (1 << 6) 815#define RT2860_RX_MC (1 << 5) 816#define RT2860_RX_UC2ME (1 << 4) 817#define RT2860_RX_FRAG (1 << 3) 818#define RT2860_RX_NULL (1 << 2) 819#define RT2860_RX_DATA (1 << 1) 820#define RT2860_RX_BA (1 << 0) 821} __packed; 822 823/* RT2870 RX descriptor */ 824struct rt2870_rxd { 825 /* single 32-bit field */ 826 uint32_t flags; 827} __packed; 828 829/* RX Wireless Information */ 830struct rt2860_rxwi { 831 uint8_t wcid; 832 uint8_t keyidx; 833#define RT2860_RX_UDF_SHIFT 5 834#define RT2860_RX_BSS_IDX_SHIFT 2 835 836 uint16_t len; 837#define RT2860_RX_TID_SHIFT 12 838 839 uint16_t seq; 840 uint16_t phy; 841 uint8_t rssi[3]; 842 uint8_t reserved1; 843 uint8_t snr[2]; 844 uint16_t reserved2; 845} __packed; 846 847#define RT2860_RF_2820 0x0001 /* 2T3R */ 848#define RT2860_RF_2850 0x0002 /* dual-band 2T3R */ 849#define RT2860_RF_2720 0x0003 /* 1T2R */ 850#define RT2860_RF_2750 0x0004 /* dual-band 1T2R */ 851#define RT3070_RF_3020 0x0005 /* 1T1R */ 852#define RT3070_RF_2020 0x0006 /* b/g */ 853#define RT3070_RF_3021 0x0007 /* 1T2R */ 854#define RT3070_RF_3022 0x0008 /* 2T2R */ 855#define RT3070_RF_3052 0x0009 /* dual-band 2T2R */ 856#define RT5592_RF_5592 0x000f /* dual-band 2T2R */ 857#define RT5390_RF_5370 0x5370 /* 1T1R */ 858#define RT5390_RF_5372 0x5372 /* 2T2R */ 859 860/* USB commands for RT2870 only */ 861#define RT2870_RESET 1 862#define RT2870_WRITE_2 2 863#define RT2870_WRITE_REGION_1 6 864#define RT2870_READ_REGION_1 7 865#define RT2870_EEPROM_READ 9 866 867#define RT2860_EEPROM_DELAY 1 /* minimum hold time (microsecond) */ 868 869#define RT2860_EEPROM_VERSION 0x01 870#define RT2860_EEPROM_MAC01 0x02 871#define RT2860_EEPROM_MAC23 0x03 872#define RT2860_EEPROM_MAC45 0x04 873#define RT2860_EEPROM_PCIE_PSLEVEL 0x11 874#define RT2860_EEPROM_REV 0x12 875#define RT2860_EEPROM_ANTENNA 0x1a 876#define RT2860_EEPROM_CONFIG 0x1b 877#define RT2860_EEPROM_COUNTRY 0x1c 878#define RT2860_EEPROM_FREQ_LEDS 0x1d 879#define RT2860_EEPROM_LED1 0x1e 880#define RT2860_EEPROM_LED2 0x1f 881#define RT2860_EEPROM_LED3 0x20 882#define RT2860_EEPROM_LNA 0x22 883#define RT2860_EEPROM_RSSI1_2GHZ 0x23 884#define RT2860_EEPROM_RSSI2_2GHZ 0x24 885#define RT2860_EEPROM_RSSI1_5GHZ 0x25 886#define RT2860_EEPROM_RSSI2_5GHZ 0x26 887#define RT2860_EEPROM_DELTAPWR 0x28 888#define RT2860_EEPROM_PWR2GHZ_BASE1 0x29 889#define RT2860_EEPROM_PWR2GHZ_BASE2 0x30 890#define RT2860_EEPROM_TSSI1_2GHZ 0x37 891#define RT2860_EEPROM_TSSI2_2GHZ 0x38 892#define RT2860_EEPROM_TSSI3_2GHZ 0x39 893#define RT2860_EEPROM_TSSI4_2GHZ 0x3a 894#define RT2860_EEPROM_TSSI5_2GHZ 0x3b 895#define RT2860_EEPROM_PWR5GHZ_BASE1 0x3c 896#define RT2860_EEPROM_PWR5GHZ_BASE2 0x53 897#define RT2860_EEPROM_TSSI1_5GHZ 0x6a 898#define RT2860_EEPROM_TSSI2_5GHZ 0x6b 899#define RT2860_EEPROM_TSSI3_5GHZ 0x6c 900#define RT2860_EEPROM_TSSI4_5GHZ 0x6d 901#define RT2860_EEPROM_TSSI5_5GHZ 0x6e 902#define RT2860_EEPROM_RPWR 0x6f 903#define RT2860_EEPROM_BBP_BASE 0x78 904#define RT3071_EEPROM_RF_BASE 0x82 905 906/* 907 * EEPROM IQ calibration. 908 */ 909#define RT5390_EEPROM_IQ_GAIN_CAL_TX0_2GHZ 0x130 910#define RT5390_EEPROM_IQ_PHASE_CAL_TX0_2GHZ 0x131 911#define RT5390_EEPROM_IQ_GAIN_CAL_TX1_2GHZ 0x133 912#define RT5390_EEPROM_IQ_PHASE_CAL_TX1_2GHZ 0x134 913#define RT5390_EEPROM_RF_IQ_COMPENSATION_CTL 0x13c 914#define RT5390_EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CTL 0x13d 915#define RT5390_EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5GHZ 0x144 916#define RT5390_EEPROM_IQ_PHASE_CAL_TX0_CH36_TO_CH64_5GHZ 0x145 917#define RT5390_EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5GHZ 0x146 918#define RT5390_EEPROM_IQ_PHASE_CAL_TX0_CH100_TO_CH138_5GHZ 0x147 919#define RT5390_EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5GHZ 0x148 920#define RT5390_EEPROM_IQ_PHASE_CAL_TX0_CH140_TO_CH165_5GHZ 0x149 921#define RT5390_EEPROM_IQ_GAIN_CAL_TX1_CH36_TO_CH64_5GHZ 0x14a 922#define RT5390_EEPROM_IQ_PHASE_CAL_TX1_CH36_TO_CH64_5GHZ 0x14b 923#define RT5390_EEPROM_IQ_GAIN_CAL_TX1_CH100_TO_CH138_5GHZ 0x14c 924#define RT5390_EEPROM_IQ_PHASE_CAL_TX1_CH100_TO_CH138_5GHZ 0x14d 925#define RT5390_EEPROM_IQ_GAIN_CAL_TX1_CH140_TO_CH165_5GHZ 0x14e 926#define RT5390_EEPROM_IQ_PHASE_CAL_TX1_CH140_TO_CH165_5GHZ 0x14f 927 928#define RT2860_RIDX_CCK1 0 929#define RT2860_RIDX_CCK11 3 930#define RT2860_RIDX_OFDM6 4 931#define RT2860_RIDX_MAX 12 932 933/* 934 * EEPROM access macro. 935 */ 936#define RT2860_EEPROM_CTL(sc, val) do { \ 937 RAL_WRITE((sc), RT2860_PCI_EECTRL, (val)); \ 938 RAL_BARRIER_READ_WRITE((sc)); \ 939 DELAY(RT2860_EEPROM_DELAY); \ 940} while (/* CONSTCOND */0) 941 942/* 943 * Default values for MAC registers; values taken from the reference driver. 944 */ 945#define RT2870_DEF_MAC \ 946 { RT2860_BCN_OFFSET0, 0xf8f0e8e0 }, \ 947 { RT2860_BCN_OFFSET1, 0x6f77d0c8 }, \ 948 { RT2860_LEGACY_BASIC_RATE, 0x0000013f }, \ 949 { RT2860_HT_BASIC_RATE, 0x00008003 }, \ 950 { RT2860_MAC_SYS_CTRL, 0x00000000 }, \ 951 { RT2860_BKOFF_SLOT_CFG, 0x00000209 }, \ 952 { RT2860_TX_SW_CFG0, 0x00000000 }, \ 953 { RT2860_TX_SW_CFG1, 0x00080606 }, \ 954 { RT2860_TX_LINK_CFG, 0x00001020 }, \ 955 { RT2860_TX_TIMEOUT_CFG, 0x000a2090 }, \ 956 { RT2860_MAX_LEN_CFG, 0x00001f00 }, \ 957 { RT2860_LED_CFG, 0x7f031e46 }, \ 958 { RT2860_WMM_AIFSN_CFG, 0x00002273 }, \ 959 { RT2860_WMM_CWMIN_CFG, 0x00002344 }, \ 960 { RT2860_WMM_CWMAX_CFG, 0x000034aa }, \ 961 { RT2860_MAX_PCNT, 0x1f3fbf9f }, \ 962 { RT2860_TX_RTY_CFG, 0x47d01f0f }, \ 963 { RT2860_AUTO_RSP_CFG, 0x00000013 }, \ 964 { RT2860_CCK_PROT_CFG, 0x05740003 }, \ 965 { RT2860_OFDM_PROT_CFG, 0x05740003 }, \ 966 { RT2860_PBF_CFG, 0x00f40006 }, \ 967 { RT2860_WPDMA_GLO_CFG, 0x00000030 }, \ 968 { RT2860_GF20_PROT_CFG, 0x01744004 }, \ 969 { RT2860_GF40_PROT_CFG, 0x03f44084 }, \ 970 { RT2860_MM20_PROT_CFG, 0x01744004 }, \ 971 { RT2860_MM40_PROT_CFG, 0x03f44084 }, \ 972 { RT2860_TXOP_CTRL_CFG, 0x0000583f }, \ 973 { RT2860_TXOP_HLDR_ET, 0x00000002 }, \ 974 { RT2860_TX_RTS_CFG, 0x00092b20 }, \ 975 { RT2860_EXP_ACK_TIME, 0x002400ca }, \ 976 { RT2860_XIFS_TIME_CFG, 0x33a41010 }, \ 977 { RT2860_PWR_PIN_CFG, 0x00000003 } 978 979/* 980 * Default values for BBP registers; values taken from the reference driver. 981 */ 982#define RT2860_DEF_BBP \ 983 { 65, 0x2c }, \ 984 { 66, 0x38 }, \ 985 { 68, 0x0b }, \ 986 { 69, 0x12 }, \ 987 { 70, 0x0a }, \ 988 { 73, 0x10 }, \ 989 { 81, 0x37 }, \ 990 { 82, 0x62 }, \ 991 { 83, 0x6a }, \ 992 { 84, 0x99 }, \ 993 { 86, 0x00 }, \ 994 { 91, 0x04 }, \ 995 { 92, 0x00 }, \ 996 { 103, 0x00 }, \ 997 { 105, 0x05 }, \ 998 { 106, 0x35 } 999 1000#define RT5390_DEF_BBP \ 1001 { 31, 0x08 }, \ 1002 { 65, 0x2c }, \ 1003 { 66, 0x38 }, \ 1004 { 68, 0x0b }, \ 1005 { 69, 0x0d }, \ 1006 { 70, 0x06 }, \ 1007 { 73, 0x13 }, \ 1008 { 75, 0x46 }, \ 1009 { 76, 0x28 }, \ 1010 { 77, 0x59 }, \ 1011 { 81, 0x37 }, \ 1012 { 82, 0x62 }, \ 1013 { 83, 0x7a }, \ 1014 { 84, 0x9a }, \ 1015 { 86, 0x38 }, \ 1016 { 91, 0x04 }, \ 1017 { 92, 0x02 }, \ 1018 { 103, 0xc0 }, \ 1019 { 104, 0x92 }, \ 1020 { 105, 0x3c }, \ 1021 { 106, 0x03 }, \ 1022 { 128, 0x12 } 1023 1024#define RT5592_DEF_BBP \ 1025 { 20, 0x06 }, \ 1026 { 31, 0x08 }, \ 1027 { 65, 0x2c }, \ 1028 { 66, 0x38 }, \ 1029 { 68, 0xdd }, \ 1030 { 69, 0x1a }, \ 1031 { 70, 0x05 }, \ 1032 { 73, 0x13 }, \ 1033 { 74, 0x0f }, \ 1034 { 75, 0x4f }, \ 1035 { 76, 0x28 }, \ 1036 { 77, 0x59 }, \ 1037 { 81, 0x37 }, \ 1038 { 82, 0x62 }, \ 1039 { 83, 0x6a }, \ 1040 { 84, 0x9a }, \ 1041 { 86, 0x38 }, \ 1042 { 88, 0x90 }, \ 1043 { 91, 0x04 }, \ 1044 { 92, 0x02 }, \ 1045 { 95, 0x9a }, \ 1046 { 98, 0x12 }, \ 1047 { 103, 0xc0 }, \ 1048 { 104, 0x92 }, \ 1049 { 105, 0x3c }, \ 1050 { 106, 0x35 }, \ 1051 { 128, 0x12 }, \ 1052 { 134, 0xd0 }, \ 1053 { 135, 0xf6 }, \ 1054 { 137, 0x0f } 1055 1056/* 1057 * Default settings for RF registers; values derived from the reference driver. 1058 */ 1059#define RT2860_RF2850 \ 1060 { 1, 0x98402ecc, 0x984c0786, 0x9816b455, 0x9800510b }, \ 1061 { 2, 0x98402ecc, 0x984c0786, 0x98168a55, 0x9800519f }, \ 1062 { 3, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800518b }, \ 1063 { 4, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800519f }, \ 1064 { 5, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800518b }, \ 1065 { 6, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800519f }, \ 1066 { 7, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800518b }, \ 1067 { 8, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800519f }, \ 1068 { 9, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800518b }, \ 1069 { 10, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800519f }, \ 1070 { 11, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800518b }, \ 1071 { 12, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800519f }, \ 1072 { 13, 0x98402ecc, 0x984c079e, 0x98168a55, 0x9800518b }, \ 1073 { 14, 0x98402ecc, 0x984c07a2, 0x98168a55, 0x98005193 }, \ 1074 { 36, 0x98402ecc, 0x984c099a, 0x98158a55, 0x980ed1a3 }, \ 1075 { 38, 0x98402ecc, 0x984c099e, 0x98158a55, 0x980ed193 }, \ 1076 { 40, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed183 }, \ 1077 { 44, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed1a3 }, \ 1078 { 46, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed18b }, \ 1079 { 48, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed19b }, \ 1080 { 52, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed193 }, \ 1081 { 54, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed1a3 }, \ 1082 { 56, 0x98402ec8, 0x984c068e, 0x98158a55, 0x980ed18b }, \ 1083 { 60, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed183 }, \ 1084 { 62, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed193 }, \ 1085 { 64, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed1a3 }, \ 1086 { 100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783 }, \ 1087 { 102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793 }, \ 1088 { 104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3 }, \ 1089 { 108, 0x98402ecc, 0x985c0a32, 0x98578a55, 0x980ed193 }, \ 1090 { 110, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed183 }, \ 1091 { 112, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed19b }, \ 1092 { 116, 0x98402ecc, 0x984c0a3a, 0x98178a55, 0x980ed1a3 }, \ 1093 { 118, 0x98402ecc, 0x984c0a3e, 0x98178a55, 0x980ed193 }, \ 1094 { 120, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed183 }, \ 1095 { 124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193 }, \ 1096 { 126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b }, \ 1097 { 128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3 }, \ 1098 { 132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b }, \ 1099 { 134, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed193 }, \ 1100 { 136, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed19b }, \ 1101 { 140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183 }, \ 1102 { 149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7 }, \ 1103 { 151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187 }, \ 1104 { 153, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed18f }, \ 1105 { 157, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed19f }, \ 1106 { 159, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed1a7 }, \ 1107 { 161, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed187 }, \ 1108 { 165, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed197 }, \ 1109 { 167, 0x98402ec4, 0x984c03d2, 0x98179855, 0x9815531f }, \ 1110 { 169, 0x98402ec4, 0x984c03d2, 0x98179855, 0x98155327 }, \ 1111 { 171, 0x98402ec4, 0x984c03d6, 0x98179855, 0x98155307 }, \ 1112 { 173, 0x98402ec4, 0x984c03d6, 0x98179855, 0x9815530f }, \ 1113 { 184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b }, \ 1114 { 188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13 }, \ 1115 { 192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b }, \ 1116 { 196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23 }, \ 1117 { 208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13 }, \ 1118 { 212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b }, \ 1119 { 216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23 } 1120 1121#define RT3070_RF3052 \ 1122 { 0xf1, 2, 2 }, \ 1123 { 0xf1, 2, 7 }, \ 1124 { 0xf2, 2, 2 }, \ 1125 { 0xf2, 2, 7 }, \ 1126 { 0xf3, 2, 2 }, \ 1127 { 0xf3, 2, 7 }, \ 1128 { 0xf4, 2, 2 }, \ 1129 { 0xf4, 2, 7 }, \ 1130 { 0xf5, 2, 2 }, \ 1131 { 0xf5, 2, 7 }, \ 1132 { 0xf6, 2, 2 }, \ 1133 { 0xf6, 2, 7 }, \ 1134 { 0xf7, 2, 2 }, \ 1135 { 0xf8, 2, 4 }, \ 1136 { 0x56, 0, 4 }, \ 1137 { 0x56, 0, 6 }, \ 1138 { 0x56, 0, 8 }, \ 1139 { 0x57, 0, 0 }, \ 1140 { 0x57, 0, 2 }, \ 1141 { 0x57, 0, 4 }, \ 1142 { 0x57, 0, 8 }, \ 1143 { 0x57, 0, 10 }, \ 1144 { 0x58, 0, 0 }, \ 1145 { 0x58, 0, 4 }, \ 1146 { 0x58, 0, 6 }, \ 1147 { 0x58, 0, 8 }, \ 1148 { 0x5b, 0, 8 }, \ 1149 { 0x5b, 0, 10 }, \ 1150 { 0x5c, 0, 0 }, \ 1151 { 0x5c, 0, 4 }, \ 1152 { 0x5c, 0, 6 }, \ 1153 { 0x5c, 0, 8 }, \ 1154 { 0x5d, 0, 0 }, \ 1155 { 0x5d, 0, 2 }, \ 1156 { 0x5d, 0, 4 }, \ 1157 { 0x5d, 0, 8 }, \ 1158 { 0x5d, 0, 10 }, \ 1159 { 0x5e, 0, 0 }, \ 1160 { 0x5e, 0, 4 }, \ 1161 { 0x5e, 0, 6 }, \ 1162 { 0x5e, 0, 8 }, \ 1163 { 0x5f, 0, 0 }, \ 1164 { 0x5f, 0, 9 }, \ 1165 { 0x5f, 0, 11 }, \ 1166 { 0x60, 0, 1 }, \ 1167 { 0x60, 0, 5 }, \ 1168 { 0x60, 0, 7 }, \ 1169 { 0x60, 0, 9 }, \ 1170 { 0x61, 0, 1 }, \ 1171 { 0x61, 0, 3 }, \ 1172 { 0x61, 0, 5 }, \ 1173 { 0x61, 0, 7 }, \ 1174 { 0x61, 0, 9 } 1175 1176#define RT5592_RF5592_20MHZ \ 1177 { 0x1e2, 4, 10, 3 }, \ 1178 { 0x1e3, 4, 10, 3 }, \ 1179 { 0x1e4, 4, 10, 3 }, \ 1180 { 0x1e5, 4, 10, 3 }, \ 1181 { 0x1e6, 4, 10, 3 }, \ 1182 { 0x1e7, 4, 10, 3 }, \ 1183 { 0x1e8, 4, 10, 3 }, \ 1184 { 0x1e9, 4, 10, 3 }, \ 1185 { 0x1ea, 4, 10, 3 }, \ 1186 { 0x1eb, 4, 10, 3 }, \ 1187 { 0x1ec, 4, 10, 3 }, \ 1188 { 0x1ed, 4, 10, 3 }, \ 1189 { 0x1ee, 4, 10, 3 }, \ 1190 { 0x1f0, 8, 10, 3 }, \ 1191 { 0xac, 8, 12, 1 }, \ 1192 { 0xad, 0, 12, 1 }, \ 1193 { 0xad, 4, 12, 1 }, \ 1194 { 0xae, 0, 12, 1 }, \ 1195 { 0xae, 4, 12, 1 }, \ 1196 { 0xae, 8, 12, 1 }, \ 1197 { 0xaf, 4, 12, 1 }, \ 1198 { 0xaf, 8, 12, 1 }, \ 1199 { 0xb0, 0, 12, 1 }, \ 1200 { 0xb0, 8, 12, 1 }, \ 1201 { 0xb1, 0, 12, 1 }, \ 1202 { 0xb1, 4, 12, 1 }, \ 1203 { 0xb7, 4, 12, 1 }, \ 1204 { 0xb7, 8, 12, 1 }, \ 1205 { 0xb8, 0, 12, 1 }, \ 1206 { 0xb8, 8, 12, 1 }, \ 1207 { 0xb9, 0, 12, 1 }, \ 1208 { 0xb9, 4, 12, 1 }, \ 1209 { 0xba, 0, 12, 1 }, \ 1210 { 0xba, 4, 12, 1 }, \ 1211 { 0xba, 8, 12, 1 }, \ 1212 { 0xbb, 4, 12, 1 }, \ 1213 { 0xbb, 8, 12, 1 }, \ 1214 { 0xbc, 0, 12, 1 }, \ 1215 { 0xbc, 8, 12, 1 }, \ 1216 { 0xbd, 0, 12, 1 }, \ 1217 { 0xbd, 4, 12, 1 }, \ 1218 { 0xbe, 0, 12, 1 }, \ 1219 { 0xbf, 6, 12, 1 }, \ 1220 { 0xbf, 10, 12, 1 }, \ 1221 { 0xc0, 2, 12, 1 }, \ 1222 { 0xc0, 10, 12, 1 }, \ 1223 { 0xc1, 2, 12, 1 }, \ 1224 { 0xc1, 6, 12, 1 }, \ 1225 { 0xc2, 2, 12, 1 }, \ 1226 { 0xa4, 0, 12, 1 }, \ 1227 { 0xa4, 4, 12, 1 }, \ 1228 { 0xa5, 8, 12, 1 }, \ 1229 { 0xa6, 0, 12, 1 } 1230 1231#define RT5592_RF5592_40MHZ \ 1232 { 0xf1, 2, 10, 3 }, \ 1233 { 0xf1, 7, 10, 3 }, \ 1234 { 0xf2, 2, 10, 3 }, \ 1235 { 0xf2, 7, 10, 3 }, \ 1236 { 0xf3, 2, 10, 3 }, \ 1237 { 0xf3, 7, 10, 3 }, \ 1238 { 0xf4, 2, 10, 3 }, \ 1239 { 0xf4, 7, 10, 3 }, \ 1240 { 0xf5, 2, 10, 3 }, \ 1241 { 0xf5, 7, 10, 3 }, \ 1242 { 0xf6, 2, 10, 3 }, \ 1243 { 0xf6, 7, 10, 3 }, \ 1244 { 0xf7, 2, 10, 3 }, \ 1245 { 0xf8, 4, 10, 3 }, \ 1246 { 0x56, 4, 12, 1 }, \ 1247 { 0x56, 6, 12, 1 }, \ 1248 { 0x56, 8, 12, 1 }, \ 1249 { 0x57, 0, 12, 1 }, \ 1250 { 0x57, 2, 12, 1 }, \ 1251 { 0x57, 4, 12, 1 }, \ 1252 { 0x57, 8, 12, 1 }, \ 1253 { 0x57, 10, 12, 1 }, \ 1254 { 0x58, 0, 12, 1 }, \ 1255 { 0x58, 4, 12, 1 }, \ 1256 { 0x58, 6, 12, 1 }, \ 1257 { 0x58, 8, 12, 1 }, \ 1258 { 0x5b, 8, 12, 1 }, \ 1259 { 0x5b, 10, 12, 1 }, \ 1260 { 0x5c, 0, 12, 1 }, \ 1261 { 0x5c, 4, 12, 1 }, \ 1262 { 0x5c, 6, 12, 1 }, \ 1263 { 0x5c, 8, 12, 1 }, \ 1264 { 0x5d, 0, 12, 1 }, \ 1265 { 0x5d, 2, 12, 1 }, \ 1266 { 0x5d, 4, 12, 1 }, \ 1267 { 0x5d, 8, 12, 1 }, \ 1268 { 0x5d, 10, 12, 1 }, \ 1269 { 0x5e, 0, 12, 1 }, \ 1270 { 0x5e, 4, 12, 1 }, \ 1271 { 0x5e, 6, 12, 1 }, \ 1272 { 0x5e, 8, 12, 1 }, \ 1273 { 0x5f, 0, 12, 1 }, \ 1274 { 0x5f, 9, 12, 1 }, \ 1275 { 0x5f, 11, 12, 1 }, \ 1276 { 0x60, 1, 12, 1 }, \ 1277 { 0x60, 5, 12, 1 }, \ 1278 { 0x60, 7, 12, 1 }, \ 1279 { 0x60, 9, 12, 1 }, \ 1280 { 0x61, 1, 12, 1 }, \ 1281 { 0x52, 0, 12, 1 }, \ 1282 { 0x52, 4, 12, 1 }, \ 1283 { 0x52, 8, 12, 1 }, \ 1284 { 0x53, 0, 12, 1 } 1285 1286#define RT3070_DEF_RF \ 1287 { 4, 0x40 }, \ 1288 { 5, 0x03 }, \ 1289 { 6, 0x02 }, \ 1290 { 7, 0x60 }, \ 1291 { 9, 0x0f }, \ 1292 { 10, 0x41 }, \ 1293 { 11, 0x21 }, \ 1294 { 12, 0x7b }, \ 1295 { 14, 0x90 }, \ 1296 { 15, 0x58 }, \ 1297 { 16, 0xb3 }, \ 1298 { 17, 0x92 }, \ 1299 { 18, 0x2c }, \ 1300 { 19, 0x02 }, \ 1301 { 20, 0xba }, \ 1302 { 21, 0xdb }, \ 1303 { 24, 0x16 }, \ 1304 { 25, 0x03 }, \ 1305 { 29, 0x1f } 1306 1307#define RT3572_DEF_RF \ 1308 { 0, 0x70 }, \ 1309 { 1, 0x81 }, \ 1310 { 2, 0xf1 }, \ 1311 { 3, 0x02 }, \ 1312 { 4, 0x4c }, \ 1313 { 5, 0x05 }, \ 1314 { 6, 0x4a }, \ 1315 { 7, 0xd8 }, \ 1316 { 9, 0xc3 }, \ 1317 { 10, 0xf1 }, \ 1318 { 11, 0xb9 }, \ 1319 { 12, 0x70 }, \ 1320 { 13, 0x65 }, \ 1321 { 14, 0xa0 }, \ 1322 { 15, 0x53 }, \ 1323 { 16, 0x4c }, \ 1324 { 17, 0x23 }, \ 1325 { 18, 0xac }, \ 1326 { 19, 0x93 }, \ 1327 { 20, 0xb3 }, \ 1328 { 21, 0xd0 }, \ 1329 { 22, 0x00 }, \ 1330 { 23, 0x3c }, \ 1331 { 24, 0x16 }, \ 1332 { 25, 0x15 }, \ 1333 { 26, 0x85 }, \ 1334 { 27, 0x00 }, \ 1335 { 28, 0x00 }, \ 1336 { 29, 0x9b }, \ 1337 { 30, 0x09 }, \ 1338 { 31, 0x10 } 1339 1340#define RT5390_DEF_RF \ 1341 { 1, 0x0f }, \ 1342 { 2, 0x80 }, \ 1343 { 3, 0x88 }, \ 1344 { 5, 0x10 }, \ 1345 { 6, 0xa0 }, \ 1346 { 7, 0x00 }, \ 1347 { 10, 0x53 }, \ 1348 { 11, 0x4a }, \ 1349 { 12, 0x46 }, \ 1350 { 13, 0x9f }, \ 1351 { 14, 0x00 }, \ 1352 { 15, 0x00 }, \ 1353 { 16, 0x00 }, \ 1354 { 18, 0x03 }, \ 1355 { 19, 0x00 }, \ 1356 { 20, 0x00 }, \ 1357 { 21, 0x00 }, \ 1358 { 22, 0x20 }, \ 1359 { 23, 0x00 }, \ 1360 { 24, 0x00 }, \ 1361 { 25, 0xc0 }, \ 1362 { 26, 0x00 }, \ 1363 { 27, 0x09 }, \ 1364 { 28, 0x00 }, \ 1365 { 29, 0x10 }, \ 1366 { 30, 0x10 }, \ 1367 { 31, 0x80 }, \ 1368 { 32, 0x80 }, \ 1369 { 33, 0x00 }, \ 1370 { 34, 0x07 }, \ 1371 { 35, 0x12 }, \ 1372 { 36, 0x00 }, \ 1373 { 37, 0x08 }, \ 1374 { 38, 0x85 }, \ 1375 { 39, 0x1b }, \ 1376 { 40, 0x0b }, \ 1377 { 41, 0xbb }, \ 1378 { 42, 0xd2 }, \ 1379 { 43, 0x9a }, \ 1380 { 44, 0x0e }, \ 1381 { 45, 0xa2 }, \ 1382 { 46, 0x7b }, \ 1383 { 47, 0x00 }, \ 1384 { 48, 0x10 }, \ 1385 { 49, 0x94 }, \ 1386 { 52, 0x38 }, \ 1387 { 53, 0x84 }, \ 1388 { 54, 0x78 }, \ 1389 { 55, 0x44 }, \ 1390 { 56, 0x22 }, \ 1391 { 57, 0x80 }, \ 1392 { 58, 0x7f }, \ 1393 { 59, 0x8f }, \ 1394 { 60, 0x45 }, \ 1395 { 61, 0xdd }, \ 1396 { 62, 0x00 }, \ 1397 { 63, 0x00 } 1398 1399#define RT5392_DEF_RF \ 1400 { 1, 0x17 }, \ 1401 { 3, 0x88 }, \ 1402 { 5, 0x10 }, \ 1403 { 6, 0xe0 }, \ 1404 { 7, 0x00 }, \ 1405 { 10, 0x53 }, \ 1406 { 11, 0x4a }, \ 1407 { 12, 0x46 }, \ 1408 { 13, 0x9f }, \ 1409 { 14, 0x00 }, \ 1410 { 15, 0x00 }, \ 1411 { 16, 0x00 }, \ 1412 { 18, 0x03 }, \ 1413 { 19, 0x4d }, \ 1414 { 20, 0x00 }, \ 1415 { 21, 0x8d }, \ 1416 { 22, 0x20 }, \ 1417 { 23, 0x0b }, \ 1418 { 24, 0x44 }, \ 1419 { 25, 0x80 }, \ 1420 { 26, 0x82 }, \ 1421 { 27, 0x09 }, \ 1422 { 28, 0x00 }, \ 1423 { 29, 0x10 }, \ 1424 { 30, 0x10 }, \ 1425 { 31, 0x80 }, \ 1426 { 32, 0x20 }, \ 1427 { 33, 0xc0 }, \ 1428 { 34, 0x07 }, \ 1429 { 35, 0x12 }, \ 1430 { 36, 0x00 }, \ 1431 { 37, 0x08 }, \ 1432 { 38, 0x89 }, \ 1433 { 39, 0x1b }, \ 1434 { 40, 0x0f }, \ 1435 { 41, 0xbb }, \ 1436 { 42, 0xd5 }, \ 1437 { 43, 0x9b }, \ 1438 { 44, 0x0e }, \ 1439 { 45, 0xa2 }, \ 1440 { 46, 0x73 }, \ 1441 { 47, 0x0c }, \ 1442 { 48, 0x10 }, \ 1443 { 49, 0x94 }, \ 1444 { 50, 0x94 }, \ 1445 { 51, 0x3a }, \ 1446 { 52, 0x48 }, \ 1447 { 53, 0x44 }, \ 1448 { 54, 0x38 }, \ 1449 { 55, 0x43 }, \ 1450 { 56, 0xa1 }, \ 1451 { 57, 0x00 }, \ 1452 { 58, 0x39 }, \ 1453 { 59, 0x07 }, \ 1454 { 60, 0x45 }, \ 1455 { 61, 0x91 }, \ 1456 { 62, 0x39 }, \ 1457 { 63, 0x07 } 1458 1459#define RT5592_DEF_RF \ 1460 { 1, 0x3f }, \ 1461 { 3, 0x08 }, \ 1462 { 5, 0x10 }, \ 1463 { 6, 0xe4 }, \ 1464 { 7, 0x00 }, \ 1465 { 14, 0x00 }, \ 1466 { 15, 0x00 }, \ 1467 { 16, 0x00 }, \ 1468 { 18, 0x03 }, \ 1469 { 19, 0x4d }, \ 1470 { 20, 0x10 }, \ 1471 { 21, 0x8d }, \ 1472 { 26, 0x82 }, \ 1473 { 28, 0x00 }, \ 1474 { 29, 0x10 }, \ 1475 { 33, 0xc0 }, \ 1476 { 34, 0x07 }, \ 1477 { 35, 0x12 }, \ 1478 { 47, 0x0c }, \ 1479 { 53, 0x22 }, \ 1480 { 63, 0x07 } 1481 1482#define RT5592_2GHZ_DEF_RF \ 1483 { 10, 0x90 }, \ 1484 { 11, 0x4a }, \ 1485 { 12, 0x52 }, \ 1486 { 13, 0x42 }, \ 1487 { 22, 0x40 }, \ 1488 { 24, 0x4a }, \ 1489 { 25, 0x80 }, \ 1490 { 27, 0x42 }, \ 1491 { 36, 0x80 }, \ 1492 { 37, 0x08 }, \ 1493 { 38, 0x89 }, \ 1494 { 39, 0x1b }, \ 1495 { 40, 0x0d }, \ 1496 { 41, 0x9b }, \ 1497 { 42, 0xd5 }, \ 1498 { 43, 0x72 }, \ 1499 { 44, 0x0e }, \ 1500 { 45, 0xa2 }, \ 1501 { 46, 0x6b }, \ 1502 { 48, 0x10 }, \ 1503 { 51, 0x3e }, \ 1504 { 52, 0x48 }, \ 1505 { 54, 0x38 }, \ 1506 { 56, 0xa1 }, \ 1507 { 57, 0x00 }, \ 1508 { 58, 0x39 }, \ 1509 { 60, 0x45 }, \ 1510 { 61, 0x91 }, \ 1511 { 62, 0x39 } 1512 1513#define RT5592_5GHZ_DEF_RF \ 1514 { 10, 0x97 }, \ 1515 { 11, 0x40 }, \ 1516 { 25, 0xbf }, \ 1517 { 27, 0x42 }, \ 1518 { 36, 0x00 }, \ 1519 { 37, 0x04 }, \ 1520 { 38, 0x85 }, \ 1521 { 40, 0x42 }, \ 1522 { 41, 0xbb }, \ 1523 { 42, 0xd7 }, \ 1524 { 45, 0x41 }, \ 1525 { 48, 0x00 }, \ 1526 { 57, 0x77 }, \ 1527 { 60, 0x05 }, \ 1528 { 61, 0x01 } 1529 1530#define RT5592_CHAN_5GHZ \ 1531 { 36, 64, 12, 0x2e }, \ 1532 { 100, 165, 12, 0x0e }, \ 1533 { 36, 64, 13, 0x22 }, \ 1534 { 100, 165, 13, 0x42 }, \ 1535 { 36, 64, 22, 0x60 }, \ 1536 { 100, 165, 22, 0x40 }, \ 1537 { 36, 64, 23, 0x7f }, \ 1538 { 100, 153, 23, 0x3c }, \ 1539 { 155, 165, 23, 0x38 }, \ 1540 { 36, 50, 24, 0x09 }, \ 1541 { 52, 64, 24, 0x07 }, \ 1542 { 100, 153, 24, 0x06 }, \ 1543 { 155, 165, 24, 0x05 }, \ 1544 { 36, 64, 39, 0x1c }, \ 1545 { 100, 138, 39, 0x1a }, \ 1546 { 140, 165, 39, 0x18 }, \ 1547 { 36, 64, 43, 0x5b }, \ 1548 { 100, 138, 43, 0x3b }, \ 1549 { 140, 165, 43, 0x1b }, \ 1550 { 36, 64, 44, 0x40 }, \ 1551 { 100, 138, 44, 0x20 }, \ 1552 { 140, 165, 44, 0x10 }, \ 1553 { 36, 64, 46, 0x00 }, \ 1554 { 100, 138, 46, 0x18 }, \ 1555 { 140, 165, 46, 0x08 }, \ 1556 { 36, 64, 51, 0xfe }, \ 1557 { 100, 124, 51, 0xfc }, \ 1558 { 126, 165, 51, 0xec }, \ 1559 { 36, 64, 52, 0x0c }, \ 1560 { 100, 138, 52, 0x06 }, \ 1561 { 140, 165, 52, 0x06 }, \ 1562 { 36, 64, 54, 0xf8 }, \ 1563 { 100, 165, 54, 0xeb }, \ 1564 { 36, 50, 55, 0x06 }, \ 1565 { 52, 64, 55, 0x04 }, \ 1566 { 100, 138, 55, 0x01 }, \ 1567 { 140, 165, 55, 0x00 }, \ 1568 { 36, 50, 56, 0xd3 }, \ 1569 { 52, 128, 56, 0xbb }, \ 1570 { 130, 165, 56, 0xab }, \ 1571 { 36, 64, 58, 0x15 }, \ 1572 { 100, 116, 58, 0x1d }, \ 1573 { 118, 165, 58, 0x15 }, \ 1574 { 36, 64, 59, 0x7f }, \ 1575 { 100, 138, 59, 0x3f }, \ 1576 { 140, 165, 59, 0x7c }, \ 1577 { 36, 64, 62, 0x15 }, \ 1578 { 100, 116, 62, 0x1d }, \ 1579 { 118, 165, 62, 0x15 } 1580 1581union run_stats { 1582 uint32_t raw; 1583 struct { 1584 uint16_t fail; 1585 uint16_t pad; 1586 } error; 1587 struct { 1588 uint16_t success; 1589 uint16_t retry; 1590 } tx; 1591} __aligned(4); 1592 1593#endif /* _IF_RUNREG_H_ */ 1594