162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Definitions for RTL818x hardware 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2007 Michael Wu <flamingice@sourmilk.net> 662306a36Sopenharmony_ci * Copyright 2007 Andrea Merello <andrea.merello@gmail.com> 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Based on the r8187 driver, which is: 962306a36Sopenharmony_ci * Copyright 2005 Andrea Merello <andrea.merello@gmail.com>, et al. 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#ifndef RTL818X_H 1362306a36Sopenharmony_ci#define RTL818X_H 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cistruct rtl818x_csr { 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci u8 MAC[6]; 1862306a36Sopenharmony_ci u8 reserved_0[2]; 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci union { 2162306a36Sopenharmony_ci __le32 MAR[2]; /* 0x8 */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci struct{ /* rtl8187se */ 2462306a36Sopenharmony_ci u8 rf_sw_config; /* 0x8 */ 2562306a36Sopenharmony_ci u8 reserved_01[3]; 2662306a36Sopenharmony_ci __le32 TMGDA; /* 0xc */ 2762306a36Sopenharmony_ci } __packed; 2862306a36Sopenharmony_ci } __packed; 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci union { /* 0x10 */ 3162306a36Sopenharmony_ci struct { 3262306a36Sopenharmony_ci u8 RX_FIFO_COUNT; 3362306a36Sopenharmony_ci u8 reserved_1; 3462306a36Sopenharmony_ci u8 TX_FIFO_COUNT; 3562306a36Sopenharmony_ci u8 BQREQ; 3662306a36Sopenharmony_ci } __packed; 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci __le32 TBKDA; /* for 8187se */ 3962306a36Sopenharmony_ci } __packed; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci __le32 TBEDA; /* 0x14 - for rtl8187se */ 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci __le32 TSFT[2]; 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci union { /* 0x20 */ 4662306a36Sopenharmony_ci __le32 TLPDA; 4762306a36Sopenharmony_ci __le32 TVIDA; /* for 8187se */ 4862306a36Sopenharmony_ci } __packed; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci union { /* 0x24 */ 5162306a36Sopenharmony_ci __le32 TNPDA; 5262306a36Sopenharmony_ci __le32 TVODA; /* for 8187se */ 5362306a36Sopenharmony_ci } __packed; 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci /* hi pri ring for all cards */ 5662306a36Sopenharmony_ci __le32 THPDA; /* 0x28 */ 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci union { /* 0x2c */ 5962306a36Sopenharmony_ci struct { 6062306a36Sopenharmony_ci u8 reserved_2a; 6162306a36Sopenharmony_ci u8 EIFS_8187SE; 6262306a36Sopenharmony_ci } __packed; 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci __le16 BRSR; 6562306a36Sopenharmony_ci } __packed; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci u8 BSSID[6]; /* 0x2e */ 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci union { /* 0x34 */ 7062306a36Sopenharmony_ci struct { 7162306a36Sopenharmony_ci u8 RESP_RATE; 7262306a36Sopenharmony_ci u8 EIFS; 7362306a36Sopenharmony_ci } __packed; 7462306a36Sopenharmony_ci __le16 BRSR_8187SE; 7562306a36Sopenharmony_ci } __packed; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci u8 reserved_3[1]; /* 0x36 */ 7862306a36Sopenharmony_ci u8 CMD; /* 0x37 */ 7962306a36Sopenharmony_ci#define RTL818X_CMD_TX_ENABLE (1 << 2) 8062306a36Sopenharmony_ci#define RTL818X_CMD_RX_ENABLE (1 << 3) 8162306a36Sopenharmony_ci#define RTL818X_CMD_RESET (1 << 4) 8262306a36Sopenharmony_ci u8 reserved_4[4]; /* 0x38 */ 8362306a36Sopenharmony_ci union { 8462306a36Sopenharmony_ci struct { 8562306a36Sopenharmony_ci __le16 INT_MASK; 8662306a36Sopenharmony_ci __le16 INT_STATUS; 8762306a36Sopenharmony_ci } __packed; 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci __le32 INT_STATUS_SE; /* 0x3c */ 9062306a36Sopenharmony_ci } __packed; 9162306a36Sopenharmony_ci/* status bits for rtl8187 and rtl8180/8185 */ 9262306a36Sopenharmony_ci#define RTL818X_INT_RX_OK (1 << 0) 9362306a36Sopenharmony_ci#define RTL818X_INT_RX_ERR (1 << 1) 9462306a36Sopenharmony_ci#define RTL818X_INT_TXL_OK (1 << 2) 9562306a36Sopenharmony_ci#define RTL818X_INT_TXL_ERR (1 << 3) 9662306a36Sopenharmony_ci#define RTL818X_INT_RX_DU (1 << 4) 9762306a36Sopenharmony_ci#define RTL818X_INT_RX_FO (1 << 5) 9862306a36Sopenharmony_ci#define RTL818X_INT_TXN_OK (1 << 6) 9962306a36Sopenharmony_ci#define RTL818X_INT_TXN_ERR (1 << 7) 10062306a36Sopenharmony_ci#define RTL818X_INT_TXH_OK (1 << 8) 10162306a36Sopenharmony_ci#define RTL818X_INT_TXH_ERR (1 << 9) 10262306a36Sopenharmony_ci#define RTL818X_INT_TXB_OK (1 << 10) 10362306a36Sopenharmony_ci#define RTL818X_INT_TXB_ERR (1 << 11) 10462306a36Sopenharmony_ci#define RTL818X_INT_ATIM (1 << 12) 10562306a36Sopenharmony_ci#define RTL818X_INT_BEACON (1 << 13) 10662306a36Sopenharmony_ci#define RTL818X_INT_TIME_OUT (1 << 14) 10762306a36Sopenharmony_ci#define RTL818X_INT_TX_FO (1 << 15) 10862306a36Sopenharmony_ci/* status bits for rtl8187se */ 10962306a36Sopenharmony_ci#define RTL818X_INT_SE_TIMER3 (1 << 0) 11062306a36Sopenharmony_ci#define RTL818X_INT_SE_TIMER2 (1 << 1) 11162306a36Sopenharmony_ci#define RTL818X_INT_SE_RQ0SOR (1 << 2) 11262306a36Sopenharmony_ci#define RTL818X_INT_SE_TXBED_OK (1 << 3) 11362306a36Sopenharmony_ci#define RTL818X_INT_SE_TXBED_ERR (1 << 4) 11462306a36Sopenharmony_ci#define RTL818X_INT_SE_TXBE_OK (1 << 5) 11562306a36Sopenharmony_ci#define RTL818X_INT_SE_TXBE_ERR (1 << 6) 11662306a36Sopenharmony_ci#define RTL818X_INT_SE_RX_OK (1 << 7) 11762306a36Sopenharmony_ci#define RTL818X_INT_SE_RX_ERR (1 << 8) 11862306a36Sopenharmony_ci#define RTL818X_INT_SE_TXL_OK (1 << 9) 11962306a36Sopenharmony_ci#define RTL818X_INT_SE_TXL_ERR (1 << 10) 12062306a36Sopenharmony_ci#define RTL818X_INT_SE_RX_DU (1 << 11) 12162306a36Sopenharmony_ci#define RTL818X_INT_SE_RX_FIFO (1 << 12) 12262306a36Sopenharmony_ci#define RTL818X_INT_SE_TXN_OK (1 << 13) 12362306a36Sopenharmony_ci#define RTL818X_INT_SE_TXN_ERR (1 << 14) 12462306a36Sopenharmony_ci#define RTL818X_INT_SE_TXH_OK (1 << 15) 12562306a36Sopenharmony_ci#define RTL818X_INT_SE_TXH_ERR (1 << 16) 12662306a36Sopenharmony_ci#define RTL818X_INT_SE_TXB_OK (1 << 17) 12762306a36Sopenharmony_ci#define RTL818X_INT_SE_TXB_ERR (1 << 18) 12862306a36Sopenharmony_ci#define RTL818X_INT_SE_ATIM_TO (1 << 19) 12962306a36Sopenharmony_ci#define RTL818X_INT_SE_BK_TO (1 << 20) 13062306a36Sopenharmony_ci#define RTL818X_INT_SE_TIMER1 (1 << 21) 13162306a36Sopenharmony_ci#define RTL818X_INT_SE_TX_FIFO (1 << 22) 13262306a36Sopenharmony_ci#define RTL818X_INT_SE_WAKEUP (1 << 23) 13362306a36Sopenharmony_ci#define RTL818X_INT_SE_BK_DMA (1 << 24) 13462306a36Sopenharmony_ci#define RTL818X_INT_SE_TMGD_OK (1 << 30) 13562306a36Sopenharmony_ci __le32 TX_CONF; /* 0x40 */ 13662306a36Sopenharmony_ci#define RTL818X_TX_CONF_LOOPBACK_MAC (1 << 17) 13762306a36Sopenharmony_ci#define RTL818X_TX_CONF_LOOPBACK_CONT (3 << 17) 13862306a36Sopenharmony_ci#define RTL818X_TX_CONF_NO_ICV (1 << 19) 13962306a36Sopenharmony_ci#define RTL818X_TX_CONF_DISCW (1 << 20) 14062306a36Sopenharmony_ci#define RTL818X_TX_CONF_SAT_HWPLCP (1 << 24) 14162306a36Sopenharmony_ci#define RTL818X_TX_CONF_R8180_ABCD (2 << 25) 14262306a36Sopenharmony_ci#define RTL818X_TX_CONF_R8180_F (3 << 25) 14362306a36Sopenharmony_ci#define RTL818X_TX_CONF_R8185_ABC (4 << 25) 14462306a36Sopenharmony_ci#define RTL818X_TX_CONF_R8185_D (5 << 25) 14562306a36Sopenharmony_ci#define RTL818X_TX_CONF_R8187vD (5 << 25) 14662306a36Sopenharmony_ci#define RTL818X_TX_CONF_R8187vD_B (6 << 25) 14762306a36Sopenharmony_ci#define RTL818X_TX_CONF_RTL8187SE (6 << 25) 14862306a36Sopenharmony_ci#define RTL818X_TX_CONF_HWVER_MASK (7 << 25) 14962306a36Sopenharmony_ci#define RTL818X_TX_CONF_DISREQQSIZE (1 << 28) 15062306a36Sopenharmony_ci#define RTL818X_TX_CONF_PROBE_DTS (1 << 29) 15162306a36Sopenharmony_ci#define RTL818X_TX_CONF_HW_SEQNUM (1 << 30) 15262306a36Sopenharmony_ci#define RTL818X_TX_CONF_CW_MIN (1 << 31) 15362306a36Sopenharmony_ci __le32 RX_CONF; 15462306a36Sopenharmony_ci#define RTL818X_RX_CONF_MONITOR (1 << 0) 15562306a36Sopenharmony_ci#define RTL818X_RX_CONF_NICMAC (1 << 1) 15662306a36Sopenharmony_ci#define RTL818X_RX_CONF_MULTICAST (1 << 2) 15762306a36Sopenharmony_ci#define RTL818X_RX_CONF_BROADCAST (1 << 3) 15862306a36Sopenharmony_ci#define RTL818X_RX_CONF_FCS (1 << 5) 15962306a36Sopenharmony_ci#define RTL818X_RX_CONF_DATA (1 << 18) 16062306a36Sopenharmony_ci#define RTL818X_RX_CONF_CTRL (1 << 19) 16162306a36Sopenharmony_ci#define RTL818X_RX_CONF_MGMT (1 << 20) 16262306a36Sopenharmony_ci#define RTL818X_RX_CONF_ADDR3 (1 << 21) 16362306a36Sopenharmony_ci#define RTL818X_RX_CONF_PM (1 << 22) 16462306a36Sopenharmony_ci#define RTL818X_RX_CONF_BSSID (1 << 23) 16562306a36Sopenharmony_ci#define RTL818X_RX_CONF_RX_AUTORESETPHY (1 << 28) 16662306a36Sopenharmony_ci#define RTL818X_RX_CONF_CSDM1 (1 << 29) 16762306a36Sopenharmony_ci#define RTL818X_RX_CONF_CSDM2 (1 << 30) 16862306a36Sopenharmony_ci#define RTL818X_RX_CONF_ONLYERLPKT (1 << 31) 16962306a36Sopenharmony_ci __le32 INT_TIMEOUT; 17062306a36Sopenharmony_ci __le32 TBDA; 17162306a36Sopenharmony_ci u8 EEPROM_CMD; 17262306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_READ (1 << 0) 17362306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_WRITE (1 << 1) 17462306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_CK (1 << 2) 17562306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_CS (1 << 3) 17662306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_NORMAL (0 << 6) 17762306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_LOAD (1 << 6) 17862306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_PROGRAM (2 << 6) 17962306a36Sopenharmony_ci#define RTL818X_EEPROM_CMD_CONFIG (3 << 6) 18062306a36Sopenharmony_ci u8 CONFIG0; 18162306a36Sopenharmony_ci u8 CONFIG1; 18262306a36Sopenharmony_ci u8 CONFIG2; 18362306a36Sopenharmony_ci#define RTL818X_CONFIG2_ANTENNA_DIV (1 << 6) 18462306a36Sopenharmony_ci __le32 ANAPARAM; 18562306a36Sopenharmony_ci u8 MSR; 18662306a36Sopenharmony_ci#define RTL818X_MSR_NO_LINK (0 << 2) 18762306a36Sopenharmony_ci#define RTL818X_MSR_ADHOC (1 << 2) 18862306a36Sopenharmony_ci#define RTL818X_MSR_INFRA (2 << 2) 18962306a36Sopenharmony_ci#define RTL818X_MSR_MASTER (3 << 2) 19062306a36Sopenharmony_ci#define RTL818X_MSR_ENEDCA (4 << 2) 19162306a36Sopenharmony_ci u8 CONFIG3; 19262306a36Sopenharmony_ci#define RTL818X_CONFIG3_ANAPARAM_WRITE (1 << 6) 19362306a36Sopenharmony_ci#define RTL818X_CONFIG3_GNT_SELECT (1 << 7) 19462306a36Sopenharmony_ci u8 CONFIG4; 19562306a36Sopenharmony_ci#define RTL818X_CONFIG4_POWEROFF (1 << 6) 19662306a36Sopenharmony_ci#define RTL818X_CONFIG4_VCOOFF (1 << 7) 19762306a36Sopenharmony_ci u8 TESTR; 19862306a36Sopenharmony_ci u8 reserved_9[2]; 19962306a36Sopenharmony_ci u8 PGSELECT; 20062306a36Sopenharmony_ci u8 SECURITY; 20162306a36Sopenharmony_ci __le32 ANAPARAM2; 20262306a36Sopenharmony_ci u8 reserved_10[8]; 20362306a36Sopenharmony_ci __le32 IMR; /* 0x6c - Interrupt mask reg for 8187se */ 20462306a36Sopenharmony_ci#define IMR_TMGDOK ((1 << 30)) 20562306a36Sopenharmony_ci#define IMR_DOT11HINT ((1 << 25)) /* 802.11h Measurement Interrupt */ 20662306a36Sopenharmony_ci#define IMR_BCNDMAINT ((1 << 24)) /* Beacon DMA Interrupt */ 20762306a36Sopenharmony_ci#define IMR_WAKEINT ((1 << 23)) /* Wake Up Interrupt */ 20862306a36Sopenharmony_ci#define IMR_TXFOVW ((1 << 22)) /* Tx FIFO Overflow */ 20962306a36Sopenharmony_ci#define IMR_TIMEOUT1 ((1 << 21)) /* Time Out Interrupt 1 */ 21062306a36Sopenharmony_ci#define IMR_BCNINT ((1 << 20)) /* Beacon Time out */ 21162306a36Sopenharmony_ci#define IMR_ATIMINT ((1 << 19)) /* ATIM Time Out */ 21262306a36Sopenharmony_ci#define IMR_TBDER ((1 << 18)) /* Tx Beacon Descriptor Error */ 21362306a36Sopenharmony_ci#define IMR_TBDOK ((1 << 17)) /* Tx Beacon Descriptor OK */ 21462306a36Sopenharmony_ci#define IMR_THPDER ((1 << 16)) /* Tx High Priority Descriptor Error */ 21562306a36Sopenharmony_ci#define IMR_THPDOK ((1 << 15)) /* Tx High Priority Descriptor OK */ 21662306a36Sopenharmony_ci#define IMR_TVODER ((1 << 14)) /* Tx AC_VO Descriptor Error Int */ 21762306a36Sopenharmony_ci#define IMR_TVODOK ((1 << 13)) /* Tx AC_VO Descriptor OK Interrupt */ 21862306a36Sopenharmony_ci#define IMR_FOVW ((1 << 12)) /* Rx FIFO Overflow Interrupt */ 21962306a36Sopenharmony_ci#define IMR_RDU ((1 << 11)) /* Rx Descriptor Unavailable */ 22062306a36Sopenharmony_ci#define IMR_TVIDER ((1 << 10)) /* Tx AC_VI Descriptor Error */ 22162306a36Sopenharmony_ci#define IMR_TVIDOK ((1 << 9)) /* Tx AC_VI Descriptor OK Interrupt */ 22262306a36Sopenharmony_ci#define IMR_RER ((1 << 8)) /* Rx Error Interrupt */ 22362306a36Sopenharmony_ci#define IMR_ROK ((1 << 7)) /* Receive OK Interrupt */ 22462306a36Sopenharmony_ci#define IMR_TBEDER ((1 << 6)) /* Tx AC_BE Descriptor Error */ 22562306a36Sopenharmony_ci#define IMR_TBEDOK ((1 << 5)) /* Tx AC_BE Descriptor OK */ 22662306a36Sopenharmony_ci#define IMR_TBKDER ((1 << 4)) /* Tx AC_BK Descriptor Error */ 22762306a36Sopenharmony_ci#define IMR_TBKDOK ((1 << 3)) /* Tx AC_BK Descriptor OK */ 22862306a36Sopenharmony_ci#define IMR_RQOSOK ((1 << 2)) /* Rx QoS OK Interrupt */ 22962306a36Sopenharmony_ci#define IMR_TIMEOUT2 ((1 << 1)) /* Time Out Interrupt 2 */ 23062306a36Sopenharmony_ci#define IMR_TIMEOUT3 ((1 << 0)) /* Time Out Interrupt 3 */ 23162306a36Sopenharmony_ci __le16 BEACON_INTERVAL; /* 0x70 */ 23262306a36Sopenharmony_ci __le16 ATIM_WND; /* 0x72 */ 23362306a36Sopenharmony_ci __le16 BEACON_INTERVAL_TIME; /* 0x74 */ 23462306a36Sopenharmony_ci __le16 ATIMTR_INTERVAL; /* 0x76 */ 23562306a36Sopenharmony_ci u8 PHY_DELAY; /* 0x78 */ 23662306a36Sopenharmony_ci u8 CARRIER_SENSE_COUNTER; /* 0x79 */ 23762306a36Sopenharmony_ci u8 reserved_11[2]; /* 0x7a */ 23862306a36Sopenharmony_ci u8 PHY[4]; /* 0x7c */ 23962306a36Sopenharmony_ci __le16 RFPinsOutput; /* 0x80 */ 24062306a36Sopenharmony_ci __le16 RFPinsEnable; /* 0x82 */ 24162306a36Sopenharmony_ci __le16 RFPinsSelect; /* 0x84 */ 24262306a36Sopenharmony_ci __le16 RFPinsInput; /* 0x86 */ 24362306a36Sopenharmony_ci __le32 RF_PARA; /* 0x88 */ 24462306a36Sopenharmony_ci __le32 RF_TIMING; /* 0x8c */ 24562306a36Sopenharmony_ci u8 GP_ENABLE; /* 0x90 */ 24662306a36Sopenharmony_ci u8 GPIO0; /* 0x91 */ 24762306a36Sopenharmony_ci u8 GPIO1; /* 0x92 */ 24862306a36Sopenharmony_ci u8 TPPOLL_STOP; /* 0x93 - rtl8187se only */ 24962306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_BQ (1 << 7) 25062306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_VI (1 << 4) 25162306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_VO (1 << 5) 25262306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_BE (1 << 3) 25362306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_BK (1 << 2) 25462306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_MG (1 << 1) 25562306a36Sopenharmony_ci#define RTL818x_TPPOLL_STOP_HI (1 << 6) 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci __le32 HSSI_PARA; /* 0x94 */ 25862306a36Sopenharmony_ci u8 reserved_13[4]; /* 0x98 */ 25962306a36Sopenharmony_ci u8 TX_AGC_CTL; /* 0x9c */ 26062306a36Sopenharmony_ci#define RTL818X_TX_AGC_CTL_PERPACKET_GAIN (1 << 0) 26162306a36Sopenharmony_ci#define RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL (1 << 1) 26262306a36Sopenharmony_ci#define RTL818X_TX_AGC_CTL_FEEDBACK_ANT (1 << 2) 26362306a36Sopenharmony_ci u8 TX_GAIN_CCK; 26462306a36Sopenharmony_ci u8 TX_GAIN_OFDM; 26562306a36Sopenharmony_ci u8 TX_ANTENNA; 26662306a36Sopenharmony_ci u8 reserved_14[16]; 26762306a36Sopenharmony_ci u8 WPA_CONF; 26862306a36Sopenharmony_ci u8 reserved_15[3]; 26962306a36Sopenharmony_ci u8 SIFS; 27062306a36Sopenharmony_ci u8 DIFS; 27162306a36Sopenharmony_ci u8 SLOT; 27262306a36Sopenharmony_ci u8 reserved_16[5]; 27362306a36Sopenharmony_ci u8 CW_CONF; 27462306a36Sopenharmony_ci#define RTL818X_CW_CONF_PERPACKET_CW (1 << 0) 27562306a36Sopenharmony_ci#define RTL818X_CW_CONF_PERPACKET_RETRY (1 << 1) 27662306a36Sopenharmony_ci u8 CW_VAL; 27762306a36Sopenharmony_ci u8 RATE_FALLBACK; 27862306a36Sopenharmony_ci#define RTL818X_RATE_FALLBACK_ENABLE (1 << 7) 27962306a36Sopenharmony_ci u8 ACM_CONTROL; 28062306a36Sopenharmony_ci u8 reserved_17[24]; 28162306a36Sopenharmony_ci u8 CONFIG5; 28262306a36Sopenharmony_ci u8 TX_DMA_POLLING; 28362306a36Sopenharmony_ci u8 PHY_PR; 28462306a36Sopenharmony_ci u8 reserved_18; 28562306a36Sopenharmony_ci __le16 CWR; 28662306a36Sopenharmony_ci u8 RETRY_CTR; 28762306a36Sopenharmony_ci u8 reserved_19[3]; 28862306a36Sopenharmony_ci __le16 INT_MIG; 28962306a36Sopenharmony_ci/* RTL818X_R8187B_*: magic numbers from ioregisters */ 29062306a36Sopenharmony_ci#define RTL818X_R8187B_B 0 29162306a36Sopenharmony_ci#define RTL818X_R8187B_D 1 29262306a36Sopenharmony_ci#define RTL818X_R8187B_E 2 29362306a36Sopenharmony_ci __le32 RDSAR; 29462306a36Sopenharmony_ci __le16 TID_AC_MAP; 29562306a36Sopenharmony_ci u8 reserved_20[4]; 29662306a36Sopenharmony_ci union { 29762306a36Sopenharmony_ci __le16 ANAPARAM3; /* 0xee */ 29862306a36Sopenharmony_ci u8 ANAPARAM3A; /* for rtl8187 */ 29962306a36Sopenharmony_ci }; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci#define AC_PARAM_TXOP_LIMIT_SHIFT 16 30262306a36Sopenharmony_ci#define AC_PARAM_ECW_MAX_SHIFT 12 30362306a36Sopenharmony_ci#define AC_PARAM_ECW_MIN_SHIFT 8 30462306a36Sopenharmony_ci#define AC_PARAM_AIFS_SHIFT 0 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci __le32 AC_VO_PARAM; /* 0xf0 */ 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci union { /* 0xf4 */ 30962306a36Sopenharmony_ci __le32 AC_VI_PARAM; 31062306a36Sopenharmony_ci __le16 FEMR; 31162306a36Sopenharmony_ci } __packed; 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci union{ /* 0xf8 */ 31462306a36Sopenharmony_ci __le32 AC_BE_PARAM; /* rtl8187se */ 31562306a36Sopenharmony_ci struct{ 31662306a36Sopenharmony_ci u8 reserved_21[2]; 31762306a36Sopenharmony_ci __le16 TALLY_CNT; /* 0xfa */ 31862306a36Sopenharmony_ci } __packed; 31962306a36Sopenharmony_ci } __packed; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci union { 32262306a36Sopenharmony_ci u8 TALLY_SEL; /* 0xfc */ 32362306a36Sopenharmony_ci __le32 AC_BK_PARAM; 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci } __packed; 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci} __packed; 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci/* These are addresses with NON-standard usage. 33062306a36Sopenharmony_ci * They have offsets very far from this struct. 33162306a36Sopenharmony_ci * I don't like to introduce a ton of "reserved".. 33262306a36Sopenharmony_ci * They are for RTL8187SE 33362306a36Sopenharmony_ci */ 33462306a36Sopenharmony_ci#define REG_ADDR1(addr) ((u8 __iomem *)priv->map + (addr)) 33562306a36Sopenharmony_ci#define REG_ADDR2(addr) ((__le16 __iomem *)priv->map + ((addr) >> 1)) 33662306a36Sopenharmony_ci#define REG_ADDR4(addr) ((__le32 __iomem *)priv->map + ((addr) >> 2)) 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci#define FEMR_SE REG_ADDR2(0x1D4) 33962306a36Sopenharmony_ci#define ARFR REG_ADDR2(0x1E0) 34062306a36Sopenharmony_ci#define RFSW_CTRL REG_ADDR2(0x272) 34162306a36Sopenharmony_ci#define SW_3W_DB0 REG_ADDR2(0x274) 34262306a36Sopenharmony_ci#define SW_3W_DB0_4 REG_ADDR4(0x274) 34362306a36Sopenharmony_ci#define SW_3W_DB1 REG_ADDR2(0x278) 34462306a36Sopenharmony_ci#define SW_3W_DB1_4 REG_ADDR4(0x278) 34562306a36Sopenharmony_ci#define SW_3W_CMD1 REG_ADDR1(0x27D) 34662306a36Sopenharmony_ci#define PI_DATA_REG REG_ADDR2(0x360) 34762306a36Sopenharmony_ci#define SI_DATA_REG REG_ADDR2(0x362) 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_cistruct rtl818x_rf_ops { 35062306a36Sopenharmony_ci char *name; 35162306a36Sopenharmony_ci void (*init)(struct ieee80211_hw *); 35262306a36Sopenharmony_ci void (*stop)(struct ieee80211_hw *); 35362306a36Sopenharmony_ci void (*set_chan)(struct ieee80211_hw *, struct ieee80211_conf *); 35462306a36Sopenharmony_ci u8 (*calc_rssi)(u8 agc, u8 sq); 35562306a36Sopenharmony_ci}; 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci/** 35862306a36Sopenharmony_ci * enum rtl818x_tx_desc_flags - Tx/Rx flags are common between RTL818X chips 35962306a36Sopenharmony_ci * 36062306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_NO_ENC: Disable hardware based encryption. 36162306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_TX_OK: TX frame was ACKed. 36262306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_SPLCP: Use short preamble. 36362306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_MOREFRAG: More fragments follow. 36462306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_CTS: Use CTS-to-self protection. 36562306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_RTS: Use RTS/CTS protection. 36662306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_LS: Last segment of the frame. 36762306a36Sopenharmony_ci * @RTL818X_TX_DESC_FLAG_FS: First segment of the frame. 36862306a36Sopenharmony_ci */ 36962306a36Sopenharmony_cienum rtl818x_tx_desc_flags { 37062306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_NO_ENC = (1 << 15), 37162306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_TX_OK = (1 << 15), 37262306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_SPLCP = (1 << 16), 37362306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_RX_UNDER = (1 << 16), 37462306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_MOREFRAG = (1 << 17), 37562306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_CTS = (1 << 18), 37662306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_RTS = (1 << 23), 37762306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_LS = (1 << 28), 37862306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_FS = (1 << 29), 37962306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_DMA = (1 << 30), 38062306a36Sopenharmony_ci RTL818X_TX_DESC_FLAG_OWN = (1 << 31) 38162306a36Sopenharmony_ci}; 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_cienum rtl818x_rx_desc_flags { 38462306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_ICV_ERR = (1 << 12), 38562306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_CRC32_ERR = (1 << 13), 38662306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_PM = (1 << 14), 38762306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_RX_ERR = (1 << 15), 38862306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_BCAST = (1 << 16), 38962306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_PAM = (1 << 17), 39062306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_MCAST = (1 << 18), 39162306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_QOS = (1 << 19), /* RTL8187(B) only */ 39262306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_TRSW = (1 << 24), /* RTL8187(B) only */ 39362306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_SPLCP = (1 << 25), 39462306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_FOF = (1 << 26), 39562306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_DMA_FAIL = (1 << 27), 39662306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_LS = (1 << 28), 39762306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_FS = (1 << 29), 39862306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_EOR = (1 << 30), 39962306a36Sopenharmony_ci RTL818X_RX_DESC_FLAG_OWN = (1 << 31) 40062306a36Sopenharmony_ci}; 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci#endif /* RTL818X_H */ 403