46 if (!(x & 0xffff0000u)) {
50 if (!(x & 0xff000000u)) {
54 if (!(x & 0xf0000000u)) {
58 if (!(x & 0xc0000000u)) {
62 if (!(x & 0x80000000u)) {
89 u32 coef_scaled, coef_exp, coef_man,
90 ds_coef_exp, ds_coef_man, clock;
94 DBG(
"ath5k: attempt to set OFDM timings on non-OFDM channel\n");
105 coef_scaled = ((5 * (clock << 24)) / 2) /
channel->center_freq;
109 coef_exp =
fls(coef_scaled) - 1;
112 if (!coef_scaled || !coef_exp)
116 coef_exp = 14 - (coef_exp - 24);
121 coef_man = coef_scaled +
122 (1 << (24 - coef_exp - 1));
126 ds_coef_man = coef_man >> (24 - coef_exp);
127 ds_coef_exp = coef_exp - 16;
182 if (rate != 20 && rate != 55 && rate != 110)
250 if (
data & 0xffc00000)
258 for (i = 50; i > 0; i--) {
285 u32 turbo, mode, clock, bus_flags;
295 DBG(
"ath5k: failed to wake up the MAC chip\n");
330 DBG(
"ath5k: invalid radio modulation mode\n");
344 DBG(
"ath5k: invalid radio modulation mode\n");
348 DBG(
"ath5k: invalid radio frequency mode\n");
381 DBG(
"ath5k: failed to reset the MAC chip\n");
388 DBG(
"ath5k: failed to resume the MAC chip\n");
394 DBG(
"ath5k: failed to warm reset the MAC chip\n");
426 if ((
channel->center_freq % refclk_freq != 0) &&
427 ((
channel->center_freq % refclk_freq < 10) ||
428 (
channel->center_freq % refclk_freq > 22)))
490 if (
channel->center_freq == 2462 ||
502 ah->ah_radio_5ghz_revision <
541 s16 cck_ofdm_pwr_delta;
544 if (
channel->center_freq == 2484)
567 ah->ah_txpower.txp_cck_ofdm_pwr_delta = cck_ofdm_pwr_delta;
568 ah->ah_txpower.txp_cck_ofdm_gainf_delta =
575 (
ah->ah_antenna[ee_mode][0] |
693 u32 s_seq[10], s_ant, s_led[3], staid1_flags;
695 u8 mode, freq, ee_mode, ant[2];
733 DBG(
"ath5k: TurboG not available on 5211\n");
742 DBG(
"ath5k: XR mode not available on 5211\n");
750 DBG(
"ath5k: invalid channel (%d MHz)\n",
755 if (change_channel) {
763 for (i = 0; i < 10; i++)
780 if (change_channel &&
ah->ah_rf_banks !=
NULL)
917 if (change_channel) {
919 for (i = 0; i < 10; i++)
1030 for (i = 0; i <= 20; i++) {
1061 ah->ah_calibration = 0;
1063 ah->ah_calibration = 1;
1074 DBG(
"ath5k: gain calibration timeout (%d MHz)\n",
1108 DBG(
"ath5k: failed to reset TX queue\n");
1150 if (
ah->ah_gpio[0] == 0)
#define AR5K_PHY_SHIFT_5GHZ
#define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF
#define AR5K_QOS_NOACK_BYTE_OFFSET
#define AR5K_TXCFG_SDMAMR
#define AR5K_PHY_RX_DELAY_M
#define AR5K_PHY_SETTLING
#define EINVAL
Invalid argument.
#define AR5K_PHY_MODE_RAD_RF5112
#define AR5K_TUNE_RSSI_THRES
#define AR5K_PHY_FRAME_CTL
#define AR5K_RATE_DUR(_n)
#define AR5K_PHY_TIMING_3
#define AR5K_PHY_TX_PWR_ADJ
static unsigned int unsigned int reg
#define AR5K_TXCFG_DCU_DBL_BUF_DIS
#define AR5K_EEPROM_VERSION_5_1
#define AR5K_EEPROM_MODE_11G
u16 ee_thr_62[AR5K_EEPROM_N_MODES]
s8 ee_adc_desired_size_turbo[AR5K_EEPROM_N_MODES]
#define AR5K_PHY_TST1_TXHOLD
#define AR5K_EEPROM_MODE_11A
#define AR5K_BEACON_ENABLE
#define AR5K_PHY_IQ_CORR_ENABLE
#define AR5K_BEACON_RESET_TSF
#define AR5K_PHY_PLL_40MHZ
int ath5k_hw_wake(struct ath5k_hw *ah)
#define AR5K_INI_RFGAIN_5GHZ
#define AR5K_PHY_PLL_44MHZ
#define AR5K_PHY_TIMING_3_DSC_MAN
u16 ee_false_detect[AR5K_EEPROM_N_MODES]
#define AR5K_INIT_CYCRSSI_THR1
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, int initial __unused)
#define AR5K_PCICFG_LEDSTATE
#define AR5K_PHY_DESIRED_SIZE_ADC
#define AR5K_PHY_AGCCTL_CAL
#define AR5K_SREV_PHY_5212B
u16 net80211_duration(struct net80211_device *dev, int bytes, u16 rate)
Calculate one frame's contribution to 802.11 duration field.
#define AR5K_PHY_BLUETOOTH
void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level)
int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
#define AR5K_PHY_MODE_MOD_DYN
s16 ee_noise_floor_thr[AR5K_EEPROM_N_MODES]
int ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah)
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
ath5k_hw_set_associd - Set BSSID for association
u16 ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES]
int ath5k_hw_reset(struct ath5k_hw *ah, struct net80211_channel *channel, int change_channel)
#define AR5K_PHY_NF_SVAL(_n)
ath5k_hw_get_isr - Get interrupt status
#define AR5K_USEC_RX_LATENCY_5210
#define AR5K_QOS_NOACK_BIT_OFFSET
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
#define AR5K_TUNE_DEFAULT_TXPOWER
#define AR5K_PHY_SCAL_32MHZ_HB63
#define AR5K_RESET_CTL_PCI
u16 rates[NET80211_NR_BANDS][NET80211_MAX_RATES]
List of transmission rates supported by the card, indexed by band.
int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
#define AR5K_PHY_PLL_RF5112
#define AR5K_PHY_ANT_CTL_TXRX_EN
int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct net80211_channel *channel, unsigned int mode)
s8 ee_adc_desired_size[AR5K_EEPROM_N_MODES]
#define AR5K_STA_ID1_BASE_RATE_11B
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
#define AR5K_PHY_ANT_SWITCH_TABLE_1
static unsigned int ath5k_hw_htoclock(unsigned int usec, int turbo)
#define __unused
Declare a variable or data structure as unused.
#define AR5K_STA_ID1_SELFGEN_DEF_ANT
#define AR5K_RESET_CTL_MAC
int nr_rates[NET80211_NR_BANDS]
Number of supported rates, indexed by band.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1
#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX
#define AR5K_PHY_TURBO_MODE
int ath5k_hw_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, struct net80211_channel *channel)
uint32_t channel
RNDIS channel.
#define AR5K_PHY_SCAL_32MHZ
#define EFAULT
Bad address.
static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)
#define AR5K_QOS_NOACK_2BIT_VALUES
int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
#define AR5K_STA_ID1_PWR_SV
#define AR5K_RESET_CTL_PCU
#define AR5K_EEPROM_VERSION_5_0
#define AR5K_PHY_MODE_MOD_CCK
#define AR5K_STA_ID1_RTS_DEF_ANTENNA
#define AR5K_PHY_MODE_FREQ_5GHZ
static int ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, struct net80211_channel *channel)
u16 ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES]
#define AR5K_RSSI_THR_BMISS_S
#define AR5K_QUEUE_DCU_SEQNUM(_q)
#define AR5K_PHY_FAST_ADC
u16 ee_margin_tx_rx_turbo[AR5K_EEPROM_N_MODES]
#define AR5K_SET_SHORT_PREAMBLE
#define AR5K_EEPROM_VERSION_4_1
#define AR5K_PHY_MODE_RAD_RF5111
#define AR5K_PHY_MODE_MOD_OFDM
#define AR5K_DEFAULT_ANTENNA
#define AR5K_PHY_HEAVY_CLIP_ENABLE
#define AR5K_EEPROM_MODE_11B
enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)
ath5k_hw_set_imr - Set interrupt mask
#define AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
#define AR5K_DIAG_SW_ECO_ENABLE
#define AR5K_PHY_SETTLING_SWITCH
#define AR5K_USEC_TX_LATENCY_5211
u16 ee_i_cal[AR5K_EEPROM_N_MODES]
#define AR5K_PHY_ADC_TEST
#define AR5K_PHY_ACT_DISABLE
u16 ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES]
#define PCI_CAP_ID_EXP
PCI Express.
#define AR5K_QCUDCU_CLKGT
#define AR5K_TXCFG_B_MODE
#define AR5K_PHY_TURBO_SHORT
s8 ee_pga_desired_size[AR5K_EEPROM_N_MODES]
#define AR5K_EEPROM_HDR_RFKILL(_v)
#define AR5K_PHY_ADC_CTL_PWD_ADC_OFF
#define AR5K_TUNE_BMISS_THRES
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
#define AR5K_PHY_DESIRED_SIZE_PGA
u16 ee_switch_settling_turbo[AR5K_EEPROM_N_MODES]
struct net80211_hw_info * hwinfo
#define AR5K_PHY_ANT_CTL_SWTABLE_IDLE
#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
ath5k_hw_set_opmode - Set PCU operating mode
#define AR5K_DIAG_SW_5211
#define AR5K_SREV_RAD_5112A
#define AR5K_PHY_IQ_CORR_Q_I_COFF_S
#define AR5K_PHY_TIMING_3_DSC_EXP
#define AR5K_STA_ID1_DESC_ANTENNA
#define AR5K_INI_RFGAIN_2GHZ
uint16_t delay
Forward delay.
#define AR5K_PHY_PLL_RF5111
u16 ee_margin_tx_rx[AR5K_EEPROM_N_MODES]
u16 ee_cck_ofdm_power_delta
#define EIO
Input/output error.
#define AR5K_PHY_PLL_40MHZ_5413
int ath5k_bitrate_to_hw_rix(int bitrate)
#define AR5K_STA_ID1_DEFAULT_ANTENNA
u16 ee_atn_tx_rx[AR5K_EEPROM_N_MODES]
u16 ee_atn_tx_rx_turbo[AR5K_EEPROM_N_MODES]
uint8_t data[48]
Additional event data.
#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON
static int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, struct net80211_channel *channel)
ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
#define AR5K_PHY_NF_THRESH62
#define AR5K_PHY_ANT_SWITCH_TABLE_0
#define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah)
#define AR5K_PHY_ADC_CTL_INBUFGAIN_ON
#define AR5K_PHY_SCAL_32MHZ_2417
#define AR5K_PCICFG_SPWR_DN
#define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX
#define AR5K_PHY_GAIN_2GHZ
struct net80211_device * dev
#define AR5K_PHY_CCKTXCTL_WORLD
#define AR5K_SREV_PHY_5212A
static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, struct net80211_channel *channel, u8 *ant, u8 ee_mode)
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
#define AR5K_PHY_DAG_CCK_CTL
#define AR5K_RESET_CTL_PHY
#define DBG(...)
Print a debugging message.
#define AR5K_PHY_DESIRED_SIZE
#define AR5K_RESET_CTL_DMA
int ath5k_hw_txpower(struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 txpower)
#define AR5K_PHY_DAG_CCK_CTL_RSSI_THR
u16 ee_cck_ofdm_gain_delta
#define AR5K_PHY_MODE_FREQ_2GHZ
#define AR5K_PHY_CCKTXCTL
#define NULL
NULL pointer (VOID *)
u16 ee_switch_settling[AR5K_EEPROM_N_MODES]
#define AR5K_PHY_GAIN_TXRX_ATTEN
#define AR5K_PHY_RX_DELAY
int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, int change_channel)
#define AR5K_PHY_ADC_CTL_PWD_DAC_OFF
static void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, unsigned int mode __unused)
ath5k_hw_write_rate_duration - fill rate code to duration table
#define AR5K_STA_ID1_ACKCTS_6MB
u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
#define AR5K_PHY_ACT_ENABLE
u16 ee_q_cal[AR5K_EEPROM_N_MODES]
#define AR5K_RXCFG_SDMAMW
s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES]
#define AR5K_RESET_CTL_BASEBAND
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
static const uint8_t r[3][4]
MD4 shift amounts.
#define AR5K_REG_SM(_val, _flags)
#define AR5K_PHY_OFDM_SELFCORR