diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-04-26 15:03:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-26 15:03:48 -0400 |
commit | d9b8ae6bd8c3304569a25079fcdbebaa28a48ee4 (patch) | |
tree | 9ce3e4eb355685f970dd7333a0a935109aff0583 /drivers | |
parent | 872f24dbc604ef585ea7eec73020dcdfaffd1956 (diff) | |
parent | 94c514fe240fc0dd02187b78facefde8b6744634 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
drivers/net/wireless/iwlwifi/iwl-testmode.c
Diffstat (limited to 'drivers')
107 files changed, 3230 insertions, 2447 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index de30cb34b8f3..f554bff87e62 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -618,19 +618,10 @@ static void ar5008_hw_init_bb(struct ath_hw *ah, | |||
618 | u32 synthDelay; | 618 | u32 synthDelay; |
619 | 619 | ||
620 | synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; | 620 | synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; |
621 | if (IS_CHAN_B(chan)) | ||
622 | synthDelay = (4 * synthDelay) / 22; | ||
623 | else | ||
624 | synthDelay /= 10; | ||
625 | |||
626 | if (IS_CHAN_HALF_RATE(chan)) | ||
627 | synthDelay *= 2; | ||
628 | else if (IS_CHAN_QUARTER_RATE(chan)) | ||
629 | synthDelay *= 4; | ||
630 | 621 | ||
631 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); | 622 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); |
632 | 623 | ||
633 | udelay(synthDelay + BASE_ACTIVATE_DELAY); | 624 | ath9k_hw_synth_delay(ah, chan, synthDelay); |
634 | } | 625 | } |
635 | 626 | ||
636 | static void ar5008_hw_init_chain_masks(struct ath_hw *ah) | 627 | static void ar5008_hw_init_chain_masks(struct ath_hw *ah) |
@@ -948,12 +939,8 @@ static bool ar5008_hw_rfbus_req(struct ath_hw *ah) | |||
948 | static void ar5008_hw_rfbus_done(struct ath_hw *ah) | 939 | static void ar5008_hw_rfbus_done(struct ath_hw *ah) |
949 | { | 940 | { |
950 | u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; | 941 | u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; |
951 | if (IS_CHAN_B(ah->curchan)) | ||
952 | synthDelay = (4 * synthDelay) / 22; | ||
953 | else | ||
954 | synthDelay /= 10; | ||
955 | 942 | ||
956 | udelay(synthDelay + BASE_ACTIVATE_DELAY); | 943 | ath9k_hw_synth_delay(ah, ah->curchan, synthDelay); |
957 | 944 | ||
958 | REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); | 945 | REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); |
959 | } | 946 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 63089cc1fafd..a0387a027db0 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -1000,10 +1000,12 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
1000 | if (mci && IS_CHAN_2GHZ(chan) && run_agc_cal) | 1000 | if (mci && IS_CHAN_2GHZ(chan) && run_agc_cal) |
1001 | ar9003_mci_init_cal_req(ah, &is_reusable); | 1001 | ar9003_mci_init_cal_req(ah, &is_reusable); |
1002 | 1002 | ||
1003 | txiqcal_done = ar9003_hw_tx_iq_cal_run(ah); | 1003 | if (!(IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan))) { |
1004 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); | 1004 | txiqcal_done = ar9003_hw_tx_iq_cal_run(ah); |
1005 | udelay(5); | 1005 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); |
1006 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); | 1006 | udelay(5); |
1007 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); | ||
1008 | } | ||
1007 | 1009 | ||
1008 | skip_tx_iqcal: | 1010 | skip_tx_iqcal: |
1009 | if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) { | 1011 | if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 1188db205e32..ac53d901801d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -4281,18 +4281,10 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4281 | #undef POW_SM | 4281 | #undef POW_SM |
4282 | } | 4282 | } |
4283 | 4283 | ||
4284 | static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, | 4284 | static void ar9003_hw_get_legacy_target_powers(struct ath_hw *ah, u16 freq, |
4285 | u8 *targetPowerValT2) | 4285 | u8 *targetPowerValT2, |
4286 | bool is2GHz) | ||
4286 | { | 4287 | { |
4287 | /* XXX: hard code for now, need to get from eeprom struct */ | ||
4288 | u8 ht40PowerIncForPdadc = 0; | ||
4289 | bool is2GHz = false; | ||
4290 | unsigned int i = 0; | ||
4291 | struct ath_common *common = ath9k_hw_common(ah); | ||
4292 | |||
4293 | if (freq < 4000) | ||
4294 | is2GHz = true; | ||
4295 | |||
4296 | targetPowerValT2[ALL_TARGET_LEGACY_6_24] = | 4288 | targetPowerValT2[ALL_TARGET_LEGACY_6_24] = |
4297 | ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq, | 4289 | ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq, |
4298 | is2GHz); | 4290 | is2GHz); |
@@ -4305,6 +4297,11 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, | |||
4305 | targetPowerValT2[ALL_TARGET_LEGACY_54] = | 4297 | targetPowerValT2[ALL_TARGET_LEGACY_54] = |
4306 | ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq, | 4298 | ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq, |
4307 | is2GHz); | 4299 | is2GHz); |
4300 | } | ||
4301 | |||
4302 | static void ar9003_hw_get_cck_target_powers(struct ath_hw *ah, u16 freq, | ||
4303 | u8 *targetPowerValT2) | ||
4304 | { | ||
4308 | targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] = | 4305 | targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] = |
4309 | ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L, | 4306 | ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L, |
4310 | freq); | 4307 | freq); |
@@ -4314,6 +4311,11 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, | |||
4314 | ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq); | 4311 | ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq); |
4315 | targetPowerValT2[ALL_TARGET_LEGACY_11S] = | 4312 | targetPowerValT2[ALL_TARGET_LEGACY_11S] = |
4316 | ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq); | 4313 | ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq); |
4314 | } | ||
4315 | |||
4316 | static void ar9003_hw_get_ht20_target_powers(struct ath_hw *ah, u16 freq, | ||
4317 | u8 *targetPowerValT2, bool is2GHz) | ||
4318 | { | ||
4317 | targetPowerValT2[ALL_TARGET_HT20_0_8_16] = | 4319 | targetPowerValT2[ALL_TARGET_HT20_0_8_16] = |
4318 | ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, | 4320 | ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, |
4319 | is2GHz); | 4321 | is2GHz); |
@@ -4356,6 +4358,16 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, | |||
4356 | targetPowerValT2[ALL_TARGET_HT20_23] = | 4358 | targetPowerValT2[ALL_TARGET_HT20_23] = |
4357 | ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq, | 4359 | ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq, |
4358 | is2GHz); | 4360 | is2GHz); |
4361 | } | ||
4362 | |||
4363 | static void ar9003_hw_get_ht40_target_powers(struct ath_hw *ah, | ||
4364 | u16 freq, | ||
4365 | u8 *targetPowerValT2, | ||
4366 | bool is2GHz) | ||
4367 | { | ||
4368 | /* XXX: hard code for now, need to get from eeprom struct */ | ||
4369 | u8 ht40PowerIncForPdadc = 0; | ||
4370 | |||
4359 | targetPowerValT2[ALL_TARGET_HT40_0_8_16] = | 4371 | targetPowerValT2[ALL_TARGET_HT40_0_8_16] = |
4360 | ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, | 4372 | ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, |
4361 | is2GHz) + ht40PowerIncForPdadc; | 4373 | is2GHz) + ht40PowerIncForPdadc; |
@@ -4399,6 +4411,26 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, | |||
4399 | targetPowerValT2[ALL_TARGET_HT40_23] = | 4411 | targetPowerValT2[ALL_TARGET_HT40_23] = |
4400 | ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq, | 4412 | ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq, |
4401 | is2GHz) + ht40PowerIncForPdadc; | 4413 | is2GHz) + ht40PowerIncForPdadc; |
4414 | } | ||
4415 | |||
4416 | static void ar9003_hw_get_target_power_eeprom(struct ath_hw *ah, | ||
4417 | struct ath9k_channel *chan, | ||
4418 | u8 *targetPowerValT2) | ||
4419 | { | ||
4420 | bool is2GHz = IS_CHAN_2GHZ(chan); | ||
4421 | unsigned int i = 0; | ||
4422 | struct ath_common *common = ath9k_hw_common(ah); | ||
4423 | u16 freq = chan->channel; | ||
4424 | |||
4425 | if (is2GHz) | ||
4426 | ar9003_hw_get_cck_target_powers(ah, freq, targetPowerValT2); | ||
4427 | |||
4428 | ar9003_hw_get_legacy_target_powers(ah, freq, targetPowerValT2, is2GHz); | ||
4429 | ar9003_hw_get_ht20_target_powers(ah, freq, targetPowerValT2, is2GHz); | ||
4430 | |||
4431 | if (IS_CHAN_HT40(chan)) | ||
4432 | ar9003_hw_get_ht40_target_powers(ah, freq, targetPowerValT2, | ||
4433 | is2GHz); | ||
4402 | 4434 | ||
4403 | for (i = 0; i < ar9300RateSize; i++) { | 4435 | for (i = 0; i < ar9300RateSize; i++) { |
4404 | ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n", | 4436 | ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n", |
@@ -4778,9 +4810,6 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, | |||
4778 | scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, | 4810 | scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, |
4779 | antenna_reduction); | 4811 | antenna_reduction); |
4780 | 4812 | ||
4781 | /* | ||
4782 | * Get target powers from EEPROM - our baseline for TX Power | ||
4783 | */ | ||
4784 | if (is2ghz) { | 4813 | if (is2ghz) { |
4785 | /* Setup for CTL modes */ | 4814 | /* Setup for CTL modes */ |
4786 | /* CTL_11B, CTL_11G, CTL_2GHT20 */ | 4815 | /* CTL_11B, CTL_11G, CTL_2GHT20 */ |
@@ -4952,7 +4981,12 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, | |||
4952 | unsigned int i = 0, paprd_scale_factor = 0; | 4981 | unsigned int i = 0, paprd_scale_factor = 0; |
4953 | u8 pwr_idx, min_pwridx = 0; | 4982 | u8 pwr_idx, min_pwridx = 0; |
4954 | 4983 | ||
4955 | ar9003_hw_set_target_power_eeprom(ah, chan->channel, targetPowerValT2); | 4984 | memset(targetPowerValT2, 0 , sizeof(targetPowerValT2)); |
4985 | |||
4986 | /* | ||
4987 | * Get target powers from EEPROM - our baseline for TX Power | ||
4988 | */ | ||
4989 | ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2); | ||
4956 | 4990 | ||
4957 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { | 4991 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { |
4958 | if (IS_CHAN_2GHZ(chan)) | 4992 | if (IS_CHAN_2GHZ(chan)) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index bbda25f4e9f0..a1c0879a5d4e 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -526,22 +526,10 @@ static void ar9003_hw_init_bb(struct ath_hw *ah, | |||
526 | * Value is in 100ns increments. | 526 | * Value is in 100ns increments. |
527 | */ | 527 | */ |
528 | synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; | 528 | synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; |
529 | if (IS_CHAN_B(chan)) | ||
530 | synthDelay = (4 * synthDelay) / 22; | ||
531 | else | ||
532 | synthDelay /= 10; | ||
533 | 529 | ||
534 | /* Activate the PHY (includes baseband activate + synthesizer on) */ | 530 | /* Activate the PHY (includes baseband activate + synthesizer on) */ |
535 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); | 531 | REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); |
536 | 532 | ath9k_hw_synth_delay(ah, chan, synthDelay); | |
537 | /* | ||
538 | * There is an issue if the AP starts the calibration before | ||
539 | * the base band timeout completes. This could result in the | ||
540 | * rx_clear false triggering. As a workaround we add delay an | ||
541 | * extra BASE_ACTIVATE_DELAY usecs to ensure this condition | ||
542 | * does not happen. | ||
543 | */ | ||
544 | udelay(synthDelay + BASE_ACTIVATE_DELAY); | ||
545 | } | 533 | } |
546 | 534 | ||
547 | static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) | 535 | static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) |
@@ -723,6 +711,14 @@ static void ar9003_hw_set_rfmode(struct ath_hw *ah, | |||
723 | 711 | ||
724 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) | 712 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) |
725 | rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); | 713 | rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); |
714 | if (IS_CHAN_QUARTER_RATE(chan)) | ||
715 | rfMode |= AR_PHY_MODE_QUARTER; | ||
716 | if (IS_CHAN_HALF_RATE(chan)) | ||
717 | rfMode |= AR_PHY_MODE_HALF; | ||
718 | |||
719 | if (rfMode & (AR_PHY_MODE_QUARTER | AR_PHY_MODE_HALF)) | ||
720 | REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL, | ||
721 | AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW, 3); | ||
726 | 722 | ||
727 | REG_WRITE(ah, AR_PHY_MODE, rfMode); | 723 | REG_WRITE(ah, AR_PHY_MODE, rfMode); |
728 | } | 724 | } |
@@ -793,12 +789,8 @@ static bool ar9003_hw_rfbus_req(struct ath_hw *ah) | |||
793 | static void ar9003_hw_rfbus_done(struct ath_hw *ah) | 789 | static void ar9003_hw_rfbus_done(struct ath_hw *ah) |
794 | { | 790 | { |
795 | u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; | 791 | u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; |
796 | if (IS_CHAN_B(ah->curchan)) | ||
797 | synthDelay = (4 * synthDelay) / 22; | ||
798 | else | ||
799 | synthDelay /= 10; | ||
800 | 792 | ||
801 | udelay(synthDelay + BASE_ACTIVATE_DELAY); | 793 | ath9k_hw_synth_delay(ah, ah->curchan, synthDelay); |
802 | 794 | ||
803 | REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); | 795 | REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); |
804 | } | 796 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index d834d97fe727..7268a48a92a1 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h | |||
@@ -468,6 +468,9 @@ | |||
468 | #define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150) | 468 | #define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150) |
469 | #define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158) | 469 | #define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158) |
470 | 470 | ||
471 | #define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW 3 | ||
472 | #define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW_S 0 | ||
473 | |||
471 | #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00 | 474 | #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00 |
472 | #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10 | 475 | #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10 |
473 | #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF | 476 | #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index 702e5abc38b2..11bc55e3d697 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -817,8 +817,10 @@ void ath9k_set_beaconing_status(struct ath_softc *sc, bool status) | |||
817 | { | 817 | { |
818 | struct ath_hw *ah = sc->sc_ah; | 818 | struct ath_hw *ah = sc->sc_ah; |
819 | 819 | ||
820 | if (!ath_has_valid_bslot(sc)) | 820 | if (!ath_has_valid_bslot(sc)) { |
821 | sc->sc_flags &= ~SC_OP_BEACONS; | ||
821 | return; | 822 | return; |
823 | } | ||
822 | 824 | ||
823 | ath9k_ps_wakeup(sc); | 825 | ath9k_ps_wakeup(sc); |
824 | if (status) { | 826 | if (status) { |
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c index ec3271993411..1ca6da80d4ad 100644 --- a/drivers/net/wireless/ath/ath9k/btcoex.c +++ b/drivers/net/wireless/ath/ath9k/btcoex.c | |||
@@ -108,9 +108,7 @@ void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah) | |||
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | 110 | ||
111 | if (AR_SREV_9462(ah)) { | 111 | if (AR_SREV_9300_20_OR_LATER(ah)) { |
112 | btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI; | ||
113 | } else if (AR_SREV_9300_20_OR_LATER(ah)) { | ||
114 | btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; | 112 | btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; |
115 | btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300; | 113 | btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300; |
116 | btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300; | 114 | btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300; |
@@ -284,11 +282,12 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah) | |||
284 | ath9k_hw_btcoex_enable_2wire(ah); | 282 | ath9k_hw_btcoex_enable_2wire(ah); |
285 | break; | 283 | break; |
286 | case ATH_BTCOEX_CFG_3WIRE: | 284 | case ATH_BTCOEX_CFG_3WIRE: |
285 | if (AR_SREV_9462(ah)) { | ||
286 | ath9k_hw_btcoex_enable_mci(ah); | ||
287 | return; | ||
288 | } | ||
287 | ath9k_hw_btcoex_enable_3wire(ah); | 289 | ath9k_hw_btcoex_enable_3wire(ah); |
288 | break; | 290 | break; |
289 | case ATH_BTCOEX_CFG_MCI: | ||
290 | ath9k_hw_btcoex_enable_mci(ah); | ||
291 | return; | ||
292 | } | 291 | } |
293 | 292 | ||
294 | REG_RMW(ah, AR_GPIO_PDPU, | 293 | REG_RMW(ah, AR_GPIO_PDPU, |
@@ -305,11 +304,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah) | |||
305 | int i; | 304 | int i; |
306 | 305 | ||
307 | btcoex_hw->enabled = false; | 306 | btcoex_hw->enabled = false; |
308 | if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) { | 307 | if (AR_SREV_9462(ah)) { |
309 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); | 308 | ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); |
310 | for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) | 309 | for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) |
311 | REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), | 310 | REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), |
312 | btcoex_hw->wlan_weight[i]); | 311 | btcoex_hw->wlan_weight[i]); |
312 | return; | ||
313 | } | 313 | } |
314 | ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); | 314 | ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); |
315 | 315 | ||
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h index 8f93aef4414f..3a1e1cfabd5e 100644 --- a/drivers/net/wireless/ath/ath9k/btcoex.h +++ b/drivers/net/wireless/ath/ath9k/btcoex.h | |||
@@ -51,7 +51,6 @@ enum ath_btcoex_scheme { | |||
51 | ATH_BTCOEX_CFG_NONE, | 51 | ATH_BTCOEX_CFG_NONE, |
52 | ATH_BTCOEX_CFG_2WIRE, | 52 | ATH_BTCOEX_CFG_2WIRE, |
53 | ATH_BTCOEX_CFG_3WIRE, | 53 | ATH_BTCOEX_CFG_3WIRE, |
54 | ATH_BTCOEX_CFG_MCI, | ||
55 | }; | 54 | }; |
56 | 55 | ||
57 | struct ath9k_hw_mci { | 56 | struct ath9k_hw_mci { |
diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c index 92891f5fd454..ecc81792f2dc 100644 --- a/drivers/net/wireless/ath/ath9k/dfs.c +++ b/drivers/net/wireless/ath/ath9k/dfs.c | |||
@@ -148,11 +148,13 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, | |||
148 | struct ath_hw *ah = sc->sc_ah; | 148 | struct ath_hw *ah = sc->sc_ah; |
149 | struct ath_common *common = ath9k_hw_common(ah); | 149 | struct ath_common *common = ath9k_hw_common(ah); |
150 | 150 | ||
151 | DFS_STAT_INC(sc, pulses_total); | ||
151 | if ((rs->rs_phyerr != ATH9K_PHYERR_RADAR) && | 152 | if ((rs->rs_phyerr != ATH9K_PHYERR_RADAR) && |
152 | (rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT)) { | 153 | (rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT)) { |
153 | ath_dbg(common, DFS, | 154 | ath_dbg(common, DFS, |
154 | "Error: rs_phyer=0x%x not a radar error\n", | 155 | "Error: rs_phyer=0x%x not a radar error\n", |
155 | rs->rs_phyerr); | 156 | rs->rs_phyerr); |
157 | DFS_STAT_INC(sc, pulses_no_dfs); | ||
156 | return; | 158 | return; |
157 | } | 159 | } |
158 | 160 | ||
@@ -188,7 +190,9 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, | |||
188 | "width=%d, rssi=%d, delta_ts=%llu\n", | 190 | "width=%d, rssi=%d, delta_ts=%llu\n", |
189 | pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); | 191 | pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); |
190 | last_ts = pe.ts; | 192 | last_ts = pe.ts; |
193 | DFS_STAT_INC(sc, pulses_processed); | ||
191 | if (pd != NULL && pd->add_pulse(pd, &pe)) { | 194 | if (pd != NULL && pd->add_pulse(pd, &pe)) { |
195 | DFS_STAT_INC(sc, radar_detected); | ||
192 | /* | 196 | /* |
193 | * TODO: forward radar event to DFS management layer | 197 | * TODO: forward radar event to DFS management layer |
194 | */ | 198 | */ |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c index 4364c103ed33..55d28072adeb 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.c +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c | |||
@@ -21,9 +21,15 @@ | |||
21 | #include "ath9k.h" | 21 | #include "ath9k.h" |
22 | #include "dfs_debug.h" | 22 | #include "dfs_debug.h" |
23 | 23 | ||
24 | |||
25 | struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 }; | ||
26 | |||
24 | #define ATH9K_DFS_STAT(s, p) \ | 27 | #define ATH9K_DFS_STAT(s, p) \ |
25 | len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ | 28 | len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ |
26 | sc->debug.stats.dfs_stats.p); | 29 | sc->debug.stats.dfs_stats.p); |
30 | #define ATH9K_DFS_POOL_STAT(s, p) \ | ||
31 | len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ | ||
32 | global_dfs_pool_stats.p); | ||
27 | 33 | ||
28 | static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | 34 | static ssize_t read_file_dfs(struct file *file, char __user *user_buf, |
29 | size_t count, loff_t *ppos) | 35 | size_t count, loff_t *ppos) |
@@ -43,6 +49,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | |||
43 | hw_ver->macVersion, hw_ver->macRev, | 49 | hw_ver->macVersion, hw_ver->macRev, |
44 | (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? | 50 | (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? |
45 | "enabled" : "disabled"); | 51 | "enabled" : "disabled"); |
52 | len += snprintf(buf + len, size - len, "Pulse detector statistics:\n"); | ||
53 | ATH9K_DFS_STAT("pulse events reported ", pulses_total); | ||
54 | ATH9K_DFS_STAT("invalid pulse events ", pulses_no_dfs); | ||
46 | ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected); | 55 | ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected); |
47 | ATH9K_DFS_STAT("Datalen discards ", datalen_discards); | 56 | ATH9K_DFS_STAT("Datalen discards ", datalen_discards); |
48 | ATH9K_DFS_STAT("RSSI discards ", rssi_discards); | 57 | ATH9K_DFS_STAT("RSSI discards ", rssi_discards); |
@@ -50,6 +59,18 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | |||
50 | ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors); | 59 | ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors); |
51 | ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors); | 60 | ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors); |
52 | ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors); | 61 | ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors); |
62 | len += snprintf(buf + len, size - len, "Radar detector statistics " | ||
63 | "(current DFS region: %d)\n", sc->dfs_detector->region); | ||
64 | ATH9K_DFS_STAT("Pulse events processed ", pulses_processed); | ||
65 | ATH9K_DFS_STAT("Radars detected ", radar_detected); | ||
66 | len += snprintf(buf + len, size - len, "Global Pool statistics:\n"); | ||
67 | ATH9K_DFS_POOL_STAT("Pool references ", pool_reference); | ||
68 | ATH9K_DFS_POOL_STAT("Pulses allocated ", pulse_allocated); | ||
69 | ATH9K_DFS_POOL_STAT("Pulses alloc error ", pulse_alloc_error); | ||
70 | ATH9K_DFS_POOL_STAT("Pulses in use ", pulse_used); | ||
71 | ATH9K_DFS_POOL_STAT("Seqs. allocated ", pseq_allocated); | ||
72 | ATH9K_DFS_POOL_STAT("Seqs. alloc error ", pseq_alloc_error); | ||
73 | ATH9K_DFS_POOL_STAT("Seqs. in use ", pseq_used); | ||
53 | 74 | ||
54 | if (len > size) | 75 | if (len > size) |
55 | len = size; | 76 | len = size; |
@@ -60,8 +81,33 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | |||
60 | return retval; | 81 | return retval; |
61 | } | 82 | } |
62 | 83 | ||
84 | /* magic number to prevent accidental reset of DFS statistics */ | ||
85 | #define DFS_STATS_RESET_MAGIC 0x80000000 | ||
86 | static ssize_t write_file_dfs(struct file *file, const char __user *user_buf, | ||
87 | size_t count, loff_t *ppos) | ||
88 | { | ||
89 | struct ath_softc *sc = file->private_data; | ||
90 | unsigned long val; | ||
91 | char buf[32]; | ||
92 | ssize_t len; | ||
93 | |||
94 | len = min(count, sizeof(buf) - 1); | ||
95 | if (copy_from_user(buf, user_buf, len)) | ||
96 | return -EFAULT; | ||
97 | |||
98 | buf[len] = '\0'; | ||
99 | if (strict_strtoul(buf, 0, &val)) | ||
100 | return -EINVAL; | ||
101 | |||
102 | if (val == DFS_STATS_RESET_MAGIC) | ||
103 | memset(&sc->debug.stats.dfs_stats, 0, | ||
104 | sizeof(sc->debug.stats.dfs_stats)); | ||
105 | return count; | ||
106 | } | ||
107 | |||
63 | static const struct file_operations fops_dfs_stats = { | 108 | static const struct file_operations fops_dfs_stats = { |
64 | .read = read_file_dfs, | 109 | .read = read_file_dfs, |
110 | .write = write_file_dfs, | ||
65 | .open = simple_open, | 111 | .open = simple_open, |
66 | .owner = THIS_MODULE, | 112 | .owner = THIS_MODULE, |
67 | .llseek = default_llseek, | 113 | .llseek = default_llseek, |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h index 4911724cb445..e36810a4b585 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.h +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.h | |||
@@ -22,17 +22,23 @@ | |||
22 | #include "hw.h" | 22 | #include "hw.h" |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * struct ath_dfs_stats - DFS Statistics | 25 | * struct ath_dfs_stats - DFS Statistics per wiphy |
26 | * | 26 | * @pulses_total: pulses reported by HW |
27 | * @pulses_detected: No. of pulses detected so far | 27 | * @pulses_no_dfs: pulses wrongly reported as DFS |
28 | * @datalen_discards: No. of pulses discarded due to invalid datalen | 28 | * @pulses_detected: pulses detected so far |
29 | * @rssi_discards: No. of pulses discarded due to invalid RSSI | 29 | * @datalen_discards: pulses discarded due to invalid datalen |
30 | * @bwinfo_discards: No. of pulses discarded due to invalid BW info | 30 | * @rssi_discards: pulses discarded due to invalid RSSI |
31 | * @pri_phy_errors: No. of pulses reported for primary channel | 31 | * @bwinfo_discards: pulses discarded due to invalid BW info |
32 | * @ext_phy_errors: No. of pulses reported for extension channel | 32 | * @pri_phy_errors: pulses reported for primary channel |
33 | * @dc_phy_errors: No. of pulses reported for primary + extension channel | 33 | * @ext_phy_errors: pulses reported for extension channel |
34 | * @dc_phy_errors: pulses reported for primary + extension channel | ||
35 | * @pulses_processed: pulses forwarded to detector | ||
36 | * @radar_detected: radars detected | ||
34 | */ | 37 | */ |
35 | struct ath_dfs_stats { | 38 | struct ath_dfs_stats { |
39 | /* pulse stats */ | ||
40 | u32 pulses_total; | ||
41 | u32 pulses_no_dfs; | ||
36 | u32 pulses_detected; | 42 | u32 pulses_detected; |
37 | u32 datalen_discards; | 43 | u32 datalen_discards; |
38 | u32 rssi_discards; | 44 | u32 rssi_discards; |
@@ -40,18 +46,39 @@ struct ath_dfs_stats { | |||
40 | u32 pri_phy_errors; | 46 | u32 pri_phy_errors; |
41 | u32 ext_phy_errors; | 47 | u32 ext_phy_errors; |
42 | u32 dc_phy_errors; | 48 | u32 dc_phy_errors; |
49 | /* pattern detection stats */ | ||
50 | u32 pulses_processed; | ||
51 | u32 radar_detected; | ||
43 | }; | 52 | }; |
44 | 53 | ||
54 | /** | ||
55 | * struct ath_dfs_pool_stats - DFS Statistics for global pools | ||
56 | */ | ||
57 | struct ath_dfs_pool_stats { | ||
58 | u32 pool_reference; | ||
59 | u32 pulse_allocated; | ||
60 | u32 pulse_alloc_error; | ||
61 | u32 pulse_used; | ||
62 | u32 pseq_allocated; | ||
63 | u32 pseq_alloc_error; | ||
64 | u32 pseq_used; | ||
65 | }; | ||
45 | #if defined(CONFIG_ATH9K_DFS_DEBUGFS) | 66 | #if defined(CONFIG_ATH9K_DFS_DEBUGFS) |
46 | 67 | ||
47 | #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++) | 68 | #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++) |
48 | void ath9k_dfs_init_debug(struct ath_softc *sc); | 69 | void ath9k_dfs_init_debug(struct ath_softc *sc); |
49 | 70 | ||
71 | #define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++) | ||
72 | #define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--) | ||
73 | extern struct ath_dfs_pool_stats global_dfs_pool_stats; | ||
74 | |||
50 | #else | 75 | #else |
51 | 76 | ||
52 | #define DFS_STAT_INC(sc, c) do { } while (0) | 77 | #define DFS_STAT_INC(sc, c) do { } while (0) |
53 | static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { } | 78 | static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { } |
54 | 79 | ||
80 | #define DFS_POOL_STAT_INC(c) do { } while (0) | ||
81 | #define DFS_POOL_STAT_DEC(c) do { } while (0) | ||
55 | #endif /* CONFIG_ATH9K_DFS_DEBUGFS */ | 82 | #endif /* CONFIG_ATH9K_DFS_DEBUGFS */ |
56 | 83 | ||
57 | #endif /* ATH9K_DFS_DEBUG_H */ | 84 | #endif /* ATH9K_DFS_DEBUG_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c index 025e88a64fa4..91b8dceeadb1 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c | |||
@@ -15,9 +15,12 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/spinlock.h> | ||
18 | 19 | ||
20 | #include "ath9k.h" | ||
19 | #include "dfs_pattern_detector.h" | 21 | #include "dfs_pattern_detector.h" |
20 | #include "dfs_pri_detector.h" | 22 | #include "dfs_pri_detector.h" |
23 | #include "dfs_debug.h" | ||
21 | 24 | ||
22 | /** | 25 | /** |
23 | * struct pri_sequence - sequence of pulses matching one PRI | 26 | * struct pri_sequence - sequence of pulses matching one PRI |
@@ -94,6 +97,81 @@ static u32 pde_get_multiple(u32 val, u32 fraction, u32 tolerance) | |||
94 | static u32 singleton_pool_references; | 97 | static u32 singleton_pool_references; |
95 | static LIST_HEAD(pulse_pool); | 98 | static LIST_HEAD(pulse_pool); |
96 | static LIST_HEAD(pseq_pool); | 99 | static LIST_HEAD(pseq_pool); |
100 | static DEFINE_SPINLOCK(pool_lock); | ||
101 | |||
102 | static void pool_register_ref(void) | ||
103 | { | ||
104 | spin_lock_bh(&pool_lock); | ||
105 | singleton_pool_references++; | ||
106 | DFS_POOL_STAT_INC(pool_reference); | ||
107 | spin_unlock_bh(&pool_lock); | ||
108 | } | ||
109 | |||
110 | static void pool_deregister_ref(void) | ||
111 | { | ||
112 | spin_lock_bh(&pool_lock); | ||
113 | singleton_pool_references--; | ||
114 | DFS_POOL_STAT_DEC(pool_reference); | ||
115 | if (singleton_pool_references == 0) { | ||
116 | /* free singleton pools with no references left */ | ||
117 | struct pri_sequence *ps, *ps0; | ||
118 | struct pulse_elem *p, *p0; | ||
119 | |||
120 | list_for_each_entry_safe(p, p0, &pulse_pool, head) { | ||
121 | list_del(&p->head); | ||
122 | DFS_POOL_STAT_DEC(pulse_allocated); | ||
123 | kfree(p); | ||
124 | } | ||
125 | list_for_each_entry_safe(ps, ps0, &pseq_pool, head) { | ||
126 | list_del(&ps->head); | ||
127 | DFS_POOL_STAT_DEC(pseq_allocated); | ||
128 | kfree(ps); | ||
129 | } | ||
130 | } | ||
131 | spin_unlock_bh(&pool_lock); | ||
132 | } | ||
133 | |||
134 | static void pool_put_pulse_elem(struct pulse_elem *pe) | ||
135 | { | ||
136 | spin_lock_bh(&pool_lock); | ||
137 | list_add(&pe->head, &pulse_pool); | ||
138 | DFS_POOL_STAT_DEC(pulse_used); | ||
139 | spin_unlock_bh(&pool_lock); | ||
140 | } | ||
141 | |||
142 | static void pool_put_pseq_elem(struct pri_sequence *pse) | ||
143 | { | ||
144 | spin_lock_bh(&pool_lock); | ||
145 | list_add(&pse->head, &pseq_pool); | ||
146 | DFS_POOL_STAT_DEC(pseq_used); | ||
147 | spin_unlock_bh(&pool_lock); | ||
148 | } | ||
149 | |||
150 | static struct pri_sequence *pool_get_pseq_elem(void) | ||
151 | { | ||
152 | struct pri_sequence *pse = NULL; | ||
153 | spin_lock_bh(&pool_lock); | ||
154 | if (!list_empty(&pseq_pool)) { | ||
155 | pse = list_first_entry(&pseq_pool, struct pri_sequence, head); | ||
156 | list_del(&pse->head); | ||
157 | DFS_POOL_STAT_INC(pseq_used); | ||
158 | } | ||
159 | spin_unlock_bh(&pool_lock); | ||
160 | return pse; | ||
161 | } | ||
162 | |||
163 | static struct pulse_elem *pool_get_pulse_elem(void) | ||
164 | { | ||
165 | struct pulse_elem *pe = NULL; | ||
166 | spin_lock_bh(&pool_lock); | ||
167 | if (!list_empty(&pulse_pool)) { | ||
168 | pe = list_first_entry(&pulse_pool, struct pulse_elem, head); | ||
169 | list_del(&pe->head); | ||
170 | DFS_POOL_STAT_INC(pulse_used); | ||
171 | } | ||
172 | spin_unlock_bh(&pool_lock); | ||
173 | return pe; | ||
174 | } | ||
97 | 175 | ||
98 | static struct pulse_elem *pulse_queue_get_tail(struct pri_detector *pde) | 176 | static struct pulse_elem *pulse_queue_get_tail(struct pri_detector *pde) |
99 | { | 177 | { |
@@ -110,7 +188,7 @@ static bool pulse_queue_dequeue(struct pri_detector *pde) | |||
110 | list_del_init(&p->head); | 188 | list_del_init(&p->head); |
111 | pde->count--; | 189 | pde->count--; |
112 | /* give it back to pool */ | 190 | /* give it back to pool */ |
113 | list_add(&p->head, &pulse_pool); | 191 | pool_put_pulse_elem(p); |
114 | } | 192 | } |
115 | return (pde->count > 0); | 193 | return (pde->count > 0); |
116 | } | 194 | } |
@@ -138,16 +216,15 @@ static void pulse_queue_check_window(struct pri_detector *pde) | |||
138 | 216 | ||
139 | static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) | 217 | static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) |
140 | { | 218 | { |
141 | struct pulse_elem *p; | 219 | struct pulse_elem *p = pool_get_pulse_elem(); |
142 | if (!list_empty(&pulse_pool)) { | 220 | if (p == NULL) { |
143 | p = list_first_entry(&pulse_pool, struct pulse_elem, head); | ||
144 | list_del(&p->head); | ||
145 | } else { | ||
146 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 221 | p = kmalloc(sizeof(*p), GFP_KERNEL); |
147 | if (p == NULL) { | 222 | if (p == NULL) { |
148 | pr_err("failed to allocate pulse_elem\n"); | 223 | DFS_POOL_STAT_INC(pulse_alloc_error); |
149 | return false; | 224 | return false; |
150 | } | 225 | } |
226 | DFS_POOL_STAT_INC(pulse_allocated); | ||
227 | DFS_POOL_STAT_INC(pulse_used); | ||
151 | } | 228 | } |
152 | INIT_LIST_HEAD(&p->head); | 229 | INIT_LIST_HEAD(&p->head); |
153 | p->ts = ts; | 230 | p->ts = ts; |
@@ -220,15 +297,15 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde, | |||
220 | 297 | ||
221 | /* this is a valid one, add it */ | 298 | /* this is a valid one, add it */ |
222 | ps.deadline_ts = ps.first_ts + ps.dur; | 299 | ps.deadline_ts = ps.first_ts + ps.dur; |
223 | 300 | new_ps = pool_get_pseq_elem(); | |
224 | if (!list_empty(&pseq_pool)) { | 301 | if (new_ps == NULL) { |
225 | new_ps = list_first_entry(&pseq_pool, | ||
226 | struct pri_sequence, head); | ||
227 | list_del(&new_ps->head); | ||
228 | } else { | ||
229 | new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL); | 302 | new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL); |
230 | if (new_ps == NULL) | 303 | if (new_ps == NULL) { |
304 | DFS_POOL_STAT_INC(pseq_alloc_error); | ||
231 | return false; | 305 | return false; |
306 | } | ||
307 | DFS_POOL_STAT_INC(pseq_allocated); | ||
308 | DFS_POOL_STAT_INC(pseq_used); | ||
232 | } | 309 | } |
233 | memcpy(new_ps, &ps, sizeof(ps)); | 310 | memcpy(new_ps, &ps, sizeof(ps)); |
234 | INIT_LIST_HEAD(&new_ps->head); | 311 | INIT_LIST_HEAD(&new_ps->head); |
@@ -250,7 +327,7 @@ pseq_handler_add_to_existing_seqs(struct pri_detector *pde, u64 ts) | |||
250 | /* first ensure that sequence is within window */ | 327 | /* first ensure that sequence is within window */ |
251 | if (ts > ps->deadline_ts) { | 328 | if (ts > ps->deadline_ts) { |
252 | list_del_init(&ps->head); | 329 | list_del_init(&ps->head); |
253 | list_add(&ps->head, &pseq_pool); | 330 | pool_put_pseq_elem(ps); |
254 | continue; | 331 | continue; |
255 | } | 332 | } |
256 | 333 | ||
@@ -299,11 +376,11 @@ static void pri_detector_reset(struct pri_detector *pde, u64 ts) | |||
299 | struct pulse_elem *p, *p0; | 376 | struct pulse_elem *p, *p0; |
300 | list_for_each_entry_safe(ps, ps0, &pde->sequences, head) { | 377 | list_for_each_entry_safe(ps, ps0, &pde->sequences, head) { |
301 | list_del_init(&ps->head); | 378 | list_del_init(&ps->head); |
302 | list_add(&ps->head, &pseq_pool); | 379 | pool_put_pseq_elem(ps); |
303 | } | 380 | } |
304 | list_for_each_entry_safe(p, p0, &pde->pulses, head) { | 381 | list_for_each_entry_safe(p, p0, &pde->pulses, head) { |
305 | list_del_init(&p->head); | 382 | list_del_init(&p->head); |
306 | list_add(&p->head, &pulse_pool); | 383 | pool_put_pulse_elem(p); |
307 | } | 384 | } |
308 | pde->count = 0; | 385 | pde->count = 0; |
309 | pde->last_ts = ts; | 386 | pde->last_ts = ts; |
@@ -312,22 +389,7 @@ static void pri_detector_reset(struct pri_detector *pde, u64 ts) | |||
312 | static void pri_detector_exit(struct pri_detector *de) | 389 | static void pri_detector_exit(struct pri_detector *de) |
313 | { | 390 | { |
314 | pri_detector_reset(de, 0); | 391 | pri_detector_reset(de, 0); |
315 | 392 | pool_deregister_ref(); | |
316 | singleton_pool_references--; | ||
317 | if (singleton_pool_references == 0) { | ||
318 | /* free singleton pools with no references left */ | ||
319 | struct pri_sequence *ps, *ps0; | ||
320 | struct pulse_elem *p, *p0; | ||
321 | |||
322 | list_for_each_entry_safe(p, p0, &pulse_pool, head) { | ||
323 | list_del(&p->head); | ||
324 | kfree(p); | ||
325 | } | ||
326 | list_for_each_entry_safe(ps, ps0, &pseq_pool, head) { | ||
327 | list_del(&ps->head); | ||
328 | kfree(ps); | ||
329 | } | ||
330 | } | ||
331 | kfree(de); | 393 | kfree(de); |
332 | } | 394 | } |
333 | 395 | ||
@@ -385,6 +447,6 @@ pri_detector_init(const struct radar_detector_specs *rs) | |||
385 | de->max_count = rs->ppb * 2; | 447 | de->max_count = rs->ppb * 2; |
386 | de->rs = rs; | 448 | de->rs = rs; |
387 | 449 | ||
388 | singleton_pool_references++; | 450 | pool_register_ref(); |
389 | return de; | 451 | return de; |
390 | } | 452 | } |
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index dd10f4ac03ef..281a9af0f1b6 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c | |||
@@ -365,7 +365,7 @@ void ath9k_stop_btcoex(struct ath_softc *sc) | |||
365 | ath9k_hw_btcoex_disable(ah); | 365 | ath9k_hw_btcoex_disable(ah); |
366 | if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) | 366 | if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) |
367 | ath9k_btcoex_timer_pause(sc); | 367 | ath9k_btcoex_timer_pause(sc); |
368 | if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_MCI) | 368 | if (AR_SREV_9462(ah)) |
369 | ath_mci_flush_profile(&sc->btcoex.mci); | 369 | ath_mci_flush_profile(&sc->btcoex.mci); |
370 | } | 370 | } |
371 | } | 371 | } |
@@ -376,7 +376,7 @@ void ath9k_deinit_btcoex(struct ath_softc *sc) | |||
376 | ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE) | 376 | ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE) |
377 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); | 377 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); |
378 | 378 | ||
379 | if (ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_MCI) | 379 | if (AR_SREV_9462(sc->sc_ah)) |
380 | ath_mci_cleanup(sc); | 380 | ath_mci_cleanup(sc); |
381 | } | 381 | } |
382 | 382 | ||
@@ -402,17 +402,16 @@ int ath9k_init_btcoex(struct ath_softc *sc) | |||
402 | txq = sc->tx.txq_map[WME_AC_BE]; | 402 | txq = sc->tx.txq_map[WME_AC_BE]; |
403 | ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); | 403 | ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); |
404 | sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; | 404 | sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; |
405 | break; | 405 | if (AR_SREV_9462(ah)) { |
406 | case ATH_BTCOEX_CFG_MCI: | 406 | sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; |
407 | sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; | 407 | INIT_LIST_HEAD(&sc->btcoex.mci.info); |
408 | sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; | ||
409 | INIT_LIST_HEAD(&sc->btcoex.mci.info); | ||
410 | 408 | ||
411 | r = ath_mci_setup(sc); | 409 | r = ath_mci_setup(sc); |
412 | if (r) | 410 | if (r) |
413 | return r; | 411 | return r; |
414 | 412 | ||
415 | ath9k_hw_btcoex_init_mci(ah); | 413 | ath9k_hw_btcoex_init_mci(ah); |
414 | } | ||
416 | 415 | ||
417 | break; | 416 | break; |
418 | default: | 417 | default: |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 72c5bcd4886d..75fd87f295d4 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -191,6 +191,22 @@ bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout) | |||
191 | } | 191 | } |
192 | EXPORT_SYMBOL(ath9k_hw_wait); | 192 | EXPORT_SYMBOL(ath9k_hw_wait); |
193 | 193 | ||
194 | void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan, | ||
195 | int hw_delay) | ||
196 | { | ||
197 | if (IS_CHAN_B(chan)) | ||
198 | hw_delay = (4 * hw_delay) / 22; | ||
199 | else | ||
200 | hw_delay /= 10; | ||
201 | |||
202 | if (IS_CHAN_HALF_RATE(chan)) | ||
203 | hw_delay *= 2; | ||
204 | else if (IS_CHAN_QUARTER_RATE(chan)) | ||
205 | hw_delay *= 4; | ||
206 | |||
207 | udelay(hw_delay + BASE_ACTIVATE_DELAY); | ||
208 | } | ||
209 | |||
194 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, | 210 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, |
195 | int column, unsigned int *writecnt) | 211 | int column, unsigned int *writecnt) |
196 | { | 212 | { |
@@ -1020,7 +1036,7 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1020 | struct ath_common *common = ath9k_hw_common(ah); | 1036 | struct ath_common *common = ath9k_hw_common(ah); |
1021 | struct ieee80211_conf *conf = &common->hw->conf; | 1037 | struct ieee80211_conf *conf = &common->hw->conf; |
1022 | const struct ath9k_channel *chan = ah->curchan; | 1038 | const struct ath9k_channel *chan = ah->curchan; |
1023 | int acktimeout, ctstimeout; | 1039 | int acktimeout, ctstimeout, ack_offset = 0; |
1024 | int slottime; | 1040 | int slottime; |
1025 | int sifstime; | 1041 | int sifstime; |
1026 | int rx_lat = 0, tx_lat = 0, eifs = 0; | 1042 | int rx_lat = 0, tx_lat = 0, eifs = 0; |
@@ -1041,6 +1057,11 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1041 | rx_lat = 37; | 1057 | rx_lat = 37; |
1042 | tx_lat = 54; | 1058 | tx_lat = 54; |
1043 | 1059 | ||
1060 | if (IS_CHAN_5GHZ(chan)) | ||
1061 | sifstime = 16; | ||
1062 | else | ||
1063 | sifstime = 10; | ||
1064 | |||
1044 | if (IS_CHAN_HALF_RATE(chan)) { | 1065 | if (IS_CHAN_HALF_RATE(chan)) { |
1045 | eifs = 175; | 1066 | eifs = 175; |
1046 | rx_lat *= 2; | 1067 | rx_lat *= 2; |
@@ -1048,8 +1069,9 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1048 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) | 1069 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) |
1049 | tx_lat += 11; | 1070 | tx_lat += 11; |
1050 | 1071 | ||
1072 | sifstime *= 2; | ||
1073 | ack_offset = 16; | ||
1051 | slottime = 13; | 1074 | slottime = 13; |
1052 | sifstime = 32; | ||
1053 | } else if (IS_CHAN_QUARTER_RATE(chan)) { | 1075 | } else if (IS_CHAN_QUARTER_RATE(chan)) { |
1054 | eifs = 340; | 1076 | eifs = 340; |
1055 | rx_lat = (rx_lat * 4) - 1; | 1077 | rx_lat = (rx_lat * 4) - 1; |
@@ -1057,8 +1079,9 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1057 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) | 1079 | if (IS_CHAN_A_FAST_CLOCK(ah, chan)) |
1058 | tx_lat += 22; | 1080 | tx_lat += 22; |
1059 | 1081 | ||
1082 | sifstime *= 4; | ||
1083 | ack_offset = 32; | ||
1060 | slottime = 21; | 1084 | slottime = 21; |
1061 | sifstime = 64; | ||
1062 | } else { | 1085 | } else { |
1063 | if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { | 1086 | if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { |
1064 | eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO; | 1087 | eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO; |
@@ -1072,14 +1095,10 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1072 | tx_lat = MS(reg, AR_USEC_TX_LAT); | 1095 | tx_lat = MS(reg, AR_USEC_TX_LAT); |
1073 | 1096 | ||
1074 | slottime = ah->slottime; | 1097 | slottime = ah->slottime; |
1075 | if (IS_CHAN_5GHZ(chan)) | ||
1076 | sifstime = 16; | ||
1077 | else | ||
1078 | sifstime = 10; | ||
1079 | } | 1098 | } |
1080 | 1099 | ||
1081 | /* As defined by IEEE 802.11-2007 17.3.8.6 */ | 1100 | /* As defined by IEEE 802.11-2007 17.3.8.6 */ |
1082 | acktimeout = slottime + sifstime + 3 * ah->coverage_class; | 1101 | acktimeout = slottime + sifstime + 3 * ah->coverage_class + ack_offset; |
1083 | ctstimeout = acktimeout; | 1102 | ctstimeout = acktimeout; |
1084 | 1103 | ||
1085 | /* | 1104 | /* |
@@ -1089,7 +1108,8 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) | |||
1089 | * BA frames in some implementations, but it has been found to fix ACK | 1108 | * BA frames in some implementations, but it has been found to fix ACK |
1090 | * timeout issues in other cases as well. | 1109 | * timeout issues in other cases as well. |
1091 | */ | 1110 | */ |
1092 | if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) { | 1111 | if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ && |
1112 | !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) { | ||
1093 | acktimeout += 64 - sifstime - ah->slottime; | 1113 | acktimeout += 64 - sifstime - ah->slottime; |
1094 | ctstimeout += 48 - sifstime - ah->slottime; | 1114 | ctstimeout += 48 - sifstime - ah->slottime; |
1095 | } | 1115 | } |
@@ -1667,6 +1687,10 @@ static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan) | |||
1667 | if (chan->channel == ah->curchan->channel) | 1687 | if (chan->channel == ah->curchan->channel) |
1668 | goto fail; | 1688 | goto fail; |
1669 | 1689 | ||
1690 | if ((ah->curchan->channelFlags | chan->channelFlags) & | ||
1691 | (CHANNEL_HALF | CHANNEL_QUARTER)) | ||
1692 | goto fail; | ||
1693 | |||
1670 | if ((chan->channelFlags & CHANNEL_ALL) != | 1694 | if ((chan->channelFlags & CHANNEL_ALL) != |
1671 | (ah->curchan->channelFlags & CHANNEL_ALL)) | 1695 | (ah->curchan->channelFlags & CHANNEL_ALL)) |
1672 | goto fail; | 1696 | goto fail; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index dd4b8f4097c8..8535f76699af 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -923,6 +923,8 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); | |||
923 | void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); | 923 | void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); |
924 | 924 | ||
925 | /* General Operation */ | 925 | /* General Operation */ |
926 | void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan, | ||
927 | int hw_delay); | ||
926 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); | 928 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); |
927 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, | 929 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, |
928 | int column, unsigned int *writecnt); | 930 | int column, unsigned int *writecnt); |
@@ -959,7 +961,8 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); | |||
959 | #ifdef CONFIG_ATH9K_DEBUGFS | 961 | #ifdef CONFIG_ATH9K_DEBUGFS |
960 | void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); | 962 | void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); |
961 | #else | 963 | #else |
962 | static void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause) {} | 964 | static inline void ath9k_debug_sync_cause(struct ath_common *common, |
965 | u32 sync_cause) {} | ||
963 | #endif | 966 | #endif |
964 | 967 | ||
965 | /* Generic hw timer primitives */ | 968 | /* Generic hw timer primitives */ |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 7a6b9f69a7b1..dee9e092449a 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -646,6 +646,24 @@ void ath9k_reload_chainmask_settings(struct ath_softc *sc) | |||
646 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); | 646 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); |
647 | } | 647 | } |
648 | 648 | ||
649 | static const struct ieee80211_iface_limit if_limits[] = { | ||
650 | { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) | | ||
651 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
652 | BIT(NL80211_IFTYPE_WDS) }, | ||
653 | { .max = 8, .types = | ||
654 | #ifdef CONFIG_MAC80211_MESH | ||
655 | BIT(NL80211_IFTYPE_MESH_POINT) | | ||
656 | #endif | ||
657 | BIT(NL80211_IFTYPE_AP) | | ||
658 | BIT(NL80211_IFTYPE_P2P_GO) }, | ||
659 | }; | ||
660 | |||
661 | static const struct ieee80211_iface_combination if_comb = { | ||
662 | .limits = if_limits, | ||
663 | .n_limits = ARRAY_SIZE(if_limits), | ||
664 | .max_interfaces = 2048, | ||
665 | .num_different_channels = 1, | ||
666 | }; | ||
649 | 667 | ||
650 | void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | 668 | void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
651 | { | 669 | { |
@@ -675,6 +693,9 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
675 | BIT(NL80211_IFTYPE_ADHOC) | | 693 | BIT(NL80211_IFTYPE_ADHOC) | |
676 | BIT(NL80211_IFTYPE_MESH_POINT); | 694 | BIT(NL80211_IFTYPE_MESH_POINT); |
677 | 695 | ||
696 | hw->wiphy->iface_combinations = &if_comb; | ||
697 | hw->wiphy->n_iface_combinations = 1; | ||
698 | |||
678 | if (AR_SREV_5416(sc->sc_ah)) | 699 | if (AR_SREV_5416(sc->sc_ah)) |
679 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 700 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
680 | 701 | ||
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index f7bd2532269c..04ef775ccee1 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -133,8 +133,16 @@ EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel); | |||
133 | 133 | ||
134 | void ath9k_hw_abort_tx_dma(struct ath_hw *ah) | 134 | void ath9k_hw_abort_tx_dma(struct ath_hw *ah) |
135 | { | 135 | { |
136 | int maxdelay = 1000; | ||
136 | int i, q; | 137 | int i, q; |
137 | 138 | ||
139 | if (ah->curchan) { | ||
140 | if (IS_CHAN_HALF_RATE(ah->curchan)) | ||
141 | maxdelay *= 2; | ||
142 | else if (IS_CHAN_QUARTER_RATE(ah->curchan)) | ||
143 | maxdelay *= 4; | ||
144 | } | ||
145 | |||
138 | REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M); | 146 | REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M); |
139 | 147 | ||
140 | REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF); | 148 | REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF); |
@@ -142,7 +150,7 @@ void ath9k_hw_abort_tx_dma(struct ath_hw *ah) | |||
142 | REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF); | 150 | REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF); |
143 | 151 | ||
144 | for (q = 0; q < AR_NUM_QCU; q++) { | 152 | for (q = 0; q < AR_NUM_QCU; q++) { |
145 | for (i = 0; i < 1000; i++) { | 153 | for (i = 0; i < maxdelay; i++) { |
146 | if (i) | 154 | if (i) |
147 | udelay(5); | 155 | udelay(5); |
148 | 156 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index d0a4b9b270c5..dfa78e8b6470 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -113,21 +113,25 @@ void ath9k_ps_restore(struct ath_softc *sc) | |||
113 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 113 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
114 | enum ath9k_power_mode mode; | 114 | enum ath9k_power_mode mode; |
115 | unsigned long flags; | 115 | unsigned long flags; |
116 | bool reset; | ||
116 | 117 | ||
117 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | 118 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
118 | if (--sc->ps_usecount != 0) | 119 | if (--sc->ps_usecount != 0) |
119 | goto unlock; | 120 | goto unlock; |
120 | 121 | ||
121 | if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK)) | 122 | if (sc->ps_idle) { |
123 | ath9k_hw_setrxabort(sc->sc_ah, 1); | ||
124 | ath9k_hw_stopdmarecv(sc->sc_ah, &reset); | ||
122 | mode = ATH9K_PM_FULL_SLEEP; | 125 | mode = ATH9K_PM_FULL_SLEEP; |
123 | else if (sc->ps_enabled && | 126 | } else if (sc->ps_enabled && |
124 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | | 127 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | |
125 | PS_WAIT_FOR_CAB | | 128 | PS_WAIT_FOR_CAB | |
126 | PS_WAIT_FOR_PSPOLL_DATA | | 129 | PS_WAIT_FOR_PSPOLL_DATA | |
127 | PS_WAIT_FOR_TX_ACK))) | 130 | PS_WAIT_FOR_TX_ACK))) { |
128 | mode = ATH9K_PM_NETWORK_SLEEP; | 131 | mode = ATH9K_PM_NETWORK_SLEEP; |
129 | else | 132 | } else { |
130 | goto unlock; | 133 | goto unlock; |
134 | } | ||
131 | 135 | ||
132 | spin_lock(&common->cc_lock); | 136 | spin_lock(&common->cc_lock); |
133 | ath_hw_cycle_counters_update(common); | 137 | ath_hw_cycle_counters_update(common); |
@@ -1100,14 +1104,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1100 | } | 1104 | } |
1101 | } | 1105 | } |
1102 | 1106 | ||
1103 | /* | 1107 | if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP)) { |
1104 | * Cannot tx while the hardware is in full sleep, it first needs a full | ||
1105 | * chip reset to recover from that | ||
1106 | */ | ||
1107 | if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_FULL_SLEEP)) | ||
1108 | goto exit; | ||
1109 | |||
1110 | if (unlikely(sc->sc_ah->power_mode != ATH9K_PM_AWAKE)) { | ||
1111 | /* | 1108 | /* |
1112 | * We are using PS-Poll and mac80211 can request TX while in | 1109 | * We are using PS-Poll and mac80211 can request TX while in |
1113 | * power save mode. Need to wake up hardware for the TX to be | 1110 | * power save mode. Need to wake up hardware for the TX to be |
@@ -1126,12 +1123,21 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1126 | } | 1123 | } |
1127 | /* | 1124 | /* |
1128 | * The actual restore operation will happen only after | 1125 | * The actual restore operation will happen only after |
1129 | * the sc_flags bit is cleared. We are just dropping | 1126 | * the ps_flags bit is cleared. We are just dropping |
1130 | * the ps_usecount here. | 1127 | * the ps_usecount here. |
1131 | */ | 1128 | */ |
1132 | ath9k_ps_restore(sc); | 1129 | ath9k_ps_restore(sc); |
1133 | } | 1130 | } |
1134 | 1131 | ||
1132 | /* | ||
1133 | * Cannot tx while the hardware is in full sleep, it first needs a full | ||
1134 | * chip reset to recover from that | ||
1135 | */ | ||
1136 | if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_FULL_SLEEP)) { | ||
1137 | ath_err(common, "TX while HW is in FULL_SLEEP mode\n"); | ||
1138 | goto exit; | ||
1139 | } | ||
1140 | |||
1135 | memset(&txctl, 0, sizeof(struct ath_tx_control)); | 1141 | memset(&txctl, 0, sizeof(struct ath_tx_control)); |
1136 | txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; | 1142 | txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; |
1137 | 1143 | ||
@@ -1245,7 +1251,6 @@ static void ath9k_reclaim_beacon(struct ath_softc *sc, | |||
1245 | ath9k_set_beaconing_status(sc, false); | 1251 | ath9k_set_beaconing_status(sc, false); |
1246 | ath_beacon_return(sc, avp); | 1252 | ath_beacon_return(sc, avp); |
1247 | ath9k_set_beaconing_status(sc, true); | 1253 | ath9k_set_beaconing_status(sc, true); |
1248 | sc->sc_flags &= ~SC_OP_BEACONS; | ||
1249 | } | 1254 | } |
1250 | 1255 | ||
1251 | static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | 1256 | static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) |
@@ -1376,17 +1381,9 @@ static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw, | |||
1376 | ath9k_calculate_summary_state(hw, vif); | 1381 | ath9k_calculate_summary_state(hw, vif); |
1377 | 1382 | ||
1378 | if (ath9k_uses_beacons(vif->type)) { | 1383 | if (ath9k_uses_beacons(vif->type)) { |
1379 | int error; | 1384 | /* Reserve a beacon slot for the vif */ |
1380 | /* This may fail because upper levels do not have beacons | ||
1381 | * properly configured yet. That's OK, we assume it | ||
1382 | * will be properly configured and then we will be notified | ||
1383 | * in the info_changed method and set up beacons properly | ||
1384 | * there. | ||
1385 | */ | ||
1386 | ath9k_set_beaconing_status(sc, false); | 1385 | ath9k_set_beaconing_status(sc, false); |
1387 | error = ath_beacon_alloc(sc, vif); | 1386 | ath_beacon_alloc(sc, vif); |
1388 | if (!error) | ||
1389 | ath_beacon_config(sc, vif); | ||
1390 | ath9k_set_beaconing_status(sc, true); | 1387 | ath9k_set_beaconing_status(sc, true); |
1391 | } | 1388 | } |
1392 | } | 1389 | } |
@@ -1537,6 +1534,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1537 | static void ath9k_enable_ps(struct ath_softc *sc) | 1534 | static void ath9k_enable_ps(struct ath_softc *sc) |
1538 | { | 1535 | { |
1539 | struct ath_hw *ah = sc->sc_ah; | 1536 | struct ath_hw *ah = sc->sc_ah; |
1537 | struct ath_common *common = ath9k_hw_common(ah); | ||
1540 | 1538 | ||
1541 | sc->ps_enabled = true; | 1539 | sc->ps_enabled = true; |
1542 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { | 1540 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { |
@@ -1546,11 +1544,13 @@ static void ath9k_enable_ps(struct ath_softc *sc) | |||
1546 | } | 1544 | } |
1547 | ath9k_hw_setrxabort(ah, 1); | 1545 | ath9k_hw_setrxabort(ah, 1); |
1548 | } | 1546 | } |
1547 | ath_dbg(common, PS, "PowerSave enabled\n"); | ||
1549 | } | 1548 | } |
1550 | 1549 | ||
1551 | static void ath9k_disable_ps(struct ath_softc *sc) | 1550 | static void ath9k_disable_ps(struct ath_softc *sc) |
1552 | { | 1551 | { |
1553 | struct ath_hw *ah = sc->sc_ah; | 1552 | struct ath_hw *ah = sc->sc_ah; |
1553 | struct ath_common *common = ath9k_hw_common(ah); | ||
1554 | 1554 | ||
1555 | sc->ps_enabled = false; | 1555 | sc->ps_enabled = false; |
1556 | ath9k_hw_setpower(ah, ATH9K_PM_AWAKE); | 1556 | ath9k_hw_setpower(ah, ATH9K_PM_AWAKE); |
@@ -1565,7 +1565,7 @@ static void ath9k_disable_ps(struct ath_softc *sc) | |||
1565 | ath9k_hw_set_interrupts(ah); | 1565 | ath9k_hw_set_interrupts(ah); |
1566 | } | 1566 | } |
1567 | } | 1567 | } |
1568 | 1568 | ath_dbg(common, PS, "PowerSave disabled\n"); | |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | 1571 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
@@ -1993,7 +1993,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
1993 | struct ath_common *common = ath9k_hw_common(ah); | 1993 | struct ath_common *common = ath9k_hw_common(ah); |
1994 | struct ath_vif *avp = (void *)vif->drv_priv; | 1994 | struct ath_vif *avp = (void *)vif->drv_priv; |
1995 | int slottime; | 1995 | int slottime; |
1996 | int error; | ||
1997 | 1996 | ||
1998 | ath9k_ps_wakeup(sc); | 1997 | ath9k_ps_wakeup(sc); |
1999 | mutex_lock(&sc->mutex); | 1998 | mutex_lock(&sc->mutex); |
@@ -2026,13 +2025,25 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
2026 | } | 2025 | } |
2027 | } | 2026 | } |
2028 | 2027 | ||
2029 | /* Enable transmission of beacons (AP, IBSS, MESH) */ | 2028 | /* |
2030 | if ((changed & BSS_CHANGED_BEACON) || | 2029 | * In case of AP mode, the HW TSF has to be reset |
2031 | ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { | 2030 | * when the beacon interval changes. |
2031 | */ | ||
2032 | if ((changed & BSS_CHANGED_BEACON_INT) && | ||
2033 | (vif->type == NL80211_IFTYPE_AP)) | ||
2034 | sc->sc_flags |= SC_OP_TSF_RESET; | ||
2035 | |||
2036 | /* Configure beaconing (AP, IBSS, MESH) */ | ||
2037 | if (ath9k_uses_beacons(vif->type) && | ||
2038 | ((changed & BSS_CHANGED_BEACON) || | ||
2039 | (changed & BSS_CHANGED_BEACON_ENABLED) || | ||
2040 | (changed & BSS_CHANGED_BEACON_INT))) { | ||
2032 | ath9k_set_beaconing_status(sc, false); | 2041 | ath9k_set_beaconing_status(sc, false); |
2033 | error = ath_beacon_alloc(sc, vif); | 2042 | if (bss_conf->enable_beacon) |
2034 | if (!error) | 2043 | ath_beacon_alloc(sc, vif); |
2035 | ath_beacon_config(sc, vif); | 2044 | else |
2045 | avp->is_bslot_active = false; | ||
2046 | ath_beacon_config(sc, vif); | ||
2036 | ath9k_set_beaconing_status(sc, true); | 2047 | ath9k_set_beaconing_status(sc, true); |
2037 | } | 2048 | } |
2038 | 2049 | ||
@@ -2055,30 +2066,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
2055 | } | 2066 | } |
2056 | } | 2067 | } |
2057 | 2068 | ||
2058 | /* Disable transmission of beacons */ | ||
2059 | if ((changed & BSS_CHANGED_BEACON_ENABLED) && | ||
2060 | !bss_conf->enable_beacon) { | ||
2061 | ath9k_set_beaconing_status(sc, false); | ||
2062 | avp->is_bslot_active = false; | ||
2063 | ath9k_set_beaconing_status(sc, true); | ||
2064 | } | ||
2065 | |||
2066 | if (changed & BSS_CHANGED_BEACON_INT) { | ||
2067 | /* | ||
2068 | * In case of AP mode, the HW TSF has to be reset | ||
2069 | * when the beacon interval changes. | ||
2070 | */ | ||
2071 | if (vif->type == NL80211_IFTYPE_AP) { | ||
2072 | sc->sc_flags |= SC_OP_TSF_RESET; | ||
2073 | ath9k_set_beaconing_status(sc, false); | ||
2074 | error = ath_beacon_alloc(sc, vif); | ||
2075 | if (!error) | ||
2076 | ath_beacon_config(sc, vif); | ||
2077 | ath9k_set_beaconing_status(sc, true); | ||
2078 | } else | ||
2079 | ath_beacon_config(sc, vif); | ||
2080 | } | ||
2081 | |||
2082 | mutex_unlock(&sc->mutex); | 2069 | mutex_unlock(&sc->mutex); |
2083 | ath9k_ps_restore(sc); | 2070 | ath9k_ps_restore(sc); |
2084 | } | 2071 | } |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 301ef3e57145..544e5490ca2e 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -812,6 +812,7 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
812 | is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && | 812 | is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && |
813 | test_bit(rx_stats->rs_keyix, common->tkip_keymap); | 813 | test_bit(rx_stats->rs_keyix, common->tkip_keymap); |
814 | strip_mic = is_valid_tkip && ieee80211_is_data(fc) && | 814 | strip_mic = is_valid_tkip && ieee80211_is_data(fc) && |
815 | ieee80211_has_protected(fc) && | ||
815 | !(rx_stats->rs_status & | 816 | !(rx_stats->rs_status & |
816 | (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC | | 817 | (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC | |
817 | ATH9K_RXERR_KEYMISS)); | 818 | ATH9K_RXERR_KEYMISS)); |
@@ -907,7 +908,7 @@ static int ath9k_process_rate(struct ath_common *common, | |||
907 | struct ieee80211_supported_band *sband; | 908 | struct ieee80211_supported_band *sband; |
908 | enum ieee80211_band band; | 909 | enum ieee80211_band band; |
909 | unsigned int i = 0; | 910 | unsigned int i = 0; |
910 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 911 | struct ath_softc __maybe_unused *sc = common->priv; |
911 | 912 | ||
912 | band = hw->conf.channel->band; | 913 | band = hw->conf.channel->band; |
913 | sband = hw->wiphy->bands[band]; | 914 | sband = hw->wiphy->bands[band]; |
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile index f2cd67874cf4..406f297a9a56 100644 --- a/drivers/net/wireless/iwlwifi/Makefile +++ b/drivers/net/wireless/iwlwifi/Makefile | |||
@@ -5,7 +5,7 @@ iwlwifi-objs += iwl-ucode.o iwl-agn-tx.o iwl-debug.o | |||
5 | iwlwifi-objs += iwl-agn-lib.o iwl-agn-calib.o iwl-io.o | 5 | iwlwifi-objs += iwl-agn-lib.o iwl-agn-calib.o iwl-io.o |
6 | iwlwifi-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o | 6 | iwlwifi-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o |
7 | 7 | ||
8 | iwlwifi-objs += iwl-core.o iwl-eeprom.o iwl-power.o | 8 | iwlwifi-objs += iwl-eeprom.o iwl-power.o |
9 | iwlwifi-objs += iwl-scan.o iwl-led.o | 9 | iwlwifi-objs += iwl-scan.o iwl-led.o |
10 | iwlwifi-objs += iwl-agn-rxon.o iwl-agn-devices.o | 10 | iwlwifi-objs += iwl-agn-rxon.o iwl-agn-devices.o |
11 | iwlwifi-objs += iwl-5000.o | 11 | iwlwifi-objs += iwl-5000.o |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index e9006078f4e2..8c7a0cd13854 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include <linux/stringify.h> | 28 | #include <linux/stringify.h> |
29 | #include "iwl-config.h" | 29 | #include "iwl-config.h" |
30 | #include "iwl-cfg.h" | 30 | #include "iwl-cfg.h" |
31 | #include "iwl-dev.h" /* still needed */ | 31 | #include "iwl-csr.h" |
32 | #include "iwl-agn-hw.h" | ||
32 | 33 | ||
33 | /* Highest firmware API version supported */ | 34 | /* Highest firmware API version supported */ |
34 | #define IWL1000_UCODE_API_MAX 6 | 35 | #define IWL1000_UCODE_API_MAX 6 |
@@ -42,6 +43,10 @@ | |||
42 | #define IWL1000_UCODE_API_MIN 1 | 43 | #define IWL1000_UCODE_API_MIN 1 |
43 | #define IWL100_UCODE_API_MIN 5 | 44 | #define IWL100_UCODE_API_MIN 5 |
44 | 45 | ||
46 | /* EEPROM version */ | ||
47 | #define EEPROM_1000_TX_POWER_VERSION (4) | ||
48 | #define EEPROM_1000_EEPROM_VERSION (0x15C) | ||
49 | |||
45 | #define IWL1000_FW_PRE "iwlwifi-1000-" | 50 | #define IWL1000_FW_PRE "iwlwifi-1000-" |
46 | #define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode" | 51 | #define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode" |
47 | 52 | ||
@@ -66,7 +71,6 @@ static const struct iwl_base_params iwl1000_base_params = { | |||
66 | static const struct iwl_ht_params iwl1000_ht_params = { | 71 | static const struct iwl_ht_params iwl1000_ht_params = { |
67 | .ht_greenfield_support = true, | 72 | .ht_greenfield_support = true, |
68 | .use_rts_for_aggregation = true, /* use rts/cts protection */ | 73 | .use_rts_for_aggregation = true, /* use rts/cts protection */ |
69 | .smps_mode = IEEE80211_SMPS_DYNAMIC, | ||
70 | }; | 74 | }; |
71 | 75 | ||
72 | #define IWL_DEVICE_1000 \ | 76 | #define IWL_DEVICE_1000 \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 3d4a36cf0408..9484e3be2678 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include <linux/stringify.h> | 28 | #include <linux/stringify.h> |
29 | #include "iwl-config.h" | 29 | #include "iwl-config.h" |
30 | #include "iwl-cfg.h" | 30 | #include "iwl-cfg.h" |
31 | #include "iwl-dev.h" /* still needed */ | 31 | #include "iwl-agn-hw.h" |
32 | #include "iwl-commands.h" /* needed for BT for now */ | ||
32 | 33 | ||
33 | /* Highest firmware API version supported */ | 34 | /* Highest firmware API version supported */ |
34 | #define IWL2030_UCODE_API_MAX 6 | 35 | #define IWL2030_UCODE_API_MAX 6 |
@@ -48,6 +49,11 @@ | |||
48 | #define IWL105_UCODE_API_MIN 5 | 49 | #define IWL105_UCODE_API_MIN 5 |
49 | #define IWL135_UCODE_API_MIN 5 | 50 | #define IWL135_UCODE_API_MIN 5 |
50 | 51 | ||
52 | /* EEPROM version */ | ||
53 | #define EEPROM_2000_TX_POWER_VERSION (6) | ||
54 | #define EEPROM_2000_EEPROM_VERSION (0x805) | ||
55 | |||
56 | |||
51 | #define IWL2030_FW_PRE "iwlwifi-2030-" | 57 | #define IWL2030_FW_PRE "iwlwifi-2030-" |
52 | #define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode" | 58 | #define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode" |
53 | 59 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index ffa9ac5fe086..67d4ef26043b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include <linux/stringify.h> | 28 | #include <linux/stringify.h> |
29 | #include "iwl-config.h" | 29 | #include "iwl-config.h" |
30 | #include "iwl-cfg.h" | 30 | #include "iwl-cfg.h" |
31 | #include "iwl-dev.h" /* still needed */ | 31 | #include "iwl-agn-hw.h" |
32 | #include "iwl-csr.h" | ||
32 | 33 | ||
33 | /* Highest firmware API version supported */ | 34 | /* Highest firmware API version supported */ |
34 | #define IWL5000_UCODE_API_MAX 5 | 35 | #define IWL5000_UCODE_API_MAX 5 |
@@ -38,6 +39,12 @@ | |||
38 | #define IWL5000_UCODE_API_MIN 1 | 39 | #define IWL5000_UCODE_API_MIN 1 |
39 | #define IWL5150_UCODE_API_MIN 1 | 40 | #define IWL5150_UCODE_API_MIN 1 |
40 | 41 | ||
42 | /* EEPROM versions */ | ||
43 | #define EEPROM_5000_TX_POWER_VERSION (4) | ||
44 | #define EEPROM_5000_EEPROM_VERSION (0x11A) | ||
45 | #define EEPROM_5050_TX_POWER_VERSION (4) | ||
46 | #define EEPROM_5050_EEPROM_VERSION (0x21E) | ||
47 | |||
41 | #define IWL5000_FW_PRE "iwlwifi-5000-" | 48 | #define IWL5000_FW_PRE "iwlwifi-5000-" |
42 | #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode" | 49 | #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode" |
43 | 50 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 00da2520a4b7..08afedf4b3ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include <linux/stringify.h> | 28 | #include <linux/stringify.h> |
29 | #include "iwl-config.h" | 29 | #include "iwl-config.h" |
30 | #include "iwl-cfg.h" | 30 | #include "iwl-cfg.h" |
31 | #include "iwl-dev.h" /* still needed */ | 31 | #include "iwl-agn-hw.h" |
32 | #include "iwl-commands.h" /* needed for BT for now */ | ||
32 | 33 | ||
33 | /* Highest firmware API version supported */ | 34 | /* Highest firmware API version supported */ |
34 | #define IWL6000_UCODE_API_MAX 6 | 35 | #define IWL6000_UCODE_API_MAX 6 |
@@ -44,6 +45,20 @@ | |||
44 | #define IWL6050_UCODE_API_MIN 4 | 45 | #define IWL6050_UCODE_API_MIN 4 |
45 | #define IWL6000G2_UCODE_API_MIN 4 | 46 | #define IWL6000G2_UCODE_API_MIN 4 |
46 | 47 | ||
48 | /* EEPROM versions */ | ||
49 | #define EEPROM_6000_TX_POWER_VERSION (4) | ||
50 | #define EEPROM_6000_EEPROM_VERSION (0x423) | ||
51 | #define EEPROM_6050_TX_POWER_VERSION (4) | ||
52 | #define EEPROM_6050_EEPROM_VERSION (0x532) | ||
53 | #define EEPROM_6150_TX_POWER_VERSION (6) | ||
54 | #define EEPROM_6150_EEPROM_VERSION (0x553) | ||
55 | #define EEPROM_6005_TX_POWER_VERSION (6) | ||
56 | #define EEPROM_6005_EEPROM_VERSION (0x709) | ||
57 | #define EEPROM_6030_TX_POWER_VERSION (6) | ||
58 | #define EEPROM_6030_EEPROM_VERSION (0x709) | ||
59 | #define EEPROM_6035_TX_POWER_VERSION (6) | ||
60 | #define EEPROM_6035_EEPROM_VERSION (0x753) | ||
61 | |||
47 | #define IWL6000_FW_PRE "iwlwifi-6000-" | 62 | #define IWL6000_FW_PRE "iwlwifi-6000-" |
48 | #define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode" | 63 | #define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode" |
49 | 64 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c index 61c243f7395f..95f27f1a423b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c | |||
@@ -64,7 +64,6 @@ | |||
64 | #include <net/mac80211.h> | 64 | #include <net/mac80211.h> |
65 | 65 | ||
66 | #include "iwl-dev.h" | 66 | #include "iwl-dev.h" |
67 | #include "iwl-core.h" | ||
68 | #include "iwl-agn-calib.h" | 67 | #include "iwl-agn-calib.h" |
69 | #include "iwl-trans.h" | 68 | #include "iwl-trans.h" |
70 | #include "iwl-agn.h" | 69 | #include "iwl-agn.h" |
@@ -521,7 +520,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv) | |||
521 | 520 | ||
522 | iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.enhance_table[0]); | 521 | iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.enhance_table[0]); |
523 | 522 | ||
524 | if (cfg(priv)->base_params->hd_v2) { | 523 | if (priv->cfg->base_params->hd_v2) { |
525 | cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] = | 524 | cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] = |
526 | HD_INA_NON_SQUARE_DET_OFDM_DATA_V2; | 525 | HD_INA_NON_SQUARE_DET_OFDM_DATA_V2; |
527 | cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] = | 526 | cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] = |
@@ -895,7 +894,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv, | |||
895 | continue; | 894 | continue; |
896 | } | 895 | } |
897 | 896 | ||
898 | delta_g = (cfg(priv)->base_params->chain_noise_scale * | 897 | delta_g = (priv->cfg->base_params->chain_noise_scale * |
899 | ((s32)average_noise[default_chain] - | 898 | ((s32)average_noise[default_chain] - |
900 | (s32)average_noise[i])) / 1500; | 899 | (s32)average_noise[i])) / 1500; |
901 | 900 | ||
@@ -1051,8 +1050,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) | |||
1051 | return; | 1050 | return; |
1052 | 1051 | ||
1053 | /* Analyze signal for disconnected antenna */ | 1052 | /* Analyze signal for disconnected antenna */ |
1054 | if (cfg(priv)->bt_params && | 1053 | if (priv->cfg->bt_params && |
1055 | cfg(priv)->bt_params->advanced_bt_coexist) { | 1054 | priv->cfg->bt_params->advanced_bt_coexist) { |
1056 | /* Disable disconnected antenna algorithm for advanced | 1055 | /* Disable disconnected antenna algorithm for advanced |
1057 | bt coex, assuming valid antennas are connected */ | 1056 | bt coex, assuming valid antennas are connected */ |
1058 | data->active_chains = priv->hw_params.valid_rx_ant; | 1057 | data->active_chains = priv->hw_params.valid_rx_ant; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.h b/drivers/net/wireless/iwlwifi/iwl-agn-calib.h index 9ed6683314a7..dbe13787f272 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.h | |||
@@ -63,7 +63,6 @@ | |||
63 | #define __iwl_calib_h__ | 63 | #define __iwl_calib_h__ |
64 | 64 | ||
65 | #include "iwl-dev.h" | 65 | #include "iwl-dev.h" |
66 | #include "iwl-core.h" | ||
67 | #include "iwl-commands.h" | 66 | #include "iwl-commands.h" |
68 | 67 | ||
69 | void iwl_chain_noise_calibration(struct iwl_priv *priv); | 68 | void iwl_chain_noise_calibration(struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-devices.c b/drivers/net/wireless/iwlwifi/iwl-agn-devices.c index 08718caf4aa9..48533b3a0f9a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-devices.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-devices.c | |||
@@ -27,7 +27,6 @@ | |||
27 | /* | 27 | /* |
28 | * DVM device-specific data & functions | 28 | * DVM device-specific data & functions |
29 | */ | 29 | */ |
30 | #include "iwl-core.h" | ||
31 | #include "iwl-agn.h" | 30 | #include "iwl-agn.h" |
32 | #include "iwl-dev.h" | 31 | #include "iwl-dev.h" |
33 | #include "iwl-commands.h" | 32 | #include "iwl-commands.h" |
@@ -60,13 +59,13 @@ static void iwl1000_set_ct_threshold(struct iwl_priv *priv) | |||
60 | static void iwl1000_nic_config(struct iwl_priv *priv) | 59 | static void iwl1000_nic_config(struct iwl_priv *priv) |
61 | { | 60 | { |
62 | /* set CSR_HW_CONFIG_REG for uCode use */ | 61 | /* set CSR_HW_CONFIG_REG for uCode use */ |
63 | iwl_set_bit(trans(priv), CSR_HW_IF_CONFIG_REG, | 62 | iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG, |
64 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | 63 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | |
65 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | 64 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); |
66 | 65 | ||
67 | /* Setting digital SVR for 1000 card to 1.32V */ | 66 | /* Setting digital SVR for 1000 card to 1.32V */ |
68 | /* locking is acquired in iwl_set_bits_mask_prph() function */ | 67 | /* locking is acquired in iwl_set_bits_mask_prph() function */ |
69 | iwl_set_bits_mask_prph(trans(priv), APMG_DIGITAL_SVR_REG, | 68 | iwl_set_bits_mask_prph(priv->trans, APMG_DIGITAL_SVR_REG, |
70 | APMG_SVR_DIGITAL_VOLTAGE_1_32, | 69 | APMG_SVR_DIGITAL_VOLTAGE_1_32, |
71 | ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK); | 70 | ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK); |
72 | } | 71 | } |
@@ -175,7 +174,7 @@ static void iwl1000_hw_set_hw_params(struct iwl_priv *priv) | |||
175 | 174 | ||
176 | priv->hw_params.tx_chains_num = | 175 | priv->hw_params.tx_chains_num = |
177 | num_of_ant(priv->hw_params.valid_tx_ant); | 176 | num_of_ant(priv->hw_params.valid_tx_ant); |
178 | if (cfg(priv)->rx_with_siso_diversity) | 177 | if (priv->cfg->rx_with_siso_diversity) |
179 | priv->hw_params.rx_chains_num = 1; | 178 | priv->hw_params.rx_chains_num = 1; |
180 | else | 179 | else |
181 | priv->hw_params.rx_chains_num = | 180 | priv->hw_params.rx_chains_num = |
@@ -222,7 +221,7 @@ static void iwl2000_nic_config(struct iwl_priv *priv) | |||
222 | { | 221 | { |
223 | iwl_rf_config(priv); | 222 | iwl_rf_config(priv); |
224 | 223 | ||
225 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 224 | iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, |
226 | CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER); | 225 | CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER); |
227 | } | 226 | } |
228 | 227 | ||
@@ -256,7 +255,7 @@ static void iwl2000_hw_set_hw_params(struct iwl_priv *priv) | |||
256 | 255 | ||
257 | priv->hw_params.tx_chains_num = | 256 | priv->hw_params.tx_chains_num = |
258 | num_of_ant(priv->hw_params.valid_tx_ant); | 257 | num_of_ant(priv->hw_params.valid_tx_ant); |
259 | if (cfg(priv)->rx_with_siso_diversity) | 258 | if (priv->cfg->rx_with_siso_diversity) |
260 | priv->hw_params.rx_chains_num = 1; | 259 | priv->hw_params.rx_chains_num = 1; |
261 | else | 260 | else |
262 | priv->hw_params.rx_chains_num = | 261 | priv->hw_params.rx_chains_num = |
@@ -318,7 +317,7 @@ static void iwl5000_nic_config(struct iwl_priv *priv) | |||
318 | * (PCIe power is lost before PERST# is asserted), | 317 | * (PCIe power is lost before PERST# is asserted), |
319 | * causing ME FW to lose ownership and not being able to obtain it back. | 318 | * causing ME FW to lose ownership and not being able to obtain it back. |
320 | */ | 319 | */ |
321 | iwl_set_bits_mask_prph(trans(priv), APMG_PS_CTRL_REG, | 320 | iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG, |
322 | APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, | 321 | APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, |
323 | ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); | 322 | ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); |
324 | } | 323 | } |
@@ -573,28 +572,28 @@ static void iwl6000_nic_config(struct iwl_priv *priv) | |||
573 | { | 572 | { |
574 | iwl_rf_config(priv); | 573 | iwl_rf_config(priv); |
575 | 574 | ||
576 | switch (cfg(priv)->device_family) { | 575 | switch (priv->cfg->device_family) { |
577 | case IWL_DEVICE_FAMILY_6005: | 576 | case IWL_DEVICE_FAMILY_6005: |
578 | case IWL_DEVICE_FAMILY_6030: | 577 | case IWL_DEVICE_FAMILY_6030: |
579 | case IWL_DEVICE_FAMILY_6000: | 578 | case IWL_DEVICE_FAMILY_6000: |
580 | break; | 579 | break; |
581 | case IWL_DEVICE_FAMILY_6000i: | 580 | case IWL_DEVICE_FAMILY_6000i: |
582 | /* 2x2 IPA phy type */ | 581 | /* 2x2 IPA phy type */ |
583 | iwl_write32(trans(priv), CSR_GP_DRIVER_REG, | 582 | iwl_write32(priv->trans, CSR_GP_DRIVER_REG, |
584 | CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); | 583 | CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); |
585 | break; | 584 | break; |
586 | case IWL_DEVICE_FAMILY_6050: | 585 | case IWL_DEVICE_FAMILY_6050: |
587 | /* Indicate calibration version to uCode. */ | 586 | /* Indicate calibration version to uCode. */ |
588 | if (iwl_eeprom_calib_version(priv) >= 6) | 587 | if (iwl_eeprom_calib_version(priv) >= 6) |
589 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 588 | iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, |
590 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); | 589 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); |
591 | break; | 590 | break; |
592 | case IWL_DEVICE_FAMILY_6150: | 591 | case IWL_DEVICE_FAMILY_6150: |
593 | /* Indicate calibration version to uCode. */ | 592 | /* Indicate calibration version to uCode. */ |
594 | if (iwl_eeprom_calib_version(priv) >= 6) | 593 | if (iwl_eeprom_calib_version(priv) >= 6) |
595 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 594 | iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, |
596 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); | 595 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); |
597 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 596 | iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, |
598 | CSR_GP_DRIVER_REG_BIT_6050_1x2); | 597 | CSR_GP_DRIVER_REG_BIT_6050_1x2); |
599 | break; | 598 | break; |
600 | default: | 599 | default: |
@@ -633,7 +632,7 @@ static void iwl6000_hw_set_hw_params(struct iwl_priv *priv) | |||
633 | 632 | ||
634 | priv->hw_params.tx_chains_num = | 633 | priv->hw_params.tx_chains_num = |
635 | num_of_ant(priv->hw_params.valid_tx_ant); | 634 | num_of_ant(priv->hw_params.valid_tx_ant); |
636 | if (cfg(priv)->rx_with_siso_diversity) | 635 | if (priv->cfg->rx_with_siso_diversity) |
637 | priv->hw_params.rx_chains_num = 1; | 636 | priv->hw_params.rx_chains_num = 1; |
638 | else | 637 | else |
639 | priv->hw_params.rx_chains_num = | 638 | priv->hw_params.rx_chains_num = |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h index c797ab19d933..7960a52f6ad4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h | |||
@@ -102,6 +102,17 @@ | |||
102 | 102 | ||
103 | /* EEPROM */ | 103 | /* EEPROM */ |
104 | #define IWLAGN_EEPROM_IMG_SIZE 2048 | 104 | #define IWLAGN_EEPROM_IMG_SIZE 2048 |
105 | /* OTP */ | ||
106 | /* lower blocks contain EEPROM image and calibration data */ | ||
107 | #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ | ||
108 | /* high blocks contain PAPD data */ | ||
109 | #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ | ||
110 | #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ | ||
111 | #define OTP_MAX_LL_ITEMS_1000 (3) /* OTP blocks for 1000 */ | ||
112 | #define OTP_MAX_LL_ITEMS_6x00 (4) /* OTP blocks for 6x00 */ | ||
113 | #define OTP_MAX_LL_ITEMS_6x50 (7) /* OTP blocks for 6x50 */ | ||
114 | #define OTP_MAX_LL_ITEMS_2x00 (4) /* OTP blocks for 2x00 */ | ||
115 | |||
105 | 116 | ||
106 | #define IWLAGN_NUM_QUEUES 20 | 117 | #define IWLAGN_NUM_QUEUES 20 |
107 | 118 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 4e0c248a0050..e1c2bb802050 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -33,12 +33,11 @@ | |||
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | 34 | ||
35 | #include "iwl-dev.h" | 35 | #include "iwl-dev.h" |
36 | #include "iwl-core.h" | ||
37 | #include "iwl-io.h" | 36 | #include "iwl-io.h" |
38 | #include "iwl-agn-hw.h" | 37 | #include "iwl-agn-hw.h" |
39 | #include "iwl-agn.h" | 38 | #include "iwl-agn.h" |
40 | #include "iwl-trans.h" | 39 | #include "iwl-trans.h" |
41 | #include "iwl-shared.h" | 40 | #include "iwl-modparams.h" |
42 | 41 | ||
43 | int iwlagn_hw_valid_rtc_data_addr(u32 addr) | 42 | int iwlagn_hw_valid_rtc_data_addr(u32 addr) |
44 | { | 43 | { |
@@ -94,17 +93,6 @@ void iwlagn_temperature(struct iwl_priv *priv) | |||
94 | iwl_tt_handler(priv); | 93 | iwl_tt_handler(priv); |
95 | } | 94 | } |
96 | 95 | ||
97 | struct iwl_mod_params iwlagn_mod_params = { | ||
98 | .amsdu_size_8K = 1, | ||
99 | .restart_fw = 1, | ||
100 | .plcp_check = true, | ||
101 | .bt_coex_active = true, | ||
102 | .power_level = IWL_POWER_INDEX_1, | ||
103 | .bt_ch_announce = true, | ||
104 | .auto_agg = true, | ||
105 | /* the rest are 0 by default */ | ||
106 | }; | ||
107 | |||
108 | int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) | 96 | int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) |
109 | { | 97 | { |
110 | int idx = 0; | 98 | int idx = 0; |
@@ -189,7 +177,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) | |||
189 | goto done; | 177 | goto done; |
190 | } | 178 | } |
191 | IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); | 179 | IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); |
192 | iwl_trans_wait_tx_queue_empty(trans(priv)); | 180 | iwl_trans_wait_tx_queue_empty(priv->trans); |
193 | done: | 181 | done: |
194 | ieee80211_wake_queues(priv->hw); | 182 | ieee80211_wake_queues(priv->hw); |
195 | mutex_unlock(&priv->mutex); | 183 | mutex_unlock(&priv->mutex); |
@@ -312,21 +300,21 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
312 | BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) != | 300 | BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) != |
313 | sizeof(basic.bt3_lookup_table)); | 301 | sizeof(basic.bt3_lookup_table)); |
314 | 302 | ||
315 | if (cfg(priv)->bt_params) { | 303 | if (priv->cfg->bt_params) { |
316 | /* | 304 | /* |
317 | * newer generation of devices (2000 series and newer) | 305 | * newer generation of devices (2000 series and newer) |
318 | * use the version 2 of the bt command | 306 | * use the version 2 of the bt command |
319 | * we need to make sure sending the host command | 307 | * we need to make sure sending the host command |
320 | * with correct data structure to avoid uCode assert | 308 | * with correct data structure to avoid uCode assert |
321 | */ | 309 | */ |
322 | if (cfg(priv)->bt_params->bt_session_2) { | 310 | if (priv->cfg->bt_params->bt_session_2) { |
323 | bt_cmd_v2.prio_boost = cpu_to_le32( | 311 | bt_cmd_v2.prio_boost = cpu_to_le32( |
324 | cfg(priv)->bt_params->bt_prio_boost); | 312 | priv->cfg->bt_params->bt_prio_boost); |
325 | bt_cmd_v2.tx_prio_boost = 0; | 313 | bt_cmd_v2.tx_prio_boost = 0; |
326 | bt_cmd_v2.rx_prio_boost = 0; | 314 | bt_cmd_v2.rx_prio_boost = 0; |
327 | } else { | 315 | } else { |
328 | bt_cmd_v1.prio_boost = | 316 | bt_cmd_v1.prio_boost = |
329 | cfg(priv)->bt_params->bt_prio_boost; | 317 | priv->cfg->bt_params->bt_prio_boost; |
330 | bt_cmd_v1.tx_prio_boost = 0; | 318 | bt_cmd_v1.tx_prio_boost = 0; |
331 | bt_cmd_v1.rx_prio_boost = 0; | 319 | bt_cmd_v1.rx_prio_boost = 0; |
332 | } | 320 | } |
@@ -345,7 +333,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
345 | * (might be in monitor mode), or the interface is in | 333 | * (might be in monitor mode), or the interface is in |
346 | * IBSS mode (no proper uCode support for coex then). | 334 | * IBSS mode (no proper uCode support for coex then). |
347 | */ | 335 | */ |
348 | if (!iwlagn_mod_params.bt_coex_active || | 336 | if (!iwlwifi_mod_params.bt_coex_active || |
349 | priv->iw_mode == NL80211_IFTYPE_ADHOC) { | 337 | priv->iw_mode == NL80211_IFTYPE_ADHOC) { |
350 | basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED; | 338 | basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED; |
351 | } else { | 339 | } else { |
@@ -374,7 +362,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
374 | priv->bt_full_concurrent ? | 362 | priv->bt_full_concurrent ? |
375 | "full concurrency" : "3-wire"); | 363 | "full concurrency" : "3-wire"); |
376 | 364 | ||
377 | if (cfg(priv)->bt_params->bt_session_2) { | 365 | if (priv->cfg->bt_params->bt_session_2) { |
378 | memcpy(&bt_cmd_v2.basic, &basic, | 366 | memcpy(&bt_cmd_v2.basic, &basic, |
379 | sizeof(basic)); | 367 | sizeof(basic)); |
380 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 368 | ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
@@ -740,8 +728,8 @@ static bool is_single_rx_stream(struct iwl_priv *priv) | |||
740 | */ | 728 | */ |
741 | static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) | 729 | static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) |
742 | { | 730 | { |
743 | if (cfg(priv)->bt_params && | 731 | if (priv->cfg->bt_params && |
744 | cfg(priv)->bt_params->advanced_bt_coexist && | 732 | priv->cfg->bt_params->advanced_bt_coexist && |
745 | (priv->bt_full_concurrent || | 733 | (priv->bt_full_concurrent || |
746 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { | 734 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { |
747 | /* | 735 | /* |
@@ -812,8 +800,8 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
812 | else | 800 | else |
813 | active_chains = priv->hw_params.valid_rx_ant; | 801 | active_chains = priv->hw_params.valid_rx_ant; |
814 | 802 | ||
815 | if (cfg(priv)->bt_params && | 803 | if (priv->cfg->bt_params && |
816 | cfg(priv)->bt_params->advanced_bt_coexist && | 804 | priv->cfg->bt_params->advanced_bt_coexist && |
817 | (priv->bt_full_concurrent || | 805 | (priv->bt_full_concurrent || |
818 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { | 806 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { |
819 | /* | 807 | /* |
@@ -1132,7 +1120,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) | |||
1132 | memcpy(&rxon, &ctx->active, sizeof(rxon)); | 1120 | memcpy(&rxon, &ctx->active, sizeof(rxon)); |
1133 | 1121 | ||
1134 | priv->ucode_loaded = false; | 1122 | priv->ucode_loaded = false; |
1135 | iwl_trans_stop_device(trans(priv)); | 1123 | iwl_trans_stop_device(priv->trans); |
1136 | 1124 | ||
1137 | priv->wowlan = true; | 1125 | priv->wowlan = true; |
1138 | 1126 | ||
@@ -1154,7 +1142,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) | |||
1154 | if (ret) | 1142 | if (ret) |
1155 | goto out; | 1143 | goto out; |
1156 | 1144 | ||
1157 | if (!iwlagn_mod_params.sw_crypto) { | 1145 | if (!iwlwifi_mod_params.sw_crypto) { |
1158 | /* mark all keys clear */ | 1146 | /* mark all keys clear */ |
1159 | priv->ucode_key_table = 0; | 1147 | priv->ucode_key_table = 0; |
1160 | ctx->key_mapping_keys = 0; | 1148 | ctx->key_mapping_keys = 0; |
@@ -1260,7 +1248,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1260 | return -EIO; | 1248 | return -EIO; |
1261 | } | 1249 | } |
1262 | 1250 | ||
1263 | return iwl_trans_send_cmd(trans(priv), cmd); | 1251 | return iwl_trans_send_cmd(priv->trans, cmd); |
1264 | } | 1252 | } |
1265 | 1253 | ||
1266 | int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id, | 1254 | int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 8b13b6cf940a..51e1a69ffdda 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -36,9 +36,9 @@ | |||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | 37 | ||
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-core.h" | ||
40 | #include "iwl-agn.h" | 39 | #include "iwl-agn.h" |
41 | #include "iwl-op-mode.h" | 40 | #include "iwl-op-mode.h" |
41 | #include "iwl-modparams.h" | ||
42 | 42 | ||
43 | #define RS_NAME "iwl-agn-rs" | 43 | #define RS_NAME "iwl-agn-rs" |
44 | 44 | ||
@@ -420,7 +420,7 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
420 | 420 | ||
421 | load = rs_tl_get_load(lq_data, tid); | 421 | load = rs_tl_get_load(lq_data, tid); |
422 | 422 | ||
423 | if ((iwlagn_mod_params.auto_agg) || (load > IWL_AGG_LOAD_THRESHOLD)) { | 423 | if ((iwlwifi_mod_params.auto_agg) || (load > IWL_AGG_LOAD_THRESHOLD)) { |
424 | IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", | 424 | IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", |
425 | sta->addr, tid); | 425 | sta->addr, tid); |
426 | ret = ieee80211_start_tx_ba_session(sta, tid, 5000); | 426 | ret = ieee80211_start_tx_ba_session(sta, tid, 5000); |
@@ -1085,7 +1085,7 @@ done: | |||
1085 | (priv->tm_fixed_rate != lq_sta->dbg_fixed_rate)) | 1085 | (priv->tm_fixed_rate != lq_sta->dbg_fixed_rate)) |
1086 | rs_program_fix_rate(priv, lq_sta); | 1086 | rs_program_fix_rate(priv, lq_sta); |
1087 | #endif | 1087 | #endif |
1088 | if (cfg(priv)->bt_params && cfg(priv)->bt_params->advanced_bt_coexist) | 1088 | if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) |
1089 | rs_bt_update_lq(priv, ctx, lq_sta); | 1089 | rs_bt_update_lq(priv, ctx, lq_sta); |
1090 | } | 1090 | } |
1091 | 1091 | ||
@@ -3063,11 +3063,11 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, | |||
3063 | * overwrite if needed, pass aggregation time limit | 3063 | * overwrite if needed, pass aggregation time limit |
3064 | * to uCode in uSec | 3064 | * to uCode in uSec |
3065 | */ | 3065 | */ |
3066 | if (priv && cfg(priv)->bt_params && | 3066 | if (priv && priv->cfg->bt_params && |
3067 | cfg(priv)->bt_params->agg_time_limit && | 3067 | priv->cfg->bt_params->agg_time_limit && |
3068 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) | 3068 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) |
3069 | lq_cmd->agg_params.agg_time_limit = | 3069 | lq_cmd->agg_params.agg_time_limit = |
3070 | cpu_to_le16(cfg(priv)->bt_params->agg_time_limit); | 3070 | cpu_to_le16(priv->cfg->bt_params->agg_time_limit); |
3071 | } | 3071 | } |
3072 | 3072 | ||
3073 | static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 3073 | static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h index 203b1c13c491..82d02e1ae89f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <net/mac80211.h> | 30 | #include <net/mac80211.h> |
31 | 31 | ||
32 | #include "iwl-commands.h" | 32 | #include "iwl-commands.h" |
33 | #include "iwl-config.h" | ||
33 | 34 | ||
34 | struct iwl_rate_info { | 35 | struct iwl_rate_info { |
35 | u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ | 36 | u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ |
@@ -174,32 +175,6 @@ enum { | |||
174 | IWL_RATE_11M_IEEE = 22, | 175 | IWL_RATE_11M_IEEE = 22, |
175 | }; | 176 | }; |
176 | 177 | ||
177 | #define IWL_CCK_BASIC_RATES_MASK \ | ||
178 | (IWL_RATE_1M_MASK | \ | ||
179 | IWL_RATE_2M_MASK) | ||
180 | |||
181 | #define IWL_CCK_RATES_MASK \ | ||
182 | (IWL_CCK_BASIC_RATES_MASK | \ | ||
183 | IWL_RATE_5M_MASK | \ | ||
184 | IWL_RATE_11M_MASK) | ||
185 | |||
186 | #define IWL_OFDM_BASIC_RATES_MASK \ | ||
187 | (IWL_RATE_6M_MASK | \ | ||
188 | IWL_RATE_12M_MASK | \ | ||
189 | IWL_RATE_24M_MASK) | ||
190 | |||
191 | #define IWL_OFDM_RATES_MASK \ | ||
192 | (IWL_OFDM_BASIC_RATES_MASK | \ | ||
193 | IWL_RATE_9M_MASK | \ | ||
194 | IWL_RATE_18M_MASK | \ | ||
195 | IWL_RATE_36M_MASK | \ | ||
196 | IWL_RATE_48M_MASK | \ | ||
197 | IWL_RATE_54M_MASK) | ||
198 | |||
199 | #define IWL_BASIC_RATES_MASK \ | ||
200 | (IWL_OFDM_BASIC_RATES_MASK | \ | ||
201 | IWL_CCK_BASIC_RATES_MASK) | ||
202 | |||
203 | #define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) | 178 | #define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) |
204 | 179 | ||
205 | #define IWL_INVALID_VALUE -1 | 180 | #define IWL_INVALID_VALUE -1 |
@@ -306,15 +281,6 @@ enum iwl_table_type { | |||
306 | #define is_a_band(tbl) ((tbl) == LQ_A) | 281 | #define is_a_band(tbl) ((tbl) == LQ_A) |
307 | #define is_g_and(tbl) ((tbl) == LQ_G) | 282 | #define is_g_and(tbl) ((tbl) == LQ_G) |
308 | 283 | ||
309 | #define ANT_NONE 0x0 | ||
310 | #define ANT_A BIT(0) | ||
311 | #define ANT_B BIT(1) | ||
312 | #define ANT_AB (ANT_A | ANT_B) | ||
313 | #define ANT_C BIT(2) | ||
314 | #define ANT_AC (ANT_A | ANT_C) | ||
315 | #define ANT_BC (ANT_B | ANT_C) | ||
316 | #define ANT_ABC (ANT_AB | ANT_C) | ||
317 | |||
318 | #define IWL_MAX_MCS_DISPLAY_SIZE 12 | 284 | #define IWL_MAX_MCS_DISPLAY_SIZE 12 |
319 | 285 | ||
320 | struct iwl_rate_mcs_info { | 286 | struct iwl_rate_mcs_info { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index db6c90f6affe..f94122387e25 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
@@ -34,11 +34,10 @@ | |||
34 | #include <asm/unaligned.h> | 34 | #include <asm/unaligned.h> |
35 | #include "iwl-eeprom.h" | 35 | #include "iwl-eeprom.h" |
36 | #include "iwl-dev.h" | 36 | #include "iwl-dev.h" |
37 | #include "iwl-core.h" | ||
38 | #include "iwl-io.h" | 37 | #include "iwl-io.h" |
39 | #include "iwl-agn-calib.h" | 38 | #include "iwl-agn-calib.h" |
40 | #include "iwl-agn.h" | 39 | #include "iwl-agn.h" |
41 | #include "iwl-shared.h" | 40 | #include "iwl-modparams.h" |
42 | 41 | ||
43 | #define IWL_CMD_ENTRY(x) [x] = #x | 42 | #define IWL_CMD_ENTRY(x) [x] = #x |
44 | 43 | ||
@@ -339,7 +338,7 @@ static void iwlagn_recover_from_statistics(struct iwl_priv *priv, | |||
339 | if (msecs < 99) | 338 | if (msecs < 99) |
340 | return; | 339 | return; |
341 | 340 | ||
342 | if (iwlagn_mod_params.plcp_check && | 341 | if (iwlwifi_mod_params.plcp_check && |
343 | !iwlagn_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs)) | 342 | !iwlagn_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs)) |
344 | iwl_force_rf_reset(priv, false); | 343 | iwl_force_rf_reset(priv, false); |
345 | } | 344 | } |
@@ -604,16 +603,16 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv, | |||
604 | if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | | 603 | if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | |
605 | CT_CARD_DISABLED)) { | 604 | CT_CARD_DISABLED)) { |
606 | 605 | ||
607 | iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_SET, | 606 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET, |
608 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 607 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
609 | 608 | ||
610 | iwl_write_direct32(trans(priv), HBUS_TARG_MBX_C, | 609 | iwl_write_direct32(priv->trans, HBUS_TARG_MBX_C, |
611 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); | 610 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); |
612 | 611 | ||
613 | if (!(flags & RXON_CARD_DISABLED)) { | 612 | if (!(flags & RXON_CARD_DISABLED)) { |
614 | iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, | 613 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, |
615 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 614 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
616 | iwl_write_direct32(trans(priv), HBUS_TARG_MBX_C, | 615 | iwl_write_direct32(priv->trans, HBUS_TARG_MBX_C, |
617 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); | 616 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); |
618 | } | 617 | } |
619 | if (flags & CT_CARD_DISABLED) | 618 | if (flags & CT_CARD_DISABLED) |
@@ -636,7 +635,7 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv, | |||
636 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, | 635 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, |
637 | test_bit(STATUS_RF_KILL_HW, &priv->status)); | 636 | test_bit(STATUS_RF_KILL_HW, &priv->status)); |
638 | else | 637 | else |
639 | wake_up(&trans(priv)->wait_command_queue); | 638 | wake_up(&priv->trans->wait_command_queue); |
640 | return 0; | 639 | return 0; |
641 | } | 640 | } |
642 | 641 | ||
@@ -749,7 +748,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
749 | } | 748 | } |
750 | 749 | ||
751 | /* In case of HW accelerated crypto and bad decryption, drop */ | 750 | /* In case of HW accelerated crypto and bad decryption, drop */ |
752 | if (!iwlagn_mod_params.sw_crypto && | 751 | if (!iwlwifi_mod_params.sw_crypto && |
753 | iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) | 752 | iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) |
754 | return; | 753 | return; |
755 | 754 | ||
@@ -763,8 +762,6 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
763 | p = rxb_steal_page(rxb); | 762 | p = rxb_steal_page(rxb); |
764 | skb_add_rx_frag(skb, 0, p, offset, len, len); | 763 | skb_add_rx_frag(skb, 0, p, offset, len, len); |
765 | 764 | ||
766 | iwl_update_stats(priv, false, fc, len); | ||
767 | |||
768 | /* | 765 | /* |
769 | * Wake any queues that were stopped due to a passive channel tx | 766 | * Wake any queues that were stopped due to a passive channel tx |
770 | * failure. This can happen because the regulatory enforcement in | 767 | * failure. This can happen because the regulatory enforcement in |
@@ -970,7 +967,6 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv, | |||
970 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ | 967 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ |
971 | rx_status.signal = iwlagn_calc_rssi(priv, phy_res); | 968 | rx_status.signal = iwlagn_calc_rssi(priv, phy_res); |
972 | 969 | ||
973 | iwl_dbg_log_rx_data_frame(priv, len, header); | ||
974 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", | 970 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", |
975 | rx_status.signal, (unsigned long long)rx_status.mactime); | 971 | rx_status.signal, (unsigned long long)rx_status.mactime); |
976 | 972 | ||
@@ -1105,7 +1101,7 @@ void iwl_setup_rx_handlers(struct iwl_priv *priv) | |||
1105 | iwl_notification_wait_init(&priv->notif_wait); | 1101 | iwl_notification_wait_init(&priv->notif_wait); |
1106 | 1102 | ||
1107 | /* Set up BT Rx handlers */ | 1103 | /* Set up BT Rx handlers */ |
1108 | if (cfg(priv)->bt_params) | 1104 | if (priv->cfg->bt_params) |
1109 | iwlagn_bt_rx_handler_setup(priv); | 1105 | iwlagn_bt_rx_handler_setup(priv); |
1110 | } | 1106 | } |
1111 | 1107 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c index 5c7bddd5cfef..0f7c444f2440 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | |||
@@ -27,10 +27,9 @@ | |||
27 | #include <linux/etherdevice.h> | 27 | #include <linux/etherdevice.h> |
28 | #include "iwl-dev.h" | 28 | #include "iwl-dev.h" |
29 | #include "iwl-agn.h" | 29 | #include "iwl-agn.h" |
30 | #include "iwl-core.h" | ||
31 | #include "iwl-agn-calib.h" | 30 | #include "iwl-agn-calib.h" |
32 | #include "iwl-trans.h" | 31 | #include "iwl-trans.h" |
33 | #include "iwl-shared.h" | 32 | #include "iwl-modparams.h" |
34 | 33 | ||
35 | /* | 34 | /* |
36 | * initialize rxon structure with default values from eeprom | 35 | * initialize rxon structure with default values from eeprom |
@@ -88,11 +87,6 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, | |||
88 | 87 | ||
89 | iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif); | 88 | iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif); |
90 | 89 | ||
91 | ctx->staging.ofdm_basic_rates = | ||
92 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | ||
93 | ctx->staging.cck_basic_rates = | ||
94 | (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; | ||
95 | |||
96 | /* clear both MIX and PURE40 mode flag */ | 90 | /* clear both MIX and PURE40 mode flag */ |
97 | ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | | 91 | ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | |
98 | RXON_FLG_CHANNEL_MODE_PURE_40); | 92 | RXON_FLG_CHANNEL_MODE_PURE_40); |
@@ -531,9 +525,9 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv, | |||
531 | } | 525 | } |
532 | 526 | ||
533 | if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && | 527 | if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && |
534 | cfg(priv)->ht_params && cfg(priv)->ht_params->smps_mode) | 528 | priv->cfg->ht_params && priv->cfg->ht_params->smps_mode) |
535 | ieee80211_request_smps(ctx->vif, | 529 | ieee80211_request_smps(ctx->vif, |
536 | cfg(priv)->ht_params->smps_mode); | 530 | priv->cfg->ht_params->smps_mode); |
537 | 531 | ||
538 | return 0; | 532 | return 0; |
539 | } | 533 | } |
@@ -772,19 +766,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
772 | } | 766 | } |
773 | } | 767 | } |
774 | 768 | ||
775 | void iwl_set_rate(struct iwl_priv *priv) | ||
776 | { | ||
777 | struct iwl_rxon_context *ctx; | ||
778 | |||
779 | for_each_context(priv, ctx) { | ||
780 | ctx->staging.cck_basic_rates = | ||
781 | (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; | ||
782 | |||
783 | ctx->staging.ofdm_basic_rates = | ||
784 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | ||
785 | } | ||
786 | } | ||
787 | |||
788 | static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, | 769 | static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, |
789 | struct iwl_rxon_context *ctx, int hw_decrypt) | 770 | struct iwl_rxon_context *ctx, int hw_decrypt) |
790 | { | 771 | { |
@@ -960,6 +941,97 @@ void iwl_print_rx_config_cmd(struct iwl_priv *priv, | |||
960 | } | 941 | } |
961 | #endif | 942 | #endif |
962 | 943 | ||
944 | static void iwl_calc_basic_rates(struct iwl_priv *priv, | ||
945 | struct iwl_rxon_context *ctx) | ||
946 | { | ||
947 | int lowest_present_ofdm = 100; | ||
948 | int lowest_present_cck = 100; | ||
949 | u8 cck = 0; | ||
950 | u8 ofdm = 0; | ||
951 | |||
952 | if (ctx->vif) { | ||
953 | struct ieee80211_supported_band *sband; | ||
954 | unsigned long basic = ctx->vif->bss_conf.basic_rates; | ||
955 | int i; | ||
956 | |||
957 | sband = priv->hw->wiphy->bands[priv->hw->conf.channel->band]; | ||
958 | |||
959 | for_each_set_bit(i, &basic, BITS_PER_LONG) { | ||
960 | int hw = sband->bitrates[i].hw_value; | ||
961 | if (hw >= IWL_FIRST_OFDM_RATE) { | ||
962 | ofdm |= BIT(hw - IWL_FIRST_OFDM_RATE); | ||
963 | if (lowest_present_ofdm > hw) | ||
964 | lowest_present_ofdm = hw; | ||
965 | } else { | ||
966 | BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0); | ||
967 | |||
968 | cck |= BIT(hw); | ||
969 | if (lowest_present_cck > hw) | ||
970 | lowest_present_cck = hw; | ||
971 | } | ||
972 | } | ||
973 | } | ||
974 | |||
975 | /* | ||
976 | * Now we've got the basic rates as bitmaps in the ofdm and cck | ||
977 | * variables. This isn't sufficient though, as there might not | ||
978 | * be all the right rates in the bitmap. E.g. if the only basic | ||
979 | * rates are 5.5 Mbps and 11 Mbps, we still need to add 1 Mbps | ||
980 | * and 6 Mbps because the 802.11-2007 standard says in 9.6: | ||
981 | * | ||
982 | * [...] a STA responding to a received frame shall transmit | ||
983 | * its Control Response frame [...] at the highest rate in the | ||
984 | * BSSBasicRateSet parameter that is less than or equal to the | ||
985 | * rate of the immediately previous frame in the frame exchange | ||
986 | * sequence ([...]) and that is of the same modulation class | ||
987 | * ([...]) as the received frame. If no rate contained in the | ||
988 | * BSSBasicRateSet parameter meets these conditions, then the | ||
989 | * control frame sent in response to a received frame shall be | ||
990 | * transmitted at the highest mandatory rate of the PHY that is | ||
991 | * less than or equal to the rate of the received frame, and | ||
992 | * that is of the same modulation class as the received frame. | ||
993 | * | ||
994 | * As a consequence, we need to add all mandatory rates that are | ||
995 | * lower than all of the basic rates to these bitmaps. | ||
996 | */ | ||
997 | |||
998 | if (IWL_RATE_24M_INDEX < lowest_present_ofdm) | ||
999 | ofdm |= IWL_RATE_24M_MASK >> IWL_FIRST_OFDM_RATE; | ||
1000 | if (IWL_RATE_12M_INDEX < lowest_present_ofdm) | ||
1001 | ofdm |= IWL_RATE_12M_MASK >> IWL_FIRST_OFDM_RATE; | ||
1002 | /* 6M already there or needed so always add */ | ||
1003 | ofdm |= IWL_RATE_6M_MASK >> IWL_FIRST_OFDM_RATE; | ||
1004 | |||
1005 | /* | ||
1006 | * CCK is a bit more complex with DSSS vs. HR/DSSS vs. ERP. | ||
1007 | * Note, however: | ||
1008 | * - if no CCK rates are basic, it must be ERP since there must | ||
1009 | * be some basic rates at all, so they're OFDM => ERP PHY | ||
1010 | * (or we're in 5 GHz, and the cck bitmap will never be used) | ||
1011 | * - if 11M is a basic rate, it must be ERP as well, so add 5.5M | ||
1012 | * - if 5.5M is basic, 1M and 2M are mandatory | ||
1013 | * - if 2M is basic, 1M is mandatory | ||
1014 | * - if 1M is basic, that's the only valid ACK rate. | ||
1015 | * As a consequence, it's not as complicated as it sounds, just add | ||
1016 | * any lower rates to the ACK rate bitmap. | ||
1017 | */ | ||
1018 | if (IWL_RATE_11M_INDEX < lowest_present_ofdm) | ||
1019 | ofdm |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE; | ||
1020 | if (IWL_RATE_5M_INDEX < lowest_present_ofdm) | ||
1021 | ofdm |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE; | ||
1022 | if (IWL_RATE_2M_INDEX < lowest_present_ofdm) | ||
1023 | ofdm |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE; | ||
1024 | /* 1M already there or needed so always add */ | ||
1025 | cck |= IWL_RATE_1M_MASK >> IWL_FIRST_CCK_RATE; | ||
1026 | |||
1027 | IWL_DEBUG_RATE(priv, "Set basic rates cck:0x%.2x ofdm:0x%.2x\n", | ||
1028 | cck, ofdm); | ||
1029 | |||
1030 | /* "basic_rates" is a misnomer here -- should be called ACK rates */ | ||
1031 | ctx->staging.cck_basic_rates = cck; | ||
1032 | ctx->staging.ofdm_basic_rates = ofdm; | ||
1033 | } | ||
1034 | |||
963 | /** | 1035 | /** |
964 | * iwlagn_commit_rxon - commit staging_rxon to hardware | 1036 | * iwlagn_commit_rxon - commit staging_rxon to hardware |
965 | * | 1037 | * |
@@ -999,6 +1071,9 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
999 | /* always get timestamp with Rx frame */ | 1071 | /* always get timestamp with Rx frame */ |
1000 | ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; | 1072 | ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; |
1001 | 1073 | ||
1074 | /* recalculate basic rates */ | ||
1075 | iwl_calc_basic_rates(priv, ctx); | ||
1076 | |||
1002 | /* | 1077 | /* |
1003 | * force CTS-to-self frames protection if RTS-CTS is not preferred | 1078 | * force CTS-to-self frames protection if RTS-CTS is not preferred |
1004 | * one aggregation protection method | 1079 | * one aggregation protection method |
@@ -1055,7 +1130,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
1055 | return 0; | 1130 | return 0; |
1056 | } | 1131 | } |
1057 | 1132 | ||
1058 | iwl_set_rxon_hwcrypto(priv, ctx, !iwlagn_mod_params.sw_crypto); | 1133 | iwl_set_rxon_hwcrypto(priv, ctx, !iwlwifi_mod_params.sw_crypto); |
1059 | 1134 | ||
1060 | IWL_DEBUG_INFO(priv, | 1135 | IWL_DEBUG_INFO(priv, |
1061 | "Going to commit RXON\n" | 1136 | "Going to commit RXON\n" |
@@ -1187,13 +1262,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
1187 | } | 1262 | } |
1188 | 1263 | ||
1189 | iwl_update_bcast_stations(priv); | 1264 | iwl_update_bcast_stations(priv); |
1190 | |||
1191 | /* | ||
1192 | * The list of supported rates and rate mask can be different | ||
1193 | * for each band; since the band may have changed, reset | ||
1194 | * the rate mask to what mac80211 lists. | ||
1195 | */ | ||
1196 | iwl_set_rate(priv); | ||
1197 | } | 1265 | } |
1198 | 1266 | ||
1199 | if (changed & (IEEE80211_CONF_CHANGE_PS | | 1267 | if (changed & (IEEE80211_CONF_CHANGE_PS | |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c index 0119e7a7b78d..67e6f1d2a08b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <net/mac80211.h> | 30 | #include <net/mac80211.h> |
31 | 31 | ||
32 | #include "iwl-dev.h" | 32 | #include "iwl-dev.h" |
33 | #include "iwl-core.h" | ||
34 | #include "iwl-agn.h" | 33 | #include "iwl-agn.h" |
35 | #include "iwl-trans.h" | 34 | #include "iwl-trans.h" |
36 | 35 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c index baaf5ba2fc38..a5cfe0aceedb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c | |||
@@ -37,11 +37,11 @@ | |||
37 | #include "iwl-agn.h" | 37 | #include "iwl-agn.h" |
38 | #include "iwl-eeprom.h" | 38 | #include "iwl-eeprom.h" |
39 | #include "iwl-dev.h" | 39 | #include "iwl-dev.h" |
40 | #include "iwl-core.h" | ||
41 | #include "iwl-io.h" | 40 | #include "iwl-io.h" |
42 | #include "iwl-commands.h" | 41 | #include "iwl-commands.h" |
43 | #include "iwl-debug.h" | 42 | #include "iwl-debug.h" |
44 | #include "iwl-agn-tt.h" | 43 | #include "iwl-agn-tt.h" |
44 | #include "iwl-modparams.h" | ||
45 | 45 | ||
46 | /* default Thermal Throttling transaction table | 46 | /* default Thermal Throttling transaction table |
47 | * Current state | Throttling Down | Throttling Up | 47 | * Current state | Throttling Down | Throttling Up |
@@ -179,19 +179,19 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data) | |||
179 | 179 | ||
180 | if (tt->state == IWL_TI_CT_KILL) { | 180 | if (tt->state == IWL_TI_CT_KILL) { |
181 | if (priv->thermal_throttle.ct_kill_toggle) { | 181 | if (priv->thermal_throttle.ct_kill_toggle) { |
182 | iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, | 182 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, |
183 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); | 183 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); |
184 | priv->thermal_throttle.ct_kill_toggle = false; | 184 | priv->thermal_throttle.ct_kill_toggle = false; |
185 | } else { | 185 | } else { |
186 | iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_SET, | 186 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET, |
187 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); | 187 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); |
188 | priv->thermal_throttle.ct_kill_toggle = true; | 188 | priv->thermal_throttle.ct_kill_toggle = true; |
189 | } | 189 | } |
190 | iwl_read32(trans(priv), CSR_UCODE_DRV_GP1); | 190 | iwl_read32(priv->trans, CSR_UCODE_DRV_GP1); |
191 | spin_lock_irqsave(&trans(priv)->reg_lock, flags); | 191 | spin_lock_irqsave(&priv->trans->reg_lock, flags); |
192 | if (likely(iwl_grab_nic_access(trans(priv)))) | 192 | if (likely(iwl_grab_nic_access(priv->trans))) |
193 | iwl_release_nic_access(trans(priv)); | 193 | iwl_release_nic_access(priv->trans); |
194 | spin_unlock_irqrestore(&trans(priv)->reg_lock, flags); | 194 | spin_unlock_irqrestore(&priv->trans->reg_lock, flags); |
195 | 195 | ||
196 | /* Reschedule the ct_kill timer to occur in | 196 | /* Reschedule the ct_kill timer to occur in |
197 | * CT_KILL_EXIT_DURATION seconds to ensure we get a | 197 | * CT_KILL_EXIT_DURATION seconds to ensure we get a |
@@ -632,7 +632,7 @@ void iwl_tt_initialize(struct iwl_priv *priv) | |||
632 | INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter); | 632 | INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter); |
633 | INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit); | 633 | INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit); |
634 | 634 | ||
635 | if (cfg(priv)->base_params->adv_thermal_throttle) { | 635 | if (priv->cfg->base_params->adv_thermal_throttle) { |
636 | IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n"); | 636 | IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n"); |
637 | tt->restriction = kcalloc(IWL_TI_STATE_MAX, | 637 | tt->restriction = kcalloc(IWL_TI_STATE_MAX, |
638 | sizeof(struct iwl_tt_restriction), | 638 | sizeof(struct iwl_tt_restriction), |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index ad21b5ddf59d..f2e9f298a947 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/ieee80211.h> | 34 | #include <linux/ieee80211.h> |
35 | 35 | ||
36 | #include "iwl-dev.h" | 36 | #include "iwl-dev.h" |
37 | #include "iwl-core.h" | ||
38 | #include "iwl-io.h" | 37 | #include "iwl-io.h" |
39 | #include "iwl-agn-hw.h" | 38 | #include "iwl-agn-hw.h" |
40 | #include "iwl-agn.h" | 39 | #include "iwl-agn.h" |
@@ -85,8 +84,8 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, | |||
85 | else if (ieee80211_is_back_req(fc)) | 84 | else if (ieee80211_is_back_req(fc)) |
86 | tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; | 85 | tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; |
87 | else if (info->band == IEEE80211_BAND_2GHZ && | 86 | else if (info->band == IEEE80211_BAND_2GHZ && |
88 | cfg(priv)->bt_params && | 87 | priv->cfg->bt_params && |
89 | cfg(priv)->bt_params->advanced_bt_coexist && | 88 | priv->cfg->bt_params->advanced_bt_coexist && |
90 | (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || | 89 | (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || |
91 | ieee80211_is_reassoc_req(fc) || | 90 | ieee80211_is_reassoc_req(fc) || |
92 | skb->protocol == cpu_to_be16(ETH_P_PAE))) | 91 | skb->protocol == cpu_to_be16(ETH_P_PAE))) |
@@ -203,8 +202,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, | |||
203 | rate_flags |= RATE_MCS_CCK_MSK; | 202 | rate_flags |= RATE_MCS_CCK_MSK; |
204 | 203 | ||
205 | /* Set up antennas */ | 204 | /* Set up antennas */ |
206 | if (cfg(priv)->bt_params && | 205 | if (priv->cfg->bt_params && |
207 | cfg(priv)->bt_params->advanced_bt_coexist && | 206 | priv->cfg->bt_params->advanced_bt_coexist && |
208 | priv->bt_full_concurrent) { | 207 | priv->bt_full_concurrent) { |
209 | /* operated as 1x1 in full concurrency mode */ | 208 | /* operated as 1x1 in full concurrency mode */ |
210 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, | 209 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, |
@@ -396,12 +395,9 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
396 | 395 | ||
397 | /* TODO need this for burst mode later on */ | 396 | /* TODO need this for burst mode later on */ |
398 | iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); | 397 | iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); |
399 | iwl_dbg_log_tx_data_frame(priv, len, hdr); | ||
400 | 398 | ||
401 | iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc); | 399 | iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc); |
402 | 400 | ||
403 | iwl_update_stats(priv, true, fc, len); | ||
404 | |||
405 | memset(&info->status, 0, sizeof(info->status)); | 401 | memset(&info->status, 0, sizeof(info->status)); |
406 | 402 | ||
407 | info->driver_data[0] = ctx; | 403 | info->driver_data[0] = ctx; |
@@ -467,7 +463,11 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
467 | else | 463 | else |
468 | txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; | 464 | txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; |
469 | 465 | ||
470 | if (iwl_trans_tx(trans(priv), skb, dev_cmd, txq_id)) | 466 | WARN_ON_ONCE(!is_agg && txq_id != info->hw_queue); |
467 | WARN_ON_ONCE(is_agg && | ||
468 | priv->queue_to_mac80211[txq_id] != info->hw_queue); | ||
469 | |||
470 | if (iwl_trans_tx(priv->trans, skb, dev_cmd, txq_id)) | ||
471 | goto drop_unlock_sta; | 471 | goto drop_unlock_sta; |
472 | 472 | ||
473 | if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) && | 473 | if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) && |
@@ -496,14 +496,14 @@ drop_unlock_priv: | |||
496 | return -1; | 496 | return -1; |
497 | } | 497 | } |
498 | 498 | ||
499 | static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int ac) | 499 | static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int mq) |
500 | { | 500 | { |
501 | int q; | 501 | int q; |
502 | 502 | ||
503 | for (q = IWLAGN_FIRST_AMPDU_QUEUE; | 503 | for (q = IWLAGN_FIRST_AMPDU_QUEUE; |
504 | q < cfg(priv)->base_params->num_of_queues; q++) { | 504 | q < priv->cfg->base_params->num_of_queues; q++) { |
505 | if (!test_and_set_bit(q, priv->agg_q_alloc)) { | 505 | if (!test_and_set_bit(q, priv->agg_q_alloc)) { |
506 | priv->queue_to_ac[q] = ac; | 506 | priv->queue_to_mac80211[q] = mq; |
507 | return q; | 507 | return q; |
508 | } | 508 | } |
509 | } | 509 | } |
@@ -514,7 +514,7 @@ static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int ac) | |||
514 | static void iwlagn_dealloc_agg_txq(struct iwl_priv *priv, int q) | 514 | static void iwlagn_dealloc_agg_txq(struct iwl_priv *priv, int q) |
515 | { | 515 | { |
516 | clear_bit(q, priv->agg_q_alloc); | 516 | clear_bit(q, priv->agg_q_alloc); |
517 | priv->queue_to_ac[q] = IWL_INVALID_AC; | 517 | priv->queue_to_mac80211[q] = IWL_INVALID_MAC80211_QUEUE; |
518 | } | 518 | } |
519 | 519 | ||
520 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | 520 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, |
@@ -522,6 +522,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
522 | { | 522 | { |
523 | struct iwl_tid_data *tid_data; | 523 | struct iwl_tid_data *tid_data; |
524 | int sta_id, txq_id; | 524 | int sta_id, txq_id; |
525 | enum iwl_agg_state agg_state; | ||
525 | 526 | ||
526 | sta_id = iwl_sta_id(sta); | 527 | sta_id = iwl_sta_id(sta); |
527 | 528 | ||
@@ -545,6 +546,13 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
545 | */ | 546 | */ |
546 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | 547 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); |
547 | goto turn_off; | 548 | goto turn_off; |
549 | case IWL_AGG_STARTING: | ||
550 | /* | ||
551 | * This can happen when the session is stopped before | ||
552 | * we receive ADDBA response | ||
553 | */ | ||
554 | IWL_DEBUG_HT(priv, "AGG stop before AGG became operational\n"); | ||
555 | goto turn_off; | ||
548 | case IWL_AGG_ON: | 556 | case IWL_AGG_ON: |
549 | break; | 557 | break; |
550 | default: | 558 | default: |
@@ -576,12 +584,17 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
576 | IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", | 584 | IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", |
577 | tid_data->agg.ssn); | 585 | tid_data->agg.ssn); |
578 | turn_off: | 586 | turn_off: |
587 | agg_state = priv->tid_data[sta_id][tid].agg.state; | ||
579 | priv->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF; | 588 | priv->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF; |
580 | 589 | ||
581 | spin_unlock_bh(&priv->sta_lock); | 590 | spin_unlock_bh(&priv->sta_lock); |
582 | 591 | ||
583 | if (test_bit(txq_id, priv->agg_q_alloc)) { | 592 | if (test_bit(txq_id, priv->agg_q_alloc)) { |
584 | iwl_trans_tx_agg_disable(trans(priv), txq_id); | 593 | /* If the transport didn't know that we wanted to start |
594 | * agreggation, don't tell it that we want to stop them | ||
595 | */ | ||
596 | if (agg_state != IWL_AGG_STARTING) | ||
597 | iwl_trans_tx_agg_disable(priv->trans, txq_id); | ||
585 | iwlagn_dealloc_agg_txq(priv, txq_id); | 598 | iwlagn_dealloc_agg_txq(priv, txq_id); |
586 | } | 599 | } |
587 | 600 | ||
@@ -593,6 +606,7 @@ turn_off: | |||
593 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, | 606 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, |
594 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 607 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
595 | { | 608 | { |
609 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | ||
596 | struct iwl_tid_data *tid_data; | 610 | struct iwl_tid_data *tid_data; |
597 | int sta_id, txq_id, ret; | 611 | int sta_id, txq_id, ret; |
598 | 612 | ||
@@ -612,7 +626,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
612 | return -ENXIO; | 626 | return -ENXIO; |
613 | } | 627 | } |
614 | 628 | ||
615 | txq_id = iwlagn_alloc_agg_txq(priv, tid_to_ac[tid]); | 629 | txq_id = iwlagn_alloc_agg_txq(priv, ctx->ac_to_queue[tid_to_ac[tid]]); |
616 | if (txq_id < 0) { | 630 | if (txq_id < 0) { |
617 | IWL_DEBUG_TX_QUEUES(priv, | 631 | IWL_DEBUG_TX_QUEUES(priv, |
618 | "No free aggregation queue for %pM/%d\n", | 632 | "No free aggregation queue for %pM/%d\n", |
@@ -634,7 +648,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
634 | if (*ssn == tid_data->next_reclaimed) { | 648 | if (*ssn == tid_data->next_reclaimed) { |
635 | IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", | 649 | IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", |
636 | tid_data->agg.ssn); | 650 | tid_data->agg.ssn); |
637 | tid_data->agg.state = IWL_AGG_ON; | 651 | tid_data->agg.state = IWL_AGG_STARTING; |
638 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 652 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
639 | } else { | 653 | } else { |
640 | IWL_DEBUG_TX_QUEUES(priv, "Can't proceed: ssn %d, " | 654 | IWL_DEBUG_TX_QUEUES(priv, "Can't proceed: ssn %d, " |
@@ -661,11 +675,12 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
661 | spin_lock_bh(&priv->sta_lock); | 675 | spin_lock_bh(&priv->sta_lock); |
662 | ssn = priv->tid_data[sta_priv->sta_id][tid].agg.ssn; | 676 | ssn = priv->tid_data[sta_priv->sta_id][tid].agg.ssn; |
663 | q = priv->tid_data[sta_priv->sta_id][tid].agg.txq_id; | 677 | q = priv->tid_data[sta_priv->sta_id][tid].agg.txq_id; |
678 | priv->tid_data[sta_priv->sta_id][tid].agg.state = IWL_AGG_ON; | ||
664 | spin_unlock_bh(&priv->sta_lock); | 679 | spin_unlock_bh(&priv->sta_lock); |
665 | 680 | ||
666 | fifo = ctx->ac_to_fifo[tid_to_ac[tid]]; | 681 | fifo = ctx->ac_to_fifo[tid_to_ac[tid]]; |
667 | 682 | ||
668 | iwl_trans_tx_agg_setup(trans(priv), q, fifo, | 683 | iwl_trans_tx_agg_setup(priv->trans, q, fifo, |
669 | sta_priv->sta_id, tid, | 684 | sta_priv->sta_id, tid, |
670 | buf_size, ssn); | 685 | buf_size, ssn); |
671 | 686 | ||
@@ -732,7 +747,7 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid) | |||
732 | IWL_DEBUG_TX_QUEUES(priv, | 747 | IWL_DEBUG_TX_QUEUES(priv, |
733 | "Can continue DELBA flow ssn = next_recl =" | 748 | "Can continue DELBA flow ssn = next_recl =" |
734 | " %d", tid_data->next_reclaimed); | 749 | " %d", tid_data->next_reclaimed); |
735 | iwl_trans_tx_agg_disable(trans(priv), | 750 | iwl_trans_tx_agg_disable(priv->trans, |
736 | tid_data->agg.txq_id); | 751 | tid_data->agg.txq_id); |
737 | iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); | 752 | iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); |
738 | tid_data->agg.state = IWL_AGG_OFF; | 753 | tid_data->agg.state = IWL_AGG_OFF; |
@@ -745,7 +760,7 @@ static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid) | |||
745 | IWL_DEBUG_TX_QUEUES(priv, | 760 | IWL_DEBUG_TX_QUEUES(priv, |
746 | "Can continue ADDBA flow ssn = next_recl =" | 761 | "Can continue ADDBA flow ssn = next_recl =" |
747 | " %d", tid_data->next_reclaimed); | 762 | " %d", tid_data->next_reclaimed); |
748 | tid_data->agg.state = IWL_AGG_ON; | 763 | tid_data->agg.state = IWL_AGG_STARTING; |
749 | ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); | 764 | ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); |
750 | } | 765 | } |
751 | break; | 766 | break; |
@@ -909,8 +924,8 @@ static void iwl_rx_reply_tx_agg(struct iwl_priv *priv, | |||
909 | * notification again. | 924 | * notification again. |
910 | */ | 925 | */ |
911 | if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && | 926 | if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && |
912 | cfg(priv)->bt_params && | 927 | priv->cfg->bt_params && |
913 | cfg(priv)->bt_params->advanced_bt_coexist) { | 928 | priv->cfg->bt_params->advanced_bt_coexist) { |
914 | IWL_DEBUG_COEX(priv, "receive reply tx w/ bt_kill\n"); | 929 | IWL_DEBUG_COEX(priv, "receive reply tx w/ bt_kill\n"); |
915 | } | 930 | } |
916 | 931 | ||
@@ -1092,7 +1107,7 @@ static int iwl_reclaim(struct iwl_priv *priv, int sta_id, int tid, | |||
1092 | return 1; | 1107 | return 1; |
1093 | } | 1108 | } |
1094 | 1109 | ||
1095 | iwl_trans_reclaim(trans(priv), txq_id, ssn, skbs); | 1110 | iwl_trans_reclaim(priv->trans, txq_id, ssn, skbs); |
1096 | return 0; | 1111 | return 0; |
1097 | } | 1112 | } |
1098 | 1113 | ||
@@ -1249,7 +1264,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1249 | * (in Tx queue's circular buffer) of first TFD/frame in window */ | 1264 | * (in Tx queue's circular buffer) of first TFD/frame in window */ |
1250 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); | 1265 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); |
1251 | 1266 | ||
1252 | if (scd_flow >= cfg(priv)->base_params->num_of_queues) { | 1267 | if (scd_flow >= priv->cfg->base_params->num_of_queues) { |
1253 | IWL_ERR(priv, | 1268 | IWL_ERR(priv, |
1254 | "BUG_ON scd_flow is bigger than number of queues\n"); | 1269 | "BUG_ON scd_flow is bigger than number of queues\n"); |
1255 | return 0; | 1270 | return 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 7db39866bdc4..b53852dcdbfd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -46,13 +46,13 @@ | |||
46 | 46 | ||
47 | #include "iwl-eeprom.h" | 47 | #include "iwl-eeprom.h" |
48 | #include "iwl-dev.h" | 48 | #include "iwl-dev.h" |
49 | #include "iwl-core.h" | ||
50 | #include "iwl-io.h" | 49 | #include "iwl-io.h" |
51 | #include "iwl-agn-calib.h" | 50 | #include "iwl-agn-calib.h" |
52 | #include "iwl-agn.h" | 51 | #include "iwl-agn.h" |
53 | #include "iwl-shared.h" | ||
54 | #include "iwl-trans.h" | 52 | #include "iwl-trans.h" |
55 | #include "iwl-op-mode.h" | 53 | #include "iwl-op-mode.h" |
54 | #include "iwl-drv.h" | ||
55 | #include "iwl-modparams.h" | ||
56 | 56 | ||
57 | /****************************************************************************** | 57 | /****************************************************************************** |
58 | * | 58 | * |
@@ -348,14 +348,14 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base, | |||
348 | ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32)); | 348 | ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32)); |
349 | 349 | ||
350 | /* Make sure device is powered up for SRAM reads */ | 350 | /* Make sure device is powered up for SRAM reads */ |
351 | spin_lock_irqsave(&trans(priv)->reg_lock, reg_flags); | 351 | spin_lock_irqsave(&priv->trans->reg_lock, reg_flags); |
352 | if (unlikely(!iwl_grab_nic_access(trans(priv)))) { | 352 | if (unlikely(!iwl_grab_nic_access(priv->trans))) { |
353 | spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags); | 353 | spin_unlock_irqrestore(&priv->trans->reg_lock, reg_flags); |
354 | return; | 354 | return; |
355 | } | 355 | } |
356 | 356 | ||
357 | /* Set starting address; reads will auto-increment */ | 357 | /* Set starting address; reads will auto-increment */ |
358 | iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, ptr); | 358 | iwl_write32(priv->trans, HBUS_TARG_MEM_RADDR, ptr); |
359 | 359 | ||
360 | /* | 360 | /* |
361 | * Refuse to read more than would have fit into the log from | 361 | * Refuse to read more than would have fit into the log from |
@@ -371,20 +371,20 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base, | |||
371 | * place event id # at far right for easier visual parsing. | 371 | * place event id # at far right for easier visual parsing. |
372 | */ | 372 | */ |
373 | for (i = 0; i < num_events; i++) { | 373 | for (i = 0; i < num_events; i++) { |
374 | ev = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); | 374 | ev = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); |
375 | time = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); | 375 | time = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); |
376 | if (mode == 0) { | 376 | if (mode == 0) { |
377 | trace_iwlwifi_dev_ucode_cont_event( | 377 | trace_iwlwifi_dev_ucode_cont_event( |
378 | trans(priv)->dev, 0, time, ev); | 378 | priv->trans->dev, 0, time, ev); |
379 | } else { | 379 | } else { |
380 | data = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); | 380 | data = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); |
381 | trace_iwlwifi_dev_ucode_cont_event( | 381 | trace_iwlwifi_dev_ucode_cont_event( |
382 | trans(priv)->dev, time, data, ev); | 382 | priv->trans->dev, time, data, ev); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | /* Allow device to power down */ | 385 | /* Allow device to power down */ |
386 | iwl_release_nic_access(trans(priv)); | 386 | iwl_release_nic_access(priv->trans); |
387 | spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags); | 387 | spin_unlock_irqrestore(&priv->trans->reg_lock, reg_flags); |
388 | } | 388 | } |
389 | 389 | ||
390 | static void iwl_continuous_event_trace(struct iwl_priv *priv) | 390 | static void iwl_continuous_event_trace(struct iwl_priv *priv) |
@@ -403,8 +403,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv) | |||
403 | 403 | ||
404 | base = priv->device_pointers.log_event_table; | 404 | base = priv->device_pointers.log_event_table; |
405 | if (iwlagn_hw_valid_rtc_data_addr(base)) { | 405 | if (iwlagn_hw_valid_rtc_data_addr(base)) { |
406 | iwl_read_targ_mem_words(trans(priv), base, &read, sizeof(read)); | 406 | iwl_read_targ_mem_words(priv->trans, base, &read, sizeof(read)); |
407 | |||
408 | capacity = read.capacity; | 407 | capacity = read.capacity; |
409 | mode = read.mode; | 408 | mode = read.mode; |
410 | num_wraps = read.wrap_counter; | 409 | num_wraps = read.wrap_counter; |
@@ -444,7 +443,7 @@ static void iwl_continuous_event_trace(struct iwl_priv *priv) | |||
444 | else | 443 | else |
445 | priv->event_log.wraps_once_count++; | 444 | priv->event_log.wraps_once_count++; |
446 | 445 | ||
447 | trace_iwlwifi_dev_ucode_wrap_event(trans(priv)->dev, | 446 | trace_iwlwifi_dev_ucode_wrap_event(priv->trans->dev, |
448 | num_wraps - priv->event_log.num_wraps, | 447 | num_wraps - priv->event_log.num_wraps, |
449 | next_entry, priv->event_log.next_entry); | 448 | next_entry, priv->event_log.next_entry); |
450 | 449 | ||
@@ -579,24 +578,6 @@ static const u8 iwlagn_pan_ac_to_queue[] = { | |||
579 | 7, 6, 5, 4, | 578 | 7, 6, 5, 4, |
580 | }; | 579 | }; |
581 | 580 | ||
582 | static const u8 iwlagn_bss_queue_to_ac[] = { | ||
583 | IEEE80211_AC_VO, | ||
584 | IEEE80211_AC_VI, | ||
585 | IEEE80211_AC_BE, | ||
586 | IEEE80211_AC_BK, | ||
587 | }; | ||
588 | |||
589 | static const u8 iwlagn_pan_queue_to_ac[] = { | ||
590 | IEEE80211_AC_VO, | ||
591 | IEEE80211_AC_VI, | ||
592 | IEEE80211_AC_BE, | ||
593 | IEEE80211_AC_BK, | ||
594 | IEEE80211_AC_BK, | ||
595 | IEEE80211_AC_BE, | ||
596 | IEEE80211_AC_VI, | ||
597 | IEEE80211_AC_VO, | ||
598 | }; | ||
599 | |||
600 | void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) | 581 | void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) |
601 | { | 582 | { |
602 | int i; | 583 | int i; |
@@ -670,12 +651,12 @@ void iwl_rf_kill_ct_config(struct iwl_priv *priv) | |||
670 | struct iwl_ct_kill_throttling_config adv_cmd; | 651 | struct iwl_ct_kill_throttling_config adv_cmd; |
671 | int ret = 0; | 652 | int ret = 0; |
672 | 653 | ||
673 | iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, | 654 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, |
674 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); | 655 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); |
675 | 656 | ||
676 | priv->thermal_throttle.ct_kill_toggle = false; | 657 | priv->thermal_throttle.ct_kill_toggle = false; |
677 | 658 | ||
678 | if (cfg(priv)->base_params->support_ct_kill_exit) { | 659 | if (priv->cfg->base_params->support_ct_kill_exit) { |
679 | adv_cmd.critical_temperature_enter = | 660 | adv_cmd.critical_temperature_enter = |
680 | cpu_to_le32(priv->hw_params.ct_kill_threshold); | 661 | cpu_to_le32(priv->hw_params.ct_kill_threshold); |
681 | adv_cmd.critical_temperature_exit = | 662 | adv_cmd.critical_temperature_exit = |
@@ -754,7 +735,7 @@ void iwl_send_bt_config(struct iwl_priv *priv) | |||
754 | .kill_cts_mask = 0, | 735 | .kill_cts_mask = 0, |
755 | }; | 736 | }; |
756 | 737 | ||
757 | if (!iwlagn_mod_params.bt_coex_active) | 738 | if (!iwlwifi_mod_params.bt_coex_active) |
758 | bt_cmd.flags = BT_COEX_DISABLE; | 739 | bt_cmd.flags = BT_COEX_DISABLE; |
759 | else | 740 | else |
760 | bt_cmd.flags = BT_COEX_ENABLE; | 741 | bt_cmd.flags = BT_COEX_ENABLE; |
@@ -792,10 +773,10 @@ int iwl_alive_start(struct iwl_priv *priv) | |||
792 | } | 773 | } |
793 | 774 | ||
794 | /* download priority table before any calibration request */ | 775 | /* download priority table before any calibration request */ |
795 | if (cfg(priv)->bt_params && | 776 | if (priv->cfg->bt_params && |
796 | cfg(priv)->bt_params->advanced_bt_coexist) { | 777 | priv->cfg->bt_params->advanced_bt_coexist) { |
797 | /* Configure Bluetooth device coexistence support */ | 778 | /* Configure Bluetooth device coexistence support */ |
798 | if (cfg(priv)->bt_params->bt_sco_disable) | 779 | if (priv->cfg->bt_params->bt_sco_disable) |
799 | priv->bt_enable_pspoll = false; | 780 | priv->bt_enable_pspoll = false; |
800 | else | 781 | else |
801 | priv->bt_enable_pspoll = true; | 782 | priv->bt_enable_pspoll = true; |
@@ -932,9 +913,9 @@ void iwl_down(struct iwl_priv *priv) | |||
932 | priv->bt_status = 0; | 913 | priv->bt_status = 0; |
933 | priv->cur_rssi_ctx = NULL; | 914 | priv->cur_rssi_ctx = NULL; |
934 | priv->bt_is_sco = 0; | 915 | priv->bt_is_sco = 0; |
935 | if (cfg(priv)->bt_params) | 916 | if (priv->cfg->bt_params) |
936 | priv->bt_traffic_load = | 917 | priv->bt_traffic_load = |
937 | cfg(priv)->bt_params->bt_init_traffic_load; | 918 | priv->cfg->bt_params->bt_init_traffic_load; |
938 | else | 919 | else |
939 | priv->bt_traffic_load = 0; | 920 | priv->bt_traffic_load = 0; |
940 | priv->bt_full_concurrent = false; | 921 | priv->bt_full_concurrent = false; |
@@ -949,7 +930,7 @@ void iwl_down(struct iwl_priv *priv) | |||
949 | ieee80211_stop_queues(priv->hw); | 930 | ieee80211_stop_queues(priv->hw); |
950 | 931 | ||
951 | priv->ucode_loaded = false; | 932 | priv->ucode_loaded = false; |
952 | iwl_trans_stop_device(trans(priv)); | 933 | iwl_trans_stop_device(priv->trans); |
953 | 934 | ||
954 | /* Clear out all status bits but a few that are stable across reset */ | 935 | /* Clear out all status bits but a few that are stable across reset */ |
955 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 936 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << |
@@ -1031,12 +1012,12 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) | |||
1031 | priv->bt_status = bt_status; | 1012 | priv->bt_status = bt_status; |
1032 | priv->bt_is_sco = bt_is_sco; | 1013 | priv->bt_is_sco = bt_is_sco; |
1033 | 1014 | ||
1034 | /* reset all queues */ | 1015 | /* reset aggregation queues */ |
1035 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
1036 | atomic_set(&priv->ac_stop_count[i], 0); | ||
1037 | |||
1038 | for (i = IWLAGN_FIRST_AMPDU_QUEUE; i < IWL_MAX_HW_QUEUES; i++) | 1016 | for (i = IWLAGN_FIRST_AMPDU_QUEUE; i < IWL_MAX_HW_QUEUES; i++) |
1039 | priv->queue_to_ac[i] = IWL_INVALID_AC; | 1017 | priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; |
1018 | /* and stop counts */ | ||
1019 | for (i = 0; i < IWL_MAX_HW_QUEUES; i++) | ||
1020 | atomic_set(&priv->queue_stop_count[i], 0); | ||
1040 | 1021 | ||
1041 | memset(priv->agg_q_alloc, 0, sizeof(priv->agg_q_alloc)); | 1022 | memset(priv->agg_q_alloc, 0, sizeof(priv->agg_q_alloc)); |
1042 | } | 1023 | } |
@@ -1115,7 +1096,7 @@ void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
1115 | 1096 | ||
1116 | iwl_setup_scan_deferred_work(priv); | 1097 | iwl_setup_scan_deferred_work(priv); |
1117 | 1098 | ||
1118 | if (cfg(priv)->bt_params) | 1099 | if (priv->cfg->bt_params) |
1119 | iwlagn_bt_setup_deferred_work(priv); | 1100 | iwlagn_bt_setup_deferred_work(priv); |
1120 | 1101 | ||
1121 | init_timer(&priv->statistics_periodic); | 1102 | init_timer(&priv->statistics_periodic); |
@@ -1129,7 +1110,7 @@ void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
1129 | 1110 | ||
1130 | void iwl_cancel_deferred_work(struct iwl_priv *priv) | 1111 | void iwl_cancel_deferred_work(struct iwl_priv *priv) |
1131 | { | 1112 | { |
1132 | if (cfg(priv)->bt_params) | 1113 | if (priv->cfg->bt_params) |
1133 | iwlagn_bt_cancel_deferred_work(priv); | 1114 | iwlagn_bt_cancel_deferred_work(priv); |
1134 | 1115 | ||
1135 | cancel_work_sync(&priv->run_time_calib_work); | 1116 | cancel_work_sync(&priv->run_time_calib_work); |
@@ -1180,8 +1161,8 @@ static void iwl_init_ht_hw_capab(const struct iwl_priv *priv, | |||
1180 | 1161 | ||
1181 | ht_info->ht_supported = true; | 1162 | ht_info->ht_supported = true; |
1182 | 1163 | ||
1183 | if (cfg(priv)->ht_params && | 1164 | if (priv->cfg->ht_params && |
1184 | cfg(priv)->ht_params->ht_greenfield_support) | 1165 | priv->cfg->ht_params->ht_greenfield_support) |
1185 | ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; | 1166 | ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; |
1186 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; | 1167 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; |
1187 | max_bit_rate = MAX_BIT_RATE_20_MHZ; | 1168 | max_bit_rate = MAX_BIT_RATE_20_MHZ; |
@@ -1192,7 +1173,7 @@ static void iwl_init_ht_hw_capab(const struct iwl_priv *priv, | |||
1192 | max_bit_rate = MAX_BIT_RATE_40_MHZ; | 1173 | max_bit_rate = MAX_BIT_RATE_40_MHZ; |
1193 | } | 1174 | } |
1194 | 1175 | ||
1195 | if (iwlagn_mod_params.amsdu_size_8K) | 1176 | if (iwlwifi_mod_params.amsdu_size_8K) |
1196 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; | 1177 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; |
1197 | 1178 | ||
1198 | ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; | 1179 | ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; |
@@ -1325,7 +1306,7 @@ static int iwl_init_geos(struct iwl_priv *priv) | |||
1325 | priv->hw_params.sku & EEPROM_SKU_CAP_BAND_52GHZ) { | 1306 | priv->hw_params.sku & EEPROM_SKU_CAP_BAND_52GHZ) { |
1326 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " | 1307 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " |
1327 | "Please send your %s to maintainer.\n", | 1308 | "Please send your %s to maintainer.\n", |
1328 | trans(priv)->hw_id_str); | 1309 | priv->trans->hw_id_str); |
1329 | priv->hw_params.sku &= ~EEPROM_SKU_CAP_BAND_52GHZ; | 1310 | priv->hw_params.sku &= ~EEPROM_SKU_CAP_BAND_52GHZ; |
1330 | } | 1311 | } |
1331 | 1312 | ||
@@ -1363,7 +1344,7 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
1363 | priv->band = IEEE80211_BAND_2GHZ; | 1344 | priv->band = IEEE80211_BAND_2GHZ; |
1364 | 1345 | ||
1365 | priv->plcp_delta_threshold = | 1346 | priv->plcp_delta_threshold = |
1366 | cfg(priv)->base_params->plcp_delta_threshold; | 1347 | priv->cfg->base_params->plcp_delta_threshold; |
1367 | 1348 | ||
1368 | priv->iw_mode = NL80211_IFTYPE_STATION; | 1349 | priv->iw_mode = NL80211_IFTYPE_STATION; |
1369 | priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; | 1350 | priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; |
@@ -1380,8 +1361,8 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
1380 | iwl_init_scan_params(priv); | 1361 | iwl_init_scan_params(priv); |
1381 | 1362 | ||
1382 | /* init bt coex */ | 1363 | /* init bt coex */ |
1383 | if (cfg(priv)->bt_params && | 1364 | if (priv->cfg->bt_params && |
1384 | cfg(priv)->bt_params->advanced_bt_coexist) { | 1365 | priv->cfg->bt_params->advanced_bt_coexist) { |
1385 | priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; | 1366 | priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; |
1386 | priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; | 1367 | priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; |
1387 | priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; | 1368 | priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; |
@@ -1426,11 +1407,11 @@ void iwl_uninit_drv(struct iwl_priv *priv) | |||
1426 | 1407 | ||
1427 | void iwl_set_hw_params(struct iwl_priv *priv) | 1408 | void iwl_set_hw_params(struct iwl_priv *priv) |
1428 | { | 1409 | { |
1429 | if (cfg(priv)->ht_params) | 1410 | if (priv->cfg->ht_params) |
1430 | priv->hw_params.use_rts_for_aggregation = | 1411 | priv->hw_params.use_rts_for_aggregation = |
1431 | cfg(priv)->ht_params->use_rts_for_aggregation; | 1412 | priv->cfg->ht_params->use_rts_for_aggregation; |
1432 | 1413 | ||
1433 | if (iwlagn_mod_params.disable_11n & IWL_DISABLE_HT_ALL) | 1414 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) |
1434 | priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE; | 1415 | priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE; |
1435 | 1416 | ||
1436 | /* Device-specific setup */ | 1417 | /* Device-specific setup */ |
@@ -1441,32 +1422,32 @@ void iwl_set_hw_params(struct iwl_priv *priv) | |||
1441 | 1422 | ||
1442 | void iwl_debug_config(struct iwl_priv *priv) | 1423 | void iwl_debug_config(struct iwl_priv *priv) |
1443 | { | 1424 | { |
1444 | dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEBUG " | 1425 | dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEBUG " |
1445 | #ifdef CONFIG_IWLWIFI_DEBUG | 1426 | #ifdef CONFIG_IWLWIFI_DEBUG |
1446 | "enabled\n"); | 1427 | "enabled\n"); |
1447 | #else | 1428 | #else |
1448 | "disabled\n"); | 1429 | "disabled\n"); |
1449 | #endif | 1430 | #endif |
1450 | dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEBUGFS " | 1431 | dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEBUGFS " |
1451 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1432 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1452 | "enabled\n"); | 1433 | "enabled\n"); |
1453 | #else | 1434 | #else |
1454 | "disabled\n"); | 1435 | "disabled\n"); |
1455 | #endif | 1436 | #endif |
1456 | dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TRACING " | 1437 | dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEVICE_TRACING " |
1457 | #ifdef CONFIG_IWLWIFI_DEVICE_TRACING | 1438 | #ifdef CONFIG_IWLWIFI_DEVICE_TRACING |
1458 | "enabled\n"); | 1439 | "enabled\n"); |
1459 | #else | 1440 | #else |
1460 | "disabled\n"); | 1441 | "disabled\n"); |
1461 | #endif | 1442 | #endif |
1462 | 1443 | ||
1463 | dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TESTMODE " | 1444 | dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_DEVICE_TESTMODE " |
1464 | #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE | 1445 | #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE |
1465 | "enabled\n"); | 1446 | "enabled\n"); |
1466 | #else | 1447 | #else |
1467 | "disabled\n"); | 1448 | "disabled\n"); |
1468 | #endif | 1449 | #endif |
1469 | dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_P2P " | 1450 | dev_printk(KERN_INFO, priv->trans->dev, "CONFIG_IWLWIFI_P2P " |
1470 | #ifdef CONFIG_IWLWIFI_P2P | 1451 | #ifdef CONFIG_IWLWIFI_P2P |
1471 | "enabled\n"); | 1452 | "enabled\n"); |
1472 | #else | 1453 | #else |
@@ -1475,6 +1456,7 @@ void iwl_debug_config(struct iwl_priv *priv) | |||
1475 | } | 1456 | } |
1476 | 1457 | ||
1477 | static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | 1458 | static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, |
1459 | const struct iwl_cfg *cfg, | ||
1478 | const struct iwl_fw *fw) | 1460 | const struct iwl_fw *fw) |
1479 | { | 1461 | { |
1480 | struct iwl_priv *priv; | 1462 | struct iwl_priv *priv; |
@@ -1491,8 +1473,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1491 | STATISTICS_NOTIFICATION, | 1473 | STATISTICS_NOTIFICATION, |
1492 | REPLY_TX, | 1474 | REPLY_TX, |
1493 | }; | 1475 | }; |
1494 | const u8 *q_to_ac; | ||
1495 | int n_q_to_ac; | ||
1496 | int i; | 1476 | int i; |
1497 | 1477 | ||
1498 | /************************ | 1478 | /************************ |
@@ -1500,18 +1480,19 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1500 | ************************/ | 1480 | ************************/ |
1501 | hw = iwl_alloc_all(); | 1481 | hw = iwl_alloc_all(); |
1502 | if (!hw) { | 1482 | if (!hw) { |
1503 | pr_err("%s: Cannot allocate network device\n", | 1483 | pr_err("%s: Cannot allocate network device\n", cfg->name); |
1504 | cfg(trans)->name); | ||
1505 | goto out; | 1484 | goto out; |
1506 | } | 1485 | } |
1507 | 1486 | ||
1508 | op_mode = hw->priv; | 1487 | op_mode = hw->priv; |
1509 | op_mode->ops = &iwl_dvm_ops; | 1488 | op_mode->ops = &iwl_dvm_ops; |
1510 | priv = IWL_OP_MODE_GET_DVM(op_mode); | 1489 | priv = IWL_OP_MODE_GET_DVM(op_mode); |
1511 | priv->shrd = trans->shrd; | 1490 | priv->trans = trans; |
1491 | priv->dev = trans->dev; | ||
1492 | priv->cfg = cfg; | ||
1512 | priv->fw = fw; | 1493 | priv->fw = fw; |
1513 | 1494 | ||
1514 | switch (cfg(priv)->device_family) { | 1495 | switch (priv->cfg->device_family) { |
1515 | case IWL_DEVICE_FAMILY_1000: | 1496 | case IWL_DEVICE_FAMILY_1000: |
1516 | case IWL_DEVICE_FAMILY_100: | 1497 | case IWL_DEVICE_FAMILY_100: |
1517 | priv->lib = &iwl1000_lib; | 1498 | priv->lib = &iwl1000_lib; |
@@ -1545,7 +1526,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1545 | } | 1526 | } |
1546 | 1527 | ||
1547 | if (WARN_ON(!priv->lib)) | 1528 | if (WARN_ON(!priv->lib)) |
1548 | goto out_free_traffic_mem; | 1529 | goto out_free_hw; |
1549 | 1530 | ||
1550 | /* | 1531 | /* |
1551 | * Populate the state variables that the transport layer needs | 1532 | * Populate the state variables that the transport layer needs |
@@ -1554,10 +1535,10 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1554 | trans_cfg.op_mode = op_mode; | 1535 | trans_cfg.op_mode = op_mode; |
1555 | trans_cfg.no_reclaim_cmds = no_reclaim_cmds; | 1536 | trans_cfg.no_reclaim_cmds = no_reclaim_cmds; |
1556 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); | 1537 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); |
1557 | trans_cfg.rx_buf_size_8k = iwlagn_mod_params.amsdu_size_8K; | 1538 | trans_cfg.rx_buf_size_8k = iwlwifi_mod_params.amsdu_size_8K; |
1558 | if (!iwlagn_mod_params.wd_disable) | 1539 | if (!iwlwifi_mod_params.wd_disable) |
1559 | trans_cfg.queue_watchdog_timeout = | 1540 | trans_cfg.queue_watchdog_timeout = |
1560 | cfg(priv)->base_params->wd_timeout; | 1541 | priv->cfg->base_params->wd_timeout; |
1561 | else | 1542 | else |
1562 | trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED; | 1543 | trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED; |
1563 | trans_cfg.command_names = iwl_dvm_cmd_strings; | 1544 | trans_cfg.command_names = iwl_dvm_cmd_strings; |
@@ -1574,24 +1555,20 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1574 | trans_cfg.queue_to_fifo = iwlagn_ipan_queue_to_tx_fifo; | 1555 | trans_cfg.queue_to_fifo = iwlagn_ipan_queue_to_tx_fifo; |
1575 | trans_cfg.n_queue_to_fifo = | 1556 | trans_cfg.n_queue_to_fifo = |
1576 | ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo); | 1557 | ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo); |
1577 | q_to_ac = iwlagn_pan_queue_to_ac; | ||
1578 | n_q_to_ac = ARRAY_SIZE(iwlagn_pan_queue_to_ac); | ||
1579 | } else { | 1558 | } else { |
1580 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | 1559 | priv->sta_key_max_num = STA_KEY_MAX_NUM; |
1581 | trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; | 1560 | trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; |
1582 | trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo; | 1561 | trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo; |
1583 | trans_cfg.n_queue_to_fifo = | 1562 | trans_cfg.n_queue_to_fifo = |
1584 | ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); | 1563 | ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); |
1585 | q_to_ac = iwlagn_bss_queue_to_ac; | ||
1586 | n_q_to_ac = ARRAY_SIZE(iwlagn_bss_queue_to_ac); | ||
1587 | } | 1564 | } |
1588 | 1565 | ||
1589 | /* Configure transport layer */ | 1566 | /* Configure transport layer */ |
1590 | iwl_trans_configure(trans(priv), &trans_cfg); | 1567 | iwl_trans_configure(priv->trans, &trans_cfg); |
1591 | 1568 | ||
1592 | /* At this point both hw and priv are allocated. */ | 1569 | /* At this point both hw and priv are allocated. */ |
1593 | 1570 | ||
1594 | SET_IEEE80211_DEV(priv->hw, trans(priv)->dev); | 1571 | SET_IEEE80211_DEV(priv->hw, priv->trans->dev); |
1595 | 1572 | ||
1596 | /* show what debugging capabilities we have */ | 1573 | /* show what debugging capabilities we have */ |
1597 | iwl_debug_config(priv); | 1574 | iwl_debug_config(priv); |
@@ -1600,40 +1577,37 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1600 | 1577 | ||
1601 | /* is antenna coupling more than 35dB ? */ | 1578 | /* is antenna coupling more than 35dB ? */ |
1602 | priv->bt_ant_couple_ok = | 1579 | priv->bt_ant_couple_ok = |
1603 | (iwlagn_mod_params.ant_coupling > | 1580 | (iwlwifi_mod_params.ant_coupling > |
1604 | IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? | 1581 | IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? |
1605 | true : false; | 1582 | true : false; |
1606 | 1583 | ||
1607 | /* enable/disable bt channel inhibition */ | 1584 | /* enable/disable bt channel inhibition */ |
1608 | priv->bt_ch_announce = iwlagn_mod_params.bt_ch_announce; | 1585 | priv->bt_ch_announce = iwlwifi_mod_params.bt_ch_announce; |
1609 | IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n", | 1586 | IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n", |
1610 | (priv->bt_ch_announce) ? "On" : "Off"); | 1587 | (priv->bt_ch_announce) ? "On" : "Off"); |
1611 | 1588 | ||
1612 | if (iwl_alloc_traffic_mem(priv)) | ||
1613 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); | ||
1614 | |||
1615 | /* these spin locks will be used in apm_ops.init and EEPROM access | 1589 | /* these spin locks will be used in apm_ops.init and EEPROM access |
1616 | * we should init now | 1590 | * we should init now |
1617 | */ | 1591 | */ |
1618 | spin_lock_init(&trans(priv)->reg_lock); | 1592 | spin_lock_init(&priv->trans->reg_lock); |
1619 | spin_lock_init(&priv->statistics.lock); | 1593 | spin_lock_init(&priv->statistics.lock); |
1620 | 1594 | ||
1621 | /*********************** | 1595 | /*********************** |
1622 | * 2. Read REV register | 1596 | * 2. Read REV register |
1623 | ***********************/ | 1597 | ***********************/ |
1624 | IWL_INFO(priv, "Detected %s, REV=0x%X\n", | 1598 | IWL_INFO(priv, "Detected %s, REV=0x%X\n", |
1625 | cfg(priv)->name, trans(priv)->hw_rev); | 1599 | priv->cfg->name, priv->trans->hw_rev); |
1626 | 1600 | ||
1627 | if (iwl_trans_start_hw(trans(priv))) | 1601 | if (iwl_trans_start_hw(priv->trans)) |
1628 | goto out_free_traffic_mem; | 1602 | goto out_free_hw; |
1629 | 1603 | ||
1630 | /* Read the EEPROM */ | 1604 | /* Read the EEPROM */ |
1631 | if (iwl_eeprom_init(priv, trans(priv)->hw_rev)) { | 1605 | if (iwl_eeprom_init(priv, priv->trans->hw_rev)) { |
1632 | IWL_ERR(priv, "Unable to init EEPROM\n"); | 1606 | IWL_ERR(priv, "Unable to init EEPROM\n"); |
1633 | goto out_free_traffic_mem; | 1607 | goto out_free_hw; |
1634 | } | 1608 | } |
1635 | /* Reset chip to save power until we load uCode during "up". */ | 1609 | /* Reset chip to save power until we load uCode during "up". */ |
1636 | iwl_trans_stop_hw(trans(priv)); | 1610 | iwl_trans_stop_hw(priv->trans, false); |
1637 | 1611 | ||
1638 | if (iwl_eeprom_check_version(priv)) | 1612 | if (iwl_eeprom_check_version(priv)) |
1639 | goto out_free_eeprom; | 1613 | goto out_free_eeprom; |
@@ -1672,24 +1646,21 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1672 | trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo; | 1646 | trans_cfg.queue_to_fifo = iwlagn_default_queue_to_tx_fifo; |
1673 | trans_cfg.n_queue_to_fifo = | 1647 | trans_cfg.n_queue_to_fifo = |
1674 | ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); | 1648 | ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); |
1675 | q_to_ac = iwlagn_bss_queue_to_ac; | ||
1676 | n_q_to_ac = ARRAY_SIZE(iwlagn_bss_queue_to_ac); | ||
1677 | 1649 | ||
1678 | /* Configure transport layer again*/ | 1650 | /* Configure transport layer again*/ |
1679 | iwl_trans_configure(trans(priv), &trans_cfg); | 1651 | iwl_trans_configure(priv->trans, &trans_cfg); |
1680 | } | 1652 | } |
1681 | 1653 | ||
1682 | /******************* | 1654 | /******************* |
1683 | * 5. Setup priv | 1655 | * 5. Setup priv |
1684 | *******************/ | 1656 | *******************/ |
1685 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
1686 | atomic_set(&priv->ac_stop_count[i], 0); | ||
1687 | |||
1688 | for (i = 0; i < IWL_MAX_HW_QUEUES; i++) { | 1657 | for (i = 0; i < IWL_MAX_HW_QUEUES; i++) { |
1689 | if (i < n_q_to_ac) | 1658 | priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; |
1690 | priv->queue_to_ac[i] = q_to_ac[i]; | 1659 | if (i < IWLAGN_FIRST_AMPDU_QUEUE && |
1691 | else | 1660 | i != IWL_DEFAULT_CMD_QUEUE_NUM && |
1692 | priv->queue_to_ac[i] = IWL_INVALID_AC; | 1661 | i != IWL_IPAN_CMD_QUEUE_NUM) |
1662 | priv->queue_to_mac80211[i] = i; | ||
1663 | atomic_set(&priv->queue_stop_count[i], 0); | ||
1693 | } | 1664 | } |
1694 | 1665 | ||
1695 | WARN_ON(trans_cfg.queue_to_fifo[trans_cfg.cmd_queue] != | 1666 | WARN_ON(trans_cfg.queue_to_fifo[trans_cfg.cmd_queue] != |
@@ -1745,8 +1716,7 @@ out_destroy_workqueue: | |||
1745 | iwl_uninit_drv(priv); | 1716 | iwl_uninit_drv(priv); |
1746 | out_free_eeprom: | 1717 | out_free_eeprom: |
1747 | iwl_eeprom_free(priv); | 1718 | iwl_eeprom_free(priv); |
1748 | out_free_traffic_mem: | 1719 | out_free_hw: |
1749 | iwl_free_traffic_mem(priv); | ||
1750 | ieee80211_free_hw(priv->hw); | 1720 | ieee80211_free_hw(priv->hw); |
1751 | out: | 1721 | out: |
1752 | op_mode = NULL; | 1722 | op_mode = NULL; |
@@ -1768,7 +1738,7 @@ void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode) | |||
1768 | 1738 | ||
1769 | /*This will stop the queues, move the device to low power state */ | 1739 | /*This will stop the queues, move the device to low power state */ |
1770 | priv->ucode_loaded = false; | 1740 | priv->ucode_loaded = false; |
1771 | iwl_trans_stop_device(trans(priv)); | 1741 | iwl_trans_stop_device(priv->trans); |
1772 | 1742 | ||
1773 | iwl_eeprom_free(priv); | 1743 | iwl_eeprom_free(priv); |
1774 | 1744 | ||
@@ -1780,12 +1750,12 @@ void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode) | |||
1780 | * until now... */ | 1750 | * until now... */ |
1781 | destroy_workqueue(priv->workqueue); | 1751 | destroy_workqueue(priv->workqueue); |
1782 | priv->workqueue = NULL; | 1752 | priv->workqueue = NULL; |
1783 | iwl_free_traffic_mem(priv); | ||
1784 | 1753 | ||
1785 | iwl_uninit_drv(priv); | 1754 | iwl_uninit_drv(priv); |
1786 | 1755 | ||
1787 | dev_kfree_skb(priv->beacon_skb); | 1756 | dev_kfree_skb(priv->beacon_skb); |
1788 | 1757 | ||
1758 | iwl_trans_stop_hw(priv->trans, true); | ||
1789 | ieee80211_free_hw(priv->hw); | 1759 | ieee80211_free_hw(priv->hw); |
1790 | } | 1760 | } |
1791 | 1761 | ||
@@ -1860,7 +1830,7 @@ static const char *desc_lookup(u32 num) | |||
1860 | 1830 | ||
1861 | static void iwl_dump_nic_error_log(struct iwl_priv *priv) | 1831 | static void iwl_dump_nic_error_log(struct iwl_priv *priv) |
1862 | { | 1832 | { |
1863 | struct iwl_trans *trans = trans(priv); | 1833 | struct iwl_trans *trans = priv->trans; |
1864 | u32 base; | 1834 | u32 base; |
1865 | struct iwl_error_event_table table; | 1835 | struct iwl_error_event_table table; |
1866 | 1836 | ||
@@ -1950,7 +1920,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | |||
1950 | u32 ev, time, data; /* event log data */ | 1920 | u32 ev, time, data; /* event log data */ |
1951 | unsigned long reg_flags; | 1921 | unsigned long reg_flags; |
1952 | 1922 | ||
1953 | struct iwl_trans *trans = trans(priv); | 1923 | struct iwl_trans *trans = priv->trans; |
1954 | 1924 | ||
1955 | if (num_events == 0) | 1925 | if (num_events == 0) |
1956 | return pos; | 1926 | return pos; |
@@ -2068,7 +2038,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
2068 | u32 logsize; | 2038 | u32 logsize; |
2069 | int pos = 0; | 2039 | int pos = 0; |
2070 | size_t bufsz = 0; | 2040 | size_t bufsz = 0; |
2071 | struct iwl_trans *trans = trans(priv); | 2041 | struct iwl_trans *trans = priv->trans; |
2072 | 2042 | ||
2073 | base = priv->device_pointers.log_event_table; | 2043 | base = priv->device_pointers.log_event_table; |
2074 | if (priv->cur_ucode == IWL_UCODE_INIT) { | 2044 | if (priv->cur_ucode == IWL_UCODE_INIT) { |
@@ -2184,7 +2154,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) | |||
2184 | * commands by clearing the ready bit */ | 2154 | * commands by clearing the ready bit */ |
2185 | clear_bit(STATUS_READY, &priv->status); | 2155 | clear_bit(STATUS_READY, &priv->status); |
2186 | 2156 | ||
2187 | wake_up(&trans(priv)->wait_command_queue); | 2157 | wake_up(&priv->trans->wait_command_queue); |
2188 | 2158 | ||
2189 | if (!ondemand) { | 2159 | if (!ondemand) { |
2190 | /* | 2160 | /* |
@@ -2208,7 +2178,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) | |||
2208 | } | 2178 | } |
2209 | 2179 | ||
2210 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 2180 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { |
2211 | if (iwlagn_mod_params.restart_fw) { | 2181 | if (iwlwifi_mod_params.restart_fw) { |
2212 | IWL_DEBUG_FW_ERRORS(priv, | 2182 | IWL_DEBUG_FW_ERRORS(priv, |
2213 | "Restarting adapter due to uCode error.\n"); | 2183 | "Restarting adapter due to uCode error.\n"); |
2214 | queue_work(priv->workqueue, &priv->restart); | 2184 | queue_work(priv->workqueue, &priv->restart); |
@@ -2259,56 +2229,56 @@ static void iwl_wimax_active(struct iwl_op_mode *op_mode) | |||
2259 | void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, int queue) | 2229 | void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, int queue) |
2260 | { | 2230 | { |
2261 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); | 2231 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); |
2262 | int ac = priv->queue_to_ac[queue]; | 2232 | int mq = priv->queue_to_mac80211[queue]; |
2263 | 2233 | ||
2264 | if (WARN_ON_ONCE(ac == IWL_INVALID_AC)) | 2234 | if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE)) |
2265 | return; | 2235 | return; |
2266 | 2236 | ||
2267 | if (atomic_inc_return(&priv->ac_stop_count[ac]) > 1) { | 2237 | if (atomic_inc_return(&priv->queue_stop_count[mq]) > 1) { |
2268 | IWL_DEBUG_TX_QUEUES(priv, | 2238 | IWL_DEBUG_TX_QUEUES(priv, |
2269 | "queue %d (AC %d) already stopped\n", | 2239 | "queue %d (mac80211 %d) already stopped\n", |
2270 | queue, ac); | 2240 | queue, mq); |
2271 | return; | 2241 | return; |
2272 | } | 2242 | } |
2273 | 2243 | ||
2274 | set_bit(ac, &priv->transport_queue_stop); | 2244 | set_bit(mq, &priv->transport_queue_stop); |
2275 | ieee80211_stop_queue(priv->hw, ac); | 2245 | ieee80211_stop_queue(priv->hw, mq); |
2276 | } | 2246 | } |
2277 | 2247 | ||
2278 | void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, int queue) | 2248 | void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, int queue) |
2279 | { | 2249 | { |
2280 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); | 2250 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); |
2281 | int ac = priv->queue_to_ac[queue]; | 2251 | int mq = priv->queue_to_mac80211[queue]; |
2282 | 2252 | ||
2283 | if (WARN_ON_ONCE(ac == IWL_INVALID_AC)) | 2253 | if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE)) |
2284 | return; | 2254 | return; |
2285 | 2255 | ||
2286 | if (atomic_dec_return(&priv->ac_stop_count[ac]) > 0) { | 2256 | if (atomic_dec_return(&priv->queue_stop_count[mq]) > 0) { |
2287 | IWL_DEBUG_TX_QUEUES(priv, | 2257 | IWL_DEBUG_TX_QUEUES(priv, |
2288 | "queue %d (AC %d) already awake\n", | 2258 | "queue %d (mac80211 %d) already awake\n", |
2289 | queue, ac); | 2259 | queue, mq); |
2290 | return; | 2260 | return; |
2291 | } | 2261 | } |
2292 | 2262 | ||
2293 | clear_bit(ac, &priv->transport_queue_stop); | 2263 | clear_bit(mq, &priv->transport_queue_stop); |
2294 | 2264 | ||
2295 | if (!priv->passive_no_rx) | 2265 | if (!priv->passive_no_rx) |
2296 | ieee80211_wake_queue(priv->hw, ac); | 2266 | ieee80211_wake_queue(priv->hw, mq); |
2297 | } | 2267 | } |
2298 | 2268 | ||
2299 | void iwlagn_lift_passive_no_rx(struct iwl_priv *priv) | 2269 | void iwlagn_lift_passive_no_rx(struct iwl_priv *priv) |
2300 | { | 2270 | { |
2301 | int ac; | 2271 | int mq; |
2302 | 2272 | ||
2303 | if (!priv->passive_no_rx) | 2273 | if (!priv->passive_no_rx) |
2304 | return; | 2274 | return; |
2305 | 2275 | ||
2306 | for (ac = IEEE80211_AC_VO; ac < IEEE80211_NUM_ACS; ac++) { | 2276 | for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) { |
2307 | if (!test_bit(ac, &priv->transport_queue_stop)) { | 2277 | if (!test_bit(mq, &priv->transport_queue_stop)) { |
2308 | IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d"); | 2278 | IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d", mq); |
2309 | ieee80211_wake_queue(priv->hw, ac); | 2279 | ieee80211_wake_queue(priv->hw, mq); |
2310 | } else { | 2280 | } else { |
2311 | IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d"); | 2281 | IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d", mq); |
2312 | } | 2282 | } |
2313 | } | 2283 | } |
2314 | 2284 | ||
@@ -2398,77 +2368,3 @@ static void __exit iwl_exit(void) | |||
2398 | 2368 | ||
2399 | module_exit(iwl_exit); | 2369 | module_exit(iwl_exit); |
2400 | module_init(iwl_init); | 2370 | module_init(iwl_init); |
2401 | |||
2402 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
2403 | module_param_named(debug, iwlagn_mod_params.debug_level, uint, | ||
2404 | S_IRUGO | S_IWUSR); | ||
2405 | MODULE_PARM_DESC(debug, "debug output mask"); | ||
2406 | #endif | ||
2407 | |||
2408 | module_param_named(swcrypto, iwlagn_mod_params.sw_crypto, int, S_IRUGO); | ||
2409 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); | ||
2410 | module_param_named(11n_disable, iwlagn_mod_params.disable_11n, uint, S_IRUGO); | ||
2411 | MODULE_PARM_DESC(11n_disable, | ||
2412 | "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); | ||
2413 | module_param_named(amsdu_size_8K, iwlagn_mod_params.amsdu_size_8K, | ||
2414 | int, S_IRUGO); | ||
2415 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); | ||
2416 | module_param_named(fw_restart, iwlagn_mod_params.restart_fw, int, S_IRUGO); | ||
2417 | MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); | ||
2418 | |||
2419 | module_param_named(antenna_coupling, iwlagn_mod_params.ant_coupling, | ||
2420 | int, S_IRUGO); | ||
2421 | MODULE_PARM_DESC(antenna_coupling, | ||
2422 | "specify antenna coupling in dB (defualt: 0 dB)"); | ||
2423 | |||
2424 | module_param_named(bt_ch_inhibition, iwlagn_mod_params.bt_ch_announce, | ||
2425 | bool, S_IRUGO); | ||
2426 | MODULE_PARM_DESC(bt_ch_inhibition, | ||
2427 | "Enable BT channel inhibition (default: enable)"); | ||
2428 | |||
2429 | module_param_named(plcp_check, iwlagn_mod_params.plcp_check, bool, S_IRUGO); | ||
2430 | MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])"); | ||
2431 | |||
2432 | module_param_named(wd_disable, iwlagn_mod_params.wd_disable, int, S_IRUGO); | ||
2433 | MODULE_PARM_DESC(wd_disable, | ||
2434 | "Disable stuck queue watchdog timer 0=system default, " | ||
2435 | "1=disable, 2=enable (default: 0)"); | ||
2436 | |||
2437 | /* | ||
2438 | * set bt_coex_active to true, uCode will do kill/defer | ||
2439 | * every time the priority line is asserted (BT is sending signals on the | ||
2440 | * priority line in the PCIx). | ||
2441 | * set bt_coex_active to false, uCode will ignore the BT activity and | ||
2442 | * perform the normal operation | ||
2443 | * | ||
2444 | * User might experience transmit issue on some platform due to WiFi/BT | ||
2445 | * co-exist problem. The possible behaviors are: | ||
2446 | * Able to scan and finding all the available AP | ||
2447 | * Not able to associate with any AP | ||
2448 | * On those platforms, WiFi communication can be restored by set | ||
2449 | * "bt_coex_active" module parameter to "false" | ||
2450 | * | ||
2451 | * default: bt_coex_active = true (BT_COEX_ENABLE) | ||
2452 | */ | ||
2453 | module_param_named(bt_coex_active, iwlagn_mod_params.bt_coex_active, | ||
2454 | bool, S_IRUGO); | ||
2455 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)"); | ||
2456 | |||
2457 | module_param_named(led_mode, iwlagn_mod_params.led_mode, int, S_IRUGO); | ||
2458 | MODULE_PARM_DESC(led_mode, "0=system default, " | ||
2459 | "1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)"); | ||
2460 | |||
2461 | module_param_named(power_save, iwlagn_mod_params.power_save, | ||
2462 | bool, S_IRUGO); | ||
2463 | MODULE_PARM_DESC(power_save, | ||
2464 | "enable WiFi power management (default: disable)"); | ||
2465 | |||
2466 | module_param_named(power_level, iwlagn_mod_params.power_level, | ||
2467 | int, S_IRUGO); | ||
2468 | MODULE_PARM_DESC(power_level, | ||
2469 | "default power save level (range from 1 - 5, default: 1)"); | ||
2470 | |||
2471 | module_param_named(auto_agg, iwlagn_mod_params.auto_agg, | ||
2472 | bool, S_IRUGO); | ||
2473 | MODULE_PARM_DESC(auto_agg, | ||
2474 | "enable agg w/o check traffic load (default: enable)"); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index 942b3649fff1..34900e6523dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -64,6 +64,7 @@ | |||
64 | #define __iwl_agn_h__ | 64 | #define __iwl_agn_h__ |
65 | 65 | ||
66 | #include "iwl-dev.h" | 66 | #include "iwl-dev.h" |
67 | #include "iwl-config.h" | ||
67 | 68 | ||
68 | /* The first 11 queues (0-10) are used otherwise */ | 69 | /* The first 11 queues (0-10) are used otherwise */ |
69 | #define IWLAGN_FIRST_AMPDU_QUEUE 11 | 70 | #define IWLAGN_FIRST_AMPDU_QUEUE 11 |
@@ -81,6 +82,7 @@ extern struct iwl_lib_ops iwl6000_lib; | |||
81 | extern struct iwl_lib_ops iwl6030_lib; | 82 | extern struct iwl_lib_ops iwl6030_lib; |
82 | 83 | ||
83 | 84 | ||
85 | #define TIME_UNIT 1024 | ||
84 | 86 | ||
85 | /***************************************************** | 87 | /***************************************************** |
86 | * DRIVER STATUS FUNCTIONS | 88 | * DRIVER STATUS FUNCTIONS |
@@ -154,7 +156,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
154 | struct iwl_rxon_context *ctx, | 156 | struct iwl_rxon_context *ctx, |
155 | enum ieee80211_band band, | 157 | enum ieee80211_band band, |
156 | struct ieee80211_vif *vif); | 158 | struct ieee80211_vif *vif); |
157 | void iwl_set_rate(struct iwl_priv *priv); | ||
158 | 159 | ||
159 | /* uCode */ | 160 | /* uCode */ |
160 | int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type); | 161 | int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type); |
@@ -279,8 +280,8 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena); | |||
279 | 280 | ||
280 | static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) | 281 | static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) |
281 | { | 282 | { |
282 | return cfg(priv)->bt_params && | 283 | return priv->cfg->bt_params && |
283 | cfg(priv)->bt_params->advanced_bt_coexist; | 284 | priv->cfg->bt_params->advanced_bt_coexist; |
284 | } | 285 | } |
285 | 286 | ||
286 | #ifdef CONFIG_IWLWIFI_DEBUG | 287 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -472,16 +473,29 @@ static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state) | |||
472 | set_bit(STATUS_POWER_PMI, &priv->status); | 473 | set_bit(STATUS_POWER_PMI, &priv->status); |
473 | else | 474 | else |
474 | clear_bit(STATUS_POWER_PMI, &priv->status); | 475 | clear_bit(STATUS_POWER_PMI, &priv->status); |
475 | iwl_trans_set_pmi(trans(priv), state); | 476 | iwl_trans_set_pmi(priv->trans, state); |
476 | } | 477 | } |
477 | 478 | ||
479 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
480 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); | ||
481 | void iwl_dbgfs_unregister(struct iwl_priv *priv); | ||
482 | #else | ||
483 | static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | ||
484 | { | ||
485 | return 0; | ||
486 | } | ||
487 | static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | ||
488 | { | ||
489 | } | ||
490 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | ||
491 | |||
478 | #ifdef CONFIG_IWLWIFI_DEBUG | 492 | #ifdef CONFIG_IWLWIFI_DEBUG |
479 | #define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ | 493 | #define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ |
480 | do { \ | 494 | do { \ |
481 | if (!iwl_is_rfkill((m))) \ | 495 | if (!iwl_is_rfkill((m))) \ |
482 | IWL_ERR(m, fmt, ##args); \ | 496 | IWL_ERR(m, fmt, ##args); \ |
483 | else \ | 497 | else \ |
484 | __iwl_err(trans(m)->dev, true, \ | 498 | __iwl_err((m)->dev, true, \ |
485 | !iwl_have_debug_level(IWL_DL_RADIO), \ | 499 | !iwl_have_debug_level(IWL_DL_RADIO), \ |
486 | fmt, ##args); \ | 500 | fmt, ##args); \ |
487 | } while (0) | 501 | } while (0) |
@@ -491,7 +505,7 @@ do { \ | |||
491 | if (!iwl_is_rfkill((m))) \ | 505 | if (!iwl_is_rfkill((m))) \ |
492 | IWL_ERR(m, fmt, ##args); \ | 506 | IWL_ERR(m, fmt, ##args); \ |
493 | else \ | 507 | else \ |
494 | __iwl_err(trans(m)->dev, true, true, fmt, ##args); \ | 508 | __iwl_err((m)->dev, true, true, fmt, ##args); \ |
495 | } while (0) | 509 | } while (0) |
496 | #endif /* CONFIG_IWLWIFI_DEBUG */ | 510 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
497 | 511 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 47bfd5e59575..67b28aa7f9be 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -102,6 +102,34 @@ enum iwl_led_mode { | |||
102 | }; | 102 | }; |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * This is the threshold value of plcp error rate per 100mSecs. It is | ||
106 | * used to set and check for the validity of plcp_delta. | ||
107 | */ | ||
108 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN 1 | ||
109 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF 50 | ||
110 | #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF 100 | ||
111 | #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF 200 | ||
112 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX 255 | ||
113 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE 0 | ||
114 | |||
115 | /* TX queue watchdog timeouts in mSecs */ | ||
116 | #define IWL_WATCHHDOG_DISABLED 0 | ||
117 | #define IWL_DEF_WD_TIMEOUT 2000 | ||
118 | #define IWL_LONG_WD_TIMEOUT 10000 | ||
119 | #define IWL_MAX_WD_TIMEOUT 120000 | ||
120 | |||
121 | /* Antenna presence definitions */ | ||
122 | #define ANT_NONE 0x0 | ||
123 | #define ANT_A BIT(0) | ||
124 | #define ANT_B BIT(1) | ||
125 | #define ANT_C BIT(2) | ||
126 | #define ANT_AB (ANT_A | ANT_B) | ||
127 | #define ANT_AC (ANT_A | ANT_C) | ||
128 | #define ANT_BC (ANT_B | ANT_C) | ||
129 | #define ANT_ABC (ANT_A | ANT_B | ANT_C) | ||
130 | |||
131 | |||
132 | /* | ||
105 | * @max_ll_items: max number of OTP blocks | 133 | * @max_ll_items: max number of OTP blocks |
106 | * @shadow_ram_support: shadow support for OTP memory | 134 | * @shadow_ram_support: shadow support for OTP memory |
107 | * @led_compensation: compensate on the led on/off time per HW according | 135 | * @led_compensation: compensate on the led on/off time per HW according |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c deleted file mode 100644 index d7a8cde249ff..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ /dev/null | |||
@@ -1,297 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * GPL LICENSE SUMMARY | ||
4 | * | ||
5 | * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of version 2 of the GNU General Public License as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
19 | * USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution | ||
22 | * in the file called LICENSE.GPL. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/sched.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <net/mac80211.h> | ||
34 | |||
35 | #include "iwl-eeprom.h" | ||
36 | #include "iwl-debug.h" | ||
37 | #include "iwl-core.h" | ||
38 | #include "iwl-io.h" | ||
39 | #include "iwl-power.h" | ||
40 | #include "iwl-shared.h" | ||
41 | #include "iwl-agn.h" | ||
42 | #include "iwl-trans.h" | ||
43 | |||
44 | |||
45 | |||
46 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
47 | |||
48 | #define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) | ||
49 | |||
50 | void iwl_reset_traffic_log(struct iwl_priv *priv) | ||
51 | { | ||
52 | priv->tx_traffic_idx = 0; | ||
53 | priv->rx_traffic_idx = 0; | ||
54 | if (priv->tx_traffic) | ||
55 | memset(priv->tx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE); | ||
56 | if (priv->rx_traffic) | ||
57 | memset(priv->rx_traffic, 0, IWL_TRAFFIC_DUMP_SIZE); | ||
58 | } | ||
59 | |||
60 | int iwl_alloc_traffic_mem(struct iwl_priv *priv) | ||
61 | { | ||
62 | u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE; | ||
63 | |||
64 | if (iwl_have_debug_level(IWL_DL_TX)) { | ||
65 | if (!priv->tx_traffic) { | ||
66 | priv->tx_traffic = | ||
67 | kzalloc(traffic_size, GFP_KERNEL); | ||
68 | if (!priv->tx_traffic) | ||
69 | return -ENOMEM; | ||
70 | } | ||
71 | } | ||
72 | if (iwl_have_debug_level(IWL_DL_RX)) { | ||
73 | if (!priv->rx_traffic) { | ||
74 | priv->rx_traffic = | ||
75 | kzalloc(traffic_size, GFP_KERNEL); | ||
76 | if (!priv->rx_traffic) | ||
77 | return -ENOMEM; | ||
78 | } | ||
79 | } | ||
80 | iwl_reset_traffic_log(priv); | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | void iwl_free_traffic_mem(struct iwl_priv *priv) | ||
85 | { | ||
86 | kfree(priv->tx_traffic); | ||
87 | priv->tx_traffic = NULL; | ||
88 | |||
89 | kfree(priv->rx_traffic); | ||
90 | priv->rx_traffic = NULL; | ||
91 | } | ||
92 | |||
93 | void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv, | ||
94 | u16 length, struct ieee80211_hdr *header) | ||
95 | { | ||
96 | __le16 fc; | ||
97 | u16 len; | ||
98 | |||
99 | if (likely(!iwl_have_debug_level(IWL_DL_TX))) | ||
100 | return; | ||
101 | |||
102 | if (!priv->tx_traffic) | ||
103 | return; | ||
104 | |||
105 | fc = header->frame_control; | ||
106 | if (ieee80211_is_data(fc)) { | ||
107 | len = (length > IWL_TRAFFIC_ENTRY_SIZE) | ||
108 | ? IWL_TRAFFIC_ENTRY_SIZE : length; | ||
109 | memcpy((priv->tx_traffic + | ||
110 | (priv->tx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)), | ||
111 | header, len); | ||
112 | priv->tx_traffic_idx = | ||
113 | (priv->tx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, | ||
118 | u16 length, struct ieee80211_hdr *header) | ||
119 | { | ||
120 | __le16 fc; | ||
121 | u16 len; | ||
122 | |||
123 | if (likely(!iwl_have_debug_level(IWL_DL_RX))) | ||
124 | return; | ||
125 | |||
126 | if (!priv->rx_traffic) | ||
127 | return; | ||
128 | |||
129 | fc = header->frame_control; | ||
130 | if (ieee80211_is_data(fc)) { | ||
131 | len = (length > IWL_TRAFFIC_ENTRY_SIZE) | ||
132 | ? IWL_TRAFFIC_ENTRY_SIZE : length; | ||
133 | memcpy((priv->rx_traffic + | ||
134 | (priv->rx_traffic_idx * IWL_TRAFFIC_ENTRY_SIZE)), | ||
135 | header, len); | ||
136 | priv->rx_traffic_idx = | ||
137 | (priv->rx_traffic_idx + 1) % IWL_TRAFFIC_ENTRIES; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | const char *get_mgmt_string(int cmd) | ||
142 | { | ||
143 | #define IWL_CMD(x) case x: return #x | ||
144 | switch (cmd) { | ||
145 | IWL_CMD(MANAGEMENT_ASSOC_REQ); | ||
146 | IWL_CMD(MANAGEMENT_ASSOC_RESP); | ||
147 | IWL_CMD(MANAGEMENT_REASSOC_REQ); | ||
148 | IWL_CMD(MANAGEMENT_REASSOC_RESP); | ||
149 | IWL_CMD(MANAGEMENT_PROBE_REQ); | ||
150 | IWL_CMD(MANAGEMENT_PROBE_RESP); | ||
151 | IWL_CMD(MANAGEMENT_BEACON); | ||
152 | IWL_CMD(MANAGEMENT_ATIM); | ||
153 | IWL_CMD(MANAGEMENT_DISASSOC); | ||
154 | IWL_CMD(MANAGEMENT_AUTH); | ||
155 | IWL_CMD(MANAGEMENT_DEAUTH); | ||
156 | IWL_CMD(MANAGEMENT_ACTION); | ||
157 | default: | ||
158 | return "UNKNOWN"; | ||
159 | |||
160 | } | ||
161 | #undef IWL_CMD | ||
162 | } | ||
163 | |||
164 | const char *get_ctrl_string(int cmd) | ||
165 | { | ||
166 | #define IWL_CMD(x) case x: return #x | ||
167 | switch (cmd) { | ||
168 | IWL_CMD(CONTROL_BACK_REQ); | ||
169 | IWL_CMD(CONTROL_BACK); | ||
170 | IWL_CMD(CONTROL_PSPOLL); | ||
171 | IWL_CMD(CONTROL_RTS); | ||
172 | IWL_CMD(CONTROL_CTS); | ||
173 | IWL_CMD(CONTROL_ACK); | ||
174 | IWL_CMD(CONTROL_CFEND); | ||
175 | IWL_CMD(CONTROL_CFENDACK); | ||
176 | default: | ||
177 | return "UNKNOWN"; | ||
178 | |||
179 | } | ||
180 | #undef IWL_CMD | ||
181 | } | ||
182 | |||
183 | void iwl_clear_traffic_stats(struct iwl_priv *priv) | ||
184 | { | ||
185 | memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); | ||
186 | memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * if CONFIG_IWLWIFI_DEBUGFS defined, iwl_update_stats function will | ||
191 | * record all the MGMT, CTRL and DATA pkt for both TX and Rx pass. | ||
192 | * Use debugFs to display the rx/rx_statistics | ||
193 | * if CONFIG_IWLWIFI_DEBUGFS not being defined, then no MGMT and CTRL | ||
194 | * information will be recorded, but DATA pkt still will be recorded | ||
195 | * for the reason of iwl_led.c need to control the led blinking based on | ||
196 | * number of tx and rx data. | ||
197 | * | ||
198 | */ | ||
199 | void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len) | ||
200 | { | ||
201 | struct traffic_stats *stats; | ||
202 | |||
203 | if (is_tx) | ||
204 | stats = &priv->tx_stats; | ||
205 | else | ||
206 | stats = &priv->rx_stats; | ||
207 | |||
208 | if (ieee80211_is_mgmt(fc)) { | ||
209 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | ||
210 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ): | ||
211 | stats->mgmt[MANAGEMENT_ASSOC_REQ]++; | ||
212 | break; | ||
213 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): | ||
214 | stats->mgmt[MANAGEMENT_ASSOC_RESP]++; | ||
215 | break; | ||
216 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ): | ||
217 | stats->mgmt[MANAGEMENT_REASSOC_REQ]++; | ||
218 | break; | ||
219 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): | ||
220 | stats->mgmt[MANAGEMENT_REASSOC_RESP]++; | ||
221 | break; | ||
222 | case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ): | ||
223 | stats->mgmt[MANAGEMENT_PROBE_REQ]++; | ||
224 | break; | ||
225 | case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): | ||
226 | stats->mgmt[MANAGEMENT_PROBE_RESP]++; | ||
227 | break; | ||
228 | case cpu_to_le16(IEEE80211_STYPE_BEACON): | ||
229 | stats->mgmt[MANAGEMENT_BEACON]++; | ||
230 | break; | ||
231 | case cpu_to_le16(IEEE80211_STYPE_ATIM): | ||
232 | stats->mgmt[MANAGEMENT_ATIM]++; | ||
233 | break; | ||
234 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): | ||
235 | stats->mgmt[MANAGEMENT_DISASSOC]++; | ||
236 | break; | ||
237 | case cpu_to_le16(IEEE80211_STYPE_AUTH): | ||
238 | stats->mgmt[MANAGEMENT_AUTH]++; | ||
239 | break; | ||
240 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | ||
241 | stats->mgmt[MANAGEMENT_DEAUTH]++; | ||
242 | break; | ||
243 | case cpu_to_le16(IEEE80211_STYPE_ACTION): | ||
244 | stats->mgmt[MANAGEMENT_ACTION]++; | ||
245 | break; | ||
246 | } | ||
247 | } else if (ieee80211_is_ctl(fc)) { | ||
248 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | ||
249 | case cpu_to_le16(IEEE80211_STYPE_BACK_REQ): | ||
250 | stats->ctrl[CONTROL_BACK_REQ]++; | ||
251 | break; | ||
252 | case cpu_to_le16(IEEE80211_STYPE_BACK): | ||
253 | stats->ctrl[CONTROL_BACK]++; | ||
254 | break; | ||
255 | case cpu_to_le16(IEEE80211_STYPE_PSPOLL): | ||
256 | stats->ctrl[CONTROL_PSPOLL]++; | ||
257 | break; | ||
258 | case cpu_to_le16(IEEE80211_STYPE_RTS): | ||
259 | stats->ctrl[CONTROL_RTS]++; | ||
260 | break; | ||
261 | case cpu_to_le16(IEEE80211_STYPE_CTS): | ||
262 | stats->ctrl[CONTROL_CTS]++; | ||
263 | break; | ||
264 | case cpu_to_le16(IEEE80211_STYPE_ACK): | ||
265 | stats->ctrl[CONTROL_ACK]++; | ||
266 | break; | ||
267 | case cpu_to_le16(IEEE80211_STYPE_CFEND): | ||
268 | stats->ctrl[CONTROL_CFEND]++; | ||
269 | break; | ||
270 | case cpu_to_le16(IEEE80211_STYPE_CFENDACK): | ||
271 | stats->ctrl[CONTROL_CFENDACK]++; | ||
272 | break; | ||
273 | } | ||
274 | } else { | ||
275 | /* data */ | ||
276 | stats->data_cnt++; | ||
277 | stats->data_bytes += len; | ||
278 | } | ||
279 | } | ||
280 | #endif | ||
281 | |||
282 | int iwl_cmd_echo_test(struct iwl_priv *priv) | ||
283 | { | ||
284 | int ret; | ||
285 | struct iwl_host_cmd cmd = { | ||
286 | .id = REPLY_ECHO, | ||
287 | .len = { 0 }, | ||
288 | .flags = CMD_SYNC, | ||
289 | }; | ||
290 | |||
291 | ret = iwl_dvm_send_cmd(priv, &cmd); | ||
292 | if (ret) | ||
293 | IWL_ERR(priv, "echo testing fail: 0X%x\n", ret); | ||
294 | else | ||
295 | IWL_DEBUG_INFO(priv, "echo testing pass\n"); | ||
296 | return ret; | ||
297 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h deleted file mode 100644 index 199a0c03774c..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ /dev/null | |||
@@ -1,133 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
22 | * USA | ||
23 | * | ||
24 | * The full GNU General Public License is included in this distribution | ||
25 | * in the file called LICENSE.GPL. | ||
26 | * | ||
27 | * Contact Information: | ||
28 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
30 | * | ||
31 | * BSD LICENSE | ||
32 | * | ||
33 | * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved. | ||
34 | * All rights reserved. | ||
35 | * | ||
36 | * Redistribution and use in source and binary forms, with or without | ||
37 | * modification, are permitted provided that the following conditions | ||
38 | * are met: | ||
39 | * | ||
40 | * * Redistributions of source code must retain the above copyright | ||
41 | * notice, this list of conditions and the following disclaimer. | ||
42 | * * Redistributions in binary form must reproduce the above copyright | ||
43 | * notice, this list of conditions and the following disclaimer in | ||
44 | * the documentation and/or other materials provided with the | ||
45 | * distribution. | ||
46 | * * Neither the name Intel Corporation nor the names of its | ||
47 | * contributors may be used to endorse or promote products derived | ||
48 | * from this software without specific prior written permission. | ||
49 | * | ||
50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
61 | *****************************************************************************/ | ||
62 | |||
63 | #ifndef __iwl_core_h__ | ||
64 | #define __iwl_core_h__ | ||
65 | |||
66 | #include "iwl-dev.h" | ||
67 | #include "iwl-io.h" | ||
68 | |||
69 | /************************ | ||
70 | * forward declarations * | ||
71 | ************************/ | ||
72 | struct iwl_host_cmd; | ||
73 | struct iwl_cmd; | ||
74 | |||
75 | #define TIME_UNIT 1024 | ||
76 | |||
77 | /*************************** | ||
78 | * L i b * | ||
79 | ***************************/ | ||
80 | |||
81 | int iwl_cmd_echo_test(struct iwl_priv *priv); | ||
82 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
83 | int iwl_alloc_traffic_mem(struct iwl_priv *priv); | ||
84 | void iwl_free_traffic_mem(struct iwl_priv *priv); | ||
85 | void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv, | ||
86 | u16 length, struct ieee80211_hdr *header); | ||
87 | void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, | ||
88 | u16 length, struct ieee80211_hdr *header); | ||
89 | const char *get_mgmt_string(int cmd); | ||
90 | const char *get_ctrl_string(int cmd); | ||
91 | void iwl_clear_traffic_stats(struct iwl_priv *priv); | ||
92 | void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, | ||
93 | u16 len); | ||
94 | void iwl_reset_traffic_log(struct iwl_priv *priv); | ||
95 | |||
96 | #else | ||
97 | static inline int iwl_alloc_traffic_mem(struct iwl_priv *priv) | ||
98 | { | ||
99 | return 0; | ||
100 | } | ||
101 | static inline void iwl_free_traffic_mem(struct iwl_priv *priv) | ||
102 | { | ||
103 | } | ||
104 | static inline void iwl_reset_traffic_log(struct iwl_priv *priv) | ||
105 | { | ||
106 | } | ||
107 | static inline void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv, | ||
108 | u16 length, struct ieee80211_hdr *header) | ||
109 | { | ||
110 | } | ||
111 | static inline void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, | ||
112 | u16 length, struct ieee80211_hdr *header) | ||
113 | { | ||
114 | } | ||
115 | static inline void iwl_update_stats(struct iwl_priv *priv, bool is_tx, | ||
116 | __le16 fc, u16 len) | ||
117 | { | ||
118 | } | ||
119 | #endif | ||
120 | |||
121 | /******************************************************************************* | ||
122 | * Scanning | ||
123 | ******************************************************************************/ | ||
124 | /* traffic log definitions */ | ||
125 | #define IWL_TRAFFIC_ENTRIES (256) | ||
126 | #define IWL_TRAFFIC_ENTRY_SIZE (64) | ||
127 | |||
128 | /***************************************************** | ||
129 | * S e n d i n g H o s t C o m m a n d s * | ||
130 | *****************************************************/ | ||
131 | extern bool bt_siso_mode; | ||
132 | |||
133 | #endif /* __iwl_core_h__ */ | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.c b/drivers/net/wireless/iwlwifi/iwl-debug.c index 059efabda184..2d1b42847b9b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.c +++ b/drivers/net/wireless/iwlwifi/iwl-debug.c | |||
@@ -63,6 +63,7 @@ | |||
63 | 63 | ||
64 | #include <linux/interrupt.h> | 64 | #include <linux/interrupt.h> |
65 | #include "iwl-debug.h" | 65 | #include "iwl-debug.h" |
66 | #include "iwl-devtrace.h" | ||
66 | 67 | ||
67 | #define __iwl_fn(fn) \ | 68 | #define __iwl_fn(fn) \ |
68 | void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ | 69 | void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index a6b32a11e103..8376b842bdba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -29,10 +29,13 @@ | |||
29 | #ifndef __iwl_debug_h__ | 29 | #ifndef __iwl_debug_h__ |
30 | #define __iwl_debug_h__ | 30 | #define __iwl_debug_h__ |
31 | 31 | ||
32 | #include "iwl-shared.h" | 32 | #include "iwl-modparams.h" |
33 | #include "iwl-devtrace.h" | ||
34 | 33 | ||
35 | struct iwl_priv; | 34 | |
35 | static inline bool iwl_have_debug_level(u32 level) | ||
36 | { | ||
37 | return iwlwifi_mod_params.debug_level & level; | ||
38 | } | ||
36 | 39 | ||
37 | void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, | 40 | void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, |
38 | const char *fmt, ...); | 41 | const char *fmt, ...); |
@@ -41,10 +44,10 @@ void __iwl_info(struct device *dev, const char *fmt, ...); | |||
41 | void __iwl_crit(struct device *dev, const char *fmt, ...); | 44 | void __iwl_crit(struct device *dev, const char *fmt, ...); |
42 | 45 | ||
43 | /* No matter what is m (priv, bus, trans), this will work */ | 46 | /* No matter what is m (priv, bus, trans), this will work */ |
44 | #define IWL_ERR(m, f, a...) __iwl_err(trans(m)->dev, false, false, f, ## a) | 47 | #define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a) |
45 | #define IWL_WARN(m, f, a...) __iwl_warn(trans(m)->dev, f, ## a) | 48 | #define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a) |
46 | #define IWL_INFO(m, f, a...) __iwl_info(trans(m)->dev, f, ## a) | 49 | #define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a) |
47 | #define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a) | 50 | #define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a) |
48 | 51 | ||
49 | #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) | 52 | #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) |
50 | void __iwl_dbg(struct device *dev, | 53 | void __iwl_dbg(struct device *dev, |
@@ -65,9 +68,9 @@ do { \ | |||
65 | } while (0) | 68 | } while (0) |
66 | 69 | ||
67 | #define IWL_DEBUG(m, level, fmt, args...) \ | 70 | #define IWL_DEBUG(m, level, fmt, args...) \ |
68 | __iwl_dbg(trans(m)->dev, level, false, __func__, fmt, ##args) | 71 | __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args) |
69 | #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ | 72 | #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ |
70 | __iwl_dbg(trans(m)->dev, level, true, __func__, fmt, ##args) | 73 | __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args) |
71 | 74 | ||
72 | #ifdef CONFIG_IWLWIFI_DEBUG | 75 | #ifdef CONFIG_IWLWIFI_DEBUG |
73 | #define iwl_print_hex_dump(m, level, p, len) \ | 76 | #define iwl_print_hex_dump(m, level, p, len) \ |
@@ -80,19 +83,6 @@ do { \ | |||
80 | #define iwl_print_hex_dump(m, level, p, len) | 83 | #define iwl_print_hex_dump(m, level, p, len) |
81 | #endif /* CONFIG_IWLWIFI_DEBUG */ | 84 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
82 | 85 | ||
83 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
84 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); | ||
85 | void iwl_dbgfs_unregister(struct iwl_priv *priv); | ||
86 | #else | ||
87 | static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | ||
88 | { | ||
89 | return 0; | ||
90 | } | ||
91 | static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | ||
92 | { | ||
93 | } | ||
94 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | ||
95 | |||
96 | /* | 86 | /* |
97 | * To use the debug system: | 87 | * To use the debug system: |
98 | * | 88 | * |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 32834a797d11..e7c157e5ebeb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -37,9 +37,9 @@ | |||
37 | 37 | ||
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-debug.h" | 39 | #include "iwl-debug.h" |
40 | #include "iwl-core.h" | ||
41 | #include "iwl-io.h" | 40 | #include "iwl-io.h" |
42 | #include "iwl-agn.h" | 41 | #include "iwl-agn.h" |
42 | #include "iwl-modparams.h" | ||
43 | 43 | ||
44 | /* create and remove of files */ | 44 | /* create and remove of files */ |
45 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 45 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
@@ -111,105 +111,6 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
111 | .llseek = generic_file_llseek, \ | 111 | .llseek = generic_file_llseek, \ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, | ||
115 | char __user *user_buf, | ||
116 | size_t count, loff_t *ppos) { | ||
117 | |||
118 | struct iwl_priv *priv = file->private_data; | ||
119 | char *buf; | ||
120 | int pos = 0; | ||
121 | |||
122 | int cnt; | ||
123 | ssize_t ret; | ||
124 | const size_t bufsz = 100 + | ||
125 | sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); | ||
126 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
127 | if (!buf) | ||
128 | return -ENOMEM; | ||
129 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); | ||
130 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { | ||
131 | pos += scnprintf(buf + pos, bufsz - pos, | ||
132 | "\t%25s\t\t: %u\n", | ||
133 | get_mgmt_string(cnt), | ||
134 | priv->tx_stats.mgmt[cnt]); | ||
135 | } | ||
136 | pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); | ||
137 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | ||
138 | pos += scnprintf(buf + pos, bufsz - pos, | ||
139 | "\t%25s\t\t: %u\n", | ||
140 | get_ctrl_string(cnt), | ||
141 | priv->tx_stats.ctrl[cnt]); | ||
142 | } | ||
143 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | ||
144 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | ||
145 | priv->tx_stats.data_cnt); | ||
146 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | ||
147 | priv->tx_stats.data_bytes); | ||
148 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
149 | kfree(buf); | ||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | static ssize_t iwl_dbgfs_clear_traffic_statistics_write(struct file *file, | ||
154 | const char __user *user_buf, | ||
155 | size_t count, loff_t *ppos) | ||
156 | { | ||
157 | struct iwl_priv *priv = file->private_data; | ||
158 | u32 clear_flag; | ||
159 | char buf[8]; | ||
160 | int buf_size; | ||
161 | |||
162 | memset(buf, 0, sizeof(buf)); | ||
163 | buf_size = min(count, sizeof(buf) - 1); | ||
164 | if (copy_from_user(buf, user_buf, buf_size)) | ||
165 | return -EFAULT; | ||
166 | if (sscanf(buf, "%x", &clear_flag) != 1) | ||
167 | return -EFAULT; | ||
168 | iwl_clear_traffic_stats(priv); | ||
169 | |||
170 | return count; | ||
171 | } | ||
172 | |||
173 | static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, | ||
174 | char __user *user_buf, | ||
175 | size_t count, loff_t *ppos) { | ||
176 | |||
177 | struct iwl_priv *priv = file->private_data; | ||
178 | char *buf; | ||
179 | int pos = 0; | ||
180 | int cnt; | ||
181 | ssize_t ret; | ||
182 | const size_t bufsz = 100 + | ||
183 | sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); | ||
184 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
185 | if (!buf) | ||
186 | return -ENOMEM; | ||
187 | |||
188 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); | ||
189 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { | ||
190 | pos += scnprintf(buf + pos, bufsz - pos, | ||
191 | "\t%25s\t\t: %u\n", | ||
192 | get_mgmt_string(cnt), | ||
193 | priv->rx_stats.mgmt[cnt]); | ||
194 | } | ||
195 | pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); | ||
196 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | ||
197 | pos += scnprintf(buf + pos, bufsz - pos, | ||
198 | "\t%25s\t\t: %u\n", | ||
199 | get_ctrl_string(cnt), | ||
200 | priv->rx_stats.ctrl[cnt]); | ||
201 | } | ||
202 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | ||
203 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | ||
204 | priv->rx_stats.data_cnt); | ||
205 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | ||
206 | priv->rx_stats.data_bytes); | ||
207 | |||
208 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
209 | kfree(buf); | ||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | static ssize_t iwl_dbgfs_sram_read(struct file *file, | 114 | static ssize_t iwl_dbgfs_sram_read(struct file *file, |
214 | char __user *user_buf, | 115 | char __user *user_buf, |
215 | size_t count, loff_t *ppos) | 116 | size_t count, loff_t *ppos) |
@@ -230,10 +131,8 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
230 | /* default is to dump the entire data segment */ | 131 | /* default is to dump the entire data segment */ |
231 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { | 132 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { |
232 | priv->dbgfs_sram_offset = 0x800000; | 133 | priv->dbgfs_sram_offset = 0x800000; |
233 | if (!priv->ucode_loaded) { | 134 | if (!priv->ucode_loaded) |
234 | IWL_ERR(priv, "No uCode has been loadded.\n"); | ||
235 | return -EINVAL; | 135 | return -EINVAL; |
236 | } | ||
237 | img = &priv->fw->img[priv->cur_ucode]; | 136 | img = &priv->fw->img[priv->cur_ucode]; |
238 | priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; | 137 | priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; |
239 | } | 138 | } |
@@ -259,7 +158,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
259 | sram = priv->dbgfs_sram_offset & ~0x3; | 158 | sram = priv->dbgfs_sram_offset & ~0x3; |
260 | 159 | ||
261 | /* read the first u32 from sram */ | 160 | /* read the first u32 from sram */ |
262 | val = iwl_read_targ_mem(trans(priv), sram); | 161 | val = iwl_read_targ_mem(priv->trans, sram); |
263 | 162 | ||
264 | for (; len; len--) { | 163 | for (; len; len--) { |
265 | /* put the address at the start of every line */ | 164 | /* put the address at the start of every line */ |
@@ -278,7 +177,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
278 | if (++offset == 4) { | 177 | if (++offset == 4) { |
279 | sram += 4; | 178 | sram += 4; |
280 | offset = 0; | 179 | offset = 0; |
281 | val = iwl_read_targ_mem(trans(priv), sram); | 180 | val = iwl_read_targ_mem(priv->trans, sram); |
282 | } | 181 | } |
283 | 182 | ||
284 | /* put in extra spaces and split lines for human readability */ | 183 | /* put in extra spaces and split lines for human readability */ |
@@ -408,26 +307,21 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, | |||
408 | const u8 *ptr; | 307 | const u8 *ptr; |
409 | char *buf; | 308 | char *buf; |
410 | u16 eeprom_ver; | 309 | u16 eeprom_ver; |
411 | size_t eeprom_len = cfg(priv)->base_params->eeprom_size; | 310 | size_t eeprom_len = priv->cfg->base_params->eeprom_size; |
412 | buf_size = 4 * eeprom_len + 256; | 311 | buf_size = 4 * eeprom_len + 256; |
413 | 312 | ||
414 | if (eeprom_len % 16) { | 313 | if (eeprom_len % 16) |
415 | IWL_ERR(priv, "NVM size is not multiple of 16.\n"); | ||
416 | return -ENODATA; | 314 | return -ENODATA; |
417 | } | ||
418 | 315 | ||
419 | ptr = priv->eeprom; | 316 | ptr = priv->eeprom; |
420 | if (!ptr) { | 317 | if (!ptr) |
421 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); | ||
422 | return -ENOMEM; | 318 | return -ENOMEM; |
423 | } | ||
424 | 319 | ||
425 | /* 4 characters for byte 0xYY */ | 320 | /* 4 characters for byte 0xYY */ |
426 | buf = kzalloc(buf_size, GFP_KERNEL); | 321 | buf = kzalloc(buf_size, GFP_KERNEL); |
427 | if (!buf) { | 322 | if (!buf) |
428 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
429 | return -ENOMEM; | 323 | return -ENOMEM; |
430 | } | 324 | |
431 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | 325 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); |
432 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " | 326 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " |
433 | "version: 0x%x\n", | 327 | "version: 0x%x\n", |
@@ -461,10 +355,8 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, | |||
461 | return -EAGAIN; | 355 | return -EAGAIN; |
462 | 356 | ||
463 | buf = kzalloc(bufsz, GFP_KERNEL); | 357 | buf = kzalloc(bufsz, GFP_KERNEL); |
464 | if (!buf) { | 358 | if (!buf) |
465 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
466 | return -ENOMEM; | 359 | return -ENOMEM; |
467 | } | ||
468 | 360 | ||
469 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | 361 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); |
470 | if (supp_band) { | 362 | if (supp_band) { |
@@ -566,10 +458,8 @@ static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file, | |||
566 | ssize_t ret; | 458 | ssize_t ret; |
567 | 459 | ||
568 | buf = kzalloc(bufsz, GFP_KERNEL); | 460 | buf = kzalloc(bufsz, GFP_KERNEL); |
569 | if (!buf) { | 461 | if (!buf) |
570 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
571 | return -ENOMEM; | 462 | return -ENOMEM; |
572 | } | ||
573 | 463 | ||
574 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { | 464 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { |
575 | if (priv->rx_handlers_stats[cnt] > 0) | 465 | if (priv->rx_handlers_stats[cnt] > 0) |
@@ -683,11 +573,8 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, | |||
683 | return -EFAULT; | 573 | return -EFAULT; |
684 | if (!iwl_is_any_associated(priv)) | 574 | if (!iwl_is_any_associated(priv)) |
685 | priv->disable_ht40 = ht40 ? true : false; | 575 | priv->disable_ht40 = ht40 ? true : false; |
686 | else { | 576 | else |
687 | IWL_ERR(priv, "Sta associated with AP - " | ||
688 | "Change to 40MHz channel support is not allowed\n"); | ||
689 | return -EINVAL; | 577 | return -EINVAL; |
690 | } | ||
691 | 578 | ||
692 | return count; | 579 | return count; |
693 | } | 580 | } |
@@ -819,87 +706,6 @@ DEBUGFS_READ_FILE_OPS(temperature); | |||
819 | DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); | 706 | DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); |
820 | DEBUGFS_READ_FILE_OPS(current_sleep_command); | 707 | DEBUGFS_READ_FILE_OPS(current_sleep_command); |
821 | 708 | ||
822 | static ssize_t iwl_dbgfs_traffic_log_read(struct file *file, | ||
823 | char __user *user_buf, | ||
824 | size_t count, loff_t *ppos) | ||
825 | { | ||
826 | struct iwl_priv *priv = file->private_data; | ||
827 | int pos = 0, ofs = 0; | ||
828 | int cnt = 0, entry; | ||
829 | |||
830 | char *buf; | ||
831 | int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + | ||
832 | (cfg(priv)->base_params->num_of_queues * 32 * 8) + 400; | ||
833 | const u8 *ptr; | ||
834 | ssize_t ret; | ||
835 | |||
836 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
837 | if (!buf) { | ||
838 | IWL_ERR(priv, "Can not allocate buffer\n"); | ||
839 | return -ENOMEM; | ||
840 | } | ||
841 | if (priv->tx_traffic && iwl_have_debug_level(IWL_DL_TX)) { | ||
842 | ptr = priv->tx_traffic; | ||
843 | pos += scnprintf(buf + pos, bufsz - pos, | ||
844 | "Tx Traffic idx: %u\n", priv->tx_traffic_idx); | ||
845 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { | ||
846 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; | ||
847 | entry++, ofs += 16) { | ||
848 | pos += scnprintf(buf + pos, bufsz - pos, | ||
849 | "0x%.4x ", ofs); | ||
850 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, | ||
851 | buf + pos, bufsz - pos, 0); | ||
852 | pos += strlen(buf + pos); | ||
853 | if (bufsz - pos > 0) | ||
854 | buf[pos++] = '\n'; | ||
855 | } | ||
856 | } | ||
857 | } | ||
858 | |||
859 | if (priv->rx_traffic && iwl_have_debug_level(IWL_DL_RX)) { | ||
860 | ptr = priv->rx_traffic; | ||
861 | pos += scnprintf(buf + pos, bufsz - pos, | ||
862 | "Rx Traffic idx: %u\n", priv->rx_traffic_idx); | ||
863 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { | ||
864 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; | ||
865 | entry++, ofs += 16) { | ||
866 | pos += scnprintf(buf + pos, bufsz - pos, | ||
867 | "0x%.4x ", ofs); | ||
868 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, | ||
869 | buf + pos, bufsz - pos, 0); | ||
870 | pos += strlen(buf + pos); | ||
871 | if (bufsz - pos > 0) | ||
872 | buf[pos++] = '\n'; | ||
873 | } | ||
874 | } | ||
875 | } | ||
876 | |||
877 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
878 | kfree(buf); | ||
879 | return ret; | ||
880 | } | ||
881 | |||
882 | static ssize_t iwl_dbgfs_traffic_log_write(struct file *file, | ||
883 | const char __user *user_buf, | ||
884 | size_t count, loff_t *ppos) | ||
885 | { | ||
886 | struct iwl_priv *priv = file->private_data; | ||
887 | char buf[8]; | ||
888 | int buf_size; | ||
889 | int traffic_log; | ||
890 | |||
891 | memset(buf, 0, sizeof(buf)); | ||
892 | buf_size = min(count, sizeof(buf) - 1); | ||
893 | if (copy_from_user(buf, user_buf, buf_size)) | ||
894 | return -EFAULT; | ||
895 | if (sscanf(buf, "%d", &traffic_log) != 1) | ||
896 | return -EFAULT; | ||
897 | if (traffic_log == 0) | ||
898 | iwl_reset_traffic_log(priv); | ||
899 | |||
900 | return count; | ||
901 | } | ||
902 | |||
903 | static const char *fmt_value = " %-30s %10u\n"; | 709 | static const char *fmt_value = " %-30s %10u\n"; |
904 | static const char *fmt_hex = " %-30s 0x%02X\n"; | 710 | static const char *fmt_hex = " %-30s 0x%02X\n"; |
905 | static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; | 711 | static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; |
@@ -950,10 +756,8 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, | |||
950 | return -EAGAIN; | 756 | return -EAGAIN; |
951 | 757 | ||
952 | buf = kzalloc(bufsz, GFP_KERNEL); | 758 | buf = kzalloc(bufsz, GFP_KERNEL); |
953 | if (!buf) { | 759 | if (!buf) |
954 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
955 | return -ENOMEM; | 760 | return -ENOMEM; |
956 | } | ||
957 | 761 | ||
958 | /* | 762 | /* |
959 | * the statistic information display here is based on | 763 | * the statistic information display here is based on |
@@ -1379,10 +1183,8 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, | |||
1379 | return -EAGAIN; | 1183 | return -EAGAIN; |
1380 | 1184 | ||
1381 | buf = kzalloc(bufsz, GFP_KERNEL); | 1185 | buf = kzalloc(bufsz, GFP_KERNEL); |
1382 | if (!buf) { | 1186 | if (!buf) |
1383 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1384 | return -ENOMEM; | 1187 | return -ENOMEM; |
1385 | } | ||
1386 | 1188 | ||
1387 | /* the statistic information display here is based on | 1189 | /* the statistic information display here is based on |
1388 | * the last statistics notification from uCode | 1190 | * the last statistics notification from uCode |
@@ -1581,10 +1383,8 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, | |||
1581 | return -EAGAIN; | 1383 | return -EAGAIN; |
1582 | 1384 | ||
1583 | buf = kzalloc(bufsz, GFP_KERNEL); | 1385 | buf = kzalloc(bufsz, GFP_KERNEL); |
1584 | if (!buf) { | 1386 | if (!buf) |
1585 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1586 | return -ENOMEM; | 1387 | return -ENOMEM; |
1587 | } | ||
1588 | 1388 | ||
1589 | /* the statistic information display here is based on | 1389 | /* the statistic information display here is based on |
1590 | * the last statistics notification from uCode | 1390 | * the last statistics notification from uCode |
@@ -1707,16 +1507,11 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, | |||
1707 | ret = iwl_send_statistics_request(priv, CMD_SYNC, false); | 1507 | ret = iwl_send_statistics_request(priv, CMD_SYNC, false); |
1708 | mutex_unlock(&priv->mutex); | 1508 | mutex_unlock(&priv->mutex); |
1709 | 1509 | ||
1710 | if (ret) { | 1510 | if (ret) |
1711 | IWL_ERR(priv, | ||
1712 | "Error sending statistics request: %zd\n", ret); | ||
1713 | return -EAGAIN; | 1511 | return -EAGAIN; |
1714 | } | ||
1715 | buf = kzalloc(bufsz, GFP_KERNEL); | 1512 | buf = kzalloc(bufsz, GFP_KERNEL); |
1716 | if (!buf) { | 1513 | if (!buf) |
1717 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1718 | return -ENOMEM; | 1514 | return -ENOMEM; |
1719 | } | ||
1720 | 1515 | ||
1721 | /* | 1516 | /* |
1722 | * the statistic information display here is based on | 1517 | * the statistic information display here is based on |
@@ -1793,10 +1588,8 @@ static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file, | |||
1793 | return -EAGAIN; | 1588 | return -EAGAIN; |
1794 | 1589 | ||
1795 | buf = kzalloc(bufsz, GFP_KERNEL); | 1590 | buf = kzalloc(bufsz, GFP_KERNEL); |
1796 | if (!buf) { | 1591 | if (!buf) |
1797 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1798 | return -ENOMEM; | 1592 | return -ENOMEM; |
1799 | } | ||
1800 | 1593 | ||
1801 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n"); | 1594 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n"); |
1802 | pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n", | 1595 | pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n", |
@@ -1936,10 +1729,8 @@ static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, | |||
1936 | 1729 | ||
1937 | data = &priv->sensitivity_data; | 1730 | data = &priv->sensitivity_data; |
1938 | buf = kzalloc(bufsz, GFP_KERNEL); | 1731 | buf = kzalloc(bufsz, GFP_KERNEL); |
1939 | if (!buf) { | 1732 | if (!buf) |
1940 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1941 | return -ENOMEM; | 1733 | return -ENOMEM; |
1942 | } | ||
1943 | 1734 | ||
1944 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", | 1735 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", |
1945 | data->auto_corr_ofdm); | 1736 | data->auto_corr_ofdm); |
@@ -2017,10 +1808,8 @@ static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, | |||
2017 | 1808 | ||
2018 | data = &priv->chain_noise_data; | 1809 | data = &priv->chain_noise_data; |
2019 | buf = kzalloc(bufsz, GFP_KERNEL); | 1810 | buf = kzalloc(bufsz, GFP_KERNEL); |
2020 | if (!buf) { | 1811 | if (!buf) |
2021 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
2022 | return -ENOMEM; | 1812 | return -ENOMEM; |
2023 | } | ||
2024 | 1813 | ||
2025 | pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", | 1814 | pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", |
2026 | data->active_chains); | 1815 | data->active_chains); |
@@ -2071,7 +1860,7 @@ static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, | |||
2071 | const size_t bufsz = sizeof(buf); | 1860 | const size_t bufsz = sizeof(buf); |
2072 | u32 pwrsave_status; | 1861 | u32 pwrsave_status; |
2073 | 1862 | ||
2074 | pwrsave_status = iwl_read32(trans(priv), CSR_GP_CNTRL) & | 1863 | pwrsave_status = iwl_read32(priv->trans, CSR_GP_CNTRL) & |
2075 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; | 1864 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; |
2076 | 1865 | ||
2077 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); | 1866 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); |
@@ -2380,7 +2169,7 @@ static ssize_t iwl_dbgfs_protection_mode_read(struct file *file, | |||
2380 | char buf[40]; | 2169 | char buf[40]; |
2381 | const size_t bufsz = sizeof(buf); | 2170 | const size_t bufsz = sizeof(buf); |
2382 | 2171 | ||
2383 | if (cfg(priv)->ht_params) | 2172 | if (priv->cfg->ht_params) |
2384 | pos += scnprintf(buf + pos, bufsz - pos, | 2173 | pos += scnprintf(buf + pos, bufsz - pos, |
2385 | "use %s for aggregation\n", | 2174 | "use %s for aggregation\n", |
2386 | (priv->hw_params.use_rts_for_aggregation) ? | 2175 | (priv->hw_params.use_rts_for_aggregation) ? |
@@ -2400,7 +2189,7 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, | |||
2400 | int buf_size; | 2189 | int buf_size; |
2401 | int rts; | 2190 | int rts; |
2402 | 2191 | ||
2403 | if (!cfg(priv)->ht_params) | 2192 | if (!priv->cfg->ht_params) |
2404 | return -EINVAL; | 2193 | return -EINVAL; |
2405 | 2194 | ||
2406 | memset(buf, 0, sizeof(buf)); | 2195 | memset(buf, 0, sizeof(buf)); |
@@ -2416,6 +2205,23 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, | |||
2416 | return count; | 2205 | return count; |
2417 | } | 2206 | } |
2418 | 2207 | ||
2208 | static int iwl_cmd_echo_test(struct iwl_priv *priv) | ||
2209 | { | ||
2210 | int ret; | ||
2211 | struct iwl_host_cmd cmd = { | ||
2212 | .id = REPLY_ECHO, | ||
2213 | .len = { 0 }, | ||
2214 | .flags = CMD_SYNC, | ||
2215 | }; | ||
2216 | |||
2217 | ret = iwl_dvm_send_cmd(priv, &cmd); | ||
2218 | if (ret) | ||
2219 | IWL_ERR(priv, "echo testing fail: 0X%x\n", ret); | ||
2220 | else | ||
2221 | IWL_DEBUG_INFO(priv, "echo testing pass\n"); | ||
2222 | return ret; | ||
2223 | } | ||
2224 | |||
2419 | static ssize_t iwl_dbgfs_echo_test_write(struct file *file, | 2225 | static ssize_t iwl_dbgfs_echo_test_write(struct file *file, |
2420 | const char __user *user_buf, | 2226 | const char __user *user_buf, |
2421 | size_t count, loff_t *ppos) | 2227 | size_t count, loff_t *ppos) |
@@ -2499,9 +2305,27 @@ static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, | |||
2499 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 2305 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
2500 | } | 2306 | } |
2501 | 2307 | ||
2502 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 2308 | static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file, |
2503 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 2309 | const char __user *user_buf, |
2504 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 2310 | size_t count, loff_t *ppos) |
2311 | { | ||
2312 | struct iwl_priv *priv = file->private_data; | ||
2313 | char buf[8]; | ||
2314 | u32 calib_disabled; | ||
2315 | int buf_size; | ||
2316 | |||
2317 | memset(buf, 0, sizeof(buf)); | ||
2318 | buf_size = min(count, sizeof(buf) - 1); | ||
2319 | if (copy_from_user(buf, user_buf, buf_size)) | ||
2320 | return -EFAULT; | ||
2321 | if (sscanf(buf, "%x", &calib_disabled) != 1) | ||
2322 | return -EFAULT; | ||
2323 | |||
2324 | priv->calib_disabled = calib_disabled; | ||
2325 | |||
2326 | return count; | ||
2327 | } | ||
2328 | |||
2505 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); | 2329 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); |
2506 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); | 2330 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); |
2507 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); | 2331 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
@@ -2509,7 +2333,6 @@ DEBUGFS_READ_FILE_OPS(sensitivity); | |||
2509 | DEBUGFS_READ_FILE_OPS(chain_noise); | 2333 | DEBUGFS_READ_FILE_OPS(chain_noise); |
2510 | DEBUGFS_READ_FILE_OPS(power_save_status); | 2334 | DEBUGFS_READ_FILE_OPS(power_save_status); |
2511 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); | 2335 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
2512 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | ||
2513 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); | 2336 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); |
2514 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); | 2337 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); |
2515 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); | 2338 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); |
@@ -2523,7 +2346,7 @@ DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); | |||
2523 | DEBUGFS_READ_FILE_OPS(reply_tx_error); | 2346 | DEBUGFS_READ_FILE_OPS(reply_tx_error); |
2524 | DEBUGFS_WRITE_FILE_OPS(echo_test); | 2347 | DEBUGFS_WRITE_FILE_OPS(echo_test); |
2525 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); | 2348 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); |
2526 | DEBUGFS_READ_FILE_OPS(calib_disabled); | 2349 | DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); |
2527 | 2350 | ||
2528 | /* | 2351 | /* |
2529 | * Create the debugfs files and directories | 2352 | * Create the debugfs files and directories |
@@ -2564,12 +2387,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2564 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); | 2387 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
2565 | DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR); | 2388 | DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR); |
2566 | 2389 | ||
2567 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); | ||
2568 | DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR); | ||
2569 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); | ||
2570 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); | 2390 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |
2571 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); | 2391 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); |
2572 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); | ||
2573 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); | 2392 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); |
2574 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); | 2393 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); |
2575 | DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); | 2394 | DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); |
@@ -2592,9 +2411,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2592 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); | 2411 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); |
2593 | 2412 | ||
2594 | /* Calibrations disabled/enabled status*/ | 2413 | /* Calibrations disabled/enabled status*/ |
2595 | DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IRUSR); | 2414 | DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR); |
2596 | 2415 | ||
2597 | if (iwl_trans_dbgfs_register(trans(priv), dir_debug)) | 2416 | if (iwl_trans_dbgfs_register(priv->trans, dir_debug)) |
2598 | goto err; | 2417 | goto err; |
2599 | return 0; | 2418 | return 0; |
2600 | 2419 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index c235a1ea71b4..f70219c3b122 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
40 | 40 | ||
41 | #include "iwl-fw.h" | ||
41 | #include "iwl-eeprom.h" | 42 | #include "iwl-eeprom.h" |
42 | #include "iwl-csr.h" | 43 | #include "iwl-csr.h" |
43 | #include "iwl-debug.h" | 44 | #include "iwl-debug.h" |
@@ -47,7 +48,6 @@ | |||
47 | #include "iwl-agn-rs.h" | 48 | #include "iwl-agn-rs.h" |
48 | #include "iwl-agn-tt.h" | 49 | #include "iwl-agn-tt.h" |
49 | #include "iwl-trans.h" | 50 | #include "iwl-trans.h" |
50 | #include "iwl-shared.h" | ||
51 | #include "iwl-op-mode.h" | 51 | #include "iwl-op-mode.h" |
52 | #include "iwl-notif-wait.h" | 52 | #include "iwl-notif-wait.h" |
53 | 53 | ||
@@ -194,6 +194,7 @@ struct iwl_qos_info { | |||
194 | * These states relate to a specific RA / TID. | 194 | * These states relate to a specific RA / TID. |
195 | * | 195 | * |
196 | * @IWL_AGG_OFF: aggregation is not used | 196 | * @IWL_AGG_OFF: aggregation is not used |
197 | * @IWL_AGG_STARTING: aggregation are starting (between start and oper) | ||
197 | * @IWL_AGG_ON: aggregation session is up | 198 | * @IWL_AGG_ON: aggregation session is up |
198 | * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the | 199 | * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the |
199 | * HW queue to be empty from packets for this RA /TID. | 200 | * HW queue to be empty from packets for this RA /TID. |
@@ -202,6 +203,7 @@ struct iwl_qos_info { | |||
202 | */ | 203 | */ |
203 | enum iwl_agg_state { | 204 | enum iwl_agg_state { |
204 | IWL_AGG_OFF = 0, | 205 | IWL_AGG_OFF = 0, |
206 | IWL_AGG_STARTING, | ||
205 | IWL_AGG_ON, | 207 | IWL_AGG_ON, |
206 | IWL_EMPTYING_HW_QUEUE_ADDBA, | 208 | IWL_EMPTYING_HW_QUEUE_ADDBA, |
207 | IWL_EMPTYING_HW_QUEUE_DELBA, | 209 | IWL_EMPTYING_HW_QUEUE_DELBA, |
@@ -504,44 +506,6 @@ struct reply_agg_tx_error_statistics { | |||
504 | u32 unknown; | 506 | u32 unknown; |
505 | }; | 507 | }; |
506 | 508 | ||
507 | /* management statistics */ | ||
508 | enum iwl_mgmt_stats { | ||
509 | MANAGEMENT_ASSOC_REQ = 0, | ||
510 | MANAGEMENT_ASSOC_RESP, | ||
511 | MANAGEMENT_REASSOC_REQ, | ||
512 | MANAGEMENT_REASSOC_RESP, | ||
513 | MANAGEMENT_PROBE_REQ, | ||
514 | MANAGEMENT_PROBE_RESP, | ||
515 | MANAGEMENT_BEACON, | ||
516 | MANAGEMENT_ATIM, | ||
517 | MANAGEMENT_DISASSOC, | ||
518 | MANAGEMENT_AUTH, | ||
519 | MANAGEMENT_DEAUTH, | ||
520 | MANAGEMENT_ACTION, | ||
521 | MANAGEMENT_MAX, | ||
522 | }; | ||
523 | /* control statistics */ | ||
524 | enum iwl_ctrl_stats { | ||
525 | CONTROL_BACK_REQ = 0, | ||
526 | CONTROL_BACK, | ||
527 | CONTROL_PSPOLL, | ||
528 | CONTROL_RTS, | ||
529 | CONTROL_CTS, | ||
530 | CONTROL_ACK, | ||
531 | CONTROL_CFEND, | ||
532 | CONTROL_CFENDACK, | ||
533 | CONTROL_MAX, | ||
534 | }; | ||
535 | |||
536 | struct traffic_stats { | ||
537 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
538 | u32 mgmt[MANAGEMENT_MAX]; | ||
539 | u32 ctrl[CONTROL_MAX]; | ||
540 | u32 data_cnt; | ||
541 | u64 data_bytes; | ||
542 | #endif | ||
543 | }; | ||
544 | |||
545 | /* | 509 | /* |
546 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds | 510 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds |
547 | * to perform continuous uCode event logging operation if enabled | 511 | * to perform continuous uCode event logging operation if enabled |
@@ -568,25 +532,8 @@ struct iwl_event_log { | |||
568 | int wraps_more_count; | 532 | int wraps_more_count; |
569 | }; | 533 | }; |
570 | 534 | ||
571 | /* | ||
572 | * This is the threshold value of plcp error rate per 100mSecs. It is | ||
573 | * used to set and check for the validity of plcp_delta. | ||
574 | */ | ||
575 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (1) | ||
576 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50) | ||
577 | #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100) | ||
578 | #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200) | ||
579 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255) | ||
580 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE (0) | ||
581 | |||
582 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) | 535 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) |
583 | 536 | ||
584 | /* TX queue watchdog timeouts in mSecs */ | ||
585 | #define IWL_WATCHHDOG_DISABLED (0) | ||
586 | #define IWL_DEF_WD_TIMEOUT (2000) | ||
587 | #define IWL_LONG_WD_TIMEOUT (10000) | ||
588 | #define IWL_MAX_WD_TIMEOUT (120000) | ||
589 | |||
590 | /* BT Antenna Coupling Threshold (dB) */ | 537 | /* BT Antenna Coupling Threshold (dB) */ |
591 | #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) | 538 | #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) |
592 | 539 | ||
@@ -602,6 +549,13 @@ struct iwl_rf_reset { | |||
602 | unsigned long last_reset_jiffies; | 549 | unsigned long last_reset_jiffies; |
603 | }; | 550 | }; |
604 | 551 | ||
552 | enum iwl_rxon_context_id { | ||
553 | IWL_RXON_CTX_BSS, | ||
554 | IWL_RXON_CTX_PAN, | ||
555 | |||
556 | NUM_IWL_RXON_CTX | ||
557 | }; | ||
558 | |||
605 | /* extend beacon time format bit shifting */ | 559 | /* extend beacon time format bit shifting */ |
606 | /* | 560 | /* |
607 | * for _agn devices | 561 | * for _agn devices |
@@ -742,12 +696,15 @@ struct iwl_wipan_noa_data { | |||
742 | }; | 696 | }; |
743 | 697 | ||
744 | /* Calibration disabling bit mask */ | 698 | /* Calibration disabling bit mask */ |
745 | #define IWL_SENSITIVITY_CALIB_DISABLED BIT(1) | 699 | enum { |
746 | #define IWL_CHAIN_NOISE_CALIB_DISABLED BIT(2) | 700 | IWL_CALIB_ENABLE_ALL = 0, |
747 | #define IWL_TX_POWER_CALIB_DISABLED BIT(3) | 701 | |
702 | IWL_SENSITIVITY_CALIB_DISABLED = BIT(0), | ||
703 | IWL_CHAIN_NOISE_CALIB_DISABLED = BIT(1), | ||
704 | IWL_TX_POWER_CALIB_DISABLED = BIT(2), | ||
748 | 705 | ||
749 | #define IWL_CALIB_ENABLE_ALL 0 | 706 | IWL_CALIB_DISABLE_ALL = 0xFFFFFFFF, |
750 | #define IWL_CALIB_DISABLE_ALL 0xFFFFFFFF | 707 | }; |
751 | 708 | ||
752 | #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \ | 709 | #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \ |
753 | ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific)) | 710 | ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific)) |
@@ -758,8 +715,9 @@ struct iwl_wipan_noa_data { | |||
758 | 715 | ||
759 | struct iwl_priv { | 716 | struct iwl_priv { |
760 | 717 | ||
761 | /*data shared among all the driver's layers */ | 718 | struct iwl_trans *trans; |
762 | struct iwl_shared *shrd; | 719 | struct device *dev; /* for debug prints only */ |
720 | const struct iwl_cfg *cfg; | ||
763 | const struct iwl_fw *fw; | 721 | const struct iwl_fw *fw; |
764 | const struct iwl_lib_ops *lib; | 722 | const struct iwl_lib_ops *lib; |
765 | unsigned long status; | 723 | unsigned long status; |
@@ -769,9 +727,9 @@ struct iwl_priv { | |||
769 | 727 | ||
770 | unsigned long transport_queue_stop; | 728 | unsigned long transport_queue_stop; |
771 | bool passive_no_rx; | 729 | bool passive_no_rx; |
772 | #define IWL_INVALID_AC 0xff | 730 | #define IWL_INVALID_MAC80211_QUEUE 0xff |
773 | u8 queue_to_ac[IWL_MAX_HW_QUEUES]; | 731 | u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; |
774 | atomic_t ac_stop_count[IEEE80211_NUM_ACS]; | 732 | atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; |
775 | 733 | ||
776 | unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; | 734 | unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; |
777 | 735 | ||
@@ -880,10 +838,6 @@ struct iwl_priv { | |||
880 | 838 | ||
881 | int activity_timer_active; | 839 | int activity_timer_active; |
882 | 840 | ||
883 | /* counts mgmt, ctl, and data packets */ | ||
884 | struct traffic_stats tx_stats; | ||
885 | struct traffic_stats rx_stats; | ||
886 | |||
887 | struct iwl_power_mgr power_data; | 841 | struct iwl_power_mgr power_data; |
888 | struct iwl_tt_mgmt thermal_throttle; | 842 | struct iwl_tt_mgmt thermal_throttle; |
889 | 843 | ||
@@ -1003,10 +957,6 @@ struct iwl_priv { | |||
1003 | 957 | ||
1004 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 958 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1005 | /* debugfs */ | 959 | /* debugfs */ |
1006 | u16 tx_traffic_idx; | ||
1007 | u16 rx_traffic_idx; | ||
1008 | u8 *tx_traffic; | ||
1009 | u8 *rx_traffic; | ||
1010 | struct dentry *debugfs_dir; | 960 | struct dentry *debugfs_dir; |
1011 | u32 dbgfs_sram_offset, dbgfs_sram_len; | 961 | u32 dbgfs_sram_offset, dbgfs_sram_len; |
1012 | bool disable_ht40; | 962 | bool disable_ht40; |
@@ -1051,7 +1001,6 @@ struct iwl_priv { | |||
1051 | }; /*iwl_priv */ | 1001 | }; /*iwl_priv */ |
1052 | 1002 | ||
1053 | extern struct kmem_cache *iwl_tx_cmd_pool; | 1003 | extern struct kmem_cache *iwl_tx_cmd_pool; |
1054 | extern struct iwl_mod_params iwlagn_mod_params; | ||
1055 | 1004 | ||
1056 | static inline struct iwl_rxon_context * | 1005 | static inline struct iwl_rxon_context * |
1057 | iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) | 1006 | iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index 17485e715424..05302d6f989f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -67,9 +67,11 @@ | |||
67 | 67 | ||
68 | #include "iwl-drv.h" | 68 | #include "iwl-drv.h" |
69 | #include "iwl-trans.h" | 69 | #include "iwl-trans.h" |
70 | #include "iwl-shared.h" | ||
71 | #include "iwl-op-mode.h" | 70 | #include "iwl-op-mode.h" |
72 | #include "iwl-agn-hw.h" | 71 | #include "iwl-agn-hw.h" |
72 | #include "iwl-fw.h" | ||
73 | #include "iwl-config.h" | ||
74 | #include "iwl-modparams.h" | ||
73 | 75 | ||
74 | /* private includes */ | 76 | /* private includes */ |
75 | #include "iwl-fw-file.h" | 77 | #include "iwl-fw-file.h" |
@@ -77,8 +79,10 @@ | |||
77 | /** | 79 | /** |
78 | * struct iwl_drv - drv common data | 80 | * struct iwl_drv - drv common data |
79 | * @fw: the iwl_fw structure | 81 | * @fw: the iwl_fw structure |
80 | * @shrd: pointer to common shared structure | ||
81 | * @op_mode: the running op_mode | 82 | * @op_mode: the running op_mode |
83 | * @trans: transport layer | ||
84 | * @dev: for debug prints only | ||
85 | * @cfg: configuration struct | ||
82 | * @fw_index: firmware revision to try loading | 86 | * @fw_index: firmware revision to try loading |
83 | * @firmware_name: composite filename of ucode file to load | 87 | * @firmware_name: composite filename of ucode file to load |
84 | * @request_firmware_complete: the firmware has been obtained from user space | 88 | * @request_firmware_complete: the firmware has been obtained from user space |
@@ -86,8 +90,10 @@ | |||
86 | struct iwl_drv { | 90 | struct iwl_drv { |
87 | struct iwl_fw fw; | 91 | struct iwl_fw fw; |
88 | 92 | ||
89 | struct iwl_shared *shrd; | ||
90 | struct iwl_op_mode *op_mode; | 93 | struct iwl_op_mode *op_mode; |
94 | struct iwl_trans *trans; | ||
95 | struct device *dev; | ||
96 | const struct iwl_cfg *cfg; | ||
91 | 97 | ||
92 | int fw_index; /* firmware we're trying to load */ | 98 | int fw_index; /* firmware we're trying to load */ |
93 | char firmware_name[25]; /* name of firmware file to load */ | 99 | char firmware_name[25]; /* name of firmware file to load */ |
@@ -110,7 +116,7 @@ struct fw_sec { | |||
110 | static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc) | 116 | static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc) |
111 | { | 117 | { |
112 | if (desc->v_addr) | 118 | if (desc->v_addr) |
113 | dma_free_coherent(trans(drv)->dev, desc->len, | 119 | dma_free_coherent(drv->trans->dev, desc->len, |
114 | desc->v_addr, desc->p_addr); | 120 | desc->v_addr, desc->p_addr); |
115 | desc->v_addr = NULL; | 121 | desc->v_addr = NULL; |
116 | desc->len = 0; | 122 | desc->len = 0; |
@@ -138,7 +144,7 @@ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, | |||
138 | return -EINVAL; | 144 | return -EINVAL; |
139 | } | 145 | } |
140 | 146 | ||
141 | desc->v_addr = dma_alloc_coherent(trans(drv)->dev, sec->size, | 147 | desc->v_addr = dma_alloc_coherent(drv->trans->dev, sec->size, |
142 | &desc->p_addr, GFP_KERNEL); | 148 | &desc->p_addr, GFP_KERNEL); |
143 | if (!desc->v_addr) | 149 | if (!desc->v_addr) |
144 | return -ENOMEM; | 150 | return -ENOMEM; |
@@ -156,8 +162,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | |||
156 | 162 | ||
157 | static int iwl_request_firmware(struct iwl_drv *drv, bool first) | 163 | static int iwl_request_firmware(struct iwl_drv *drv, bool first) |
158 | { | 164 | { |
159 | const struct iwl_cfg *cfg = cfg(drv); | 165 | const char *name_pre = drv->cfg->fw_name_pre; |
160 | const char *name_pre = cfg->fw_name_pre; | ||
161 | char tag[8]; | 166 | char tag[8]; |
162 | 167 | ||
163 | if (first) { | 168 | if (first) { |
@@ -166,14 +171,14 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) | |||
166 | strcpy(tag, UCODE_EXPERIMENTAL_TAG); | 171 | strcpy(tag, UCODE_EXPERIMENTAL_TAG); |
167 | } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) { | 172 | } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) { |
168 | #endif | 173 | #endif |
169 | drv->fw_index = cfg->ucode_api_max; | 174 | drv->fw_index = drv->cfg->ucode_api_max; |
170 | sprintf(tag, "%d", drv->fw_index); | 175 | sprintf(tag, "%d", drv->fw_index); |
171 | } else { | 176 | } else { |
172 | drv->fw_index--; | 177 | drv->fw_index--; |
173 | sprintf(tag, "%d", drv->fw_index); | 178 | sprintf(tag, "%d", drv->fw_index); |
174 | } | 179 | } |
175 | 180 | ||
176 | if (drv->fw_index < cfg->ucode_api_min) { | 181 | if (drv->fw_index < drv->cfg->ucode_api_min) { |
177 | IWL_ERR(drv, "no suitable firmware found!\n"); | 182 | IWL_ERR(drv, "no suitable firmware found!\n"); |
178 | return -ENOENT; | 183 | return -ENOENT; |
179 | } | 184 | } |
@@ -186,7 +191,7 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) | |||
186 | drv->firmware_name); | 191 | drv->firmware_name); |
187 | 192 | ||
188 | return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name, | 193 | return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name, |
189 | trans(drv)->dev, | 194 | drv->trans->dev, |
190 | GFP_KERNEL, drv, iwl_ucode_callback); | 195 | GFP_KERNEL, drv, iwl_ucode_callback); |
191 | } | 196 | } |
192 | 197 | ||
@@ -725,14 +730,13 @@ static int validate_sec_sizes(struct iwl_drv *drv, | |||
725 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | 730 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) |
726 | { | 731 | { |
727 | struct iwl_drv *drv = context; | 732 | struct iwl_drv *drv = context; |
728 | const struct iwl_cfg *cfg = cfg(drv); | ||
729 | struct iwl_fw *fw = &drv->fw; | 733 | struct iwl_fw *fw = &drv->fw; |
730 | struct iwl_ucode_header *ucode; | 734 | struct iwl_ucode_header *ucode; |
731 | int err; | 735 | int err; |
732 | struct iwl_firmware_pieces pieces; | 736 | struct iwl_firmware_pieces pieces; |
733 | const unsigned int api_max = cfg->ucode_api_max; | 737 | const unsigned int api_max = drv->cfg->ucode_api_max; |
734 | unsigned int api_ok = cfg->ucode_api_ok; | 738 | unsigned int api_ok = drv->cfg->ucode_api_ok; |
735 | const unsigned int api_min = cfg->ucode_api_min; | 739 | const unsigned int api_min = drv->cfg->ucode_api_min; |
736 | u32 api_ver; | 740 | u32 api_ver; |
737 | int i; | 741 | int i; |
738 | 742 | ||
@@ -811,7 +815,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
811 | * In mvm uCode there is no difference between data and instructions | 815 | * In mvm uCode there is no difference between data and instructions |
812 | * sections. | 816 | * sections. |
813 | */ | 817 | */ |
814 | if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, cfg)) | 818 | if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, drv->cfg)) |
815 | goto try_again; | 819 | goto try_again; |
816 | 820 | ||
817 | /* Allocate ucode buffers for card's bus-master loading ... */ | 821 | /* Allocate ucode buffers for card's bus-master loading ... */ |
@@ -835,14 +839,14 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
835 | fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; | 839 | fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; |
836 | else | 840 | else |
837 | fw->init_evtlog_size = | 841 | fw->init_evtlog_size = |
838 | cfg->base_params->max_event_log_size; | 842 | drv->cfg->base_params->max_event_log_size; |
839 | fw->init_errlog_ptr = pieces.init_errlog_ptr; | 843 | fw->init_errlog_ptr = pieces.init_errlog_ptr; |
840 | fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr; | 844 | fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr; |
841 | if (pieces.inst_evtlog_size) | 845 | if (pieces.inst_evtlog_size) |
842 | fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; | 846 | fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; |
843 | else | 847 | else |
844 | fw->inst_evtlog_size = | 848 | fw->inst_evtlog_size = |
845 | cfg->base_params->max_event_log_size; | 849 | drv->cfg->base_params->max_event_log_size; |
846 | fw->inst_errlog_ptr = pieces.inst_errlog_ptr; | 850 | fw->inst_errlog_ptr = pieces.inst_errlog_ptr; |
847 | 851 | ||
848 | /* | 852 | /* |
@@ -858,7 +862,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
858 | release_firmware(ucode_raw); | 862 | release_firmware(ucode_raw); |
859 | complete(&drv->request_firmware_complete); | 863 | complete(&drv->request_firmware_complete); |
860 | 864 | ||
861 | drv->op_mode = iwl_dvm_ops.start(drv->shrd->trans, &drv->fw); | 865 | drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw); |
862 | 866 | ||
863 | if (!drv->op_mode) | 867 | if (!drv->op_mode) |
864 | goto out_unbind; | 868 | goto out_unbind; |
@@ -878,24 +882,23 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
878 | release_firmware(ucode_raw); | 882 | release_firmware(ucode_raw); |
879 | out_unbind: | 883 | out_unbind: |
880 | complete(&drv->request_firmware_complete); | 884 | complete(&drv->request_firmware_complete); |
881 | device_release_driver(trans(drv)->dev); | 885 | device_release_driver(drv->trans->dev); |
882 | } | 886 | } |
883 | 887 | ||
884 | int iwl_drv_start(struct iwl_shared *shrd, | 888 | struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, |
885 | struct iwl_trans *trans, const struct iwl_cfg *cfg) | 889 | const struct iwl_cfg *cfg) |
886 | { | 890 | { |
887 | struct iwl_drv *drv; | 891 | struct iwl_drv *drv; |
888 | int ret; | 892 | int ret; |
889 | 893 | ||
890 | shrd->cfg = cfg; | ||
891 | |||
892 | drv = kzalloc(sizeof(*drv), GFP_KERNEL); | 894 | drv = kzalloc(sizeof(*drv), GFP_KERNEL); |
893 | if (!drv) { | 895 | if (!drv) { |
894 | dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); | 896 | dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); |
895 | return -ENOMEM; | 897 | return NULL; |
896 | } | 898 | } |
897 | drv->shrd = shrd; | 899 | drv->trans = trans; |
898 | shrd->drv = drv; | 900 | drv->dev = trans->dev; |
901 | drv->cfg = cfg; | ||
899 | 902 | ||
900 | init_completion(&drv->request_firmware_complete); | 903 | init_completion(&drv->request_firmware_complete); |
901 | 904 | ||
@@ -904,16 +907,14 @@ int iwl_drv_start(struct iwl_shared *shrd, | |||
904 | if (ret) { | 907 | if (ret) { |
905 | dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw"); | 908 | dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw"); |
906 | kfree(drv); | 909 | kfree(drv); |
907 | shrd->drv = NULL; | 910 | drv = NULL; |
908 | } | 911 | } |
909 | 912 | ||
910 | return ret; | 913 | return drv; |
911 | } | 914 | } |
912 | 915 | ||
913 | void iwl_drv_stop(struct iwl_shared *shrd) | 916 | void iwl_drv_stop(struct iwl_drv *drv) |
914 | { | 917 | { |
915 | struct iwl_drv *drv = shrd->drv; | ||
916 | |||
917 | wait_for_completion(&drv->request_firmware_complete); | 918 | wait_for_completion(&drv->request_firmware_complete); |
918 | 919 | ||
919 | /* op_mode can be NULL if its start failed */ | 920 | /* op_mode can be NULL if its start failed */ |
@@ -923,5 +924,91 @@ void iwl_drv_stop(struct iwl_shared *shrd) | |||
923 | iwl_dealloc_ucode(drv); | 924 | iwl_dealloc_ucode(drv); |
924 | 925 | ||
925 | kfree(drv); | 926 | kfree(drv); |
926 | shrd->drv = NULL; | ||
927 | } | 927 | } |
928 | |||
929 | |||
930 | /* shared module parameters */ | ||
931 | struct iwl_mod_params iwlwifi_mod_params = { | ||
932 | .amsdu_size_8K = 1, | ||
933 | .restart_fw = 1, | ||
934 | .plcp_check = true, | ||
935 | .bt_coex_active = true, | ||
936 | .power_level = IWL_POWER_INDEX_1, | ||
937 | .bt_ch_announce = true, | ||
938 | .auto_agg = true, | ||
939 | /* the rest are 0 by default */ | ||
940 | }; | ||
941 | |||
942 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
943 | module_param_named(debug, iwlwifi_mod_params.debug_level, uint, | ||
944 | S_IRUGO | S_IWUSR); | ||
945 | MODULE_PARM_DESC(debug, "debug output mask"); | ||
946 | #endif | ||
947 | |||
948 | module_param_named(swcrypto, iwlwifi_mod_params.sw_crypto, int, S_IRUGO); | ||
949 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); | ||
950 | module_param_named(11n_disable, iwlwifi_mod_params.disable_11n, uint, S_IRUGO); | ||
951 | MODULE_PARM_DESC(11n_disable, | ||
952 | "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); | ||
953 | module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, | ||
954 | int, S_IRUGO); | ||
955 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); | ||
956 | module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, int, S_IRUGO); | ||
957 | MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); | ||
958 | |||
959 | module_param_named(antenna_coupling, iwlwifi_mod_params.ant_coupling, | ||
960 | int, S_IRUGO); | ||
961 | MODULE_PARM_DESC(antenna_coupling, | ||
962 | "specify antenna coupling in dB (defualt: 0 dB)"); | ||
963 | |||
964 | module_param_named(bt_ch_inhibition, iwlwifi_mod_params.bt_ch_announce, | ||
965 | bool, S_IRUGO); | ||
966 | MODULE_PARM_DESC(bt_ch_inhibition, | ||
967 | "Enable BT channel inhibition (default: enable)"); | ||
968 | |||
969 | module_param_named(plcp_check, iwlwifi_mod_params.plcp_check, bool, S_IRUGO); | ||
970 | MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])"); | ||
971 | |||
972 | module_param_named(wd_disable, iwlwifi_mod_params.wd_disable, int, S_IRUGO); | ||
973 | MODULE_PARM_DESC(wd_disable, | ||
974 | "Disable stuck queue watchdog timer 0=system default, " | ||
975 | "1=disable, 2=enable (default: 0)"); | ||
976 | |||
977 | /* | ||
978 | * set bt_coex_active to true, uCode will do kill/defer | ||
979 | * every time the priority line is asserted (BT is sending signals on the | ||
980 | * priority line in the PCIx). | ||
981 | * set bt_coex_active to false, uCode will ignore the BT activity and | ||
982 | * perform the normal operation | ||
983 | * | ||
984 | * User might experience transmit issue on some platform due to WiFi/BT | ||
985 | * co-exist problem. The possible behaviors are: | ||
986 | * Able to scan and finding all the available AP | ||
987 | * Not able to associate with any AP | ||
988 | * On those platforms, WiFi communication can be restored by set | ||
989 | * "bt_coex_active" module parameter to "false" | ||
990 | * | ||
991 | * default: bt_coex_active = true (BT_COEX_ENABLE) | ||
992 | */ | ||
993 | module_param_named(bt_coex_active, iwlwifi_mod_params.bt_coex_active, | ||
994 | bool, S_IRUGO); | ||
995 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)"); | ||
996 | |||
997 | module_param_named(led_mode, iwlwifi_mod_params.led_mode, int, S_IRUGO); | ||
998 | MODULE_PARM_DESC(led_mode, "0=system default, " | ||
999 | "1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)"); | ||
1000 | |||
1001 | module_param_named(power_save, iwlwifi_mod_params.power_save, | ||
1002 | bool, S_IRUGO); | ||
1003 | MODULE_PARM_DESC(power_save, | ||
1004 | "enable WiFi power management (default: disable)"); | ||
1005 | |||
1006 | module_param_named(power_level, iwlwifi_mod_params.power_level, | ||
1007 | int, S_IRUGO); | ||
1008 | MODULE_PARM_DESC(power_level, | ||
1009 | "default power save level (range from 1 - 5, default: 1)"); | ||
1010 | |||
1011 | module_param_named(auto_agg, iwlwifi_mod_params.auto_agg, | ||
1012 | bool, S_IRUGO); | ||
1013 | MODULE_PARM_DESC(auto_agg, | ||
1014 | "enable agg w/o check traffic load (default: enable)"); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.h b/drivers/net/wireless/iwlwifi/iwl-drv.h index 3b771c1d9096..2cbf137b25bf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.h +++ b/drivers/net/wireless/iwlwifi/iwl-drv.h | |||
@@ -63,7 +63,12 @@ | |||
63 | #ifndef __iwl_drv_h__ | 63 | #ifndef __iwl_drv_h__ |
64 | #define __iwl_drv_h__ | 64 | #define __iwl_drv_h__ |
65 | 65 | ||
66 | #include "iwl-shared.h" | 66 | /* for all modules */ |
67 | #define DRV_NAME "iwlwifi" | ||
68 | #define IWLWIFI_VERSION "in-tree:" | ||
69 | #define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation" | ||
70 | #define DRV_AUTHOR "<ilw@linux.intel.com>" | ||
71 | |||
67 | 72 | ||
68 | /** | 73 | /** |
69 | * DOC: Driver system flows - drv component | 74 | * DOC: Driver system flows - drv component |
@@ -90,34 +95,32 @@ | |||
90 | * 8) iwl_ucode_callback starts the wifi implementation to matches the fw | 95 | * 8) iwl_ucode_callback starts the wifi implementation to matches the fw |
91 | */ | 96 | */ |
92 | 97 | ||
98 | struct iwl_drv; | ||
99 | struct iwl_trans; | ||
100 | struct iwl_cfg; | ||
93 | /** | 101 | /** |
94 | * iwl_drv_start - start the drv | 102 | * iwl_drv_start - start the drv |
95 | * | 103 | * |
96 | * @shrd: the shrd area | ||
97 | * @trans_ops: the ops of the transport | 104 | * @trans_ops: the ops of the transport |
98 | * @cfg: device specific constants / virtual functions | 105 | * @cfg: device specific constants / virtual functions |
99 | * | 106 | * |
100 | * TODO: review the parameters given to this function | ||
101 | * | ||
102 | * starts the driver: fetches the firmware. This should be called by bus | 107 | * starts the driver: fetches the firmware. This should be called by bus |
103 | * specific system flows implementations. For example, the bus specific probe | 108 | * specific system flows implementations. For example, the bus specific probe |
104 | * function should do bus related operations only, and then call to this | 109 | * function should do bus related operations only, and then call to this |
105 | * function. | 110 | * function. It returns the driver object or %NULL if an error occured. |
106 | */ | 111 | */ |
107 | int iwl_drv_start(struct iwl_shared *shrd, | 112 | struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, |
108 | struct iwl_trans *trans, const struct iwl_cfg *cfg); | 113 | const struct iwl_cfg *cfg); |
109 | 114 | ||
110 | /** | 115 | /** |
111 | * iwl_drv_stop - stop the drv | 116 | * iwl_drv_stop - stop the drv |
112 | * | 117 | * |
113 | * @shrd: the shrd area | 118 | * @drv: |
114 | * | ||
115 | * TODO: review the parameters given to this function | ||
116 | * | 119 | * |
117 | * Stop the driver. This should be called by bus specific system flows | 120 | * Stop the driver. This should be called by bus specific system flows |
118 | * implementations. For example, the bus specific remove function should first | 121 | * implementations. For example, the bus specific remove function should first |
119 | * call this function and then do the bus related operations only. | 122 | * call this function and then do the bus related operations only. |
120 | */ | 123 | */ |
121 | void iwl_drv_stop(struct iwl_shared *shrd); | 124 | void iwl_drv_stop(struct iwl_drv *drv); |
122 | 125 | ||
123 | #endif /* __iwl_drv_h__ */ | 126 | #endif /* __iwl_drv_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index a004431d1a60..50c58911e718 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -68,9 +68,7 @@ | |||
68 | 68 | ||
69 | #include <net/mac80211.h> | 69 | #include <net/mac80211.h> |
70 | 70 | ||
71 | #include "iwl-commands.h" | ||
72 | #include "iwl-dev.h" | 71 | #include "iwl-dev.h" |
73 | #include "iwl-core.h" | ||
74 | #include "iwl-debug.h" | 72 | #include "iwl-debug.h" |
75 | #include "iwl-agn.h" | 73 | #include "iwl-agn.h" |
76 | #include "iwl-eeprom.h" | 74 | #include "iwl-eeprom.h" |
@@ -189,7 +187,7 @@ static void iwl_eeprom_release_semaphore(struct iwl_trans *trans) | |||
189 | 187 | ||
190 | static int iwl_eeprom_verify_signature(struct iwl_priv *priv) | 188 | static int iwl_eeprom_verify_signature(struct iwl_priv *priv) |
191 | { | 189 | { |
192 | u32 gp = iwl_read32(trans(priv), CSR_EEPROM_GP) & | 190 | u32 gp = iwl_read32(priv->trans, CSR_EEPROM_GP) & |
193 | CSR_EEPROM_GP_VALID_MSK; | 191 | CSR_EEPROM_GP_VALID_MSK; |
194 | int ret = 0; | 192 | int ret = 0; |
195 | 193 | ||
@@ -236,8 +234,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv) | |||
236 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | 234 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); |
237 | calib_ver = iwl_eeprom_calib_version(priv); | 235 | calib_ver = iwl_eeprom_calib_version(priv); |
238 | 236 | ||
239 | if (eeprom_ver < cfg(priv)->eeprom_ver || | 237 | if (eeprom_ver < priv->cfg->eeprom_ver || |
240 | calib_ver < cfg(priv)->eeprom_calib_ver) | 238 | calib_ver < priv->cfg->eeprom_calib_ver) |
241 | goto err; | 239 | goto err; |
242 | 240 | ||
243 | IWL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", | 241 | IWL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", |
@@ -247,8 +245,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv) | |||
247 | err: | 245 | err: |
248 | IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " | 246 | IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " |
249 | "CALIB=0x%x < 0x%x\n", | 247 | "CALIB=0x%x < 0x%x\n", |
250 | eeprom_ver, cfg(priv)->eeprom_ver, | 248 | eeprom_ver, priv->cfg->eeprom_ver, |
251 | calib_ver, cfg(priv)->eeprom_calib_ver); | 249 | calib_ver, priv->cfg->eeprom_calib_ver); |
252 | return -EINVAL; | 250 | return -EINVAL; |
253 | 251 | ||
254 | } | 252 | } |
@@ -259,7 +257,7 @@ int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
259 | 257 | ||
260 | priv->hw_params.sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); | 258 | priv->hw_params.sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); |
261 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && | 259 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && |
262 | !cfg(priv)->ht_params) { | 260 | !priv->cfg->ht_params) { |
263 | IWL_ERR(priv, "Invalid 11n configuration\n"); | 261 | IWL_ERR(priv, "Invalid 11n configuration\n"); |
264 | return -EINVAL; | 262 | return -EINVAL; |
265 | } | 263 | } |
@@ -277,10 +275,10 @@ int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
277 | priv->hw_params.valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); | 275 | priv->hw_params.valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); |
278 | 276 | ||
279 | /* check overrides (some devices have wrong EEPROM) */ | 277 | /* check overrides (some devices have wrong EEPROM) */ |
280 | if (cfg(priv)->valid_tx_ant) | 278 | if (priv->cfg->valid_tx_ant) |
281 | priv->hw_params.valid_tx_ant = cfg(priv)->valid_tx_ant; | 279 | priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; |
282 | if (cfg(priv)->valid_rx_ant) | 280 | if (priv->cfg->valid_rx_ant) |
283 | priv->hw_params.valid_rx_ant = cfg(priv)->valid_rx_ant; | 281 | priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; |
284 | 282 | ||
285 | if (!priv->hw_params.valid_tx_ant || !priv->hw_params.valid_rx_ant) { | 283 | if (!priv->hw_params.valid_tx_ant || !priv->hw_params.valid_rx_ant) { |
286 | IWL_ERR(priv, "Invalid chain (0x%X, 0x%X)\n", | 284 | IWL_ERR(priv, "Invalid chain (0x%X, 0x%X)\n", |
@@ -349,7 +347,7 @@ static u32 eeprom_indirect_address(struct iwl_priv *priv, u32 address) | |||
349 | const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset) | 347 | const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset) |
350 | { | 348 | { |
351 | u32 address = eeprom_indirect_address(priv, offset); | 349 | u32 address = eeprom_indirect_address(priv, offset); |
352 | BUG_ON(address >= cfg(priv)->base_params->eeprom_size); | 350 | BUG_ON(address >= priv->cfg->base_params->eeprom_size); |
353 | return &priv->eeprom[address]; | 351 | return &priv->eeprom[address]; |
354 | } | 352 | } |
355 | 353 | ||
@@ -433,7 +431,7 @@ static int iwl_init_otp_access(struct iwl_trans *trans) | |||
433 | * CSR auto clock gate disable bit - | 431 | * CSR auto clock gate disable bit - |
434 | * this is only applicable for HW with OTP shadow RAM | 432 | * this is only applicable for HW with OTP shadow RAM |
435 | */ | 433 | */ |
436 | if (cfg(trans)->base_params->shadow_ram_support) | 434 | if (trans->cfg->base_params->shadow_ram_support) |
437 | iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, | 435 | iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, |
438 | CSR_RESET_LINK_PWR_MGMT_DISABLED); | 436 | CSR_RESET_LINK_PWR_MGMT_DISABLED); |
439 | } | 437 | } |
@@ -554,7 +552,7 @@ static int iwl_find_otp_image(struct iwl_trans *trans, | |||
554 | } | 552 | } |
555 | /* more in the link list, continue */ | 553 | /* more in the link list, continue */ |
556 | usedblocks++; | 554 | usedblocks++; |
557 | } while (usedblocks <= cfg(trans)->base_params->max_ll_items); | 555 | } while (usedblocks <= trans->cfg->base_params->max_ll_items); |
558 | 556 | ||
559 | /* OTP has no valid blocks */ | 557 | /* OTP has no valid blocks */ |
560 | IWL_DEBUG_EEPROM(trans, "OTP has no valid blocks\n"); | 558 | IWL_DEBUG_EEPROM(trans, "OTP has no valid blocks\n"); |
@@ -693,7 +691,7 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
693 | ((txp->delta_20_in_40 & 0xf0) >> 4), | 691 | ((txp->delta_20_in_40 & 0xf0) >> 4), |
694 | (txp->delta_20_in_40 & 0x0f)); | 692 | (txp->delta_20_in_40 & 0x0f)); |
695 | 693 | ||
696 | max_txp_avg = iwl_get_max_txpower_avg(cfg(priv), txp_array, idx, | 694 | max_txp_avg = iwl_get_max_txpower_avg(priv->cfg, txp_array, idx, |
697 | &max_txp_avg_halfdbm); | 695 | &max_txp_avg_halfdbm); |
698 | 696 | ||
699 | /* | 697 | /* |
@@ -719,18 +717,18 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
719 | int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | 717 | int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) |
720 | { | 718 | { |
721 | __le16 *e; | 719 | __le16 *e; |
722 | u32 gp = iwl_read32(trans(priv), CSR_EEPROM_GP); | 720 | u32 gp = iwl_read32(priv->trans, CSR_EEPROM_GP); |
723 | int sz; | 721 | int sz; |
724 | int ret; | 722 | int ret; |
725 | u16 addr; | 723 | u16 addr; |
726 | u16 validblockaddr = 0; | 724 | u16 validblockaddr = 0; |
727 | u16 cache_addr = 0; | 725 | u16 cache_addr = 0; |
728 | 726 | ||
729 | priv->nvm_device_type = iwl_get_nvm_type(trans(priv), hw_rev); | 727 | priv->nvm_device_type = iwl_get_nvm_type(priv->trans, hw_rev); |
730 | if (priv->nvm_device_type == -ENOENT) | 728 | if (priv->nvm_device_type == -ENOENT) |
731 | return -ENOENT; | 729 | return -ENOENT; |
732 | /* allocate eeprom */ | 730 | /* allocate eeprom */ |
733 | sz = cfg(priv)->base_params->eeprom_size; | 731 | sz = priv->cfg->base_params->eeprom_size; |
734 | IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); | 732 | IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); |
735 | priv->eeprom = kzalloc(sz, GFP_KERNEL); | 733 | priv->eeprom = kzalloc(sz, GFP_KERNEL); |
736 | if (!priv->eeprom) { | 734 | if (!priv->eeprom) { |
@@ -747,7 +745,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | |||
747 | } | 745 | } |
748 | 746 | ||
749 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ | 747 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ |
750 | ret = iwl_eeprom_acquire_semaphore(trans(priv)); | 748 | ret = iwl_eeprom_acquire_semaphore(priv->trans); |
751 | if (ret < 0) { | 749 | if (ret < 0) { |
752 | IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); | 750 | IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); |
753 | ret = -ENOENT; | 751 | ret = -ENOENT; |
@@ -756,22 +754,22 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | |||
756 | 754 | ||
757 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { | 755 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { |
758 | 756 | ||
759 | ret = iwl_init_otp_access(trans(priv)); | 757 | ret = iwl_init_otp_access(priv->trans); |
760 | if (ret) { | 758 | if (ret) { |
761 | IWL_ERR(priv, "Failed to initialize OTP access.\n"); | 759 | IWL_ERR(priv, "Failed to initialize OTP access.\n"); |
762 | ret = -ENOENT; | 760 | ret = -ENOENT; |
763 | goto done; | 761 | goto done; |
764 | } | 762 | } |
765 | iwl_write32(trans(priv), CSR_EEPROM_GP, | 763 | iwl_write32(priv->trans, CSR_EEPROM_GP, |
766 | iwl_read32(trans(priv), CSR_EEPROM_GP) & | 764 | iwl_read32(priv->trans, CSR_EEPROM_GP) & |
767 | ~CSR_EEPROM_GP_IF_OWNER_MSK); | 765 | ~CSR_EEPROM_GP_IF_OWNER_MSK); |
768 | 766 | ||
769 | iwl_set_bit(trans(priv), CSR_OTP_GP_REG, | 767 | iwl_set_bit(priv->trans, CSR_OTP_GP_REG, |
770 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | | 768 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | |
771 | CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); | 769 | CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); |
772 | /* traversing the linked list if no shadow ram supported */ | 770 | /* traversing the linked list if no shadow ram supported */ |
773 | if (!cfg(priv)->base_params->shadow_ram_support) { | 771 | if (!priv->cfg->base_params->shadow_ram_support) { |
774 | if (iwl_find_otp_image(trans(priv), &validblockaddr)) { | 772 | if (iwl_find_otp_image(priv->trans, &validblockaddr)) { |
775 | ret = -ENOENT; | 773 | ret = -ENOENT; |
776 | goto done; | 774 | goto done; |
777 | } | 775 | } |
@@ -780,7 +778,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | |||
780 | addr += sizeof(u16)) { | 778 | addr += sizeof(u16)) { |
781 | __le16 eeprom_data; | 779 | __le16 eeprom_data; |
782 | 780 | ||
783 | ret = iwl_read_otp_word(trans(priv), addr, | 781 | ret = iwl_read_otp_word(priv->trans, addr, |
784 | &eeprom_data); | 782 | &eeprom_data); |
785 | if (ret) | 783 | if (ret) |
786 | goto done; | 784 | goto done; |
@@ -792,10 +790,10 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | |||
792 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 790 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
793 | u32 r; | 791 | u32 r; |
794 | 792 | ||
795 | iwl_write32(trans(priv), CSR_EEPROM_REG, | 793 | iwl_write32(priv->trans, CSR_EEPROM_REG, |
796 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); | 794 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); |
797 | 795 | ||
798 | ret = iwl_poll_bit(trans(priv), CSR_EEPROM_REG, | 796 | ret = iwl_poll_bit(priv->trans, CSR_EEPROM_REG, |
799 | CSR_EEPROM_REG_READ_VALID_MSK, | 797 | CSR_EEPROM_REG_READ_VALID_MSK, |
800 | CSR_EEPROM_REG_READ_VALID_MSK, | 798 | CSR_EEPROM_REG_READ_VALID_MSK, |
801 | IWL_EEPROM_ACCESS_TIMEOUT); | 799 | IWL_EEPROM_ACCESS_TIMEOUT); |
@@ -804,7 +802,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | |||
804 | "Time out reading EEPROM[%d]\n", addr); | 802 | "Time out reading EEPROM[%d]\n", addr); |
805 | goto done; | 803 | goto done; |
806 | } | 804 | } |
807 | r = iwl_read32(trans(priv), CSR_EEPROM_REG); | 805 | r = iwl_read32(priv->trans, CSR_EEPROM_REG); |
808 | e[addr / 2] = cpu_to_le16(r >> 16); | 806 | e[addr / 2] = cpu_to_le16(r >> 16); |
809 | } | 807 | } |
810 | } | 808 | } |
@@ -816,7 +814,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) | |||
816 | 814 | ||
817 | ret = 0; | 815 | ret = 0; |
818 | done: | 816 | done: |
819 | iwl_eeprom_release_semaphore(trans(priv)); | 817 | iwl_eeprom_release_semaphore(priv->trans); |
820 | 818 | ||
821 | err: | 819 | err: |
822 | if (ret) | 820 | if (ret) |
@@ -1132,7 +1130,7 @@ void iwl_rf_config(struct iwl_priv *priv) | |||
1132 | 1130 | ||
1133 | /* write radio config values to register */ | 1131 | /* write radio config values to register */ |
1134 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { | 1132 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { |
1135 | iwl_set_bit(trans(priv), CSR_HW_IF_CONFIG_REG, | 1133 | iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG, |
1136 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | 1134 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | |
1137 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | 1135 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | |
1138 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | 1136 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); |
@@ -1144,7 +1142,7 @@ void iwl_rf_config(struct iwl_priv *priv) | |||
1144 | WARN_ON(1); | 1142 | WARN_ON(1); |
1145 | 1143 | ||
1146 | /* set CSR_HW_CONFIG_REG for uCode use */ | 1144 | /* set CSR_HW_CONFIG_REG for uCode use */ |
1147 | iwl_set_bit(trans(priv), CSR_HW_IF_CONFIG_REG, | 1145 | iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG, |
1148 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | 1146 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | |
1149 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | 1147 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); |
1150 | } | 1148 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index b3a3b1f0fdc4..64bfd947caeb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -206,59 +206,6 @@ struct iwl_eeprom_calib_hdr { | |||
206 | /* 6000 regulatory - indirect access */ | 206 | /* 6000 regulatory - indirect access */ |
207 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\ | 207 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\ |
208 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */ | 208 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */ |
209 | |||
210 | /* 5000 Specific */ | ||
211 | #define EEPROM_5000_TX_POWER_VERSION (4) | ||
212 | #define EEPROM_5000_EEPROM_VERSION (0x11A) | ||
213 | |||
214 | /* 5050 Specific */ | ||
215 | #define EEPROM_5050_TX_POWER_VERSION (4) | ||
216 | #define EEPROM_5050_EEPROM_VERSION (0x21E) | ||
217 | |||
218 | /* 1000 Specific */ | ||
219 | #define EEPROM_1000_TX_POWER_VERSION (4) | ||
220 | #define EEPROM_1000_EEPROM_VERSION (0x15C) | ||
221 | |||
222 | /* 6x00 Specific */ | ||
223 | #define EEPROM_6000_TX_POWER_VERSION (4) | ||
224 | #define EEPROM_6000_EEPROM_VERSION (0x423) | ||
225 | |||
226 | /* 6x50 Specific */ | ||
227 | #define EEPROM_6050_TX_POWER_VERSION (4) | ||
228 | #define EEPROM_6050_EEPROM_VERSION (0x532) | ||
229 | |||
230 | /* 6150 Specific */ | ||
231 | #define EEPROM_6150_TX_POWER_VERSION (6) | ||
232 | #define EEPROM_6150_EEPROM_VERSION (0x553) | ||
233 | |||
234 | /* 6x05 Specific */ | ||
235 | #define EEPROM_6005_TX_POWER_VERSION (6) | ||
236 | #define EEPROM_6005_EEPROM_VERSION (0x709) | ||
237 | |||
238 | /* 6x30 Specific */ | ||
239 | #define EEPROM_6030_TX_POWER_VERSION (6) | ||
240 | #define EEPROM_6030_EEPROM_VERSION (0x709) | ||
241 | |||
242 | /* 2x00 Specific */ | ||
243 | #define EEPROM_2000_TX_POWER_VERSION (6) | ||
244 | #define EEPROM_2000_EEPROM_VERSION (0x805) | ||
245 | |||
246 | /* 6x35 Specific */ | ||
247 | #define EEPROM_6035_TX_POWER_VERSION (6) | ||
248 | #define EEPROM_6035_EEPROM_VERSION (0x753) | ||
249 | |||
250 | |||
251 | /* OTP */ | ||
252 | /* lower blocks contain EEPROM image and calibration data */ | ||
253 | #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ | ||
254 | /* high blocks contain PAPD data */ | ||
255 | #define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ | ||
256 | #define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ | ||
257 | #define OTP_MAX_LL_ITEMS_1000 (3) /* OTP blocks for 1000 */ | ||
258 | #define OTP_MAX_LL_ITEMS_6x00 (4) /* OTP blocks for 6x00 */ | ||
259 | #define OTP_MAX_LL_ITEMS_6x50 (7) /* OTP blocks for 6x50 */ | ||
260 | #define OTP_MAX_LL_ITEMS_2x00 (4) /* OTP blocks for 2x00 */ | ||
261 | |||
262 | /* 2.4 GHz */ | 209 | /* 2.4 GHz */ |
263 | extern const u8 iwl_eeprom_band_1[14]; | 210 | extern const u8 iwl_eeprom_band_1[14]; |
264 | 211 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index 8e36bdc1e522..2153e4cc5572 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -63,6 +63,7 @@ | |||
63 | #ifndef __iwl_fw_h__ | 63 | #ifndef __iwl_fw_h__ |
64 | #define __iwl_fw_h__ | 64 | #define __iwl_fw_h__ |
65 | #include <linux/types.h> | 65 | #include <linux/types.h> |
66 | #include <net/mac80211.h> | ||
66 | 67 | ||
67 | /** | 68 | /** |
68 | * enum iwl_ucode_tlv_flag - ucode API flags | 69 | * enum iwl_ucode_tlv_flag - ucode API flags |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 09b856768f62..abb3250164ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #define __iwl_io_h__ | 30 | #define __iwl_io_h__ |
31 | 31 | ||
32 | #include "iwl-devtrace.h" | 32 | #include "iwl-devtrace.h" |
33 | #include "iwl-shared.h" | ||
34 | #include "iwl-trans.h" | 33 | #include "iwl-trans.h" |
35 | 34 | ||
36 | static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) | 35 | static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index 1993a2b7ae63..47000419f916 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
@@ -36,11 +36,10 @@ | |||
36 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
37 | 37 | ||
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-core.h" | ||
40 | #include "iwl-agn.h" | 39 | #include "iwl-agn.h" |
41 | #include "iwl-io.h" | 40 | #include "iwl-io.h" |
42 | #include "iwl-trans.h" | 41 | #include "iwl-trans.h" |
43 | #include "iwl-shared.h" | 42 | #include "iwl-modparams.h" |
44 | 43 | ||
45 | /* Throughput OFF time(ms) ON time (ms) | 44 | /* Throughput OFF time(ms) ON time (ms) |
46 | * >300 25 25 | 45 | * >300 25 25 |
@@ -71,7 +70,7 @@ static const struct ieee80211_tpt_blink iwl_blink[] = { | |||
71 | /* Set led register off */ | 70 | /* Set led register off */ |
72 | void iwlagn_led_enable(struct iwl_priv *priv) | 71 | void iwlagn_led_enable(struct iwl_priv *priv) |
73 | { | 72 | { |
74 | iwl_write32(trans(priv), CSR_LED_REG, CSR_LED_REG_TRUN_ON); | 73 | iwl_write32(priv->trans, CSR_LED_REG, CSR_LED_REG_TRUN_ON); |
75 | } | 74 | } |
76 | 75 | ||
77 | /* | 76 | /* |
@@ -107,9 +106,9 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) | |||
107 | }; | 106 | }; |
108 | u32 reg; | 107 | u32 reg; |
109 | 108 | ||
110 | reg = iwl_read32(trans(priv), CSR_LED_REG); | 109 | reg = iwl_read32(priv->trans, CSR_LED_REG); |
111 | if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) | 110 | if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) |
112 | iwl_write32(trans(priv), CSR_LED_REG, | 111 | iwl_write32(priv->trans, CSR_LED_REG, |
113 | reg & CSR_LED_BSM_CTRL_MSK); | 112 | reg & CSR_LED_BSM_CTRL_MSK); |
114 | 113 | ||
115 | return iwl_dvm_send_cmd(priv, &cmd); | 114 | return iwl_dvm_send_cmd(priv, &cmd); |
@@ -138,11 +137,11 @@ static int iwl_led_cmd(struct iwl_priv *priv, | |||
138 | } | 137 | } |
139 | 138 | ||
140 | IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", | 139 | IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", |
141 | cfg(priv)->base_params->led_compensation); | 140 | priv->cfg->base_params->led_compensation); |
142 | led_cmd.on = iwl_blink_compensation(priv, on, | 141 | led_cmd.on = iwl_blink_compensation(priv, on, |
143 | cfg(priv)->base_params->led_compensation); | 142 | priv->cfg->base_params->led_compensation); |
144 | led_cmd.off = iwl_blink_compensation(priv, off, | 143 | led_cmd.off = iwl_blink_compensation(priv, off, |
145 | cfg(priv)->base_params->led_compensation); | 144 | priv->cfg->base_params->led_compensation); |
146 | 145 | ||
147 | ret = iwl_send_led_cmd(priv, &led_cmd); | 146 | ret = iwl_send_led_cmd(priv, &led_cmd); |
148 | if (!ret) { | 147 | if (!ret) { |
@@ -175,7 +174,7 @@ static int iwl_led_blink_set(struct led_classdev *led_cdev, | |||
175 | 174 | ||
176 | void iwl_leds_init(struct iwl_priv *priv) | 175 | void iwl_leds_init(struct iwl_priv *priv) |
177 | { | 176 | { |
178 | int mode = iwlagn_mod_params.led_mode; | 177 | int mode = iwlwifi_mod_params.led_mode; |
179 | int ret; | 178 | int ret; |
180 | 179 | ||
181 | if (mode == IWL_LED_DISABLE) { | 180 | if (mode == IWL_LED_DISABLE) { |
@@ -183,7 +182,7 @@ void iwl_leds_init(struct iwl_priv *priv) | |||
183 | return; | 182 | return; |
184 | } | 183 | } |
185 | if (mode == IWL_LED_DEFAULT) | 184 | if (mode == IWL_LED_DEFAULT) |
186 | mode = cfg(priv)->led_mode; | 185 | mode = priv->cfg->led_mode; |
187 | 186 | ||
188 | priv->led.name = kasprintf(GFP_KERNEL, "%s-led", | 187 | priv->led.name = kasprintf(GFP_KERNEL, "%s-led", |
189 | wiphy_name(priv->hw->wiphy)); | 188 | wiphy_name(priv->hw->wiphy)); |
@@ -207,7 +206,7 @@ void iwl_leds_init(struct iwl_priv *priv) | |||
207 | break; | 206 | break; |
208 | } | 207 | } |
209 | 208 | ||
210 | ret = led_classdev_register(trans(priv)->dev, &priv->led); | 209 | ret = led_classdev_register(priv->trans->dev, &priv->led); |
211 | if (ret) { | 210 | if (ret) { |
212 | kfree(priv->led.name); | 211 | kfree(priv->led.name); |
213 | return; | 212 | return; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index 3f82ff4f3afe..b30bb0c637ca 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
@@ -44,13 +44,12 @@ | |||
44 | 44 | ||
45 | #include "iwl-eeprom.h" | 45 | #include "iwl-eeprom.h" |
46 | #include "iwl-dev.h" | 46 | #include "iwl-dev.h" |
47 | #include "iwl-core.h" | ||
48 | #include "iwl-io.h" | 47 | #include "iwl-io.h" |
49 | #include "iwl-agn-calib.h" | 48 | #include "iwl-agn-calib.h" |
50 | #include "iwl-agn.h" | 49 | #include "iwl-agn.h" |
51 | #include "iwl-shared.h" | ||
52 | #include "iwl-trans.h" | 50 | #include "iwl-trans.h" |
53 | #include "iwl-op-mode.h" | 51 | #include "iwl-op-mode.h" |
52 | #include "iwl-modparams.h" | ||
54 | 53 | ||
55 | /***************************************************************************** | 54 | /***************************************************************************** |
56 | * | 55 | * |
@@ -147,7 +146,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
147 | IEEE80211_HW_AMPDU_AGGREGATION | | 146 | IEEE80211_HW_AMPDU_AGGREGATION | |
148 | IEEE80211_HW_NEED_DTIM_PERIOD | | 147 | IEEE80211_HW_NEED_DTIM_PERIOD | |
149 | IEEE80211_HW_SPECTRUM_MGMT | | 148 | IEEE80211_HW_SPECTRUM_MGMT | |
150 | IEEE80211_HW_REPORTS_TX_ACK_STATUS; | 149 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
150 | IEEE80211_HW_QUEUE_CONTROL | | ||
151 | IEEE80211_HW_SUPPORTS_PS | | ||
152 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS | | ||
153 | IEEE80211_HW_SCAN_WHILE_IDLE; | ||
154 | |||
155 | hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE; | ||
151 | 156 | ||
152 | /* | 157 | /* |
153 | * Including the following line will crash some AP's. This | 158 | * Including the following line will crash some AP's. This |
@@ -156,10 +161,6 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
156 | hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; | 161 | hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; |
157 | */ | 162 | */ |
158 | 163 | ||
159 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | ||
160 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS | | ||
161 | IEEE80211_HW_SCAN_WHILE_IDLE; | ||
162 | |||
163 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) | 164 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE) |
164 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | 165 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
165 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 166 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; |
@@ -198,13 +199,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
198 | WIPHY_FLAG_IBSS_RSN; | 199 | WIPHY_FLAG_IBSS_RSN; |
199 | 200 | ||
200 | if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && | 201 | if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && |
201 | trans(priv)->ops->wowlan_suspend && | 202 | priv->trans->ops->wowlan_suspend && |
202 | device_can_wakeup(trans(priv)->dev)) { | 203 | device_can_wakeup(priv->trans->dev)) { |
203 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | | 204 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | |
204 | WIPHY_WOWLAN_DISCONNECT | | 205 | WIPHY_WOWLAN_DISCONNECT | |
205 | WIPHY_WOWLAN_EAP_IDENTITY_REQ | | 206 | WIPHY_WOWLAN_EAP_IDENTITY_REQ | |
206 | WIPHY_WOWLAN_RFKILL_RELEASE; | 207 | WIPHY_WOWLAN_RFKILL_RELEASE; |
207 | if (!iwlagn_mod_params.sw_crypto) | 208 | if (!iwlwifi_mod_params.sw_crypto) |
208 | hw->wiphy->wowlan.flags |= | 209 | hw->wiphy->wowlan.flags |= |
209 | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | | 210 | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | |
210 | WIPHY_WOWLAN_GTK_REKEY_FAILURE; | 211 | WIPHY_WOWLAN_GTK_REKEY_FAILURE; |
@@ -216,7 +217,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
216 | IWLAGN_WOWLAN_MAX_PATTERN_LEN; | 217 | IWLAGN_WOWLAN_MAX_PATTERN_LEN; |
217 | } | 218 | } |
218 | 219 | ||
219 | if (iwlagn_mod_params.power_save) | 220 | if (iwlwifi_mod_params.power_save) |
220 | hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; | 221 | hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; |
221 | else | 222 | else |
222 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 223 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
@@ -225,8 +226,11 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
225 | /* we create the 802.11 header and a zero-length SSID element */ | 226 | /* we create the 802.11 header and a zero-length SSID element */ |
226 | hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; | 227 | hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; |
227 | 228 | ||
228 | /* Default value; 4 EDCA QOS priorities */ | 229 | /* |
229 | hw->queues = 4; | 230 | * We don't use all queues: 4 and 9 are unused and any |
231 | * aggregation queue gets mapped down to the AC queue. | ||
232 | */ | ||
233 | hw->queues = IWLAGN_FIRST_AMPDU_QUEUE; | ||
230 | 234 | ||
231 | hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; | 235 | hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; |
232 | 236 | ||
@@ -237,7 +241,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
237 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 241 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
238 | &priv->bands[IEEE80211_BAND_5GHZ]; | 242 | &priv->bands[IEEE80211_BAND_5GHZ]; |
239 | 243 | ||
240 | hw->wiphy->hw_version = trans(priv)->hw_id; | 244 | hw->wiphy->hw_version = priv->trans->hw_id; |
241 | 245 | ||
242 | iwl_leds_init(priv); | 246 | iwl_leds_init(priv); |
243 | 247 | ||
@@ -356,7 +360,7 @@ void iwlagn_mac_stop(struct ieee80211_hw *hw) | |||
356 | * even if interface is down, trans->down will leave the RF | 360 | * even if interface is down, trans->down will leave the RF |
357 | * kill interrupt enabled | 361 | * kill interrupt enabled |
358 | */ | 362 | */ |
359 | iwl_trans_stop_hw(trans(priv)); | 363 | iwl_trans_stop_hw(priv->trans, false); |
360 | 364 | ||
361 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 365 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
362 | } | 366 | } |
@@ -367,7 +371,7 @@ void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw, | |||
367 | { | 371 | { |
368 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 372 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
369 | 373 | ||
370 | if (iwlagn_mod_params.sw_crypto) | 374 | if (iwlwifi_mod_params.sw_crypto) |
371 | return; | 375 | return; |
372 | 376 | ||
373 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 377 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
@@ -412,9 +416,9 @@ int iwlagn_mac_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
412 | if (ret) | 416 | if (ret) |
413 | goto error; | 417 | goto error; |
414 | 418 | ||
415 | device_set_wakeup_enable(trans(priv)->dev, true); | 419 | device_set_wakeup_enable(priv->trans->dev, true); |
416 | 420 | ||
417 | iwl_trans_wowlan_suspend(trans(priv)); | 421 | iwl_trans_wowlan_suspend(priv->trans); |
418 | 422 | ||
419 | goto out; | 423 | goto out; |
420 | 424 | ||
@@ -441,19 +445,19 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) | |||
441 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 445 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
442 | mutex_lock(&priv->mutex); | 446 | mutex_lock(&priv->mutex); |
443 | 447 | ||
444 | iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, | 448 | iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, |
445 | CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); | 449 | CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); |
446 | 450 | ||
447 | base = priv->device_pointers.error_event_table; | 451 | base = priv->device_pointers.error_event_table; |
448 | if (iwlagn_hw_valid_rtc_data_addr(base)) { | 452 | if (iwlagn_hw_valid_rtc_data_addr(base)) { |
449 | spin_lock_irqsave(&trans(priv)->reg_lock, flags); | 453 | spin_lock_irqsave(&priv->trans->reg_lock, flags); |
450 | ret = iwl_grab_nic_access_silent(trans(priv)); | 454 | ret = iwl_grab_nic_access_silent(priv->trans); |
451 | if (likely(ret == 0)) { | 455 | if (likely(ret == 0)) { |
452 | iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, base); | 456 | iwl_write32(priv->trans, HBUS_TARG_MEM_RADDR, base); |
453 | status = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); | 457 | status = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); |
454 | iwl_release_nic_access(trans(priv)); | 458 | iwl_release_nic_access(priv->trans); |
455 | } | 459 | } |
456 | spin_unlock_irqrestore(&trans(priv)->reg_lock, flags); | 460 | spin_unlock_irqrestore(&priv->trans->reg_lock, flags); |
457 | 461 | ||
458 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 462 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
459 | if (ret == 0) { | 463 | if (ret == 0) { |
@@ -468,7 +472,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) | |||
468 | 472 | ||
469 | if (priv->wowlan_sram) | 473 | if (priv->wowlan_sram) |
470 | _iwl_read_targ_mem_words( | 474 | _iwl_read_targ_mem_words( |
471 | trans(priv), 0x800000, | 475 | priv->trans, 0x800000, |
472 | priv->wowlan_sram, | 476 | priv->wowlan_sram, |
473 | img->sec[IWL_UCODE_SECTION_DATA].len / 4); | 477 | img->sec[IWL_UCODE_SECTION_DATA].len / 4); |
474 | } | 478 | } |
@@ -480,7 +484,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) | |||
480 | 484 | ||
481 | priv->wowlan = false; | 485 | priv->wowlan = false; |
482 | 486 | ||
483 | device_set_wakeup_enable(trans(priv)->dev, false); | 487 | device_set_wakeup_enable(priv->trans->dev, false); |
484 | 488 | ||
485 | iwlagn_prepare_restart(priv); | 489 | iwlagn_prepare_restart(priv); |
486 | 490 | ||
@@ -533,7 +537,7 @@ int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
533 | 537 | ||
534 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 538 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
535 | 539 | ||
536 | if (iwlagn_mod_params.sw_crypto) { | 540 | if (iwlwifi_mod_params.sw_crypto) { |
537 | IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); | 541 | IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); |
538 | return -EOPNOTSUPP; | 542 | return -EOPNOTSUPP; |
539 | } | 543 | } |
@@ -644,7 +648,7 @@ int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | |||
644 | 648 | ||
645 | switch (action) { | 649 | switch (action) { |
646 | case IEEE80211_AMPDU_RX_START: | 650 | case IEEE80211_AMPDU_RX_START: |
647 | if (iwlagn_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) | 651 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) |
648 | break; | 652 | break; |
649 | IWL_DEBUG_HT(priv, "start Rx\n"); | 653 | IWL_DEBUG_HT(priv, "start Rx\n"); |
650 | ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); | 654 | ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); |
@@ -654,9 +658,9 @@ int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | |||
654 | ret = iwl_sta_rx_agg_stop(priv, sta, tid); | 658 | ret = iwl_sta_rx_agg_stop(priv, sta, tid); |
655 | break; | 659 | break; |
656 | case IEEE80211_AMPDU_TX_START: | 660 | case IEEE80211_AMPDU_TX_START: |
657 | if (!trans(priv)->ops->tx_agg_setup) | 661 | if (!priv->trans->ops->tx_agg_setup) |
658 | break; | 662 | break; |
659 | if (iwlagn_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) | 663 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) |
660 | break; | 664 | break; |
661 | IWL_DEBUG_HT(priv, "start Tx\n"); | 665 | IWL_DEBUG_HT(priv, "start Tx\n"); |
662 | ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); | 666 | ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); |
@@ -895,7 +899,6 @@ void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, | |||
895 | iwl_set_rxon_ht(priv, ht_conf); | 899 | iwl_set_rxon_ht(priv, ht_conf); |
896 | iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); | 900 | iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); |
897 | 901 | ||
898 | iwl_set_rate(priv); | ||
899 | /* | 902 | /* |
900 | * at this point, staging_rxon has the | 903 | * at this point, staging_rxon has the |
901 | * configuration for channel switch | 904 | * configuration for channel switch |
@@ -1006,7 +1009,7 @@ void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) | |||
1006 | } | 1009 | } |
1007 | } | 1010 | } |
1008 | IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); | 1011 | IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); |
1009 | iwl_trans_wait_tx_queue_empty(trans(priv)); | 1012 | iwl_trans_wait_tx_queue_empty(priv->trans); |
1010 | done: | 1013 | done: |
1011 | mutex_unlock(&priv->mutex); | 1014 | mutex_unlock(&priv->mutex); |
1012 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1015 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -1130,8 +1133,8 @@ void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw, | |||
1130 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 1133 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
1131 | mutex_lock(&priv->mutex); | 1134 | mutex_lock(&priv->mutex); |
1132 | 1135 | ||
1133 | if (cfg(priv)->bt_params && | 1136 | if (priv->cfg->bt_params && |
1134 | cfg(priv)->bt_params->advanced_bt_coexist) { | 1137 | priv->cfg->bt_params->advanced_bt_coexist) { |
1135 | if (rssi_event == RSSI_EVENT_LOW) | 1138 | if (rssi_event == RSSI_EVENT_LOW) |
1136 | priv->bt_enable_pspoll = true; | 1139 | priv->bt_enable_pspoll = true; |
1137 | else if (rssi_event == RSSI_EVENT_HIGH) | 1140 | else if (rssi_event == RSSI_EVENT_HIGH) |
@@ -1220,7 +1223,7 @@ static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
1220 | int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | 1223 | int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
1221 | { | 1224 | { |
1222 | struct ieee80211_vif *vif = ctx->vif; | 1225 | struct ieee80211_vif *vif = ctx->vif; |
1223 | int err; | 1226 | int err, ac; |
1224 | 1227 | ||
1225 | lockdep_assert_held(&priv->mutex); | 1228 | lockdep_assert_held(&priv->mutex); |
1226 | 1229 | ||
@@ -1240,7 +1243,7 @@ int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
1240 | return err; | 1243 | return err; |
1241 | } | 1244 | } |
1242 | 1245 | ||
1243 | if (cfg(priv)->bt_params && cfg(priv)->bt_params->advanced_bt_coexist && | 1246 | if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist && |
1244 | vif->type == NL80211_IFTYPE_ADHOC) { | 1247 | vif->type == NL80211_IFTYPE_ADHOC) { |
1245 | /* | 1248 | /* |
1246 | * pretend to have high BT traffic as long as we | 1249 | * pretend to have high BT traffic as long as we |
@@ -1250,11 +1253,20 @@ int iwl_setup_interface(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
1250 | priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; | 1253 | priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; |
1251 | } | 1254 | } |
1252 | 1255 | ||
1256 | /* set up queue mappings */ | ||
1257 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) | ||
1258 | vif->hw_queue[ac] = ctx->ac_to_queue[ac]; | ||
1259 | |||
1260 | if (vif->type == NL80211_IFTYPE_AP) | ||
1261 | vif->cab_queue = ctx->mcast_queue; | ||
1262 | else | ||
1263 | vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; | ||
1264 | |||
1253 | return 0; | 1265 | return 0; |
1254 | } | 1266 | } |
1255 | 1267 | ||
1256 | static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | 1268 | static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, |
1257 | struct ieee80211_vif *vif) | 1269 | struct ieee80211_vif *vif) |
1258 | { | 1270 | { |
1259 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 1271 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
1260 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | 1272 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h index 35bd83ce3dae..558b2e63c5cf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h | |||
@@ -68,42 +68,16 @@ | |||
68 | #include <linux/gfp.h> | 68 | #include <linux/gfp.h> |
69 | #include <net/mac80211.h> | 69 | #include <net/mac80211.h> |
70 | 70 | ||
71 | #include "iwl-commands.h" | 71 | extern struct iwl_mod_params iwlwifi_mod_params; |
72 | #include "iwl-fw.h" | ||
73 | #include "iwl-config.h" | ||
74 | 72 | ||
75 | /** | 73 | enum iwl_power_level { |
76 | * DOC: shared area - role and goal | 74 | IWL_POWER_INDEX_1, |
77 | * | 75 | IWL_POWER_INDEX_2, |
78 | * The shared area contains all the data exported by the upper layer to the | 76 | IWL_POWER_INDEX_3, |
79 | * other layers. Since the bus and transport layer shouldn't dereference | 77 | IWL_POWER_INDEX_4, |
80 | * iwl_priv, all the data needed by the upper layer and the transport / bus | 78 | IWL_POWER_INDEX_5, |
81 | * layer must be here. | 79 | IWL_POWER_NUM |
82 | * The shared area also holds pointer to all the other layers. This allows a | 80 | }; |
83 | * layer to call a function from another layer. | ||
84 | * | ||
85 | * NOTE: All the layers hold a pointer to the shared area which must be shrd. | ||
86 | * A few macros assume that (_m)->shrd points to the shared area no matter | ||
87 | * what _m is. | ||
88 | * | ||
89 | * gets notifications about enumeration, suspend, resume. | ||
90 | * For the moment, the bus layer is not a linux kernel module as itself, and | ||
91 | * the module_init function of the driver must call the bus specific | ||
92 | * registration functions. These functions are listed at the end of this file. | ||
93 | * For the moment, there is only one implementation of this interface: PCI-e. | ||
94 | * This implementation is iwl-pci.c | ||
95 | */ | ||
96 | |||
97 | struct iwl_priv; | ||
98 | struct iwl_trans; | ||
99 | struct iwl_trans_ops; | ||
100 | |||
101 | #define DRV_NAME "iwlwifi" | ||
102 | #define IWLWIFI_VERSION "in-tree:" | ||
103 | #define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation" | ||
104 | #define DRV_AUTHOR "<ilw@linux.intel.com>" | ||
105 | |||
106 | extern struct iwl_mod_params iwlagn_mod_params; | ||
107 | 81 | ||
108 | #define IWL_DISABLE_HT_ALL BIT(0) | 82 | #define IWL_DISABLE_HT_ALL BIT(0) |
109 | #define IWL_DISABLE_HT_TXAGG BIT(1) | 83 | #define IWL_DISABLE_HT_TXAGG BIT(1) |
@@ -147,38 +121,4 @@ struct iwl_mod_params { | |||
147 | bool auto_agg; | 121 | bool auto_agg; |
148 | }; | 122 | }; |
149 | 123 | ||
150 | /** | ||
151 | * struct iwl_shared - shared fields for all the layers of the driver | ||
152 | * | ||
153 | * @wowlan: are we running wowlan uCode | ||
154 | * @bus: pointer to the bus layer data | ||
155 | * @cfg: see struct iwl_cfg | ||
156 | * @priv: pointer to the upper layer data | ||
157 | * @trans: pointer to the transport layer data | ||
158 | * @nic: pointer to the nic data | ||
159 | * @lock: protect general shared data | ||
160 | * @eeprom: pointer to the eeprom/OTP image | ||
161 | */ | ||
162 | struct iwl_shared { | ||
163 | const struct iwl_cfg *cfg; | ||
164 | struct iwl_trans *trans; | ||
165 | void *drv; | ||
166 | }; | ||
167 | |||
168 | /*Whatever _m is (iwl_trans, iwl_priv, these macros will work */ | ||
169 | #define cfg(_m) ((_m)->shrd->cfg) | ||
170 | #define trans(_m) ((_m)->shrd->trans) | ||
171 | |||
172 | static inline bool iwl_have_debug_level(u32 level) | ||
173 | { | ||
174 | return iwlagn_mod_params.debug_level & level; | ||
175 | } | ||
176 | |||
177 | enum iwl_rxon_context_id { | ||
178 | IWL_RXON_CTX_BSS, | ||
179 | IWL_RXON_CTX_PAN, | ||
180 | |||
181 | NUM_IWL_RXON_CTX | ||
182 | }; | ||
183 | |||
184 | #endif /* #__iwl_shared_h__ */ | 124 | #endif /* #__iwl_shared_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h index ca947aebb727..4ef742b28e08 100644 --- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h | |||
@@ -69,6 +69,7 @@ struct sk_buff; | |||
69 | struct iwl_device_cmd; | 69 | struct iwl_device_cmd; |
70 | struct iwl_rx_cmd_buffer; | 70 | struct iwl_rx_cmd_buffer; |
71 | struct iwl_fw; | 71 | struct iwl_fw; |
72 | struct iwl_cfg; | ||
72 | 73 | ||
73 | /** | 74 | /** |
74 | * DOC: Operational mode - what is it ? | 75 | * DOC: Operational mode - what is it ? |
@@ -129,6 +130,7 @@ struct iwl_fw; | |||
129 | */ | 130 | */ |
130 | struct iwl_op_mode_ops { | 131 | struct iwl_op_mode_ops { |
131 | struct iwl_op_mode *(*start)(struct iwl_trans *trans, | 132 | struct iwl_op_mode *(*start)(struct iwl_trans *trans, |
133 | const struct iwl_cfg *cfg, | ||
132 | const struct iwl_fw *fw); | 134 | const struct iwl_fw *fw); |
133 | void (*stop)(struct iwl_op_mode *op_mode); | 135 | void (*stop)(struct iwl_op_mode *op_mode); |
134 | int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, | 136 | int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index 754001581340..0c8a1c2d8847 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -67,11 +67,11 @@ | |||
67 | #include <linux/pci.h> | 67 | #include <linux/pci.h> |
68 | #include <linux/pci-aspm.h> | 68 | #include <linux/pci-aspm.h> |
69 | 69 | ||
70 | #include "iwl-shared.h" | ||
71 | #include "iwl-trans.h" | 70 | #include "iwl-trans.h" |
72 | #include "iwl-cfg.h" | 71 | #include "iwl-cfg.h" |
73 | #include "iwl-drv.h" | 72 | #include "iwl-drv.h" |
74 | #include "iwl-trans.h" | 73 | #include "iwl-trans.h" |
74 | #include "iwl-trans-pcie-int.h" | ||
75 | 75 | ||
76 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ | 76 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ |
77 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | 77 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ |
@@ -262,61 +262,46 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | |||
262 | /* PCI registers */ | 262 | /* PCI registers */ |
263 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | 263 | #define PCI_CFG_RETRY_TIMEOUT 0x041 |
264 | 264 | ||
265 | #ifndef CONFIG_IWLWIFI_IDI | ||
266 | |||
265 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 267 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
266 | { | 268 | { |
267 | const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 269 | const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
268 | struct iwl_shared *shrd; | ||
269 | struct iwl_trans *iwl_trans; | 270 | struct iwl_trans *iwl_trans; |
270 | int err; | 271 | struct iwl_trans_pcie *trans_pcie; |
271 | |||
272 | shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL); | ||
273 | if (!shrd) { | ||
274 | dev_printk(KERN_ERR, &pdev->dev, | ||
275 | "Couldn't allocate iwl_shared"); | ||
276 | err = -ENOMEM; | ||
277 | goto out_free_bus; | ||
278 | } | ||
279 | 272 | ||
280 | #ifdef CONFIG_IWLWIFI_IDI | 273 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); |
281 | iwl_trans = iwl_trans_idi_alloc(shrd, pdev, ent); | 274 | if (iwl_trans == NULL) |
282 | #else | 275 | return -ENOMEM; |
283 | iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent); | ||
284 | #endif | ||
285 | if (iwl_trans == NULL) { | ||
286 | err = -ENOMEM; | ||
287 | goto out_free_bus; | ||
288 | } | ||
289 | 276 | ||
290 | shrd->trans = iwl_trans; | ||
291 | pci_set_drvdata(pdev, iwl_trans); | 277 | pci_set_drvdata(pdev, iwl_trans); |
292 | 278 | ||
293 | err = iwl_drv_start(shrd, iwl_trans, cfg); | 279 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); |
294 | if (err) | 280 | trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); |
281 | if (!trans_pcie->drv) | ||
295 | goto out_free_trans; | 282 | goto out_free_trans; |
296 | 283 | ||
297 | return 0; | 284 | return 0; |
298 | 285 | ||
299 | out_free_trans: | 286 | out_free_trans: |
300 | iwl_trans_free(iwl_trans); | 287 | iwl_trans_pcie_free(iwl_trans); |
301 | pci_set_drvdata(pdev, NULL); | 288 | pci_set_drvdata(pdev, NULL); |
302 | out_free_bus: | 289 | return -EFAULT; |
303 | kfree(shrd); | ||
304 | return err; | ||
305 | } | 290 | } |
306 | 291 | ||
307 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) | 292 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) |
308 | { | 293 | { |
309 | struct iwl_trans *iwl_trans = pci_get_drvdata(pdev); | 294 | struct iwl_trans *trans = pci_get_drvdata(pdev); |
310 | struct iwl_shared *shrd = iwl_trans->shrd; | 295 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
311 | 296 | ||
312 | iwl_drv_stop(shrd); | 297 | iwl_drv_stop(trans_pcie->drv); |
313 | iwl_trans_free(shrd->trans); | 298 | iwl_trans_pcie_free(trans); |
314 | 299 | ||
315 | pci_set_drvdata(pdev, NULL); | 300 | pci_set_drvdata(pdev, NULL); |
316 | |||
317 | kfree(shrd); | ||
318 | } | 301 | } |
319 | 302 | ||
303 | #endif /* CONFIG_IWLWIFI_IDI */ | ||
304 | |||
320 | #ifdef CONFIG_PM_SLEEP | 305 | #ifdef CONFIG_PM_SLEEP |
321 | 306 | ||
322 | static int iwl_pci_suspend(struct device *device) | 307 | static int iwl_pci_suspend(struct device *device) |
@@ -361,6 +346,15 @@ static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); | |||
361 | 346 | ||
362 | #endif | 347 | #endif |
363 | 348 | ||
349 | #ifdef CONFIG_IWLWIFI_IDI | ||
350 | /* | ||
351 | * Defined externally in iwl-idi.c | ||
352 | */ | ||
353 | int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | ||
354 | void __devexit iwl_pci_remove(struct pci_dev *pdev); | ||
355 | |||
356 | #endif /* CONFIG_IWLWIFI_IDI */ | ||
357 | |||
364 | static struct pci_driver iwl_pci_driver = { | 358 | static struct pci_driver iwl_pci_driver = { |
365 | .name = DRV_NAME, | 359 | .name = DRV_NAME, |
366 | .id_table = iwl_hw_card_ids, | 360 | .id_table = iwl_hw_card_ids, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/iwlwifi/iwl-phy-db.c index 1a791af82d15..f166955340fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c +++ b/drivers/net/wireless/iwlwifi/iwl-phy-db.c | |||
@@ -65,14 +65,13 @@ | |||
65 | #include <linux/string.h> | 65 | #include <linux/string.h> |
66 | 66 | ||
67 | #include "iwl-debug.h" | 67 | #include "iwl-debug.h" |
68 | #include "iwl-shared.h" | ||
69 | #include "iwl-dev.h" | 68 | #include "iwl-dev.h" |
70 | 69 | ||
71 | #include "iwl-phy-db.h" | 70 | #include "iwl-phy-db.h" |
72 | 71 | ||
73 | #define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */ | 72 | #define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */ |
74 | 73 | ||
75 | struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd) | 74 | struct iwl_phy_db *iwl_phy_db_init(struct device *dev) |
76 | { | 75 | { |
77 | struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db), | 76 | struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db), |
78 | GFP_KERNEL); | 77 | GFP_KERNEL); |
@@ -80,7 +79,7 @@ struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd) | |||
80 | if (!phy_db) | 79 | if (!phy_db) |
81 | return phy_db; | 80 | return phy_db; |
82 | 81 | ||
83 | phy_db->shrd = shrd; | 82 | phy_db->dev = dev; |
84 | 83 | ||
85 | /* TODO: add default values of the phy db. */ | 84 | /* TODO: add default values of the phy db. */ |
86 | return phy_db; | 85 | return phy_db; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.h b/drivers/net/wireless/iwlwifi/iwl-phy-db.h index 5e86305de66a..c34c6a9303ab 100644 --- a/drivers/net/wireless/iwlwifi/iwl-phy-db.h +++ b/drivers/net/wireless/iwlwifi/iwl-phy-db.h | |||
@@ -96,7 +96,7 @@ struct iwl_phy_db { | |||
96 | u32 channel_size; | 96 | u32 channel_size; |
97 | 97 | ||
98 | /* for an access to the logger */ | 98 | /* for an access to the logger */ |
99 | const struct iwl_shared *shrd; | 99 | struct device *dev; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | enum iwl_phy_db_section_type { | 102 | enum iwl_phy_db_section_type { |
@@ -114,7 +114,7 @@ struct iwl_phy_db_chg_txp { | |||
114 | __le16 max_channel_idx; | 114 | __le16 max_channel_idx; |
115 | } __packed; | 115 | } __packed; |
116 | 116 | ||
117 | struct iwl_phy_db *iwl_phy_db_init(struct iwl_shared *shrd); | 117 | struct iwl_phy_db *iwl_phy_db_init(struct device *dev); |
118 | 118 | ||
119 | void iwl_phy_db_free(struct iwl_phy_db *phy_db); | 119 | void iwl_phy_db_free(struct iwl_phy_db *phy_db); |
120 | 120 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 174a0f737214..8352265dbc4b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -37,13 +37,12 @@ | |||
37 | #include "iwl-eeprom.h" | 37 | #include "iwl-eeprom.h" |
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-agn.h" | 39 | #include "iwl-agn.h" |
40 | #include "iwl-core.h" | ||
41 | #include "iwl-io.h" | 40 | #include "iwl-io.h" |
42 | #include "iwl-commands.h" | 41 | #include "iwl-commands.h" |
43 | #include "iwl-debug.h" | 42 | #include "iwl-debug.h" |
44 | #include "iwl-power.h" | 43 | #include "iwl-power.h" |
45 | #include "iwl-trans.h" | 44 | #include "iwl-trans.h" |
46 | #include "iwl-shared.h" | 45 | #include "iwl-modparams.h" |
47 | 46 | ||
48 | /* | 47 | /* |
49 | * Setting power level allows the card to go to sleep when not busy. | 48 | * Setting power level allows the card to go to sleep when not busy. |
@@ -167,7 +166,7 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv, | |||
167 | u8 skip; | 166 | u8 skip; |
168 | u32 slp_itrvl; | 167 | u32 slp_itrvl; |
169 | 168 | ||
170 | if (cfg(priv)->adv_pm) { | 169 | if (priv->cfg->adv_pm) { |
171 | table = apm_range_2; | 170 | table = apm_range_2; |
172 | if (period <= IWL_DTIM_RANGE_1_MAX) | 171 | if (period <= IWL_DTIM_RANGE_1_MAX) |
173 | table = apm_range_1; | 172 | table = apm_range_1; |
@@ -215,13 +214,13 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv, | |||
215 | else | 214 | else |
216 | cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK; | 215 | cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK; |
217 | 216 | ||
218 | if (cfg(priv)->base_params->shadow_reg_enable) | 217 | if (priv->cfg->base_params->shadow_reg_enable) |
219 | cmd->flags |= IWL_POWER_SHADOW_REG_ENA; | 218 | cmd->flags |= IWL_POWER_SHADOW_REG_ENA; |
220 | else | 219 | else |
221 | cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; | 220 | cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; |
222 | 221 | ||
223 | if (iwl_advanced_bt_coexist(priv)) { | 222 | if (iwl_advanced_bt_coexist(priv)) { |
224 | if (!cfg(priv)->bt_params->bt_sco_disable) | 223 | if (!priv->cfg->bt_params->bt_sco_disable) |
225 | cmd->flags |= IWL_POWER_BT_SCO_ENA; | 224 | cmd->flags |= IWL_POWER_BT_SCO_ENA; |
226 | else | 225 | else |
227 | cmd->flags &= ~IWL_POWER_BT_SCO_ENA; | 226 | cmd->flags &= ~IWL_POWER_BT_SCO_ENA; |
@@ -295,7 +294,7 @@ static void iwl_power_build_cmd(struct iwl_priv *priv, | |||
295 | 294 | ||
296 | if (priv->wowlan) | 295 | if (priv->wowlan) |
297 | iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper); | 296 | iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper); |
298 | else if (!cfg(priv)->base_params->no_idle_support && | 297 | else if (!priv->cfg->base_params->no_idle_support && |
299 | priv->hw->conf.flags & IEEE80211_CONF_IDLE) | 298 | priv->hw->conf.flags & IEEE80211_CONF_IDLE) |
300 | iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20); | 299 | iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20); |
301 | else if (iwl_tt_is_low_power_state(priv)) { | 300 | else if (iwl_tt_is_low_power_state(priv)) { |
@@ -309,10 +308,10 @@ static void iwl_power_build_cmd(struct iwl_priv *priv, | |||
309 | priv->power_data.debug_sleep_level_override, | 308 | priv->power_data.debug_sleep_level_override, |
310 | dtimper); | 309 | dtimper); |
311 | else { | 310 | else { |
312 | if (iwlagn_mod_params.power_level > IWL_POWER_INDEX_1 && | 311 | if (iwlwifi_mod_params.power_level > IWL_POWER_INDEX_1 && |
313 | iwlagn_mod_params.power_level <= IWL_POWER_INDEX_5) | 312 | iwlwifi_mod_params.power_level <= IWL_POWER_INDEX_5) |
314 | iwl_static_sleep_cmd(priv, cmd, | 313 | iwl_static_sleep_cmd(priv, cmd, |
315 | iwlagn_mod_params.power_level, dtimper); | 314 | iwlwifi_mod_params.power_level, dtimper); |
316 | else | 315 | else |
317 | iwl_static_sleep_cmd(priv, cmd, | 316 | iwl_static_sleep_cmd(priv, cmd, |
318 | IWL_POWER_INDEX_1, dtimper); | 317 | IWL_POWER_INDEX_1, dtimper); |
@@ -378,7 +377,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
378 | /* initialize to default */ | 377 | /* initialize to default */ |
379 | void iwl_power_initialize(struct iwl_priv *priv) | 378 | void iwl_power_initialize(struct iwl_priv *priv) |
380 | { | 379 | { |
381 | priv->power_data.bus_pm = trans(priv)->pm_support; | 380 | priv->power_data.bus_pm = priv->trans->pm_support; |
382 | 381 | ||
383 | priv->power_data.debug_sleep_level_override = -1; | 382 | priv->power_data.debug_sleep_level_override = -1; |
384 | 383 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h index 07a19fce5fdc..21afc92efacb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.h +++ b/drivers/net/wireless/iwlwifi/iwl-power.h | |||
@@ -30,15 +30,6 @@ | |||
30 | 30 | ||
31 | #include "iwl-commands.h" | 31 | #include "iwl-commands.h" |
32 | 32 | ||
33 | enum iwl_power_level { | ||
34 | IWL_POWER_INDEX_1, | ||
35 | IWL_POWER_INDEX_2, | ||
36 | IWL_POWER_INDEX_3, | ||
37 | IWL_POWER_INDEX_4, | ||
38 | IWL_POWER_INDEX_5, | ||
39 | IWL_POWER_NUM | ||
40 | }; | ||
41 | |||
42 | struct iwl_power_mgr { | 33 | struct iwl_power_mgr { |
43 | struct iwl_powertable_cmd sleep_cmd; | 34 | struct iwl_powertable_cmd sleep_cmd; |
44 | struct iwl_powertable_cmd sleep_cmd_next; | 35 | struct iwl_powertable_cmd sleep_cmd_next; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 490a60d8ad7d..a8437a6bc18e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -32,7 +32,6 @@ | |||
32 | 32 | ||
33 | #include "iwl-eeprom.h" | 33 | #include "iwl-eeprom.h" |
34 | #include "iwl-dev.h" | 34 | #include "iwl-dev.h" |
35 | #include "iwl-core.h" | ||
36 | #include "iwl-io.h" | 35 | #include "iwl-io.h" |
37 | #include "iwl-agn.h" | 36 | #include "iwl-agn.h" |
38 | #include "iwl-trans.h" | 37 | #include "iwl-trans.h" |
@@ -791,8 +790,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
791 | * Internal scans are passive, so we can indiscriminately set | 790 | * Internal scans are passive, so we can indiscriminately set |
792 | * the BT ignore flag on 2.4 GHz since it applies to TX only. | 791 | * the BT ignore flag on 2.4 GHz since it applies to TX only. |
793 | */ | 792 | */ |
794 | if (cfg(priv)->bt_params && | 793 | if (priv->cfg->bt_params && |
795 | cfg(priv)->bt_params->advanced_bt_coexist) | 794 | priv->cfg->bt_params->advanced_bt_coexist) |
796 | scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT; | 795 | scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT; |
797 | break; | 796 | break; |
798 | case IEEE80211_BAND_5GHZ: | 797 | case IEEE80211_BAND_5GHZ: |
@@ -834,8 +833,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
834 | band = priv->scan_band; | 833 | band = priv->scan_band; |
835 | 834 | ||
836 | if (band == IEEE80211_BAND_2GHZ && | 835 | if (band == IEEE80211_BAND_2GHZ && |
837 | cfg(priv)->bt_params && | 836 | priv->cfg->bt_params && |
838 | cfg(priv)->bt_params->advanced_bt_coexist) { | 837 | priv->cfg->bt_params->advanced_bt_coexist) { |
839 | /* transmit 2.4 GHz probes only on first antenna */ | 838 | /* transmit 2.4 GHz probes only on first antenna */ |
840 | scan_tx_antennas = first_antenna(scan_tx_antennas); | 839 | scan_tx_antennas = first_antenna(scan_tx_antennas); |
841 | } | 840 | } |
@@ -863,8 +862,8 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
863 | 862 | ||
864 | rx_ant = first_antenna(active_chains); | 863 | rx_ant = first_antenna(active_chains); |
865 | } | 864 | } |
866 | if (cfg(priv)->bt_params && | 865 | if (priv->cfg->bt_params && |
867 | cfg(priv)->bt_params->advanced_bt_coexist && | 866 | priv->cfg->bt_params->advanced_bt_coexist && |
868 | priv->bt_full_concurrent) { | 867 | priv->bt_full_concurrent) { |
869 | /* operated as 1x1 in full concurrency mode */ | 868 | /* operated as 1x1 in full concurrency mode */ |
870 | rx_ant = first_antenna(rx_ant); | 869 | rx_ant = first_antenna(rx_ant); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c index bb275098bb10..060aac3e22f1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-testmode.c +++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c | |||
@@ -71,7 +71,6 @@ | |||
71 | #include <net/netlink.h> | 71 | #include <net/netlink.h> |
72 | 72 | ||
73 | #include "iwl-dev.h" | 73 | #include "iwl-dev.h" |
74 | #include "iwl-core.h" | ||
75 | #include "iwl-debug.h" | 74 | #include "iwl-debug.h" |
76 | #include "iwl-io.h" | 75 | #include "iwl-io.h" |
77 | #include "iwl-agn.h" | 76 | #include "iwl-agn.h" |
@@ -219,7 +218,7 @@ static void iwl_trace_cleanup(struct iwl_priv *priv) | |||
219 | if (priv->testmode_trace.trace_enabled) { | 218 | if (priv->testmode_trace.trace_enabled) { |
220 | if (priv->testmode_trace.cpu_addr && | 219 | if (priv->testmode_trace.cpu_addr && |
221 | priv->testmode_trace.dma_addr) | 220 | priv->testmode_trace.dma_addr) |
222 | dma_free_coherent(trans(priv)->dev, | 221 | dma_free_coherent(priv->trans->dev, |
223 | priv->testmode_trace.total_size, | 222 | priv->testmode_trace.total_size, |
224 | priv->testmode_trace.cpu_addr, | 223 | priv->testmode_trace.cpu_addr, |
225 | priv->testmode_trace.dma_addr); | 224 | priv->testmode_trace.dma_addr); |
@@ -373,7 +372,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) | |||
373 | 372 | ||
374 | switch (cmd) { | 373 | switch (cmd) { |
375 | case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: | 374 | case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: |
376 | val32 = iwl_read_direct32(trans(priv), ofs); | 375 | val32 = iwl_read_direct32(priv->trans, ofs); |
377 | IWL_INFO(priv, "32bit value to read 0x%x\n", val32); | 376 | IWL_INFO(priv, "32bit value to read 0x%x\n", val32); |
378 | 377 | ||
379 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); | 378 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); |
@@ -394,7 +393,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) | |||
394 | } else { | 393 | } else { |
395 | val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]); | 394 | val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]); |
396 | IWL_INFO(priv, "32bit value to write 0x%x\n", val32); | 395 | IWL_INFO(priv, "32bit value to write 0x%x\n", val32); |
397 | iwl_write_direct32(trans(priv), ofs, val32); | 396 | iwl_write_direct32(priv->trans, ofs, val32); |
398 | } | 397 | } |
399 | break; | 398 | break; |
400 | case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: | 399 | case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: |
@@ -404,7 +403,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) | |||
404 | } else { | 403 | } else { |
405 | val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]); | 404 | val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]); |
406 | IWL_INFO(priv, "8bit value to write 0x%x\n", val8); | 405 | IWL_INFO(priv, "8bit value to write 0x%x\n", val8); |
407 | iwl_write8(trans(priv), ofs, val8); | 406 | iwl_write8(priv->trans, ofs, val8); |
408 | } | 407 | } |
409 | break; | 408 | break; |
410 | default: | 409 | default: |
@@ -467,7 +466,7 @@ cfg_init_calib_error: | |||
467 | static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | 466 | static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) |
468 | { | 467 | { |
469 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 468 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
470 | struct iwl_trans *trans = trans(priv); | 469 | struct iwl_trans *trans = priv->trans; |
471 | struct sk_buff *skb; | 470 | struct sk_buff *skb; |
472 | unsigned char *rsp_data_ptr = NULL; | 471 | unsigned char *rsp_data_ptr = NULL; |
473 | int status = 0, rsp_data_len = 0; | 472 | int status = 0, rsp_data_len = 0; |
@@ -476,8 +475,8 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
476 | 475 | ||
477 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { | 476 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { |
478 | case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: | 477 | case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: |
479 | rsp_data_ptr = (unsigned char *)cfg(priv)->name; | 478 | rsp_data_ptr = (unsigned char *)priv->cfg->name; |
480 | rsp_data_len = strlen(cfg(priv)->name); | 479 | rsp_data_len = strlen(priv->cfg->name); |
481 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, | 480 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, |
482 | rsp_data_len + 20); | 481 | rsp_data_len + 20); |
483 | if (!skb) { | 482 | if (!skb) { |
@@ -538,7 +537,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
538 | case IWL_TM_CMD_APP2DEV_GET_EEPROM: | 537 | case IWL_TM_CMD_APP2DEV_GET_EEPROM: |
539 | if (priv->eeprom) { | 538 | if (priv->eeprom) { |
540 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, | 539 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, |
541 | cfg(priv)->base_params->eeprom_size + 20); | 540 | priv->cfg->base_params->eeprom_size + 20); |
542 | if (!skb) { | 541 | if (!skb) { |
543 | IWL_ERR(priv, "Memory allocation fail\n"); | 542 | IWL_ERR(priv, "Memory allocation fail\n"); |
544 | return -ENOMEM; | 543 | return -ENOMEM; |
@@ -546,7 +545,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
546 | if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, | 545 | if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, |
547 | IWL_TM_CMD_DEV2APP_EEPROM_RSP) || | 546 | IWL_TM_CMD_DEV2APP_EEPROM_RSP) || |
548 | nla_put(skb, IWL_TM_ATTR_EEPROM, | 547 | nla_put(skb, IWL_TM_ATTR_EEPROM, |
549 | cfg(priv)->base_params->eeprom_size, | 548 | priv->cfg->base_params->eeprom_size, |
550 | priv->eeprom)) | 549 | priv->eeprom)) |
551 | goto nla_put_failure; | 550 | goto nla_put_failure; |
552 | status = cfg80211_testmode_reply(skb); | 551 | status = cfg80211_testmode_reply(skb); |
@@ -583,7 +582,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
583 | break; | 582 | break; |
584 | 583 | ||
585 | case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: | 584 | case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: |
586 | devid = trans(priv)->hw_id; | 585 | devid = priv->trans->hw_id; |
587 | IWL_INFO(priv, "hw version: 0x%x\n", devid); | 586 | IWL_INFO(priv, "hw version: 0x%x\n", devid); |
588 | 587 | ||
589 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); | 588 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); |
@@ -650,7 +649,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) | |||
650 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 649 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
651 | struct sk_buff *skb; | 650 | struct sk_buff *skb; |
652 | int status = 0; | 651 | int status = 0; |
653 | struct device *dev = trans(priv)->dev; | 652 | struct device *dev = priv->trans->dev; |
654 | 653 | ||
655 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { | 654 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { |
656 | case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: | 655 | case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: |
@@ -792,7 +791,7 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb) | |||
792 | 791 | ||
793 | static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size) | 792 | static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size) |
794 | { | 793 | { |
795 | struct iwl_trans *trans = trans(priv); | 794 | struct iwl_trans *trans = priv->trans; |
796 | unsigned long flags; | 795 | unsigned long flags; |
797 | int i; | 796 | int i; |
798 | 797 | ||
@@ -832,7 +831,7 @@ static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size) | |||
832 | static int iwl_testmode_indirect_write(struct iwl_priv *priv, u32 addr, | 831 | static int iwl_testmode_indirect_write(struct iwl_priv *priv, u32 addr, |
833 | u32 size, unsigned char *buf) | 832 | u32 size, unsigned char *buf) |
834 | { | 833 | { |
835 | struct iwl_trans *trans = trans(priv); | 834 | struct iwl_trans *trans = priv->trans; |
836 | u32 val, i; | 835 | u32 val, i; |
837 | unsigned long flags; | 836 | unsigned long flags; |
838 | 837 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h index 70bdd0e2df38..6213c05a4b52 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #include "iwl-fh.h" | 39 | #include "iwl-fh.h" |
40 | #include "iwl-csr.h" | 40 | #include "iwl-csr.h" |
41 | #include "iwl-shared.h" | ||
42 | #include "iwl-trans.h" | 41 | #include "iwl-trans.h" |
43 | #include "iwl-debug.h" | 42 | #include "iwl-debug.h" |
44 | #include "iwl-io.h" | 43 | #include "iwl-io.h" |
@@ -180,30 +179,33 @@ struct iwl_queue { | |||
180 | * space less than this */ | 179 | * space less than this */ |
181 | }; | 180 | }; |
182 | 181 | ||
182 | #define TFD_TX_CMD_SLOTS 256 | ||
183 | #define TFD_CMD_SLOTS 32 | ||
184 | |||
185 | struct iwl_pcie_tx_queue_entry { | ||
186 | struct iwl_device_cmd *cmd; | ||
187 | struct sk_buff *skb; | ||
188 | struct iwl_cmd_meta meta; | ||
189 | }; | ||
190 | |||
183 | /** | 191 | /** |
184 | * struct iwl_tx_queue - Tx Queue for DMA | 192 | * struct iwl_tx_queue - Tx Queue for DMA |
185 | * @q: generic Rx/Tx queue descriptor | 193 | * @q: generic Rx/Tx queue descriptor |
186 | * @bd: base of circular buffer of TFDs | 194 | * @tfds: transmit frame descriptors (DMA memory) |
187 | * @cmd: array of command/TX buffer pointers | 195 | * @entries: transmit entries (driver state) |
188 | * @meta: array of meta data for each command/tx buffer | 196 | * @lock: queue lock |
189 | * @dma_addr_cmd: physical address of cmd/tx buffer array | 197 | * @stuck_timer: timer that fires if queue gets stuck |
190 | * @txb: array of per-TFD driver data | 198 | * @trans_pcie: pointer back to transport (for timer) |
191 | * lock: queue lock | ||
192 | * @time_stamp: time (in jiffies) of last read_ptr change | ||
193 | * @need_update: indicates need to update read/write index | 199 | * @need_update: indicates need to update read/write index |
200 | * @active: stores if queue is active | ||
194 | * | 201 | * |
195 | * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame | 202 | * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame |
196 | * descriptors) and required locking structures. | 203 | * descriptors) and required locking structures. |
197 | */ | 204 | */ |
198 | #define TFD_TX_CMD_SLOTS 256 | ||
199 | #define TFD_CMD_SLOTS 32 | ||
200 | |||
201 | struct iwl_tx_queue { | 205 | struct iwl_tx_queue { |
202 | struct iwl_queue q; | 206 | struct iwl_queue q; |
203 | struct iwl_tfd *tfds; | 207 | struct iwl_tfd *tfds; |
204 | struct iwl_device_cmd **cmd; | 208 | struct iwl_pcie_tx_queue_entry *entries; |
205 | struct iwl_cmd_meta *meta; | ||
206 | struct sk_buff **skbs; | ||
207 | spinlock_t lock; | 209 | spinlock_t lock; |
208 | struct timer_list stuck_timer; | 210 | struct timer_list stuck_timer; |
209 | struct iwl_trans_pcie *trans_pcie; | 211 | struct iwl_trans_pcie *trans_pcie; |
@@ -215,6 +217,7 @@ struct iwl_tx_queue { | |||
215 | * struct iwl_trans_pcie - PCIe transport specific data | 217 | * struct iwl_trans_pcie - PCIe transport specific data |
216 | * @rxq: all the RX queue data | 218 | * @rxq: all the RX queue data |
217 | * @rx_replenish: work that will be called when buffers need to be allocated | 219 | * @rx_replenish: work that will be called when buffers need to be allocated |
220 | * @drv - pointer to iwl_drv | ||
218 | * @trans: pointer to the generic transport area | 221 | * @trans: pointer to the generic transport area |
219 | * @irq - the irq number for the device | 222 | * @irq - the irq number for the device |
220 | * @irq_requested: true when the irq has been requested | 223 | * @irq_requested: true when the irq has been requested |
@@ -235,6 +238,7 @@ struct iwl_trans_pcie { | |||
235 | struct iwl_rx_queue rxq; | 238 | struct iwl_rx_queue rxq; |
236 | struct work_struct rx_replenish; | 239 | struct work_struct rx_replenish; |
237 | struct iwl_trans *trans; | 240 | struct iwl_trans *trans; |
241 | struct iwl_drv *drv; | ||
238 | 242 | ||
239 | /* INT ICT Table */ | 243 | /* INT ICT Table */ |
240 | __le32 *ict_tbl; | 244 | __le32 *ict_tbl; |
@@ -297,6 +301,11 @@ iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie) | |||
297 | trans_specific); | 301 | trans_specific); |
298 | } | 302 | } |
299 | 303 | ||
304 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | ||
305 | const struct pci_device_id *ent, | ||
306 | const struct iwl_cfg *cfg); | ||
307 | void iwl_trans_pcie_free(struct iwl_trans *trans); | ||
308 | |||
300 | /***************************************************** | 309 | /***************************************************** |
301 | * RX | 310 | * RX |
302 | ******************************************************/ | 311 | ******************************************************/ |
@@ -426,4 +435,10 @@ trans_pcie_get_cmd_string(struct iwl_trans_pcie *trans_pcie, u8 cmd) | |||
426 | return trans_pcie->command_names[cmd]; | 435 | return trans_pcie->command_names[cmd]; |
427 | } | 436 | } |
428 | 437 | ||
438 | static inline bool iwl_is_rfkill_set(struct iwl_trans *trans) | ||
439 | { | ||
440 | return !(iwl_read32(trans, CSR_GP_CNTRL) & | ||
441 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | ||
442 | } | ||
443 | |||
429 | #endif /* __iwl_trans_int_pcie_h__ */ | 444 | #endif /* __iwl_trans_int_pcie_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c index de78fb8dca9f..d2239aad7f11 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | |||
@@ -140,7 +140,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans, | |||
140 | if (q->need_update == 0) | 140 | if (q->need_update == 0) |
141 | goto exit_unlock; | 141 | goto exit_unlock; |
142 | 142 | ||
143 | if (cfg(trans)->base_params->shadow_reg_enable) { | 143 | if (trans->cfg->base_params->shadow_reg_enable) { |
144 | /* shadow register enabled */ | 144 | /* shadow register enabled */ |
145 | /* Device expects a multiple of 8 */ | 145 | /* Device expects a multiple of 8 */ |
146 | q->write_actual = (q->write & ~0x7); | 146 | q->write_actual = (q->write & ~0x7); |
@@ -425,7 +425,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, | |||
425 | cmd_index = get_cmd_index(&txq->q, index); | 425 | cmd_index = get_cmd_index(&txq->q, index); |
426 | 426 | ||
427 | if (reclaim) | 427 | if (reclaim) |
428 | cmd = txq->cmd[cmd_index]; | 428 | cmd = txq->entries[cmd_index].cmd; |
429 | else | 429 | else |
430 | cmd = NULL; | 430 | cmd = NULL; |
431 | 431 | ||
@@ -543,7 +543,7 @@ static void iwl_rx_handle(struct iwl_trans *trans) | |||
543 | static void iwl_irq_handle_error(struct iwl_trans *trans) | 543 | static void iwl_irq_handle_error(struct iwl_trans *trans) |
544 | { | 544 | { |
545 | /* W/A for WiFi/WiMAX coex and WiMAX own the RF */ | 545 | /* W/A for WiFi/WiMAX coex and WiMAX own the RF */ |
546 | if (cfg(trans)->internal_wimax_coex && | 546 | if (trans->cfg->internal_wimax_coex && |
547 | (!(iwl_read_prph(trans, APMG_CLK_CTRL_REG) & | 547 | (!(iwl_read_prph(trans, APMG_CLK_CTRL_REG) & |
548 | APMS_CLK_VAL_MRB_FUNC_MODE) || | 548 | APMS_CLK_VAL_MRB_FUNC_MODE) || |
549 | (iwl_read_prph(trans, APMG_PS_CTRL_REG) & | 549 | (iwl_read_prph(trans, APMG_PS_CTRL_REG) & |
@@ -648,8 +648,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans) | |||
648 | if (inta & CSR_INT_BIT_RF_KILL) { | 648 | if (inta & CSR_INT_BIT_RF_KILL) { |
649 | bool hw_rfkill; | 649 | bool hw_rfkill; |
650 | 650 | ||
651 | hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & | 651 | hw_rfkill = iwl_is_rfkill_set(trans); |
652 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | ||
653 | IWL_WARN(trans, "RF_KILL bit toggled to %s.\n", | 652 | IWL_WARN(trans, "RF_KILL bit toggled to %s.\n", |
654 | hw_rfkill ? "disable radio" : "enable radio"); | 653 | hw_rfkill ? "disable radio" : "enable radio"); |
655 | 654 | ||
@@ -680,7 +679,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans) | |||
680 | if (inta & CSR_INT_BIT_WAKEUP) { | 679 | if (inta & CSR_INT_BIT_WAKEUP) { |
681 | IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); | 680 | IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); |
682 | iwl_rx_queue_update_write_ptr(trans, &trans_pcie->rxq); | 681 | iwl_rx_queue_update_write_ptr(trans, &trans_pcie->rxq); |
683 | for (i = 0; i < cfg(trans)->base_params->num_of_queues; i++) | 682 | for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) |
684 | iwl_txq_update_write_ptr(trans, | 683 | iwl_txq_update_write_ptr(trans, |
685 | &trans_pcie->txq[i]); | 684 | &trans_pcie->txq[i]); |
686 | 685 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c index 918874067bd3..21a8a672fbb2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include "iwl-agn-hw.h" | 37 | #include "iwl-agn-hw.h" |
38 | #include "iwl-op-mode.h" | 38 | #include "iwl-op-mode.h" |
39 | #include "iwl-trans-pcie-int.h" | 39 | #include "iwl-trans-pcie-int.h" |
40 | /* FIXME: need to abstract out TX command (once we know what it looks like) */ | ||
41 | #include "iwl-commands.h" | ||
40 | 42 | ||
41 | #define IWL_TX_CRC_SIZE 4 | 43 | #define IWL_TX_CRC_SIZE 4 |
42 | #define IWL_TX_DELIMITER_SIZE 4 | 44 | #define IWL_TX_DELIMITER_SIZE 4 |
@@ -58,7 +60,7 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans, | |||
58 | u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | 60 | u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; |
59 | __le16 bc_ent; | 61 | __le16 bc_ent; |
60 | struct iwl_tx_cmd *tx_cmd = | 62 | struct iwl_tx_cmd *tx_cmd = |
61 | (struct iwl_tx_cmd *) txq->cmd[txq->q.write_ptr]->payload; | 63 | (void *) txq->entries[txq->q.write_ptr].cmd->payload; |
62 | 64 | ||
63 | scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; | 65 | scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; |
64 | 66 | ||
@@ -99,7 +101,7 @@ void iwl_txq_update_write_ptr(struct iwl_trans *trans, struct iwl_tx_queue *txq) | |||
99 | if (txq->need_update == 0) | 101 | if (txq->need_update == 0) |
100 | return; | 102 | return; |
101 | 103 | ||
102 | if (cfg(trans)->base_params->shadow_reg_enable) { | 104 | if (trans->cfg->base_params->shadow_reg_enable) { |
103 | /* shadow register enabled */ | 105 | /* shadow register enabled */ |
104 | iwl_write32(trans, HBUS_TARG_WRPTR, | 106 | iwl_write32(trans, HBUS_TARG_WRPTR, |
105 | txq->q.write_ptr | (txq_id << 8)); | 107 | txq->q.write_ptr | (txq_id << 8)); |
@@ -221,13 +223,14 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq, | |||
221 | 223 | ||
222 | lockdep_assert_held(&txq->lock); | 224 | lockdep_assert_held(&txq->lock); |
223 | 225 | ||
224 | iwlagn_unmap_tfd(trans, &txq->meta[index], &tfd_tmp[index], dma_dir); | 226 | iwlagn_unmap_tfd(trans, &txq->entries[index].meta, |
227 | &tfd_tmp[index], dma_dir); | ||
225 | 228 | ||
226 | /* free SKB */ | 229 | /* free SKB */ |
227 | if (txq->skbs) { | 230 | if (txq->entries) { |
228 | struct sk_buff *skb; | 231 | struct sk_buff *skb; |
229 | 232 | ||
230 | skb = txq->skbs[index]; | 233 | skb = txq->entries[index].skb; |
231 | 234 | ||
232 | /* Can be called from irqs-disabled context | 235 | /* Can be called from irqs-disabled context |
233 | * If skb is not NULL, it means that the whole queue is being | 236 | * If skb is not NULL, it means that the whole queue is being |
@@ -235,7 +238,7 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq, | |||
235 | */ | 238 | */ |
236 | if (skb) { | 239 | if (skb) { |
237 | iwl_op_mode_free_skb(trans->op_mode, skb); | 240 | iwl_op_mode_free_skb(trans->op_mode, skb); |
238 | txq->skbs[index] = NULL; | 241 | txq->entries[index].skb = NULL; |
239 | } | 242 | } |
240 | } | 243 | } |
241 | } | 244 | } |
@@ -358,7 +361,7 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans, | |||
358 | u8 sta_id = 0; | 361 | u8 sta_id = 0; |
359 | __le16 bc_ent; | 362 | __le16 bc_ent; |
360 | struct iwl_tx_cmd *tx_cmd = | 363 | struct iwl_tx_cmd *tx_cmd = |
361 | (struct iwl_tx_cmd *) txq->cmd[txq->q.read_ptr]->payload; | 364 | (void *)txq->entries[txq->q.read_ptr].cmd->payload; |
362 | 365 | ||
363 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); | 366 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); |
364 | 367 | ||
@@ -578,8 +581,8 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
578 | } | 581 | } |
579 | 582 | ||
580 | idx = get_cmd_index(q, q->write_ptr); | 583 | idx = get_cmd_index(q, q->write_ptr); |
581 | out_cmd = txq->cmd[idx]; | 584 | out_cmd = txq->entries[idx].cmd; |
582 | out_meta = &txq->meta[idx]; | 585 | out_meta = &txq->entries[idx].meta; |
583 | 586 | ||
584 | memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ | 587 | memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ |
585 | if (cmd->flags & CMD_WANT_SKB) | 588 | if (cmd->flags & CMD_WANT_SKB) |
@@ -772,8 +775,8 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb, | |||
772 | spin_lock(&txq->lock); | 775 | spin_lock(&txq->lock); |
773 | 776 | ||
774 | cmd_index = get_cmd_index(&txq->q, index); | 777 | cmd_index = get_cmd_index(&txq->q, index); |
775 | cmd = txq->cmd[cmd_index]; | 778 | cmd = txq->entries[cmd_index].cmd; |
776 | meta = &txq->meta[cmd_index]; | 779 | meta = &txq->entries[cmd_index].meta; |
777 | 780 | ||
778 | iwlagn_unmap_tfd(trans, meta, &txq->tfds[index], | 781 | iwlagn_unmap_tfd(trans, meta, &txq->tfds[index], |
779 | DMA_BIDIRECTIONAL); | 782 | DMA_BIDIRECTIONAL); |
@@ -905,8 +908,8 @@ cancel: | |||
905 | * in later, it will possibly set an invalid | 908 | * in later, it will possibly set an invalid |
906 | * address (cmd->meta.source). | 909 | * address (cmd->meta.source). |
907 | */ | 910 | */ |
908 | trans_pcie->txq[trans_pcie->cmd_queue].meta[cmd_idx].flags &= | 911 | trans_pcie->txq[trans_pcie->cmd_queue]. |
909 | ~CMD_WANT_SKB; | 912 | entries[cmd_idx].meta.flags &= ~CMD_WANT_SKB; |
910 | } | 913 | } |
911 | 914 | ||
912 | if (cmd->resp_pkt) { | 915 | if (cmd->resp_pkt) { |
@@ -961,12 +964,12 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index, | |||
961 | q->read_ptr != index; | 964 | q->read_ptr != index; |
962 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 965 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
963 | 966 | ||
964 | if (WARN_ON_ONCE(txq->skbs[txq->q.read_ptr] == NULL)) | 967 | if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) |
965 | continue; | 968 | continue; |
966 | 969 | ||
967 | __skb_queue_tail(skbs, txq->skbs[txq->q.read_ptr]); | 970 | __skb_queue_tail(skbs, txq->entries[txq->q.read_ptr].skb); |
968 | 971 | ||
969 | txq->skbs[txq->q.read_ptr] = NULL; | 972 | txq->entries[txq->q.read_ptr].skb = NULL; |
970 | 973 | ||
971 | iwlagn_txq_inval_byte_cnt_tbl(trans, txq); | 974 | iwlagn_txq_inval_byte_cnt_tbl(trans, txq); |
972 | 975 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index 14a32c420fd4..63557bb85cda 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -68,18 +68,20 @@ | |||
68 | #include <linux/bitops.h> | 68 | #include <linux/bitops.h> |
69 | #include <linux/gfp.h> | 69 | #include <linux/gfp.h> |
70 | 70 | ||
71 | #include "iwl-drv.h" | ||
71 | #include "iwl-trans.h" | 72 | #include "iwl-trans.h" |
72 | #include "iwl-trans-pcie-int.h" | 73 | #include "iwl-trans-pcie-int.h" |
73 | #include "iwl-csr.h" | 74 | #include "iwl-csr.h" |
74 | #include "iwl-prph.h" | 75 | #include "iwl-prph.h" |
75 | #include "iwl-shared.h" | ||
76 | #include "iwl-eeprom.h" | 76 | #include "iwl-eeprom.h" |
77 | #include "iwl-agn-hw.h" | 77 | #include "iwl-agn-hw.h" |
78 | /* FIXME: need to abstract out TX command (once we know what it looks like) */ | ||
79 | #include "iwl-commands.h" | ||
78 | 80 | ||
79 | #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) | 81 | #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) |
80 | 82 | ||
81 | #define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \ | 83 | #define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \ |
82 | (((1<<cfg(trans)->base_params->num_of_queues) - 1) &\ | 84 | (((1<<trans->cfg->base_params->num_of_queues) - 1) &\ |
83 | (~(1<<(trans_pcie)->cmd_queue))) | 85 | (~(1<<(trans_pcie)->cmd_queue))) |
84 | 86 | ||
85 | static int iwl_trans_rx_alloc(struct iwl_trans *trans) | 87 | static int iwl_trans_rx_alloc(struct iwl_trans *trans) |
@@ -334,7 +336,7 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans, | |||
334 | int i; | 336 | int i; |
335 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 337 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
336 | 338 | ||
337 | if (WARN_ON(txq->meta || txq->cmd || txq->skbs || txq->tfds)) | 339 | if (WARN_ON(txq->entries || txq->tfds)) |
338 | return -EINVAL; | 340 | return -EINVAL; |
339 | 341 | ||
340 | setup_timer(&txq->stuck_timer, iwl_trans_pcie_queue_stuck_timer, | 342 | setup_timer(&txq->stuck_timer, iwl_trans_pcie_queue_stuck_timer, |
@@ -343,35 +345,22 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans, | |||
343 | 345 | ||
344 | txq->q.n_window = slots_num; | 346 | txq->q.n_window = slots_num; |
345 | 347 | ||
346 | txq->meta = kcalloc(slots_num, sizeof(txq->meta[0]), GFP_KERNEL); | 348 | txq->entries = kcalloc(slots_num, |
347 | txq->cmd = kcalloc(slots_num, sizeof(txq->cmd[0]), GFP_KERNEL); | 349 | sizeof(struct iwl_pcie_tx_queue_entry), |
350 | GFP_KERNEL); | ||
348 | 351 | ||
349 | if (!txq->meta || !txq->cmd) | 352 | if (!txq->entries) |
350 | goto error; | 353 | goto error; |
351 | 354 | ||
352 | if (txq_id == trans_pcie->cmd_queue) | 355 | if (txq_id == trans_pcie->cmd_queue) |
353 | for (i = 0; i < slots_num; i++) { | 356 | for (i = 0; i < slots_num; i++) { |
354 | txq->cmd[i] = kmalloc(sizeof(struct iwl_device_cmd), | 357 | txq->entries[i].cmd = |
355 | GFP_KERNEL); | 358 | kmalloc(sizeof(struct iwl_device_cmd), |
356 | if (!txq->cmd[i]) | 359 | GFP_KERNEL); |
360 | if (!txq->entries[i].cmd) | ||
357 | goto error; | 361 | goto error; |
358 | } | 362 | } |
359 | 363 | ||
360 | /* Alloc driver data array and TFD circular buffer */ | ||
361 | /* Driver private data, only for Tx (not command) queues, | ||
362 | * not shared with device. */ | ||
363 | if (txq_id != trans_pcie->cmd_queue) { | ||
364 | txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->skbs[0]), | ||
365 | GFP_KERNEL); | ||
366 | if (!txq->skbs) { | ||
367 | IWL_ERR(trans, "kmalloc for auxiliary BD " | ||
368 | "structures failed\n"); | ||
369 | goto error; | ||
370 | } | ||
371 | } else { | ||
372 | txq->skbs = NULL; | ||
373 | } | ||
374 | |||
375 | /* Circular buffer of transmit frame descriptors (TFDs), | 364 | /* Circular buffer of transmit frame descriptors (TFDs), |
376 | * shared with device */ | 365 | * shared with device */ |
377 | txq->tfds = dma_alloc_coherent(trans->dev, tfd_sz, | 366 | txq->tfds = dma_alloc_coherent(trans->dev, tfd_sz, |
@@ -384,17 +373,11 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans, | |||
384 | 373 | ||
385 | return 0; | 374 | return 0; |
386 | error: | 375 | error: |
387 | kfree(txq->skbs); | 376 | if (txq->entries && txq_id == trans_pcie->cmd_queue) |
388 | txq->skbs = NULL; | ||
389 | /* since txq->cmd has been zeroed, | ||
390 | * all non allocated cmd[i] will be NULL */ | ||
391 | if (txq->cmd && txq_id == trans_pcie->cmd_queue) | ||
392 | for (i = 0; i < slots_num; i++) | 377 | for (i = 0; i < slots_num; i++) |
393 | kfree(txq->cmd[i]); | 378 | kfree(txq->entries[i].cmd); |
394 | kfree(txq->meta); | 379 | kfree(txq->entries); |
395 | kfree(txq->cmd); | 380 | txq->entries = NULL; |
396 | txq->meta = NULL; | ||
397 | txq->cmd = NULL; | ||
398 | 381 | ||
399 | return -ENOMEM; | 382 | return -ENOMEM; |
400 | 383 | ||
@@ -406,7 +389,6 @@ static int iwl_trans_txq_init(struct iwl_trans *trans, struct iwl_tx_queue *txq, | |||
406 | int ret; | 389 | int ret; |
407 | 390 | ||
408 | txq->need_update = 0; | 391 | txq->need_update = 0; |
409 | memset(txq->meta, 0, sizeof(txq->meta[0]) * slots_num); | ||
410 | 392 | ||
411 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise | 393 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise |
412 | * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ | 394 | * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ |
@@ -484,7 +466,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id) | |||
484 | 466 | ||
485 | if (txq_id == trans_pcie->cmd_queue) | 467 | if (txq_id == trans_pcie->cmd_queue) |
486 | for (i = 0; i < txq->q.n_window; i++) | 468 | for (i = 0; i < txq->q.n_window; i++) |
487 | kfree(txq->cmd[i]); | 469 | kfree(txq->entries[i].cmd); |
488 | 470 | ||
489 | /* De-alloc circular buffer of TFDs */ | 471 | /* De-alloc circular buffer of TFDs */ |
490 | if (txq->q.n_bd) { | 472 | if (txq->q.n_bd) { |
@@ -493,15 +475,8 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id) | |||
493 | memset(&txq->q.dma_addr, 0, sizeof(txq->q.dma_addr)); | 475 | memset(&txq->q.dma_addr, 0, sizeof(txq->q.dma_addr)); |
494 | } | 476 | } |
495 | 477 | ||
496 | /* De-alloc array of per-TFD driver data */ | 478 | kfree(txq->entries); |
497 | kfree(txq->skbs); | 479 | txq->entries = NULL; |
498 | txq->skbs = NULL; | ||
499 | |||
500 | /* deallocate arrays */ | ||
501 | kfree(txq->cmd); | ||
502 | kfree(txq->meta); | ||
503 | txq->cmd = NULL; | ||
504 | txq->meta = NULL; | ||
505 | 480 | ||
506 | del_timer_sync(&txq->stuck_timer); | 481 | del_timer_sync(&txq->stuck_timer); |
507 | 482 | ||
@@ -522,7 +497,7 @@ static void iwl_trans_pcie_tx_free(struct iwl_trans *trans) | |||
522 | /* Tx queues */ | 497 | /* Tx queues */ |
523 | if (trans_pcie->txq) { | 498 | if (trans_pcie->txq) { |
524 | for (txq_id = 0; | 499 | for (txq_id = 0; |
525 | txq_id < cfg(trans)->base_params->num_of_queues; txq_id++) | 500 | txq_id < trans->cfg->base_params->num_of_queues; txq_id++) |
526 | iwl_tx_queue_free(trans, txq_id); | 501 | iwl_tx_queue_free(trans, txq_id); |
527 | } | 502 | } |
528 | 503 | ||
@@ -547,7 +522,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans) | |||
547 | int txq_id, slots_num; | 522 | int txq_id, slots_num; |
548 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 523 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
549 | 524 | ||
550 | u16 scd_bc_tbls_size = cfg(trans)->base_params->num_of_queues * | 525 | u16 scd_bc_tbls_size = trans->cfg->base_params->num_of_queues * |
551 | sizeof(struct iwlagn_scd_bc_tbl); | 526 | sizeof(struct iwlagn_scd_bc_tbl); |
552 | 527 | ||
553 | /*It is not allowed to alloc twice, so warn when this happens. | 528 | /*It is not allowed to alloc twice, so warn when this happens. |
@@ -571,7 +546,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans) | |||
571 | goto error; | 546 | goto error; |
572 | } | 547 | } |
573 | 548 | ||
574 | trans_pcie->txq = kcalloc(cfg(trans)->base_params->num_of_queues, | 549 | trans_pcie->txq = kcalloc(trans->cfg->base_params->num_of_queues, |
575 | sizeof(struct iwl_tx_queue), GFP_KERNEL); | 550 | sizeof(struct iwl_tx_queue), GFP_KERNEL); |
576 | if (!trans_pcie->txq) { | 551 | if (!trans_pcie->txq) { |
577 | IWL_ERR(trans, "Not enough memory for txq\n"); | 552 | IWL_ERR(trans, "Not enough memory for txq\n"); |
@@ -580,7 +555,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans) | |||
580 | } | 555 | } |
581 | 556 | ||
582 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ | 557 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ |
583 | for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; | 558 | for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; |
584 | txq_id++) { | 559 | txq_id++) { |
585 | slots_num = (txq_id == trans_pcie->cmd_queue) ? | 560 | slots_num = (txq_id == trans_pcie->cmd_queue) ? |
586 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 561 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
@@ -626,7 +601,7 @@ static int iwl_tx_init(struct iwl_trans *trans) | |||
626 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 601 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
627 | 602 | ||
628 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ | 603 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ |
629 | for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; | 604 | for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; |
630 | txq_id++) { | 605 | txq_id++) { |
631 | slots_num = (txq_id == trans_pcie->cmd_queue) ? | 606 | slots_num = (txq_id == trans_pcie->cmd_queue) ? |
632 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 607 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
@@ -749,9 +724,9 @@ static int iwl_apm_init(struct iwl_trans *trans) | |||
749 | iwl_apm_config(trans); | 724 | iwl_apm_config(trans); |
750 | 725 | ||
751 | /* Configure analog phase-lock-loop before activating to D0A */ | 726 | /* Configure analog phase-lock-loop before activating to D0A */ |
752 | if (cfg(trans)->base_params->pll_cfg_val) | 727 | if (trans->cfg->base_params->pll_cfg_val) |
753 | iwl_set_bit(trans, CSR_ANA_PLL_CFG, | 728 | iwl_set_bit(trans, CSR_ANA_PLL_CFG, |
754 | cfg(trans)->base_params->pll_cfg_val); | 729 | trans->cfg->base_params->pll_cfg_val); |
755 | 730 | ||
756 | /* | 731 | /* |
757 | * Set "initialization complete" bit to move adapter from | 732 | * Set "initialization complete" bit to move adapter from |
@@ -861,7 +836,7 @@ static int iwl_nic_init(struct iwl_trans *trans) | |||
861 | if (iwl_tx_init(trans)) | 836 | if (iwl_tx_init(trans)) |
862 | return -ENOMEM; | 837 | return -ENOMEM; |
863 | 838 | ||
864 | if (cfg(trans)->base_params->shadow_reg_enable) { | 839 | if (trans->cfg->base_params->shadow_reg_enable) { |
865 | /* enable shadow regs in HW */ | 840 | /* enable shadow regs in HW */ |
866 | iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, | 841 | iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, |
867 | 0x800FFFFF); | 842 | 0x800FFFFF); |
@@ -1008,15 +983,13 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
1008 | return -EIO; | 983 | return -EIO; |
1009 | } | 984 | } |
1010 | 985 | ||
986 | iwl_enable_rfkill_int(trans); | ||
987 | |||
1011 | /* If platform's RF_KILL switch is NOT set to KILL */ | 988 | /* If platform's RF_KILL switch is NOT set to KILL */ |
1012 | hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & | 989 | hw_rfkill = iwl_is_rfkill_set(trans); |
1013 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | ||
1014 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 990 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
1015 | 991 | if (hw_rfkill) | |
1016 | if (hw_rfkill) { | ||
1017 | iwl_enable_rfkill_int(trans); | ||
1018 | return -ERFKILL; | 992 | return -ERFKILL; |
1019 | } | ||
1020 | 993 | ||
1021 | iwl_write32(trans, CSR_INT, 0xFFFFFFFF); | 994 | iwl_write32(trans, CSR_INT, 0xFFFFFFFF); |
1022 | 995 | ||
@@ -1080,7 +1053,7 @@ static void iwl_tx_start(struct iwl_trans *trans) | |||
1080 | iwl_write_targ_mem(trans, a, 0); | 1053 | iwl_write_targ_mem(trans, a, 0); |
1081 | for (; a < trans_pcie->scd_base_addr + | 1054 | for (; a < trans_pcie->scd_base_addr + |
1082 | SCD_TRANS_TBL_OFFSET_QUEUE( | 1055 | SCD_TRANS_TBL_OFFSET_QUEUE( |
1083 | cfg(trans)->base_params->num_of_queues); | 1056 | trans->cfg->base_params->num_of_queues); |
1084 | a += 4) | 1057 | a += 4) |
1085 | iwl_write_targ_mem(trans, a, 0); | 1058 | iwl_write_targ_mem(trans, a, 0); |
1086 | 1059 | ||
@@ -1103,7 +1076,7 @@ static void iwl_tx_start(struct iwl_trans *trans) | |||
1103 | iwl_write_prph(trans, SCD_AGGR_SEL, 0); | 1076 | iwl_write_prph(trans, SCD_AGGR_SEL, 0); |
1104 | 1077 | ||
1105 | /* initiate the queues */ | 1078 | /* initiate the queues */ |
1106 | for (i = 0; i < cfg(trans)->base_params->num_of_queues; i++) { | 1079 | for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) { |
1107 | iwl_write_prph(trans, SCD_QUEUE_RDPTR(i), 0); | 1080 | iwl_write_prph(trans, SCD_QUEUE_RDPTR(i), 0); |
1108 | iwl_write_direct32(trans, HBUS_TARG_WRPTR, 0 | (i << 8)); | 1081 | iwl_write_direct32(trans, HBUS_TARG_WRPTR, 0 | (i << 8)); |
1109 | iwl_write_targ_mem(trans, trans_pcie->scd_base_addr + | 1082 | iwl_write_targ_mem(trans, trans_pcie->scd_base_addr + |
@@ -1120,7 +1093,7 @@ static void iwl_tx_start(struct iwl_trans *trans) | |||
1120 | } | 1093 | } |
1121 | 1094 | ||
1122 | iwl_write_prph(trans, SCD_INTERRUPT_MASK, | 1095 | iwl_write_prph(trans, SCD_INTERRUPT_MASK, |
1123 | IWL_MASK(0, cfg(trans)->base_params->num_of_queues)); | 1096 | IWL_MASK(0, trans->cfg->base_params->num_of_queues)); |
1124 | 1097 | ||
1125 | /* Activate all Tx DMA/FIFO channels */ | 1098 | /* Activate all Tx DMA/FIFO channels */ |
1126 | iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7)); | 1099 | iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7)); |
@@ -1188,7 +1161,7 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans) | |||
1188 | } | 1161 | } |
1189 | 1162 | ||
1190 | /* Unmap DMA from host system and free skb's */ | 1163 | /* Unmap DMA from host system and free skb's */ |
1191 | for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; | 1164 | for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; |
1192 | txq_id++) | 1165 | txq_id++) |
1193 | iwl_tx_queue_unmap(trans, txq_id); | 1166 | iwl_tx_queue_unmap(trans, txq_id); |
1194 | 1167 | ||
@@ -1240,6 +1213,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
1240 | iwl_disable_interrupts(trans); | 1213 | iwl_disable_interrupts(trans); |
1241 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 1214 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
1242 | 1215 | ||
1216 | iwl_enable_rfkill_int(trans); | ||
1217 | |||
1243 | /* wait to make sure we flush pending tasklet*/ | 1218 | /* wait to make sure we flush pending tasklet*/ |
1244 | synchronize_irq(trans_pcie->irq); | 1219 | synchronize_irq(trans_pcie->irq); |
1245 | tasklet_kill(&trans_pcie->irq_tasklet); | 1220 | tasklet_kill(&trans_pcie->irq_tasklet); |
@@ -1296,15 +1271,15 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1296 | spin_lock(&txq->lock); | 1271 | spin_lock(&txq->lock); |
1297 | 1272 | ||
1298 | /* Set up driver data for this TFD */ | 1273 | /* Set up driver data for this TFD */ |
1299 | txq->skbs[q->write_ptr] = skb; | 1274 | txq->entries[q->write_ptr].skb = skb; |
1300 | txq->cmd[q->write_ptr] = dev_cmd; | 1275 | txq->entries[q->write_ptr].cmd = dev_cmd; |
1301 | 1276 | ||
1302 | dev_cmd->hdr.cmd = REPLY_TX; | 1277 | dev_cmd->hdr.cmd = REPLY_TX; |
1303 | dev_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | | 1278 | dev_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | |
1304 | INDEX_TO_SEQ(q->write_ptr))); | 1279 | INDEX_TO_SEQ(q->write_ptr))); |
1305 | 1280 | ||
1306 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ | 1281 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ |
1307 | out_meta = &txq->meta[q->write_ptr]; | 1282 | out_meta = &txq->entries[q->write_ptr].meta; |
1308 | 1283 | ||
1309 | /* | 1284 | /* |
1310 | * Use the first empty entry in this queue's command buffer array | 1285 | * Use the first empty entry in this queue's command buffer array |
@@ -1450,8 +1425,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
1450 | 1425 | ||
1451 | iwl_apm_init(trans); | 1426 | iwl_apm_init(trans); |
1452 | 1427 | ||
1453 | hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & | 1428 | /* From now on, the op_mode will be kept updated about RF kill state */ |
1454 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | 1429 | iwl_enable_rfkill_int(trans); |
1430 | |||
1431 | hw_rfkill = iwl_is_rfkill_set(trans); | ||
1455 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 1432 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
1456 | 1433 | ||
1457 | return err; | 1434 | return err; |
@@ -1464,14 +1441,37 @@ error: | |||
1464 | return err; | 1441 | return err; |
1465 | } | 1442 | } |
1466 | 1443 | ||
1467 | static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans) | 1444 | static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans, |
1445 | bool op_mode_leaving) | ||
1468 | { | 1446 | { |
1447 | bool hw_rfkill; | ||
1448 | unsigned long flags; | ||
1449 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
1450 | |||
1469 | iwl_apm_stop(trans); | 1451 | iwl_apm_stop(trans); |
1470 | 1452 | ||
1453 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); | ||
1454 | iwl_disable_interrupts(trans); | ||
1455 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | ||
1456 | |||
1471 | iwl_write32(trans, CSR_INT, 0xFFFFFFFF); | 1457 | iwl_write32(trans, CSR_INT, 0xFFFFFFFF); |
1472 | 1458 | ||
1473 | /* Even if we stop the HW, we still want the RF kill interrupt */ | 1459 | if (!op_mode_leaving) { |
1474 | iwl_enable_rfkill_int(trans); | 1460 | /* |
1461 | * Even if we stop the HW, we still want the RF kill | ||
1462 | * interrupt | ||
1463 | */ | ||
1464 | iwl_enable_rfkill_int(trans); | ||
1465 | |||
1466 | /* | ||
1467 | * Check again since the RF kill state may have changed while | ||
1468 | * all the interrupts were disabled, in this case we couldn't | ||
1469 | * receive the RF kill interrupt and update the state in the | ||
1470 | * op_mode. | ||
1471 | */ | ||
1472 | hw_rfkill = iwl_is_rfkill_set(trans); | ||
1473 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | ||
1474 | } | ||
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | 1477 | static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, |
@@ -1548,7 +1548,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, | |||
1548 | trans_pcie->command_names = trans_cfg->command_names; | 1548 | trans_pcie->command_names = trans_cfg->command_names; |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | static void iwl_trans_pcie_free(struct iwl_trans *trans) | 1551 | void iwl_trans_pcie_free(struct iwl_trans *trans) |
1552 | { | 1552 | { |
1553 | struct iwl_trans_pcie *trans_pcie = | 1553 | struct iwl_trans_pcie *trans_pcie = |
1554 | IWL_TRANS_GET_PCIE_TRANS(trans); | 1554 | IWL_TRANS_GET_PCIE_TRANS(trans); |
@@ -1567,7 +1567,6 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans) | |||
1567 | pci_release_regions(trans_pcie->pci_dev); | 1567 | pci_release_regions(trans_pcie->pci_dev); |
1568 | pci_disable_device(trans_pcie->pci_dev); | 1568 | pci_disable_device(trans_pcie->pci_dev); |
1569 | 1569 | ||
1570 | trans->shrd->trans = NULL; | ||
1571 | kfree(trans); | 1570 | kfree(trans); |
1572 | } | 1571 | } |
1573 | 1572 | ||
@@ -1591,16 +1590,14 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans) | |||
1591 | { | 1590 | { |
1592 | bool hw_rfkill; | 1591 | bool hw_rfkill; |
1593 | 1592 | ||
1594 | hw_rfkill = !(iwl_read32(trans, CSR_GP_CNTRL) & | 1593 | iwl_enable_rfkill_int(trans); |
1595 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | ||
1596 | |||
1597 | if (hw_rfkill) | ||
1598 | iwl_enable_rfkill_int(trans); | ||
1599 | else | ||
1600 | iwl_enable_interrupts(trans); | ||
1601 | 1594 | ||
1595 | hw_rfkill = iwl_is_rfkill_set(trans); | ||
1602 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 1596 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
1603 | 1597 | ||
1598 | if (!hw_rfkill) | ||
1599 | iwl_enable_interrupts(trans); | ||
1600 | |||
1604 | return 0; | 1601 | return 0; |
1605 | } | 1602 | } |
1606 | #endif /* CONFIG_PM_SLEEP */ | 1603 | #endif /* CONFIG_PM_SLEEP */ |
@@ -1617,7 +1614,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans) | |||
1617 | int ret = 0; | 1614 | int ret = 0; |
1618 | 1615 | ||
1619 | /* waiting for all the tx frames complete might take a while */ | 1616 | /* waiting for all the tx frames complete might take a while */ |
1620 | for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) { | 1617 | for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { |
1621 | if (cnt == trans_pcie->cmd_queue) | 1618 | if (cnt == trans_pcie->cmd_queue) |
1622 | continue; | 1619 | continue; |
1623 | txq = &trans_pcie->txq[cnt]; | 1620 | txq = &trans_pcie->txq[cnt]; |
@@ -1829,17 +1826,16 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, | |||
1829 | int ret; | 1826 | int ret; |
1830 | size_t bufsz; | 1827 | size_t bufsz; |
1831 | 1828 | ||
1832 | bufsz = sizeof(char) * 64 * cfg(trans)->base_params->num_of_queues; | 1829 | bufsz = sizeof(char) * 64 * trans->cfg->base_params->num_of_queues; |
1833 | 1830 | ||
1834 | if (!trans_pcie->txq) { | 1831 | if (!trans_pcie->txq) |
1835 | IWL_ERR(trans, "txq not ready\n"); | ||
1836 | return -EAGAIN; | 1832 | return -EAGAIN; |
1837 | } | 1833 | |
1838 | buf = kzalloc(bufsz, GFP_KERNEL); | 1834 | buf = kzalloc(bufsz, GFP_KERNEL); |
1839 | if (!buf) | 1835 | if (!buf) |
1840 | return -ENOMEM; | 1836 | return -ENOMEM; |
1841 | 1837 | ||
1842 | for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) { | 1838 | for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { |
1843 | txq = &trans_pcie->txq[cnt]; | 1839 | txq = &trans_pcie->txq[cnt]; |
1844 | q = &txq->q; | 1840 | q = &txq->q; |
1845 | pos += scnprintf(buf + pos, bufsz - pos, | 1841 | pos += scnprintf(buf + pos, bufsz - pos, |
@@ -1895,10 +1891,8 @@ static ssize_t iwl_dbgfs_interrupt_read(struct file *file, | |||
1895 | ssize_t ret; | 1891 | ssize_t ret; |
1896 | 1892 | ||
1897 | buf = kzalloc(bufsz, GFP_KERNEL); | 1893 | buf = kzalloc(bufsz, GFP_KERNEL); |
1898 | if (!buf) { | 1894 | if (!buf) |
1899 | IWL_ERR(trans, "Can not allocate Buffer\n"); | ||
1900 | return -ENOMEM; | 1895 | return -ENOMEM; |
1901 | } | ||
1902 | 1896 | ||
1903 | pos += scnprintf(buf + pos, bufsz - pos, | 1897 | pos += scnprintf(buf + pos, bufsz - pos, |
1904 | "Interrupt Statistics Report:\n"); | 1898 | "Interrupt Statistics Report:\n"); |
@@ -2049,7 +2043,7 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, | |||
2049 | 2043 | ||
2050 | #endif /*CONFIG_IWLWIFI_DEBUGFS */ | 2044 | #endif /*CONFIG_IWLWIFI_DEBUGFS */ |
2051 | 2045 | ||
2052 | const struct iwl_trans_ops trans_ops_pcie = { | 2046 | static const struct iwl_trans_ops trans_ops_pcie = { |
2053 | .start_hw = iwl_trans_pcie_start_hw, | 2047 | .start_hw = iwl_trans_pcie_start_hw, |
2054 | .stop_hw = iwl_trans_pcie_stop_hw, | 2048 | .stop_hw = iwl_trans_pcie_stop_hw, |
2055 | .fw_alive = iwl_trans_pcie_fw_alive, | 2049 | .fw_alive = iwl_trans_pcie_fw_alive, |
@@ -2066,8 +2060,6 @@ const struct iwl_trans_ops trans_ops_pcie = { | |||
2066 | .tx_agg_disable = iwl_trans_pcie_tx_agg_disable, | 2060 | .tx_agg_disable = iwl_trans_pcie_tx_agg_disable, |
2067 | .tx_agg_setup = iwl_trans_pcie_tx_agg_setup, | 2061 | .tx_agg_setup = iwl_trans_pcie_tx_agg_setup, |
2068 | 2062 | ||
2069 | .free = iwl_trans_pcie_free, | ||
2070 | |||
2071 | .dbgfs_register = iwl_trans_pcie_dbgfs_register, | 2063 | .dbgfs_register = iwl_trans_pcie_dbgfs_register, |
2072 | 2064 | ||
2073 | .wait_tx_queue_empty = iwl_trans_pcie_wait_tx_queue_empty, | 2065 | .wait_tx_queue_empty = iwl_trans_pcie_wait_tx_queue_empty, |
@@ -2083,9 +2075,9 @@ const struct iwl_trans_ops trans_ops_pcie = { | |||
2083 | .set_pmi = iwl_trans_pcie_set_pmi, | 2075 | .set_pmi = iwl_trans_pcie_set_pmi, |
2084 | }; | 2076 | }; |
2085 | 2077 | ||
2086 | struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, | 2078 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
2087 | struct pci_dev *pdev, | 2079 | const struct pci_device_id *ent, |
2088 | const struct pci_device_id *ent) | 2080 | const struct iwl_cfg *cfg) |
2089 | { | 2081 | { |
2090 | struct iwl_trans_pcie *trans_pcie; | 2082 | struct iwl_trans_pcie *trans_pcie; |
2091 | struct iwl_trans *trans; | 2083 | struct iwl_trans *trans; |
@@ -2101,7 +2093,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, | |||
2101 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 2093 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
2102 | 2094 | ||
2103 | trans->ops = &trans_ops_pcie; | 2095 | trans->ops = &trans_ops_pcie; |
2104 | trans->shrd = shrd; | 2096 | trans->cfg = cfg; |
2105 | trans_pcie->trans = trans; | 2097 | trans_pcie->trans = trans; |
2106 | spin_lock_init(&trans_pcie->irq_lock); | 2098 | spin_lock_init(&trans_pcie->irq_lock); |
2107 | init_waitqueue_head(&trans_pcie->ucode_write_waitq); | 2099 | init_waitqueue_head(&trans_pcie->ucode_write_waitq); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index f3496a0490f0..7018d313a4e0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -66,8 +66,9 @@ | |||
66 | #include <linux/ieee80211.h> | 66 | #include <linux/ieee80211.h> |
67 | #include <linux/mm.h> /* for page_address */ | 67 | #include <linux/mm.h> /* for page_address */ |
68 | 68 | ||
69 | #include "iwl-shared.h" | ||
70 | #include "iwl-debug.h" | 69 | #include "iwl-debug.h" |
70 | #include "iwl-config.h" | ||
71 | #include "iwl-fw.h" | ||
71 | 72 | ||
72 | /** | 73 | /** |
73 | * DOC: Transport layer - what is it ? | 74 | * DOC: Transport layer - what is it ? |
@@ -104,13 +105,6 @@ | |||
104 | * 6) Eventually, the free function will be called. | 105 | * 6) Eventually, the free function will be called. |
105 | */ | 106 | */ |
106 | 107 | ||
107 | struct iwl_priv; | ||
108 | struct iwl_shared; | ||
109 | struct iwl_op_mode; | ||
110 | struct fw_img; | ||
111 | struct sk_buff; | ||
112 | struct dentry; | ||
113 | |||
114 | /** | 108 | /** |
115 | * DOC: Host command section | 109 | * DOC: Host command section |
116 | * | 110 | * |
@@ -326,6 +320,8 @@ struct iwl_trans_config { | |||
326 | const char **command_names; | 320 | const char **command_names; |
327 | }; | 321 | }; |
328 | 322 | ||
323 | struct iwl_trans; | ||
324 | |||
329 | /** | 325 | /** |
330 | * struct iwl_trans_ops - transport specific operations | 326 | * struct iwl_trans_ops - transport specific operations |
331 | * | 327 | * |
@@ -334,7 +330,8 @@ struct iwl_trans_config { | |||
334 | * @start_hw: starts the HW- from that point on, the HW can send interrupts | 330 | * @start_hw: starts the HW- from that point on, the HW can send interrupts |
335 | * May sleep | 331 | * May sleep |
336 | * @stop_hw: stops the HW- from that point on, the HW will be in low power but | 332 | * @stop_hw: stops the HW- from that point on, the HW will be in low power but |
337 | * will still issue interrupt if the HW RF kill is triggered. | 333 | * will still issue interrupt if the HW RF kill is triggered unless |
334 | * op_mode_leaving is true. | ||
338 | * May sleep | 335 | * May sleep |
339 | * @start_fw: allocates and inits all the resources for the transport | 336 | * @start_fw: allocates and inits all the resources for the transport |
340 | * layer. Also kick a fw image. | 337 | * layer. Also kick a fw image. |
@@ -357,10 +354,6 @@ struct iwl_trans_config { | |||
357 | * May sleep | 354 | * May sleep |
358 | * @tx_agg_disable: de-configure a Tx queue to send AMPDUs | 355 | * @tx_agg_disable: de-configure a Tx queue to send AMPDUs |
359 | * Must be atomic | 356 | * Must be atomic |
360 | * @free: release all the ressource for the transport layer itself such as | ||
361 | * irq, tasklet etc... From this point on, the device may not issue | ||
362 | * any interrupt (incl. RFKILL). | ||
363 | * May sleep | ||
364 | * @wait_tx_queue_empty: wait until all tx queues are empty | 357 | * @wait_tx_queue_empty: wait until all tx queues are empty |
365 | * May sleep | 358 | * May sleep |
366 | * @dbgfs_register: add the dbgfs files under this directory. Files will be | 359 | * @dbgfs_register: add the dbgfs files under this directory. Files will be |
@@ -378,7 +371,7 @@ struct iwl_trans_config { | |||
378 | struct iwl_trans_ops { | 371 | struct iwl_trans_ops { |
379 | 372 | ||
380 | int (*start_hw)(struct iwl_trans *iwl_trans); | 373 | int (*start_hw)(struct iwl_trans *iwl_trans); |
381 | void (*stop_hw)(struct iwl_trans *iwl_trans); | 374 | void (*stop_hw)(struct iwl_trans *iwl_trans, bool op_mode_leaving); |
382 | int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw); | 375 | int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw); |
383 | void (*fw_alive)(struct iwl_trans *trans); | 376 | void (*fw_alive)(struct iwl_trans *trans); |
384 | void (*stop_device)(struct iwl_trans *trans); | 377 | void (*stop_device)(struct iwl_trans *trans); |
@@ -396,8 +389,6 @@ struct iwl_trans_ops { | |||
396 | int sta_id, int tid, int frame_limit, u16 ssn); | 389 | int sta_id, int tid, int frame_limit, u16 ssn); |
397 | void (*tx_agg_disable)(struct iwl_trans *trans, int queue); | 390 | void (*tx_agg_disable)(struct iwl_trans *trans, int queue); |
398 | 391 | ||
399 | void (*free)(struct iwl_trans *trans); | ||
400 | |||
401 | int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); | 392 | int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); |
402 | int (*wait_tx_queue_empty)(struct iwl_trans *trans); | 393 | int (*wait_tx_queue_empty)(struct iwl_trans *trans); |
403 | #ifdef CONFIG_PM_SLEEP | 394 | #ifdef CONFIG_PM_SLEEP |
@@ -428,7 +419,7 @@ enum iwl_trans_state { | |||
428 | * | 419 | * |
429 | * @ops - pointer to iwl_trans_ops | 420 | * @ops - pointer to iwl_trans_ops |
430 | * @op_mode - pointer to the op_mode | 421 | * @op_mode - pointer to the op_mode |
431 | * @shrd - pointer to iwl_shared which holds shared data from the upper layer | 422 | * @cfg - pointer to the configuration |
432 | * @reg_lock - protect hw register access | 423 | * @reg_lock - protect hw register access |
433 | * @dev - pointer to struct device * that represents the device | 424 | * @dev - pointer to struct device * that represents the device |
434 | * @hw_id: a u32 with the ID of the device / subdevice. | 425 | * @hw_id: a u32 with the ID of the device / subdevice. |
@@ -440,7 +431,7 @@ enum iwl_trans_state { | |||
440 | struct iwl_trans { | 431 | struct iwl_trans { |
441 | const struct iwl_trans_ops *ops; | 432 | const struct iwl_trans_ops *ops; |
442 | struct iwl_op_mode *op_mode; | 433 | struct iwl_op_mode *op_mode; |
443 | struct iwl_shared *shrd; | 434 | const struct iwl_cfg *cfg; |
444 | enum iwl_trans_state state; | 435 | enum iwl_trans_state state; |
445 | spinlock_t reg_lock; | 436 | spinlock_t reg_lock; |
446 | 437 | ||
@@ -477,11 +468,12 @@ static inline int iwl_trans_start_hw(struct iwl_trans *trans) | |||
477 | return trans->ops->start_hw(trans); | 468 | return trans->ops->start_hw(trans); |
478 | } | 469 | } |
479 | 470 | ||
480 | static inline void iwl_trans_stop_hw(struct iwl_trans *trans) | 471 | static inline void iwl_trans_stop_hw(struct iwl_trans *trans, |
472 | bool op_mode_leaving) | ||
481 | { | 473 | { |
482 | might_sleep(); | 474 | might_sleep(); |
483 | 475 | ||
484 | trans->ops->stop_hw(trans); | 476 | trans->ops->stop_hw(trans, op_mode_leaving); |
485 | 477 | ||
486 | trans->state = IWL_TRANS_NO_FW; | 478 | trans->state = IWL_TRANS_NO_FW; |
487 | } | 479 | } |
@@ -566,11 +558,6 @@ static inline void iwl_trans_tx_agg_setup(struct iwl_trans *trans, int queue, | |||
566 | frame_limit, ssn); | 558 | frame_limit, ssn); |
567 | } | 559 | } |
568 | 560 | ||
569 | static inline void iwl_trans_free(struct iwl_trans *trans) | ||
570 | { | ||
571 | trans->ops->free(trans); | ||
572 | } | ||
573 | |||
574 | static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans) | 561 | static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans) |
575 | { | 562 | { |
576 | WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, | 563 | WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, |
@@ -618,19 +605,9 @@ static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) | |||
618 | } | 605 | } |
619 | 606 | ||
620 | /***************************************************** | 607 | /***************************************************** |
621 | * Transport layers implementations + their allocation function | 608 | * driver (transport) register/unregister functions |
622 | ******************************************************/ | 609 | ******************************************************/ |
623 | struct pci_dev; | ||
624 | struct pci_device_id; | ||
625 | extern const struct iwl_trans_ops trans_ops_pcie; | ||
626 | struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, | ||
627 | struct pci_dev *pdev, | ||
628 | const struct pci_device_id *ent); | ||
629 | int __must_check iwl_pci_register_driver(void); | 610 | int __must_check iwl_pci_register_driver(void); |
630 | void iwl_pci_unregister_driver(void); | 611 | void iwl_pci_unregister_driver(void); |
631 | 612 | ||
632 | extern const struct iwl_trans_ops trans_ops_idi; | ||
633 | struct iwl_trans *iwl_trans_idi_alloc(struct iwl_shared *shrd, | ||
634 | void *pdev_void, | ||
635 | const void *ent_void); | ||
636 | #endif /* __iwl_trans_h__ */ | 613 | #endif /* __iwl_trans_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c index 539171945610..bc40dc68b0f4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | 32 | ||
33 | #include "iwl-dev.h" | 33 | #include "iwl-dev.h" |
34 | #include "iwl-core.h" | ||
35 | #include "iwl-io.h" | 34 | #include "iwl-io.h" |
36 | #include "iwl-agn-hw.h" | 35 | #include "iwl-agn-hw.h" |
37 | #include "iwl-agn.h" | 36 | #include "iwl-agn.h" |
@@ -145,8 +144,8 @@ int iwl_init_alive_start(struct iwl_priv *priv) | |||
145 | { | 144 | { |
146 | int ret; | 145 | int ret; |
147 | 146 | ||
148 | if (cfg(priv)->bt_params && | 147 | if (priv->cfg->bt_params && |
149 | cfg(priv)->bt_params->advanced_bt_coexist) { | 148 | priv->cfg->bt_params->advanced_bt_coexist) { |
150 | /* | 149 | /* |
151 | * Tell uCode we are ready to perform calibration | 150 | * Tell uCode we are ready to perform calibration |
152 | * need to perform this before any calibration | 151 | * need to perform this before any calibration |
@@ -168,8 +167,8 @@ int iwl_init_alive_start(struct iwl_priv *priv) | |||
168 | * temperature offset calibration is only needed for runtime ucode, | 167 | * temperature offset calibration is only needed for runtime ucode, |
169 | * so prepare the value now. | 168 | * so prepare the value now. |
170 | */ | 169 | */ |
171 | if (cfg(priv)->need_temp_offset_calib) { | 170 | if (priv->cfg->need_temp_offset_calib) { |
172 | if (cfg(priv)->temp_offset_v2) | 171 | if (priv->cfg->temp_offset_v2) |
173 | return iwl_set_temperature_offset_calib_v2(priv); | 172 | return iwl_set_temperature_offset_calib_v2(priv); |
174 | else | 173 | else |
175 | return iwl_set_temperature_offset_calib(priv); | 174 | return iwl_set_temperature_offset_calib(priv); |
@@ -244,7 +243,7 @@ static int iwl_alive_notify(struct iwl_priv *priv) | |||
244 | { | 243 | { |
245 | int ret; | 244 | int ret; |
246 | 245 | ||
247 | iwl_trans_fw_alive(trans(priv)); | 246 | iwl_trans_fw_alive(priv->trans); |
248 | 247 | ||
249 | priv->passive_no_rx = false; | 248 | priv->passive_no_rx = false; |
250 | priv->transport_queue_stop = 0; | 249 | priv->transport_queue_stop = 0; |
@@ -253,7 +252,7 @@ static int iwl_alive_notify(struct iwl_priv *priv) | |||
253 | if (ret) | 252 | if (ret) |
254 | return ret; | 253 | return ret; |
255 | 254 | ||
256 | if (!cfg(priv)->no_xtal_calib) { | 255 | if (!priv->cfg->no_xtal_calib) { |
257 | ret = iwl_set_Xtal_calib(priv); | 256 | ret = iwl_set_Xtal_calib(priv); |
258 | if (ret) | 257 | if (ret) |
259 | return ret; | 258 | return ret; |
@@ -282,9 +281,9 @@ static int iwl_verify_sec_sparse(struct iwl_priv *priv, | |||
282 | /* read data comes through single port, auto-incr addr */ | 281 | /* read data comes through single port, auto-incr addr */ |
283 | /* NOTE: Use the debugless read so we don't flood kernel log | 282 | /* NOTE: Use the debugless read so we don't flood kernel log |
284 | * if IWL_DL_IO is set */ | 283 | * if IWL_DL_IO is set */ |
285 | iwl_write_direct32(trans(priv), HBUS_TARG_MEM_RADDR, | 284 | iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR, |
286 | i + fw_desc->offset); | 285 | i + fw_desc->offset); |
287 | val = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); | 286 | val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); |
288 | if (val != le32_to_cpu(*image)) | 287 | if (val != le32_to_cpu(*image)) |
289 | return -EIO; | 288 | return -EIO; |
290 | } | 289 | } |
@@ -303,14 +302,14 @@ static void iwl_print_mismatch_sec(struct iwl_priv *priv, | |||
303 | 302 | ||
304 | IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); | 303 | IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); |
305 | 304 | ||
306 | iwl_write_direct32(trans(priv), HBUS_TARG_MEM_RADDR, | 305 | iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR, |
307 | fw_desc->offset); | 306 | fw_desc->offset); |
308 | 307 | ||
309 | for (offs = 0; | 308 | for (offs = 0; |
310 | offs < len && errors < 20; | 309 | offs < len && errors < 20; |
311 | offs += sizeof(u32), image++) { | 310 | offs += sizeof(u32), image++) { |
312 | /* read data comes through single port, auto-incr addr */ | 311 | /* read data comes through single port, auto-incr addr */ |
313 | val = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT); | 312 | val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); |
314 | if (val != le32_to_cpu(*image)) { | 313 | if (val != le32_to_cpu(*image)) { |
315 | IWL_ERR(priv, "uCode INST section at " | 314 | IWL_ERR(priv, "uCode INST section at " |
316 | "offset 0x%x, is 0x%x, s/b 0x%x\n", | 315 | "offset 0x%x, is 0x%x, s/b 0x%x\n", |
@@ -402,7 +401,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
402 | alive_cmd, ARRAY_SIZE(alive_cmd), | 401 | alive_cmd, ARRAY_SIZE(alive_cmd), |
403 | iwl_alive_fn, &alive_data); | 402 | iwl_alive_fn, &alive_data); |
404 | 403 | ||
405 | ret = iwl_trans_start_fw(trans(priv), fw); | 404 | ret = iwl_trans_start_fw(priv->trans, fw); |
406 | if (ret) { | 405 | if (ret) { |
407 | priv->cur_ucode = old_type; | 406 | priv->cur_ucode = old_type; |
408 | iwl_remove_notification(&priv->notif_wait, &alive_wait); | 407 | iwl_remove_notification(&priv->notif_wait, &alive_wait); |
@@ -526,7 +525,7 @@ int iwl_run_init_ucode(struct iwl_priv *priv) | |||
526 | iwl_remove_notification(&priv->notif_wait, &calib_wait); | 525 | iwl_remove_notification(&priv->notif_wait, &calib_wait); |
527 | out: | 526 | out: |
528 | /* Whatever happened, stop the device */ | 527 | /* Whatever happened, stop the device */ |
529 | iwl_trans_stop_device(trans(priv)); | 528 | iwl_trans_stop_device(priv->trans); |
530 | priv->ucode_loaded = false; | 529 | priv->ucode_loaded = false; |
531 | 530 | ||
532 | return ret; | 531 | return ret; |
diff --git a/drivers/net/wireless/libertas/firmware.c b/drivers/net/wireless/libertas/firmware.c index cd23f1a8c98a..77f6504fd55d 100644 --- a/drivers/net/wireless/libertas/firmware.c +++ b/drivers/net/wireless/libertas/firmware.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/firmware.h> | 5 | #include <linux/firmware.h> |
6 | #include <linux/firmware.h> | 6 | #include <linux/firmware.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/sched.h> | ||
8 | 9 | ||
9 | #include "dev.h" | 10 | #include "dev.h" |
10 | #include "decl.h" | 11 | #include "decl.h" |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index cee50528522b..16beaf39dc53 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -738,6 +738,50 @@ done: | |||
738 | return ret; | 738 | return ret; |
739 | } | 739 | } |
740 | 740 | ||
741 | static void if_cs_prog_firmware(struct lbs_private *priv, int ret, | ||
742 | const struct firmware *helper, | ||
743 | const struct firmware *mainfw) | ||
744 | { | ||
745 | struct if_cs_card *card = priv->card; | ||
746 | |||
747 | if (ret) { | ||
748 | pr_err("failed to find firmware (%d)\n", ret); | ||
749 | return; | ||
750 | } | ||
751 | |||
752 | /* Load the firmware */ | ||
753 | ret = if_cs_prog_helper(card, helper); | ||
754 | if (ret == 0 && (card->model != MODEL_8305)) | ||
755 | ret = if_cs_prog_real(card, mainfw); | ||
756 | if (ret) | ||
757 | goto out; | ||
758 | |||
759 | /* Now actually get the IRQ */ | ||
760 | ret = request_irq(card->p_dev->irq, if_cs_interrupt, | ||
761 | IRQF_SHARED, DRV_NAME, card); | ||
762 | if (ret) { | ||
763 | pr_err("error in request_irq\n"); | ||
764 | goto out; | ||
765 | } | ||
766 | |||
767 | /* | ||
768 | * Clear any interrupt cause that happened while sending | ||
769 | * firmware/initializing card | ||
770 | */ | ||
771 | if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK); | ||
772 | if_cs_enable_ints(card); | ||
773 | |||
774 | /* And finally bring the card up */ | ||
775 | priv->fw_ready = 1; | ||
776 | if (lbs_start_card(priv) != 0) { | ||
777 | pr_err("could not activate card\n"); | ||
778 | free_irq(card->p_dev->irq, card); | ||
779 | } | ||
780 | |||
781 | out: | ||
782 | release_firmware(helper); | ||
783 | release_firmware(mainfw); | ||
784 | } | ||
741 | 785 | ||
742 | 786 | ||
743 | /********************************************************************/ | 787 | /********************************************************************/ |
@@ -809,8 +853,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
809 | unsigned int prod_id; | 853 | unsigned int prod_id; |
810 | struct lbs_private *priv; | 854 | struct lbs_private *priv; |
811 | struct if_cs_card *card; | 855 | struct if_cs_card *card; |
812 | const struct firmware *helper = NULL; | ||
813 | const struct firmware *mainfw = NULL; | ||
814 | 856 | ||
815 | lbs_deb_enter(LBS_DEB_CS); | 857 | lbs_deb_enter(LBS_DEB_CS); |
816 | 858 | ||
@@ -890,20 +932,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
890 | goto out2; | 932 | goto out2; |
891 | } | 933 | } |
892 | 934 | ||
893 | ret = lbs_get_firmware(&p_dev->dev, card->model, &fw_table[0], | ||
894 | &helper, &mainfw); | ||
895 | if (ret) { | ||
896 | pr_err("failed to find firmware (%d)\n", ret); | ||
897 | goto out2; | ||
898 | } | ||
899 | |||
900 | /* Load the firmware early, before calling into libertas.ko */ | ||
901 | ret = if_cs_prog_helper(card, helper); | ||
902 | if (ret == 0 && (card->model != MODEL_8305)) | ||
903 | ret = if_cs_prog_real(card, mainfw); | ||
904 | if (ret) | ||
905 | goto out2; | ||
906 | |||
907 | /* Make this card known to the libertas driver */ | 935 | /* Make this card known to the libertas driver */ |
908 | priv = lbs_add_card(card, &p_dev->dev); | 936 | priv = lbs_add_card(card, &p_dev->dev); |
909 | if (!priv) { | 937 | if (!priv) { |
@@ -911,37 +939,22 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
911 | goto out2; | 939 | goto out2; |
912 | } | 940 | } |
913 | 941 | ||
914 | /* Finish setting up fields in lbs_private */ | 942 | /* Set up fields in lbs_private */ |
915 | card->priv = priv; | 943 | card->priv = priv; |
916 | priv->card = card; | 944 | priv->card = card; |
917 | priv->hw_host_to_card = if_cs_host_to_card; | 945 | priv->hw_host_to_card = if_cs_host_to_card; |
918 | priv->enter_deep_sleep = NULL; | 946 | priv->enter_deep_sleep = NULL; |
919 | priv->exit_deep_sleep = NULL; | 947 | priv->exit_deep_sleep = NULL; |
920 | priv->reset_deep_sleep_wakeup = NULL; | 948 | priv->reset_deep_sleep_wakeup = NULL; |
921 | priv->fw_ready = 1; | ||
922 | 949 | ||
923 | /* Now actually get the IRQ */ | 950 | /* Get firmware */ |
924 | ret = request_irq(p_dev->irq, if_cs_interrupt, | 951 | ret = lbs_get_firmware_async(priv, &p_dev->dev, card->model, fw_table, |
925 | IRQF_SHARED, DRV_NAME, card); | 952 | if_cs_prog_firmware); |
926 | if (ret) { | 953 | if (ret) { |
927 | pr_err("error in request_irq\n"); | 954 | pr_err("failed to find firmware (%d)\n", ret); |
928 | goto out3; | ||
929 | } | ||
930 | |||
931 | /* | ||
932 | * Clear any interrupt cause that happened while sending | ||
933 | * firmware/initializing card | ||
934 | */ | ||
935 | if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK); | ||
936 | if_cs_enable_ints(card); | ||
937 | |||
938 | /* And finally bring the card up */ | ||
939 | if (lbs_start_card(priv) != 0) { | ||
940 | pr_err("could not activate card\n"); | ||
941 | goto out3; | 955 | goto out3; |
942 | } | 956 | } |
943 | 957 | ||
944 | ret = 0; | ||
945 | goto out; | 958 | goto out; |
946 | 959 | ||
947 | out3: | 960 | out3: |
@@ -951,9 +964,6 @@ out2: | |||
951 | out1: | 964 | out1: |
952 | pcmcia_disable_device(p_dev); | 965 | pcmcia_disable_device(p_dev); |
953 | out: | 966 | out: |
954 | release_firmware(helper); | ||
955 | release_firmware(mainfw); | ||
956 | |||
957 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); | 967 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); |
958 | return ret; | 968 | return ret; |
959 | } | 969 | } |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 9eefb2a0ce9f..ab84eb943749 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -233,21 +233,27 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
233 | 233 | ||
234 | skb_push(skb_aggr, headroom); | 234 | skb_push(skb_aggr, headroom); |
235 | 235 | ||
236 | /* | 236 | if (adapter->iface_type == MWIFIEX_USB) { |
237 | * Padding per MSDU will affect the length of next | 237 | adapter->data_sent = true; |
238 | * packet and hence the exact length of next packet | 238 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, |
239 | * is uncertain here. | 239 | skb_aggr, NULL); |
240 | * | 240 | } else { |
241 | * Also, aggregation of transmission buffer, while | 241 | /* |
242 | * downloading the data to the card, wont gain much | 242 | * Padding per MSDU will affect the length of next |
243 | * on the AMSDU packets as the AMSDU packets utilizes | 243 | * packet and hence the exact length of next packet |
244 | * the transmission buffer space to the maximum | 244 | * is uncertain here. |
245 | * (adapter->tx_buf_size). | 245 | * |
246 | */ | 246 | * Also, aggregation of transmission buffer, while |
247 | tx_param.next_pkt_len = 0; | 247 | * downloading the data to the card, wont gain much |
248 | 248 | * on the AMSDU packets as the AMSDU packets utilizes | |
249 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | 249 | * the transmission buffer space to the maximum |
250 | skb_aggr, &tx_param); | 250 | * (adapter->tx_buf_size). |
251 | */ | ||
252 | tx_param.next_pkt_len = 0; | ||
253 | |||
254 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | ||
255 | skb_aggr, &tx_param); | ||
256 | } | ||
251 | switch (ret) { | 257 | switch (ret) { |
252 | case -EBUSY: | 258 | case -EBUSY: |
253 | spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); | 259 | spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); |
diff --git a/drivers/net/wireless/mwifiex/Kconfig b/drivers/net/wireless/mwifiex/Kconfig index 2a078cea830a..7f91cc694787 100644 --- a/drivers/net/wireless/mwifiex/Kconfig +++ b/drivers/net/wireless/mwifiex/Kconfig | |||
@@ -30,3 +30,14 @@ config MWIFIEX_PCIE | |||
30 | 30 | ||
31 | If you choose to build it as a module, it will be called | 31 | If you choose to build it as a module, it will be called |
32 | mwifiex_pcie. | 32 | mwifiex_pcie. |
33 | |||
34 | config MWIFIEX_USB | ||
35 | tristate "Marvell WiFi-Ex Driver for USB8797" | ||
36 | depends on MWIFIEX && USB | ||
37 | select FW_LOADER | ||
38 | ---help--- | ||
39 | This adds support for wireless adapters based on Marvell | ||
40 | Avastar 88W8797 chipset with USB interface. | ||
41 | |||
42 | If you choose to build it as a module, it will be called | ||
43 | mwifiex_usb. | ||
diff --git a/drivers/net/wireless/mwifiex/Makefile b/drivers/net/wireless/mwifiex/Makefile index b0257ad1bbed..5c1a46bf1e11 100644 --- a/drivers/net/wireless/mwifiex/Makefile +++ b/drivers/net/wireless/mwifiex/Makefile | |||
@@ -42,3 +42,6 @@ obj-$(CONFIG_MWIFIEX_SDIO) += mwifiex_sdio.o | |||
42 | 42 | ||
43 | mwifiex_pcie-y += pcie.o | 43 | mwifiex_pcie-y += pcie.o |
44 | obj-$(CONFIG_MWIFIEX_PCIE) += mwifiex_pcie.o | 44 | obj-$(CONFIG_MWIFIEX_PCIE) += mwifiex_pcie.o |
45 | |||
46 | mwifiex_usb-y += usb.o | ||
47 | obj-$(CONFIG_MWIFIEX_USB) += mwifiex_usb.o | ||
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 07f6e0092552..1710beffb93a 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -139,6 +139,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
139 | uint16_t cmd_size; | 139 | uint16_t cmd_size; |
140 | struct timeval tstamp; | 140 | struct timeval tstamp; |
141 | unsigned long flags; | 141 | unsigned long flags; |
142 | __le32 tmp; | ||
142 | 143 | ||
143 | if (!adapter || !cmd_node) | 144 | if (!adapter || !cmd_node) |
144 | return -1; | 145 | return -1; |
@@ -178,15 +179,28 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
178 | le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size, | 179 | le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size, |
179 | le16_to_cpu(host_cmd->seq_num)); | 180 | le16_to_cpu(host_cmd->seq_num)); |
180 | 181 | ||
181 | skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN); | 182 | if (adapter->iface_type == MWIFIEX_USB) { |
182 | 183 | tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD); | |
183 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, | 184 | skb_push(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); |
184 | cmd_node->cmd_skb, NULL); | 185 | memcpy(cmd_node->cmd_skb->data, &tmp, MWIFIEX_TYPE_LEN); |
185 | 186 | adapter->cmd_sent = true; | |
186 | skb_pull(cmd_node->cmd_skb, INTF_HEADER_LEN); | 187 | ret = adapter->if_ops.host_to_card(adapter, |
188 | MWIFIEX_USB_EP_CMD_EVENT, | ||
189 | cmd_node->cmd_skb, NULL); | ||
190 | skb_pull(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); | ||
191 | if (ret == -EBUSY) | ||
192 | cmd_node->cmd_skb = NULL; | ||
193 | } else { | ||
194 | skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN); | ||
195 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, | ||
196 | cmd_node->cmd_skb, NULL); | ||
197 | skb_pull(cmd_node->cmd_skb, INTF_HEADER_LEN); | ||
198 | } | ||
187 | 199 | ||
188 | if (ret == -1) { | 200 | if (ret == -1) { |
189 | dev_err(adapter->dev, "DNLD_CMD: host to card failed\n"); | 201 | dev_err(adapter->dev, "DNLD_CMD: host to card failed\n"); |
202 | if (adapter->iface_type == MWIFIEX_USB) | ||
203 | adapter->cmd_sent = false; | ||
190 | if (cmd_node->wait_q_enabled) | 204 | if (cmd_node->wait_q_enabled) |
191 | adapter->cmd_wait_q.status = -1; | 205 | adapter->cmd_wait_q.status = -1; |
192 | mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); | 206 | mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); |
@@ -232,6 +246,9 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) | |||
232 | struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = | 246 | struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = |
233 | (struct mwifiex_opt_sleep_confirm *) | 247 | (struct mwifiex_opt_sleep_confirm *) |
234 | adapter->sleep_cfm->data; | 248 | adapter->sleep_cfm->data; |
249 | struct sk_buff *sleep_cfm_tmp; | ||
250 | __le32 tmp; | ||
251 | |||
235 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); | 252 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); |
236 | 253 | ||
237 | sleep_cfm_buf->seq_num = | 254 | sleep_cfm_buf->seq_num = |
@@ -240,10 +257,28 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) | |||
240 | priv->bss_type))); | 257 | priv->bss_type))); |
241 | adapter->seq_num++; | 258 | adapter->seq_num++; |
242 | 259 | ||
243 | skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); | 260 | if (adapter->iface_type == MWIFIEX_USB) { |
244 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, | 261 | sleep_cfm_tmp = |
245 | adapter->sleep_cfm, NULL); | 262 | dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm) |
246 | skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); | 263 | + MWIFIEX_TYPE_LEN); |
264 | skb_put(sleep_cfm_tmp, sizeof(struct mwifiex_opt_sleep_confirm) | ||
265 | + MWIFIEX_TYPE_LEN); | ||
266 | tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD); | ||
267 | memcpy(sleep_cfm_tmp->data, &tmp, MWIFIEX_TYPE_LEN); | ||
268 | memcpy(sleep_cfm_tmp->data + MWIFIEX_TYPE_LEN, | ||
269 | adapter->sleep_cfm->data, | ||
270 | sizeof(struct mwifiex_opt_sleep_confirm)); | ||
271 | ret = adapter->if_ops.host_to_card(adapter, | ||
272 | MWIFIEX_USB_EP_CMD_EVENT, | ||
273 | sleep_cfm_tmp, NULL); | ||
274 | if (ret != -EBUSY) | ||
275 | dev_kfree_skb_any(sleep_cfm_tmp); | ||
276 | } else { | ||
277 | skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); | ||
278 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, | ||
279 | adapter->sleep_cfm, NULL); | ||
280 | skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); | ||
281 | } | ||
247 | 282 | ||
248 | if (ret == -1) { | 283 | if (ret == -1) { |
249 | dev_err(adapter->dev, "SLEEP_CFM: failed\n"); | 284 | dev_err(adapter->dev, "SLEEP_CFM: failed\n"); |
@@ -343,7 +378,12 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) | |||
343 | } | 378 | } |
344 | if (!cmd_array[i].resp_skb) | 379 | if (!cmd_array[i].resp_skb) |
345 | continue; | 380 | continue; |
346 | dev_kfree_skb_any(cmd_array[i].resp_skb); | 381 | |
382 | if (adapter->iface_type == MWIFIEX_USB) | ||
383 | adapter->if_ops.cmdrsp_complete(adapter, | ||
384 | cmd_array[i].resp_skb); | ||
385 | else | ||
386 | dev_kfree_skb_any(cmd_array[i].resp_skb); | ||
347 | } | 387 | } |
348 | /* Release struct cmd_ctrl_node */ | 388 | /* Release struct cmd_ctrl_node */ |
349 | if (adapter->cmd_pool) { | 389 | if (adapter->cmd_pool) { |
@@ -1083,6 +1123,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) | |||
1083 | MWIFIEX_BSS_ROLE_ANY), | 1123 | MWIFIEX_BSS_ROLE_ANY), |
1084 | false); | 1124 | false); |
1085 | } | 1125 | } |
1126 | EXPORT_SYMBOL_GPL(mwifiex_process_hs_config); | ||
1086 | 1127 | ||
1087 | /* | 1128 | /* |
1088 | * This function handles the command response of a sleep confirm command. | 1129 | * This function handles the command response of a sleep confirm command. |
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h index be5fd1652e53..d04aba4131dc 100644 --- a/drivers/net/wireless/mwifiex/decl.h +++ b/drivers/net/wireless/mwifiex/decl.h | |||
@@ -53,6 +53,7 @@ | |||
53 | #define MWIFIEX_RATE_BITMAP_MCS127 159 | 53 | #define MWIFIEX_RATE_BITMAP_MCS127 159 |
54 | 54 | ||
55 | #define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024) | 55 | #define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024) |
56 | #define MWIFIEX_RX_CMD_BUF_SIZE (2 * 1024) | ||
56 | 57 | ||
57 | #define MWIFIEX_RTS_MIN_VALUE (0) | 58 | #define MWIFIEX_RTS_MIN_VALUE (0) |
58 | #define MWIFIEX_RTS_MAX_VALUE (2347) | 59 | #define MWIFIEX_RTS_MAX_VALUE (2347) |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 6b15449a4cb7..2a2cabadb9b5 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -81,6 +81,11 @@ enum KEY_TYPE_ID { | |||
81 | #define FIRMWARE_READY_SDIO 0xfedc | 81 | #define FIRMWARE_READY_SDIO 0xfedc |
82 | #define FIRMWARE_READY_PCIE 0xfedcba00 | 82 | #define FIRMWARE_READY_PCIE 0xfedcba00 |
83 | 83 | ||
84 | enum mwifiex_usb_ep { | ||
85 | MWIFIEX_USB_EP_CMD_EVENT = 1, | ||
86 | MWIFIEX_USB_EP_DATA = 2, | ||
87 | }; | ||
88 | |||
84 | enum MWIFIEX_802_11_PRIVACY_FILTER { | 89 | enum MWIFIEX_802_11_PRIVACY_FILTER { |
85 | MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL, | 90 | MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL, |
86 | MWIFIEX_802_11_PRIV_FILTER_8021X_WEP | 91 | MWIFIEX_802_11_PRIV_FILTER_8021X_WEP |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index 0d55c5b542d7..d440c3eb640b 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -188,10 +188,10 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) | |||
188 | 188 | ||
189 | adapter->cmd_sent = false; | 189 | adapter->cmd_sent = false; |
190 | 190 | ||
191 | if (adapter->iface_type == MWIFIEX_PCIE) | 191 | if (adapter->iface_type == MWIFIEX_SDIO) |
192 | adapter->data_sent = false; | ||
193 | else | ||
194 | adapter->data_sent = true; | 192 | adapter->data_sent = true; |
193 | else | ||
194 | adapter->data_sent = false; | ||
195 | 195 | ||
196 | adapter->cmd_resp_received = false; | 196 | adapter->cmd_resp_received = false; |
197 | adapter->event_received = false; | 197 | adapter->event_received = false; |
@@ -379,7 +379,8 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter) | |||
379 | 379 | ||
380 | dev_dbg(adapter->dev, "info: free scan table\n"); | 380 | dev_dbg(adapter->dev, "info: free scan table\n"); |
381 | 381 | ||
382 | adapter->if_ops.cleanup_if(adapter); | 382 | if (adapter->if_ops.cleanup_if) |
383 | adapter->if_ops.cleanup_if(adapter); | ||
383 | 384 | ||
384 | if (adapter->sleep_cfm) | 385 | if (adapter->sleep_cfm) |
385 | dev_kfree_skb_any(adapter->sleep_cfm); | 386 | dev_kfree_skb_any(adapter->sleep_cfm); |
@@ -419,6 +420,8 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) | |||
419 | spin_lock_init(&adapter->cmd_pending_q_lock); | 420 | spin_lock_init(&adapter->cmd_pending_q_lock); |
420 | spin_lock_init(&adapter->scan_pending_q_lock); | 421 | spin_lock_init(&adapter->scan_pending_q_lock); |
421 | 422 | ||
423 | skb_queue_head_init(&adapter->usb_rx_data_q); | ||
424 | |||
422 | for (i = 0; i < adapter->priv_num; ++i) { | 425 | for (i = 0; i < adapter->priv_num; ++i) { |
423 | INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); | 426 | INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); |
424 | adapter->bss_prio_tbl[i].bss_prio_cur = NULL; | 427 | adapter->bss_prio_tbl[i].bss_prio_cur = NULL; |
@@ -574,6 +577,7 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) | |||
574 | struct mwifiex_private *priv; | 577 | struct mwifiex_private *priv; |
575 | s32 i; | 578 | s32 i; |
576 | unsigned long flags; | 579 | unsigned long flags; |
580 | struct sk_buff *skb; | ||
577 | 581 | ||
578 | /* mwifiex already shutdown */ | 582 | /* mwifiex already shutdown */ |
579 | if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) | 583 | if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) |
@@ -601,6 +605,18 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) | |||
601 | 605 | ||
602 | spin_lock_irqsave(&adapter->mwifiex_lock, flags); | 606 | spin_lock_irqsave(&adapter->mwifiex_lock, flags); |
603 | 607 | ||
608 | if (adapter->if_ops.data_complete) { | ||
609 | while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) { | ||
610 | struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); | ||
611 | |||
612 | priv = adapter->priv[rx_info->bss_num]; | ||
613 | if (priv) | ||
614 | priv->stats.rx_dropped++; | ||
615 | |||
616 | adapter->if_ops.data_complete(adapter, skb); | ||
617 | } | ||
618 | } | ||
619 | |||
604 | /* Free adapter structure */ | 620 | /* Free adapter structure */ |
605 | mwifiex_free_adapter(adapter); | 621 | mwifiex_free_adapter(adapter); |
606 | 622 | ||
@@ -630,24 +646,28 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, | |||
630 | int ret; | 646 | int ret; |
631 | u32 poll_num = 1; | 647 | u32 poll_num = 1; |
632 | 648 | ||
633 | adapter->winner = 0; | 649 | if (adapter->if_ops.check_fw_status) { |
650 | adapter->winner = 0; | ||
634 | 651 | ||
635 | /* Check if firmware is already running */ | 652 | /* check if firmware is already running */ |
636 | ret = adapter->if_ops.check_fw_status(adapter, poll_num); | 653 | ret = adapter->if_ops.check_fw_status(adapter, poll_num); |
637 | if (!ret) { | 654 | if (!ret) { |
638 | dev_notice(adapter->dev, | 655 | dev_notice(adapter->dev, |
639 | "WLAN FW already running! Skip FW download\n"); | 656 | "WLAN FW already running! Skip FW dnld\n"); |
640 | goto done; | 657 | goto done; |
641 | } | 658 | } |
642 | poll_num = MAX_FIRMWARE_POLL_TRIES; | 659 | |
643 | 660 | poll_num = MAX_FIRMWARE_POLL_TRIES; | |
644 | /* Check if we are the winner for downloading FW */ | 661 | |
645 | if (!adapter->winner) { | 662 | /* check if we are the winner for downloading FW */ |
646 | dev_notice(adapter->dev, | 663 | if (!adapter->winner) { |
647 | "Other intf already running! Skip FW download\n"); | 664 | dev_notice(adapter->dev, |
648 | poll_num = MAX_MULTI_INTERFACE_POLL_TRIES; | 665 | "FW already running! Skip FW dnld\n"); |
649 | goto poll_fw; | 666 | poll_num = MAX_MULTI_INTERFACE_POLL_TRIES; |
667 | goto poll_fw; | ||
668 | } | ||
650 | } | 669 | } |
670 | |||
651 | if (pmfw) { | 671 | if (pmfw) { |
652 | /* Download firmware with helper */ | 672 | /* Download firmware with helper */ |
653 | ret = adapter->if_ops.prog_fw(adapter, pmfw); | 673 | ret = adapter->if_ops.prog_fw(adapter, pmfw); |
@@ -666,6 +686,8 @@ poll_fw: | |||
666 | } | 686 | } |
667 | done: | 687 | done: |
668 | /* re-enable host interrupt for mwifiex after fw dnld is successful */ | 688 | /* re-enable host interrupt for mwifiex after fw dnld is successful */ |
669 | adapter->if_ops.enable_int(adapter); | 689 | if (adapter->if_ops.enable_int) |
690 | adapter->if_ops.enable_int(adapter); | ||
691 | |||
670 | return ret; | 692 | return ret; |
671 | } | 693 | } |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 245b7329e0c9..be0f0e583f75 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -58,8 +58,9 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, | |||
58 | memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); | 58 | memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); |
59 | 59 | ||
60 | /* card specific initialization has been deferred until now .. */ | 60 | /* card specific initialization has been deferred until now .. */ |
61 | if (adapter->if_ops.init_if(adapter)) | 61 | if (adapter->if_ops.init_if) |
62 | goto error; | 62 | if (adapter->if_ops.init_if(adapter)) |
63 | goto error; | ||
63 | 64 | ||
64 | adapter->priv_num = 0; | 65 | adapter->priv_num = 0; |
65 | 66 | ||
@@ -140,6 +141,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) | |||
140 | { | 141 | { |
141 | int ret = 0; | 142 | int ret = 0; |
142 | unsigned long flags; | 143 | unsigned long flags; |
144 | struct sk_buff *skb; | ||
143 | 145 | ||
144 | spin_lock_irqsave(&adapter->main_proc_lock, flags); | 146 | spin_lock_irqsave(&adapter->main_proc_lock, flags); |
145 | 147 | ||
@@ -161,7 +163,8 @@ process_start: | |||
161 | if (adapter->int_status) { | 163 | if (adapter->int_status) { |
162 | if (adapter->hs_activated) | 164 | if (adapter->hs_activated) |
163 | mwifiex_process_hs_config(adapter); | 165 | mwifiex_process_hs_config(adapter); |
164 | adapter->if_ops.process_int_status(adapter); | 166 | if (adapter->if_ops.process_int_status) |
167 | adapter->if_ops.process_int_status(adapter); | ||
165 | } | 168 | } |
166 | 169 | ||
167 | /* Need to wake up the card ? */ | 170 | /* Need to wake up the card ? */ |
@@ -174,6 +177,7 @@ process_start: | |||
174 | adapter->if_ops.wakeup(adapter); | 177 | adapter->if_ops.wakeup(adapter); |
175 | continue; | 178 | continue; |
176 | } | 179 | } |
180 | |||
177 | if (IS_CARD_RX_RCVD(adapter)) { | 181 | if (IS_CARD_RX_RCVD(adapter)) { |
178 | adapter->pm_wakeup_fw_try = false; | 182 | adapter->pm_wakeup_fw_try = false; |
179 | if (adapter->ps_state == PS_STATE_SLEEP) | 183 | if (adapter->ps_state == PS_STATE_SLEEP) |
@@ -194,6 +198,11 @@ process_start: | |||
194 | } | 198 | } |
195 | } | 199 | } |
196 | 200 | ||
201 | /* Check Rx data for USB */ | ||
202 | if (adapter->iface_type == MWIFIEX_USB) | ||
203 | while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) | ||
204 | mwifiex_handle_rx_packet(adapter, skb); | ||
205 | |||
197 | /* Check for Cmd Resp */ | 206 | /* Check for Cmd Resp */ |
198 | if (adapter->cmd_resp_received) { | 207 | if (adapter->cmd_resp_received) { |
199 | adapter->cmd_resp_received = false; | 208 | adapter->cmd_resp_received = false; |
@@ -317,7 +326,10 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
317 | fw.fw_buf = (u8 *) adapter->firmware->data; | 326 | fw.fw_buf = (u8 *) adapter->firmware->data; |
318 | fw.fw_len = adapter->firmware->size; | 327 | fw.fw_len = adapter->firmware->size; |
319 | 328 | ||
320 | ret = mwifiex_dnld_fw(adapter, &fw); | 329 | if (adapter->if_ops.dnld_fw) |
330 | ret = adapter->if_ops.dnld_fw(adapter, &fw); | ||
331 | else | ||
332 | ret = mwifiex_dnld_fw(adapter, &fw); | ||
321 | if (ret == -1) | 333 | if (ret == -1) |
322 | goto done; | 334 | goto done; |
323 | 335 | ||
@@ -731,7 +743,8 @@ mwifiex_add_card(void *card, struct semaphore *sem, | |||
731 | 743 | ||
732 | err_init_fw: | 744 | err_init_fw: |
733 | pr_debug("info: %s: unregister device\n", __func__); | 745 | pr_debug("info: %s: unregister device\n", __func__); |
734 | adapter->if_ops.unregister_dev(adapter); | 746 | if (adapter->if_ops.unregister_dev) |
747 | adapter->if_ops.unregister_dev(adapter); | ||
735 | err_registerdev: | 748 | err_registerdev: |
736 | adapter->surprise_removed = true; | 749 | adapter->surprise_removed = true; |
737 | mwifiex_terminate_workqueue(adapter); | 750 | mwifiex_terminate_workqueue(adapter); |
@@ -836,7 +849,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) | |||
836 | 849 | ||
837 | /* Unregister device */ | 850 | /* Unregister device */ |
838 | dev_dbg(adapter->dev, "info: unregister device\n"); | 851 | dev_dbg(adapter->dev, "info: unregister device\n"); |
839 | adapter->if_ops.unregister_dev(adapter); | 852 | if (adapter->if_ops.unregister_dev) |
853 | adapter->if_ops.unregister_dev(adapter); | ||
840 | /* Free adapter structure */ | 854 | /* Free adapter structure */ |
841 | dev_dbg(adapter->dev, "info: free adapter\n"); | 855 | dev_dbg(adapter->dev, "info: free adapter\n"); |
842 | mwifiex_free_adapter(adapter); | 856 | mwifiex_free_adapter(adapter); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index a4000f9608d5..324ad390cacd 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -92,9 +92,16 @@ enum { | |||
92 | #define MWIFIEX_OUI_NOT_PRESENT 0 | 92 | #define MWIFIEX_OUI_NOT_PRESENT 0 |
93 | #define MWIFIEX_OUI_PRESENT 1 | 93 | #define MWIFIEX_OUI_PRESENT 1 |
94 | 94 | ||
95 | /* | ||
96 | * Do not check for data_received for USB, as data_received | ||
97 | * is handled in mwifiex_usb_recv for USB | ||
98 | */ | ||
95 | #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \ | 99 | #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \ |
96 | adapter->event_received || \ | 100 | adapter->event_received || \ |
97 | adapter->data_received) | 101 | ((adapter->iface_type != MWIFIEX_USB) && \ |
102 | adapter->data_received) || \ | ||
103 | ((adapter->iface_type == MWIFIEX_USB) && \ | ||
104 | !skb_queue_empty(&adapter->usb_rx_data_q))) | ||
98 | 105 | ||
99 | #define MWIFIEX_TYPE_CMD 1 | 106 | #define MWIFIEX_TYPE_CMD 1 |
100 | #define MWIFIEX_TYPE_DATA 0 | 107 | #define MWIFIEX_TYPE_DATA 0 |
@@ -110,6 +117,11 @@ enum { | |||
110 | 117 | ||
111 | #define MWIFIEX_EVENT_HEADER_LEN 4 | 118 | #define MWIFIEX_EVENT_HEADER_LEN 4 |
112 | 119 | ||
120 | #define MWIFIEX_TYPE_LEN 4 | ||
121 | #define MWIFIEX_USB_TYPE_CMD 0xF00DFACE | ||
122 | #define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE | ||
123 | #define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE | ||
124 | |||
113 | struct mwifiex_dbg { | 125 | struct mwifiex_dbg { |
114 | u32 num_cmd_host_to_card_failure; | 126 | u32 num_cmd_host_to_card_failure; |
115 | u32 num_cmd_sleep_cfm_host_to_card_failure; | 127 | u32 num_cmd_sleep_cfm_host_to_card_failure; |
@@ -162,6 +174,7 @@ enum MWIFIEX_PS_STATE { | |||
162 | enum mwifiex_iface_type { | 174 | enum mwifiex_iface_type { |
163 | MWIFIEX_SDIO, | 175 | MWIFIEX_SDIO, |
164 | MWIFIEX_PCIE, | 176 | MWIFIEX_PCIE, |
177 | MWIFIEX_USB | ||
165 | }; | 178 | }; |
166 | 179 | ||
167 | struct mwifiex_add_ba_param { | 180 | struct mwifiex_add_ba_param { |
@@ -546,6 +559,8 @@ struct mwifiex_if_ops { | |||
546 | void (*cleanup_mpa_buf) (struct mwifiex_adapter *); | 559 | void (*cleanup_mpa_buf) (struct mwifiex_adapter *); |
547 | int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *); | 560 | int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *); |
548 | int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *); | 561 | int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *); |
562 | int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *); | ||
563 | int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); | ||
549 | }; | 564 | }; |
550 | 565 | ||
551 | struct mwifiex_adapter { | 566 | struct mwifiex_adapter { |
@@ -608,6 +623,7 @@ struct mwifiex_adapter { | |||
608 | struct list_head scan_pending_q; | 623 | struct list_head scan_pending_q; |
609 | /* spin lock for scan_pending_q */ | 624 | /* spin lock for scan_pending_q */ |
610 | spinlock_t scan_pending_q_lock; | 625 | spinlock_t scan_pending_q_lock; |
626 | struct sk_buff_head usb_rx_data_q; | ||
611 | u32 scan_processing; | 627 | u32 scan_processing; |
612 | u16 region_code; | 628 | u16 region_code; |
613 | struct mwifiex_802_11d_domain_reg domain_reg; | 629 | struct mwifiex_802_11d_domain_reg domain_reg; |
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 1f7110577b9d..87ed2a1f6cd9 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -1293,7 +1293,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) | |||
1293 | if (ret) | 1293 | if (ret) |
1294 | return -1; | 1294 | return -1; |
1295 | 1295 | ||
1296 | if (first_sta) { | 1296 | if (first_sta && (priv->adapter->iface_type != MWIFIEX_USB)) { |
1297 | /* Enable auto deep sleep */ | 1297 | /* Enable auto deep sleep */ |
1298 | auto_ds.auto_ds = DEEP_SLEEP_ON; | 1298 | auto_ds.auto_ds = DEEP_SLEEP_ON; |
1299 | auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME; | 1299 | auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME; |
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c index 750b695aca12..02ce3b77d3e7 100644 --- a/drivers/net/wireless/mwifiex/sta_rx.c +++ b/drivers/net/wireless/mwifiex/sta_rx.c | |||
@@ -145,7 +145,12 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, | |||
145 | " rx_pkt_offset=%d, rx_pkt_length=%d\n", skb->len, | 145 | " rx_pkt_offset=%d, rx_pkt_length=%d\n", skb->len, |
146 | local_rx_pd->rx_pkt_offset, local_rx_pd->rx_pkt_length); | 146 | local_rx_pd->rx_pkt_offset, local_rx_pd->rx_pkt_length); |
147 | priv->stats.rx_dropped++; | 147 | priv->stats.rx_dropped++; |
148 | dev_kfree_skb_any(skb); | 148 | |
149 | if (adapter->if_ops.data_complete) | ||
150 | adapter->if_ops.data_complete(adapter, skb); | ||
151 | else | ||
152 | dev_kfree_skb_any(skb); | ||
153 | |||
149 | return ret; | 154 | return ret; |
150 | } | 155 | } |
151 | 156 | ||
@@ -196,8 +201,12 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, | |||
196 | (u8) local_rx_pd->rx_pkt_type, | 201 | (u8) local_rx_pd->rx_pkt_type, |
197 | skb); | 202 | skb); |
198 | 203 | ||
199 | if (ret || (rx_pkt_type == PKT_TYPE_BAR)) | 204 | if (ret || (rx_pkt_type == PKT_TYPE_BAR)) { |
200 | dev_kfree_skb_any(skb); | 205 | if (adapter->if_ops.data_complete) |
206 | adapter->if_ops.data_complete(adapter, skb); | ||
207 | else | ||
208 | dev_kfree_skb_any(skb); | ||
209 | } | ||
201 | 210 | ||
202 | if (ret) | 211 | if (ret) |
203 | priv->stats.rx_dropped++; | 212 | priv->stats.rx_dropped++; |
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c index 7af534feb420..0a046d3a0c16 100644 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ b/drivers/net/wireless/mwifiex/sta_tx.c | |||
@@ -149,10 +149,14 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) | |||
149 | local_tx_pd->bss_num = priv->bss_num; | 149 | local_tx_pd->bss_num = priv->bss_num; |
150 | local_tx_pd->bss_type = priv->bss_type; | 150 | local_tx_pd->bss_type = priv->bss_type; |
151 | 151 | ||
152 | skb_push(skb, INTF_HEADER_LEN); | 152 | if (adapter->iface_type == MWIFIEX_USB) { |
153 | 153 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, | |
154 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | 154 | skb, NULL); |
155 | skb, NULL); | 155 | } else { |
156 | skb_push(skb, INTF_HEADER_LEN); | ||
157 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | ||
158 | skb, NULL); | ||
159 | } | ||
156 | switch (ret) { | 160 | switch (ret) { |
157 | case -EBUSY: | 161 | case -EBUSY: |
158 | adapter->data_sent = true; | 162 | adapter->data_sent = true; |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index d2af8cb98541..e2faec4db108 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
@@ -77,12 +77,23 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, | |||
77 | if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) | 77 | if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) |
78 | local_tx_pd = | 78 | local_tx_pd = |
79 | (struct txpd *) (head_ptr + INTF_HEADER_LEN); | 79 | (struct txpd *) (head_ptr + INTF_HEADER_LEN); |
80 | 80 | if (adapter->iface_type == MWIFIEX_USB) { | |
81 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | 81 | adapter->data_sent = true; |
82 | skb, tx_param); | 82 | skb_pull(skb, INTF_HEADER_LEN); |
83 | ret = adapter->if_ops.host_to_card(adapter, | ||
84 | MWIFIEX_USB_EP_DATA, | ||
85 | skb, NULL); | ||
86 | } else { | ||
87 | ret = adapter->if_ops.host_to_card(adapter, | ||
88 | MWIFIEX_TYPE_DATA, | ||
89 | skb, tx_param); | ||
90 | } | ||
83 | } | 91 | } |
84 | 92 | ||
85 | switch (ret) { | 93 | switch (ret) { |
94 | case -ENOSR: | ||
95 | dev_err(adapter->dev, "data: -ENOSR is returned\n"); | ||
96 | break; | ||
86 | case -EBUSY: | 97 | case -EBUSY: |
87 | if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && | 98 | if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && |
88 | (adapter->pps_uapsd_mode) && (adapter->tx_lock_flag)) { | 99 | (adapter->pps_uapsd_mode) && (adapter->tx_lock_flag)) { |
@@ -135,6 +146,9 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, | |||
135 | if (!priv) | 146 | if (!priv) |
136 | goto done; | 147 | goto done; |
137 | 148 | ||
149 | if (adapter->iface_type == MWIFIEX_USB) | ||
150 | adapter->data_sent = false; | ||
151 | |||
138 | mwifiex_set_trans_start(priv->netdev); | 152 | mwifiex_set_trans_start(priv->netdev); |
139 | if (!status) { | 153 | if (!status) { |
140 | priv->stats.tx_packets++; | 154 | priv->stats.tx_packets++; |
@@ -162,4 +176,5 @@ done: | |||
162 | 176 | ||
163 | return 0; | 177 | return 0; |
164 | } | 178 | } |
179 | EXPORT_SYMBOL_GPL(mwifiex_write_data_complete); | ||
165 | 180 | ||
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c new file mode 100644 index 000000000000..49ebf20c56eb --- /dev/null +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -0,0 +1,1052 @@ | |||
1 | /* | ||
2 | * Marvell Wireless LAN device driver: USB specific handling | ||
3 | * | ||
4 | * Copyright (C) 2012, Marvell International Ltd. | ||
5 | * | ||
6 | * This software file (the "File") is distributed by Marvell International | ||
7 | * Ltd. under the terms of the GNU General Public License Version 2, June 1991 | ||
8 | * (the "License"). You may use, redistribute and/or modify this File in | ||
9 | * accordance with the terms and conditions of the License, a copy of which | ||
10 | * is available by writing to the Free Software Foundation, Inc., | ||
11 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the | ||
12 | * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
13 | * | ||
14 | * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE | ||
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE | ||
16 | * ARE EXPRESSLY DISCLAIMED. The License provides additional details about | ||
17 | * this warranty disclaimer. | ||
18 | */ | ||
19 | |||
20 | #include "main.h" | ||
21 | #include "usb.h" | ||
22 | |||
23 | #define USB_VERSION "1.0" | ||
24 | |||
25 | static const char usbdriver_name[] = "usb8797"; | ||
26 | |||
27 | static u8 user_rmmod; | ||
28 | static struct mwifiex_if_ops usb_ops; | ||
29 | static struct semaphore add_remove_card_sem; | ||
30 | |||
31 | static struct usb_device_id mwifiex_usb_table[] = { | ||
32 | {USB_DEVICE(USB8797_VID, USB8797_PID_1)}, | ||
33 | {USB_DEVICE_AND_INTERFACE_INFO(USB8797_VID, USB8797_PID_2, | ||
34 | USB_CLASS_VENDOR_SPEC, | ||
35 | USB_SUBCLASS_VENDOR_SPEC, 0xff)}, | ||
36 | { } /* Terminating entry */ | ||
37 | }; | ||
38 | |||
39 | MODULE_DEVICE_TABLE(usb, mwifiex_usb_table); | ||
40 | |||
41 | static int mwifiex_usb_submit_rx_urb(struct urb_context *ctx, int size); | ||
42 | |||
43 | /* This function handles received packet. Necessary action is taken based on | ||
44 | * cmd/event/data. | ||
45 | */ | ||
46 | static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | ||
47 | struct sk_buff *skb, u8 ep) | ||
48 | { | ||
49 | struct device *dev = adapter->dev; | ||
50 | u32 recv_type; | ||
51 | __le32 tmp; | ||
52 | |||
53 | if (adapter->hs_activated) | ||
54 | mwifiex_process_hs_config(adapter); | ||
55 | |||
56 | if (skb->len < INTF_HEADER_LEN) { | ||
57 | dev_err(dev, "%s: invalid skb->len\n", __func__); | ||
58 | return -1; | ||
59 | } | ||
60 | |||
61 | switch (ep) { | ||
62 | case MWIFIEX_USB_EP_CMD_EVENT: | ||
63 | dev_dbg(dev, "%s: EP_CMD_EVENT\n", __func__); | ||
64 | skb_copy_from_linear_data(skb, &tmp, INTF_HEADER_LEN); | ||
65 | recv_type = le32_to_cpu(tmp); | ||
66 | skb_pull(skb, INTF_HEADER_LEN); | ||
67 | |||
68 | switch (recv_type) { | ||
69 | case MWIFIEX_USB_TYPE_CMD: | ||
70 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { | ||
71 | dev_err(dev, "CMD: skb->len too large\n"); | ||
72 | return -1; | ||
73 | } else if (!adapter->curr_cmd) { | ||
74 | dev_dbg(dev, "CMD: no curr_cmd\n"); | ||
75 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | ||
76 | mwifiex_process_sleep_confirm_resp( | ||
77 | adapter, skb->data, | ||
78 | skb->len); | ||
79 | return 0; | ||
80 | } | ||
81 | return -1; | ||
82 | } | ||
83 | |||
84 | adapter->curr_cmd->resp_skb = skb; | ||
85 | adapter->cmd_resp_received = true; | ||
86 | break; | ||
87 | case MWIFIEX_USB_TYPE_EVENT: | ||
88 | if (skb->len < sizeof(u32)) { | ||
89 | dev_err(dev, "EVENT: skb->len too small\n"); | ||
90 | return -1; | ||
91 | } | ||
92 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); | ||
93 | adapter->event_cause = le32_to_cpu(tmp); | ||
94 | skb_pull(skb, sizeof(u32)); | ||
95 | dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); | ||
96 | |||
97 | if (skb->len > MAX_EVENT_SIZE) { | ||
98 | dev_err(dev, "EVENT: event body too large\n"); | ||
99 | return -1; | ||
100 | } | ||
101 | |||
102 | skb_copy_from_linear_data(skb, adapter->event_body, | ||
103 | skb->len); | ||
104 | adapter->event_received = true; | ||
105 | adapter->event_skb = skb; | ||
106 | break; | ||
107 | default: | ||
108 | dev_err(dev, "unknown recv_type %#x\n", recv_type); | ||
109 | return -1; | ||
110 | } | ||
111 | break; | ||
112 | case MWIFIEX_USB_EP_DATA: | ||
113 | dev_dbg(dev, "%s: EP_DATA\n", __func__); | ||
114 | if (skb->len > MWIFIEX_RX_DATA_BUF_SIZE) { | ||
115 | dev_err(dev, "DATA: skb->len too large\n"); | ||
116 | return -1; | ||
117 | } | ||
118 | skb_queue_tail(&adapter->usb_rx_data_q, skb); | ||
119 | adapter->data_received = true; | ||
120 | break; | ||
121 | default: | ||
122 | dev_err(dev, "%s: unknown endport %#x\n", __func__, ep); | ||
123 | return -1; | ||
124 | } | ||
125 | |||
126 | return -EINPROGRESS; | ||
127 | } | ||
128 | |||
129 | static void mwifiex_usb_rx_complete(struct urb *urb) | ||
130 | { | ||
131 | struct urb_context *context = (struct urb_context *)urb->context; | ||
132 | struct mwifiex_adapter *adapter = context->adapter; | ||
133 | struct sk_buff *skb = context->skb; | ||
134 | struct usb_card_rec *card; | ||
135 | int recv_length = urb->actual_length; | ||
136 | int size, status; | ||
137 | |||
138 | if (!adapter || !adapter->card) { | ||
139 | pr_err("mwifiex adapter or card structure is not valid\n"); | ||
140 | return; | ||
141 | } | ||
142 | |||
143 | card = (struct usb_card_rec *)adapter->card; | ||
144 | if (card->rx_cmd_ep == context->ep) | ||
145 | atomic_dec(&card->rx_cmd_urb_pending); | ||
146 | else | ||
147 | atomic_dec(&card->rx_data_urb_pending); | ||
148 | |||
149 | if (recv_length) { | ||
150 | if (urb->status || (adapter->surprise_removed)) { | ||
151 | dev_err(adapter->dev, | ||
152 | "URB status is failed: %d\n", urb->status); | ||
153 | /* Do not free skb in case of command ep */ | ||
154 | if (card->rx_cmd_ep != context->ep) | ||
155 | dev_kfree_skb_any(skb); | ||
156 | goto setup_for_next; | ||
157 | } | ||
158 | if (skb->len > recv_length) | ||
159 | skb_trim(skb, recv_length); | ||
160 | else | ||
161 | skb_put(skb, recv_length - skb->len); | ||
162 | |||
163 | atomic_inc(&adapter->rx_pending); | ||
164 | status = mwifiex_usb_recv(adapter, skb, context->ep); | ||
165 | |||
166 | dev_dbg(adapter->dev, "info: recv_length=%d, status=%d\n", | ||
167 | recv_length, status); | ||
168 | if (status == -EINPROGRESS) { | ||
169 | queue_work(adapter->workqueue, &adapter->main_work); | ||
170 | |||
171 | /* urb for data_ep is re-submitted now; | ||
172 | * urb for cmd_ep will be re-submitted in callback | ||
173 | * mwifiex_usb_recv_complete | ||
174 | */ | ||
175 | if (card->rx_cmd_ep == context->ep) | ||
176 | return; | ||
177 | } else { | ||
178 | atomic_dec(&adapter->rx_pending); | ||
179 | if (status == -1) | ||
180 | dev_err(adapter->dev, | ||
181 | "received data processing failed!\n"); | ||
182 | |||
183 | /* Do not free skb in case of command ep */ | ||
184 | if (card->rx_cmd_ep != context->ep) | ||
185 | dev_kfree_skb_any(skb); | ||
186 | } | ||
187 | } else if (urb->status) { | ||
188 | if (!adapter->is_suspended) { | ||
189 | dev_warn(adapter->dev, | ||
190 | "Card is removed: %d\n", urb->status); | ||
191 | adapter->surprise_removed = true; | ||
192 | } | ||
193 | dev_kfree_skb_any(skb); | ||
194 | return; | ||
195 | } else { | ||
196 | /* Do not free skb in case of command ep */ | ||
197 | if (card->rx_cmd_ep != context->ep) | ||
198 | dev_kfree_skb_any(skb); | ||
199 | |||
200 | /* fall through setup_for_next */ | ||
201 | } | ||
202 | |||
203 | setup_for_next: | ||
204 | if (card->rx_cmd_ep == context->ep) | ||
205 | size = MWIFIEX_RX_CMD_BUF_SIZE; | ||
206 | else | ||
207 | size = MWIFIEX_RX_DATA_BUF_SIZE; | ||
208 | |||
209 | mwifiex_usb_submit_rx_urb(context, size); | ||
210 | |||
211 | return; | ||
212 | } | ||
213 | |||
214 | static void mwifiex_usb_tx_complete(struct urb *urb) | ||
215 | { | ||
216 | struct urb_context *context = (struct urb_context *)(urb->context); | ||
217 | struct mwifiex_adapter *adapter = context->adapter; | ||
218 | struct usb_card_rec *card = adapter->card; | ||
219 | |||
220 | dev_dbg(adapter->dev, "%s: status: %d\n", __func__, urb->status); | ||
221 | |||
222 | if (context->ep == card->tx_cmd_ep) { | ||
223 | dev_dbg(adapter->dev, "%s: CMD\n", __func__); | ||
224 | atomic_dec(&card->tx_cmd_urb_pending); | ||
225 | adapter->cmd_sent = false; | ||
226 | } else { | ||
227 | dev_dbg(adapter->dev, "%s: DATA\n", __func__); | ||
228 | atomic_dec(&card->tx_data_urb_pending); | ||
229 | mwifiex_write_data_complete(adapter, context->skb, | ||
230 | urb->status ? -1 : 0); | ||
231 | } | ||
232 | |||
233 | queue_work(adapter->workqueue, &adapter->main_work); | ||
234 | |||
235 | return; | ||
236 | } | ||
237 | |||
238 | static int mwifiex_usb_submit_rx_urb(struct urb_context *ctx, int size) | ||
239 | { | ||
240 | struct mwifiex_adapter *adapter = ctx->adapter; | ||
241 | struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; | ||
242 | |||
243 | if (card->rx_cmd_ep != ctx->ep) { | ||
244 | ctx->skb = dev_alloc_skb(size); | ||
245 | if (!ctx->skb) { | ||
246 | dev_err(adapter->dev, | ||
247 | "%s: dev_alloc_skb failed\n", __func__); | ||
248 | return -ENOMEM; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | usb_fill_bulk_urb(ctx->urb, card->udev, | ||
253 | usb_rcvbulkpipe(card->udev, ctx->ep), ctx->skb->data, | ||
254 | size, mwifiex_usb_rx_complete, (void *)ctx); | ||
255 | |||
256 | if (card->rx_cmd_ep == ctx->ep) | ||
257 | atomic_inc(&card->rx_cmd_urb_pending); | ||
258 | else | ||
259 | atomic_inc(&card->rx_data_urb_pending); | ||
260 | |||
261 | if (usb_submit_urb(ctx->urb, GFP_ATOMIC)) { | ||
262 | dev_err(adapter->dev, "usb_submit_urb failed\n"); | ||
263 | dev_kfree_skb_any(ctx->skb); | ||
264 | ctx->skb = NULL; | ||
265 | |||
266 | if (card->rx_cmd_ep == ctx->ep) | ||
267 | atomic_dec(&card->rx_cmd_urb_pending); | ||
268 | else | ||
269 | atomic_dec(&card->rx_data_urb_pending); | ||
270 | |||
271 | return -1; | ||
272 | } | ||
273 | |||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static void mwifiex_usb_free(struct usb_card_rec *card) | ||
278 | { | ||
279 | int i; | ||
280 | |||
281 | if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb) | ||
282 | usb_kill_urb(card->rx_cmd.urb); | ||
283 | |||
284 | usb_free_urb(card->rx_cmd.urb); | ||
285 | card->rx_cmd.urb = NULL; | ||
286 | |||
287 | if (atomic_read(&card->rx_data_urb_pending)) | ||
288 | for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) | ||
289 | if (card->rx_data_list[i].urb) | ||
290 | usb_kill_urb(card->rx_data_list[i].urb); | ||
291 | |||
292 | for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) { | ||
293 | usb_free_urb(card->rx_data_list[i].urb); | ||
294 | card->rx_data_list[i].urb = NULL; | ||
295 | } | ||
296 | |||
297 | for (i = 0; i < MWIFIEX_TX_DATA_URB; i++) { | ||
298 | usb_free_urb(card->tx_data_list[i].urb); | ||
299 | card->tx_data_list[i].urb = NULL; | ||
300 | } | ||
301 | |||
302 | usb_free_urb(card->tx_cmd.urb); | ||
303 | card->tx_cmd.urb = NULL; | ||
304 | |||
305 | return; | ||
306 | } | ||
307 | |||
308 | /* This function probes an mwifiex device and registers it. It allocates | ||
309 | * the card structure, initiates the device registration and initialization | ||
310 | * procedure by adding a logical interface. | ||
311 | */ | ||
312 | static int mwifiex_usb_probe(struct usb_interface *intf, | ||
313 | const struct usb_device_id *id) | ||
314 | { | ||
315 | struct usb_device *udev = interface_to_usbdev(intf); | ||
316 | struct usb_host_interface *iface_desc = intf->cur_altsetting; | ||
317 | struct usb_endpoint_descriptor *epd; | ||
318 | int ret, i; | ||
319 | struct usb_card_rec *card; | ||
320 | u16 id_vendor, id_product, bcd_device, bcd_usb; | ||
321 | |||
322 | card = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL); | ||
323 | if (!card) | ||
324 | return -ENOMEM; | ||
325 | |||
326 | id_vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
327 | id_product = le16_to_cpu(udev->descriptor.idProduct); | ||
328 | bcd_device = le16_to_cpu(udev->descriptor.bcdDevice); | ||
329 | bcd_usb = le16_to_cpu(udev->descriptor.bcdUSB); | ||
330 | pr_debug("info: VID/PID = %X/%X, Boot2 version = %X\n", | ||
331 | id_vendor, id_product, bcd_device); | ||
332 | |||
333 | /* PID_1 is used for firmware downloading only */ | ||
334 | if (id_product == USB8797_PID_1) | ||
335 | card->usb_boot_state = USB8797_FW_DNLD; | ||
336 | else | ||
337 | card->usb_boot_state = USB8797_FW_READY; | ||
338 | |||
339 | card->udev = udev; | ||
340 | card->intf = intf; | ||
341 | |||
342 | pr_debug("info: bcdUSB=%#x Device Class=%#x SubClass=%#x Protocl=%#x\n", | ||
343 | udev->descriptor.bcdUSB, udev->descriptor.bDeviceClass, | ||
344 | udev->descriptor.bDeviceSubClass, | ||
345 | udev->descriptor.bDeviceProtocol); | ||
346 | |||
347 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | ||
348 | epd = &iface_desc->endpoint[i].desc; | ||
349 | if (usb_endpoint_dir_in(epd) && | ||
350 | usb_endpoint_num(epd) == MWIFIEX_USB_EP_CMD_EVENT && | ||
351 | usb_endpoint_xfer_bulk(epd)) { | ||
352 | pr_debug("info: bulk IN: max pkt size: %d, addr: %d\n", | ||
353 | le16_to_cpu(epd->wMaxPacketSize), | ||
354 | epd->bEndpointAddress); | ||
355 | card->rx_cmd_ep = usb_endpoint_num(epd); | ||
356 | atomic_set(&card->rx_cmd_urb_pending, 0); | ||
357 | } | ||
358 | if (usb_endpoint_dir_in(epd) && | ||
359 | usb_endpoint_num(epd) == MWIFIEX_USB_EP_DATA && | ||
360 | usb_endpoint_xfer_bulk(epd)) { | ||
361 | pr_debug("info: bulk IN: max pkt size: %d, addr: %d\n", | ||
362 | le16_to_cpu(epd->wMaxPacketSize), | ||
363 | epd->bEndpointAddress); | ||
364 | card->rx_data_ep = usb_endpoint_num(epd); | ||
365 | atomic_set(&card->rx_data_urb_pending, 0); | ||
366 | } | ||
367 | if (usb_endpoint_dir_out(epd) && | ||
368 | usb_endpoint_num(epd) == MWIFIEX_USB_EP_DATA && | ||
369 | usb_endpoint_xfer_bulk(epd)) { | ||
370 | pr_debug("info: bulk OUT: max pkt size: %d, addr: %d\n", | ||
371 | le16_to_cpu(epd->wMaxPacketSize), | ||
372 | epd->bEndpointAddress); | ||
373 | card->tx_data_ep = usb_endpoint_num(epd); | ||
374 | atomic_set(&card->tx_data_urb_pending, 0); | ||
375 | } | ||
376 | if (usb_endpoint_dir_out(epd) && | ||
377 | usb_endpoint_num(epd) == MWIFIEX_USB_EP_CMD_EVENT && | ||
378 | usb_endpoint_xfer_bulk(epd)) { | ||
379 | pr_debug("info: bulk OUT: max pkt size: %d, addr: %d\n", | ||
380 | le16_to_cpu(epd->wMaxPacketSize), | ||
381 | epd->bEndpointAddress); | ||
382 | card->tx_cmd_ep = usb_endpoint_num(epd); | ||
383 | atomic_set(&card->tx_cmd_urb_pending, 0); | ||
384 | card->bulk_out_maxpktsize = | ||
385 | le16_to_cpu(epd->wMaxPacketSize); | ||
386 | } | ||
387 | } | ||
388 | |||
389 | usb_set_intfdata(intf, card); | ||
390 | |||
391 | ret = mwifiex_add_card(card, &add_remove_card_sem, &usb_ops, | ||
392 | MWIFIEX_USB); | ||
393 | if (ret) { | ||
394 | pr_err("%s: mwifiex_add_card failed: %d\n", __func__, ret); | ||
395 | usb_reset_device(udev); | ||
396 | kfree(card); | ||
397 | return ret; | ||
398 | } | ||
399 | |||
400 | usb_get_dev(udev); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | /* Kernel needs to suspend all functions separately. Therefore all | ||
406 | * registered functions must have drivers with suspend and resume | ||
407 | * methods. Failing that the kernel simply removes the whole card. | ||
408 | * | ||
409 | * If already not suspended, this function allocates and sends a | ||
410 | * 'host sleep activate' request to the firmware and turns off the traffic. | ||
411 | */ | ||
412 | static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message) | ||
413 | { | ||
414 | struct usb_card_rec *card = usb_get_intfdata(intf); | ||
415 | struct mwifiex_adapter *adapter; | ||
416 | int i; | ||
417 | |||
418 | if (!card || !card->adapter) { | ||
419 | pr_err("%s: card or card->adapter is NULL\n", __func__); | ||
420 | return 0; | ||
421 | } | ||
422 | adapter = card->adapter; | ||
423 | |||
424 | if (unlikely(adapter->is_suspended)) | ||
425 | dev_warn(adapter->dev, "Device already suspended\n"); | ||
426 | |||
427 | mwifiex_enable_hs(adapter); | ||
428 | |||
429 | /* 'is_suspended' flag indicates device is suspended. | ||
430 | * It must be set here before the usb_kill_urb() calls. Reason | ||
431 | * is in the complete handlers, urb->status(= -ENOENT) and | ||
432 | * this flag is used in combination to distinguish between a | ||
433 | * 'suspended' state and a 'disconnect' one. | ||
434 | */ | ||
435 | adapter->is_suspended = true; | ||
436 | |||
437 | for (i = 0; i < adapter->priv_num; i++) | ||
438 | netif_carrier_off(adapter->priv[i]->netdev); | ||
439 | |||
440 | if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb) | ||
441 | usb_kill_urb(card->rx_cmd.urb); | ||
442 | |||
443 | if (atomic_read(&card->rx_data_urb_pending)) | ||
444 | for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) | ||
445 | if (card->rx_data_list[i].urb) | ||
446 | usb_kill_urb(card->rx_data_list[i].urb); | ||
447 | |||
448 | for (i = 0; i < MWIFIEX_TX_DATA_URB; i++) | ||
449 | if (card->tx_data_list[i].urb) | ||
450 | usb_kill_urb(card->tx_data_list[i].urb); | ||
451 | |||
452 | if (card->tx_cmd.urb) | ||
453 | usb_kill_urb(card->tx_cmd.urb); | ||
454 | |||
455 | return 0; | ||
456 | } | ||
457 | |||
458 | /* Kernel needs to suspend all functions separately. Therefore all | ||
459 | * registered functions must have drivers with suspend and resume | ||
460 | * methods. Failing that the kernel simply removes the whole card. | ||
461 | * | ||
462 | * If already not resumed, this function turns on the traffic and | ||
463 | * sends a 'host sleep cancel' request to the firmware. | ||
464 | */ | ||
465 | static int mwifiex_usb_resume(struct usb_interface *intf) | ||
466 | { | ||
467 | struct usb_card_rec *card = usb_get_intfdata(intf); | ||
468 | struct mwifiex_adapter *adapter; | ||
469 | int i; | ||
470 | |||
471 | if (!card || !card->adapter) { | ||
472 | pr_err("%s: card or card->adapter is NULL\n", __func__); | ||
473 | return 0; | ||
474 | } | ||
475 | adapter = card->adapter; | ||
476 | |||
477 | if (unlikely(!adapter->is_suspended)) { | ||
478 | dev_warn(adapter->dev, "Device already resumed\n"); | ||
479 | return 0; | ||
480 | } | ||
481 | |||
482 | /* Indicate device resumed. The netdev queue will be resumed only | ||
483 | * after the urbs have been re-submitted | ||
484 | */ | ||
485 | adapter->is_suspended = false; | ||
486 | |||
487 | if (!atomic_read(&card->rx_data_urb_pending)) | ||
488 | for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) | ||
489 | mwifiex_usb_submit_rx_urb(&card->rx_data_list[i], | ||
490 | MWIFIEX_RX_DATA_BUF_SIZE); | ||
491 | |||
492 | if (!atomic_read(&card->rx_cmd_urb_pending)) { | ||
493 | card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE); | ||
494 | if (card->rx_cmd.skb) | ||
495 | mwifiex_usb_submit_rx_urb(&card->rx_cmd, | ||
496 | MWIFIEX_RX_CMD_BUF_SIZE); | ||
497 | } | ||
498 | |||
499 | for (i = 0; i < adapter->priv_num; i++) | ||
500 | if (adapter->priv[i]->media_connected) | ||
501 | netif_carrier_on(adapter->priv[i]->netdev); | ||
502 | |||
503 | /* Disable Host Sleep */ | ||
504 | if (adapter->hs_activated) | ||
505 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, | ||
506 | MWIFIEX_BSS_ROLE_ANY), | ||
507 | MWIFIEX_ASYNC_CMD); | ||
508 | |||
509 | #ifdef CONFIG_PM | ||
510 | /* Resume handler may be called due to remote wakeup, | ||
511 | * force to exit suspend anyway | ||
512 | */ | ||
513 | usb_disable_autosuspend(card->udev); | ||
514 | #endif /* CONFIG_PM */ | ||
515 | |||
516 | return 0; | ||
517 | } | ||
518 | |||
519 | static void mwifiex_usb_disconnect(struct usb_interface *intf) | ||
520 | { | ||
521 | struct usb_card_rec *card = usb_get_intfdata(intf); | ||
522 | struct mwifiex_adapter *adapter; | ||
523 | int i; | ||
524 | |||
525 | if (!card || !card->adapter) { | ||
526 | pr_err("%s: card or card->adapter is NULL\n", __func__); | ||
527 | return; | ||
528 | } | ||
529 | |||
530 | adapter = card->adapter; | ||
531 | if (!adapter->priv_num) | ||
532 | return; | ||
533 | |||
534 | /* In case driver is removed when asynchronous FW downloading is | ||
535 | * in progress | ||
536 | */ | ||
537 | wait_for_completion(&adapter->fw_load); | ||
538 | |||
539 | if (user_rmmod) { | ||
540 | #ifdef CONFIG_PM | ||
541 | if (adapter->is_suspended) | ||
542 | mwifiex_usb_resume(intf); | ||
543 | #endif | ||
544 | for (i = 0; i < adapter->priv_num; i++) | ||
545 | if ((GET_BSS_ROLE(adapter->priv[i]) == | ||
546 | MWIFIEX_BSS_ROLE_STA) && | ||
547 | adapter->priv[i]->media_connected) | ||
548 | mwifiex_deauthenticate(adapter->priv[i], NULL); | ||
549 | |||
550 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | ||
551 | MWIFIEX_BSS_ROLE_ANY), | ||
552 | MWIFIEX_FUNC_SHUTDOWN); | ||
553 | } | ||
554 | |||
555 | mwifiex_usb_free(card); | ||
556 | |||
557 | dev_dbg(adapter->dev, "%s: removing card\n", __func__); | ||
558 | mwifiex_remove_card(adapter, &add_remove_card_sem); | ||
559 | |||
560 | usb_set_intfdata(intf, NULL); | ||
561 | usb_put_dev(interface_to_usbdev(intf)); | ||
562 | kfree(card); | ||
563 | |||
564 | return; | ||
565 | } | ||
566 | |||
567 | static struct usb_driver mwifiex_usb_driver = { | ||
568 | .name = usbdriver_name, | ||
569 | .probe = mwifiex_usb_probe, | ||
570 | .disconnect = mwifiex_usb_disconnect, | ||
571 | .id_table = mwifiex_usb_table, | ||
572 | .suspend = mwifiex_usb_suspend, | ||
573 | .resume = mwifiex_usb_resume, | ||
574 | .supports_autosuspend = 1, | ||
575 | }; | ||
576 | |||
577 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) | ||
578 | { | ||
579 | struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; | ||
580 | int i; | ||
581 | |||
582 | card->tx_cmd.adapter = adapter; | ||
583 | card->tx_cmd.ep = card->tx_cmd_ep; | ||
584 | |||
585 | card->tx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL); | ||
586 | if (!card->tx_cmd.urb) { | ||
587 | dev_err(adapter->dev, "tx_cmd.urb allocation failed\n"); | ||
588 | return -ENOMEM; | ||
589 | } | ||
590 | |||
591 | card->tx_data_ix = 0; | ||
592 | |||
593 | for (i = 0; i < MWIFIEX_TX_DATA_URB; i++) { | ||
594 | card->tx_data_list[i].adapter = adapter; | ||
595 | card->tx_data_list[i].ep = card->tx_data_ep; | ||
596 | |||
597 | card->tx_data_list[i].urb = usb_alloc_urb(0, GFP_KERNEL); | ||
598 | if (!card->tx_data_list[i].urb) { | ||
599 | dev_err(adapter->dev, | ||
600 | "tx_data_list[] urb allocation failed\n"); | ||
601 | return -ENOMEM; | ||
602 | } | ||
603 | } | ||
604 | |||
605 | return 0; | ||
606 | } | ||
607 | |||
608 | static int mwifiex_usb_rx_init(struct mwifiex_adapter *adapter) | ||
609 | { | ||
610 | struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; | ||
611 | int i; | ||
612 | |||
613 | card->rx_cmd.adapter = adapter; | ||
614 | card->rx_cmd.ep = card->rx_cmd_ep; | ||
615 | |||
616 | card->rx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL); | ||
617 | if (!card->rx_cmd.urb) { | ||
618 | dev_err(adapter->dev, "rx_cmd.urb allocation failed\n"); | ||
619 | return -ENOMEM; | ||
620 | } | ||
621 | |||
622 | card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE); | ||
623 | if (!card->rx_cmd.skb) { | ||
624 | dev_err(adapter->dev, "rx_cmd.skb allocation failed\n"); | ||
625 | return -ENOMEM; | ||
626 | } | ||
627 | |||
628 | if (mwifiex_usb_submit_rx_urb(&card->rx_cmd, MWIFIEX_RX_CMD_BUF_SIZE)) | ||
629 | return -1; | ||
630 | |||
631 | for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) { | ||
632 | card->rx_data_list[i].adapter = adapter; | ||
633 | card->rx_data_list[i].ep = card->rx_data_ep; | ||
634 | |||
635 | card->rx_data_list[i].urb = usb_alloc_urb(0, GFP_KERNEL); | ||
636 | if (!card->rx_data_list[i].urb) { | ||
637 | dev_err(adapter->dev, | ||
638 | "rx_data_list[] urb allocation failed\n"); | ||
639 | return -1; | ||
640 | } | ||
641 | if (mwifiex_usb_submit_rx_urb(&card->rx_data_list[i], | ||
642 | MWIFIEX_RX_DATA_BUF_SIZE)) | ||
643 | return -1; | ||
644 | } | ||
645 | |||
646 | return 0; | ||
647 | } | ||
648 | |||
649 | static int mwifiex_write_data_sync(struct mwifiex_adapter *adapter, u8 *pbuf, | ||
650 | u32 *len, u8 ep, u32 timeout) | ||
651 | { | ||
652 | struct usb_card_rec *card = adapter->card; | ||
653 | int actual_length, ret; | ||
654 | |||
655 | if (!(*len % card->bulk_out_maxpktsize)) | ||
656 | (*len)++; | ||
657 | |||
658 | /* Send the data block */ | ||
659 | ret = usb_bulk_msg(card->udev, usb_sndbulkpipe(card->udev, ep), pbuf, | ||
660 | *len, &actual_length, timeout); | ||
661 | if (ret) { | ||
662 | dev_err(adapter->dev, "usb_bulk_msg for tx failed: %d\n", ret); | ||
663 | ret = -1; | ||
664 | } | ||
665 | |||
666 | *len = actual_length; | ||
667 | |||
668 | return ret; | ||
669 | } | ||
670 | |||
671 | static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *pbuf, | ||
672 | u32 *len, u8 ep, u32 timeout) | ||
673 | { | ||
674 | struct usb_card_rec *card = adapter->card; | ||
675 | int actual_length, ret; | ||
676 | |||
677 | /* Receive the data response */ | ||
678 | ret = usb_bulk_msg(card->udev, usb_rcvbulkpipe(card->udev, ep), pbuf, | ||
679 | *len, &actual_length, timeout); | ||
680 | if (ret) { | ||
681 | dev_err(adapter->dev, "usb_bulk_msg for rx failed: %d\n", ret); | ||
682 | ret = -1; | ||
683 | } | ||
684 | |||
685 | *len = actual_length; | ||
686 | |||
687 | return ret; | ||
688 | } | ||
689 | |||
690 | /* This function write a command/data packet to card. */ | ||
691 | static int mwifiex_usb_host_to_card(struct mwifiex_adapter *adapter, u8 ep, | ||
692 | struct sk_buff *skb, | ||
693 | struct mwifiex_tx_param *tx_param) | ||
694 | { | ||
695 | struct usb_card_rec *card = adapter->card; | ||
696 | struct urb_context *context; | ||
697 | u8 *data = (u8 *)skb->data; | ||
698 | struct urb *tx_urb; | ||
699 | |||
700 | if (adapter->is_suspended) { | ||
701 | dev_err(adapter->dev, | ||
702 | "%s: not allowed while suspended\n", __func__); | ||
703 | return -1; | ||
704 | } | ||
705 | |||
706 | if (adapter->surprise_removed) { | ||
707 | dev_err(adapter->dev, "%s: device removed\n", __func__); | ||
708 | return -1; | ||
709 | } | ||
710 | |||
711 | if (ep == card->tx_data_ep && | ||
712 | atomic_read(&card->tx_data_urb_pending) >= MWIFIEX_TX_DATA_URB) { | ||
713 | return -EBUSY; | ||
714 | } | ||
715 | |||
716 | dev_dbg(adapter->dev, "%s: ep=%d\n", __func__, ep); | ||
717 | |||
718 | if (ep == card->tx_cmd_ep) { | ||
719 | context = &card->tx_cmd; | ||
720 | } else { | ||
721 | if (card->tx_data_ix >= MWIFIEX_TX_DATA_URB) | ||
722 | card->tx_data_ix = 0; | ||
723 | context = &card->tx_data_list[card->tx_data_ix++]; | ||
724 | } | ||
725 | |||
726 | context->adapter = adapter; | ||
727 | context->ep = ep; | ||
728 | context->skb = skb; | ||
729 | tx_urb = context->urb; | ||
730 | |||
731 | usb_fill_bulk_urb(tx_urb, card->udev, usb_sndbulkpipe(card->udev, ep), | ||
732 | data, skb->len, mwifiex_usb_tx_complete, | ||
733 | (void *)context); | ||
734 | |||
735 | tx_urb->transfer_flags |= URB_ZERO_PACKET; | ||
736 | |||
737 | if (ep == card->tx_cmd_ep) | ||
738 | atomic_inc(&card->tx_cmd_urb_pending); | ||
739 | else | ||
740 | atomic_inc(&card->tx_data_urb_pending); | ||
741 | |||
742 | if (usb_submit_urb(tx_urb, GFP_ATOMIC)) { | ||
743 | dev_err(adapter->dev, "%s: usb_submit_urb failed\n", __func__); | ||
744 | if (ep == card->tx_cmd_ep) { | ||
745 | atomic_dec(&card->tx_cmd_urb_pending); | ||
746 | } else { | ||
747 | atomic_dec(&card->tx_data_urb_pending); | ||
748 | if (card->tx_data_ix) | ||
749 | card->tx_data_ix--; | ||
750 | else | ||
751 | card->tx_data_ix = MWIFIEX_TX_DATA_URB; | ||
752 | } | ||
753 | |||
754 | return -1; | ||
755 | } else { | ||
756 | if (ep == card->tx_data_ep && | ||
757 | atomic_read(&card->tx_data_urb_pending) == | ||
758 | MWIFIEX_TX_DATA_URB) | ||
759 | return -ENOSR; | ||
760 | } | ||
761 | |||
762 | return -EINPROGRESS; | ||
763 | } | ||
764 | |||
765 | /* This function register usb device and initialize parameter. */ | ||
766 | static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | ||
767 | { | ||
768 | struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; | ||
769 | |||
770 | card->adapter = adapter; | ||
771 | adapter->dev = &card->udev->dev; | ||
772 | strcpy(adapter->fw_name, USB8797_DEFAULT_FW_NAME); | ||
773 | |||
774 | return 0; | ||
775 | } | ||
776 | |||
777 | /* This function reads one block of firmware data. */ | ||
778 | static int mwifiex_get_fw_data(struct mwifiex_adapter *adapter, | ||
779 | u32 offset, u32 len, u8 *buf) | ||
780 | { | ||
781 | if (!buf || !len) | ||
782 | return -1; | ||
783 | |||
784 | if (offset + len > adapter->firmware->size) | ||
785 | return -1; | ||
786 | |||
787 | memcpy(buf, adapter->firmware->data + offset, len); | ||
788 | |||
789 | return 0; | ||
790 | } | ||
791 | |||
792 | static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, | ||
793 | struct mwifiex_fw_image *fw) | ||
794 | { | ||
795 | int ret = 0; | ||
796 | u8 *firmware = fw->fw_buf, *recv_buff; | ||
797 | u32 retries = USB8797_FW_MAX_RETRY, dlen; | ||
798 | u32 fw_seqnum = 0, tlen = 0, dnld_cmd = 0; | ||
799 | struct fw_data *fwdata; | ||
800 | struct fw_sync_header sync_fw; | ||
801 | u8 check_winner = 1; | ||
802 | |||
803 | if (!firmware) { | ||
804 | dev_err(adapter->dev, | ||
805 | "No firmware image found! Terminating download\n"); | ||
806 | ret = -1; | ||
807 | goto fw_exit; | ||
808 | } | ||
809 | |||
810 | /* Allocate memory for transmit */ | ||
811 | fwdata = kzalloc(FW_DNLD_TX_BUF_SIZE, GFP_KERNEL); | ||
812 | if (!fwdata) | ||
813 | goto fw_exit; | ||
814 | |||
815 | /* Allocate memory for receive */ | ||
816 | recv_buff = kzalloc(FW_DNLD_RX_BUF_SIZE, GFP_KERNEL); | ||
817 | if (!recv_buff) | ||
818 | goto cleanup; | ||
819 | |||
820 | do { | ||
821 | /* Send pseudo data to check winner status first */ | ||
822 | if (check_winner) { | ||
823 | memset(&fwdata->fw_hdr, 0, sizeof(struct fw_header)); | ||
824 | dlen = 0; | ||
825 | } else { | ||
826 | /* copy the header of the fw_data to get the length */ | ||
827 | if (firmware) | ||
828 | memcpy(&fwdata->fw_hdr, &firmware[tlen], | ||
829 | sizeof(struct fw_header)); | ||
830 | else | ||
831 | mwifiex_get_fw_data(adapter, tlen, | ||
832 | sizeof(struct fw_header), | ||
833 | (u8 *)&fwdata->fw_hdr); | ||
834 | |||
835 | dlen = le32_to_cpu(fwdata->fw_hdr.data_len); | ||
836 | dnld_cmd = le32_to_cpu(fwdata->fw_hdr.dnld_cmd); | ||
837 | tlen += sizeof(struct fw_header); | ||
838 | |||
839 | if (firmware) | ||
840 | memcpy(fwdata->data, &firmware[tlen], dlen); | ||
841 | else | ||
842 | mwifiex_get_fw_data(adapter, tlen, dlen, | ||
843 | (u8 *)fwdata->data); | ||
844 | |||
845 | fwdata->seq_num = cpu_to_le32(fw_seqnum); | ||
846 | tlen += dlen; | ||
847 | } | ||
848 | |||
849 | /* If the send/receive fails or CRC occurs then retry */ | ||
850 | while (retries--) { | ||
851 | u8 *buf = (u8 *)fwdata; | ||
852 | u32 len = FW_DATA_XMIT_SIZE; | ||
853 | |||
854 | /* send the firmware block */ | ||
855 | ret = mwifiex_write_data_sync(adapter, buf, &len, | ||
856 | MWIFIEX_USB_EP_CMD_EVENT, | ||
857 | MWIFIEX_USB_TIMEOUT); | ||
858 | if (ret) { | ||
859 | dev_err(adapter->dev, | ||
860 | "write_data_sync: failed: %d\n", ret); | ||
861 | continue; | ||
862 | } | ||
863 | |||
864 | buf = recv_buff; | ||
865 | len = FW_DNLD_RX_BUF_SIZE; | ||
866 | |||
867 | /* Receive the firmware block response */ | ||
868 | ret = mwifiex_read_data_sync(adapter, buf, &len, | ||
869 | MWIFIEX_USB_EP_CMD_EVENT, | ||
870 | MWIFIEX_USB_TIMEOUT); | ||
871 | if (ret) { | ||
872 | dev_err(adapter->dev, | ||
873 | "read_data_sync: failed: %d\n", ret); | ||
874 | continue; | ||
875 | } | ||
876 | |||
877 | memcpy(&sync_fw, recv_buff, | ||
878 | sizeof(struct fw_sync_header)); | ||
879 | |||
880 | /* check 1st firmware block resp for highest bit set */ | ||
881 | if (check_winner) { | ||
882 | if (le32_to_cpu(sync_fw.cmd) & 0x80000000) { | ||
883 | dev_warn(adapter->dev, | ||
884 | "USB is not the winner %#x\n", | ||
885 | sync_fw.cmd); | ||
886 | |||
887 | /* returning success */ | ||
888 | ret = 0; | ||
889 | goto cleanup; | ||
890 | } | ||
891 | |||
892 | dev_dbg(adapter->dev, | ||
893 | "USB is the winner, start to download FW\n"); | ||
894 | |||
895 | check_winner = 0; | ||
896 | break; | ||
897 | } | ||
898 | |||
899 | /* check the firmware block response for CRC errors */ | ||
900 | if (sync_fw.cmd) { | ||
901 | dev_err(adapter->dev, | ||
902 | "FW received block with CRC %#x\n", | ||
903 | sync_fw.cmd); | ||
904 | ret = -1; | ||
905 | continue; | ||
906 | } | ||
907 | |||
908 | retries = USB8797_FW_MAX_RETRY; | ||
909 | break; | ||
910 | } | ||
911 | fw_seqnum++; | ||
912 | } while ((dnld_cmd != FW_HAS_LAST_BLOCK) && retries); | ||
913 | |||
914 | cleanup: | ||
915 | dev_dbg(adapter->dev, "%s: %d bytes downloaded\n", __func__, tlen); | ||
916 | |||
917 | kfree(recv_buff); | ||
918 | kfree(fwdata); | ||
919 | |||
920 | if (retries) | ||
921 | ret = 0; | ||
922 | fw_exit: | ||
923 | return ret; | ||
924 | } | ||
925 | |||
926 | static int mwifiex_usb_dnld_fw(struct mwifiex_adapter *adapter, | ||
927 | struct mwifiex_fw_image *fw) | ||
928 | { | ||
929 | int ret; | ||
930 | struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; | ||
931 | |||
932 | if (card->usb_boot_state == USB8797_FW_DNLD) { | ||
933 | ret = mwifiex_prog_fw_w_helper(adapter, fw); | ||
934 | if (ret) | ||
935 | return -1; | ||
936 | |||
937 | /* Boot state changes after successful firmware download */ | ||
938 | if (card->usb_boot_state == USB8797_FW_DNLD) | ||
939 | return -1; | ||
940 | } | ||
941 | |||
942 | ret = mwifiex_usb_rx_init(adapter); | ||
943 | if (!ret) | ||
944 | ret = mwifiex_usb_tx_init(adapter); | ||
945 | |||
946 | return ret; | ||
947 | } | ||
948 | |||
949 | static void mwifiex_submit_rx_urb(struct mwifiex_adapter *adapter, u8 ep) | ||
950 | { | ||
951 | struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; | ||
952 | |||
953 | skb_push(card->rx_cmd.skb, INTF_HEADER_LEN); | ||
954 | if ((ep == card->rx_cmd_ep) && | ||
955 | (!atomic_read(&card->rx_cmd_urb_pending))) | ||
956 | mwifiex_usb_submit_rx_urb(&card->rx_cmd, | ||
957 | MWIFIEX_RX_CMD_BUF_SIZE); | ||
958 | |||
959 | return; | ||
960 | } | ||
961 | |||
962 | static int mwifiex_usb_cmd_event_complete(struct mwifiex_adapter *adapter, | ||
963 | struct sk_buff *skb) | ||
964 | { | ||
965 | atomic_dec(&adapter->rx_pending); | ||
966 | mwifiex_submit_rx_urb(adapter, MWIFIEX_USB_EP_CMD_EVENT); | ||
967 | |||
968 | return 0; | ||
969 | } | ||
970 | |||
971 | static int mwifiex_usb_data_complete(struct mwifiex_adapter *adapter, | ||
972 | struct sk_buff *skb) | ||
973 | { | ||
974 | atomic_dec(&adapter->rx_pending); | ||
975 | dev_kfree_skb_any(skb); | ||
976 | |||
977 | return 0; | ||
978 | } | ||
979 | |||
980 | /* This function wakes up the card. */ | ||
981 | static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) | ||
982 | { | ||
983 | /* Simulation of HS_AWAKE event */ | ||
984 | adapter->pm_wakeup_fw_try = false; | ||
985 | adapter->pm_wakeup_card_req = false; | ||
986 | adapter->ps_state = PS_STATE_AWAKE; | ||
987 | |||
988 | return 0; | ||
989 | } | ||
990 | |||
991 | static struct mwifiex_if_ops usb_ops = { | ||
992 | .register_dev = mwifiex_register_dev, | ||
993 | .wakeup = mwifiex_pm_wakeup_card, | ||
994 | .wakeup_complete = mwifiex_pm_wakeup_card_complete, | ||
995 | |||
996 | /* USB specific */ | ||
997 | .dnld_fw = mwifiex_usb_dnld_fw, | ||
998 | .cmdrsp_complete = mwifiex_usb_cmd_event_complete, | ||
999 | .event_complete = mwifiex_usb_cmd_event_complete, | ||
1000 | .data_complete = mwifiex_usb_data_complete, | ||
1001 | .host_to_card = mwifiex_usb_host_to_card, | ||
1002 | }; | ||
1003 | |||
1004 | /* This function initializes the USB driver module. | ||
1005 | * | ||
1006 | * This initiates the semaphore and registers the device with | ||
1007 | * USB bus. | ||
1008 | */ | ||
1009 | static int mwifiex_usb_init_module(void) | ||
1010 | { | ||
1011 | int ret; | ||
1012 | |||
1013 | pr_debug("Marvell USB8797 Driver\n"); | ||
1014 | |||
1015 | sema_init(&add_remove_card_sem, 1); | ||
1016 | |||
1017 | ret = usb_register(&mwifiex_usb_driver); | ||
1018 | if (ret) | ||
1019 | pr_err("Driver register failed!\n"); | ||
1020 | else | ||
1021 | pr_debug("info: Driver registered successfully!\n"); | ||
1022 | |||
1023 | return ret; | ||
1024 | } | ||
1025 | |||
1026 | /* This function cleans up the USB driver. | ||
1027 | * | ||
1028 | * The following major steps are followed in .disconnect for cleanup: | ||
1029 | * - Resume the device if its suspended | ||
1030 | * - Disconnect the device if connected | ||
1031 | * - Shutdown the firmware | ||
1032 | * - Unregister the device from USB bus. | ||
1033 | */ | ||
1034 | static void mwifiex_usb_cleanup_module(void) | ||
1035 | { | ||
1036 | if (!down_interruptible(&add_remove_card_sem)) | ||
1037 | up(&add_remove_card_sem); | ||
1038 | |||
1039 | /* set the flag as user is removing this module */ | ||
1040 | user_rmmod = 1; | ||
1041 | |||
1042 | usb_deregister(&mwifiex_usb_driver); | ||
1043 | } | ||
1044 | |||
1045 | module_init(mwifiex_usb_init_module); | ||
1046 | module_exit(mwifiex_usb_cleanup_module); | ||
1047 | |||
1048 | MODULE_AUTHOR("Marvell International Ltd."); | ||
1049 | MODULE_DESCRIPTION("Marvell WiFi-Ex USB Driver version" USB_VERSION); | ||
1050 | MODULE_VERSION(USB_VERSION); | ||
1051 | MODULE_LICENSE("GPL v2"); | ||
1052 | MODULE_FIRMWARE("mrvl/usb8797_uapsta.bin"); | ||
diff --git a/drivers/net/wireless/mwifiex/usb.h b/drivers/net/wireless/mwifiex/usb.h new file mode 100644 index 000000000000..98c4316cd1a9 --- /dev/null +++ b/drivers/net/wireless/mwifiex/usb.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * This file contains definitions for mwifiex USB interface driver. | ||
3 | * | ||
4 | * Copyright (C) 2012, Marvell International Ltd. | ||
5 | * | ||
6 | * This software file (the "File") is distributed by Marvell International | ||
7 | * Ltd. under the terms of the GNU General Public License Version 2, June 1991 | ||
8 | * (the "License"). You may use, redistribute and/or modify this File in | ||
9 | * accordance with the terms and conditions of the License, a copy of which | ||
10 | * is available by writing to the Free Software Foundation, Inc., | ||
11 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the | ||
12 | * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
13 | * | ||
14 | * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE | ||
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE | ||
16 | * ARE EXPRESSLY DISCLAIMED. The License provides additional details about | ||
17 | * this warranty disclaimer. | ||
18 | */ | ||
19 | |||
20 | #ifndef _MWIFIEX_USB_H | ||
21 | #define _MWIFIEX_USB_H | ||
22 | |||
23 | #include <linux/usb.h> | ||
24 | |||
25 | #define USB8797_VID 0x1286 | ||
26 | #define USB8797_PID_1 0x2043 | ||
27 | #define USB8797_PID_2 0x2044 | ||
28 | |||
29 | #define USB8797_FW_DNLD 1 | ||
30 | #define USB8797_FW_READY 2 | ||
31 | #define USB8797_FW_MAX_RETRY 3 | ||
32 | |||
33 | #define MWIFIEX_TX_DATA_URB 6 | ||
34 | #define MWIFIEX_RX_DATA_URB 6 | ||
35 | #define MWIFIEX_USB_TIMEOUT 100 | ||
36 | |||
37 | #define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin" | ||
38 | |||
39 | #define FW_DNLD_TX_BUF_SIZE 620 | ||
40 | #define FW_DNLD_RX_BUF_SIZE 2048 | ||
41 | #define FW_HAS_LAST_BLOCK 0x00000004 | ||
42 | |||
43 | #define FW_DATA_XMIT_SIZE \ | ||
44 | (sizeof(struct fw_header) + dlen + sizeof(u32)) | ||
45 | |||
46 | struct urb_context { | ||
47 | struct mwifiex_adapter *adapter; | ||
48 | struct sk_buff *skb; | ||
49 | struct urb *urb; | ||
50 | u8 ep; | ||
51 | }; | ||
52 | |||
53 | struct usb_card_rec { | ||
54 | struct mwifiex_adapter *adapter; | ||
55 | struct usb_device *udev; | ||
56 | struct usb_interface *intf; | ||
57 | u8 rx_cmd_ep; | ||
58 | struct urb_context rx_cmd; | ||
59 | atomic_t rx_cmd_urb_pending; | ||
60 | struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB]; | ||
61 | u8 usb_boot_state; | ||
62 | u8 rx_data_ep; | ||
63 | atomic_t rx_data_urb_pending; | ||
64 | u8 tx_data_ep; | ||
65 | u8 tx_cmd_ep; | ||
66 | atomic_t tx_data_urb_pending; | ||
67 | atomic_t tx_cmd_urb_pending; | ||
68 | int bulk_out_maxpktsize; | ||
69 | struct urb_context tx_cmd; | ||
70 | int tx_data_ix; | ||
71 | struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB]; | ||
72 | }; | ||
73 | |||
74 | struct fw_header { | ||
75 | __le32 dnld_cmd; | ||
76 | __le32 base_addr; | ||
77 | __le32 data_len; | ||
78 | __le32 crc; | ||
79 | }; | ||
80 | |||
81 | struct fw_sync_header { | ||
82 | __le32 cmd; | ||
83 | __le32 seq_num; | ||
84 | }; | ||
85 | |||
86 | struct fw_data { | ||
87 | struct fw_header fw_hdr; | ||
88 | __le32 seq_num; | ||
89 | u8 data[1]; | ||
90 | }; | ||
91 | |||
92 | /* This function is called after the card has woken up. */ | ||
93 | static inline int | ||
94 | mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) | ||
95 | { | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | #endif /*_MWIFIEX_USB_H */ | ||
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index 6b399976d6c8..2864c74bdb6f 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c | |||
@@ -167,6 +167,28 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
167 | skb->dev = priv->netdev; | 167 | skb->dev = priv->netdev; |
168 | skb->protocol = eth_type_trans(skb, priv->netdev); | 168 | skb->protocol = eth_type_trans(skb, priv->netdev); |
169 | skb->ip_summed = CHECKSUM_NONE; | 169 | skb->ip_summed = CHECKSUM_NONE; |
170 | |||
171 | /* This is required only in case of 11n and USB as we alloc | ||
172 | * a buffer of 4K only if its 11N (to be able to receive 4K | ||
173 | * AMSDU packets). In case of SD we allocate buffers based | ||
174 | * on the size of packet and hence this is not needed. | ||
175 | * | ||
176 | * Modifying the truesize here as our allocation for each | ||
177 | * skb is 4K but we only receive 2K packets and this cause | ||
178 | * the kernel to start dropping packets in case where | ||
179 | * application has allocated buffer based on 2K size i.e. | ||
180 | * if there a 64K packet received (in IP fragments and | ||
181 | * application allocates 64K to receive this packet but | ||
182 | * this packet would almost double up because we allocate | ||
183 | * each 1.5K fragment in 4K and pass it up. As soon as the | ||
184 | * 64K limit hits kernel will start to drop rest of the | ||
185 | * fragments. Currently we fail the Filesndl-ht.scr script | ||
186 | * for UDP, hence this fix | ||
187 | */ | ||
188 | if ((adapter->iface_type == MWIFIEX_USB) && | ||
189 | (skb->truesize > MWIFIEX_RX_DATA_BUF_SIZE)) | ||
190 | skb->truesize += (skb->len - MWIFIEX_RX_DATA_BUF_SIZE); | ||
191 | |||
170 | priv->stats.rx_bytes += skb->len; | 192 | priv->stats.rx_bytes += skb->len; |
171 | priv->stats.rx_packets++; | 193 | priv->stats.rx_packets++; |
172 | if (in_interrupt()) | 194 | if (in_interrupt()) |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 5a7316c6f125..429a1dee2d26 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -1120,11 +1120,19 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv, | |||
1120 | tx_info = MWIFIEX_SKB_TXCB(skb); | 1120 | tx_info = MWIFIEX_SKB_TXCB(skb); |
1121 | 1121 | ||
1122 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); | 1122 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); |
1123 | tx_param.next_pkt_len = | 1123 | |
1124 | ((skb_next) ? skb_next->len + | 1124 | if (adapter->iface_type == MWIFIEX_USB) { |
1125 | sizeof(struct txpd) : 0); | 1125 | adapter->data_sent = true; |
1126 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, skb, | 1126 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, |
1127 | &tx_param); | 1127 | skb, NULL); |
1128 | } else { | ||
1129 | tx_param.next_pkt_len = | ||
1130 | ((skb_next) ? skb_next->len + | ||
1131 | sizeof(struct txpd) : 0); | ||
1132 | ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, | ||
1133 | skb, &tx_param); | ||
1134 | } | ||
1135 | |||
1128 | switch (ret) { | 1136 | switch (ret) { |
1129 | case -EBUSY: | 1137 | case -EBUSY: |
1130 | dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); | 1138 | dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index 063bfa8b91f4..d91f4f628f65 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -83,6 +83,7 @@ | |||
83 | #define REV_RT3090E 0x0211 | 83 | #define REV_RT3090E 0x0211 |
84 | #define REV_RT3390E 0x0211 | 84 | #define REV_RT3390E 0x0211 |
85 | #define REV_RT5390F 0x0502 | 85 | #define REV_RT5390F 0x0502 |
86 | #define REV_RT5390R 0x1502 | ||
86 | 87 | ||
87 | /* | 88 | /* |
88 | * Signal information. | 89 | * Signal information. |
@@ -98,7 +99,7 @@ | |||
98 | #define EEPROM_BASE 0x0000 | 99 | #define EEPROM_BASE 0x0000 |
99 | #define EEPROM_SIZE 0x0110 | 100 | #define EEPROM_SIZE 0x0110 |
100 | #define BBP_BASE 0x0000 | 101 | #define BBP_BASE 0x0000 |
101 | #define BBP_SIZE 0x0080 | 102 | #define BBP_SIZE 0x00ff |
102 | #define RF_BASE 0x0004 | 103 | #define RF_BASE 0x0004 |
103 | #define RF_SIZE 0x0010 | 104 | #define RF_SIZE 0x0010 |
104 | 105 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index bd1980202f19..1cd16b416024 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -3356,6 +3356,13 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
3356 | rt2800_register_write(rt2x00dev, GPIO_CTRL_CFG, reg); | 3356 | rt2800_register_write(rt2x00dev, GPIO_CTRL_CFG, reg); |
3357 | } | 3357 | } |
3358 | 3358 | ||
3359 | /* This chip has hardware antenna diversity*/ | ||
3360 | if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) { | ||
3361 | rt2800_bbp_write(rt2x00dev, 150, 0); /* Disable Antenna Software OFDM */ | ||
3362 | rt2800_bbp_write(rt2x00dev, 151, 0); /* Disable Antenna Software CCK */ | ||
3363 | rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */ | ||
3364 | } | ||
3365 | |||
3359 | rt2800_bbp_read(rt2x00dev, 152, &value); | 3366 | rt2800_bbp_read(rt2x00dev, 152, &value); |
3360 | if (ant == 0) | 3367 | if (ant == 0) |
3361 | rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1); | 3368 | rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1); |
@@ -4291,6 +4298,11 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
4291 | rt2x00dev->default_ant.rx = ANTENNA_A; | 4298 | rt2x00dev->default_ant.rx = ANTENNA_A; |
4292 | } | 4299 | } |
4293 | 4300 | ||
4301 | if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) { | ||
4302 | rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; /* Unused */ | ||
4303 | rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; /* Unused */ | ||
4304 | } | ||
4305 | |||
4294 | /* | 4306 | /* |
4295 | * Determine external LNA informations. | 4307 | * Determine external LNA informations. |
4296 | */ | 4308 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 001735f7a661..5601302d09ad 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
922 | { USB_DEVICE(0x1482, 0x3c09) }, | 922 | { USB_DEVICE(0x1482, 0x3c09) }, |
923 | /* AirTies */ | 923 | /* AirTies */ |
924 | { USB_DEVICE(0x1eda, 0x2012) }, | 924 | { USB_DEVICE(0x1eda, 0x2012) }, |
925 | { USB_DEVICE(0x1eda, 0x2210) }, | ||
925 | { USB_DEVICE(0x1eda, 0x2310) }, | 926 | { USB_DEVICE(0x1eda, 0x2310) }, |
926 | /* Allwin */ | 927 | /* Allwin */ |
927 | { USB_DEVICE(0x8516, 0x2070) }, | 928 | { USB_DEVICE(0x8516, 0x2070) }, |
@@ -991,6 +992,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
991 | /* DVICO */ | 992 | /* DVICO */ |
992 | { USB_DEVICE(0x0fe9, 0xb307) }, | 993 | { USB_DEVICE(0x0fe9, 0xb307) }, |
993 | /* Edimax */ | 994 | /* Edimax */ |
995 | { USB_DEVICE(0x7392, 0x4085) }, | ||
994 | { USB_DEVICE(0x7392, 0x7711) }, | 996 | { USB_DEVICE(0x7392, 0x7711) }, |
995 | { USB_DEVICE(0x7392, 0x7717) }, | 997 | { USB_DEVICE(0x7392, 0x7717) }, |
996 | { USB_DEVICE(0x7392, 0x7718) }, | 998 | { USB_DEVICE(0x7392, 0x7718) }, |
@@ -1066,6 +1068,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1066 | /* Philips */ | 1068 | /* Philips */ |
1067 | { USB_DEVICE(0x0471, 0x200f) }, | 1069 | { USB_DEVICE(0x0471, 0x200f) }, |
1068 | /* Planex */ | 1070 | /* Planex */ |
1071 | { USB_DEVICE(0x2019, 0x5201) }, | ||
1069 | { USB_DEVICE(0x2019, 0xab25) }, | 1072 | { USB_DEVICE(0x2019, 0xab25) }, |
1070 | { USB_DEVICE(0x2019, 0xed06) }, | 1073 | { USB_DEVICE(0x2019, 0xed06) }, |
1071 | /* Quanta */ | 1074 | /* Quanta */ |
@@ -1134,6 +1137,10 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1134 | #ifdef CONFIG_RT2800USB_RT33XX | 1137 | #ifdef CONFIG_RT2800USB_RT33XX |
1135 | /* Belkin */ | 1138 | /* Belkin */ |
1136 | { USB_DEVICE(0x050d, 0x945b) }, | 1139 | { USB_DEVICE(0x050d, 0x945b) }, |
1140 | /* Panasonic */ | ||
1141 | { USB_DEVICE(0x083a, 0xb511) }, | ||
1142 | /* Philips */ | ||
1143 | { USB_DEVICE(0x0471, 0x20dd) }, | ||
1137 | /* Ralink */ | 1144 | /* Ralink */ |
1138 | { USB_DEVICE(0x148f, 0x3370) }, | 1145 | { USB_DEVICE(0x148f, 0x3370) }, |
1139 | { USB_DEVICE(0x148f, 0x8070) }, | 1146 | { USB_DEVICE(0x148f, 0x8070) }, |
@@ -1145,6 +1152,8 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1145 | { USB_DEVICE(0x8516, 0x3572) }, | 1152 | { USB_DEVICE(0x8516, 0x3572) }, |
1146 | /* Askey */ | 1153 | /* Askey */ |
1147 | { USB_DEVICE(0x1690, 0x0744) }, | 1154 | { USB_DEVICE(0x1690, 0x0744) }, |
1155 | { USB_DEVICE(0x1690, 0x0761) }, | ||
1156 | { USB_DEVICE(0x1690, 0x0764) }, | ||
1148 | /* Cisco */ | 1157 | /* Cisco */ |
1149 | { USB_DEVICE(0x167b, 0x4001) }, | 1158 | { USB_DEVICE(0x167b, 0x4001) }, |
1150 | /* EnGenius */ | 1159 | /* EnGenius */ |
@@ -1159,20 +1168,25 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1159 | /* Sitecom */ | 1168 | /* Sitecom */ |
1160 | { USB_DEVICE(0x0df6, 0x0041) }, | 1169 | { USB_DEVICE(0x0df6, 0x0041) }, |
1161 | { USB_DEVICE(0x0df6, 0x0062) }, | 1170 | { USB_DEVICE(0x0df6, 0x0062) }, |
1171 | { USB_DEVICE(0x0df6, 0x0065) }, | ||
1172 | { USB_DEVICE(0x0df6, 0x0066) }, | ||
1173 | { USB_DEVICE(0x0df6, 0x0068) }, | ||
1162 | /* Toshiba */ | 1174 | /* Toshiba */ |
1163 | { USB_DEVICE(0x0930, 0x0a07) }, | 1175 | { USB_DEVICE(0x0930, 0x0a07) }, |
1164 | /* Zinwell */ | 1176 | /* Zinwell */ |
1165 | { USB_DEVICE(0x5a57, 0x0284) }, | 1177 | { USB_DEVICE(0x5a57, 0x0284) }, |
1166 | #endif | 1178 | #endif |
1167 | #ifdef CONFIG_RT2800USB_RT53XX | 1179 | #ifdef CONFIG_RT2800USB_RT53XX |
1168 | /* Alpha */ | ||
1169 | { USB_DEVICE(0x2001, 0x3c15) }, | ||
1170 | { USB_DEVICE(0x2001, 0x3c19) }, | ||
1171 | /* Arcadyan */ | 1180 | /* Arcadyan */ |
1172 | { USB_DEVICE(0x043e, 0x7a12) }, | 1181 | { USB_DEVICE(0x043e, 0x7a12) }, |
1173 | /* Azurewave */ | 1182 | /* Azurewave */ |
1174 | { USB_DEVICE(0x13d3, 0x3329) }, | 1183 | { USB_DEVICE(0x13d3, 0x3329) }, |
1175 | { USB_DEVICE(0x13d3, 0x3365) }, | 1184 | { USB_DEVICE(0x13d3, 0x3365) }, |
1185 | /* D-Link */ | ||
1186 | { USB_DEVICE(0x2001, 0x3c15) }, | ||
1187 | { USB_DEVICE(0x2001, 0x3c19) }, | ||
1188 | { USB_DEVICE(0x2001, 0x3c1c) }, | ||
1189 | { USB_DEVICE(0x2001, 0x3c1d) }, | ||
1176 | /* LG innotek */ | 1190 | /* LG innotek */ |
1177 | { USB_DEVICE(0x043e, 0x7a22) }, | 1191 | { USB_DEVICE(0x043e, 0x7a22) }, |
1178 | /* Panasonic */ | 1192 | /* Panasonic */ |
@@ -1224,12 +1238,8 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1224 | { USB_DEVICE(0x07d1, 0x3c0b) }, | 1238 | { USB_DEVICE(0x07d1, 0x3c0b) }, |
1225 | { USB_DEVICE(0x07d1, 0x3c17) }, | 1239 | { USB_DEVICE(0x07d1, 0x3c17) }, |
1226 | { USB_DEVICE(0x2001, 0x3c17) }, | 1240 | { USB_DEVICE(0x2001, 0x3c17) }, |
1227 | /* Edimax */ | ||
1228 | { USB_DEVICE(0x7392, 0x4085) }, | ||
1229 | /* Encore */ | 1241 | /* Encore */ |
1230 | { USB_DEVICE(0x203d, 0x14a1) }, | 1242 | { USB_DEVICE(0x203d, 0x14a1) }, |
1231 | /* Fujitsu Stylistic 550 */ | ||
1232 | { USB_DEVICE(0x1690, 0x0761) }, | ||
1233 | /* Gemtek */ | 1243 | /* Gemtek */ |
1234 | { USB_DEVICE(0x15a9, 0x0010) }, | 1244 | { USB_DEVICE(0x15a9, 0x0010) }, |
1235 | /* Gigabyte */ | 1245 | /* Gigabyte */ |
@@ -1250,7 +1260,6 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1250 | { USB_DEVICE(0x05a6, 0x0101) }, | 1260 | { USB_DEVICE(0x05a6, 0x0101) }, |
1251 | { USB_DEVICE(0x1d4d, 0x0010) }, | 1261 | { USB_DEVICE(0x1d4d, 0x0010) }, |
1252 | /* Planex */ | 1262 | /* Planex */ |
1253 | { USB_DEVICE(0x2019, 0x5201) }, | ||
1254 | { USB_DEVICE(0x2019, 0xab24) }, | 1263 | { USB_DEVICE(0x2019, 0xab24) }, |
1255 | /* Qcom */ | 1264 | /* Qcom */ |
1256 | { USB_DEVICE(0x18e8, 0x6259) }, | 1265 | { USB_DEVICE(0x18e8, 0x6259) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 5583214721e0..ca36cccaba31 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1282,7 +1282,7 @@ void rt2x00lib_dmadone(struct queue_entry *entry); | |||
1282 | void rt2x00lib_txdone(struct queue_entry *entry, | 1282 | void rt2x00lib_txdone(struct queue_entry *entry, |
1283 | struct txdone_entry_desc *txdesc); | 1283 | struct txdone_entry_desc *txdesc); |
1284 | void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); | 1284 | void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); |
1285 | void rt2x00lib_rxdone(struct queue_entry *entry); | 1285 | void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp); |
1286 | 1286 | ||
1287 | /* | 1287 | /* |
1288 | * mac80211 handlers. | 1288 | * mac80211 handlers. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index dd87d41ac936..e5404e576251 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -588,7 +588,7 @@ static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, | |||
588 | return 0; | 588 | return 0; |
589 | } | 589 | } |
590 | 590 | ||
591 | void rt2x00lib_rxdone(struct queue_entry *entry) | 591 | void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp) |
592 | { | 592 | { |
593 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 593 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
594 | struct rxdone_entry_desc rxdesc; | 594 | struct rxdone_entry_desc rxdesc; |
@@ -608,7 +608,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry) | |||
608 | * Allocate a new sk_buffer. If no new buffer available, drop the | 608 | * Allocate a new sk_buffer. If no new buffer available, drop the |
609 | * received frame and reuse the existing buffer. | 609 | * received frame and reuse the existing buffer. |
610 | */ | 610 | */ |
611 | skb = rt2x00queue_alloc_rxskb(entry); | 611 | skb = rt2x00queue_alloc_rxskb(entry, gfp); |
612 | if (!skb) | 612 | if (!skb) |
613 | goto submit_entry; | 613 | goto submit_entry; |
614 | 614 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 78bd43b8961f..a0935987fa3a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -103,7 +103,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | |||
103 | * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. | 103 | * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. |
104 | * @entry: The entry for which the skb will be applicable. | 104 | * @entry: The entry for which the skb will be applicable. |
105 | */ | 105 | */ |
106 | struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry); | 106 | struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * rt2x00queue_free_skb - free a skb | 109 | * rt2x00queue_free_skb - free a skb |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 17148bb24426..0a4653a92cab 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -92,7 +92,7 @@ bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
92 | /* | 92 | /* |
93 | * Send the frame to rt2x00lib for further processing. | 93 | * Send the frame to rt2x00lib for further processing. |
94 | */ | 94 | */ |
95 | rt2x00lib_rxdone(entry); | 95 | rt2x00lib_rxdone(entry, GFP_ATOMIC); |
96 | } | 96 | } |
97 | 97 | ||
98 | return !max_rx; | 98 | return !max_rx; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 8ecf409476cd..4c662eccf53c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "rt2x00.h" | 33 | #include "rt2x00.h" |
34 | #include "rt2x00lib.h" | 34 | #include "rt2x00lib.h" |
35 | 35 | ||
36 | struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry) | 36 | struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp) |
37 | { | 37 | { |
38 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 38 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
39 | struct sk_buff *skb; | 39 | struct sk_buff *skb; |
@@ -68,7 +68,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry) | |||
68 | /* | 68 | /* |
69 | * Allocate skbuffer. | 69 | * Allocate skbuffer. |
70 | */ | 70 | */ |
71 | skb = dev_alloc_skb(frame_size + head_size + tail_size); | 71 | skb = __dev_alloc_skb(frame_size + head_size + tail_size, gfp); |
72 | if (!skb) | 72 | if (!skb) |
73 | return NULL; | 73 | return NULL; |
74 | 74 | ||
@@ -1163,7 +1163,7 @@ static int rt2x00queue_alloc_rxskbs(struct data_queue *queue) | |||
1163 | struct sk_buff *skb; | 1163 | struct sk_buff *skb; |
1164 | 1164 | ||
1165 | for (i = 0; i < queue->limit; i++) { | 1165 | for (i = 0; i < queue->limit; i++) { |
1166 | skb = rt2x00queue_alloc_rxskb(&queue->entries[i]); | 1166 | skb = rt2x00queue_alloc_rxskb(&queue->entries[i], GFP_KERNEL); |
1167 | if (!skb) | 1167 | if (!skb) |
1168 | return -ENOMEM; | 1168 | return -ENOMEM; |
1169 | queue->entries[i].skb = skb; | 1169 | queue->entries[i].skb = skb; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 66094eb21b61..d357d1ed92f6 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -358,7 +358,7 @@ static void rt2x00usb_work_rxdone(struct work_struct *work) | |||
358 | /* | 358 | /* |
359 | * Send the frame to rt2x00lib for further processing. | 359 | * Send the frame to rt2x00lib for further processing. |
360 | */ | 360 | */ |
361 | rt2x00lib_rxdone(entry); | 361 | rt2x00lib_rxdone(entry, GFP_KERNEL); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c index 1208b753f62f..f7f48c7ac854 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | |||
@@ -33,9 +33,6 @@ | |||
33 | #include "../pci.h" | 33 | #include "../pci.h" |
34 | #include "../base.h" | 34 | #include "../base.h" |
35 | 35 | ||
36 | struct dig_t dm_digtable; | ||
37 | static struct ps_t dm_pstable; | ||
38 | |||
39 | #define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) | 36 | #define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) |
40 | #define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) | 37 | #define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) |
41 | #define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) | 38 | #define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) |
@@ -163,33 +160,37 @@ static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { | |||
163 | 160 | ||
164 | static void rtl92c_dm_diginit(struct ieee80211_hw *hw) | 161 | static void rtl92c_dm_diginit(struct ieee80211_hw *hw) |
165 | { | 162 | { |
166 | dm_digtable.dig_enable_flag = true; | 163 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
167 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 164 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; |
168 | dm_digtable.cur_igvalue = 0x20; | 165 | |
169 | dm_digtable.pre_igvalue = 0x0; | 166 | dm_digtable->dig_enable_flag = true; |
170 | dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 167 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
171 | dm_digtable.presta_connectstate = DIG_STA_DISCONNECT; | 168 | dm_digtable->cur_igvalue = 0x20; |
172 | dm_digtable.curmultista_connectstate = DIG_MULTISTA_DISCONNECT; | 169 | dm_digtable->pre_igvalue = 0x0; |
173 | dm_digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; | 170 | dm_digtable->cursta_connectctate = DIG_STA_DISCONNECT; |
174 | dm_digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; | 171 | dm_digtable->presta_connectstate = DIG_STA_DISCONNECT; |
175 | dm_digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; | 172 | dm_digtable->curmultista_connectstate = DIG_MULTISTA_DISCONNECT; |
176 | dm_digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; | 173 | dm_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; |
177 | dm_digtable.rx_gain_range_max = DM_DIG_MAX; | 174 | dm_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; |
178 | dm_digtable.rx_gain_range_min = DM_DIG_MIN; | 175 | dm_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; |
179 | dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; | 176 | dm_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; |
180 | dm_digtable.backoff_val_range_max = DM_DIG_BACKOFF_MAX; | 177 | dm_digtable->rx_gain_range_max = DM_DIG_MAX; |
181 | dm_digtable.backoff_val_range_min = DM_DIG_BACKOFF_MIN; | 178 | dm_digtable->rx_gain_range_min = DM_DIG_MIN; |
182 | dm_digtable.pre_cck_pd_state = CCK_PD_STAGE_MAX; | 179 | dm_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT; |
183 | dm_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; | 180 | dm_digtable->backoff_val_range_max = DM_DIG_BACKOFF_MAX; |
181 | dm_digtable->backoff_val_range_min = DM_DIG_BACKOFF_MIN; | ||
182 | dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX; | ||
183 | dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; | ||
184 | } | 184 | } |
185 | 185 | ||
186 | static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) | 186 | static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) |
187 | { | 187 | { |
188 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 188 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
189 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
189 | long rssi_val_min = 0; | 190 | long rssi_val_min = 0; |
190 | 191 | ||
191 | if ((dm_digtable.curmultista_connectstate == DIG_MULTISTA_CONNECT) && | 192 | if ((dm_digtable->curmultista_connectstate == DIG_MULTISTA_CONNECT) && |
192 | (dm_digtable.cursta_connectctate == DIG_STA_CONNECT)) { | 193 | (dm_digtable->cursta_connectctate == DIG_STA_CONNECT)) { |
193 | if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb != 0) | 194 | if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb != 0) |
194 | rssi_val_min = | 195 | rssi_val_min = |
195 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb > | 196 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb > |
@@ -198,10 +199,10 @@ static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) | |||
198 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 199 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
199 | else | 200 | else |
200 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; | 201 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; |
201 | } else if (dm_digtable.cursta_connectctate == DIG_STA_CONNECT || | 202 | } else if (dm_digtable->cursta_connectctate == DIG_STA_CONNECT || |
202 | dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT) { | 203 | dm_digtable->cursta_connectctate == DIG_STA_BEFORE_CONNECT) { |
203 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; | 204 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; |
204 | } else if (dm_digtable.curmultista_connectstate == | 205 | } else if (dm_digtable->curmultista_connectstate == |
205 | DIG_MULTISTA_CONNECT) { | 206 | DIG_MULTISTA_CONNECT) { |
206 | rssi_val_min = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 207 | rssi_val_min = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
207 | } | 208 | } |
@@ -260,7 +261,8 @@ static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) | |||
260 | static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) | 261 | static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) |
261 | { | 262 | { |
262 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 263 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
263 | u8 value_igi = dm_digtable.cur_igvalue; | 264 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; |
265 | u8 value_igi = dm_digtable->cur_igvalue; | ||
264 | 266 | ||
265 | if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) | 267 | if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) |
266 | value_igi--; | 268 | value_igi--; |
@@ -277,43 +279,44 @@ static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) | |||
277 | if (rtlpriv->falsealm_cnt.cnt_all > 10000) | 279 | if (rtlpriv->falsealm_cnt.cnt_all > 10000) |
278 | value_igi = 0x32; | 280 | value_igi = 0x32; |
279 | 281 | ||
280 | dm_digtable.cur_igvalue = value_igi; | 282 | dm_digtable->cur_igvalue = value_igi; |
281 | rtl92c_dm_write_dig(hw); | 283 | rtl92c_dm_write_dig(hw); |
282 | } | 284 | } |
283 | 285 | ||
284 | static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) | 286 | static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) |
285 | { | 287 | { |
286 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 288 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
289 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
287 | 290 | ||
288 | if (rtlpriv->falsealm_cnt.cnt_all > dm_digtable.fa_highthresh) { | 291 | if (rtlpriv->falsealm_cnt.cnt_all > dm_digtable->fa_highthresh) { |
289 | if ((dm_digtable.backoff_val - 2) < | 292 | if ((dm_digtable->backoff_val - 2) < |
290 | dm_digtable.backoff_val_range_min) | 293 | dm_digtable->backoff_val_range_min) |
291 | dm_digtable.backoff_val = | 294 | dm_digtable->backoff_val = |
292 | dm_digtable.backoff_val_range_min; | 295 | dm_digtable->backoff_val_range_min; |
293 | else | 296 | else |
294 | dm_digtable.backoff_val -= 2; | 297 | dm_digtable->backoff_val -= 2; |
295 | } else if (rtlpriv->falsealm_cnt.cnt_all < dm_digtable.fa_lowthresh) { | 298 | } else if (rtlpriv->falsealm_cnt.cnt_all < dm_digtable->fa_lowthresh) { |
296 | if ((dm_digtable.backoff_val + 2) > | 299 | if ((dm_digtable->backoff_val + 2) > |
297 | dm_digtable.backoff_val_range_max) | 300 | dm_digtable->backoff_val_range_max) |
298 | dm_digtable.backoff_val = | 301 | dm_digtable->backoff_val = |
299 | dm_digtable.backoff_val_range_max; | 302 | dm_digtable->backoff_val_range_max; |
300 | else | 303 | else |
301 | dm_digtable.backoff_val += 2; | 304 | dm_digtable->backoff_val += 2; |
302 | } | 305 | } |
303 | 306 | ||
304 | if ((dm_digtable.rssi_val_min + 10 - dm_digtable.backoff_val) > | 307 | if ((dm_digtable->rssi_val_min + 10 - dm_digtable->backoff_val) > |
305 | dm_digtable.rx_gain_range_max) | 308 | dm_digtable->rx_gain_range_max) |
306 | dm_digtable.cur_igvalue = dm_digtable.rx_gain_range_max; | 309 | dm_digtable->cur_igvalue = dm_digtable->rx_gain_range_max; |
307 | else if ((dm_digtable.rssi_val_min + 10 - | 310 | else if ((dm_digtable->rssi_val_min + 10 - |
308 | dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min) | 311 | dm_digtable->backoff_val) < dm_digtable->rx_gain_range_min) |
309 | dm_digtable.cur_igvalue = dm_digtable.rx_gain_range_min; | 312 | dm_digtable->cur_igvalue = dm_digtable->rx_gain_range_min; |
310 | else | 313 | else |
311 | dm_digtable.cur_igvalue = dm_digtable.rssi_val_min + 10 - | 314 | dm_digtable->cur_igvalue = dm_digtable->rssi_val_min + 10 - |
312 | dm_digtable.backoff_val; | 315 | dm_digtable->backoff_val; |
313 | 316 | ||
314 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, | 317 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
315 | "rssi_val_min = %x backoff_val %x\n", | 318 | "rssi_val_min = %x backoff_val %x\n", |
316 | dm_digtable.rssi_val_min, dm_digtable.backoff_val); | 319 | dm_digtable->rssi_val_min, dm_digtable->backoff_val); |
317 | 320 | ||
318 | rtl92c_dm_write_dig(hw); | 321 | rtl92c_dm_write_dig(hw); |
319 | } | 322 | } |
@@ -322,6 +325,7 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) | |||
322 | { | 325 | { |
323 | static u8 initialized; /* initialized to false */ | 326 | static u8 initialized; /* initialized to false */ |
324 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 327 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
328 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
325 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 329 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
326 | long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 330 | long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
327 | bool multi_sta = false; | 331 | bool multi_sta = false; |
@@ -330,68 +334,69 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) | |||
330 | multi_sta = true; | 334 | multi_sta = true; |
331 | 335 | ||
332 | if (!multi_sta || | 336 | if (!multi_sta || |
333 | dm_digtable.cursta_connectctate != DIG_STA_DISCONNECT) { | 337 | dm_digtable->cursta_connectctate != DIG_STA_DISCONNECT) { |
334 | initialized = false; | 338 | initialized = false; |
335 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 339 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
336 | return; | 340 | return; |
337 | } else if (initialized == false) { | 341 | } else if (initialized == false) { |
338 | initialized = true; | 342 | initialized = true; |
339 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; | 343 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; |
340 | dm_digtable.cur_igvalue = 0x20; | 344 | dm_digtable->cur_igvalue = 0x20; |
341 | rtl92c_dm_write_dig(hw); | 345 | rtl92c_dm_write_dig(hw); |
342 | } | 346 | } |
343 | 347 | ||
344 | if (dm_digtable.curmultista_connectstate == DIG_MULTISTA_CONNECT) { | 348 | if (dm_digtable->curmultista_connectstate == DIG_MULTISTA_CONNECT) { |
345 | if ((rssi_strength < dm_digtable.rssi_lowthresh) && | 349 | if ((rssi_strength < dm_digtable->rssi_lowthresh) && |
346 | (dm_digtable.dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { | 350 | (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { |
347 | 351 | ||
348 | if (dm_digtable.dig_ext_port_stage == | 352 | if (dm_digtable->dig_ext_port_stage == |
349 | DIG_EXT_PORT_STAGE_2) { | 353 | DIG_EXT_PORT_STAGE_2) { |
350 | dm_digtable.cur_igvalue = 0x20; | 354 | dm_digtable->cur_igvalue = 0x20; |
351 | rtl92c_dm_write_dig(hw); | 355 | rtl92c_dm_write_dig(hw); |
352 | } | 356 | } |
353 | 357 | ||
354 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; | 358 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; |
355 | } else if (rssi_strength > dm_digtable.rssi_highthresh) { | 359 | } else if (rssi_strength > dm_digtable->rssi_highthresh) { |
356 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; | 360 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; |
357 | rtl92c_dm_ctrl_initgain_by_fa(hw); | 361 | rtl92c_dm_ctrl_initgain_by_fa(hw); |
358 | } | 362 | } |
359 | } else if (dm_digtable.dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { | 363 | } else if (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { |
360 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; | 364 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; |
361 | dm_digtable.cur_igvalue = 0x20; | 365 | dm_digtable->cur_igvalue = 0x20; |
362 | rtl92c_dm_write_dig(hw); | 366 | rtl92c_dm_write_dig(hw); |
363 | } | 367 | } |
364 | 368 | ||
365 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, | 369 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
366 | "curmultista_connectstate = %x dig_ext_port_stage %x\n", | 370 | "curmultista_connectstate = %x dig_ext_port_stage %x\n", |
367 | dm_digtable.curmultista_connectstate, | 371 | dm_digtable->curmultista_connectstate, |
368 | dm_digtable.dig_ext_port_stage); | 372 | dm_digtable->dig_ext_port_stage); |
369 | } | 373 | } |
370 | 374 | ||
371 | static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) | 375 | static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) |
372 | { | 376 | { |
373 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 377 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
378 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
374 | 379 | ||
375 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, | 380 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
376 | "presta_connectstate = %x, cursta_connectctate = %x\n", | 381 | "presta_connectstate = %x, cursta_connectctate = %x\n", |
377 | dm_digtable.presta_connectstate, | 382 | dm_digtable->presta_connectstate, |
378 | dm_digtable.cursta_connectctate); | 383 | dm_digtable->cursta_connectctate); |
379 | 384 | ||
380 | if (dm_digtable.presta_connectstate == dm_digtable.cursta_connectctate | 385 | if (dm_digtable->presta_connectstate == dm_digtable->cursta_connectctate |
381 | || dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT | 386 | || dm_digtable->cursta_connectctate == DIG_STA_BEFORE_CONNECT |
382 | || dm_digtable.cursta_connectctate == DIG_STA_CONNECT) { | 387 | || dm_digtable->cursta_connectctate == DIG_STA_CONNECT) { |
383 | 388 | ||
384 | if (dm_digtable.cursta_connectctate != DIG_STA_DISCONNECT) { | 389 | if (dm_digtable->cursta_connectctate != DIG_STA_DISCONNECT) { |
385 | dm_digtable.rssi_val_min = | 390 | dm_digtable->rssi_val_min = |
386 | rtl92c_dm_initial_gain_min_pwdb(hw); | 391 | rtl92c_dm_initial_gain_min_pwdb(hw); |
387 | rtl92c_dm_ctrl_initgain_by_rssi(hw); | 392 | rtl92c_dm_ctrl_initgain_by_rssi(hw); |
388 | } | 393 | } |
389 | } else { | 394 | } else { |
390 | dm_digtable.rssi_val_min = 0; | 395 | dm_digtable->rssi_val_min = 0; |
391 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 396 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
392 | dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; | 397 | dm_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT; |
393 | dm_digtable.cur_igvalue = 0x20; | 398 | dm_digtable->cur_igvalue = 0x20; |
394 | dm_digtable.pre_igvalue = 0; | 399 | dm_digtable->pre_igvalue = 0; |
395 | rtl92c_dm_write_dig(hw); | 400 | rtl92c_dm_write_dig(hw); |
396 | } | 401 | } |
397 | } | 402 | } |
@@ -400,40 +405,41 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
400 | { | 405 | { |
401 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 406 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
402 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 407 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
408 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
403 | 409 | ||
404 | if (dm_digtable.cursta_connectctate == DIG_STA_CONNECT) { | 410 | if (dm_digtable->cursta_connectctate == DIG_STA_CONNECT) { |
405 | dm_digtable.rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); | 411 | dm_digtable->rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); |
406 | 412 | ||
407 | if (dm_digtable.pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { | 413 | if (dm_digtable->pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { |
408 | if (dm_digtable.rssi_val_min <= 25) | 414 | if (dm_digtable->rssi_val_min <= 25) |
409 | dm_digtable.cur_cck_pd_state = | 415 | dm_digtable->cur_cck_pd_state = |
410 | CCK_PD_STAGE_LowRssi; | 416 | CCK_PD_STAGE_LowRssi; |
411 | else | 417 | else |
412 | dm_digtable.cur_cck_pd_state = | 418 | dm_digtable->cur_cck_pd_state = |
413 | CCK_PD_STAGE_HighRssi; | 419 | CCK_PD_STAGE_HighRssi; |
414 | } else { | 420 | } else { |
415 | if (dm_digtable.rssi_val_min <= 20) | 421 | if (dm_digtable->rssi_val_min <= 20) |
416 | dm_digtable.cur_cck_pd_state = | 422 | dm_digtable->cur_cck_pd_state = |
417 | CCK_PD_STAGE_LowRssi; | 423 | CCK_PD_STAGE_LowRssi; |
418 | else | 424 | else |
419 | dm_digtable.cur_cck_pd_state = | 425 | dm_digtable->cur_cck_pd_state = |
420 | CCK_PD_STAGE_HighRssi; | 426 | CCK_PD_STAGE_HighRssi; |
421 | } | 427 | } |
422 | } else { | 428 | } else { |
423 | dm_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; | 429 | dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; |
424 | } | 430 | } |
425 | 431 | ||
426 | if (dm_digtable.pre_cck_pd_state != dm_digtable.cur_cck_pd_state) { | 432 | if (dm_digtable->pre_cck_pd_state != dm_digtable->cur_cck_pd_state) { |
427 | if (dm_digtable.cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { | 433 | if (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { |
428 | if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) | 434 | if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) |
429 | dm_digtable.cur_cck_fa_state = | 435 | dm_digtable->cur_cck_fa_state = |
430 | CCK_FA_STAGE_High; | 436 | CCK_FA_STAGE_High; |
431 | else | 437 | else |
432 | dm_digtable.cur_cck_fa_state = CCK_FA_STAGE_Low; | 438 | dm_digtable->cur_cck_fa_state = CCK_FA_STAGE_Low; |
433 | 439 | ||
434 | if (dm_digtable.pre_cck_fa_state != | 440 | if (dm_digtable->pre_cck_fa_state != |
435 | dm_digtable.cur_cck_fa_state) { | 441 | dm_digtable->cur_cck_fa_state) { |
436 | if (dm_digtable.cur_cck_fa_state == | 442 | if (dm_digtable->cur_cck_fa_state == |
437 | CCK_FA_STAGE_Low) | 443 | CCK_FA_STAGE_Low) |
438 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, | 444 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, |
439 | 0x83); | 445 | 0x83); |
@@ -441,8 +447,8 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
441 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, | 447 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, |
442 | 0xcd); | 448 | 0xcd); |
443 | 449 | ||
444 | dm_digtable.pre_cck_fa_state = | 450 | dm_digtable->pre_cck_fa_state = |
445 | dm_digtable.cur_cck_fa_state; | 451 | dm_digtable->cur_cck_fa_state; |
446 | } | 452 | } |
447 | 453 | ||
448 | rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); | 454 | rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); |
@@ -458,11 +464,11 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
458 | rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, | 464 | rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, |
459 | MASKBYTE2, 0xd3); | 465 | MASKBYTE2, 0xd3); |
460 | } | 466 | } |
461 | dm_digtable.pre_cck_pd_state = dm_digtable.cur_cck_pd_state; | 467 | dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state; |
462 | } | 468 | } |
463 | 469 | ||
464 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", | 470 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", |
465 | dm_digtable.cur_cck_pd_state); | 471 | dm_digtable->cur_cck_pd_state); |
466 | 472 | ||
467 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", | 473 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", |
468 | IS_92C_SERIAL(rtlhal->version)); | 474 | IS_92C_SERIAL(rtlhal->version)); |
@@ -470,31 +476,34 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
470 | 476 | ||
471 | static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) | 477 | static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) |
472 | { | 478 | { |
479 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
480 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
473 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 481 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
474 | 482 | ||
475 | if (mac->act_scanning) | 483 | if (mac->act_scanning) |
476 | return; | 484 | return; |
477 | 485 | ||
478 | if (mac->link_state >= MAC80211_LINKED) | 486 | if (mac->link_state >= MAC80211_LINKED) |
479 | dm_digtable.cursta_connectctate = DIG_STA_CONNECT; | 487 | dm_digtable->cursta_connectctate = DIG_STA_CONNECT; |
480 | else | 488 | else |
481 | dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 489 | dm_digtable->cursta_connectctate = DIG_STA_DISCONNECT; |
482 | 490 | ||
483 | rtl92c_dm_initial_gain_sta(hw); | 491 | rtl92c_dm_initial_gain_sta(hw); |
484 | rtl92c_dm_initial_gain_multi_sta(hw); | 492 | rtl92c_dm_initial_gain_multi_sta(hw); |
485 | rtl92c_dm_cck_packet_detection_thresh(hw); | 493 | rtl92c_dm_cck_packet_detection_thresh(hw); |
486 | 494 | ||
487 | dm_digtable.presta_connectstate = dm_digtable.cursta_connectctate; | 495 | dm_digtable->presta_connectstate = dm_digtable->cursta_connectctate; |
488 | 496 | ||
489 | } | 497 | } |
490 | 498 | ||
491 | static void rtl92c_dm_dig(struct ieee80211_hw *hw) | 499 | static void rtl92c_dm_dig(struct ieee80211_hw *hw) |
492 | { | 500 | { |
493 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 501 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
502 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
494 | 503 | ||
495 | if (rtlpriv->dm.dm_initialgain_enable == false) | 504 | if (rtlpriv->dm.dm_initialgain_enable == false) |
496 | return; | 505 | return; |
497 | if (dm_digtable.dig_enable_flag == false) | 506 | if (dm_digtable->dig_enable_flag == false) |
498 | return; | 507 | return; |
499 | 508 | ||
500 | rtl92c_dm_ctrl_initgain_by_twoport(hw); | 509 | rtl92c_dm_ctrl_initgain_by_twoport(hw); |
@@ -514,23 +523,24 @@ static void rtl92c_dm_init_dynamic_txpower(struct ieee80211_hw *hw) | |||
514 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw) | 523 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw) |
515 | { | 524 | { |
516 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 525 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
526 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
517 | 527 | ||
518 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 528 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
519 | "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", | 529 | "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", |
520 | dm_digtable.cur_igvalue, dm_digtable.pre_igvalue, | 530 | dm_digtable->cur_igvalue, dm_digtable->pre_igvalue, |
521 | dm_digtable.backoff_val); | 531 | dm_digtable->backoff_val); |
522 | 532 | ||
523 | dm_digtable.cur_igvalue += 2; | 533 | dm_digtable->cur_igvalue += 2; |
524 | if (dm_digtable.cur_igvalue > 0x3f) | 534 | if (dm_digtable->cur_igvalue > 0x3f) |
525 | dm_digtable.cur_igvalue = 0x3f; | 535 | dm_digtable->cur_igvalue = 0x3f; |
526 | 536 | ||
527 | if (dm_digtable.pre_igvalue != dm_digtable.cur_igvalue) { | 537 | if (dm_digtable->pre_igvalue != dm_digtable->cur_igvalue) { |
528 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, | 538 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, |
529 | dm_digtable.cur_igvalue); | 539 | dm_digtable->cur_igvalue); |
530 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, | 540 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, |
531 | dm_digtable.cur_igvalue); | 541 | dm_digtable->cur_igvalue); |
532 | 542 | ||
533 | dm_digtable.pre_igvalue = dm_digtable.cur_igvalue; | 543 | dm_digtable->pre_igvalue = dm_digtable->cur_igvalue; |
534 | } | 544 | } |
535 | } | 545 | } |
536 | EXPORT_SYMBOL(rtl92c_dm_write_dig); | 546 | EXPORT_SYMBOL(rtl92c_dm_write_dig); |
@@ -1223,15 +1233,20 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) | |||
1223 | 1233 | ||
1224 | static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) | 1234 | static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) |
1225 | { | 1235 | { |
1226 | dm_pstable.pre_ccastate = CCA_MAX; | 1236 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1227 | dm_pstable.cur_ccasate = CCA_MAX; | 1237 | struct ps_t *dm_pstable = &rtlpriv->dm_pstable; |
1228 | dm_pstable.pre_rfstate = RF_MAX; | 1238 | |
1229 | dm_pstable.cur_rfstate = RF_MAX; | 1239 | dm_pstable->pre_ccastate = CCA_MAX; |
1230 | dm_pstable.rssi_val_min = 0; | 1240 | dm_pstable->cur_ccasate = CCA_MAX; |
1241 | dm_pstable->pre_rfstate = RF_MAX; | ||
1242 | dm_pstable->cur_rfstate = RF_MAX; | ||
1243 | dm_pstable->rssi_val_min = 0; | ||
1231 | } | 1244 | } |
1232 | 1245 | ||
1233 | void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) | 1246 | void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) |
1234 | { | 1247 | { |
1248 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1249 | struct ps_t *dm_pstable = &rtlpriv->dm_pstable; | ||
1235 | static u8 initialize; | 1250 | static u8 initialize; |
1236 | static u32 reg_874, reg_c70, reg_85c, reg_a74; | 1251 | static u32 reg_874, reg_c70, reg_85c, reg_a74; |
1237 | 1252 | ||
@@ -1251,27 +1266,27 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) | |||
1251 | } | 1266 | } |
1252 | 1267 | ||
1253 | if (!bforce_in_normal) { | 1268 | if (!bforce_in_normal) { |
1254 | if (dm_pstable.rssi_val_min != 0) { | 1269 | if (dm_pstable->rssi_val_min != 0) { |
1255 | if (dm_pstable.pre_rfstate == RF_NORMAL) { | 1270 | if (dm_pstable->pre_rfstate == RF_NORMAL) { |
1256 | if (dm_pstable.rssi_val_min >= 30) | 1271 | if (dm_pstable->rssi_val_min >= 30) |
1257 | dm_pstable.cur_rfstate = RF_SAVE; | 1272 | dm_pstable->cur_rfstate = RF_SAVE; |
1258 | else | 1273 | else |
1259 | dm_pstable.cur_rfstate = RF_NORMAL; | 1274 | dm_pstable->cur_rfstate = RF_NORMAL; |
1260 | } else { | 1275 | } else { |
1261 | if (dm_pstable.rssi_val_min <= 25) | 1276 | if (dm_pstable->rssi_val_min <= 25) |
1262 | dm_pstable.cur_rfstate = RF_NORMAL; | 1277 | dm_pstable->cur_rfstate = RF_NORMAL; |
1263 | else | 1278 | else |
1264 | dm_pstable.cur_rfstate = RF_SAVE; | 1279 | dm_pstable->cur_rfstate = RF_SAVE; |
1265 | } | 1280 | } |
1266 | } else { | 1281 | } else { |
1267 | dm_pstable.cur_rfstate = RF_MAX; | 1282 | dm_pstable->cur_rfstate = RF_MAX; |
1268 | } | 1283 | } |
1269 | } else { | 1284 | } else { |
1270 | dm_pstable.cur_rfstate = RF_NORMAL; | 1285 | dm_pstable->cur_rfstate = RF_NORMAL; |
1271 | } | 1286 | } |
1272 | 1287 | ||
1273 | if (dm_pstable.pre_rfstate != dm_pstable.cur_rfstate) { | 1288 | if (dm_pstable->pre_rfstate != dm_pstable->cur_rfstate) { |
1274 | if (dm_pstable.cur_rfstate == RF_SAVE) { | 1289 | if (dm_pstable->cur_rfstate == RF_SAVE) { |
1275 | rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, | 1290 | rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, |
1276 | 0x1C0000, 0x2); | 1291 | 0x1C0000, 0x2); |
1277 | rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0); | 1292 | rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0); |
@@ -1293,7 +1308,7 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) | |||
1293 | rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); | 1308 | rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); |
1294 | } | 1309 | } |
1295 | 1310 | ||
1296 | dm_pstable.pre_rfstate = dm_pstable.cur_rfstate; | 1311 | dm_pstable->pre_rfstate = dm_pstable->cur_rfstate; |
1297 | } | 1312 | } |
1298 | } | 1313 | } |
1299 | EXPORT_SYMBOL(rtl92c_dm_rf_saving); | 1314 | EXPORT_SYMBOL(rtl92c_dm_rf_saving); |
@@ -1301,36 +1316,37 @@ EXPORT_SYMBOL(rtl92c_dm_rf_saving); | |||
1301 | static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) | 1316 | static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) |
1302 | { | 1317 | { |
1303 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1318 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1319 | struct ps_t *dm_pstable = &rtlpriv->dm_pstable; | ||
1304 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 1320 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
1305 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 1321 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1306 | 1322 | ||
1307 | if (((mac->link_state == MAC80211_NOLINK)) && | 1323 | if (((mac->link_state == MAC80211_NOLINK)) && |
1308 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { | 1324 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { |
1309 | dm_pstable.rssi_val_min = 0; | 1325 | dm_pstable->rssi_val_min = 0; |
1310 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n"); | 1326 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n"); |
1311 | } | 1327 | } |
1312 | 1328 | ||
1313 | if (mac->link_state == MAC80211_LINKED) { | 1329 | if (mac->link_state == MAC80211_LINKED) { |
1314 | if (mac->opmode == NL80211_IFTYPE_ADHOC) { | 1330 | if (mac->opmode == NL80211_IFTYPE_ADHOC) { |
1315 | dm_pstable.rssi_val_min = | 1331 | dm_pstable->rssi_val_min = |
1316 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 1332 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
1317 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, | 1333 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, |
1318 | "AP Client PWDB = 0x%lx\n", | 1334 | "AP Client PWDB = 0x%lx\n", |
1319 | dm_pstable.rssi_val_min); | 1335 | dm_pstable->rssi_val_min); |
1320 | } else { | 1336 | } else { |
1321 | dm_pstable.rssi_val_min = | 1337 | dm_pstable->rssi_val_min = |
1322 | rtlpriv->dm.undecorated_smoothed_pwdb; | 1338 | rtlpriv->dm.undecorated_smoothed_pwdb; |
1323 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, | 1339 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, |
1324 | "STA Default Port PWDB = 0x%lx\n", | 1340 | "STA Default Port PWDB = 0x%lx\n", |
1325 | dm_pstable.rssi_val_min); | 1341 | dm_pstable->rssi_val_min); |
1326 | } | 1342 | } |
1327 | } else { | 1343 | } else { |
1328 | dm_pstable.rssi_val_min = | 1344 | dm_pstable->rssi_val_min = |
1329 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 1345 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
1330 | 1346 | ||
1331 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, | 1347 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, |
1332 | "AP Ext Port PWDB = 0x%lx\n", | 1348 | "AP Ext Port PWDB = 0x%lx\n", |
1333 | dm_pstable.rssi_val_min); | 1349 | dm_pstable->rssi_val_min); |
1334 | } | 1350 | } |
1335 | 1351 | ||
1336 | if (IS_92C_SERIAL(rtlhal->version)) | 1352 | if (IS_92C_SERIAL(rtlhal->version)) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h index 2178e3761883..518e208c0180 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | |||
@@ -91,40 +91,6 @@ | |||
91 | #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 | 91 | #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 |
92 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 | 92 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 |
93 | 93 | ||
94 | struct ps_t { | ||
95 | u8 pre_ccastate; | ||
96 | u8 cur_ccasate; | ||
97 | u8 pre_rfstate; | ||
98 | u8 cur_rfstate; | ||
99 | long rssi_val_min; | ||
100 | }; | ||
101 | |||
102 | struct dig_t { | ||
103 | u8 dig_enable_flag; | ||
104 | u8 dig_ext_port_stage; | ||
105 | u32 rssi_lowthresh; | ||
106 | u32 rssi_highthresh; | ||
107 | u32 fa_lowthresh; | ||
108 | u32 fa_highthresh; | ||
109 | u8 cursta_connectctate; | ||
110 | u8 presta_connectstate; | ||
111 | u8 curmultista_connectstate; | ||
112 | u8 pre_igvalue; | ||
113 | u8 cur_igvalue; | ||
114 | char backoff_val; | ||
115 | char backoff_val_range_max; | ||
116 | char backoff_val_range_min; | ||
117 | u8 rx_gain_range_max; | ||
118 | u8 rx_gain_range_min; | ||
119 | u8 rssi_val_min; | ||
120 | u8 pre_cck_pd_state; | ||
121 | u8 cur_cck_pd_state; | ||
122 | u8 pre_cck_fa_state; | ||
123 | u8 cur_cck_fa_state; | ||
124 | u8 pre_ccastate; | ||
125 | u8 cur_ccasate; | ||
126 | }; | ||
127 | |||
128 | struct swat_t { | 94 | struct swat_t { |
129 | u8 failure_cnt; | 95 | u8 failure_cnt; |
130 | u8 try_flag; | 96 | u8 try_flag; |
@@ -189,7 +155,6 @@ enum dm_dig_connect_e { | |||
189 | DIG_CONNECT_MAX | 155 | DIG_CONNECT_MAX |
190 | }; | 156 | }; |
191 | 157 | ||
192 | extern struct dig_t dm_digtable; | ||
193 | void rtl92c_dm_init(struct ieee80211_hw *hw); | 158 | void rtl92c_dm_init(struct ieee80211_hw *hw); |
194 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); | 159 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); |
195 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); | 160 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c index 4c016241f340..cdcad7d9f15e 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | |||
@@ -1881,6 +1881,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw) | |||
1881 | { | 1881 | { |
1882 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1882 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1883 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1883 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
1884 | struct dig_t dm_digtable = rtlpriv->dm_digtable; | ||
1884 | 1885 | ||
1885 | RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, | 1886 | RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, |
1886 | "--->Cmd(%#x), set_io_inprogress(%d)\n", | 1887 | "--->Cmd(%#x), set_io_inprogress(%d)\n", |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h index 26747fa86005..d4a3d032c7bf 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h | |||
@@ -86,40 +86,6 @@ | |||
86 | #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 | 86 | #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 |
87 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 | 87 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 |
88 | 88 | ||
89 | struct ps_t { | ||
90 | u8 pre_ccastate; | ||
91 | u8 cur_ccasate; | ||
92 | u8 pre_rfstate; | ||
93 | u8 cur_rfstate; | ||
94 | long rssi_val_min; | ||
95 | }; | ||
96 | |||
97 | struct dig_t { | ||
98 | u8 dig_enable_flag; | ||
99 | u8 dig_ext_port_stage; | ||
100 | u32 rssi_lowthresh; | ||
101 | u32 rssi_highthresh; | ||
102 | u32 fa_lowthresh; | ||
103 | u32 fa_highthresh; | ||
104 | u8 cursta_connectctate; | ||
105 | u8 presta_connectstate; | ||
106 | u8 curmultista_connectstate; | ||
107 | u8 pre_igvalue; | ||
108 | u8 cur_igvalue; | ||
109 | char backoff_val; | ||
110 | char backoff_val_range_max; | ||
111 | char backoff_val_range_min; | ||
112 | u8 rx_gain_range_max; | ||
113 | u8 rx_gain_range_min; | ||
114 | u8 rssi_val_min; | ||
115 | u8 pre_cck_pd_state; | ||
116 | u8 cur_cck_pd_state; | ||
117 | u8 pre_cck_fa_state; | ||
118 | u8 cur_cck_fa_state; | ||
119 | u8 pre_ccastate; | ||
120 | u8 cur_ccasate; | ||
121 | }; | ||
122 | |||
123 | struct swat_t { | 89 | struct swat_t { |
124 | u8 failure_cnt; | 90 | u8 failure_cnt; |
125 | u8 try_flag; | 91 | u8 try_flag; |
@@ -184,7 +150,6 @@ enum dm_dig_connect_e { | |||
184 | DIG_CONNECT_MAX | 150 | DIG_CONNECT_MAX |
185 | }; | 151 | }; |
186 | 152 | ||
187 | extern struct dig_t dm_digtable; | ||
188 | void rtl92c_dm_init(struct ieee80211_hw *hw); | 153 | void rtl92c_dm_init(struct ieee80211_hw *hw); |
189 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); | 154 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); |
190 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); | 155 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c index 4737018c9daa..a7d63a84551a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c | |||
@@ -37,8 +37,6 @@ | |||
37 | 37 | ||
38 | #define UNDEC_SM_PWDB entry_min_undecoratedsmoothed_pwdb | 38 | #define UNDEC_SM_PWDB entry_min_undecoratedsmoothed_pwdb |
39 | 39 | ||
40 | struct dig_t de_digtable; | ||
41 | |||
42 | static const u32 ofdmswing_table[OFDM_TABLE_SIZE_92D] = { | 40 | static const u32 ofdmswing_table[OFDM_TABLE_SIZE_92D] = { |
43 | 0x7f8001fe, /* 0, +6.0dB */ | 41 | 0x7f8001fe, /* 0, +6.0dB */ |
44 | 0x788001e2, /* 1, +5.5dB */ | 42 | 0x788001e2, /* 1, +5.5dB */ |
@@ -159,27 +157,30 @@ static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { | |||
159 | 157 | ||
160 | static void rtl92d_dm_diginit(struct ieee80211_hw *hw) | 158 | static void rtl92d_dm_diginit(struct ieee80211_hw *hw) |
161 | { | 159 | { |
162 | de_digtable.dig_enable_flag = true; | 160 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
163 | de_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 161 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; |
164 | de_digtable.cur_igvalue = 0x20; | 162 | |
165 | de_digtable.pre_igvalue = 0x0; | 163 | de_digtable->dig_enable_flag = true; |
166 | de_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 164 | de_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
167 | de_digtable.presta_connectstate = DIG_STA_DISCONNECT; | 165 | de_digtable->cur_igvalue = 0x20; |
168 | de_digtable.curmultista_connectstate = DIG_MULTISTA_DISCONNECT; | 166 | de_digtable->pre_igvalue = 0x0; |
169 | de_digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; | 167 | de_digtable->cursta_connectctate = DIG_STA_DISCONNECT; |
170 | de_digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; | 168 | de_digtable->presta_connectstate = DIG_STA_DISCONNECT; |
171 | de_digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; | 169 | de_digtable->curmultista_connectstate = DIG_MULTISTA_DISCONNECT; |
172 | de_digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; | 170 | de_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; |
173 | de_digtable.rx_gain_range_max = DM_DIG_FA_UPPER; | 171 | de_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; |
174 | de_digtable.rx_gain_range_min = DM_DIG_FA_LOWER; | 172 | de_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; |
175 | de_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; | 173 | de_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; |
176 | de_digtable.backoff_val_range_max = DM_DIG_BACKOFF_MAX; | 174 | de_digtable->rx_gain_range_max = DM_DIG_FA_UPPER; |
177 | de_digtable.backoff_val_range_min = DM_DIG_BACKOFF_MIN; | 175 | de_digtable->rx_gain_range_min = DM_DIG_FA_LOWER; |
178 | de_digtable.pre_cck_pd_state = CCK_PD_STAGE_LOWRSSI; | 176 | de_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT; |
179 | de_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; | 177 | de_digtable->backoff_val_range_max = DM_DIG_BACKOFF_MAX; |
180 | de_digtable.large_fa_hit = 0; | 178 | de_digtable->backoff_val_range_min = DM_DIG_BACKOFF_MIN; |
181 | de_digtable.recover_cnt = 0; | 179 | de_digtable->pre_cck_pd_state = CCK_PD_STAGE_LOWRSSI; |
182 | de_digtable.forbidden_igi = DM_DIG_FA_LOWER; | 180 | de_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; |
181 | de_digtable->large_fa_hit = 0; | ||
182 | de_digtable->recover_cnt = 0; | ||
183 | de_digtable->forbidden_igi = DM_DIG_FA_LOWER; | ||
183 | } | 184 | } |
184 | 185 | ||
185 | static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) | 186 | static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) |
@@ -266,68 +267,70 @@ static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) | |||
266 | static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw) | 267 | static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw) |
267 | { | 268 | { |
268 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 269 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
270 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; | ||
269 | struct rtl_mac *mac = rtl_mac(rtlpriv); | 271 | struct rtl_mac *mac = rtl_mac(rtlpriv); |
270 | 272 | ||
271 | /* Determine the minimum RSSI */ | 273 | /* Determine the minimum RSSI */ |
272 | if ((mac->link_state < MAC80211_LINKED) && | 274 | if ((mac->link_state < MAC80211_LINKED) && |
273 | (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { | 275 | (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { |
274 | de_digtable.min_undecorated_pwdb_for_dm = 0; | 276 | de_digtable->min_undecorated_pwdb_for_dm = 0; |
275 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, | 277 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
276 | "Not connected to any\n"); | 278 | "Not connected to any\n"); |
277 | } | 279 | } |
278 | if (mac->link_state >= MAC80211_LINKED) { | 280 | if (mac->link_state >= MAC80211_LINKED) { |
279 | if (mac->opmode == NL80211_IFTYPE_AP || | 281 | if (mac->opmode == NL80211_IFTYPE_AP || |
280 | mac->opmode == NL80211_IFTYPE_ADHOC) { | 282 | mac->opmode == NL80211_IFTYPE_ADHOC) { |
281 | de_digtable.min_undecorated_pwdb_for_dm = | 283 | de_digtable->min_undecorated_pwdb_for_dm = |
282 | rtlpriv->dm.UNDEC_SM_PWDB; | 284 | rtlpriv->dm.UNDEC_SM_PWDB; |
283 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, | 285 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
284 | "AP Client PWDB = 0x%lx\n", | 286 | "AP Client PWDB = 0x%lx\n", |
285 | rtlpriv->dm.UNDEC_SM_PWDB); | 287 | rtlpriv->dm.UNDEC_SM_PWDB); |
286 | } else { | 288 | } else { |
287 | de_digtable.min_undecorated_pwdb_for_dm = | 289 | de_digtable->min_undecorated_pwdb_for_dm = |
288 | rtlpriv->dm.undecorated_smoothed_pwdb; | 290 | rtlpriv->dm.undecorated_smoothed_pwdb; |
289 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, | 291 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
290 | "STA Default Port PWDB = 0x%x\n", | 292 | "STA Default Port PWDB = 0x%x\n", |
291 | de_digtable.min_undecorated_pwdb_for_dm); | 293 | de_digtable->min_undecorated_pwdb_for_dm); |
292 | } | 294 | } |
293 | } else { | 295 | } else { |
294 | de_digtable.min_undecorated_pwdb_for_dm = | 296 | de_digtable->min_undecorated_pwdb_for_dm = |
295 | rtlpriv->dm.UNDEC_SM_PWDB; | 297 | rtlpriv->dm.UNDEC_SM_PWDB; |
296 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, | 298 | RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
297 | "AP Ext Port or disconnect PWDB = 0x%x\n", | 299 | "AP Ext Port or disconnect PWDB = 0x%x\n", |
298 | de_digtable.min_undecorated_pwdb_for_dm); | 300 | de_digtable->min_undecorated_pwdb_for_dm); |
299 | } | 301 | } |
300 | 302 | ||
301 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n", | 303 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n", |
302 | de_digtable.min_undecorated_pwdb_for_dm); | 304 | de_digtable->min_undecorated_pwdb_for_dm); |
303 | } | 305 | } |
304 | 306 | ||
305 | static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | 307 | static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) |
306 | { | 308 | { |
307 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 309 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
310 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; | ||
308 | unsigned long flag = 0; | 311 | unsigned long flag = 0; |
309 | 312 | ||
310 | if (de_digtable.cursta_connectctate == DIG_STA_CONNECT) { | 313 | if (de_digtable->cursta_connectctate == DIG_STA_CONNECT) { |
311 | if (de_digtable.pre_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { | 314 | if (de_digtable->pre_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { |
312 | if (de_digtable.min_undecorated_pwdb_for_dm <= 25) | 315 | if (de_digtable->min_undecorated_pwdb_for_dm <= 25) |
313 | de_digtable.cur_cck_pd_state = | 316 | de_digtable->cur_cck_pd_state = |
314 | CCK_PD_STAGE_LOWRSSI; | 317 | CCK_PD_STAGE_LOWRSSI; |
315 | else | 318 | else |
316 | de_digtable.cur_cck_pd_state = | 319 | de_digtable->cur_cck_pd_state = |
317 | CCK_PD_STAGE_HIGHRSSI; | 320 | CCK_PD_STAGE_HIGHRSSI; |
318 | } else { | 321 | } else { |
319 | if (de_digtable.min_undecorated_pwdb_for_dm <= 20) | 322 | if (de_digtable->min_undecorated_pwdb_for_dm <= 20) |
320 | de_digtable.cur_cck_pd_state = | 323 | de_digtable->cur_cck_pd_state = |
321 | CCK_PD_STAGE_LOWRSSI; | 324 | CCK_PD_STAGE_LOWRSSI; |
322 | else | 325 | else |
323 | de_digtable.cur_cck_pd_state = | 326 | de_digtable->cur_cck_pd_state = |
324 | CCK_PD_STAGE_HIGHRSSI; | 327 | CCK_PD_STAGE_HIGHRSSI; |
325 | } | 328 | } |
326 | } else { | 329 | } else { |
327 | de_digtable.cur_cck_pd_state = CCK_PD_STAGE_LOWRSSI; | 330 | de_digtable->cur_cck_pd_state = CCK_PD_STAGE_LOWRSSI; |
328 | } | 331 | } |
329 | if (de_digtable.pre_cck_pd_state != de_digtable.cur_cck_pd_state) { | 332 | if (de_digtable->pre_cck_pd_state != de_digtable->cur_cck_pd_state) { |
330 | if (de_digtable.cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { | 333 | if (de_digtable->cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { |
331 | rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); | 334 | rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); |
332 | rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0x83); | 335 | rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0x83); |
333 | rtl92d_release_cckandrw_pagea_ctl(hw, &flag); | 336 | rtl92d_release_cckandrw_pagea_ctl(hw, &flag); |
@@ -336,13 +339,13 @@ static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
336 | rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0xcd); | 339 | rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0xcd); |
337 | rtl92d_release_cckandrw_pagea_ctl(hw, &flag); | 340 | rtl92d_release_cckandrw_pagea_ctl(hw, &flag); |
338 | } | 341 | } |
339 | de_digtable.pre_cck_pd_state = de_digtable.cur_cck_pd_state; | 342 | de_digtable->pre_cck_pd_state = de_digtable->cur_cck_pd_state; |
340 | } | 343 | } |
341 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CurSTAConnectState=%s\n", | 344 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CurSTAConnectState=%s\n", |
342 | de_digtable.cursta_connectctate == DIG_STA_CONNECT ? | 345 | de_digtable->cursta_connectctate == DIG_STA_CONNECT ? |
343 | "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT"); | 346 | "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT"); |
344 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CCKPDStage=%s\n", | 347 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CCKPDStage=%s\n", |
345 | de_digtable.cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ? | 348 | de_digtable->cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ? |
346 | "Low RSSI " : "High RSSI "); | 349 | "Low RSSI " : "High RSSI "); |
347 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "is92d single phy =%x\n", | 350 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "is92d single phy =%x\n", |
348 | IS_92D_SINGLEPHY(rtlpriv->rtlhal.version)); | 351 | IS_92D_SINGLEPHY(rtlpriv->rtlhal.version)); |
@@ -352,37 +355,40 @@ static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
352 | void rtl92d_dm_write_dig(struct ieee80211_hw *hw) | 355 | void rtl92d_dm_write_dig(struct ieee80211_hw *hw) |
353 | { | 356 | { |
354 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 357 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
358 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; | ||
355 | 359 | ||
356 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 360 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
357 | "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", | 361 | "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", |
358 | de_digtable.cur_igvalue, de_digtable.pre_igvalue, | 362 | de_digtable->cur_igvalue, de_digtable->pre_igvalue, |
359 | de_digtable.backoff_val); | 363 | de_digtable->backoff_val); |
360 | if (de_digtable.dig_enable_flag == false) { | 364 | if (de_digtable->dig_enable_flag == false) { |
361 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "DIG is disabled\n"); | 365 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "DIG is disabled\n"); |
362 | de_digtable.pre_igvalue = 0x17; | 366 | de_digtable->pre_igvalue = 0x17; |
363 | return; | 367 | return; |
364 | } | 368 | } |
365 | if (de_digtable.pre_igvalue != de_digtable.cur_igvalue) { | 369 | if (de_digtable->pre_igvalue != de_digtable->cur_igvalue) { |
366 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, | 370 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, |
367 | de_digtable.cur_igvalue); | 371 | de_digtable->cur_igvalue); |
368 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, | 372 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, |
369 | de_digtable.cur_igvalue); | 373 | de_digtable->cur_igvalue); |
370 | de_digtable.pre_igvalue = de_digtable.cur_igvalue; | 374 | de_digtable->pre_igvalue = de_digtable->cur_igvalue; |
371 | } | 375 | } |
372 | } | 376 | } |
373 | 377 | ||
374 | static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv) | 378 | static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv) |
375 | { | 379 | { |
380 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; | ||
381 | |||
376 | if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) && | 382 | if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) && |
377 | (rtlpriv->mac80211.vendor == PEER_CISCO)) { | 383 | (rtlpriv->mac80211.vendor == PEER_CISCO)) { |
378 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "IOT_PEER = CISCO\n"); | 384 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "IOT_PEER = CISCO\n"); |
379 | if (de_digtable.last_min_undecorated_pwdb_for_dm >= 50 | 385 | if (de_digtable->last_min_undecorated_pwdb_for_dm >= 50 |
380 | && de_digtable.min_undecorated_pwdb_for_dm < 50) { | 386 | && de_digtable->min_undecorated_pwdb_for_dm < 50) { |
381 | rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00); | 387 | rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00); |
382 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 388 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
383 | "Early Mode Off\n"); | 389 | "Early Mode Off\n"); |
384 | } else if (de_digtable.last_min_undecorated_pwdb_for_dm <= 55 && | 390 | } else if (de_digtable->last_min_undecorated_pwdb_for_dm <= 55 && |
385 | de_digtable.min_undecorated_pwdb_for_dm > 55) { | 391 | de_digtable->min_undecorated_pwdb_for_dm > 55) { |
386 | rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); | 392 | rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); |
387 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 393 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
388 | "Early Mode On\n"); | 394 | "Early Mode On\n"); |
@@ -396,14 +402,15 @@ static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv) | |||
396 | static void rtl92d_dm_dig(struct ieee80211_hw *hw) | 402 | static void rtl92d_dm_dig(struct ieee80211_hw *hw) |
397 | { | 403 | { |
398 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 404 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
399 | u8 value_igi = de_digtable.cur_igvalue; | 405 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; |
406 | u8 value_igi = de_digtable->cur_igvalue; | ||
400 | struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); | 407 | struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); |
401 | 408 | ||
402 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "==>\n"); | 409 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "==>\n"); |
403 | if (rtlpriv->rtlhal.earlymode_enable) { | 410 | if (rtlpriv->rtlhal.earlymode_enable) { |
404 | rtl92d_early_mode_enabled(rtlpriv); | 411 | rtl92d_early_mode_enabled(rtlpriv); |
405 | de_digtable.last_min_undecorated_pwdb_for_dm = | 412 | de_digtable->last_min_undecorated_pwdb_for_dm = |
406 | de_digtable.min_undecorated_pwdb_for_dm; | 413 | de_digtable->min_undecorated_pwdb_for_dm; |
407 | } | 414 | } |
408 | if (!rtlpriv->dm.dm_initialgain_enable) | 415 | if (!rtlpriv->dm.dm_initialgain_enable) |
409 | return; | 416 | return; |
@@ -421,9 +428,9 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw) | |||
421 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "progress\n"); | 428 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "progress\n"); |
422 | /* Decide the current status and if modify initial gain or not */ | 429 | /* Decide the current status and if modify initial gain or not */ |
423 | if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) | 430 | if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) |
424 | de_digtable.cursta_connectctate = DIG_STA_CONNECT; | 431 | de_digtable->cursta_connectctate = DIG_STA_CONNECT; |
425 | else | 432 | else |
426 | de_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 433 | de_digtable->cursta_connectctate = DIG_STA_DISCONNECT; |
427 | 434 | ||
428 | /* adjust initial gain according to false alarm counter */ | 435 | /* adjust initial gain according to false alarm counter */ |
429 | if (falsealm_cnt->cnt_all < DM_DIG_FA_TH0) | 436 | if (falsealm_cnt->cnt_all < DM_DIG_FA_TH0) |
@@ -436,64 +443,64 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw) | |||
436 | value_igi += 2; | 443 | value_igi += 2; |
437 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 444 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
438 | "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n", | 445 | "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n", |
439 | de_digtable.large_fa_hit, de_digtable.forbidden_igi); | 446 | de_digtable->large_fa_hit, de_digtable->forbidden_igi); |
440 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 447 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
441 | "dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n", | 448 | "dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n", |
442 | de_digtable.recover_cnt, de_digtable.rx_gain_range_min); | 449 | de_digtable->recover_cnt, de_digtable->rx_gain_range_min); |
443 | 450 | ||
444 | /* deal with abnorally large false alarm */ | 451 | /* deal with abnorally large false alarm */ |
445 | if (falsealm_cnt->cnt_all > 10000) { | 452 | if (falsealm_cnt->cnt_all > 10000) { |
446 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 453 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
447 | "dm_DIG(): Abnormally false alarm case\n"); | 454 | "dm_DIG(): Abnormally false alarm case\n"); |
448 | 455 | ||
449 | de_digtable.large_fa_hit++; | 456 | de_digtable->large_fa_hit++; |
450 | if (de_digtable.forbidden_igi < de_digtable.cur_igvalue) { | 457 | if (de_digtable->forbidden_igi < de_digtable->cur_igvalue) { |
451 | de_digtable.forbidden_igi = de_digtable.cur_igvalue; | 458 | de_digtable->forbidden_igi = de_digtable->cur_igvalue; |
452 | de_digtable.large_fa_hit = 1; | 459 | de_digtable->large_fa_hit = 1; |
453 | } | 460 | } |
454 | if (de_digtable.large_fa_hit >= 3) { | 461 | if (de_digtable->large_fa_hit >= 3) { |
455 | if ((de_digtable.forbidden_igi + 1) > DM_DIG_MAX) | 462 | if ((de_digtable->forbidden_igi + 1) > DM_DIG_MAX) |
456 | de_digtable.rx_gain_range_min = DM_DIG_MAX; | 463 | de_digtable->rx_gain_range_min = DM_DIG_MAX; |
457 | else | 464 | else |
458 | de_digtable.rx_gain_range_min = | 465 | de_digtable->rx_gain_range_min = |
459 | (de_digtable.forbidden_igi + 1); | 466 | (de_digtable->forbidden_igi + 1); |
460 | de_digtable.recover_cnt = 3600; /* 3600=2hr */ | 467 | de_digtable->recover_cnt = 3600; /* 3600=2hr */ |
461 | } | 468 | } |
462 | } else { | 469 | } else { |
463 | /* Recovery mechanism for IGI lower bound */ | 470 | /* Recovery mechanism for IGI lower bound */ |
464 | if (de_digtable.recover_cnt != 0) { | 471 | if (de_digtable->recover_cnt != 0) { |
465 | de_digtable.recover_cnt--; | 472 | de_digtable->recover_cnt--; |
466 | } else { | 473 | } else { |
467 | if (de_digtable.large_fa_hit == 0) { | 474 | if (de_digtable->large_fa_hit == 0) { |
468 | if ((de_digtable.forbidden_igi - 1) < | 475 | if ((de_digtable->forbidden_igi - 1) < |
469 | DM_DIG_FA_LOWER) { | 476 | DM_DIG_FA_LOWER) { |
470 | de_digtable.forbidden_igi = | 477 | de_digtable->forbidden_igi = |
471 | DM_DIG_FA_LOWER; | 478 | DM_DIG_FA_LOWER; |
472 | de_digtable.rx_gain_range_min = | 479 | de_digtable->rx_gain_range_min = |
473 | DM_DIG_FA_LOWER; | 480 | DM_DIG_FA_LOWER; |
474 | 481 | ||
475 | } else { | 482 | } else { |
476 | de_digtable.forbidden_igi--; | 483 | de_digtable->forbidden_igi--; |
477 | de_digtable.rx_gain_range_min = | 484 | de_digtable->rx_gain_range_min = |
478 | (de_digtable.forbidden_igi + 1); | 485 | (de_digtable->forbidden_igi + 1); |
479 | } | 486 | } |
480 | } else if (de_digtable.large_fa_hit == 3) { | 487 | } else if (de_digtable->large_fa_hit == 3) { |
481 | de_digtable.large_fa_hit = 0; | 488 | de_digtable->large_fa_hit = 0; |
482 | } | 489 | } |
483 | } | 490 | } |
484 | } | 491 | } |
485 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 492 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
486 | "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n", | 493 | "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n", |
487 | de_digtable.large_fa_hit, de_digtable.forbidden_igi); | 494 | de_digtable->large_fa_hit, de_digtable->forbidden_igi); |
488 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 495 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
489 | "dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n", | 496 | "dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n", |
490 | de_digtable.recover_cnt, de_digtable.rx_gain_range_min); | 497 | de_digtable->recover_cnt, de_digtable->rx_gain_range_min); |
491 | 498 | ||
492 | if (value_igi > DM_DIG_MAX) | 499 | if (value_igi > DM_DIG_MAX) |
493 | value_igi = DM_DIG_MAX; | 500 | value_igi = DM_DIG_MAX; |
494 | else if (value_igi < de_digtable.rx_gain_range_min) | 501 | else if (value_igi < de_digtable->rx_gain_range_min) |
495 | value_igi = de_digtable.rx_gain_range_min; | 502 | value_igi = de_digtable->rx_gain_range_min; |
496 | de_digtable.cur_igvalue = value_igi; | 503 | de_digtable->cur_igvalue = value_igi; |
497 | rtl92d_dm_write_dig(hw); | 504 | rtl92d_dm_write_dig(hw); |
498 | if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) | 505 | if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) |
499 | rtl92d_dm_cck_packet_detection_thresh(hw); | 506 | rtl92d_dm_cck_packet_detection_thresh(hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.h b/drivers/net/wireless/rtlwifi/rtl8192de/dm.h index 91030ec8ac3e..3fea0c11c24a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.h +++ b/drivers/net/wireless/rtlwifi/rtl8192de/dm.h | |||
@@ -87,55 +87,6 @@ | |||
87 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 | 87 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 |
88 | #define INDEX_MAPPING_NUM 13 | 88 | #define INDEX_MAPPING_NUM 13 |
89 | 89 | ||
90 | struct ps_t { | ||
91 | u8 pre_ccastate; | ||
92 | u8 cur_ccasate; | ||
93 | |||
94 | u8 pre_rfstate; | ||
95 | u8 cur_rfstate; | ||
96 | |||
97 | long rssi_val_min; | ||
98 | }; | ||
99 | |||
100 | struct dig_t { | ||
101 | u8 dig_enable_flag; | ||
102 | u8 dig_ext_port_stage; | ||
103 | |||
104 | u32 rssi_lowthresh; | ||
105 | u32 rssi_highthresh; | ||
106 | |||
107 | u32 fa_lowthresh; | ||
108 | u32 fa_highthresh; | ||
109 | |||
110 | u8 cursta_connectctate; | ||
111 | u8 presta_connectstate; | ||
112 | u8 curmultista_connectstate; | ||
113 | |||
114 | u8 pre_igvalue; | ||
115 | u8 cur_igvalue; | ||
116 | |||
117 | char backoff_val; | ||
118 | char backoff_val_range_max; | ||
119 | char backoff_val_range_min; | ||
120 | u8 rx_gain_range_max; | ||
121 | u8 rx_gain_range_min; | ||
122 | u8 min_undecorated_pwdb_for_dm; | ||
123 | long last_min_undecorated_pwdb_for_dm; | ||
124 | |||
125 | u8 pre_cck_pd_state; | ||
126 | u8 cur_cck_pd_state; | ||
127 | |||
128 | u8 pre_cck_fa_state; | ||
129 | u8 cur_cck_fa_state; | ||
130 | |||
131 | u8 pre_ccastate; | ||
132 | u8 cur_ccasate; | ||
133 | |||
134 | u8 large_fa_hit; | ||
135 | u8 forbidden_igi; | ||
136 | u32 recover_cnt; | ||
137 | }; | ||
138 | |||
139 | struct swat { | 90 | struct swat { |
140 | u8 failure_cnt; | 91 | u8 failure_cnt; |
141 | u8 try_flag; | 92 | u8 try_flag; |
@@ -200,8 +151,6 @@ enum dm_dig_connect { | |||
200 | DIG_CONNECT_MAX | 151 | DIG_CONNECT_MAX |
201 | }; | 152 | }; |
202 | 153 | ||
203 | extern struct dig_t de_digtable; | ||
204 | |||
205 | void rtl92d_dm_init(struct ieee80211_hw *hw); | 154 | void rtl92d_dm_init(struct ieee80211_hw *hw); |
206 | void rtl92d_dm_watchdog(struct ieee80211_hw *hw); | 155 | void rtl92d_dm_watchdog(struct ieee80211_hw *hw); |
207 | void rtl92d_dm_init_edca_turbo(struct ieee80211_hw *hw); | 156 | void rtl92d_dm_init_edca_turbo(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c index 28fc5fb8057b..18380a7829f1 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c | |||
@@ -3064,6 +3064,7 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw) | |||
3064 | static void rtl92d_phy_set_io(struct ieee80211_hw *hw) | 3064 | static void rtl92d_phy_set_io(struct ieee80211_hw *hw) |
3065 | { | 3065 | { |
3066 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 3066 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
3067 | struct dig_t *de_digtable = &rtlpriv->dm_digtable; | ||
3067 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 3068 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
3068 | 3069 | ||
3069 | RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, | 3070 | RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, |
@@ -3071,13 +3072,13 @@ static void rtl92d_phy_set_io(struct ieee80211_hw *hw) | |||
3071 | rtlphy->current_io_type, rtlphy->set_io_inprogress); | 3072 | rtlphy->current_io_type, rtlphy->set_io_inprogress); |
3072 | switch (rtlphy->current_io_type) { | 3073 | switch (rtlphy->current_io_type) { |
3073 | case IO_CMD_RESUME_DM_BY_SCAN: | 3074 | case IO_CMD_RESUME_DM_BY_SCAN: |
3074 | de_digtable.cur_igvalue = rtlphy->initgain_backup.xaagccore1; | 3075 | de_digtable->cur_igvalue = rtlphy->initgain_backup.xaagccore1; |
3075 | rtl92d_dm_write_dig(hw); | 3076 | rtl92d_dm_write_dig(hw); |
3076 | rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel); | 3077 | rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel); |
3077 | break; | 3078 | break; |
3078 | case IO_CMD_PAUSE_DM_BY_SCAN: | 3079 | case IO_CMD_PAUSE_DM_BY_SCAN: |
3079 | rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue; | 3080 | rtlphy->initgain_backup.xaagccore1 = de_digtable->cur_igvalue; |
3080 | de_digtable.cur_igvalue = 0x37; | 3081 | de_digtable->cur_igvalue = 0x37; |
3081 | rtl92d_dm_write_dig(hw); | 3082 | rtl92d_dm_write_dig(hw); |
3082 | break; | 3083 | break; |
3083 | default: | 3084 | default: |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c index fbabae17259e..2e1158026fb7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include "dm.h" | 35 | #include "dm.h" |
36 | #include "fw.h" | 36 | #include "fw.h" |
37 | 37 | ||
38 | struct dig_t digtable; | ||
39 | static const u32 edca_setting_dl[PEER_MAX] = { | 38 | static const u32 edca_setting_dl[PEER_MAX] = { |
40 | 0xa44f, /* 0 UNKNOWN */ | 39 | 0xa44f, /* 0 UNKNOWN */ |
41 | 0x5ea44f, /* 1 REALTEK_90 */ | 40 | 0x5ea44f, /* 1 REALTEK_90 */ |
@@ -421,62 +420,64 @@ static void _rtl92s_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) | |||
421 | static void rtl92s_backoff_enable_flag(struct ieee80211_hw *hw) | 420 | static void rtl92s_backoff_enable_flag(struct ieee80211_hw *hw) |
422 | { | 421 | { |
423 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 422 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
423 | struct dig_t *digtable = &rtlpriv->dm_digtable; | ||
424 | struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); | 424 | struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); |
425 | 425 | ||
426 | if (falsealm_cnt->cnt_all > digtable.fa_highthresh) { | 426 | if (falsealm_cnt->cnt_all > digtable->fa_highthresh) { |
427 | if ((digtable.backoff_val - 6) < | 427 | if ((digtable->backoff_val - 6) < |
428 | digtable.backoffval_range_min) | 428 | digtable->backoffval_range_min) |
429 | digtable.backoff_val = digtable.backoffval_range_min; | 429 | digtable->backoff_val = digtable->backoffval_range_min; |
430 | else | 430 | else |
431 | digtable.backoff_val -= 6; | 431 | digtable->backoff_val -= 6; |
432 | } else if (falsealm_cnt->cnt_all < digtable.fa_lowthresh) { | 432 | } else if (falsealm_cnt->cnt_all < digtable->fa_lowthresh) { |
433 | if ((digtable.backoff_val + 6) > | 433 | if ((digtable->backoff_val + 6) > |
434 | digtable.backoffval_range_max) | 434 | digtable->backoffval_range_max) |
435 | digtable.backoff_val = | 435 | digtable->backoff_val = |
436 | digtable.backoffval_range_max; | 436 | digtable->backoffval_range_max; |
437 | else | 437 | else |
438 | digtable.backoff_val += 6; | 438 | digtable->backoff_val += 6; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw) | 442 | static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw) |
443 | { | 443 | { |
444 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 444 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
445 | struct dig_t *digtable = &rtlpriv->dm_digtable; | ||
445 | struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); | 446 | struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); |
446 | static u8 initialized, force_write; | 447 | static u8 initialized, force_write; |
447 | u8 initial_gain = 0; | 448 | u8 initial_gain = 0; |
448 | 449 | ||
449 | if ((digtable.pre_sta_connectstate == digtable.cur_sta_connectstate) || | 450 | if ((digtable->pre_sta_connectstate == digtable->cur_sta_connectstate) || |
450 | (digtable.cur_sta_connectstate == DIG_STA_BEFORE_CONNECT)) { | 451 | (digtable->cur_sta_connectstate == DIG_STA_BEFORE_CONNECT)) { |
451 | if (digtable.cur_sta_connectstate == DIG_STA_BEFORE_CONNECT) { | 452 | if (digtable->cur_sta_connectstate == DIG_STA_BEFORE_CONNECT) { |
452 | if (rtlpriv->psc.rfpwr_state != ERFON) | 453 | if (rtlpriv->psc.rfpwr_state != ERFON) |
453 | return; | 454 | return; |
454 | 455 | ||
455 | if (digtable.backoff_enable_flag) | 456 | if (digtable->backoff_enable_flag) |
456 | rtl92s_backoff_enable_flag(hw); | 457 | rtl92s_backoff_enable_flag(hw); |
457 | else | 458 | else |
458 | digtable.backoff_val = DM_DIG_BACKOFF; | 459 | digtable->backoff_val = DM_DIG_BACKOFF; |
459 | 460 | ||
460 | if ((digtable.rssi_val + 10 - digtable.backoff_val) > | 461 | if ((digtable->rssi_val + 10 - digtable->backoff_val) > |
461 | digtable.rx_gain_range_max) | 462 | digtable->rx_gain_range_max) |
462 | digtable.cur_igvalue = | 463 | digtable->cur_igvalue = |
463 | digtable.rx_gain_range_max; | 464 | digtable->rx_gain_range_max; |
464 | else if ((digtable.rssi_val + 10 - digtable.backoff_val) | 465 | else if ((digtable->rssi_val + 10 - digtable->backoff_val) |
465 | < digtable.rx_gain_range_min) | 466 | < digtable->rx_gain_range_min) |
466 | digtable.cur_igvalue = | 467 | digtable->cur_igvalue = |
467 | digtable.rx_gain_range_min; | 468 | digtable->rx_gain_range_min; |
468 | else | 469 | else |
469 | digtable.cur_igvalue = digtable.rssi_val + 10 - | 470 | digtable->cur_igvalue = digtable->rssi_val + 10 - |
470 | digtable.backoff_val; | 471 | digtable->backoff_val; |
471 | 472 | ||
472 | if (falsealm_cnt->cnt_all > 10000) | 473 | if (falsealm_cnt->cnt_all > 10000) |
473 | digtable.cur_igvalue = | 474 | digtable->cur_igvalue = |
474 | (digtable.cur_igvalue > 0x33) ? | 475 | (digtable->cur_igvalue > 0x33) ? |
475 | digtable.cur_igvalue : 0x33; | 476 | digtable->cur_igvalue : 0x33; |
476 | 477 | ||
477 | if (falsealm_cnt->cnt_all > 16000) | 478 | if (falsealm_cnt->cnt_all > 16000) |
478 | digtable.cur_igvalue = | 479 | digtable->cur_igvalue = |
479 | digtable.rx_gain_range_max; | 480 | digtable->rx_gain_range_max; |
480 | /* connected -> connected or disconnected -> disconnected */ | 481 | /* connected -> connected or disconnected -> disconnected */ |
481 | } else { | 482 | } else { |
482 | /* Firmware control DIG, do nothing in driver dm */ | 483 | /* Firmware control DIG, do nothing in driver dm */ |
@@ -486,31 +487,31 @@ static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw) | |||
486 | * disconnected or beforeconnect->(dis)connected */ | 487 | * disconnected or beforeconnect->(dis)connected */ |
487 | } else { | 488 | } else { |
488 | /* Enable FW DIG */ | 489 | /* Enable FW DIG */ |
489 | digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 490 | digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
490 | rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_ENABLE); | 491 | rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_ENABLE); |
491 | 492 | ||
492 | digtable.backoff_val = DM_DIG_BACKOFF; | 493 | digtable->backoff_val = DM_DIG_BACKOFF; |
493 | digtable.cur_igvalue = rtlpriv->phy.default_initialgain[0]; | 494 | digtable->cur_igvalue = rtlpriv->phy.default_initialgain[0]; |
494 | digtable.pre_igvalue = 0; | 495 | digtable->pre_igvalue = 0; |
495 | return; | 496 | return; |
496 | } | 497 | } |
497 | 498 | ||
498 | /* Forced writing to prevent from fw-dig overwriting. */ | 499 | /* Forced writing to prevent from fw-dig overwriting. */ |
499 | if (digtable.pre_igvalue != rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, | 500 | if (digtable->pre_igvalue != rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, |
500 | MASKBYTE0)) | 501 | MASKBYTE0)) |
501 | force_write = 1; | 502 | force_write = 1; |
502 | 503 | ||
503 | if ((digtable.pre_igvalue != digtable.cur_igvalue) || | 504 | if ((digtable->pre_igvalue != digtable->cur_igvalue) || |
504 | !initialized || force_write) { | 505 | !initialized || force_write) { |
505 | /* Disable FW DIG */ | 506 | /* Disable FW DIG */ |
506 | rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_DISABLE); | 507 | rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_DISABLE); |
507 | 508 | ||
508 | initial_gain = (u8)digtable.cur_igvalue; | 509 | initial_gain = (u8)digtable->cur_igvalue; |
509 | 510 | ||
510 | /* Set initial gain. */ | 511 | /* Set initial gain. */ |
511 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0, initial_gain); | 512 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0, initial_gain); |
512 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0, initial_gain); | 513 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0, initial_gain); |
513 | digtable.pre_igvalue = digtable.cur_igvalue; | 514 | digtable->pre_igvalue = digtable->cur_igvalue; |
514 | initialized = 1; | 515 | initialized = 1; |
515 | force_write = 0; | 516 | force_write = 0; |
516 | } | 517 | } |
@@ -519,6 +520,7 @@ static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw) | |||
519 | static void _rtl92s_dm_ctrl_initgain_bytwoport(struct ieee80211_hw *hw) | 520 | static void _rtl92s_dm_ctrl_initgain_bytwoport(struct ieee80211_hw *hw) |
520 | { | 521 | { |
521 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 522 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
523 | struct dig_t *digtable = &rtlpriv->dm_digtable; | ||
522 | 524 | ||
523 | if (rtlpriv->mac80211.act_scanning) | 525 | if (rtlpriv->mac80211.act_scanning) |
524 | return; | 526 | return; |
@@ -526,17 +528,17 @@ static void _rtl92s_dm_ctrl_initgain_bytwoport(struct ieee80211_hw *hw) | |||
526 | /* Decide the current status and if modify initial gain or not */ | 528 | /* Decide the current status and if modify initial gain or not */ |
527 | if (rtlpriv->mac80211.link_state >= MAC80211_LINKED || | 529 | if (rtlpriv->mac80211.link_state >= MAC80211_LINKED || |
528 | rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) | 530 | rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) |
529 | digtable.cur_sta_connectstate = DIG_STA_CONNECT; | 531 | digtable->cur_sta_connectstate = DIG_STA_CONNECT; |
530 | else | 532 | else |
531 | digtable.cur_sta_connectstate = DIG_STA_DISCONNECT; | 533 | digtable->cur_sta_connectstate = DIG_STA_DISCONNECT; |
532 | 534 | ||
533 | digtable.rssi_val = rtlpriv->dm.undecorated_smoothed_pwdb; | 535 | digtable->rssi_val = rtlpriv->dm.undecorated_smoothed_pwdb; |
534 | 536 | ||
535 | /* Change dig mode to rssi */ | 537 | /* Change dig mode to rssi */ |
536 | if (digtable.cur_sta_connectstate != DIG_STA_DISCONNECT) { | 538 | if (digtable->cur_sta_connectstate != DIG_STA_DISCONNECT) { |
537 | if (digtable.dig_twoport_algorithm == | 539 | if (digtable->dig_twoport_algorithm == |
538 | DIG_TWO_PORT_ALGO_FALSE_ALARM) { | 540 | DIG_TWO_PORT_ALGO_FALSE_ALARM) { |
539 | digtable.dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; | 541 | digtable->dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; |
540 | rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_MODE_SS); | 542 | rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_MODE_SS); |
541 | } | 543 | } |
542 | } | 544 | } |
@@ -544,13 +546,14 @@ static void _rtl92s_dm_ctrl_initgain_bytwoport(struct ieee80211_hw *hw) | |||
544 | _rtl92s_dm_false_alarm_counter_statistics(hw); | 546 | _rtl92s_dm_false_alarm_counter_statistics(hw); |
545 | _rtl92s_dm_initial_gain_sta_beforeconnect(hw); | 547 | _rtl92s_dm_initial_gain_sta_beforeconnect(hw); |
546 | 548 | ||
547 | digtable.pre_sta_connectstate = digtable.cur_sta_connectstate; | 549 | digtable->pre_sta_connectstate = digtable->cur_sta_connectstate; |
548 | } | 550 | } |
549 | 551 | ||
550 | static void _rtl92s_dm_ctrl_initgain_byrssi(struct ieee80211_hw *hw) | 552 | static void _rtl92s_dm_ctrl_initgain_byrssi(struct ieee80211_hw *hw) |
551 | { | 553 | { |
552 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 554 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
553 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 555 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
556 | struct dig_t *digtable = &rtlpriv->dm_digtable; | ||
554 | 557 | ||
555 | /* 2T2R TP issue */ | 558 | /* 2T2R TP issue */ |
556 | if (rtlphy->rf_type == RF_2T2R) | 559 | if (rtlphy->rf_type == RF_2T2R) |
@@ -559,7 +562,7 @@ static void _rtl92s_dm_ctrl_initgain_byrssi(struct ieee80211_hw *hw) | |||
559 | if (!rtlpriv->dm.dm_initialgain_enable) | 562 | if (!rtlpriv->dm.dm_initialgain_enable) |
560 | return; | 563 | return; |
561 | 564 | ||
562 | if (digtable.dig_enable_flag == false) | 565 | if (digtable->dig_enable_flag == false) |
563 | return; | 566 | return; |
564 | 567 | ||
565 | _rtl92s_dm_ctrl_initgain_bytwoport(hw); | 568 | _rtl92s_dm_ctrl_initgain_bytwoport(hw); |
@@ -639,51 +642,52 @@ static void _rtl92s_dm_dynamic_txpower(struct ieee80211_hw *hw) | |||
639 | static void _rtl92s_dm_init_dig(struct ieee80211_hw *hw) | 642 | static void _rtl92s_dm_init_dig(struct ieee80211_hw *hw) |
640 | { | 643 | { |
641 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 644 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
645 | struct dig_t *digtable = &rtlpriv->dm_digtable; | ||
642 | 646 | ||
643 | /* Disable DIG scheme now.*/ | 647 | /* Disable DIG scheme now.*/ |
644 | digtable.dig_enable_flag = true; | 648 | digtable->dig_enable_flag = true; |
645 | digtable.backoff_enable_flag = true; | 649 | digtable->backoff_enable_flag = true; |
646 | 650 | ||
647 | if ((rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) && | 651 | if ((rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) && |
648 | (hal_get_firmwareversion(rtlpriv) >= 0x3c)) | 652 | (hal_get_firmwareversion(rtlpriv) >= 0x3c)) |
649 | digtable.dig_algorithm = DIG_ALGO_BY_TOW_PORT; | 653 | digtable->dig_algorithm = DIG_ALGO_BY_TOW_PORT; |
650 | else | 654 | else |
651 | digtable.dig_algorithm = | 655 | digtable->dig_algorithm = |
652 | DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM; | 656 | DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM; |
653 | 657 | ||
654 | digtable.dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; | 658 | digtable->dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; |
655 | digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 659 | digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
656 | /* off=by real rssi value, on=by digtable.rssi_val for new dig */ | 660 | /* off=by real rssi value, on=by digtable->rssi_val for new dig */ |
657 | digtable.dig_dbgmode = DM_DBG_OFF; | 661 | digtable->dig_dbgmode = DM_DBG_OFF; |
658 | digtable.dig_slgorithm_switch = 0; | 662 | digtable->dig_slgorithm_switch = 0; |
659 | 663 | ||
660 | /* 2007/10/04 MH Define init gain threshol. */ | 664 | /* 2007/10/04 MH Define init gain threshol. */ |
661 | digtable.dig_state = DM_STA_DIG_MAX; | 665 | digtable->dig_state = DM_STA_DIG_MAX; |
662 | digtable.dig_highpwrstate = DM_STA_DIG_MAX; | 666 | digtable->dig_highpwrstate = DM_STA_DIG_MAX; |
663 | 667 | ||
664 | digtable.cur_sta_connectstate = DIG_STA_DISCONNECT; | 668 | digtable->cur_sta_connectstate = DIG_STA_DISCONNECT; |
665 | digtable.pre_sta_connectstate = DIG_STA_DISCONNECT; | 669 | digtable->pre_sta_connectstate = DIG_STA_DISCONNECT; |
666 | digtable.cur_ap_connectstate = DIG_AP_DISCONNECT; | 670 | digtable->cur_ap_connectstate = DIG_AP_DISCONNECT; |
667 | digtable.pre_ap_connectstate = DIG_AP_DISCONNECT; | 671 | digtable->pre_ap_connectstate = DIG_AP_DISCONNECT; |
668 | 672 | ||
669 | digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; | 673 | digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; |
670 | digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; | 674 | digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; |
671 | 675 | ||
672 | digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; | 676 | digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; |
673 | digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; | 677 | digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; |
674 | 678 | ||
675 | digtable.rssi_highpower_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW; | 679 | digtable->rssi_highpower_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW; |
676 | digtable.rssi_highpower_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH; | 680 | digtable->rssi_highpower_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH; |
677 | 681 | ||
678 | /* for dig debug rssi value */ | 682 | /* for dig debug rssi value */ |
679 | digtable.rssi_val = 50; | 683 | digtable->rssi_val = 50; |
680 | digtable.backoff_val = DM_DIG_BACKOFF; | 684 | digtable->backoff_val = DM_DIG_BACKOFF; |
681 | digtable.rx_gain_range_max = DM_DIG_MAX; | 685 | digtable->rx_gain_range_max = DM_DIG_MAX; |
682 | 686 | ||
683 | digtable.rx_gain_range_min = DM_DIG_MIN; | 687 | digtable->rx_gain_range_min = DM_DIG_MIN; |
684 | 688 | ||
685 | digtable.backoffval_range_max = DM_DIG_BACKOFF_MAX; | 689 | digtable->backoffval_range_max = DM_DIG_BACKOFF_MAX; |
686 | digtable.backoffval_range_min = DM_DIG_BACKOFF_MIN; | 690 | digtable->backoffval_range_min = DM_DIG_BACKOFF_MIN; |
687 | } | 691 | } |
688 | 692 | ||
689 | static void _rtl92s_dm_init_dynamic_txpower(struct ieee80211_hw *hw) | 693 | static void _rtl92s_dm_init_dynamic_txpower(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.h b/drivers/net/wireless/rtlwifi/rtl8192se/dm.h index e1b19a641765..2e9052c8fe4b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.h +++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.h | |||
@@ -29,48 +29,6 @@ | |||
29 | #ifndef __RTL_92S_DM_H__ | 29 | #ifndef __RTL_92S_DM_H__ |
30 | #define __RTL_92S_DM_H__ | 30 | #define __RTL_92S_DM_H__ |
31 | 31 | ||
32 | struct dig_t { | ||
33 | u8 dig_enable_flag; | ||
34 | u8 dig_algorithm; | ||
35 | u8 dig_twoport_algorithm; | ||
36 | u8 dig_ext_port_stage; | ||
37 | u8 dig_dbgmode; | ||
38 | u8 dig_slgorithm_switch; | ||
39 | |||
40 | long rssi_lowthresh; | ||
41 | long rssi_highthresh; | ||
42 | |||
43 | u32 fa_lowthresh; | ||
44 | u32 fa_highthresh; | ||
45 | |||
46 | long rssi_highpower_lowthresh; | ||
47 | long rssi_highpower_highthresh; | ||
48 | |||
49 | u8 dig_state; | ||
50 | u8 dig_highpwrstate; | ||
51 | u8 cur_sta_connectstate; | ||
52 | u8 pre_sta_connectstate; | ||
53 | u8 cur_ap_connectstate; | ||
54 | u8 pre_ap_connectstate; | ||
55 | |||
56 | u8 cur_pd_thstate; | ||
57 | u8 pre_pd_thstate; | ||
58 | u8 cur_cs_ratiostate; | ||
59 | u8 pre_cs_ratiostate; | ||
60 | |||
61 | u32 pre_igvalue; | ||
62 | u32 cur_igvalue; | ||
63 | |||
64 | u8 backoff_enable_flag; | ||
65 | char backoff_val; | ||
66 | char backoffval_range_max; | ||
67 | char backoffval_range_min; | ||
68 | u8 rx_gain_range_max; | ||
69 | u8 rx_gain_range_min; | ||
70 | |||
71 | long rssi_val; | ||
72 | }; | ||
73 | |||
74 | enum dm_dig_alg { | 32 | enum dm_dig_alg { |
75 | DIG_ALGO_BY_FALSE_ALARM = 0, | 33 | DIG_ALGO_BY_FALSE_ALARM = 0, |
76 | DIG_ALGO_BY_RSSI = 1, | 34 | DIG_ALGO_BY_RSSI = 1, |
@@ -154,8 +112,6 @@ enum dm_ratr_sta { | |||
154 | #define DM_DIG_BACKOFF_MAX 12 | 112 | #define DM_DIG_BACKOFF_MAX 12 |
155 | #define DM_DIG_BACKOFF_MIN -4 | 113 | #define DM_DIG_BACKOFF_MIN -4 |
156 | 114 | ||
157 | extern struct dig_t digtable; | ||
158 | |||
159 | void rtl92s_dm_watchdog(struct ieee80211_hw *hw); | 115 | void rtl92s_dm_watchdog(struct ieee80211_hw *hw); |
160 | void rtl92s_dm_init(struct ieee80211_hw *hw); | 116 | void rtl92s_dm_init(struct ieee80211_hw *hw); |
161 | void rtl92s_dm_init_edca_turbo(struct ieee80211_hw *hw); | 117 | void rtl92s_dm_init_edca_turbo(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index 4a499928e4c6..8d7099bc472c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
@@ -1450,6 +1450,7 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw) | |||
1450 | bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio) | 1450 | bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio) |
1451 | { | 1451 | { |
1452 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1452 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1453 | struct dig_t *digtable = &rtlpriv->dm_digtable; | ||
1453 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 1454 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1454 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 1455 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
1455 | u32 fw_param = FW_CMD_IO_PARA_QUERY(rtlpriv); | 1456 | u32 fw_param = FW_CMD_IO_PARA_QUERY(rtlpriv); |
@@ -1588,16 +1589,16 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio) | |||
1588 | FW_SS_CTL); | 1589 | FW_SS_CTL); |
1589 | 1590 | ||
1590 | if (rtlpriv->dm.dm_flag & HAL_DM_DIG_DISABLE || | 1591 | if (rtlpriv->dm.dm_flag & HAL_DM_DIG_DISABLE || |
1591 | !digtable.dig_enable_flag) | 1592 | !digtable->dig_enable_flag) |
1592 | fw_cmdmap &= ~FW_DIG_ENABLE_CTL; | 1593 | fw_cmdmap &= ~FW_DIG_ENABLE_CTL; |
1593 | 1594 | ||
1594 | if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || | 1595 | if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || |
1595 | rtlpriv->dm.dynamic_txpower_enable) | 1596 | rtlpriv->dm.dynamic_txpower_enable) |
1596 | fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; | 1597 | fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; |
1597 | 1598 | ||
1598 | if ((digtable.dig_ext_port_stage == | 1599 | if ((digtable->dig_ext_port_stage == |
1599 | DIG_EXT_PORT_STAGE_0) || | 1600 | DIG_EXT_PORT_STAGE_0) || |
1600 | (digtable.dig_ext_port_stage == | 1601 | (digtable->dig_ext_port_stage == |
1601 | DIG_EXT_PORT_STAGE_1)) | 1602 | DIG_EXT_PORT_STAGE_1)) |
1602 | fw_cmdmap &= ~FW_DIG_ENABLE_CTL; | 1603 | fw_cmdmap &= ~FW_DIG_ENABLE_CTL; |
1603 | 1604 | ||
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 521398803099..bd816aef26dc 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -1592,6 +1592,65 @@ struct rtl_debug { | |||
1592 | char proc_name[20]; | 1592 | char proc_name[20]; |
1593 | }; | 1593 | }; |
1594 | 1594 | ||
1595 | struct ps_t { | ||
1596 | u8 pre_ccastate; | ||
1597 | u8 cur_ccasate; | ||
1598 | u8 pre_rfstate; | ||
1599 | u8 cur_rfstate; | ||
1600 | long rssi_val_min; | ||
1601 | }; | ||
1602 | |||
1603 | struct dig_t { | ||
1604 | u32 rssi_lowthresh; | ||
1605 | u32 rssi_highthresh; | ||
1606 | u32 fa_lowthresh; | ||
1607 | u32 fa_highthresh; | ||
1608 | long last_min_undecorated_pwdb_for_dm; | ||
1609 | long rssi_highpower_lowthresh; | ||
1610 | long rssi_highpower_highthresh; | ||
1611 | u32 recover_cnt; | ||
1612 | u32 pre_igvalue; | ||
1613 | u32 cur_igvalue; | ||
1614 | long rssi_val; | ||
1615 | u8 dig_enable_flag; | ||
1616 | u8 dig_ext_port_stage; | ||
1617 | u8 dig_algorithm; | ||
1618 | u8 dig_twoport_algorithm; | ||
1619 | u8 dig_dbgmode; | ||
1620 | u8 dig_slgorithm_switch; | ||
1621 | u8 cursta_connectctate; | ||
1622 | u8 presta_connectstate; | ||
1623 | u8 curmultista_connectstate; | ||
1624 | char backoff_val; | ||
1625 | char backoff_val_range_max; | ||
1626 | char backoff_val_range_min; | ||
1627 | u8 rx_gain_range_max; | ||
1628 | u8 rx_gain_range_min; | ||
1629 | u8 min_undecorated_pwdb_for_dm; | ||
1630 | u8 rssi_val_min; | ||
1631 | u8 pre_cck_pd_state; | ||
1632 | u8 cur_cck_pd_state; | ||
1633 | u8 pre_cck_fa_state; | ||
1634 | u8 cur_cck_fa_state; | ||
1635 | u8 pre_ccastate; | ||
1636 | u8 cur_ccasate; | ||
1637 | u8 large_fa_hit; | ||
1638 | u8 forbidden_igi; | ||
1639 | u8 dig_state; | ||
1640 | u8 dig_highpwrstate; | ||
1641 | u8 cur_sta_connectstate; | ||
1642 | u8 pre_sta_connectstate; | ||
1643 | u8 cur_ap_connectstate; | ||
1644 | u8 pre_ap_connectstate; | ||
1645 | u8 cur_pd_thstate; | ||
1646 | u8 pre_pd_thstate; | ||
1647 | u8 cur_cs_ratiostate; | ||
1648 | u8 pre_cs_ratiostate; | ||
1649 | u8 backoff_enable_flag; | ||
1650 | char backoffval_range_max; | ||
1651 | char backoffval_range_min; | ||
1652 | }; | ||
1653 | |||
1595 | struct rtl_priv { | 1654 | struct rtl_priv { |
1596 | struct completion firmware_loading_complete; | 1655 | struct completion firmware_loading_complete; |
1597 | struct rtl_locks locks; | 1656 | struct rtl_locks locks; |
@@ -1629,6 +1688,10 @@ struct rtl_priv { | |||
1629 | interface or hardware */ | 1688 | interface or hardware */ |
1630 | unsigned long status; | 1689 | unsigned long status; |
1631 | 1690 | ||
1691 | /* tables for dm */ | ||
1692 | struct dig_t dm_digtable; | ||
1693 | struct ps_t dm_pstable; | ||
1694 | |||
1632 | /* data buffer pointer for USB reads */ | 1695 | /* data buffer pointer for USB reads */ |
1633 | __le32 *usb_data; | 1696 | __le32 *usb_data; |
1634 | int usb_data_index; | 1697 | int usb_data_index; |