Commit 143b11c0 authored by David S. Miller's avatar David S. Miller
parents af01d537 18c8adeb
...@@ -144,6 +144,7 @@ struct ath_desc { ...@@ -144,6 +144,7 @@ struct ath_desc {
#define ATH9K_TXDESC_EXT_AND_CTL 0x0080 #define ATH9K_TXDESC_EXT_AND_CTL 0x0080
#define ATH9K_TXDESC_VMF 0x0100 #define ATH9K_TXDESC_VMF 0x0100
#define ATH9K_TXDESC_FRAG_IS_ON 0x0200 #define ATH9K_TXDESC_FRAG_IS_ON 0x0200
#define ATH9K_TXDESC_CAB 0x0400
#define ATH9K_RXDESC_INTREQ 0x0020 #define ATH9K_RXDESC_INTREQ 0x0020
...@@ -564,8 +565,6 @@ enum ath9k_cipher { ...@@ -564,8 +565,6 @@ enum ath9k_cipher {
#define CTL_5GHT40 8 #define CTL_5GHT40 8
#define AR_EEPROM_MAC(i) (0x1d+(i)) #define AR_EEPROM_MAC(i) (0x1d+(i))
#define EEP_SCALE 100
#define EEP_DELTA 10
#define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c
#define AR_EEPROM_RFSILENT_GPIO_SEL_S 2 #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2
...@@ -606,9 +605,6 @@ struct ath9k_country_entry { ...@@ -606,9 +605,6 @@ struct ath9k_country_entry {
#define REG_CLR_BIT(_a, _r, _f) \ #define REG_CLR_BIT(_a, _r, _f) \
REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f) REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f)
#define ATH9K_COMP_BUF_MAX_SIZE 9216
#define ATH9K_COMP_BUF_ALIGN_SIZE 512
#define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001 #define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
#define INIT_AIFS 2 #define INIT_AIFS 2
...@@ -632,12 +628,6 @@ struct ath9k_country_entry { ...@@ -632,12 +628,6 @@ struct ath9k_country_entry {
(IEEE80211_WEP_IVLEN + \ (IEEE80211_WEP_IVLEN + \
IEEE80211_WEP_KIDLEN + \ IEEE80211_WEP_KIDLEN + \
IEEE80211_WEP_CRCLEN)) IEEE80211_WEP_CRCLEN))
#define IEEE80211_MAX_LEN (2300 + FCS_LEN + \
(IEEE80211_WEP_IVLEN + \
IEEE80211_WEP_KIDLEN + \
IEEE80211_WEP_CRCLEN))
#define MAX_REG_ADD_COUNT 129
#define MAX_RATE_POWER 63 #define MAX_RATE_POWER 63
enum ath9k_power_mode { enum ath9k_power_mode {
...@@ -707,13 +697,6 @@ enum phytype { ...@@ -707,13 +697,6 @@ enum phytype {
}; };
#define PHY_CCK PHY_DS #define PHY_CCK PHY_DS
enum start_adhoc_option {
START_ADHOC_NO_11A,
START_ADHOC_PER_11D,
START_ADHOC_IN_11A,
START_ADHOC_IN_11B,
};
enum ath9k_tp_scale { enum ath9k_tp_scale {
ATH9K_TP_SCALE_MAX = 0, ATH9K_TP_SCALE_MAX = 0,
ATH9K_TP_SCALE_50, ATH9K_TP_SCALE_50,
...@@ -769,14 +752,11 @@ struct ath9k_node_stats { ...@@ -769,14 +752,11 @@ struct ath9k_node_stats {
#define ATH9K_RSSI_EP_MULTIPLIER (1<<7) #define ATH9K_RSSI_EP_MULTIPLIER (1<<7)
enum ath9k_gpio_output_mux_type { #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
ATH9K_GPIO_OUTPUT_MUX_AS_OUTPUT, #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
ATH9K_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED, #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2
ATH9K_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED, #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5
ATH9K_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED, #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6
ATH9K_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED,
ATH9K_GPIO_OUTPUT_MUX_NUM_ENTRIES
};
enum { enum {
ATH9K_RESET_POWER_ON, ATH9K_RESET_POWER_ON,
...@@ -790,19 +770,20 @@ struct ath_hal { ...@@ -790,19 +770,20 @@ struct ath_hal {
u32 ah_magic; u32 ah_magic;
u16 ah_devid; u16 ah_devid;
u16 ah_subvendorid; u16 ah_subvendorid;
struct ath_softc *ah_sc;
void __iomem *ah_sh;
u16 ah_countryCode;
u32 ah_macVersion; u32 ah_macVersion;
u16 ah_macRev; u16 ah_macRev;
u16 ah_phyRev; u16 ah_phyRev;
u16 ah_analog5GhzRev; u16 ah_analog5GhzRev;
u16 ah_analog2GhzRev; u16 ah_analog2GhzRev;
u8 ah_decompMask[ATH9K_DECOMP_MASK_SIZE];
u32 ah_flags; void __iomem *ah_sh;
struct ath_softc *ah_sc;
enum ath9k_opmode ah_opmode; enum ath9k_opmode ah_opmode;
struct ath9k_ops_config ah_config; struct ath9k_ops_config ah_config;
struct ath9k_hw_capabilities ah_caps; struct ath9k_hw_capabilities ah_caps;
u16 ah_countryCode;
u32 ah_flags;
int16_t ah_powerLimit; int16_t ah_powerLimit;
u16 ah_maxPowerLevel; u16 ah_maxPowerLevel;
u32 ah_tpScale; u32 ah_tpScale;
...@@ -812,15 +793,16 @@ struct ath_hal { ...@@ -812,15 +793,16 @@ struct ath_hal {
u16 ah_currentRD5G; u16 ah_currentRD5G;
u16 ah_currentRD2G; u16 ah_currentRD2G;
char ah_iso[4]; char ah_iso[4];
enum start_adhoc_option ah_adHocMode;
bool ah_commonMode;
struct ath9k_channel ah_channels[150]; struct ath9k_channel ah_channels[150];
u32 ah_nchan;
struct ath9k_channel *ah_curchan; struct ath9k_channel *ah_curchan;
u32 ah_nchan;
u16 ah_rfsilent; u16 ah_rfsilent;
bool ah_rfkillEnabled; bool ah_rfkillEnabled;
bool ah_isPciExpress; bool ah_isPciExpress;
u16 ah_txTrigLevel; u16 ah_txTrigLevel;
#ifndef ATH_NF_PER_CHAN #ifndef ATH_NF_PER_CHAN
struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
#endif #endif
...@@ -853,7 +835,7 @@ bool ath9k_regd_init_channels(struct ath_hal *ah, ...@@ -853,7 +835,7 @@ bool ath9k_regd_init_channels(struct ath_hal *ah,
u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags); u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags);
enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah,
enum ath9k_int ints); enum ath9k_int ints);
bool ath9k_hw_reset(struct ath_hal *ah, enum ath9k_opmode opmode, bool ath9k_hw_reset(struct ath_hal *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan,
enum ath9k_ht_macmode macmode, enum ath9k_ht_macmode macmode,
u8 txchainmask, u8 rxchainmask, u8 txchainmask, u8 rxchainmask,
...@@ -1018,4 +1000,7 @@ void ath9k_hw_get_channel_centers(struct ath_hal *ah, ...@@ -1018,4 +1000,7 @@ void ath9k_hw_get_channel_centers(struct ath_hal *ah,
bool ath9k_get_channel_edges(struct ath_hal *ah, bool ath9k_get_channel_edges(struct ath_hal *ah,
u16 flags, u16 *low, u16 flags, u16 *low,
u16 *high); u16 *high);
void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio,
u32 ah_signal_type);
void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 value);
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -314,14 +314,11 @@ struct ar5416_desc { ...@@ -314,14 +314,11 @@ struct ar5416_desc {
#define RXSTATUS_RATE(ah, ads) (AR_SREV_5416_V20_OR_LATER(ah) ? \ #define RXSTATUS_RATE(ah, ads) (AR_SREV_5416_V20_OR_LATER(ah) ? \
MS(ads->ds_rxstatus0, AR_RxRate) : \ MS(ads->ds_rxstatus0, AR_RxRate) : \
(ads->ds_rxstatus3 >> 2) & 0xFF) (ads->ds_rxstatus3 >> 2) & 0xFF)
#define RXSTATUS_DUPLICATE(ah, ads) (AR_SREV_5416_V20_OR_LATER(ah) ? \
MS(ads->ds_rxstatus3, AR_Parallel40) : \
(ads->ds_rxstatus3 >> 10) & 0x1)
#define set11nTries(_series, _index) \ #define set11nTries(_series, _index) \
(SM((_series)[_index].Tries, AR_XmitDataTries##_index)) (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
#define set11nRate(_series, _index) \ #define set11nRate(_series, _index) \
(SM((_series)[_index].Rate, AR_XmitRate##_index)) (SM((_series)[_index].Rate, AR_XmitRate##_index))
#define set11nPktDurRTSCTS(_series, _index) \ #define set11nPktDurRTSCTS(_series, _index) \
...@@ -330,11 +327,11 @@ struct ar5416_desc { ...@@ -330,11 +327,11 @@ struct ar5416_desc {
AR_RTSCTSQual##_index : 0)) AR_RTSCTSQual##_index : 0))
#define set11nRateFlags(_series, _index) \ #define set11nRateFlags(_series, _index) \
(((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ? \ (((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ? \
AR_2040_##_index : 0) \ AR_2040_##_index : 0) \
|((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ? \ |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ? \
AR_GI##_index : 0) \ AR_GI##_index : 0) \
|SM((_series)[_index].ChSel, AR_ChainSel##_index)) |SM((_series)[_index].ChSel, AR_ChainSel##_index))
#define AR_SREV_9100(ah) ((ah->ah_macVersion) == AR_SREV_VERSION_9100) #define AR_SREV_9100(ah) ((ah->ah_macVersion) == AR_SREV_VERSION_9100)
...@@ -346,9 +343,6 @@ struct ar5416_desc { ...@@ -346,9 +343,6 @@ struct ar5416_desc {
#define MAX_TX_FIFO_THRESHOLD ((4096 / 64) - 1) #define MAX_TX_FIFO_THRESHOLD ((4096 / 64) - 1)
#define INIT_TX_FIFO_THRESHOLD MIN_TX_FIFO_THRESHOLD #define INIT_TX_FIFO_THRESHOLD MIN_TX_FIFO_THRESHOLD
#define NUM_CORNER_FIX_BITS_2133 7
#define CCK_OFDM_GAIN_DELTA 15
struct ar5416AniState { struct ar5416AniState {
struct ath9k_channel c; struct ath9k_channel c;
u8 noiseImmunityLevel; u8 noiseImmunityLevel;
...@@ -377,11 +371,8 @@ struct ar5416AniState { ...@@ -377,11 +371,8 @@ struct ar5416AniState {
}; };
#define HAL_PROCESS_ANI 0x00000001 #define HAL_PROCESS_ANI 0x00000001
#define HAL_RADAR_EN 0x80000000
#define HAL_AR_EN 0x40000000
#define DO_ANI(ah) \ #define DO_ANI(ah) \
((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI)) ((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI))
struct ar5416Stats { struct ar5416Stats {
u32 ast_ani_niup; u32 ast_ani_niup;
...@@ -425,7 +416,6 @@ struct ar5416Stats { ...@@ -425,7 +416,6 @@ struct ar5416Stats {
#define AR5416_EEP_MINOR_VER_7 0x7 #define AR5416_EEP_MINOR_VER_7 0x7
#define AR5416_EEP_MINOR_VER_9 0x9 #define AR5416_EEP_MINOR_VER_9 0x9
#define AR5416_EEP_START_LOC 256
#define AR5416_NUM_5G_CAL_PIERS 8 #define AR5416_NUM_5G_CAL_PIERS 8
#define AR5416_NUM_2G_CAL_PIERS 4 #define AR5416_NUM_2G_CAL_PIERS 4
#define AR5416_NUM_5G_20_TARGET_POWERS 8 #define AR5416_NUM_5G_20_TARGET_POWERS 8
...@@ -441,25 +431,10 @@ struct ar5416Stats { ...@@ -441,25 +431,10 @@ struct ar5416Stats {
#define AR5416_EEPROM_MODAL_SPURS 5 #define AR5416_EEPROM_MODAL_SPURS 5
#define AR5416_MAX_RATE_POWER 63 #define AR5416_MAX_RATE_POWER 63
#define AR5416_NUM_PDADC_VALUES 128 #define AR5416_NUM_PDADC_VALUES 128
#define AR5416_NUM_RATES 16
#define AR5416_BCHAN_UNUSED 0xFF #define AR5416_BCHAN_UNUSED 0xFF
#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
#define AR5416_EEPMISC_BIG_ENDIAN 0x01
#define AR5416_MAX_CHAINS 3 #define AR5416_MAX_CHAINS 3
#define AR5416_ANT_16S 25
#define AR5416_NUM_ANT_CHAIN_FIELDS 7
#define AR5416_NUM_ANT_COMMON_FIELDS 4
#define AR5416_SIZE_ANT_CHAIN_FIELD 3
#define AR5416_SIZE_ANT_COMMON_FIELD 4
#define AR5416_ANT_CHAIN_MASK 0x7
#define AR5416_ANT_COMMON_MASK 0xf
#define AR5416_CHAIN_0_IDX 0
#define AR5416_CHAIN_1_IDX 1
#define AR5416_CHAIN_2_IDX 2
#define AR5416_PWR_TABLE_OFFSET -5 #define AR5416_PWR_TABLE_OFFSET -5
#define AR5416_LEGACY_CHAINMASK 1
enum eeprom_param { enum eeprom_param {
EEP_NFTHRESH_5, EEP_NFTHRESH_5,
...@@ -633,7 +608,7 @@ struct ar5416IniArray { ...@@ -633,7 +608,7 @@ struct ar5416IniArray {
}; };
#define INIT_INI_ARRAY(iniarray, array, rows, columns) do { \ #define INIT_INI_ARRAY(iniarray, array, rows, columns) do { \
(iniarray)->ia_array = (u32 *)(array); \ (iniarray)->ia_array = (u32 *)(array); \
(iniarray)->ia_rows = (rows); \ (iniarray)->ia_rows = (rows); \
(iniarray)->ia_columns = (columns); \ (iniarray)->ia_columns = (columns); \
} while (0) } while (0)
...@@ -641,16 +616,16 @@ struct ar5416IniArray { ...@@ -641,16 +616,16 @@ struct ar5416IniArray {
#define INI_RA(iniarray, row, column) \ #define INI_RA(iniarray, row, column) \
(((iniarray)->ia_array)[(row) * ((iniarray)->ia_columns) + (column)]) (((iniarray)->ia_array)[(row) * ((iniarray)->ia_columns) + (column)])
#define INIT_CAL(_perCal) do { \ #define INIT_CAL(_perCal) do { \
(_perCal)->calState = CAL_WAITING; \ (_perCal)->calState = CAL_WAITING; \
(_perCal)->calNext = NULL; \ (_perCal)->calNext = NULL; \
} while (0) } while (0)
#define INSERT_CAL(_ahp, _perCal) \ #define INSERT_CAL(_ahp, _perCal) \
do { \ do { \
if ((_ahp)->ah_cal_list_last == NULL) { \ if ((_ahp)->ah_cal_list_last == NULL) { \
(_ahp)->ah_cal_list = \ (_ahp)->ah_cal_list = \
(_ahp)->ah_cal_list_last = (_perCal); \ (_ahp)->ah_cal_list_last = (_perCal); \
((_ahp)->ah_cal_list_last)->calNext = (_perCal); \ ((_ahp)->ah_cal_list_last)->calNext = (_perCal); \
} else { \ } else { \
((_ahp)->ah_cal_list_last)->calNext = (_perCal); \ ((_ahp)->ah_cal_list_last)->calNext = (_perCal); \
...@@ -696,25 +671,29 @@ struct hal_cal_list { ...@@ -696,25 +671,29 @@ struct hal_cal_list {
struct ath_hal_5416 { struct ath_hal_5416 {
struct ath_hal ah; struct ath_hal ah;
struct ar5416_eeprom ah_eeprom; struct ar5416_eeprom ah_eeprom;
struct ar5416Stats ah_stats;
struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
void __iomem *ah_cal_mem;
u8 ah_macaddr[ETH_ALEN]; u8 ah_macaddr[ETH_ALEN];
u8 ah_bssid[ETH_ALEN]; u8 ah_bssid[ETH_ALEN];
u8 ah_bssidmask[ETH_ALEN]; u8 ah_bssidmask[ETH_ALEN];
u16 ah_assocId; u16 ah_assocId;
int16_t ah_curchanRadIndex; int16_t ah_curchanRadIndex;
u32 ah_maskReg; u32 ah_maskReg;
struct ar5416Stats ah_stats;
u32 ah_txDescMask;
u32 ah_txOkInterruptMask; u32 ah_txOkInterruptMask;
u32 ah_txErrInterruptMask; u32 ah_txErrInterruptMask;
u32 ah_txDescInterruptMask; u32 ah_txDescInterruptMask;
u32 ah_txEolInterruptMask; u32 ah_txEolInterruptMask;
u32 ah_txUrnInterruptMask; u32 ah_txUrnInterruptMask;
struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
enum ath9k_power_mode ah_powerMode;
bool ah_chipFullSleep; bool ah_chipFullSleep;
u32 ah_atimWindow; u32 ah_atimWindow;
enum ath9k_ant_setting ah_diversityControl;
u16 ah_antennaSwitchSwap; u16 ah_antennaSwitchSwap;
enum ath9k_power_mode ah_powerMode;
enum ath9k_ant_setting ah_diversityControl;
/* Calibration */
enum hal_cal_types ah_suppCals; enum hal_cal_types ah_suppCals;
struct hal_cal_list ah_iqCalData; struct hal_cal_list ah_iqCalData;
struct hal_cal_list ah_adcGainCalData; struct hal_cal_list ah_adcGainCalData;
...@@ -751,16 +730,16 @@ struct ath_hal_5416 { ...@@ -751,16 +730,16 @@ struct ath_hal_5416 {
int32_t sign[AR5416_MAX_CHAINS]; int32_t sign[AR5416_MAX_CHAINS];
} ah_Meas3; } ah_Meas3;
u16 ah_CalSamples; u16 ah_CalSamples;
u32 ah_tx6PowerInHalfDbm;
u32 ah_staId1Defaults; u32 ah_staId1Defaults;
u32 ah_miscMode; u32 ah_miscMode;
bool ah_tpcEnabled;
u32 ah_beaconInterval;
enum { enum {
AUTO_32KHZ, AUTO_32KHZ,
USE_32KHZ, USE_32KHZ,
DONT_USE_32KHZ, DONT_USE_32KHZ,
} ah_enable32kHzClock; } ah_enable32kHzClock;
/* RF */
u32 *ah_analogBank0Data; u32 *ah_analogBank0Data;
u32 *ah_analogBank1Data; u32 *ah_analogBank1Data;
u32 *ah_analogBank2Data; u32 *ah_analogBank2Data;
...@@ -770,8 +749,9 @@ struct ath_hal_5416 { ...@@ -770,8 +749,9 @@ struct ath_hal_5416 {
u32 *ah_analogBank7Data; u32 *ah_analogBank7Data;
u32 *ah_addac5416_21; u32 *ah_addac5416_21;
u32 *ah_bank6Temp; u32 *ah_bank6Temp;
u32 ah_ofdmTxPower;
int16_t ah_txPowerIndexOffset; int16_t ah_txPowerIndexOffset;
u32 ah_beaconInterval;
u32 ah_slottime; u32 ah_slottime;
u32 ah_acktimeout; u32 ah_acktimeout;
u32 ah_ctstimeout; u32 ah_ctstimeout;
...@@ -780,7 +760,8 @@ struct ath_hal_5416 { ...@@ -780,7 +760,8 @@ struct ath_hal_5416 {
u32 ah_gpioSelect; u32 ah_gpioSelect;
u32 ah_polarity; u32 ah_polarity;
u32 ah_gpioBit; u32 ah_gpioBit;
bool ah_eepEnabled;
/* ANI */
u32 ah_procPhyErr; u32 ah_procPhyErr;
bool ah_hasHwPhyCounters; bool ah_hasHwPhyCounters;
u32 ah_aniPeriod; u32 ah_aniPeriod;
...@@ -790,18 +771,14 @@ struct ath_hal_5416 { ...@@ -790,18 +771,14 @@ struct ath_hal_5416 {
int ah_coarseHigh[5]; int ah_coarseHigh[5];
int ah_coarseLow[5]; int ah_coarseLow[5];
int ah_firpwr[5]; int ah_firpwr[5];
u16 ah_ratesArray[16]; enum ath9k_ani_cmd ah_ani_function;
u32 ah_intrTxqs; u32 ah_intrTxqs;
bool ah_intrMitigation; bool ah_intrMitigation;
u32 ah_cycleCount;
u32 ah_ctlBusy;
u32 ah_extBusy;
enum ath9k_ht_extprotspacing ah_extprotspacing; enum ath9k_ht_extprotspacing ah_extprotspacing;
u8 ah_txchainmask; u8 ah_txchainmask;
u8 ah_rxchainmask; u8 ah_rxchainmask;
int ah_hwp;
void __iomem *ah_cal_mem;
enum ath9k_ani_cmd ah_ani_function;
struct ar5416IniArray ah_iniModes; struct ar5416IniArray ah_iniModes;
struct ar5416IniArray ah_iniCommon; struct ar5416IniArray ah_iniCommon;
struct ar5416IniArray ah_iniBank0; struct ar5416IniArray ah_iniBank0;
...@@ -820,10 +797,6 @@ struct ath_hal_5416 { ...@@ -820,10 +797,6 @@ struct ath_hal_5416 {
#define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
#define IS_5416_EMU(ah) \
((ah->ah_devid == AR5416_DEVID_EMU) || \
(ah->ah_devid == AR5416_DEVID_EMU_PCIE))
#define ar5416RfDetach(ah) do { \ #define ar5416RfDetach(ah) do { \
if (AH5416(ah)->ah_rfHal.rfDetach != NULL) \ if (AH5416(ah)->ah_rfHal.rfDetach != NULL) \
AH5416(ah)->ah_rfHal.rfDetach(ah); \ AH5416(ah)->ah_rfHal.rfDetach(ah); \
...@@ -841,8 +814,8 @@ struct ath_hal_5416 { ...@@ -841,8 +814,8 @@ struct ath_hal_5416 {
#define REG_WRITE_ARRAY(iniarray, column, regWr) do { \ #define REG_WRITE_ARRAY(iniarray, column, regWr) do { \
int r; \ int r; \
for (r = 0; r < ((iniarray)->ia_rows); r++) { \ for (r = 0; r < ((iniarray)->ia_rows); r++) { \
REG_WRITE(ah, INI_RA((iniarray), (r), 0), \ REG_WRITE(ah, INI_RA((iniarray), (r), 0), \
INI_RA((iniarray), r, (column))); \ INI_RA((iniarray), r, (column))); \
DO_DELAY(regWr); \ DO_DELAY(regWr); \
} \ } \
} while (0) } while (0)
...@@ -852,30 +825,21 @@ struct ath_hal_5416 { ...@@ -852,30 +825,21 @@ struct ath_hal_5416 {
#define COEF_SCALE_S 24 #define COEF_SCALE_S 24
#define HT40_CHANNEL_CENTER_SHIFT 10 #define HT40_CHANNEL_CENTER_SHIFT 10
#define ar5416CheckOpMode(_opmode) \
((_opmode == ATH9K_M_STA) || (_opmode == ATH9K_M_IBSS) || \
(_opmode == ATH9K_M_HOSTAP) || (_opmode == ATH9K_M_MONITOR))
#define AR5416_EEPROM_MAGIC_OFFSET 0x0 #define AR5416_EEPROM_MAGIC_OFFSET 0x0
#define AR5416_EEPROM_S 2 #define AR5416_EEPROM_S 2
#define AR5416_EEPROM_OFFSET 0x2000 #define AR5416_EEPROM_OFFSET 0x2000
#define AR5416_EEPROM_START_ADDR \ #define AR5416_EEPROM_START_ADDR \
(AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200 (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200
#define AR5416_EEPROM_MAX 0xae0 #define AR5416_EEPROM_MAX 0xae0
#define ar5416_get_eep_ver(_ahp) \ #define ar5416_get_eep_ver(_ahp) \
(((_ahp)->ah_eeprom.baseEepHeader.version >> 12) & 0xF) (((_ahp)->ah_eeprom.baseEepHeader.version >> 12) & 0xF)
#define ar5416_get_eep_rev(_ahp) \ #define ar5416_get_eep_rev(_ahp) \
(((_ahp)->ah_eeprom.baseEepHeader.version) & 0xFFF) (((_ahp)->ah_eeprom.baseEepHeader.version) & 0xFFF)
#define ar5416_get_ntxchains(_txchainmask) \ #define ar5416_get_ntxchains(_txchainmask) \
(((_txchainmask >> 2) & 1) + \ (((_txchainmask >> 2) & 1) + \
((_txchainmask >> 1) & 1) + (_txchainmask & 1)) ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
#define IS_EEP_MINOR_V3(_ahp) \
(ath9k_hw_get_eeprom((_ahp), EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_3)
#define FIXED_CCA_THRESHOLD 15
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
#define AR5416_EEPROM_MAGIC 0x5aa5 #define AR5416_EEPROM_MAGIC 0x5aa5
#else #else
...@@ -910,8 +874,6 @@ struct ath_hal_5416 { ...@@ -910,8 +874,6 @@ struct ath_hal_5416 {
#define AR_GPIOD_MASK 0x00001FFF #define AR_GPIOD_MASK 0x00001FFF
#define AR_GPIO_BIT(_gpio) (1 << (_gpio)) #define AR_GPIO_BIT(_gpio) (1 << (_gpio))
#define MAX_ANALOG_START 319
#define HAL_EP_RND(x, mul) \ #define HAL_EP_RND(x, mul) \
((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
#define BEACON_RSSI(ahp) \ #define BEACON_RSSI(ahp) \
...@@ -923,8 +885,6 @@ struct ath_hal_5416 { ...@@ -923,8 +885,6 @@ struct ath_hal_5416 {
#define AH_TIMEOUT 100000 #define AH_TIMEOUT 100000
#define AH_TIME_QUANTUM 10 #define AH_TIME_QUANTUM 10
#define IS(_c, _f) (((_c)->channelFlags & _f) || 0)
#define AR_KEYTABLE_SIZE 128 #define AR_KEYTABLE_SIZE 128
#define POWER_UP_TIME 200000 #define POWER_UP_TIME 200000
...@@ -964,6 +924,6 @@ struct ath_hal_5416 { ...@@ -964,6 +924,6 @@ struct ath_hal_5416 {
#define OFDM_SYMBOL_TIME_QUARTER 16 #define OFDM_SYMBOL_TIME_QUARTER 16
u32 ath9k_hw_get_eeprom(struct ath_hal_5416 *ahp, u32 ath9k_hw_get_eeprom(struct ath_hal_5416 *ahp,
enum eeprom_param param); enum eeprom_param param);
#endif #endif
This diff is collapsed.
...@@ -18,19 +18,19 @@ ...@@ -18,19 +18,19 @@
#define PHY_H #define PHY_H
bool ath9k_hw_ar9280_set_channel(struct ath_hal *ah, bool ath9k_hw_ar9280_set_channel(struct ath_hal *ah,
struct ath9k_channel struct ath9k_channel
*chan); *chan);
bool ath9k_hw_set_channel(struct ath_hal *ah, bool ath9k_hw_set_channel(struct ath_hal *ah,
struct ath9k_channel *chan); struct ath9k_channel *chan);
void ath9k_hw_write_regs(struct ath_hal *ah, u32 modesIndex, void ath9k_hw_write_regs(struct ath_hal *ah, u32 modesIndex,
u32 freqIndex, int regWrites); u32 freqIndex, int regWrites);
bool ath9k_hw_set_rf_regs(struct ath_hal *ah, bool ath9k_hw_set_rf_regs(struct ath_hal *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan,
u16 modesIndex); u16 modesIndex);
void ath9k_hw_decrease_chain_power(struct ath_hal *ah, void ath9k_hw_decrease_chain_power(struct ath_hal *ah,
struct ath9k_channel *chan); struct ath9k_channel *chan);
bool ath9k_hw_init_rf(struct ath_hal *ah, bool ath9k_hw_init_rf(struct ath_hal *ah,
int *status); int *status);
#define AR_PHY_BASE 0x9800 #define AR_PHY_BASE 0x9800
#define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2)) #define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2))
......
This diff is collapsed.
This diff is collapsed.
...@@ -184,7 +184,7 @@ static int ath_ampdu_input(struct ath_softc *sc, ...@@ -184,7 +184,7 @@ static int ath_ampdu_input(struct ath_softc *sc,
tid = qc[0] & 0xf; tid = qc[0] & 0xf;
} }
if (sc->sc_opmode == ATH9K_M_STA) { if (sc->sc_ah->ah_opmode == ATH9K_M_STA) {
/* Drop the frame not belonging to me. */ /* Drop the frame not belonging to me. */
if (memcmp(hdr->addr1, sc->sc_myaddr, ETH_ALEN)) { if (memcmp(hdr->addr1, sc->sc_myaddr, ETH_ALEN)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
...@@ -448,17 +448,16 @@ static int ath_rx_indicate(struct ath_softc *sc, ...@@ -448,17 +448,16 @@ static int ath_rx_indicate(struct ath_softc *sc,
int type; int type;
/* indicate frame to the stack, which will free the old skb. */ /* indicate frame to the stack, which will free the old skb. */
type = ath__rx_indicate(sc, skb, status, keyix); type = _ath_rx_indicate(sc, skb, status, keyix);
/* allocate a new skb and queue it to for H/W processing */ /* allocate a new skb and queue it to for H/W processing */
nskb = ath_rxbuf_alloc(sc, sc->sc_rxbufsize); nskb = ath_rxbuf_alloc(sc, sc->sc_rxbufsize);
if (nskb != NULL) { if (nskb != NULL) {
bf->bf_mpdu = nskb; bf->bf_mpdu = nskb;
bf->bf_buf_addr = ath_skb_map_single(sc, bf->bf_buf_addr = pci_map_single(sc->pdev, nskb->data,
nskb, skb_end_pointer(nskb) - nskb->head,
PCI_DMA_FROMDEVICE, PCI_DMA_FROMDEVICE);
/* XXX: Remove get_dma_mem_context() */ bf->bf_dmacontext = bf->bf_buf_addr;
get_dma_mem_context(bf, bf_dmacontext));
ATH_RX_CONTEXT(nskb)->ctx_rxbuf = bf; ATH_RX_CONTEXT(nskb)->ctx_rxbuf = bf;
/* queue the new wbuf to H/W */ /* queue the new wbuf to H/W */
...@@ -504,7 +503,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) ...@@ -504,7 +503,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
do { do {
spin_lock_init(&sc->sc_rxflushlock); spin_lock_init(&sc->sc_rxflushlock);
sc->sc_rxflush = 0; sc->sc_flags &= ~SC_OP_RXFLUSH;
spin_lock_init(&sc->sc_rxbuflock); spin_lock_init(&sc->sc_rxbuflock);
/* /*
...@@ -541,9 +540,10 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) ...@@ -541,9 +540,10 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
} }
bf->bf_mpdu = skb; bf->bf_mpdu = skb;
bf->bf_buf_addr = bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data,
ath_skb_map_single(sc, skb, PCI_DMA_FROMDEVICE, skb_end_pointer(skb) - skb->head,
get_dma_mem_context(bf, bf_dmacontext)); PCI_DMA_FROMDEVICE);
bf->bf_dmacontext = bf->bf_buf_addr;
ATH_RX_CONTEXT(skb)->ctx_rxbuf = bf; ATH_RX_CONTEXT(skb)->ctx_rxbuf = bf;
} }
sc->sc_rxlink = NULL; sc->sc_rxlink = NULL;
...@@ -597,6 +597,7 @@ void ath_rx_cleanup(struct ath_softc *sc) ...@@ -597,6 +597,7 @@ void ath_rx_cleanup(struct ath_softc *sc)
u32 ath_calcrxfilter(struct ath_softc *sc) u32 ath_calcrxfilter(struct ath_softc *sc)
{ {
#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
u32 rfilt; u32 rfilt;
rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE) rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE)
...@@ -604,25 +605,29 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ...@@ -604,25 +605,29 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
| ATH9K_RX_FILTER_MCAST; | ATH9K_RX_FILTER_MCAST;
/* If not a STA, enable processing of Probe Requests */ /* If not a STA, enable processing of Probe Requests */
if (sc->sc_opmode != ATH9K_M_STA) if (sc->sc_ah->ah_opmode != ATH9K_M_STA)
rfilt |= ATH9K_RX_FILTER_PROBEREQ; rfilt |= ATH9K_RX_FILTER_PROBEREQ;
/* Can't set HOSTAP into promiscous mode */ /* Can't set HOSTAP into promiscous mode */
if (sc->sc_opmode == ATH9K_M_MONITOR) { if (((sc->sc_ah->ah_opmode != ATH9K_M_HOSTAP) &&
(sc->rx_filter & FIF_PROMISC_IN_BSS)) ||
(sc->sc_ah->ah_opmode == ATH9K_M_MONITOR)) {
rfilt |= ATH9K_RX_FILTER_PROM; rfilt |= ATH9K_RX_FILTER_PROM;
/* ??? To prevent from sending ACK */ /* ??? To prevent from sending ACK */
rfilt &= ~ATH9K_RX_FILTER_UCAST; rfilt &= ~ATH9K_RX_FILTER_UCAST;
} }
if (sc->sc_opmode == ATH9K_M_STA || sc->sc_opmode == ATH9K_M_IBSS || if (((sc->sc_ah->ah_opmode == ATH9K_M_STA) &&
sc->sc_scanning) (sc->rx_filter & FIF_BCN_PRBRESP_PROMISC)) ||
(sc->sc_ah->ah_opmode == ATH9K_M_IBSS))
rfilt |= ATH9K_RX_FILTER_BEACON; rfilt |= ATH9K_RX_FILTER_BEACON;
/* If in HOSTAP mode, want to enable reception of PSPOLL frames /* If in HOSTAP mode, want to enable reception of PSPOLL frames
& beacon frames */ & beacon frames */
if (sc->sc_opmode == ATH9K_M_HOSTAP) if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP)
rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL);
return rfilt; return rfilt;
#undef RX_FILTER_PRESERVE #undef RX_FILTER_PRESERVE
} }
...@@ -702,11 +707,11 @@ void ath_flushrecv(struct ath_softc *sc) ...@@ -702,11 +707,11 @@ void ath_flushrecv(struct ath_softc *sc)
* progress (see references to sc_rxflush) * progress (see references to sc_rxflush)
*/ */
spin_lock_bh(&sc->sc_rxflushlock); spin_lock_bh(&sc->sc_rxflushlock);
sc->sc_rxflush = 1; sc->sc_flags |= SC_OP_RXFLUSH;
ath_rx_tasklet(sc, 1); ath_rx_tasklet(sc, 1);
sc->sc_rxflush = 0; sc->sc_flags &= ~SC_OP_RXFLUSH;
spin_unlock_bh(&sc->sc_rxflushlock); spin_unlock_bh(&sc->sc_rxflushlock);
} }
...@@ -719,7 +724,7 @@ int ath_rx_input(struct ath_softc *sc, ...@@ -719,7 +724,7 @@ int ath_rx_input(struct ath_softc *sc,
struct ath_recv_status *rx_status, struct ath_recv_status *rx_status,
enum ATH_RX_TYPE *status) enum ATH_RX_TYPE *status)
{ {
if (is_ampdu && sc->sc_rxaggr) { if (is_ampdu && (sc->sc_flags & SC_OP_RXAGGR)) {
*status = ATH_RX_CONSUMED; *status = ATH_RX_CONSUMED;
return ath_ampdu_input(sc, an, skb, rx_status); return ath_ampdu_input(sc, an, skb, rx_status);
} else { } else {
...@@ -750,7 +755,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) ...@@ -750,7 +755,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
do { do {
/* If handling rx interrupt and flush is in progress => exit */ /* If handling rx interrupt and flush is in progress => exit */
if (sc->sc_rxflush && (flush == 0)) if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0))
break; break;
spin_lock_bh(&sc->sc_rxbuflock); spin_lock_bh(&sc->sc_rxbuflock);
...@@ -900,7 +905,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) ...@@ -900,7 +905,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
* Enable this if you want to see * Enable this if you want to see
* error frames in Monitor mode. * error frames in Monitor mode.
*/ */
if (sc->sc_opmode != ATH9K_M_MONITOR) if (sc->sc_ah->ah_opmode != ATH9K_M_MONITOR)
goto rx_next; goto rx_next;
#endif #endif
/* fall thru for monitor mode handling... */ /* fall thru for monitor mode handling... */
...@@ -945,7 +950,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) ...@@ -945,7 +950,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
* decryption and MIC failures. For monitor mode, * decryption and MIC failures. For monitor mode,
* we also ignore the CRC error. * we also ignore the CRC error.
*/ */
if (sc->sc_opmode == ATH9K_M_MONITOR) { if (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR) {
if (ds->ds_rxstat.rs_status & if (ds->ds_rxstat.rs_status &
~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
ATH9K_RXERR_CRC)) ATH9K_RXERR_CRC))
...@@ -1089,7 +1094,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) ...@@ -1089,7 +1094,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
"%s: Reset rx chain mask. " "%s: Reset rx chain mask. "
"Do internal reset\n", __func__); "Do internal reset\n", __func__);
ASSERT(flush == 0); ASSERT(flush == 0);
ath_internal_reset(sc); ath_reset(sc, false);
} }
return 0; return 0;
...@@ -1127,7 +1132,7 @@ int ath_rx_aggr_start(struct ath_softc *sc, ...@@ -1127,7 +1132,7 @@ int ath_rx_aggr_start(struct ath_softc *sc,
rxtid = &an->an_aggr.rx.tid[tid]; rxtid = &an->an_aggr.rx.tid[tid];
spin_lock_bh(&rxtid->tidlock); spin_lock_bh(&rxtid->tidlock);
if (sc->sc_rxaggr) { if (sc->sc_flags & SC_OP_RXAGGR) {
/* Allow aggregation reception /* Allow aggregation reception
* Adjust rx BA window size. Peer might indicate a * Adjust rx BA window size. Peer might indicate a
* zero buffer size for a _dont_care_ condition. * zero buffer size for a _dont_care_ condition.
...@@ -1227,7 +1232,7 @@ void ath_rx_aggr_teardown(struct ath_softc *sc, ...@@ -1227,7 +1232,7 @@ void ath_rx_aggr_teardown(struct ath_softc *sc,
void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an)
{ {
if (sc->sc_rxaggr) { if (sc->sc_flags & SC_OP_RXAGGR) {
struct ath_arx_tid *rxtid; struct ath_arx_tid *rxtid;
int tidno; int tidno;
...@@ -1259,7 +1264,7 @@ void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) ...@@ -1259,7 +1264,7 @@ void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an)
void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an) void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
{ {
if (sc->sc_rxaggr) { if (sc->sc_flags & SC_OP_RXAGGR) {
struct ath_arx_tid *rxtid; struct ath_arx_tid *rxtid;
int tidno, i; int tidno, i;
...@@ -1292,27 +1297,3 @@ void ath_rx_node_free(struct ath_softc *sc, struct ath_node *an) ...@@ -1292,27 +1297,3 @@ void ath_rx_node_free(struct ath_softc *sc, struct ath_node *an)
{ {
ath_rx_node_cleanup(sc, an); ath_rx_node_cleanup(sc, an);
} }
dma_addr_t ath_skb_map_single(struct ath_softc *sc,
struct sk_buff *skb,
int direction,
dma_addr_t *pa)
{
/*
* NB: do NOT use skb->len, which is 0 on initialization.
* Use skb's entire data area instead.
*/
*pa = pci_map_single(sc->pdev, skb->data,
skb_end_pointer(skb) - skb->head, direction);
return *pa;
}
void ath_skb_unmap_single(struct ath_softc *sc,
struct sk_buff *skb,
int direction,
dma_addr_t *pa)
{
/* Unmap skb's entire data area */
pci_unmap_single(sc->pdev, *pa,
skb_end_pointer(skb) - skb->head, direction);
}
...@@ -899,12 +899,6 @@ enum { ...@@ -899,12 +899,6 @@ enum {
#define AR_GPIO_OUTPUT_MUX2 0x4064 #define AR_GPIO_OUTPUT_MUX2 0x4064
#define AR_GPIO_OUTPUT_MUX3 0x4068 #define AR_GPIO_OUTPUT_MUX3 0x4068
#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
#define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2
#define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5
#define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6
#define AR_INPUT_STATE 0x406c #define AR_INPUT_STATE 0x406c
#define AR_EEPROM_STATUS_DATA 0x407c #define AR_EEPROM_STATUS_DATA 0x407c
......
This diff is collapsed.
b43-y += main.o b43-y += main.o
b43-y += tables.o b43-y += tables.o
b43-$(CONFIG_B43_NPHY) += tables_nphy.o b43-$(CONFIG_B43_NPHY) += tables_nphy.o
b43-y += phy.o b43-y += phy_common.o
b43-y += phy_g.o
b43-y += phy_a.o
b43-$(CONFIG_B43_NPHY) += nphy.o b43-$(CONFIG_B43_NPHY) += nphy.o
b43-y += sysfs.o b43-y += sysfs.o
b43-y += xmit.o b43-y += xmit.o
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "leds.h" #include "leds.h"
#include "rfkill.h" #include "rfkill.h"
#include "lo.h" #include "lo.h"
#include "phy.h" #include "phy_common.h"
/* The unique identifier of the firmware that's officially supported by /* The unique identifier of the firmware that's officially supported by
...@@ -173,6 +173,11 @@ enum { ...@@ -173,6 +173,11 @@ enum {
#define B43_SHM_SH_CHAN 0x00A0 /* Current channel (low 8bit only) */ #define B43_SHM_SH_CHAN 0x00A0 /* Current channel (low 8bit only) */
#define B43_SHM_SH_CHAN_5GHZ 0x0100 /* Bit set, if 5Ghz channel */ #define B43_SHM_SH_CHAN_5GHZ 0x0100 /* Bit set, if 5Ghz channel */
#define B43_SHM_SH_BCMCFIFOID 0x0108 /* Last posted cookie to the bcast/mcast FIFO */ #define B43_SHM_SH_BCMCFIFOID 0x0108 /* Last posted cookie to the bcast/mcast FIFO */
/* TSSI information */
#define B43_SHM_SH_TSSI_CCK 0x0058 /* TSSI for last 4 CCK frames (32bit) */
#define B43_SHM_SH_TSSI_OFDM_A 0x0068 /* TSSI for last 4 OFDM frames (32bit) */
#define B43_SHM_SH_TSSI_OFDM_G 0x0070 /* TSSI for last 4 OFDM frames (32bit) */
#define B43_TSSI_MAX 0x7F /* Max value for one TSSI value */
/* SHM_SHARED TX FIFO variables */ /* SHM_SHARED TX FIFO variables */
#define B43_SHM_SH_SIZE01 0x0098 /* TX FIFO size for FIFO 0 (low) and 1 (high) */ #define B43_SHM_SH_SIZE01 0x0098 /* TX FIFO size for FIFO 0 (low) and 1 (high) */
#define B43_SHM_SH_SIZE23 0x009A /* TX FIFO size for FIFO 2 and 3 */ #define B43_SHM_SH_SIZE23 0x009A /* TX FIFO size for FIFO 2 and 3 */
...@@ -508,122 +513,6 @@ struct b43_iv { ...@@ -508,122 +513,6 @@ struct b43_iv {
} __attribute__((__packed__)); } __attribute__((__packed__));
struct b43_phy {
/* Band support flags. */
bool supports_2ghz;
bool supports_5ghz;
/* GMODE bit enabled? */
bool gmode;
/* Analog Type */
u8 analog;
/* B43_PHYTYPE_ */
u8 type;
/* PHY revision number. */
u8 rev;
/* Radio versioning */
u16 radio_manuf; /* Radio manufacturer */
u16 radio_ver; /* Radio version */
u8 radio_rev; /* Radio revision */
bool dyn_tssi_tbl; /* tssi2dbm is kmalloc()ed. */
/* ACI (adjacent channel interference) flags. */
bool aci_enable;
bool aci_wlan_automatic;
bool aci_hw_rssi;
/* Radio switched on/off */
bool radio_on;
struct {
/* Values saved when turning the radio off.
* They are needed when turning it on again. */
bool valid;
u16 rfover;
u16 rfoverval;
} radio_off_context;
u16 minlowsig[2];
u16 minlowsigpos[2];
/* TSSI to dBm table in use */
const s8 *tssi2dbm;
/* Target idle TSSI */
int tgt_idle_tssi;
/* Current idle TSSI */
int cur_idle_tssi;
/* LocalOscillator control values. */
struct b43_txpower_lo_control *lo_control;
/* Values from b43_calc_loopback_gain() */
s16 max_lb_gain; /* Maximum Loopback gain in hdB */
s16 trsw_rx_gain; /* TRSW RX gain in hdB */
s16 lna_lod_gain; /* LNA lod */
s16 lna_gain; /* LNA */
s16 pga_gain; /* PGA */
/* Desired TX power level (in dBm).
* This is set by the user and adjusted in b43_phy_xmitpower(). */
u8 power_level;
/* A-PHY TX Power control value. */
u16 txpwr_offset;
/* Current TX power level attenuation control values */
struct b43_bbatt bbatt;
struct b43_rfatt rfatt;
u8 tx_control; /* B43_TXCTL_XXX */
/* Hardware Power Control enabled? */
bool hardware_power_control;
/* Current Interference Mitigation mode */
int interfmode;
/* Stack of saved values from the Interference Mitigation code.
* Each value in the stack is layed out as follows:
* bit 0-11: offset
* bit 12-15: register ID
* bit 16-32: value
* register ID is: 0x1 PHY, 0x2 Radio, 0x3 ILT
*/
#define B43_INTERFSTACK_SIZE 26
u32 interfstack[B43_INTERFSTACK_SIZE]; //FIXME: use a data structure
/* Saved values from the NRSSI Slope calculation */
s16 nrssi[2];
s32 nrssislope;
/* In memory nrssi lookup table. */
s8 nrssi_lt[64];
/* current channel */
u8 channel;
u16 lofcal;
u16 initval; //FIXME rename?
/* PHY TX errors counter. */
atomic_t txerr_cnt;
/* The device does address auto increment for the OFDM tables.
* We cache the previously used address here and omit the address
* write on the next table access, if possible. */
u16 ofdmtab_addr; /* The address currently set in hardware. */
enum { /* The last data flow direction. */
B43_OFDMTAB_DIRECTION_UNKNOWN = 0,
B43_OFDMTAB_DIRECTION_READ,
B43_OFDMTAB_DIRECTION_WRITE,
} ofdmtab_addr_direction;
#if B43_DEBUG
/* Manual TX-power control enabled? */
bool manual_txpower_control;
/* PHY registers locked by b43_phy_lock()? */
bool phy_locked;
#endif /* B43_DEBUG */
};
/* Data structures for DMA transmission, per 80211 core. */ /* Data structures for DMA transmission, per 80211 core. */
struct b43_dma { struct b43_dma {
struct b43_dmaring *tx_ring_AC_BK; /* Background */ struct b43_dmaring *tx_ring_AC_BK; /* Background */
...@@ -764,6 +653,11 @@ struct b43_wl { ...@@ -764,6 +653,11 @@ struct b43_wl {
struct b43_qos_params qos_params[4]; struct b43_qos_params qos_params[4];
/* Workqueue for updating QOS parameters in hardware. */ /* Workqueue for updating QOS parameters in hardware. */
struct work_struct qos_update_work; struct work_struct qos_update_work;
/* Work for adjustment of the transmission power.
* This is scheduled when we determine that the actual TX output
* power doesn't match what we want. */
struct work_struct txpower_adjust_work;
}; };
/* In-memory representation of a cached microcode file. */ /* In-memory representation of a cached microcode file. */
...@@ -908,6 +802,15 @@ static inline int b43_is_mode(struct b43_wl *wl, int type) ...@@ -908,6 +802,15 @@ static inline int b43_is_mode(struct b43_wl *wl, int type)
return (wl->operating && wl->if_type == type); return (wl->operating && wl->if_type == type);
} }
/**
* b43_current_band - Returns the currently used band.
* Returns one of IEEE80211_BAND_2GHZ and IEEE80211_BAND_5GHZ.
*/
static inline enum ieee80211_band b43_current_band(struct b43_wl *wl)
{
return wl->hw->conf.channel->band;
}
static inline u16 b43_read16(struct b43_wldev *dev, u16 offset) static inline u16 b43_read16(struct b43_wldev *dev, u16 offset)
{ {
return ssb_read16(dev->dev, offset); return ssb_read16(dev->dev, offset);
......
...@@ -443,76 +443,6 @@ static ssize_t txstat_read_file(struct b43_wldev *dev, ...@@ -443,76 +443,6 @@ static ssize_t txstat_read_file(struct b43_wldev *dev,
return count; return count;
} }
static ssize_t txpower_g_read_file(struct b43_wldev *dev,
char *buf, size_t bufsize)
{
ssize_t count = 0;
if (dev->phy.type != B43_PHYTYPE_G) {
fappend("Device is not a G-PHY\n");
goto out;
}
fappend("Control: %s\n", dev->phy.manual_txpower_control ?
"MANUAL" : "AUTOMATIC");
fappend("Baseband attenuation: %u\n", dev->phy.bbatt.att);
fappend("Radio attenuation: %u\n", dev->phy.rfatt.att);
fappend("TX Mixer Gain: %s\n",
(dev->phy.tx_control & B43_TXCTL_TXMIX) ? "ON" : "OFF");
fappend("PA Gain 2dB: %s\n",
(dev->phy.tx_control & B43_TXCTL_PA2DB) ? "ON" : "OFF");
fappend("PA Gain 3dB: %s\n",
(dev->phy.tx_control & B43_TXCTL_PA3DB) ? "ON" : "OFF");
fappend("\n\n");
fappend("You can write to this file:\n");
fappend("Writing \"auto\" enables automatic txpower control.\n");
fappend
("Writing the attenuation values as \"bbatt rfatt txmix pa2db pa3db\" "
"enables manual txpower control.\n");
fappend("Example: 5 4 0 0 1\n");
fappend("Enables manual control with Baseband attenuation 5, "
"Radio attenuation 4, No TX Mixer Gain, "
"No PA Gain 2dB, With PA Gain 3dB.\n");
out:
return count;
}
static int txpower_g_write_file(struct b43_wldev *dev,
const char *buf, size_t count)
{
if (dev->phy.type != B43_PHYTYPE_G)
return -ENODEV;
if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) {
/* Automatic control */
dev->phy.manual_txpower_control = 0;
b43_phy_xmitpower(dev);
} else {
int bbatt = 0, rfatt = 0, txmix = 0, pa2db = 0, pa3db = 0;
/* Manual control */
if (sscanf(buf, "%d %d %d %d %d", &bbatt, &rfatt,
&txmix, &pa2db, &pa3db) != 5)
return -EINVAL;
b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt);
dev->phy.manual_txpower_control = 1;
dev->phy.bbatt.att = bbatt;
dev->phy.rfatt.att = rfatt;
dev->phy.tx_control = 0;
if (txmix)
dev->phy.tx_control |= B43_TXCTL_TXMIX;
if (pa2db)
dev->phy.tx_control |= B43_TXCTL_PA2DB;
if (pa3db)
dev->phy.tx_control |= B43_TXCTL_PA3DB;
b43_phy_lock(dev);
b43_radio_lock(dev);
b43_set_txpower_g(dev, &dev->phy.bbatt,
&dev->phy.rfatt, dev->phy.tx_control);
b43_radio_unlock(dev);
b43_phy_unlock(dev);
}
return 0;
}
/* wl->irq_lock is locked */ /* wl->irq_lock is locked */
static int restart_write_file(struct b43_wldev *dev, static int restart_write_file(struct b43_wldev *dev,
const char *buf, size_t count) const char *buf, size_t count)
...@@ -560,7 +490,7 @@ static ssize_t loctls_read_file(struct b43_wldev *dev, ...@@ -560,7 +490,7 @@ static ssize_t loctls_read_file(struct b43_wldev *dev,
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
lo = phy->lo_control; lo = phy->g->lo_control;
fappend("-- Local Oscillator calibration data --\n\n"); fappend("-- Local Oscillator calibration data --\n\n");
fappend("HW-power-control enabled: %d\n", fappend("HW-power-control enabled: %d\n",
dev->phy.hardware_power_control); dev->phy.hardware_power_control);
...@@ -578,8 +508,8 @@ static ssize_t loctls_read_file(struct b43_wldev *dev, ...@@ -578,8 +508,8 @@ static ssize_t loctls_read_file(struct b43_wldev *dev,
list_for_each_entry(cal, &lo->calib_list, list) { list_for_each_entry(cal, &lo->calib_list, list) {
bool active; bool active;
active = (b43_compare_bbatt(&cal->bbatt, &phy->bbatt) && active = (b43_compare_bbatt(&cal->bbatt, &phy->g->bbatt) &&
b43_compare_rfatt(&cal->rfatt, &phy->rfatt)); b43_compare_rfatt(&cal->rfatt, &phy->g->rfatt));
fappend("BB(%d), RF(%d,%d) -> I=%d, Q=%d " fappend("BB(%d), RF(%d,%d) -> I=%d, Q=%d "
"(expires in %lu sec)%s\n", "(expires in %lu sec)%s\n",
cal->bbatt.att, cal->bbatt.att,
...@@ -763,7 +693,6 @@ B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1); ...@@ -763,7 +693,6 @@ B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1);
B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1); B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1);
B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1); B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1);
B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0);
B43_DEBUGFS_FOPS(txpower_g, txpower_g_read_file, txpower_g_write_file, 0);
B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1);
B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0);
...@@ -877,7 +806,6 @@ void b43_debugfs_add_device(struct b43_wldev *dev) ...@@ -877,7 +806,6 @@ void b43_debugfs_add_device(struct b43_wldev *dev)
ADD_FILE(mmio32write, 0200); ADD_FILE(mmio32write, 0200);
ADD_FILE(tsf, 0600); ADD_FILE(tsf, 0600);
ADD_FILE(txstat, 0400); ADD_FILE(txstat, 0400);
ADD_FILE(txpower_g, 0600);
ADD_FILE(restart, 0200); ADD_FILE(restart, 0200);
ADD_FILE(loctls, 0400); ADD_FILE(loctls, 0400);
...@@ -907,7 +835,6 @@ void b43_debugfs_remove_device(struct b43_wldev *dev) ...@@ -907,7 +835,6 @@ void b43_debugfs_remove_device(struct b43_wldev *dev)
debugfs_remove(e->file_mmio32write.dentry); debugfs_remove(e->file_mmio32write.dentry);
debugfs_remove(e->file_tsf.dentry); debugfs_remove(e->file_tsf.dentry);
debugfs_remove(e->file_txstat.dentry); debugfs_remove(e->file_txstat.dentry);
debugfs_remove(e->file_txpower_g.dentry);
debugfs_remove(e->file_restart.dentry); debugfs_remove(e->file_restart.dentry);
debugfs_remove(e->file_loctls.dentry); debugfs_remove(e->file_loctls.dentry);
......
This diff is collapsed.
#ifndef B43_LO_H_ #ifndef B43_LO_H_
#define B43_LO_H_ #define B43_LO_H_
#include "phy.h" /* G-PHY Local Oscillator */
#include "phy_g.h"
struct b43_wldev; struct b43_wldev;
......
This diff is collapsed.
This diff is collapsed.
#ifndef B43_NPHY_H_ #ifndef B43_NPHY_H_
#define B43_NPHY_H_ #define B43_NPHY_H_
#include "phy.h" #include "phy_common.h"
/* N-PHY registers. */ /* N-PHY registers. */
...@@ -919,54 +919,14 @@ ...@@ -919,54 +919,14 @@
struct b43_wldev; struct b43_wldev;
struct b43_phy_n {
bool initialised;
#ifdef CONFIG_B43_NPHY //TODO lots of missing stuff
/* N-PHY support enabled */ };
int b43_phy_initn(struct b43_wldev *dev);
void b43_nphy_radio_turn_on(struct b43_wldev *dev); struct b43_phy_operations;
void b43_nphy_radio_turn_off(struct b43_wldev *dev); extern const struct b43_phy_operations b43_phyops_n;
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel);
void b43_nphy_xmitpower(struct b43_wldev *dev);
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna);
#else /* CONFIG_B43_NPHY */
/* N-PHY support disabled */
static inline
int b43_phy_initn(struct b43_wldev *dev)
{
return -EOPNOTSUPP;
}
static inline
void b43_nphy_radio_turn_on(struct b43_wldev *dev)
{
}
static inline
void b43_nphy_radio_turn_off(struct b43_wldev *dev)
{
}
static inline
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel)
{
return -ENOSYS;
}
static inline
void b43_nphy_xmitpower(struct b43_wldev *dev)
{
}
static inline
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
{
}
#endif /* CONFIG_B43_NPHY */
#endif /* B43_NPHY_H_ */ #endif /* B43_NPHY_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "rfkill.h" #include "rfkill.h"
#include "b43.h" #include "b43.h"
#include "phy_common.h"
#include <linux/kmod.h> #include <linux/kmod.h>
...@@ -114,11 +115,11 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) ...@@ -114,11 +115,11 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
goto out_unlock; goto out_unlock;
} }
if (!dev->phy.radio_on) if (!dev->phy.radio_on)
b43_radio_turn_on(dev); b43_software_rfkill(dev, state);
break; break;
case RFKILL_STATE_SOFT_BLOCKED: case RFKILL_STATE_SOFT_BLOCKED:
if (dev->phy.radio_on) if (dev->phy.radio_on)
b43_radio_turn_off(dev, 0); b43_software_rfkill(dev, state);
break; break;
default: default:
b43warn(wl, "Received unexpected rfkill state %d.\n", state); b43warn(wl, "Received unexpected rfkill state %d.\n", state);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "b43.h" #include "b43.h"
#include "sysfs.h" #include "sysfs.h"
#include "main.h" #include "main.h"
#include "phy.h" #include "phy_common.h"
#define GENERIC_FILESIZE 64 #define GENERIC_FILESIZE 64
...@@ -59,7 +59,12 @@ static ssize_t b43_attr_interfmode_show(struct device *dev, ...@@ -59,7 +59,12 @@ static ssize_t b43_attr_interfmode_show(struct device *dev,
mutex_lock(&wldev->wl->mutex); mutex_lock(&wldev->wl->mutex);
switch (wldev->phy.interfmode) { if (wldev->phy.type != B43_PHYTYPE_G) {
mutex_unlock(&wldev->wl->mutex);
return -ENOSYS;
}
switch (wldev->phy.g->interfmode) {
case B43_INTERFMODE_NONE: case B43_INTERFMODE_NONE:
count = count =
snprintf(buf, PAGE_SIZE, snprintf(buf, PAGE_SIZE,
...@@ -117,11 +122,15 @@ static ssize_t b43_attr_interfmode_store(struct device *dev, ...@@ -117,11 +122,15 @@ static ssize_t b43_attr_interfmode_store(struct device *dev,
mutex_lock(&wldev->wl->mutex); mutex_lock(&wldev->wl->mutex);
spin_lock_irqsave(&wldev->wl->irq_lock, flags); spin_lock_irqsave(&wldev->wl->irq_lock, flags);
err = b43_radio_set_interference_mitigation(wldev, mode); if (wldev->phy.ops->interf_mitigation) {
if (err) { err = wldev->phy.ops->interf_mitigation(wldev, mode);
b43err(wldev->wl, "Interference Mitigation not " if (err) {
"supported by device\n"); b43err(wldev->wl, "Interference Mitigation not "
} "supported by device\n");
}
} else
err = -ENOSYS;
mmiowb(); mmiowb();
spin_unlock_irqrestore(&wldev->wl->irq_lock, flags); spin_unlock_irqrestore(&wldev->wl->irq_lock, flags);
mutex_unlock(&wldev->wl->mutex); mutex_unlock(&wldev->wl->mutex);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment