Commit graph

81 commits

Author SHA1 Message Date
Gustavo A. R. Silva 604e986700 ath9k: ar5008_phy: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1056532 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-11-05 13:15:24 +02:00
Colin Ian King a2f73a167d ath9k: remove unused array firstep_table
Array firstep_table is being assigned but is never used
hence it is redundant and can be removed.

Cleans up clang warning:
warning: 'firstep_table' defined but not used [-Wunused-const-variable=]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-08-28 16:44:35 +03:00
Gustavo A. R. Silva 12b67b0d6b ath9k: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-06-13 14:45:20 +03:00
Martin Blumenstingl 7d7dc53868 ath9k: replace eeprom_param EEP_MINOR_REV with get_eeprom_rev
get_eeprom(ah, EEP_MINOR_REV) and get_eeprom_rev(ah) are both doing the
same thing: returning the EEPROM revision (12 lowest bits). Make the
code consistent by using get_eeprom_rev(ah) everywhere.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-12-15 10:26:27 +02:00
Bob Copeland b5182e157d ath9k: remove repetitions of mask array size
The constant "123", which is the number of elements in
mask_m / mask_p, is repeated several times in this function.

Replace memsets with array initialization, and replace a loop
conditional with ARRAY_SIZE() so that we don't repeat ourselves.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-09-09 15:12:18 +03:00
Oleksij Rempel de478a6138 ath9k: ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p initialisation
by moving common code to ar5008_hw_cmn_spur_mitigate i forgot to move
mask_m & mask_p initialisation. This coused a performance regression
on ar9281.

Fixes: f911085ffa ("ath9k: split ar5008_hw_spur_mitigate and reuse common code in ar9002_hw_spur_mitigate.")
Reported-by: Gustav Frederiksen <lkml2017@openmailbox.org>
Tested-by: Gustav Frederiksen <lkml2017@openmailbox.org>
Cc: <stable@vger.kernel.org> # 4.2+
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-04-15 21:03:54 +03:00
Oleksij Rempel f911085ffa ath9k: split ar5008_hw_spur_mitigate and reuse common code in ar9002_hw_spur_mitigate.
[ar5008 and ar9002]_hw_spur_mitigate have big portion of identical code.
This patch will move common part of ar5008_hw_spur_mitigate to
ar5008_hw_cmn_spur_mitigate and reuse it in ar9002_hw_spur_mitigate.

As noticed by Joe Perches I reuse ar9002_hw_spur_mitigate (const) version of
declarations for pilot_mask_reg and chan_mask_reg.

There should be no other difference with original code.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-05-26 14:02:45 +03:00
Oleksij Rempel 3df5dd901d ath9k: write buffer related optimisation in ar5008_hw_set_channel_regs
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-03-30 11:31:33 +03:00
Lorenzo Bianconi c08267dc9a ath9k: add power per-rate tables for AR9002 chips
Add TX power per-rate tables for MIMO/legacy modes for AR9002 based chips
in order to cap the maximum TX power value per-rate in the TX descriptor path.
Add TX power adjustments for HT40 mode, open loop CCK rates and eeprom power
bias for AR9280 and later chips

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-01-15 14:47:06 +02:00
Lorenzo Bianconi edad187380 ath9k: set pulse_rssi threshold to 15
Reduce pulse_rssi threshold to 15 in order to improve radar pattern detection
probability on ext channel

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-10-30 15:24:49 -04:00
Lorenzo Bianconi 992a36a641 ath9k: do not overwrite AR_PHY_RADAR_1 MSB
Do not overwrite AR_PHY_RADAR_1 most significant byte default value

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-10-27 14:16:14 -04:00
Felix Fietkau b874ec8d57 ath9k_hw: reduce ANI spur immunity setting on HT40 extension channel
The cycpwr_thr1 value needs to be lower on the extension channel than on
the control channel, similar to how the register settings are programmed
in the initvals.

Also drop the unnecessary check for HT40 - this register can always be
written. This patch has been reported to improve HT40 stability and
throughput in some environments.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-09-30 13:17:47 -04:00
Felix Fietkau 171cdab8c7 Revert "ath9k_hw: reduce ANI firstep range for older chips"
This reverts commit 09efc56345

I've received reports that this change is decreasing throughput in some
rare conditions on an AR9280 based device

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-09-30 13:17:46 -04:00
Felix Fietkau 09efc56345 ath9k_hw: reduce ANI firstep range for older chips
Use 0-8 instead of 0-16, which is closer to the old implementation.
Also drop the overwrite of the firstep_low parameter to improve
stability.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-04-09 13:55:55 -04:00
Felix Fietkau 9301ca90b6 ath9k_hw: set ANI firstep as absolute values instead of relative
On older chips, the INI value differ in similar ways as cycpwr_thr1, so
convert it to absolute values as well.

Since the ANI algorithm is different here compared to the old
implementation (fewer steps, controlled at a different point in time),
it makes sense to use values similar to what would be applied for newer
chips, just without relying on INI defaults.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-03-14 14:49:15 -04:00
Felix Fietkau 28327fd096 ath9k_hw: set ANI cycpwr_thr1 as absolute values instead of relative
The table was copied from the ANI implementation of AR9300. It assumes
that the INI values contain a baseline value that is usable as reference
from which to increase/decrease based on the noise immunity value.

On older chips, the differences are bigger and especially AR5008/AR9001
are configured to much more sensitive values than what is useful.

Improve ANI behavior by reverting to the absolute values used in the
previous implementation (expressed as a simple formula instead of the
old table).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-03-14 14:49:15 -04:00
Felix Fietkau e4744ec786 ath9k_hw: remove references to hw->conf
Accessing it to get the current operating channel is racy and in the way
of further channel handling related changes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:59 -04:00
Felix Fietkau 1a5e63265f ath9k_hw: remove IS_CHAN_B()
Hardware 802.11b-only mode isn't supported by the driver (the device is
configured for 802.11n/g instead). Simplify the code by removing checks
for it.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Felix Fietkau 8896934c16 ath9k_hw: remove direct accesses to channel mode flags
Use wrappers where available. Simplifies code and helps with further
improvements to the channel data structure

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Sujith Manoharan 551ed40969 ath9k: Remove incorrect diversity initialization
Fast antenna diversity is required only for single chain
chips and the diversity initialization is done in the
per-family board setup routines. Enabling of diversity
should be done based on the calibrated EEPROM/OTP data,
doing it for all chips is incorrect.

Remove the code that sets the fast_div bit for all cards, since
the documentation for the AR_PHY_CCK_DETECT register says:

reg 642: sig_detect_cck
enable_ant_fast_div : Only used for single chain chips.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:50 -04:00
Sujith Manoharan 9ef4893234 ath9k: Fix issue with parsing malformed CFP IE
All QCA chips have the ability to parse the CF Parameter Set
IE in beacons. If the IE is malformed in the beacons from some
APs [1], the HW locks up. In AP mode, a beacon stuck would happen
and in client mode, a disconnection usually is the result.

To fix this issue, set the AR_PCU_MISC_MODE2_CFP_IGNORE to ignore
the CFP IE in beacons - this is applicable for all chips. For
AP mode, if this issue happens, the NAV is also corrupted and has
to be reset - this will be done in a subsequent patch.

[1] : http://msujith.org/ath9k/cfp/Malformed-CF-Param.png

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:46 -04:00
Sujith Manoharan 65c1a4de59 ath9k: Remove unused ANI commands
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 13:58:27 -04:00
Sujith Manoharan 64b6f46f11 ath9k_hw: Fix multicast search for AR9002 family
The multicast search bit is disabled for the AR9003
family, but this is required for AR9002 too. Fix this in
the INI override routine.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-07-18 16:22:00 -04:00
Sujith Manoharan c24bd3620c ath9k: Do not maintain ANI state per-channel
ANI state can be maintained globally instead of per-channel.
This reduces memory usage and since default values are used
during a scan run, per-channel state is not required.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-06-03 15:55:48 -04:00
Sujith Manoharan 4f4395c692 ath9k: Set ofdmWeakSigDetect directly
The macros ATH9K_ANI_USE_OFDM_WEAK_SIG can be removed.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-06-03 15:55:47 -04:00
Felix Fietkau a043dfb90e ath9k_hw: make various ar5416/ar91xx rf banks const
Banks 0-3,7 are neither modified at run time, nor SREV dependent.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-04-10 14:10:32 -04:00
Felix Fietkau 37c62fecbf ath9k_hw: clean up RF Bank6 handling on AR5416/AR91xx
There are two sets of initvals for this RF bank, one with TPC support and
one without.
The TPC one always gets used, so remove the other one to avoid confusion.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-04-10 14:10:32 -04:00
Felix Fietkau c1b976d2fc ath9k_hw: use the devres API for allocations
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-07 15:16:51 -05:00
Rajkumar Manoharan 81b67fd60a ath9k_hw: rename mrcCCKOff to fix smatch warning
Rename mrcCCKOff for better code readability and also fixes
the smatch warning.

drivers/net/wireless/ath/ath9k/ar9003_phy.c:982
	ar9003_hw_ani_control() Error invalid range 1 to 0.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-22 14:44:05 -04:00
Felix Fietkau 465dce62cd ath9k_hw: clean up defines and variables from the ANI implementation split
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-20 14:44:43 -04:00
Felix Fietkau 6790ae7a13 ath9k_hw: remove the old ANI implementation
It was found to be buggy on a variety of chipsets from AR913x to AR928x.
The new version (which was introduced along with AR93xx support) is more
reliable in preventing connectivity dropouts and also fixes MIB interrupt
storm issues.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-20 14:44:42 -04:00
Felix Fietkau 7067e7014d ath9k_hw: remove confusing logic inversion in an ANI variable
Code using this had already triggered smatch complaints, so remove it before
it gets fixed the wrong way.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-20 14:44:42 -04:00
David S. Miller 0d6c4a2e46 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	drivers/net/ethernet/intel/e1000e/param.c
	drivers/net/wireless/iwlwifi/iwl-agn-rx.c
	drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
	drivers/net/wireless/iwlwifi/iwl-trans.h

Resolved the iwlwifi conflict with mainline using 3-way diff posted
by John Linville and Stephen Rothwell.  In 'net' we added a bug
fix to make iwlwifi report a more accurate skb->truesize but this
conflicted with RX path changes that happened meanwhile in net-next.

In e1000e a conflict arose in the validation code for settings of
adapter->itr.  'net-next' had more sophisticated logic so that
logic was used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-07 23:35:40 -04:00
Felix Fietkau 7c5adc8d83 ath9k_hw: fix and clean up PHY activation delay
The delay calculation is the same for all chips, however some parts of the
code missed the extra delay factor for half/quarter.
Clean up the code and move the delay calculation to a common place.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-23 15:35:31 -04:00
Gabor Juhos 64ea57d0c7 ath9k: add an extra boolean parameter to ath9k_hw_apply_txpower
In order to unifying regulatory limit handling
commit ca2c68cc7b
(ath9k_hw: clean up tx power handling) introduced
a new helper function 'ath9k_hw_apply_txpower',
and the direct calls of 'ah->eep_ops->set_txpower'
has been replaced by a call of the helper function.

This caused a change in the behaviour of the
'ath9k_hw_set_txpowerlimit' function. The purpose
of that function is to calculate and store the
rate txpower table and the regulatory limit without
touching the hardware registers. Before the commit,
the 'test' parameter of the function was passed to
the 'ah->eep_ops->set_txpower'. Now the calling of
the 'set_txpower' function happens indirectly through
'ath9k_hw_apply_txpower', so the 'test' argument of
the 'set_txpower' is always 'false'.

This patch restores the original behaviour of
'ath9k_hw_set_txpowerlimit' by adding a new
argument to 'ath9k_hw_apply_txpower.'

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-23 14:56:11 -04:00
Zefir Kurtisi 997002785e ath9k: remove dead code
Clean up some orphaned code lines containing
* unused variables (not referenced / write-only)
* non-implemented function prototypes

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-12 15:10:32 -04:00
Rajkumar Manoharan 54da20d83f ath9k_hw: improve ANI processing and rx desensitizing parameters
This patch improves ANI operations by switching among the immunity
levels based on PHY errors and beacon rssi which will adjust receiver
desensitizing parameters. The changes are

* Configure the Weak Signal Detection based on current immunity value.
* At highest OFDM immunity level poor performance was observed with
  strong interference. By tuning the FIR step and spur immunity levels
  and not changing any weak signal detection thresholds at any level
  helped to improve the performance.
* ANI took long time to recover back to lower immunity levels on heavy
  data load. As the listen time got reset to zero before reaching to
  the 5x of aniperiod, the immunity level is not lowering back even
  without any interference. This patch fix that.

Cc: Paul Stewart <pstew@google.com>
Cc: Susinder Gulasekaran <susinder@qca.qualcomm.com>
Signed-off-by: Suresh Chandrasekaran <csuresh@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-09 16:05:52 -04:00
Felix Fietkau c7effd3593 ath9k: inline AR9271 1.0 INI overrides
Makes them more readable and reduces code size

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-15 13:45:08 -04:00
Felix Fietkau aa0e5786b6 ath9k_hw: remove iniModes_*_tx_gain_9271
Program tx gain through iniModesTxGain like on AR9287

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-15 13:45:08 -04:00
Felix Fietkau c7d36f9fe7 ath9k_hw: clean up iniModesAdditional
use iniModesFastClock for 5 ghz fast clock specific settings, and
iniAdditional for clock/chip specific initval overrides

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-15 13:45:07 -04:00
Felix Fietkau 9bbb8168ed ath9k_hw: prevent writes to const data on AR9160
Duplicate the data for iniAddac early on, to avoid having to do redundant
memcpy calls later. While we're at it, make AR5416 < v2.2 use the same
codepath. Fixes a reported crash on x86.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Magnus Määttä <magnus.maatta@logica.com>
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-21 14:45:25 -05:00
Joe Perches d2182b69dc ath: Convert ath_dbg(bar, ATH_DBG_<FOO>, to ath_dbg(bar, FOO
Add ATH_DBG_ to macros to shorten the uses and
reduce the line count.

Coalesce ath_dbg formats.
Add missing spaces to coalesced formats.
Add missing newline terminations to ath_dbg formats.
Align ath_dbg arguments where appropriate.
Standardize ath_dbg formats without periods.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-12-19 14:35:31 -05:00
Felix Fietkau ca2c68cc7b ath9k_hw: clean up tx power handling
The code for handling various restrictions concerning regulatory limits,
antenna gain, etc. is very convoluted and duplicated across various
EEPROM parsing implementations, making it hard to review.

This patch partially cleans up the mess by unifying regulatory limit
handling in one function and simplifying handling of antenna gain.
It also removes unused transmit power scaling arrays from the EEPROM code,
which belonged to an unimplemented API that isn't supposed to be in
the driver anyway.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-10-11 16:41:26 -04:00
Felix Fietkau 491b209d06 ath9k_hw: remove ar9100_hw_compute_pll_control
AR913x uses the same PLL register layout as AR9160 and later.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-09-19 15:58:25 -04:00
Felix Fietkau bf3f204b92 ath9k_hw: fix setting the hardware diversity flag
ath9k_hw_set_diversity is only called from init.c where it cannot affect
the hardware setting because it's cleared on the next reset.
Instead of using a PHY op for something that's supposed to be initialized
statically, set the register value directly in the INI override function.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-09-19 15:58:25 -04:00
Felix Fietkau d7084da0ce ath9k_hw: remove dead code in the eeprom ops
The eeprom .set_addac function is only necessary for AR9160, remove it
from eeprom_4k.c and remove the dummy function from eeprom_9287.c

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-09-19 15:58:24 -04:00
Felix Fietkau 1b8714f7dc ath9k_hw: clean up hardware revision checks
- AR_SREV_5416_20_OR_LATER is always true, remove it
- AR_SREV_9280_20_OR_LATER is always true within eeprom_4k.c and eeprom_9287.c
- (AR_SREV_9271 || AR_SREV_9285) is always true in eeprom_4k.c

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-09-19 15:58:24 -04:00
Felix Fietkau 7d865c7080 ath9k_hw: fix synth delay for half/quarter channels
The radio needs twice / four times as much time to stabilize for half/quarter
channels.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-11 15:02:15 -04:00
John W. Linville 31ec97d9ce Merge ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2011-05-24 16:47:54 -04:00
Sujith Manoharan 5b68138e56 ath9k: Drag the driver to the year 2011
The Times They Are a-Changin'.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-19 13:54:05 -04:00