162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> 462306a36Sopenharmony_ci <http://rt2x00.serialmonkey.com> 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci/* 962306a36Sopenharmony_ci Module: rt73usb 1062306a36Sopenharmony_ci Abstract: Data structures and registers for the rt73usb module. 1162306a36Sopenharmony_ci Supported chipsets: rt2571W & rt2671. 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#ifndef RT73USB_H 1562306a36Sopenharmony_ci#define RT73USB_H 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci/* 1862306a36Sopenharmony_ci * RF chip defines. 1962306a36Sopenharmony_ci */ 2062306a36Sopenharmony_ci#define RF5226 0x0001 2162306a36Sopenharmony_ci#define RF2528 0x0002 2262306a36Sopenharmony_ci#define RF5225 0x0003 2362306a36Sopenharmony_ci#define RF2527 0x0004 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* 2662306a36Sopenharmony_ci * Signal information. 2762306a36Sopenharmony_ci * Default offset is required for RSSI <-> dBm conversion. 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_ci#define DEFAULT_RSSI_OFFSET 120 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci/* 3262306a36Sopenharmony_ci * Register layout information. 3362306a36Sopenharmony_ci */ 3462306a36Sopenharmony_ci#define CSR_REG_BASE 0x3000 3562306a36Sopenharmony_ci#define CSR_REG_SIZE 0x04b0 3662306a36Sopenharmony_ci#define EEPROM_BASE 0x0000 3762306a36Sopenharmony_ci#define EEPROM_SIZE 0x0100 3862306a36Sopenharmony_ci#define BBP_BASE 0x0000 3962306a36Sopenharmony_ci#define BBP_SIZE 0x0080 4062306a36Sopenharmony_ci#define RF_BASE 0x0004 4162306a36Sopenharmony_ci#define RF_SIZE 0x0010 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* 4462306a36Sopenharmony_ci * Number of TX queues. 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ci#define NUM_TX_QUEUES 4 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* 4962306a36Sopenharmony_ci * USB registers. 5062306a36Sopenharmony_ci */ 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* 5362306a36Sopenharmony_ci * MCU_LEDCS: LED control for MCU Mailbox. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci#define MCU_LEDCS_LED_MODE FIELD16(0x001f) 5662306a36Sopenharmony_ci#define MCU_LEDCS_RADIO_STATUS FIELD16(0x0020) 5762306a36Sopenharmony_ci#define MCU_LEDCS_LINK_BG_STATUS FIELD16(0x0040) 5862306a36Sopenharmony_ci#define MCU_LEDCS_LINK_A_STATUS FIELD16(0x0080) 5962306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_0 FIELD16(0x0100) 6062306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_1 FIELD16(0x0200) 6162306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_2 FIELD16(0x0400) 6262306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_3 FIELD16(0x0800) 6362306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_GPIO_4 FIELD16(0x1000) 6462306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_ACT FIELD16(0x2000) 6562306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_READY_BG FIELD16(0x4000) 6662306a36Sopenharmony_ci#define MCU_LEDCS_POLARITY_READY_A FIELD16(0x8000) 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci/* 6962306a36Sopenharmony_ci * 8051 firmware image. 7062306a36Sopenharmony_ci */ 7162306a36Sopenharmony_ci#define FIRMWARE_RT2571 "rt73.bin" 7262306a36Sopenharmony_ci#define FIRMWARE_IMAGE_BASE 0x0800 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* 7562306a36Sopenharmony_ci * Security key table memory. 7662306a36Sopenharmony_ci * 16 entries 32-byte for shared key table 7762306a36Sopenharmony_ci * 64 entries 32-byte for pairwise key table 7862306a36Sopenharmony_ci * 64 entries 8-byte for pairwise ta key table 7962306a36Sopenharmony_ci */ 8062306a36Sopenharmony_ci#define SHARED_KEY_TABLE_BASE 0x1000 8162306a36Sopenharmony_ci#define PAIRWISE_KEY_TABLE_BASE 0x1200 8262306a36Sopenharmony_ci#define PAIRWISE_TA_TABLE_BASE 0x1a00 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define SHARED_KEY_ENTRY(__idx) \ 8562306a36Sopenharmony_ci ( SHARED_KEY_TABLE_BASE + \ 8662306a36Sopenharmony_ci ((__idx) * sizeof(struct hw_key_entry)) ) 8762306a36Sopenharmony_ci#define PAIRWISE_KEY_ENTRY(__idx) \ 8862306a36Sopenharmony_ci ( PAIRWISE_KEY_TABLE_BASE + \ 8962306a36Sopenharmony_ci ((__idx) * sizeof(struct hw_key_entry)) ) 9062306a36Sopenharmony_ci#define PAIRWISE_TA_ENTRY(__idx) \ 9162306a36Sopenharmony_ci ( PAIRWISE_TA_TABLE_BASE + \ 9262306a36Sopenharmony_ci ((__idx) * sizeof(struct hw_pairwise_ta_entry)) ) 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_cistruct hw_key_entry { 9562306a36Sopenharmony_ci u8 key[16]; 9662306a36Sopenharmony_ci u8 tx_mic[8]; 9762306a36Sopenharmony_ci u8 rx_mic[8]; 9862306a36Sopenharmony_ci} __packed; 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_cistruct hw_pairwise_ta_entry { 10162306a36Sopenharmony_ci u8 address[6]; 10262306a36Sopenharmony_ci u8 cipher; 10362306a36Sopenharmony_ci u8 reserved; 10462306a36Sopenharmony_ci} __packed; 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* 10762306a36Sopenharmony_ci * Since NULL frame won't be that long (256 byte), 10862306a36Sopenharmony_ci * We steal 16 tail bytes to save debugging settings. 10962306a36Sopenharmony_ci */ 11062306a36Sopenharmony_ci#define HW_DEBUG_SETTING_BASE 0x2bf0 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci/* 11362306a36Sopenharmony_ci * On-chip BEACON frame space. 11462306a36Sopenharmony_ci */ 11562306a36Sopenharmony_ci#define HW_BEACON_BASE0 0x2400 11662306a36Sopenharmony_ci#define HW_BEACON_BASE1 0x2500 11762306a36Sopenharmony_ci#define HW_BEACON_BASE2 0x2600 11862306a36Sopenharmony_ci#define HW_BEACON_BASE3 0x2700 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define HW_BEACON_OFFSET(__index) \ 12162306a36Sopenharmony_ci ( HW_BEACON_BASE0 + (__index * 0x0100) ) 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* 12462306a36Sopenharmony_ci * MAC Control/Status Registers(CSR). 12562306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us. 12662306a36Sopenharmony_ci */ 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci/* 12962306a36Sopenharmony_ci * MAC_CSR0: ASIC revision number. 13062306a36Sopenharmony_ci */ 13162306a36Sopenharmony_ci#define MAC_CSR0 0x3000 13262306a36Sopenharmony_ci#define MAC_CSR0_REVISION FIELD32(0x0000000f) 13362306a36Sopenharmony_ci#define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci/* 13662306a36Sopenharmony_ci * MAC_CSR1: System control register. 13762306a36Sopenharmony_ci * SOFT_RESET: Software reset bit, 1: reset, 0: normal. 13862306a36Sopenharmony_ci * BBP_RESET: Hardware reset BBP. 13962306a36Sopenharmony_ci * HOST_READY: Host is ready after initialization, 1: ready. 14062306a36Sopenharmony_ci */ 14162306a36Sopenharmony_ci#define MAC_CSR1 0x3004 14262306a36Sopenharmony_ci#define MAC_CSR1_SOFT_RESET FIELD32(0x00000001) 14362306a36Sopenharmony_ci#define MAC_CSR1_BBP_RESET FIELD32(0x00000002) 14462306a36Sopenharmony_ci#define MAC_CSR1_HOST_READY FIELD32(0x00000004) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci/* 14762306a36Sopenharmony_ci * MAC_CSR2: STA MAC register 0. 14862306a36Sopenharmony_ci */ 14962306a36Sopenharmony_ci#define MAC_CSR2 0x3008 15062306a36Sopenharmony_ci#define MAC_CSR2_BYTE0 FIELD32(0x000000ff) 15162306a36Sopenharmony_ci#define MAC_CSR2_BYTE1 FIELD32(0x0000ff00) 15262306a36Sopenharmony_ci#define MAC_CSR2_BYTE2 FIELD32(0x00ff0000) 15362306a36Sopenharmony_ci#define MAC_CSR2_BYTE3 FIELD32(0xff000000) 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci/* 15662306a36Sopenharmony_ci * MAC_CSR3: STA MAC register 1. 15762306a36Sopenharmony_ci * UNICAST_TO_ME_MASK: 15862306a36Sopenharmony_ci * Used to mask off bits from byte 5 of the MAC address 15962306a36Sopenharmony_ci * to determine the UNICAST_TO_ME bit for RX frames. 16062306a36Sopenharmony_ci * The full mask is complemented by BSS_ID_MASK: 16162306a36Sopenharmony_ci * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK 16262306a36Sopenharmony_ci */ 16362306a36Sopenharmony_ci#define MAC_CSR3 0x300c 16462306a36Sopenharmony_ci#define MAC_CSR3_BYTE4 FIELD32(0x000000ff) 16562306a36Sopenharmony_ci#define MAC_CSR3_BYTE5 FIELD32(0x0000ff00) 16662306a36Sopenharmony_ci#define MAC_CSR3_UNICAST_TO_ME_MASK FIELD32(0x00ff0000) 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* 16962306a36Sopenharmony_ci * MAC_CSR4: BSSID register 0. 17062306a36Sopenharmony_ci */ 17162306a36Sopenharmony_ci#define MAC_CSR4 0x3010 17262306a36Sopenharmony_ci#define MAC_CSR4_BYTE0 FIELD32(0x000000ff) 17362306a36Sopenharmony_ci#define MAC_CSR4_BYTE1 FIELD32(0x0000ff00) 17462306a36Sopenharmony_ci#define MAC_CSR4_BYTE2 FIELD32(0x00ff0000) 17562306a36Sopenharmony_ci#define MAC_CSR4_BYTE3 FIELD32(0xff000000) 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* 17862306a36Sopenharmony_ci * MAC_CSR5: BSSID register 1. 17962306a36Sopenharmony_ci * BSS_ID_MASK: 18062306a36Sopenharmony_ci * This mask is used to mask off bits 0 and 1 of byte 5 of the 18162306a36Sopenharmony_ci * BSSID. This will make sure that those bits will be ignored 18262306a36Sopenharmony_ci * when determining the MY_BSS of RX frames. 18362306a36Sopenharmony_ci * 0: 1-BSSID mode (BSS index = 0) 18462306a36Sopenharmony_ci * 1: 2-BSSID mode (BSS index: Byte5, bit 0) 18562306a36Sopenharmony_ci * 2: 2-BSSID mode (BSS index: byte5, bit 1) 18662306a36Sopenharmony_ci * 3: 4-BSSID mode (BSS index: byte5, bit 0 - 1) 18762306a36Sopenharmony_ci */ 18862306a36Sopenharmony_ci#define MAC_CSR5 0x3014 18962306a36Sopenharmony_ci#define MAC_CSR5_BYTE4 FIELD32(0x000000ff) 19062306a36Sopenharmony_ci#define MAC_CSR5_BYTE5 FIELD32(0x0000ff00) 19162306a36Sopenharmony_ci#define MAC_CSR5_BSS_ID_MASK FIELD32(0x00ff0000) 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci/* 19462306a36Sopenharmony_ci * MAC_CSR6: Maximum frame length register. 19562306a36Sopenharmony_ci */ 19662306a36Sopenharmony_ci#define MAC_CSR6 0x3018 19762306a36Sopenharmony_ci#define MAC_CSR6_MAX_FRAME_UNIT FIELD32(0x00000fff) 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci/* 20062306a36Sopenharmony_ci * MAC_CSR7: Reserved 20162306a36Sopenharmony_ci */ 20262306a36Sopenharmony_ci#define MAC_CSR7 0x301c 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* 20562306a36Sopenharmony_ci * MAC_CSR8: SIFS/EIFS register. 20662306a36Sopenharmony_ci * All units are in US. 20762306a36Sopenharmony_ci */ 20862306a36Sopenharmony_ci#define MAC_CSR8 0x3020 20962306a36Sopenharmony_ci#define MAC_CSR8_SIFS FIELD32(0x000000ff) 21062306a36Sopenharmony_ci#define MAC_CSR8_SIFS_AFTER_RX_OFDM FIELD32(0x0000ff00) 21162306a36Sopenharmony_ci#define MAC_CSR8_EIFS FIELD32(0xffff0000) 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci/* 21462306a36Sopenharmony_ci * MAC_CSR9: Back-Off control register. 21562306a36Sopenharmony_ci * SLOT_TIME: Slot time, default is 20us for 802.11BG. 21662306a36Sopenharmony_ci * CWMIN: Bit for Cwmin. default Cwmin is 31 (2^5 - 1). 21762306a36Sopenharmony_ci * CWMAX: Bit for Cwmax, default Cwmax is 1023 (2^10 - 1). 21862306a36Sopenharmony_ci * CW_SELECT: 1: CWmin/Cwmax select from register, 0:select from TxD. 21962306a36Sopenharmony_ci */ 22062306a36Sopenharmony_ci#define MAC_CSR9 0x3024 22162306a36Sopenharmony_ci#define MAC_CSR9_SLOT_TIME FIELD32(0x000000ff) 22262306a36Sopenharmony_ci#define MAC_CSR9_CWMIN FIELD32(0x00000f00) 22362306a36Sopenharmony_ci#define MAC_CSR9_CWMAX FIELD32(0x0000f000) 22462306a36Sopenharmony_ci#define MAC_CSR9_CW_SELECT FIELD32(0x00010000) 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci/* 22762306a36Sopenharmony_ci * MAC_CSR10: Power state configuration. 22862306a36Sopenharmony_ci */ 22962306a36Sopenharmony_ci#define MAC_CSR10 0x3028 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci/* 23262306a36Sopenharmony_ci * MAC_CSR11: Power saving transition time register. 23362306a36Sopenharmony_ci * DELAY_AFTER_TBCN: Delay after Tbcn expired in units of TU. 23462306a36Sopenharmony_ci * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup. 23562306a36Sopenharmony_ci * WAKEUP_LATENCY: In unit of TU. 23662306a36Sopenharmony_ci */ 23762306a36Sopenharmony_ci#define MAC_CSR11 0x302c 23862306a36Sopenharmony_ci#define MAC_CSR11_DELAY_AFTER_TBCN FIELD32(0x000000ff) 23962306a36Sopenharmony_ci#define MAC_CSR11_TBCN_BEFORE_WAKEUP FIELD32(0x00007f00) 24062306a36Sopenharmony_ci#define MAC_CSR11_AUTOWAKE FIELD32(0x00008000) 24162306a36Sopenharmony_ci#define MAC_CSR11_WAKEUP_LATENCY FIELD32(0x000f0000) 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci/* 24462306a36Sopenharmony_ci * MAC_CSR12: Manual power control / status register (merge CSR20 & PWRCSR1). 24562306a36Sopenharmony_ci * CURRENT_STATE: 0:sleep, 1:awake. 24662306a36Sopenharmony_ci * FORCE_WAKEUP: This has higher priority than PUT_TO_SLEEP. 24762306a36Sopenharmony_ci * BBP_CURRENT_STATE: 0: BBP sleep, 1: BBP awake. 24862306a36Sopenharmony_ci */ 24962306a36Sopenharmony_ci#define MAC_CSR12 0x3030 25062306a36Sopenharmony_ci#define MAC_CSR12_CURRENT_STATE FIELD32(0x00000001) 25162306a36Sopenharmony_ci#define MAC_CSR12_PUT_TO_SLEEP FIELD32(0x00000002) 25262306a36Sopenharmony_ci#define MAC_CSR12_FORCE_WAKEUP FIELD32(0x00000004) 25362306a36Sopenharmony_ci#define MAC_CSR12_BBP_CURRENT_STATE FIELD32(0x00000008) 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci/* 25662306a36Sopenharmony_ci * MAC_CSR13: GPIO. 25762306a36Sopenharmony_ci * MAC_CSR13_VALx: GPIO value 25862306a36Sopenharmony_ci * MAC_CSR13_DIRx: GPIO direction: 0 = input; 1 = output 25962306a36Sopenharmony_ci */ 26062306a36Sopenharmony_ci#define MAC_CSR13 0x3034 26162306a36Sopenharmony_ci#define MAC_CSR13_VAL0 FIELD32(0x00000001) 26262306a36Sopenharmony_ci#define MAC_CSR13_VAL1 FIELD32(0x00000002) 26362306a36Sopenharmony_ci#define MAC_CSR13_VAL2 FIELD32(0x00000004) 26462306a36Sopenharmony_ci#define MAC_CSR13_VAL3 FIELD32(0x00000008) 26562306a36Sopenharmony_ci#define MAC_CSR13_VAL4 FIELD32(0x00000010) 26662306a36Sopenharmony_ci#define MAC_CSR13_VAL5 FIELD32(0x00000020) 26762306a36Sopenharmony_ci#define MAC_CSR13_VAL6 FIELD32(0x00000040) 26862306a36Sopenharmony_ci#define MAC_CSR13_VAL7 FIELD32(0x00000080) 26962306a36Sopenharmony_ci#define MAC_CSR13_DIR0 FIELD32(0x00000100) 27062306a36Sopenharmony_ci#define MAC_CSR13_DIR1 FIELD32(0x00000200) 27162306a36Sopenharmony_ci#define MAC_CSR13_DIR2 FIELD32(0x00000400) 27262306a36Sopenharmony_ci#define MAC_CSR13_DIR3 FIELD32(0x00000800) 27362306a36Sopenharmony_ci#define MAC_CSR13_DIR4 FIELD32(0x00001000) 27462306a36Sopenharmony_ci#define MAC_CSR13_DIR5 FIELD32(0x00002000) 27562306a36Sopenharmony_ci#define MAC_CSR13_DIR6 FIELD32(0x00004000) 27662306a36Sopenharmony_ci#define MAC_CSR13_DIR7 FIELD32(0x00008000) 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ci/* 27962306a36Sopenharmony_ci * MAC_CSR14: LED control register. 28062306a36Sopenharmony_ci * ON_PERIOD: On period, default 70ms. 28162306a36Sopenharmony_ci * OFF_PERIOD: Off period, default 30ms. 28262306a36Sopenharmony_ci * HW_LED: HW TX activity, 1: normal OFF, 0: normal ON. 28362306a36Sopenharmony_ci * SW_LED: s/w LED, 1: ON, 0: OFF. 28462306a36Sopenharmony_ci * HW_LED_POLARITY: 0: active low, 1: active high. 28562306a36Sopenharmony_ci */ 28662306a36Sopenharmony_ci#define MAC_CSR14 0x3038 28762306a36Sopenharmony_ci#define MAC_CSR14_ON_PERIOD FIELD32(0x000000ff) 28862306a36Sopenharmony_ci#define MAC_CSR14_OFF_PERIOD FIELD32(0x0000ff00) 28962306a36Sopenharmony_ci#define MAC_CSR14_HW_LED FIELD32(0x00010000) 29062306a36Sopenharmony_ci#define MAC_CSR14_SW_LED FIELD32(0x00020000) 29162306a36Sopenharmony_ci#define MAC_CSR14_HW_LED_POLARITY FIELD32(0x00040000) 29262306a36Sopenharmony_ci#define MAC_CSR14_SW_LED2 FIELD32(0x00080000) 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci/* 29562306a36Sopenharmony_ci * MAC_CSR15: NAV control. 29662306a36Sopenharmony_ci */ 29762306a36Sopenharmony_ci#define MAC_CSR15 0x303c 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ci/* 30062306a36Sopenharmony_ci * TXRX control registers. 30162306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us. 30262306a36Sopenharmony_ci */ 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_ci/* 30562306a36Sopenharmony_ci * TXRX_CSR0: TX/RX configuration register. 30662306a36Sopenharmony_ci * TSF_OFFSET: Default is 24. 30762306a36Sopenharmony_ci * AUTO_TX_SEQ: 1: ASIC auto replace sequence nr in outgoing frame. 30862306a36Sopenharmony_ci * DISABLE_RX: Disable Rx engine. 30962306a36Sopenharmony_ci * DROP_CRC: Drop CRC error. 31062306a36Sopenharmony_ci * DROP_PHYSICAL: Drop physical error. 31162306a36Sopenharmony_ci * DROP_CONTROL: Drop control frame. 31262306a36Sopenharmony_ci * DROP_NOT_TO_ME: Drop not to me unicast frame. 31362306a36Sopenharmony_ci * DROP_TO_DS: Drop fram ToDs bit is true. 31462306a36Sopenharmony_ci * DROP_VERSION_ERROR: Drop version error frame. 31562306a36Sopenharmony_ci * DROP_MULTICAST: Drop multicast frames. 31662306a36Sopenharmony_ci * DROP_BORADCAST: Drop broadcast frames. 31762306a36Sopenharmony_ci * DROP_ACK_CTS: Drop received ACK and CTS. 31862306a36Sopenharmony_ci */ 31962306a36Sopenharmony_ci#define TXRX_CSR0 0x3040 32062306a36Sopenharmony_ci#define TXRX_CSR0_RX_ACK_TIMEOUT FIELD32(0x000001ff) 32162306a36Sopenharmony_ci#define TXRX_CSR0_TSF_OFFSET FIELD32(0x00007e00) 32262306a36Sopenharmony_ci#define TXRX_CSR0_AUTO_TX_SEQ FIELD32(0x00008000) 32362306a36Sopenharmony_ci#define TXRX_CSR0_DISABLE_RX FIELD32(0x00010000) 32462306a36Sopenharmony_ci#define TXRX_CSR0_DROP_CRC FIELD32(0x00020000) 32562306a36Sopenharmony_ci#define TXRX_CSR0_DROP_PHYSICAL FIELD32(0x00040000) 32662306a36Sopenharmony_ci#define TXRX_CSR0_DROP_CONTROL FIELD32(0x00080000) 32762306a36Sopenharmony_ci#define TXRX_CSR0_DROP_NOT_TO_ME FIELD32(0x00100000) 32862306a36Sopenharmony_ci#define TXRX_CSR0_DROP_TO_DS FIELD32(0x00200000) 32962306a36Sopenharmony_ci#define TXRX_CSR0_DROP_VERSION_ERROR FIELD32(0x00400000) 33062306a36Sopenharmony_ci#define TXRX_CSR0_DROP_MULTICAST FIELD32(0x00800000) 33162306a36Sopenharmony_ci#define TXRX_CSR0_DROP_BROADCAST FIELD32(0x01000000) 33262306a36Sopenharmony_ci#define TXRX_CSR0_DROP_ACK_CTS FIELD32(0x02000000) 33362306a36Sopenharmony_ci#define TXRX_CSR0_TX_WITHOUT_WAITING FIELD32(0x04000000) 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci/* 33662306a36Sopenharmony_ci * TXRX_CSR1 33762306a36Sopenharmony_ci */ 33862306a36Sopenharmony_ci#define TXRX_CSR1 0x3044 33962306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID0 FIELD32(0x0000007f) 34062306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID0_VALID FIELD32(0x00000080) 34162306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID1 FIELD32(0x00007f00) 34262306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID1_VALID FIELD32(0x00008000) 34362306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID2 FIELD32(0x007f0000) 34462306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID2_VALID FIELD32(0x00800000) 34562306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID3 FIELD32(0x7f000000) 34662306a36Sopenharmony_ci#define TXRX_CSR1_BBP_ID3_VALID FIELD32(0x80000000) 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci/* 34962306a36Sopenharmony_ci * TXRX_CSR2 35062306a36Sopenharmony_ci */ 35162306a36Sopenharmony_ci#define TXRX_CSR2 0x3048 35262306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID0 FIELD32(0x0000007f) 35362306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID0_VALID FIELD32(0x00000080) 35462306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID1 FIELD32(0x00007f00) 35562306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID1_VALID FIELD32(0x00008000) 35662306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID2 FIELD32(0x007f0000) 35762306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID2_VALID FIELD32(0x00800000) 35862306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID3 FIELD32(0x7f000000) 35962306a36Sopenharmony_ci#define TXRX_CSR2_BBP_ID3_VALID FIELD32(0x80000000) 36062306a36Sopenharmony_ci 36162306a36Sopenharmony_ci/* 36262306a36Sopenharmony_ci * TXRX_CSR3 36362306a36Sopenharmony_ci */ 36462306a36Sopenharmony_ci#define TXRX_CSR3 0x304c 36562306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID0 FIELD32(0x0000007f) 36662306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID0_VALID FIELD32(0x00000080) 36762306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID1 FIELD32(0x00007f00) 36862306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID1_VALID FIELD32(0x00008000) 36962306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID2 FIELD32(0x007f0000) 37062306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID2_VALID FIELD32(0x00800000) 37162306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID3 FIELD32(0x7f000000) 37262306a36Sopenharmony_ci#define TXRX_CSR3_BBP_ID3_VALID FIELD32(0x80000000) 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci/* 37562306a36Sopenharmony_ci * TXRX_CSR4: Auto-Responder/Tx-retry register. 37662306a36Sopenharmony_ci * AUTORESPOND_PREAMBLE: 0:long, 1:short preamble. 37762306a36Sopenharmony_ci * OFDM_TX_RATE_DOWN: 1:enable. 37862306a36Sopenharmony_ci * OFDM_TX_RATE_STEP: 0:1-step, 1: 2-step, 2:3-step, 3:4-step. 37962306a36Sopenharmony_ci * OFDM_TX_FALLBACK_CCK: 0: Fallback to OFDM 6M only, 1: Fallback to CCK 1M,2M. 38062306a36Sopenharmony_ci */ 38162306a36Sopenharmony_ci#define TXRX_CSR4 0x3050 38262306a36Sopenharmony_ci#define TXRX_CSR4_TX_ACK_TIMEOUT FIELD32(0x000000ff) 38362306a36Sopenharmony_ci#define TXRX_CSR4_CNTL_ACK_POLICY FIELD32(0x00000700) 38462306a36Sopenharmony_ci#define TXRX_CSR4_ACK_CTS_PSM FIELD32(0x00010000) 38562306a36Sopenharmony_ci#define TXRX_CSR4_AUTORESPOND_ENABLE FIELD32(0x00020000) 38662306a36Sopenharmony_ci#define TXRX_CSR4_AUTORESPOND_PREAMBLE FIELD32(0x00040000) 38762306a36Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_RATE_DOWN FIELD32(0x00080000) 38862306a36Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_RATE_STEP FIELD32(0x00300000) 38962306a36Sopenharmony_ci#define TXRX_CSR4_OFDM_TX_FALLBACK_CCK FIELD32(0x00400000) 39062306a36Sopenharmony_ci#define TXRX_CSR4_LONG_RETRY_LIMIT FIELD32(0x0f000000) 39162306a36Sopenharmony_ci#define TXRX_CSR4_SHORT_RETRY_LIMIT FIELD32(0xf0000000) 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci/* 39462306a36Sopenharmony_ci * TXRX_CSR5 39562306a36Sopenharmony_ci */ 39662306a36Sopenharmony_ci#define TXRX_CSR5 0x3054 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ci/* 39962306a36Sopenharmony_ci * TXRX_CSR6: ACK/CTS payload consumed time 40062306a36Sopenharmony_ci */ 40162306a36Sopenharmony_ci#define TXRX_CSR6 0x3058 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci/* 40462306a36Sopenharmony_ci * TXRX_CSR7: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps. 40562306a36Sopenharmony_ci */ 40662306a36Sopenharmony_ci#define TXRX_CSR7 0x305c 40762306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_6MBS FIELD32(0x000000ff) 40862306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_9MBS FIELD32(0x0000ff00) 40962306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_12MBS FIELD32(0x00ff0000) 41062306a36Sopenharmony_ci#define TXRX_CSR7_ACK_CTS_18MBS FIELD32(0xff000000) 41162306a36Sopenharmony_ci 41262306a36Sopenharmony_ci/* 41362306a36Sopenharmony_ci * TXRX_CSR8: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps. 41462306a36Sopenharmony_ci */ 41562306a36Sopenharmony_ci#define TXRX_CSR8 0x3060 41662306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_24MBS FIELD32(0x000000ff) 41762306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_36MBS FIELD32(0x0000ff00) 41862306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_48MBS FIELD32(0x00ff0000) 41962306a36Sopenharmony_ci#define TXRX_CSR8_ACK_CTS_54MBS FIELD32(0xff000000) 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci/* 42262306a36Sopenharmony_ci * TXRX_CSR9: Synchronization control register. 42362306a36Sopenharmony_ci * BEACON_INTERVAL: In unit of 1/16 TU. 42462306a36Sopenharmony_ci * TSF_TICKING: Enable TSF auto counting. 42562306a36Sopenharmony_ci * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode. 42662306a36Sopenharmony_ci * BEACON_GEN: Enable beacon generator. 42762306a36Sopenharmony_ci */ 42862306a36Sopenharmony_ci#define TXRX_CSR9 0x3064 42962306a36Sopenharmony_ci#define TXRX_CSR9_BEACON_INTERVAL FIELD32(0x0000ffff) 43062306a36Sopenharmony_ci#define TXRX_CSR9_TSF_TICKING FIELD32(0x00010000) 43162306a36Sopenharmony_ci#define TXRX_CSR9_TSF_SYNC FIELD32(0x00060000) 43262306a36Sopenharmony_ci#define TXRX_CSR9_TBTT_ENABLE FIELD32(0x00080000) 43362306a36Sopenharmony_ci#define TXRX_CSR9_BEACON_GEN FIELD32(0x00100000) 43462306a36Sopenharmony_ci#define TXRX_CSR9_TIMESTAMP_COMPENSATE FIELD32(0xff000000) 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci/* 43762306a36Sopenharmony_ci * TXRX_CSR10: BEACON alignment. 43862306a36Sopenharmony_ci */ 43962306a36Sopenharmony_ci#define TXRX_CSR10 0x3068 44062306a36Sopenharmony_ci 44162306a36Sopenharmony_ci/* 44262306a36Sopenharmony_ci * TXRX_CSR11: AES mask. 44362306a36Sopenharmony_ci */ 44462306a36Sopenharmony_ci#define TXRX_CSR11 0x306c 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci/* 44762306a36Sopenharmony_ci * TXRX_CSR12: TSF low 32. 44862306a36Sopenharmony_ci */ 44962306a36Sopenharmony_ci#define TXRX_CSR12 0x3070 45062306a36Sopenharmony_ci#define TXRX_CSR12_LOW_TSFTIMER FIELD32(0xffffffff) 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci/* 45362306a36Sopenharmony_ci * TXRX_CSR13: TSF high 32. 45462306a36Sopenharmony_ci */ 45562306a36Sopenharmony_ci#define TXRX_CSR13 0x3074 45662306a36Sopenharmony_ci#define TXRX_CSR13_HIGH_TSFTIMER FIELD32(0xffffffff) 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci/* 45962306a36Sopenharmony_ci * TXRX_CSR14: TBTT timer. 46062306a36Sopenharmony_ci */ 46162306a36Sopenharmony_ci#define TXRX_CSR14 0x3078 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_ci/* 46462306a36Sopenharmony_ci * TXRX_CSR15: TKIP MIC priority byte "AND" mask. 46562306a36Sopenharmony_ci */ 46662306a36Sopenharmony_ci#define TXRX_CSR15 0x307c 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/* 46962306a36Sopenharmony_ci * PHY control registers. 47062306a36Sopenharmony_ci * Some values are set in TU, whereas 1 TU == 1024 us. 47162306a36Sopenharmony_ci */ 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* 47462306a36Sopenharmony_ci * PHY_CSR0: RF/PS control. 47562306a36Sopenharmony_ci */ 47662306a36Sopenharmony_ci#define PHY_CSR0 0x3080 47762306a36Sopenharmony_ci#define PHY_CSR0_PA_PE_BG FIELD32(0x00010000) 47862306a36Sopenharmony_ci#define PHY_CSR0_PA_PE_A FIELD32(0x00020000) 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_ci/* 48162306a36Sopenharmony_ci * PHY_CSR1 48262306a36Sopenharmony_ci */ 48362306a36Sopenharmony_ci#define PHY_CSR1 0x3084 48462306a36Sopenharmony_ci#define PHY_CSR1_RF_RPI FIELD32(0x00010000) 48562306a36Sopenharmony_ci 48662306a36Sopenharmony_ci/* 48762306a36Sopenharmony_ci * PHY_CSR2: Pre-TX BBP control. 48862306a36Sopenharmony_ci */ 48962306a36Sopenharmony_ci#define PHY_CSR2 0x3088 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_ci/* 49262306a36Sopenharmony_ci * PHY_CSR3: BBP serial control register. 49362306a36Sopenharmony_ci * VALUE: Register value to program into BBP. 49462306a36Sopenharmony_ci * REG_NUM: Selected BBP register. 49562306a36Sopenharmony_ci * READ_CONTROL: 0: Write BBP, 1: Read BBP. 49662306a36Sopenharmony_ci * BUSY: 1: ASIC is busy execute BBP programming. 49762306a36Sopenharmony_ci */ 49862306a36Sopenharmony_ci#define PHY_CSR3 0x308c 49962306a36Sopenharmony_ci#define PHY_CSR3_VALUE FIELD32(0x000000ff) 50062306a36Sopenharmony_ci#define PHY_CSR3_REGNUM FIELD32(0x00007f00) 50162306a36Sopenharmony_ci#define PHY_CSR3_READ_CONTROL FIELD32(0x00008000) 50262306a36Sopenharmony_ci#define PHY_CSR3_BUSY FIELD32(0x00010000) 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci/* 50562306a36Sopenharmony_ci * PHY_CSR4: RF serial control register 50662306a36Sopenharmony_ci * VALUE: Register value (include register id) serial out to RF/IF chip. 50762306a36Sopenharmony_ci * NUMBER_OF_BITS: Number of bits used in RFRegValue (I:20, RFMD:22). 50862306a36Sopenharmony_ci * IF_SELECT: 1: select IF to program, 0: select RF to program. 50962306a36Sopenharmony_ci * PLL_LD: RF PLL_LD status. 51062306a36Sopenharmony_ci * BUSY: 1: ASIC is busy execute RF programming. 51162306a36Sopenharmony_ci */ 51262306a36Sopenharmony_ci#define PHY_CSR4 0x3090 51362306a36Sopenharmony_ci#define PHY_CSR4_VALUE FIELD32(0x00ffffff) 51462306a36Sopenharmony_ci#define PHY_CSR4_NUMBER_OF_BITS FIELD32(0x1f000000) 51562306a36Sopenharmony_ci#define PHY_CSR4_IF_SELECT FIELD32(0x20000000) 51662306a36Sopenharmony_ci#define PHY_CSR4_PLL_LD FIELD32(0x40000000) 51762306a36Sopenharmony_ci#define PHY_CSR4_BUSY FIELD32(0x80000000) 51862306a36Sopenharmony_ci 51962306a36Sopenharmony_ci/* 52062306a36Sopenharmony_ci * PHY_CSR5: RX to TX signal switch timing control. 52162306a36Sopenharmony_ci */ 52262306a36Sopenharmony_ci#define PHY_CSR5 0x3094 52362306a36Sopenharmony_ci#define PHY_CSR5_IQ_FLIP FIELD32(0x00000004) 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci/* 52662306a36Sopenharmony_ci * PHY_CSR6: TX to RX signal timing control. 52762306a36Sopenharmony_ci */ 52862306a36Sopenharmony_ci#define PHY_CSR6 0x3098 52962306a36Sopenharmony_ci#define PHY_CSR6_IQ_FLIP FIELD32(0x00000004) 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci/* 53262306a36Sopenharmony_ci * PHY_CSR7: TX DAC switching timing control. 53362306a36Sopenharmony_ci */ 53462306a36Sopenharmony_ci#define PHY_CSR7 0x309c 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_ci/* 53762306a36Sopenharmony_ci * Security control register. 53862306a36Sopenharmony_ci */ 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci/* 54162306a36Sopenharmony_ci * SEC_CSR0: Shared key table control. 54262306a36Sopenharmony_ci */ 54362306a36Sopenharmony_ci#define SEC_CSR0 0x30a0 54462306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY0_VALID FIELD32(0x00000001) 54562306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY1_VALID FIELD32(0x00000002) 54662306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY2_VALID FIELD32(0x00000004) 54762306a36Sopenharmony_ci#define SEC_CSR0_BSS0_KEY3_VALID FIELD32(0x00000008) 54862306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY0_VALID FIELD32(0x00000010) 54962306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY1_VALID FIELD32(0x00000020) 55062306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY2_VALID FIELD32(0x00000040) 55162306a36Sopenharmony_ci#define SEC_CSR0_BSS1_KEY3_VALID FIELD32(0x00000080) 55262306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY0_VALID FIELD32(0x00000100) 55362306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY1_VALID FIELD32(0x00000200) 55462306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY2_VALID FIELD32(0x00000400) 55562306a36Sopenharmony_ci#define SEC_CSR0_BSS2_KEY3_VALID FIELD32(0x00000800) 55662306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY0_VALID FIELD32(0x00001000) 55762306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY1_VALID FIELD32(0x00002000) 55862306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY2_VALID FIELD32(0x00004000) 55962306a36Sopenharmony_ci#define SEC_CSR0_BSS3_KEY3_VALID FIELD32(0x00008000) 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_ci/* 56262306a36Sopenharmony_ci * SEC_CSR1: Shared key table security mode register. 56362306a36Sopenharmony_ci */ 56462306a36Sopenharmony_ci#define SEC_CSR1 0x30a4 56562306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY0_CIPHER_ALG FIELD32(0x00000007) 56662306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY1_CIPHER_ALG FIELD32(0x00000070) 56762306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY2_CIPHER_ALG FIELD32(0x00000700) 56862306a36Sopenharmony_ci#define SEC_CSR1_BSS0_KEY3_CIPHER_ALG FIELD32(0x00007000) 56962306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY0_CIPHER_ALG FIELD32(0x00070000) 57062306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY1_CIPHER_ALG FIELD32(0x00700000) 57162306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY2_CIPHER_ALG FIELD32(0x07000000) 57262306a36Sopenharmony_ci#define SEC_CSR1_BSS1_KEY3_CIPHER_ALG FIELD32(0x70000000) 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_ci/* 57562306a36Sopenharmony_ci * Pairwise key table valid bitmap registers. 57662306a36Sopenharmony_ci * SEC_CSR2: pairwise key table valid bitmap 0. 57762306a36Sopenharmony_ci * SEC_CSR3: pairwise key table valid bitmap 1. 57862306a36Sopenharmony_ci */ 57962306a36Sopenharmony_ci#define SEC_CSR2 0x30a8 58062306a36Sopenharmony_ci#define SEC_CSR3 0x30ac 58162306a36Sopenharmony_ci 58262306a36Sopenharmony_ci/* 58362306a36Sopenharmony_ci * SEC_CSR4: Pairwise key table lookup control. 58462306a36Sopenharmony_ci */ 58562306a36Sopenharmony_ci#define SEC_CSR4 0x30b0 58662306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS0 FIELD32(0x00000001) 58762306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS1 FIELD32(0x00000002) 58862306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS2 FIELD32(0x00000004) 58962306a36Sopenharmony_ci#define SEC_CSR4_ENABLE_BSS3 FIELD32(0x00000008) 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci/* 59262306a36Sopenharmony_ci * SEC_CSR5: shared key table security mode register. 59362306a36Sopenharmony_ci */ 59462306a36Sopenharmony_ci#define SEC_CSR5 0x30b4 59562306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY0_CIPHER_ALG FIELD32(0x00000007) 59662306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY1_CIPHER_ALG FIELD32(0x00000070) 59762306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY2_CIPHER_ALG FIELD32(0x00000700) 59862306a36Sopenharmony_ci#define SEC_CSR5_BSS2_KEY3_CIPHER_ALG FIELD32(0x00007000) 59962306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY0_CIPHER_ALG FIELD32(0x00070000) 60062306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY1_CIPHER_ALG FIELD32(0x00700000) 60162306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY2_CIPHER_ALG FIELD32(0x07000000) 60262306a36Sopenharmony_ci#define SEC_CSR5_BSS3_KEY3_CIPHER_ALG FIELD32(0x70000000) 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ci/* 60562306a36Sopenharmony_ci * STA control registers. 60662306a36Sopenharmony_ci */ 60762306a36Sopenharmony_ci 60862306a36Sopenharmony_ci/* 60962306a36Sopenharmony_ci * STA_CSR0: RX PLCP error count & RX FCS error count. 61062306a36Sopenharmony_ci */ 61162306a36Sopenharmony_ci#define STA_CSR0 0x30c0 61262306a36Sopenharmony_ci#define STA_CSR0_FCS_ERROR FIELD32(0x0000ffff) 61362306a36Sopenharmony_ci#define STA_CSR0_PLCP_ERROR FIELD32(0xffff0000) 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_ci/* 61662306a36Sopenharmony_ci * STA_CSR1: RX False CCA count & RX LONG frame count. 61762306a36Sopenharmony_ci */ 61862306a36Sopenharmony_ci#define STA_CSR1 0x30c4 61962306a36Sopenharmony_ci#define STA_CSR1_PHYSICAL_ERROR FIELD32(0x0000ffff) 62062306a36Sopenharmony_ci#define STA_CSR1_FALSE_CCA_ERROR FIELD32(0xffff0000) 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci/* 62362306a36Sopenharmony_ci * STA_CSR2: TX Beacon count and RX FIFO overflow count. 62462306a36Sopenharmony_ci */ 62562306a36Sopenharmony_ci#define STA_CSR2 0x30c8 62662306a36Sopenharmony_ci#define STA_CSR2_RX_FIFO_OVERFLOW_COUNT FIELD32(0x0000ffff) 62762306a36Sopenharmony_ci#define STA_CSR2_RX_OVERFLOW_COUNT FIELD32(0xffff0000) 62862306a36Sopenharmony_ci 62962306a36Sopenharmony_ci/* 63062306a36Sopenharmony_ci * STA_CSR3: TX Beacon count. 63162306a36Sopenharmony_ci */ 63262306a36Sopenharmony_ci#define STA_CSR3 0x30cc 63362306a36Sopenharmony_ci#define STA_CSR3_TX_BEACON_COUNT FIELD32(0x0000ffff) 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci/* 63662306a36Sopenharmony_ci * STA_CSR4: TX Retry count. 63762306a36Sopenharmony_ci */ 63862306a36Sopenharmony_ci#define STA_CSR4 0x30d0 63962306a36Sopenharmony_ci#define STA_CSR4_TX_NO_RETRY_COUNT FIELD32(0x0000ffff) 64062306a36Sopenharmony_ci#define STA_CSR4_TX_ONE_RETRY_COUNT FIELD32(0xffff0000) 64162306a36Sopenharmony_ci 64262306a36Sopenharmony_ci/* 64362306a36Sopenharmony_ci * STA_CSR5: TX Retry count. 64462306a36Sopenharmony_ci */ 64562306a36Sopenharmony_ci#define STA_CSR5 0x30d4 64662306a36Sopenharmony_ci#define STA_CSR4_TX_MULTI_RETRY_COUNT FIELD32(0x0000ffff) 64762306a36Sopenharmony_ci#define STA_CSR4_TX_RETRY_FAIL_COUNT FIELD32(0xffff0000) 64862306a36Sopenharmony_ci 64962306a36Sopenharmony_ci/* 65062306a36Sopenharmony_ci * QOS control registers. 65162306a36Sopenharmony_ci */ 65262306a36Sopenharmony_ci 65362306a36Sopenharmony_ci/* 65462306a36Sopenharmony_ci * QOS_CSR1: TXOP holder MAC address register. 65562306a36Sopenharmony_ci */ 65662306a36Sopenharmony_ci#define QOS_CSR1 0x30e4 65762306a36Sopenharmony_ci#define QOS_CSR1_BYTE4 FIELD32(0x000000ff) 65862306a36Sopenharmony_ci#define QOS_CSR1_BYTE5 FIELD32(0x0000ff00) 65962306a36Sopenharmony_ci 66062306a36Sopenharmony_ci/* 66162306a36Sopenharmony_ci * QOS_CSR2: TXOP holder timeout register. 66262306a36Sopenharmony_ci */ 66362306a36Sopenharmony_ci#define QOS_CSR2 0x30e8 66462306a36Sopenharmony_ci 66562306a36Sopenharmony_ci/* 66662306a36Sopenharmony_ci * RX QOS-CFPOLL MAC address register. 66762306a36Sopenharmony_ci * QOS_CSR3: RX QOS-CFPOLL MAC address 0. 66862306a36Sopenharmony_ci * QOS_CSR4: RX QOS-CFPOLL MAC address 1. 66962306a36Sopenharmony_ci */ 67062306a36Sopenharmony_ci#define QOS_CSR3 0x30ec 67162306a36Sopenharmony_ci#define QOS_CSR4 0x30f0 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci/* 67462306a36Sopenharmony_ci * QOS_CSR5: "QosControl" field of the RX QOS-CFPOLL. 67562306a36Sopenharmony_ci */ 67662306a36Sopenharmony_ci#define QOS_CSR5 0x30f4 67762306a36Sopenharmony_ci 67862306a36Sopenharmony_ci/* 67962306a36Sopenharmony_ci * WMM Scheduler Register 68062306a36Sopenharmony_ci */ 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_ci/* 68362306a36Sopenharmony_ci * AIFSN_CSR: AIFSN for each EDCA AC. 68462306a36Sopenharmony_ci * AIFSN0: For AC_VO. 68562306a36Sopenharmony_ci * AIFSN1: For AC_VI. 68662306a36Sopenharmony_ci * AIFSN2: For AC_BE. 68762306a36Sopenharmony_ci * AIFSN3: For AC_BK. 68862306a36Sopenharmony_ci */ 68962306a36Sopenharmony_ci#define AIFSN_CSR 0x0400 69062306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) 69162306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN1 FIELD32(0x000000f0) 69262306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN2 FIELD32(0x00000f00) 69362306a36Sopenharmony_ci#define AIFSN_CSR_AIFSN3 FIELD32(0x0000f000) 69462306a36Sopenharmony_ci 69562306a36Sopenharmony_ci/* 69662306a36Sopenharmony_ci * CWMIN_CSR: CWmin for each EDCA AC. 69762306a36Sopenharmony_ci * CWMIN0: For AC_VO. 69862306a36Sopenharmony_ci * CWMIN1: For AC_VI. 69962306a36Sopenharmony_ci * CWMIN2: For AC_BE. 70062306a36Sopenharmony_ci * CWMIN3: For AC_BK. 70162306a36Sopenharmony_ci */ 70262306a36Sopenharmony_ci#define CWMIN_CSR 0x0404 70362306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) 70462306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN1 FIELD32(0x000000f0) 70562306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN2 FIELD32(0x00000f00) 70662306a36Sopenharmony_ci#define CWMIN_CSR_CWMIN3 FIELD32(0x0000f000) 70762306a36Sopenharmony_ci 70862306a36Sopenharmony_ci/* 70962306a36Sopenharmony_ci * CWMAX_CSR: CWmax for each EDCA AC. 71062306a36Sopenharmony_ci * CWMAX0: For AC_VO. 71162306a36Sopenharmony_ci * CWMAX1: For AC_VI. 71262306a36Sopenharmony_ci * CWMAX2: For AC_BE. 71362306a36Sopenharmony_ci * CWMAX3: For AC_BK. 71462306a36Sopenharmony_ci */ 71562306a36Sopenharmony_ci#define CWMAX_CSR 0x0408 71662306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) 71762306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX1 FIELD32(0x000000f0) 71862306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX2 FIELD32(0x00000f00) 71962306a36Sopenharmony_ci#define CWMAX_CSR_CWMAX3 FIELD32(0x0000f000) 72062306a36Sopenharmony_ci 72162306a36Sopenharmony_ci/* 72262306a36Sopenharmony_ci * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register. 72362306a36Sopenharmony_ci * AC0_TX_OP: For AC_VO, in unit of 32us. 72462306a36Sopenharmony_ci * AC1_TX_OP: For AC_VI, in unit of 32us. 72562306a36Sopenharmony_ci */ 72662306a36Sopenharmony_ci#define AC_TXOP_CSR0 0x040c 72762306a36Sopenharmony_ci#define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) 72862306a36Sopenharmony_ci#define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) 72962306a36Sopenharmony_ci 73062306a36Sopenharmony_ci/* 73162306a36Sopenharmony_ci * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register. 73262306a36Sopenharmony_ci * AC2_TX_OP: For AC_BE, in unit of 32us. 73362306a36Sopenharmony_ci * AC3_TX_OP: For AC_BK, in unit of 32us. 73462306a36Sopenharmony_ci */ 73562306a36Sopenharmony_ci#define AC_TXOP_CSR1 0x0410 73662306a36Sopenharmony_ci#define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) 73762306a36Sopenharmony_ci#define AC_TXOP_CSR1_AC3_TX_OP FIELD32(0xffff0000) 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci/* 74062306a36Sopenharmony_ci * BBP registers. 74162306a36Sopenharmony_ci * The wordsize of the BBP is 8 bits. 74262306a36Sopenharmony_ci */ 74362306a36Sopenharmony_ci 74462306a36Sopenharmony_ci/* 74562306a36Sopenharmony_ci * R2 74662306a36Sopenharmony_ci */ 74762306a36Sopenharmony_ci#define BBP_R2_BG_MODE FIELD8(0x20) 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci/* 75062306a36Sopenharmony_ci * R3 75162306a36Sopenharmony_ci */ 75262306a36Sopenharmony_ci#define BBP_R3_SMART_MODE FIELD8(0x01) 75362306a36Sopenharmony_ci 75462306a36Sopenharmony_ci/* 75562306a36Sopenharmony_ci * R4: RX antenna control 75662306a36Sopenharmony_ci * FRAME_END: 1 - DPDT, 0 - SPDT (Only valid for 802.11G, RF2527 & RF2529) 75762306a36Sopenharmony_ci */ 75862306a36Sopenharmony_ci 75962306a36Sopenharmony_ci/* 76062306a36Sopenharmony_ci * ANTENNA_CONTROL semantics (guessed): 76162306a36Sopenharmony_ci * 0x1: Software controlled antenna switching (fixed or SW diversity) 76262306a36Sopenharmony_ci * 0x2: Hardware diversity. 76362306a36Sopenharmony_ci */ 76462306a36Sopenharmony_ci#define BBP_R4_RX_ANTENNA_CONTROL FIELD8(0x03) 76562306a36Sopenharmony_ci#define BBP_R4_RX_FRAME_END FIELD8(0x20) 76662306a36Sopenharmony_ci 76762306a36Sopenharmony_ci/* 76862306a36Sopenharmony_ci * R77 76962306a36Sopenharmony_ci */ 77062306a36Sopenharmony_ci#define BBP_R77_RX_ANTENNA FIELD8(0x03) 77162306a36Sopenharmony_ci 77262306a36Sopenharmony_ci/* 77362306a36Sopenharmony_ci * RF registers 77462306a36Sopenharmony_ci */ 77562306a36Sopenharmony_ci 77662306a36Sopenharmony_ci/* 77762306a36Sopenharmony_ci * RF 3 77862306a36Sopenharmony_ci */ 77962306a36Sopenharmony_ci#define RF3_TXPOWER FIELD32(0x00003e00) 78062306a36Sopenharmony_ci 78162306a36Sopenharmony_ci/* 78262306a36Sopenharmony_ci * RF 4 78362306a36Sopenharmony_ci */ 78462306a36Sopenharmony_ci#define RF4_FREQ_OFFSET FIELD32(0x0003f000) 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci/* 78762306a36Sopenharmony_ci * EEPROM content. 78862306a36Sopenharmony_ci * The wordsize of the EEPROM is 16 bits. 78962306a36Sopenharmony_ci */ 79062306a36Sopenharmony_ci 79162306a36Sopenharmony_ci/* 79262306a36Sopenharmony_ci * HW MAC address. 79362306a36Sopenharmony_ci */ 79462306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_0 0x0002 79562306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) 79662306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) 79762306a36Sopenharmony_ci#define EEPROM_MAC_ADDR1 0x0003 79862306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) 79962306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) 80062306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_2 0x0004 80162306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) 80262306a36Sopenharmony_ci#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) 80362306a36Sopenharmony_ci 80462306a36Sopenharmony_ci/* 80562306a36Sopenharmony_ci * EEPROM antenna. 80662306a36Sopenharmony_ci * ANTENNA_NUM: Number of antennas. 80762306a36Sopenharmony_ci * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. 80862306a36Sopenharmony_ci * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. 80962306a36Sopenharmony_ci * FRAME_TYPE: 0: DPDT , 1: SPDT , noted this bit is valid for g only. 81062306a36Sopenharmony_ci * DYN_TXAGC: Dynamic TX AGC control. 81162306a36Sopenharmony_ci * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0. 81262306a36Sopenharmony_ci * RF_TYPE: Rf_type of this adapter. 81362306a36Sopenharmony_ci */ 81462306a36Sopenharmony_ci#define EEPROM_ANTENNA 0x0010 81562306a36Sopenharmony_ci#define EEPROM_ANTENNA_NUM FIELD16(0x0003) 81662306a36Sopenharmony_ci#define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c) 81762306a36Sopenharmony_ci#define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030) 81862306a36Sopenharmony_ci#define EEPROM_ANTENNA_FRAME_TYPE FIELD16(0x0040) 81962306a36Sopenharmony_ci#define EEPROM_ANTENNA_DYN_TXAGC FIELD16(0x0200) 82062306a36Sopenharmony_ci#define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400) 82162306a36Sopenharmony_ci#define EEPROM_ANTENNA_RF_TYPE FIELD16(0xf800) 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci/* 82462306a36Sopenharmony_ci * EEPROM NIC config. 82562306a36Sopenharmony_ci * EXTERNAL_LNA: External LNA. 82662306a36Sopenharmony_ci */ 82762306a36Sopenharmony_ci#define EEPROM_NIC 0x0011 82862306a36Sopenharmony_ci#define EEPROM_NIC_EXTERNAL_LNA FIELD16(0x0010) 82962306a36Sopenharmony_ci 83062306a36Sopenharmony_ci/* 83162306a36Sopenharmony_ci * EEPROM geography. 83262306a36Sopenharmony_ci * GEO_A: Default geographical setting for 5GHz band 83362306a36Sopenharmony_ci * GEO: Default geographical setting. 83462306a36Sopenharmony_ci */ 83562306a36Sopenharmony_ci#define EEPROM_GEOGRAPHY 0x0012 83662306a36Sopenharmony_ci#define EEPROM_GEOGRAPHY_GEO_A FIELD16(0x00ff) 83762306a36Sopenharmony_ci#define EEPROM_GEOGRAPHY_GEO FIELD16(0xff00) 83862306a36Sopenharmony_ci 83962306a36Sopenharmony_ci/* 84062306a36Sopenharmony_ci * EEPROM BBP. 84162306a36Sopenharmony_ci */ 84262306a36Sopenharmony_ci#define EEPROM_BBP_START 0x0013 84362306a36Sopenharmony_ci#define EEPROM_BBP_SIZE 16 84462306a36Sopenharmony_ci#define EEPROM_BBP_VALUE FIELD16(0x00ff) 84562306a36Sopenharmony_ci#define EEPROM_BBP_REG_ID FIELD16(0xff00) 84662306a36Sopenharmony_ci 84762306a36Sopenharmony_ci/* 84862306a36Sopenharmony_ci * EEPROM TXPOWER 802.11G 84962306a36Sopenharmony_ci */ 85062306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_START 0x0023 85162306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_SIZE 7 85262306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_1 FIELD16(0x00ff) 85362306a36Sopenharmony_ci#define EEPROM_TXPOWER_G_2 FIELD16(0xff00) 85462306a36Sopenharmony_ci 85562306a36Sopenharmony_ci/* 85662306a36Sopenharmony_ci * EEPROM Frequency 85762306a36Sopenharmony_ci */ 85862306a36Sopenharmony_ci#define EEPROM_FREQ 0x002f 85962306a36Sopenharmony_ci#define EEPROM_FREQ_OFFSET FIELD16(0x00ff) 86062306a36Sopenharmony_ci#define EEPROM_FREQ_SEQ_MASK FIELD16(0xff00) 86162306a36Sopenharmony_ci#define EEPROM_FREQ_SEQ FIELD16(0x0300) 86262306a36Sopenharmony_ci 86362306a36Sopenharmony_ci/* 86462306a36Sopenharmony_ci * EEPROM LED. 86562306a36Sopenharmony_ci * POLARITY_RDY_G: Polarity RDY_G setting. 86662306a36Sopenharmony_ci * POLARITY_RDY_A: Polarity RDY_A setting. 86762306a36Sopenharmony_ci * POLARITY_ACT: Polarity ACT setting. 86862306a36Sopenharmony_ci * POLARITY_GPIO_0: Polarity GPIO0 setting. 86962306a36Sopenharmony_ci * POLARITY_GPIO_1: Polarity GPIO1 setting. 87062306a36Sopenharmony_ci * POLARITY_GPIO_2: Polarity GPIO2 setting. 87162306a36Sopenharmony_ci * POLARITY_GPIO_3: Polarity GPIO3 setting. 87262306a36Sopenharmony_ci * POLARITY_GPIO_4: Polarity GPIO4 setting. 87362306a36Sopenharmony_ci * LED_MODE: Led mode. 87462306a36Sopenharmony_ci */ 87562306a36Sopenharmony_ci#define EEPROM_LED 0x0030 87662306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_RDY_G FIELD16(0x0001) 87762306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) 87862306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) 87962306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008) 88062306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010) 88162306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020) 88262306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040) 88362306a36Sopenharmony_ci#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080) 88462306a36Sopenharmony_ci#define EEPROM_LED_LED_MODE FIELD16(0x1f00) 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci/* 88762306a36Sopenharmony_ci * EEPROM TXPOWER 802.11A 88862306a36Sopenharmony_ci */ 88962306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_START 0x0031 89062306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_SIZE 12 89162306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff) 89262306a36Sopenharmony_ci#define EEPROM_TXPOWER_A_2 FIELD16(0xff00) 89362306a36Sopenharmony_ci 89462306a36Sopenharmony_ci/* 89562306a36Sopenharmony_ci * EEPROM RSSI offset 802.11BG 89662306a36Sopenharmony_ci */ 89762306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG 0x004d 89862306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG_1 FIELD16(0x00ff) 89962306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_BG_2 FIELD16(0xff00) 90062306a36Sopenharmony_ci 90162306a36Sopenharmony_ci/* 90262306a36Sopenharmony_ci * EEPROM RSSI offset 802.11A 90362306a36Sopenharmony_ci */ 90462306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A 0x004e 90562306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A_1 FIELD16(0x00ff) 90662306a36Sopenharmony_ci#define EEPROM_RSSI_OFFSET_A_2 FIELD16(0xff00) 90762306a36Sopenharmony_ci 90862306a36Sopenharmony_ci/* 90962306a36Sopenharmony_ci * DMA descriptor defines. 91062306a36Sopenharmony_ci */ 91162306a36Sopenharmony_ci#define TXD_DESC_SIZE ( 6 * sizeof(__le32) ) 91262306a36Sopenharmony_ci#define TXINFO_SIZE ( 6 * sizeof(__le32) ) 91362306a36Sopenharmony_ci#define RXD_DESC_SIZE ( 6 * sizeof(__le32) ) 91462306a36Sopenharmony_ci 91562306a36Sopenharmony_ci/* 91662306a36Sopenharmony_ci * TX descriptor format for TX, PRIO and Beacon Ring. 91762306a36Sopenharmony_ci */ 91862306a36Sopenharmony_ci 91962306a36Sopenharmony_ci/* 92062306a36Sopenharmony_ci * Word0 92162306a36Sopenharmony_ci * BURST: Next frame belongs to same "burst" event. 92262306a36Sopenharmony_ci * TKIP_MIC: ASIC appends TKIP MIC if TKIP is used. 92362306a36Sopenharmony_ci * KEY_TABLE: Use per-client pairwise KEY table. 92462306a36Sopenharmony_ci * KEY_INDEX: 92562306a36Sopenharmony_ci * Key index (0~31) to the pairwise KEY table. 92662306a36Sopenharmony_ci * 0~3 to shared KEY table 0 (BSS0). 92762306a36Sopenharmony_ci * 4~7 to shared KEY table 1 (BSS1). 92862306a36Sopenharmony_ci * 8~11 to shared KEY table 2 (BSS2). 92962306a36Sopenharmony_ci * 12~15 to shared KEY table 3 (BSS3). 93062306a36Sopenharmony_ci * BURST2: For backward compatibility, set to same value as BURST. 93162306a36Sopenharmony_ci */ 93262306a36Sopenharmony_ci#define TXD_W0_BURST FIELD32(0x00000001) 93362306a36Sopenharmony_ci#define TXD_W0_VALID FIELD32(0x00000002) 93462306a36Sopenharmony_ci#define TXD_W0_MORE_FRAG FIELD32(0x00000004) 93562306a36Sopenharmony_ci#define TXD_W0_ACK FIELD32(0x00000008) 93662306a36Sopenharmony_ci#define TXD_W0_TIMESTAMP FIELD32(0x00000010) 93762306a36Sopenharmony_ci#define TXD_W0_OFDM FIELD32(0x00000020) 93862306a36Sopenharmony_ci#define TXD_W0_IFS FIELD32(0x00000040) 93962306a36Sopenharmony_ci#define TXD_W0_RETRY_MODE FIELD32(0x00000080) 94062306a36Sopenharmony_ci#define TXD_W0_TKIP_MIC FIELD32(0x00000100) 94162306a36Sopenharmony_ci#define TXD_W0_KEY_TABLE FIELD32(0x00000200) 94262306a36Sopenharmony_ci#define TXD_W0_KEY_INDEX FIELD32(0x0000fc00) 94362306a36Sopenharmony_ci#define TXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) 94462306a36Sopenharmony_ci#define TXD_W0_BURST2 FIELD32(0x10000000) 94562306a36Sopenharmony_ci#define TXD_W0_CIPHER_ALG FIELD32(0xe0000000) 94662306a36Sopenharmony_ci 94762306a36Sopenharmony_ci/* 94862306a36Sopenharmony_ci * Word1 94962306a36Sopenharmony_ci * HOST_Q_ID: EDCA/HCCA queue ID. 95062306a36Sopenharmony_ci * HW_SEQUENCE: MAC overwrites the frame sequence number. 95162306a36Sopenharmony_ci * BUFFER_COUNT: Number of buffers in this TXD. 95262306a36Sopenharmony_ci */ 95362306a36Sopenharmony_ci#define TXD_W1_HOST_Q_ID FIELD32(0x0000000f) 95462306a36Sopenharmony_ci#define TXD_W1_AIFSN FIELD32(0x000000f0) 95562306a36Sopenharmony_ci#define TXD_W1_CWMIN FIELD32(0x00000f00) 95662306a36Sopenharmony_ci#define TXD_W1_CWMAX FIELD32(0x0000f000) 95762306a36Sopenharmony_ci#define TXD_W1_IV_OFFSET FIELD32(0x003f0000) 95862306a36Sopenharmony_ci#define TXD_W1_HW_SEQUENCE FIELD32(0x10000000) 95962306a36Sopenharmony_ci#define TXD_W1_BUFFER_COUNT FIELD32(0xe0000000) 96062306a36Sopenharmony_ci 96162306a36Sopenharmony_ci/* 96262306a36Sopenharmony_ci * Word2: PLCP information 96362306a36Sopenharmony_ci */ 96462306a36Sopenharmony_ci#define TXD_W2_PLCP_SIGNAL FIELD32(0x000000ff) 96562306a36Sopenharmony_ci#define TXD_W2_PLCP_SERVICE FIELD32(0x0000ff00) 96662306a36Sopenharmony_ci#define TXD_W2_PLCP_LENGTH_LOW FIELD32(0x00ff0000) 96762306a36Sopenharmony_ci#define TXD_W2_PLCP_LENGTH_HIGH FIELD32(0xff000000) 96862306a36Sopenharmony_ci 96962306a36Sopenharmony_ci/* 97062306a36Sopenharmony_ci * Word3 97162306a36Sopenharmony_ci */ 97262306a36Sopenharmony_ci#define TXD_W3_IV FIELD32(0xffffffff) 97362306a36Sopenharmony_ci 97462306a36Sopenharmony_ci/* 97562306a36Sopenharmony_ci * Word4 97662306a36Sopenharmony_ci */ 97762306a36Sopenharmony_ci#define TXD_W4_EIV FIELD32(0xffffffff) 97862306a36Sopenharmony_ci 97962306a36Sopenharmony_ci/* 98062306a36Sopenharmony_ci * Word5 98162306a36Sopenharmony_ci * FRAME_OFFSET: Frame start offset inside ASIC TXFIFO (after TXINFO field). 98262306a36Sopenharmony_ci * PACKET_ID: Driver assigned packet ID to categorize TXResult in interrupt. 98362306a36Sopenharmony_ci * WAITING_DMA_DONE_INT: TXD been filled with data 98462306a36Sopenharmony_ci * and waiting for TxDoneISR housekeeping. 98562306a36Sopenharmony_ci */ 98662306a36Sopenharmony_ci#define TXD_W5_FRAME_OFFSET FIELD32(0x000000ff) 98762306a36Sopenharmony_ci#define TXD_W5_PACKET_ID FIELD32(0x0000ff00) 98862306a36Sopenharmony_ci#define TXD_W5_TX_POWER FIELD32(0x00ff0000) 98962306a36Sopenharmony_ci#define TXD_W5_WAITING_DMA_DONE_INT FIELD32(0x01000000) 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_ci/* 99262306a36Sopenharmony_ci * RX descriptor format for RX Ring. 99362306a36Sopenharmony_ci */ 99462306a36Sopenharmony_ci 99562306a36Sopenharmony_ci/* 99662306a36Sopenharmony_ci * Word0 99762306a36Sopenharmony_ci * CIPHER_ERROR: 1:ICV error, 2:MIC error, 3:invalid key. 99862306a36Sopenharmony_ci * KEY_INDEX: Decryption key actually used. 99962306a36Sopenharmony_ci */ 100062306a36Sopenharmony_ci#define RXD_W0_OWNER_NIC FIELD32(0x00000001) 100162306a36Sopenharmony_ci#define RXD_W0_DROP FIELD32(0x00000002) 100262306a36Sopenharmony_ci#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000004) 100362306a36Sopenharmony_ci#define RXD_W0_MULTICAST FIELD32(0x00000008) 100462306a36Sopenharmony_ci#define RXD_W0_BROADCAST FIELD32(0x00000010) 100562306a36Sopenharmony_ci#define RXD_W0_MY_BSS FIELD32(0x00000020) 100662306a36Sopenharmony_ci#define RXD_W0_CRC_ERROR FIELD32(0x00000040) 100762306a36Sopenharmony_ci#define RXD_W0_OFDM FIELD32(0x00000080) 100862306a36Sopenharmony_ci#define RXD_W0_CIPHER_ERROR FIELD32(0x00000300) 100962306a36Sopenharmony_ci#define RXD_W0_KEY_INDEX FIELD32(0x0000fc00) 101062306a36Sopenharmony_ci#define RXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) 101162306a36Sopenharmony_ci#define RXD_W0_CIPHER_ALG FIELD32(0xe0000000) 101262306a36Sopenharmony_ci 101362306a36Sopenharmony_ci/* 101462306a36Sopenharmony_ci * WORD1 101562306a36Sopenharmony_ci * SIGNAL: RX raw data rate reported by BBP. 101662306a36Sopenharmony_ci * RSSI: RSSI reported by BBP. 101762306a36Sopenharmony_ci */ 101862306a36Sopenharmony_ci#define RXD_W1_SIGNAL FIELD32(0x000000ff) 101962306a36Sopenharmony_ci#define RXD_W1_RSSI_AGC FIELD32(0x00001f00) 102062306a36Sopenharmony_ci#define RXD_W1_RSSI_LNA FIELD32(0x00006000) 102162306a36Sopenharmony_ci#define RXD_W1_FRAME_OFFSET FIELD32(0x7f000000) 102262306a36Sopenharmony_ci 102362306a36Sopenharmony_ci/* 102462306a36Sopenharmony_ci * Word2 102562306a36Sopenharmony_ci * IV: Received IV of originally encrypted. 102662306a36Sopenharmony_ci */ 102762306a36Sopenharmony_ci#define RXD_W2_IV FIELD32(0xffffffff) 102862306a36Sopenharmony_ci 102962306a36Sopenharmony_ci/* 103062306a36Sopenharmony_ci * Word3 103162306a36Sopenharmony_ci * EIV: Received EIV of originally encrypted. 103262306a36Sopenharmony_ci */ 103362306a36Sopenharmony_ci#define RXD_W3_EIV FIELD32(0xffffffff) 103462306a36Sopenharmony_ci 103562306a36Sopenharmony_ci/* 103662306a36Sopenharmony_ci * Word4 103762306a36Sopenharmony_ci * ICV: Received ICV of originally encrypted. 103862306a36Sopenharmony_ci * NOTE: This is a guess, the official definition is "reserved" 103962306a36Sopenharmony_ci */ 104062306a36Sopenharmony_ci#define RXD_W4_ICV FIELD32(0xffffffff) 104162306a36Sopenharmony_ci 104262306a36Sopenharmony_ci/* 104362306a36Sopenharmony_ci * the above 20-byte is called RXINFO and will be DMAed to MAC RX block 104462306a36Sopenharmony_ci * and passed to the HOST driver. 104562306a36Sopenharmony_ci * The following fields are for DMA block and HOST usage only. 104662306a36Sopenharmony_ci * Can't be touched by ASIC MAC block. 104762306a36Sopenharmony_ci */ 104862306a36Sopenharmony_ci 104962306a36Sopenharmony_ci/* 105062306a36Sopenharmony_ci * Word5 105162306a36Sopenharmony_ci */ 105262306a36Sopenharmony_ci#define RXD_W5_RESERVED FIELD32(0xffffffff) 105362306a36Sopenharmony_ci 105462306a36Sopenharmony_ci/* 105562306a36Sopenharmony_ci * Macros for converting txpower from EEPROM to mac80211 value 105662306a36Sopenharmony_ci * and from mac80211 value to register value. 105762306a36Sopenharmony_ci */ 105862306a36Sopenharmony_ci#define MIN_TXPOWER 0 105962306a36Sopenharmony_ci#define MAX_TXPOWER 31 106062306a36Sopenharmony_ci#define DEFAULT_TXPOWER 24 106162306a36Sopenharmony_ci 106262306a36Sopenharmony_ci#define TXPOWER_FROM_DEV(__txpower) \ 106362306a36Sopenharmony_ci (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) 106462306a36Sopenharmony_ci 106562306a36Sopenharmony_ci#define TXPOWER_TO_DEV(__txpower) \ 106662306a36Sopenharmony_ci clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER) 106762306a36Sopenharmony_ci 106862306a36Sopenharmony_ci#endif /* RT73USB_H */ 1069