History log of /linux-master/drivers/net/wireless/ath/ath9k/hw.h
Revision Date Author Comments
# 02be97c7 14-Sep-2022 Jilin Yuan <yuanjilin@cdjrlc.com>

wifi: ath9k: fix repeated to words in a comment

Delete the redundant word 'to'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220915030559.42371-1-yuanjilin@cdjrlc.com


# eb3a97a6 13-Sep-2021 Christian Lamparter <chunkeey@gmail.com>

ath9k: fetch calibration data via nvmem subsystem

On most embedded ath9k devices (like range extenders,
routers, accesspoints, ...) the calibration data is
stored in a MTD partitions named "ART", or "caldata"/
"calibration".

Since commit 4b361cfa8624 ("mtd: core: add OTP nvmem provider support"):
All MTD partitions are all automatically available through
the nvmem subsystem.

This feature - together with an nvmem cell definition either
in the platform data or via device-tree allows drivers to get
the data necessary for initializing the WIFI, without having
to wait around for the filesystem and userspace to do
the extractions.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/f9b732b50a3453fadf3923cc75d365bae3505fe7.1630157099.git.chunkeey@gmail.com


# ca284802 14-Dec-2020 Jouni Malinen <jouni@codeaurora.org>

ath9k: Postpone key cache entry deletion for TXQ frames reference it

Do not delete a key cache entry that is still being referenced by
pending frames in TXQs. This avoids reuse of the key cache entry while a
frame might still be transmitted using it.

To avoid having to do any additional operations during the main TX path
operations, track pending key cache entries in a new bitmap and check
whether any pending entries can be deleted before every new key
add/remove operation. Also clear any remaining entries when stopping the
interface.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201214172118.18100-6-jouni@codeaurora.org


# d8d20845 23-Apr-2020 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath9k: add calibration timeout for AR9002

ADC & I/Q calibrations could take infinite time to comple, since they
depend on received frames. In particular the I/Q mismatch calibration
requires receiving of OFDM frames for completion. But in the 2.4GHz
band, a station could receive only CCK frames for a very long time.

And while we wait for the completion of one of the mentioned
calibrations, the NF calibration is blocked. Moreover, in some
environments, I/Q calibration is unable to complete until a correct
noise calibration will be performed due to AGC behaviour.

In order to avoid delaying NF calibration on forever, limit the maximum
duration of ADCs & I/Q calibrations. If the calibration is not completed
within the maximum time, it will be interrupted and a next calibration
will be performed. The code that selects the next calibration has been
reworked to the loop so incompleted calibration will be respinned later.

А maximum calibration time of 30 seconds was selected to give the
calibration enough time to complete and to not interfere with the long
(NF) calibration.

Run tested with AR9220.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200424004923.17129-7-ryazanov.s.a@gmail.com


# 41ba50fd 23-Apr-2020 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath9k: do not miss longcal on AR9002

Each of AGC & I/Q calibrations can take a long time. Long calibration
and NF calibration in particular are forbiden for parallel run with
ADC & I/Q calibrations. So, the chip could not be ready to perform the
long calibration at the time of request. And a request to perform the
long calibration may be lost.

In order to fix this, preserve the long calibration request as a
calibration state flag and restore the long calibration request each
time the calibration function is called again (i.e. on each subsequent
ivocation of the short calibration).

This feature will be twice useful after the next change, which will
make it possible to start the long calibration before all ADCs & I/Q
calibrations are completed.

Run tested with AR9220.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200424004923.17129-4-ryazanov.s.a@gmail.com


# b037b107 20-Mar-2019 Sven Eckelmann <sven@narfation.org>

ath9k: Differentiate between max combined and per chain power

The ath9k driver uses as maximum allowed txpower the constant
MAX_RATE_POWER. It is used to set a maximum txpower limit for the PHY
(which is combined txpower) and also the maximum txpower for per chain
rates. Its value 63 is derived from the maximum number the registers can
store for the per chain txpower.

The max txpower a user can set because of this is 31 dBm (floor(63 / 2)).
This also means that a device with multiple tx chains is even limited
further:

* 1 chain: 31 dBm per chain
* 2 chains: 28 dBm per chain
* 3 chains: 26 dBm per chain

This combined txpower limit of 31 dBm becomes even more problematic when
some extra antenna gain is set in the EEPROM. A high power device is then
no longer able to reach its potential limits.

Instead the code dealing with the combined txpower must use a higher limit
than 63 and only the code dealing with the per chain txpower have to use
the limit of 63. Since the antenna gain can be quite large and 8 bit
variables are often used in ath9k for txpower, a large, divisible by two
number like 254 is a good choice for this new limit.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# fe041deb 18-Jun-2018 Arnd Bergmann <arnd@arndb.de>

ath9k: use timespec64 for tsf_ts

ath9k is the last remaining user of the deprecated getrawmonotonic()
interface. There is nothing wrong with this usage, but migrating
to a timespec64 based interface lets us clean up the old API.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 34d4fcd8 24-Jan-2018 Wojciech Dubowik <Wojciech.Dubowik@neratec.com>

ath9k: Read noise floor calibration data from eeprom

AR9003 devices can have calibrated noise floor values
which can be used instead of hard coded one. Read them
from eeprom and save interpolated value in nf limits for
the current channel.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 7368160f 16-Jan-2018 Russell Hu <rhu@qti.qualcomm.com>

ath9k: add MSI support

On new Intel platforms like ApolloLake, legacy interrupt mechanism
(INTx) is not supported, so WLAN modules are not working because
interrupts are missing, therefore this patch is to add MSI support to
ath9k. With module paremeter "use_msi=1", ath9k driver would try to
use MSI instead of INTx.

Signed-off-by: Russell Hu <rhu@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# b9018975 23-Mar-2017 Simon Wunderlich <sw@simonwunderlich.de>

ath9k: add noise floor override option

Introduce a debugfs option to manually override the noise floor,
ignoring the automatically tuned noise floor of the driver/hw.

In my tests with a AR9580 based module and a tx99 5 MHz interferer,
I could tune the noisefloor to -95 dBm or above to allow communication
again. The automatic noise floor calibration sometimes could adapt to
the situation as well, but not reliably and permanently.

I would consider this "feature" experimental and interesting for people
debugging the noise floor calibration or other effects of the hardware.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fit.fraunhofer.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 304e5ac1 11-Oct-2016 Felix Fietkau <nbd@nbd.name>

Revert "ath9k_hw: implement temperature compensation support for AR9003+"

This reverts commit 171f6402e4aa ("ath9k_hw: implement temperature compensation
support for AR9003+"). Some users report that this commit causes a regression
in performance under some conditions.

Fixes: 171f6402e4aa ("ath9k_hw: implement temperature compensation support for AR9003+")
Cc: <stable@vger.kernel.org> # 4.8
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[kvalo@qca.qualcomm.com: improve commit log]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 171f6402 10-Jul-2016 Felix Fietkau <nbd@nbd.name>

ath9k_hw: implement temperature compensation support for AR9003+

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b2d70d49 06-Mar-2016 Miaoqing Pan <miaoqing@codeaurora.org>

ath9k: make GPIO API to support both of WMAC and SOC

commit 61b559dea40e ("ath9k: add extra GPIO led support")
added ath9k to support access SOC's GPIOs, but implemented
in a separated API: ath9k_hw_request_gpio().

So this patch make the APIs more common, to support both
of WMAC and SOC GPIOs. The new APIs as below,

void ath9k_hw_gpio_request_in();
void ath9k_hw_gpio_request_out();
void ath9k_hw_gpio_free();

NOTE, the BSP of the SOC chips(AR9340, AR9531, AR9550, AR9561)
should set the corresponding MUX registers correctly.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# a01ab81b 06-Mar-2016 Miaoqing Pan <miaoqing@codeaurora.org>

ath9k: define correct GPIO numbers and bits mask

Define correct GPIO numbers and MASK bits to indicate the WMAC
GPIO resource.

Allow SOC chips(AR9340, AR9531, AR9550, AR9561) to access all GPIOs
which rely on gpiolib framework. But restrict SOC AR9330 only to
access WMAC GPIO which has the same design with the old chips.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 871d0051 28-Sep-2015 Miaoqing Pan <miaoqing@codeaurora.org>

ath9k: rename ini_modes_rxgain_5g_xlna to ini_modes_rxgain_xlna

rename the variable as preparation for using the array with 2.4 GHz
band, etc.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 621a5f7a 26-Sep-2015 Viresh Kumar <viresh.kumar@linaro.org>

debugfs: Pass bool pointer to debugfs_create_bool()

Its a bit odd that debugfs_create_bool() takes 'u32 *' as an argument,
when all it needs is a boolean pointer.

It would be better to update this API to make it accept 'bool *'
instead, as that will make it more consistent and often more convenient.
Over that bool takes just a byte.

That required updates to all user sites as well, in the same commit
updating the API. regmap core was also using
debugfs_{read|write}_file_bool(), directly and variable types were
updated for that to be bool as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f911085f 17-May-2015 Oleksij Rempel <linux@rempel-privat.de>

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>


# 61b559de 31-Mar-2015 Miaoqing Pan <miaoqing@qca.qualcomm.com>

ath9k: add extra GPIO led support

ar9550 or later chips, the AR_GPIO_IN_OUT register only can
control GPIO[0:3]. For the extra GPIO, use standard GPIO calls
instead of WMAC internal registers.

Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# a57cb45a 22-Mar-2015 Oleksij Rempel <linux@rempel-privat.de>

ath9k: add new function ath9k_hw_read_array

REG_READ generate most overhead on usb bus. It send and read micro packages
and reduce usb bandwidth. To reduce this overhead we should read in batches.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 8badb50c 22-Mar-2015 Oleksij Rempel <linux@rempel-privat.de>

ath9k_htc: add new WMI_REG_RMW_CMDID command

Since usb bus add extra delay on each request, a command
with read + write requests is too expensive. We can dramtically
reduce usb load by moving this command to firmware.

In my tests, this patch will reduce channel scan time
for about 5-10 seconds.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 44a89c82 20-Mar-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix AIC compilation error

AIC needs to be registered only when BTCOEX is enabled.
This fixes the error reported by kbuild:

>> ERROR: "ar9003_hw_attach_aic_ops" [drivers/net/wireless/ath/ath9k/ath9k_hw.ko] undefined!

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 637625f2 13-Mar-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Register private AIC ops

AIC can be disabled or enabled on a per-card
basis using MCI configuration, so register a function
to check its status.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 656cd75c 09-Mar-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Initialize pll_pwrsave for AR9462/AR9565

Cards based on AR9462/AR9565 support more PCIE
power save mechanisms, so register them correctly.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# afa7e6db 09-Mar-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix PLL powersave for AR9485

Use the value in ah->config.pll_pwrsave to determine
which array needs to be loaded. Also, initialize
pll_pwrsave to 1 by default.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# e519f78f 09-Mar-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add PCIE powersave macros

These will be used to handle chip-specific
power save configuration.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# ae55099f 15-Feb-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Move MCI registers to reg_mci.h

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# bb631314 02-Feb-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix issues with WoW enable

This patch addresses several issues with the
ath9k_hw_wow_enable() routine:

* The usage of set/clr variables is removed. Writing
the required values to registers is cleaner.

* The shift value of 28 for the contention window field
in AR_WOW_PATTERN is incorrect, change it to 27.

* Disabling Keep Alive needs to be done based on the
LINK_CHANGE option. This is done unconditionally now,
fix this.

* The workaround for the D1/D3 issue is required only
for AR9462.

* The bitfield for enabling pattern matching for packets
less than 256 bytes has expanded for new chips, handle
this accordingly.

* General cleanup.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# a28815db 02-Feb-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add support for more WOW patterns

Newer chips like WB222, WB335 support more than
8 user-configurable patterns. This patch adds
support for it by setting up the correct HW
registers.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 6af75e4d 30-Jan-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix max pattern check

Since the maximum number of configurable patterns
is chip-specific, use the HW capability instead
of a fixed value for checking if a free pattern
slot is available.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 12a44422 30-Jan-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Register max WOW patterns

Since the number of patterns that can be configured in
the HW is higher for newer chips, store the chip-specific
value in ath9k_hw_wow.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 41fe8837 30-Jan-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add a HW structure for WOW

This can be used to hold the WOW state in
ath9k_hw.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# e094c337 30-Jan-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove ath9k_hw_wow_event_to_string

Printing the value of the wakeup status is sufficient.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 4895efc9 30-Jan-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove ATH9K_HW_WOW_DEVICE_CAPABLE

Enabling WOW based on the chip is incorrect since
it needs to be done for specific sub-devices which
have proper platform support.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# c08267dc 30-Dec-2014 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

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>


# 2131fabb 18-Dec-2014 Miaoqing Pan <miaoqing@qca.qualcomm.com>

ath9k: Add HW IDs for QCA956x

Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 78063d81 30-Nov-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: fix BE/BK queue order

Hardware queues are ordered by priority. Use queue index 0 for BK, which
has lower priority than BE.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 23f53dd3 24-Nov-2014 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

ath9k: add TX power per-rate tables

Add TX power per-rate tables for different MIMO modes (e.g STBC) in order to
cap the maximum TX power value per-rate in the TX descriptor path.
Cap TX power for self generated frames (ACK, RTS/CTS).
Currently TPC is supported just by AR9003 based chips

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ee79ccd9 15-Nov-2014 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Store the chip chainmask in HW capabilities

Cc: Miaoqing Pan <miaoqing@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f4c34af4 15-Nov-2014 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Enable TSF2 for generic HW timers

The base TSF is used for HW timers 0..7, but chips
in the AR9003 family and above can support more generic
timers. To use them, however, a second HW TSF needs to
be enabled. This patch allows usage of the extra
timers by starting the second TSF properly.

The extra set of HW timers is apparently also present
in AR9287, but we enable it only for the AR9003 family.

Cc: Kobi Cohen-Arazi <kobic@qti.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# aeeb2065 15-Nov-2014 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix LED configuration

On some x86 platforms, the LED gpio is active high
instead of active low. Identify such cards and modify
the GPIO usage to make sure LED works properly.

Cc: Russell Hu <rhu@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e6510b11 15-Nov-2014 Chun-Yeow Yeoh <yeohchunyeow@gmail.com>

ath9k|ath9k_htc: Seperate the software crypto flag for Tx and Rx

Use the sw_mgmt_crypto_tx flag to trigger the CCMP encryption
for transmitted management frames to be done in software while
the sw_mgmt_crypto_rx flag is used to trigger the CCMP decryption
for received management frames to be done in software.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3468968e 25-Oct-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: allow disabling bands via platform data

Some devices have multiple bands enables in the EEPROM data, even though
they are only calibrated for one. Allow platform data to disable
unsupported bands.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a59dadbe 25-Oct-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: add support for endian swap of eeprom from platform data

On some devices (especially little-endian ones), the flash EEPROM data
has a different endian, which needs to be detected.
Add a flag to the platform data to allow overriding that behavior

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7b8aaead 25-Oct-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: restart hardware after noise floor calibration failure

When NF calibration fails, the radio often becomes deaf. The usual
hardware hang checks do not detect this, so it's better to issue a reset
when that happens.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 935477ed 25-Oct-2014 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: make support for PC-OEM cards optional

The initvals use up quite a bit of space, and PC-OEM support is
typically not needed on embedded systems

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 315dd114 30-Sep-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: fix getting tx duration for dynack

On AR9003, tx control and tx status are in separate descriptor rings.
Tx duration is extracted from the tx control descriptor data, which
ar9003_hw_proc_txdesc cannot access.

Fix getting the duration by adding a separate callback for it.

Acked-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c774d57f 15-Sep-2014 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

ath9k: add dynamic ACK timeout estimation

Add dynamic ACK timeout estimation algorithm based on ACK frame RX timestamp,
TX frame timestamp and frame duration.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Tested-by: Philippe Duchein <wireless-dev@duchein.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8e15e094 15-Sep-2014 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

ath9k: export methods related to ACK timeout estimation

Remove static keyword and export ath9k_hw_setslottime(),
ath9k_hw_set_ack_timeout() and ath9k_hw_set_cts_timeout() in hw.h.
These methods will be used in ACK timeout estimation algorithm (dynack)

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8d7e09dd 11-Jun-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: save tsf in channel context

Save TSF in channel context for multiple operating channels.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a64e1a45 22-Jan-2014 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix RX interrupt mitigation

The threshold values for RX interrupt mitigation
are different for AR9003 and AR9002 families.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e6b1e46e 30-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Assign macVersion for QCA9531

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ff47f932 27-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove unused config option ack_6mb

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d88527d3 23-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Identify baseband watchdog signatures

A full HW reset is not required for all baseband watchdog
signatures. Some BB watchdog updates are benign and can
be discarded, some require re-programming of certain registers
and others require a chip reset.

This patch adds a routine to identify such signatures.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 990de2b2 23-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add HW callbacks for MAC/BB hang checks

This is required for adding separate hang check
routines for AR9002 and AR9003.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4598702d 23-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Register supported HW hang checks

HW hang checks have to be done on a per-chip basis.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6a4d05dc 19-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k: move ath9k_debug_sync_cause out of ath9k_hw

ath9k_hw should not depend on any ath9k data structures like ath_softc

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4ed15762 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up station beacon timer API

Remove unused fields, pass timer info in usec instead of TU.
Preparation for fixing nexttbtt calculation

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c57b182b 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove spur related unused defines

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 49685634 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove additional_swba_backoff

It is unused

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ae0c4031 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: simplify spur channel handling

Remove ah->config.spurmode and ah->config.spurchans, always use EEPROM
data.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 787e0536 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ah->config.pcie_clock_req

It is unused

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 60c4bf29 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove defunct ad-hoc mode ATIM window handling code

The hardware does not have support for ATIM processing, and the driver
does not set up ah->atim_window anywhere. Additionally, the code can
clobber the timer used by P2P powersave.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c67ce339 14-Dec-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up generic timer code

- Use generic bitops instead of custom hackery
- Move interrupt enable/disable logic from ath9k to ath9k_hw
- Decouple ISR call from btcoex
- Make the overflow callback optional (to prevent IRQ storms)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0f978bfa 06-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Use a separate TX gain table for WZR-HP-G450H

The Buffalo device WZR-HP-G450H uses the index 3 for TX gain,
which is set to the high_power table currently. Later variants
of the router use the same index, but instead refer to the
low_ob_db gain table. This is not handled in the driver since
there is no way to distinguish board revisions and the high_power
table is used (incorrectly) for the newer variants.

By default, devices based on AR9300 using the TX gain index 3 have
to use the high_power table. To make sure that WZR-HP-G450H is not
broken when the high_power table is updated, use a separate array
based on information obtained from the platform data.

The current situation where only the original variant of WZR-HP-G450H
works properly stays unchanged.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4a878b9f 06-Dec-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Initialize baseband for DFS channels

Certain baseband registers require different values
to be programmed when operating in a DFS channel to
ensure that radar detection works correctly. This
is required for AR9300, AR9340 and AR9580.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c6fc7e64 29-Oct-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove pcieSerDesWrite

This HW config option is always set to true and is not needed.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e60001e7 27-Oct-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Use CONFIG_ATH9K_WOW

Move the WoW code to wow.c and compile it conditionally
based on CONFIG_ATH9K_WOW.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2d22c7dd 07-Nov-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Use correct PCIE initvals for AR9485

Currently, the PLL is turned off for AR9485 when
switching to a low power state, but AR9485 has an issue
where the card will become unresponsive if left idle
for a long time without any traffic. To fix this,
force the PLL to always be on using a different initval
array, ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1.

This is done for most of the AR9485 based cards
like HB125, WB225 etc. but certain models require the
feature to be turned off. Identify such cards and use
default values for them.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 89f927af 14-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com>

ath9k: add TX99 support

TX99 support enables Specific Absorption Rate (SAR) testing.
SAR is the unit of measurement for the amount of radio frequency(RF)
absorbed by the body when using a wireless device. The RF
exposure limits used are expressed in the terms of SAR, which is a
measure of the electric and magnetic field strength and power density
for transmitters operating at frequencies from 300 kHz to 100 GHz.

Regulatory bodies around the world require that wireless device
be evaluated to meet the RF exposure limits set forth in the
governmental SAR regulations.

In the examples below, for more bit rate options see the iw TX bitrate
setting documentation:

http://wireless.kernel.org/en/users/Documentation/iw#Modifying_transmit_bitrates

Example usage:

iw phy phy0 interface add moni0 type monitor
ip link set dev moni0 up

iw dev moni0 set channel 36 HT40+
iw set bitrates mcs-5 4

echo 10 > /sys/kernel/debug/ieee80211/phy0/ath9k/tx99_power
echo 1 > /sys/kernel/debug/ieee80211/phy0/ath9k/tx99

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e4744ec7 11-Oct-2013 Felix Fietkau <nbd@openwrt.org>

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>


# 6b21fd20 11-Oct-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: simplify channel flags

There was some duplication between channelFlags and chanmode, as well as
a lot of redundant checks based on the combinations of flags.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 81c507a8 11-Oct-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove IS_CHAN_OFDM()

The hardware is always configured with OFDM support enabled

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1a5e6326 11-Oct-2013 Felix Fietkau <nbd@openwrt.org>

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>


# 8896934c 11-Oct-2013 Felix Fietkau <nbd@openwrt.org>

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>


# 3001f0d0 11-Sep-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix PeakDetect calibration for AR9462

Since HW PeakDetect calibration is turned on for AR9462,
various conditions have to be handled in the driver:

* Enable agc_cal when loading RTT fails.
* Disable SW PeakDetect calibration when RTT calibration is not enabled.
* Keep SW PeakDetect calibration result in driver.
* Update RTT table according to the saved value.
* Write RTT back after modifying SW RTT table.
* Enable local mode for PeakDetect calibration and restore values.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4b9b42bf 11-Sep-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Use bitops for calibration flags

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1e516ca7 11-Sep-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Handle abnormal NAV in AP mode

Beacon transmission would get stuck if the NAV is
an invalid value for some reason. Check and correct
the NAV value in the HW when this happens.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5e88ba62 05-Sep-2013 Zefir Kurtisi <zefir.kurtisi@neratec.com>

ath9k: replace snprintf() with scnprintf()

Whenever the return value of snprintf() is used to calculate
remaining buffer-space, we wanted to use sncprintf() instead.

Indentation is adapted where possible. Some lines exceed the
line width limit, either they did it already before, or
since they can not be broken reasonably well.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f96bd2ad 02-Sep-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add support for AR9565 v1.0.1 LNA diversity

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b380a43b 25-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix ASPM for AR9462

If the L1 entrance latency is not calibrated properly
in the EEPROM in WB222 boards, there could be problems
in connectivity. Check and correct the calibrated value
if it doesn't match the optimal value for WB222, 4us.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e083a42e 18-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add antenna diversity tweak for CUS198

This improves RX diversity and performance for AR9485.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 36e8825e 05-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Fix build failure

Make sure that CONFIG_ATH9K_BTCOEX_SUPPORT is used for
the WLAN/BT RX diversity hooks.

Reported by the kernel build testing backend.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 31fd216d 04-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Set SWCOM value for CUS198

CUS198/CUS230 cards require a custom value to be
programmed into the SWCOM register. Assign this during
init time.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7bdea96a 04-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove "shared_chain_lnadiv"

This variable is redundant since we can use
common->bt_ant_diversity to determine if diversity
has to be enabled/disabled.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d8d7744b 04-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Rename ath9k_hw_antctrl_shared_chain_lnadiv

Use "ath9k_hw_set_bt_ant_diversity" instead.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3f2da955 04-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add a HW capability for WLAN/BT RX diversity

Make use of this capability to restrict the usage of the
debugfs file and modparam using which this feature can
be enabled.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 81dc75b5 15-Jul-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add a HW flag for FCC

Fast Channel Change across 2G/5G bands is supported
only by AR9462 and AR9565. Add a HW capability field
to indicate this.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c177fabe 18-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Program initvals for CUS217

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 51dbd0a8 17-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add support for 5G-XLNA/AR9462

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9b60b64b 13-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add custom parameters for CUS198

CUS198 is a card based on AR9485. There are differences
between the base reference design HB125 and CUS198.
Identify such cards based on the PCI subsystem IDs and
set HW parameters appropriately.

Addresses this bug - https://bugzilla.kernel.org/show_bug.cgi?id=49201

Cc: jkp@iki.fi
Cc: gfmichaud@gmail.com
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c24bd362 02-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

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>


# e323300d 02-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Simplify ANI initialization

The check "enable_ani" is not required since it is always
set to true and the logic for disabling/enabling ANI via
debugfs is done at a higher layer.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 846e438f 02-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Enable WoW only for AR9462

The only card with which WoW has been tested and verified is
AR9462. Do not enable it for all cards since WoW is really quirky
and needs to be tested properly with each chip.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a043dfb9 07-Apr-2013 Felix Fietkau <nbd@openwrt.org>

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>


# 37c62fec 07-Apr-2013 Felix Fietkau <nbd@openwrt.org>

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>


# fcb9a3de 03-Mar-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Remove CHANNEL_CW_INT

This flag is used for indicating channel interference and
we currently do nothing with it, so remove it.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f5ffe23a 20-Jan-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ath9k_hw_ani_setup and its variables

They are no longer needed for ANI functionality

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0166b4be 20-Jan-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: make the initval parameter to ath9k_hw_write_array const

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6aaacd86 13-Jan-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix RF bank initialization

ar900*_init_mode_regs needs to be called before RF banks are allocated,
otherwise the storage size of RF banks isn't known. This patch fixes
a memory overrun that can show up as a crash on unloading the module.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4a8f1995 20-Jan-2013 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix calibration issues on chainmask that don't include chain 0

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e93d083f 08-Jan-2013 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

ath9k: add spectral scan feature

Adds the spectral scan feature for ath9k. AR92xx and AR93xx chips
are supported for now. The spectral scan is triggered by configuring
a mode through a debugfs control file. Samples can be gathered via
another relay debugfs file.

Essentially, to try it out:

echo chanscan > /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan_ctl
iw dev wlan0 scan
cat /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan0 > samples
echo disable > /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan_ctl

This feature is still experimental.

The special "chanscan" mode is used to perform spectral scan while
mac80211 is scanning for channels. To allow this,
sw_scan_start/complete() ops have been added.

The patch contains code snippets and information from Zefir Kurtisi and
information provided by Adrian Chadd and Felix Fietkau.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 96da6fdd 07-Jan-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Use helper routines to simplify ar9003_hw_init_cal()

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1a6e5d7c 02-Jan-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Remove TEMP_COMP_CAL

This is not enabled for any chip and is unused.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c1b976d2 12-Dec-2012 Felix Fietkau <nbd@openwrt.org>

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>


# ab5c4f71 10-Dec-2012 Gabor Juhos <juhosg@openwrt.org>

ath9k: allow to load EEPROM content via firmware API

The calibration data for devices w/o a separate
EEPROM chip can be specified via the 'eeprom_data'
field of 'ath9k_platform_data'. The 'eeprom_data'
is usually filled from board specific setup
functions. It is easy if the EEPROM data is mapped
to the memory, but it can be complicated if it is
stored elsewhere.

The patch adds support for loading of the EEPROM
data via the firmware API to avoid this limitation.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0f21ee8d 09-Dec-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Add HW cap for PAPRD

Add a HW capability to indicate whether PAPRD is enabled
for the card, since PAPRD could be enabled in the EEPROM, but
disabled in the driver. This makes things clearer.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 36d2943b 09-Dec-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Various trivial fixes for PAPRD

* Remove unneeded memset.

All the values in the PAPRD gain table are filled, so there
is no need to zero out the arrays.

* Use GFP_KERNEL in ar9003_paprd_create_curve

This is called from the PAPRD work, so the atomic variant
is not needed.

* Change return type of ar9003_paprd_setup_gain_table

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 57527f8d 12-Nov-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Program filter coefficients correctly

2484 Mhz (Japan) usage requires filter coefficients to
be programmed in the CCK TX FIR registers. This is required
for AR9331, AR9485 and AR9462. Fix this and also remove
a few useless macros and a duplicate variable.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b126b027 11-Nov-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove unused workaround

The workaround for ASPM/L0s is needed only for AR9485 1.0,
which was never sold and is not supported by ath9k.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 77d84837 12-Oct-2012 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: fill channel mode in caldata

It is useful to have channel mode in caldata to find out
whether operaing channel is in HT40/20 when we are currently
on offchannel. It will be used by BTCOEX to enable/disable
concurrent tx mechanism later.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 424749c7 10-Oct-2012 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: perform ANI cycle in idle state

As of now the ANI cycle is executed only when the chip is awake.
On idle state case, the station wakes up from network sleep for
beacon reception. Since most of the time, ANI cycle is not syncing
with beacon wakeup, ANI cycle is ignored. Approx 5 mins once, the
calibration is performed. This could affect the connection stability
when the station is idle for long. Even though the OFDM and CCK phy
error rates are too high, ANI is unable to tune its immunity level
as quick enough due to rare execution.

Here the experiment shows that OFDM and CCK levels are at default
even on higher phy error rate.

listenTime=44 OFDM:3 errs=121977/s CCK:2 errs=440818/s ofdm_turn=1

This change ensures that ANI calibration will be exectued atleast
once for every 10 seconds. The below result shows improvements and
immunity levels are adopted quick enough.

listenTime=557 OFDM:4 errs=752/s CCK:4 errs=125/s ofdm_turn=0

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ceb26a60 03-Oct-2012 Felix Fietkau <nbd@openwrt.org>

ath9k: improve suspend/resume reliability

Ensure that drv_start() always returns true, as a failing hw start usually
eventually leads to crashes when there's still a station entry present.
Call a power-on reset after a resume and after a hw reset failure to bring
the hardware back to life again.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 362cd03f 15-Sep-2012 Sujith Manoharan <c_manoha@qualcomm.com>

ath9k_hw: Add a HW callback to set diversity

This patch adds a new callback to handle WLAN RX diversity for
AR9565.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 77fac465 11-Sep-2012 Sujith Manoharan <c_manoha@qualcomm.com>

ath9k_hw: Add version/revision macros for AR9565

And recognize the device in the init path.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 74673db9 08-Sep-2012 Felix Fietkau <nbd@openwrt.org>

ath9k: make PA linearization optional, disabled by default and fix checks

Some checks for PA linearization support checked ATH9K_HW_CAP_PAPRD and some
used the EEPROM ops, leading to issues in tx power handling, since those
two can be out of sync.

Disable the feature by default, since it has been reported that it can
cause damage to the rx path under some circumstances. It can now be enabled
for testing via debugfs.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 51dea9be 27-Aug-2012 Felix Fietkau <nbd@openwrt.org>

ath9k: fix PA linearization calibration related crash

Before PAPRD training can run, the card needs to have sent a packet for
thermal calibration. Sending a dummy packet with the PAPRD training flag
set causes a crash under some circumstance.
Fix the code by replacing the dummy tx with a delay that waits for a
real packet tx to have occurred.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d4e5979c 02-Aug-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k: Add PID/VID support for AR1111

AR1111 is same as AR9485. The h/w
difference between them is quite insignificant,
Felix suggests only very few baseband features
may not be available in AR1111. The h/w code for
AR9485 is already present, so AR1111 should
work fine with the addition of its PID/VID.

Cc: stable@vger.kernel.org [2.6.39+]
Cc: Felix Bitterli <felixb@qca.qualcomm.com>
Reported-by: Tim Bentley <Tim.Bentley@Gmail.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Tested-by: Tim Bentley <Tim.Bentley@Gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 60ca9f87 17-Jul-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Cleanup ath9k_hw_set_tsfadjust

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 64875c63 10-Jul-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: Add hardware code for WoW

add a new file wow.c which takes care of the hardware code
for WoW.

*program the descriptors and data words to periodically
send Keep Alive Frames.
*program the user defined patterns/masks and pattern length
in the hardware registers.
*'ath9k_hw_wow_enable' is called during the drivers suspend
callback which takes care of the following
- tracking wow event mask (to suppress spurious
wow events)
- properly configure suspend/resume WAR registers
- configure PCIE PM control register
- configure MAC WoW registers and their timeouts
- enabling wow configuration like magic packet,
user patterns based on users configuration
- configuring timeouts for KAL, beacon miss,
aifs, slot time, backoff
- create Keep Alive Pattern ('KAL')
*'ath9k_hw_wow_wakeup' is called during the drivers resume
callback which takes care of the following
- primary task is to find the reason for wakeup
from the wow status register
- configure/restore AR_PCIE_PM_CTRL register
- clear all WoW events
- configure/restore suspend/resume WAR registers

Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: vadivel@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3b604b6c 10-Jul-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: INI changes for WoW for AR9002 chipsets

for AR9002 family of chipsets and for WoW sleep, we reprogram
the SerDes so that the PLL and CHK REQ are both enabled. this
uses more power but in certain cases this is required as otherwise
WoW sleep is unstable and chip may disappear.

Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: vadivel@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8e981389 10-Jul-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: Add WoW hardware capability flags

have seperate wow capability flags for
*basic wow support
*device capable of matching exact user defined pattern
or de-authentication/disassoc pattern
*device such AR9280 requires first four bytes for
all sort of patterns

Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: vadivel@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 01c78533 10-Jul-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k: Add definitions and structures to support WoW

*add structures, macros and variables for WoW, so that the driver
can make use of it.
*maintain a list for user enabled patterns and masks
*track pattern slots for the hardware limitation on the
maximum number of patterns that can be stored.
*track interrupts enabled before WoW suspend, so
that can be reconfigured after resume
*have macros to parse user defined wow configurations to
hardware code

Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: vadivel@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8bc45c6b 03-Jul-2012 Gabor Juhos <juhosg@openwrt.org>

ath9k: add mode register initialization code for AR9550

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b1233779 03-Jul-2012 Gabor Juhos <juhosg@openwrt.org>

ath9k: define DEVID for QCA955x

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e1ecad78 18-Jun-2012 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: fix mci_is_enabled utility

During driver stop, btcoex is disabled and also btcoex_hw.enabled
is set to false. Afterwards mci_is_enabled returns false so that
BT is not gaining SPDT control on WLAN sleep. Fix that.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 198823fd 15-Jun-2012 Felix Fietkau <nbd@openwrt.org>

ath9k: remove MIB interrupt support

The new ANI implementation does not need it

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6790ae7a 15-Jun-2012 Felix Fietkau <nbd@openwrt.org>

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>


# c8b6fbe1 04-Jun-2012 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: configure ar9462 switching regulator

Enable WLAN and BT mode for switching regulator discontinuous
orverride for AR9462 chips.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5955b2b0 04-Jun-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Fix MCI usage

MCI has to be handled only when BTCOEX is actually enabled.
Check for this condition before calling MCI related functions
from various reset/calibration call-sites.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8a90555f 04-May-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Fix RTT calibration

This patch fixes multiple issues with the current RTT
implementation in ath9k.

* The data that is obtained from the RTT interface registers
are stored in 31:5 - mask out the extra bits when reading them.

* A history buffer is maintained which is not needed at all.
Remove this array and just store the baseband data for each
chain (or bank).

* A 'num_readings' variable was being used to handle the
last entry. But it was being used in an improper manner, with
the result that the RTT values were never being written
to the RTT Interface registers. Fix this by using a simple
flag.

* Stop baseband operations before programming the calibration values
to the HW.

* Do not restore RX gain settings as part of RTT.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7c5adc8d 19-Apr-2012 Felix Fietkau <nbd@openwrt.org>

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>


# 990e08a0 17-Apr-2012 Ben Greear <greearb@candelatech.com>

ath9k: Fix compile warnings when DEBUGFS is disabled.

This fixes two compile warnings, and removes a useless
cast when assigning the 'sc' variable.

Reported-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 64ea57d0 15-Apr-2012 Gabor Juhos <juhosg@openwrt.org>

ath9k: add an extra boolean parameter to ath9k_hw_apply_txpower

In order to unifying regulatory limit handling
commit ca2c68cc7bc80fc4504fb420df04cce99c9ee6ec
(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>


# 462e58f2 12-Apr-2012 Ben Greear <greearb@candelatech.com>

ath9k: Gather and report IRQ sync_cause errors.

Report all defined sync_cause errors in debugfs
to aid with debugging.

Use a macro to print out the interrupts file contents
to decrease code duplication.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 99700278 10-Apr-2012 Zefir Kurtisi <zefir.kurtisi@neratec.com>

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>


# c7effd35 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

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>


# aa0e5786 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

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>


# c7d36f9f 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

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>


# c8664d13 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fold ar9002_hw_cck_chan14_spread into mode regs initialization

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bbf2b30c 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove iniCommon_*_cck_fir_coeff_9271

These arrays are unused

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 99ac8cd6 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ath9k_hw_getdefantenna

The default antenna (as programmed by the INI file) is always 0 anyway.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8efa7a81 14-Mar-2012 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ath9k_hw_htc_resetinit

Automatically set the ah->htc_reset_init on init and after PHY disable.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# caed6579 14-Mar-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Cleanup FastChannelChange

The logic to determine whether to use FCC is a bit convoluted.
Use a small helper function to decide whether FCC is to be
used.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9a15858f 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove ATH9K_HW_CAP_MCI checks

With the ability to remove BTCOEX support at compile time,
these checks are no longer needed.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 64ab38df 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Remove ATH_BTCOEX_CFG_NONE checks

Since BTCOEX code can be compiled out cleanly now,
remove these checks.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# dbccdd1d 22-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Use CONFIG_ATH9K_BTCOEX_SUPPORT

Make use of CONFIG_ATH9K_BTCOEX_SUPPORT in ath9k_hw
to provide a clean way of compilation without BTCOEX
support.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f4701b5a 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Cleanup MCI bits from hw.h

This patch moves all the MCI-specific declarations that have been
dumped unceremoniously in hw.h to ar9003_mci.h

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 528e5d36 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Cleanup MCI bits from ath9k_hw_reset()

This patch moves all the MCI-specific code in the main reset
function to helper functions.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f2f408ef 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Setup MCI calibration using a helper

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d1ca8b8e 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Handle MCI power state using a helper

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5a1e2735 21-Feb-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k_hw: Use a helper function to get MCI ISR

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9bbb8168 15-Feb-2012 Felix Fietkau <nbd@openwrt.org>

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>


# 016c2177 23-Dec-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: increase tx status ring buffer size

AR9003 chips read tx status from ring buffer whose max number of
status descriptor is mininal compared to max number of tx buffers.
On a stress condition, it can be easily overflown which might cause
false tx hung detection. Though increasing number of max status
descriptors consumes more memory, it helps to avoid false positive
chip resets.

Cc: Paul Stewart <pstew@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8a309305 17-Dec-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: make bluetooth coexistence support optional at compile time

Many systems (e.g. embedded systems) do not have wifi modules connected to
bluetooth modules, so bluetooth coexistence is irrelevant there. With the
addition of MCI support, ath9k picked up quite a bit of extra code that
can be compiled out this way.

This patch redefines ATH9K_HW_CAP_MCI and adds an inline wrapper for
querying the bluetooth coexistence scheme, allowing the compiler to
eliminate code that uses it, with only very little use of #ifdef.

On MIPS this reduces the total size for the modules by about 20k.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1b2538b2 07-Dec-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: remove ATH9K_HW_CAP_CST

its not used anywhere in the current code

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9a66af33 14-Dec-2011 Zefir Kurtisi <zefir.kurtisi@neratec.com>

ath9k_hw: add DFS testing check

In order to enable DFS upstream we want to be sure
DFS has been tested for each chipset. Push for public
documentation of the requirements we want in place and
allow for enabling each chipset through a single upstream
commit.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b9b6968b 30-Nov-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: sync to latest AR9462 INI

based on systems change to improve rx dynamic range,
and enables heavy clip for 5G HT40 MCS0 to improve
spectral mask power. also remove an unused function
declaration

Cc: Wilson Tsao <wtsao@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bbefb871 29-Nov-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: Add MCI h/w code and state machine

Cc: Wilson Tsao <wtsao@qca.qualcomm.com>
Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 93d36e99 29-Nov-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: add GPIO output MUX related macros

Cc: Wilson Tsao <wtsao@qca.qualcomm.com>
Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2ee4bd1e 29-Nov-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: add definitions to support MCI h/w code

these definitions will be used by MCI state machine and the corresponding
hardware code

Cc: Wilson Tsao <wtsao@qca.qualcomm.com>
Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 54f10b05 12-Nov-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Cleanup btcoex wlan weights

Remove all wlan weight macros and group it together for better
understanding & readability. It makes the code reusable for
AR9462 wlan weights.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7dc181c2 24-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: Add btcoex profile management support for AR9462

AR9462 chips have the capabilities to provoide bluetooth
profile information. For non-AR9462 btcoex chips, the BT
priority traffic was identified by periodically polling
the respective registers and updated dutycycle, stomptype,
etc. As AR9462 chip offers the BT profile informations,
let us make use of that to update aggregation limit,
dutycycle, stomptype and wieghtages.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 423e38e8 12-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: Rename AR9480 into AR9462

Renamed to be in sync with Marketing term and to avoid
confusion with other chip names.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a126ff51 12-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Do fast channel change based on reusable calibration results

Support the fast channel change across band switch only when there
are available of reusable cabliration results. And also observed that
doing agc control calibration on fastcc, sometimes causing calibration
timeout. Hence changing agc control to be run only on full chip reset.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 324c74ad 12-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Add radio retention support for AR9480

Supported calibrations of radio retention table (RTT) are
- DC offset
- Filter
- Peak detect

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8ad74c4d 12-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Cleanup Tx calibrations for AR9003 chips

Currently Tx IQ calibration is enabled by default for all AR9003
chips. But for AR9480, the calibration status should be read from
chip after processing ini. And also the carrier leak calibration
status is checked during init cal. As the init_cal is being called
for fast channel change too, the tx_cl status only be read after
full reset. Hence moving that into process ini function.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 77a5a664 12-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Add support to reuse Carrier leak calibration

This patch adds support to reuse Carrier leak calibration
during fast channel change for AR9480 chips.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5f0c04ea 12-Oct-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Improve fast channel change for AR9003 chips

In order to reduce the overall scan time, fast channel change
should be implemented properly. This patch adds fast channel
change support across band switch or channel mode switch
instead of doing full chip reset. During the fastcc, tx iqcal
measurements are preserved and will be reloaded after successful
the channel change.

This patch also addressed fast channel issue where the STA can not
see APs in higher than operating channel on 5GHz band after
the association.

Cc: Paul Stewart <pstew@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ca2c68cc 08-Oct-2011 Felix Fietkau <nbd@openwrt.org>

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>


# bf3f204b 15-Sep-2011 Felix Fietkau <nbd@openwrt.org>

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>


# 66ac69c8 14-Sep-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove the old tx descriptor API

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2b63a41d 14-Sep-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: add a new API for setting tx descriptors

Instead of using lots of different functions with long argument lists,
pull all the necessary information from one struct. This makes the code
easier to read and eliminates the need for copying data between multiple
linked descriptors.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ce407afc 13-Sep-2011 Senthil Balasubramanian <senthilb@qca.qualcomm.com>

ath9k_hw: Add initvals and register definitions for AR946/8x chipsets.

Add initvals and register modifications required to support AR946/8x chipsets.

Signed-off-by: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a75c0629 27-Aug-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: use u8 for the tx key index

This saves some space in struct ath_frame_info

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5a63ef0f 24-Aug-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>

ath9k_hw: add AR9580 support

Here are the AR9580 1.0 initvals checksums using the
Atheros initvals-tools [1]. This is useful for when
we udate the initvals again with other values. It ensures
that we match the same initvals used internally. The
tool is documented on the wiki [2].

$ ./initvals -f ar9580-1p0
0x00000000e912711f ar9580_1p0_modes_fast_clock
0x000000004a488fc7 ar9580_1p0_radio_postamble
0x00000000f3888b02 ar9580_1p0_baseband_core
0x0000000003f783bb ar9580_1p0_mac_postamble
0x0000000094be244a ar9580_1p0_low_ob_db_tx_gain_table
0x0000000094be244a ar9580_1p0_high_power_tx_gain_table
0x0000000090be244a ar9580_1p0_lowest_ob_db_tx_gain_table
0x00000000ed9eaac6 ar9580_1p0_baseband_core_txfir_coeff_japan_2484
0x00000000c4d66d1b ar9580_1p0_mac_core
0x00000000e8e9043a ar9580_1p0_mixed_ob_db_tx_gain_table
0x000000003521a300 ar9580_1p0_wo_xlna_rx_gain_table
0x00000000301fc841 ar9580_1p0_soc_postamble
0x00000000a9a06b3a ar9580_1p0_high_ob_db_tx_gain_table
0x00000000a15ccf1b ar9580_1p0_soc_preamble
0x0000000029495000 ar9580_1p0_rx_gain_table
0x0000000037ac0ee8 ar9580_1p0_radio_core
0x00000000603a1b80 ar9580_1p0_baseband_postamble
0x000000003d8b4396 ar9580_1p0_pcie_phy_clkreq_enable_L1
0x00000000398b4396 ar9580_1p0_pcie_phy_clkreq_disable_L1
0x00000000397b4396 ar9580_1p0_pcie_phy_pll_on_clkreq

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/initvals-tool.git
[2] http://wireless.kernel.org/en/users/Drivers/ath9k_hw/initvals-tool

Cc: David Quan <dquan@qca.qualcomm.com>
Cc: Kathy Giori <kgiori@qca.qualcomm.com>
Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 69ce674b 05-Aug-2011 Stanislaw Gruszka <sgruszka@redhat.com>

ath9k: do btcoex ASPM disabling at initialization time

Disable ASPM in pci ->probe on upstream (device) and downstream
(PCIe port) component. According to e1000e driver authors this is
required. I did not find that requirement in PCIe spec, but it seems
to be logical for me.

This need to be fixed for CONFIG_PCIEASPM, that will be done later ...

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 84c87dc8 05-Aug-2011 Stanislaw Gruszka <sgruszka@redhat.com>

ath9k: remove ->config_pci_powersave() redundant argument

We always call ->config_pci_powersave() with both restore and power_off
arguments equal to 0 or both equal to 1, so merge them into one
argument.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e8fe7336 05-Aug-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: Use atomic reference count for interrupt ops

Let us enable/disable interrupts based on reference count.
By doing this we can ensure that interrupts are never be
enabled in the middle of tasklet processing. Instead of
addressing corner cases like "ath9k: avoid enabling interrupts
while processing rx", this approach handles it in generic manner.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 26526202 29-Jul-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k_hw: Add dump_eeprom support for AR9003

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f23fba49 28-Jul-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: calculate a much better approximation of channel noise

Currently ath9k presents the internal calibrated noise floor as channel
noise measurement, however this results in highly chip specific values
that are only useful as relative measurements but do not resemble any
real channel noise values.

In order to give a much better approximation of the real channel noise,
add the difference between the measured noise floor and the nominal
chip specific noise floor to the default minimum channel noise value,
which is currently used to calculate the signal strength from the RSSI
value. This may not be 100% accurate, but it's much better than what's
there before.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# eb93e891 23-Jul-2011 Pavel Roskin <proski@gnu.org>

ath9k: remove all references to subsysid, it's never used

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d4930086 29-Jul-2011 Stanislaw Gruszka <sgruszka@redhat.com>

ath9k: skip ->config_pci_powersave() if PCIe port has ASPM disabled

We receive many bug reports about system hang during suspend/resume
when ath9k driver is in use. Adrian Chadd remarked that this problem
happens on systems that have ASPM disabled.

To do not hit the bug, skip doing ->config_pci_powersave magic if PCIe
downstream port device, which ath9k device is connected to, has ASPM
disabled.

Bug was introduced by:

commit 53bc7aa08b48e5cd745f986731cc7dc24eef2a9f
Author: Vivek Natarajan <vnatarajan@atheros.com>
Date: Mon Apr 5 14:48:04 2010 +0530

ath9k: Add support for newer AR9285 chipsets.

Patch should address:
https://bugzilla.kernel.org/show_bug.cgi?id=37462
https://bugzilla.kernel.org/show_bug.cgi?id=37082
https://bugzilla.redhat.com/show_bug.cgi?id=697157

however I did not receive confirmation about that, except from Camilo
Mesias, whose system stops hang regularly with this patch (but still
hangs from time to time, but this is probably some other bug).

Tested-by: Camilo Mesias <camilo@mesias.co.uk>
Cc: stable@kernel.org # 2.6.35+
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# fe2b6afb 08-Jul-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ar9287 v1.3+ specific hardcoded register hacks

Now that the clock rate is initialized properly and SIFS, EIFS, USEC,
slot time and ACK timeout are properly calculated by the generic code,
the 'async FIFO' register hacks are no longer necessary.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 331c5ea2 08-Jul-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: Disable PAPRD based on paprd_ht20_mask for 5GHz

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7d95847c 21-Jun-2011 Gabor Juhos <juhosg@openwrt.org>

ath9k: add external_reset callback to ath9k_platfom_data for AR9330

The patch adds a callback to ath9k_platform_data. If the
callback is provided by the platform code, then it can be
used to hard reset the WMAC device.

The callback is required for doing a hard reset of the AR9330
chips to get them working again after a hang.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3762561a 21-Jun-2011 Gabor Juhos <juhosg@openwrt.org>

ath9k: add MAC revision detection for AR9330

The AR9330 1.0 and 1.1 are using the same revision,
thus it is not possible to distinguish the two chips.
The platform setup code can distinguish the chips based
on the SoC revision.

Add a callback function to ath9k_platform_data in order
to allow getting the revision number from the platform code.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 03689301 21-Jun-2011 Gabor Juhos <juhosg@openwrt.org>

ath9k: define device id for AR9330

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0e44d48c 17-Jun-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k_hw: make sure PAPRD training is properly done

checking the status of PAPRD_AGC2_POWER(Log(ADC_power) measured after
last gain-change in dB) field suggests whether the PAPRD is completely/properly
done. This is an additional check apart from polling for PAPRD done bit being set.
Susinder suggests that the ideal power range value should be
0xf0 to 0xfe. With AR9382 we do have the values in this range. to have a
common check for all platforms we take agc2_power should be atleast greater
than 0xe0

Cc: susinder@qca.qualcomm.com
Cc: senthilb@qca.qualcomm.com
Cc: kmuthusa@qca.qualcomm.com
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f29f5c08 20-May-2011 Rajkumar Manoharan <rmanoharan@atheros.com>

ath9k: Remove ATH9K_BEACON_PERIOD mask

Earlier beacon_interval is used to hold interval value and
some flags (ATH9K_BEACON_ENA &ATH9K_BEACON_PERIOD). So to
extract interval ATH9K_BEACON_PERIOD is used. Those flags
were completely removed. So masking beacon_interval is
not required.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 33e6ef4e 18-May-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ath9k_hw_get_desc_link

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 51ac8cbb 20-May-2011 Rajkumar Manoharan <rmanoharan@atheros.com>

ath9k_hw: disable phy restart on baseband panic caused by RXSM

While receiving unsupported rate frame rx state machine
gets into a state 0xb and if phy_restart happens in that
state, BB would go hang. If RXSM is in 0xb state after
first bb panic, ensure to disable the phy_restart.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5b68138e 17-May-2011 Sujith Manoharan <Sujith.Manoharan@atheros.com>

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>


# 8afbcc8b 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k_hw: define antenna diversity group

AR9285 belongs to diversity group 0 and AR9485 belongs to diversity
group 2. Based on the diversity group we configure certain antenna
diversity paramaters such as lna1_lna2_delta and fast diversity
bias values. For AR9485 we have some gain table parameter which
selects the gain table 0/1 for main and alternate antenna

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c6ba9feb 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k_hw: define registers/macros to support Antenna diversity

define few registers and macros to configure/enable Antenna diversity
parameters in AR9485

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 69de3721 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k_hw: make antenna diversity modules chip specific

this is necessary to support Antenna diversity and combining in new chip
sets such as AR9485, previously Antenna diversity support is available
only in AR9285

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cbe8c735 03-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k_hw: remove aggregation protection mode

when aggregation protection mode is enabled the hardware needs
to send RTS/CTS for each HT frame. Currently its disabled so
remove the unused call backs.

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a6ef530f 25-Apr-2011 Vivek Natarajan <vnatarajan@atheros.com>

ath9k_hw: Add support for btcoexistence in AR9300.

Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b84628eb 22-Apr-2011 Senthil Balasubramanian <senthilkumar@atheros.com>

ath9k: Add power save wrappers and modularize hw_pll handler

We should protect hw_pll handler with power save wrappers and
also modularize hw_pll handler properly for better readability.

Also add a debug message to track chip resets on pll hang condition.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d89baac8 19-Apr-2011 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Initialize mode registers from initvals.h for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0b488ac6 19-Apr-2011 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Configure pll control register accordingly for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f2f5f2a1 19-Apr-2011 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Get AHB clock information from ath9k_platform_data

Add a bool in ath9k_platform_data to pass AHB clock speed information.
Driver needs this to configure PLL on some SOCs.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b99a7be4 19-Apr-2011 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Define devid and mac version for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5519541d 17-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: fix powersave frame filtering/buffering in AP mode

This patch fixes a long standing issue of pending packets in the queue being
sent (and retransmitted many times) to sleeping stations.
This was made worse by aggregation through driver-internal retransmitting
of A-MDPU subframes.
Previously the hardware tx filter was cleared unconditionally for every
single packet - with this patch it uses the IEEE80211_TX_CTL_CLEAR_PS_FILT
for unaggregated frames.
A sta_notify driver op is added to stop aggregation for stations when they
enter powersave mode. Subframes stay buffered inside the driver, to ensure
that the BlockAck window keeps a sane state.
Since the driver uses software aggregation, the clearing of the tx filter
needs to be handled by the driver instead of mac80211 for aggregated frames.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0cb9e06b 13-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath: unshare struct ath_bus_ops between ath5k and ath9k

This struct is not used in any common code, and moving it out of
the ath header makes it easier to add more driver specific ops.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2638126a 24-Mar-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k_hw: remove ath9k_get_channel_edges

This function is nowhere used.

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 468b0d44 24-Mar-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k: remove set11n_virtualmorefrag

This does not seems to be used anywhere so remove it.

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 83860c59 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove pCap->tx_triglevel_max

It has the same purpose (and value) as ah->config.max_txtrig_level

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 340d0ea7 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_HW_CAP_ENHANCEDPM

It is not used anywhere

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6de12a1b 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove pCap->keycache_size

Similar to the number of tx queue, the number of keycache entries depends
on the chip and shouldn't be messed with based on EEPROM data.
Remove this field and stick to using AR_KEYTABLE_SIZE

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c429bdcf 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove pCap->reg_cap

It is not used anywhere and seems pointless

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0db156e9 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ah->config.ht_enable

It is only used in one place, and the device id check that it's based on
can be moved there as well.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f4c607dc 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove pCap->total_queues

The EEPROM contains a field that can restrict the number of hardware queues,
however this is not only useless (all the known chips contain the same
number of hardware queues), but also potentially dangerous in case of a
misprogrammed EEPROM (could trigger driver crashes), so let's just ignore
it completely.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a9b6b256 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: turn a few big macros into functions

RF_BANK_SETUP, REG_WRITE_RF_ARRAY and REG_WRITE_ARRAY are way too big,
so they shouldn't be inlined at every single callsite, especially since they
can easily be turned into real functions.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 845e03c9 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: add a new register op for read-mask-write

Reduces the number of calls to register ops. On MIPS this reduces the
ath9k_hw binary size from 321k down to 310k

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f9f84e96 23-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: embed the ath_ops callbacks in the ath_hw struct

With this change, loading the address to a register read/write function
costs only one pointer dereference instead of two. On MIPS this reduces
ath9k_hw binary size from 326k down to 321k.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# dd347f2f 22-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: fix beacon timer handling issues

AP mode beacon timers in ath9k are configured in milliseconds, which breaks
when increasing ATH_BCBUF to 8 instead of 4 (due to rounding errors).
Since the hardware timers are actually configured in microseconds, it's
better to let the driver use that unit directly.

To be able to do that, the beacon interval parameter abuse for passing
certain flags needs to be removed. This is easy to do, because those flags
are completely unnecessary anyway. ATH9K_BEACON_ENA is ignored,
ATH9K_BEACON_RESET_TSF can be replaced with calling ath9k_hw_reset_tsf
from the driver directly.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6de66dd9 19-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: add support for overriding LED pin and GPIO settings from platform data

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 691680b8 19-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: add an interface for overriding the value of specific GPIO pins

Some devices control antenna settings or other things through GPIO pins
of the wireless interface. Add a debugfs interface for changing those
and keeping them set across card resets.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e7fc6338 15-Mar-2011 Rajkumar Manoharan <rmanoharan@atheros.com>

ath9k_hw: Speedup register ops for HTC driver

Fine-tuning register write operation and avoid unnecessay
delays for ath9k_htc driver, saves hw reset time which
improves scanning time and also solves one of the following
scenario.

Sometimes the ACK is sent by STA for assoc response is not
seen at AP side. So the AP continues to send retry assoc
responses. At the STA side, since the assoc response was
already forwarded to mac80211, it proceeded to channel change
which in turns does chip reset.

In most of the cases the chip reset was completed before
max retries are reached at AP side. Hence STA can able to ACK
the retried frames again. But in clear environment these retries
are completed within shortspan of time.

Since ath9k_htc consumes more time for hw reset, this latency
is causing dissociation by AP due to max reties are reached.
This issue was originally reported with Cisco Aironet 1250 AP
in HT40 mode in noise free environment.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 997941d7 11-Mar-2011 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix REG_SET_BIT and REG_CLR_BIT for multiple bits

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b1415819 27-Jan-2011 Vivek Natarajan <vnatarajan@atheros.com>

ath9k_hw: Add a function to read sqsum_dvc.

Add a function to observe the delta VC of BB_PLL.
For a good chip, the sqsum_dvc is below 2000.

Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6f481010 20-Jan-2011 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: disabled PAPRD for AR9003

AR9003's PAPRD was enabled prematurely, and is causing some
large discrepancies on throughput and network connectivity.
For example downlink (RX) throughput against an AR9280 AP
can vary widlely from 43-73 Mbit/s while disabling this
gets AR9382 (2x2) up to around 93 Mbit/s in a 2.4 GHz HT20 setup.

Cc: stable@kernel.org
Cc: Paul Shaw <paul.shaw@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 09a525d3 04-Jan-2011 Sujith Manoharan <Sujith.Manoharan@atheros.com>

ath9k_htc: Add multiple register read API

This would decrease latency in reading bulk registers.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 97dcec57 19-Dec-2010 Sujith Manoharan <Sujith.Manoharan@atheros.com>

ath9k_htc: Fix warning on device removal

The commit "ath9k_hw: warn if we cannot change the power to the chip"
introduced a new warning to indicate chip powerup failures, but this
is not required for devices that have been removed. Handle USB device
removal properly by checking for unplugged status.

For PCI devices, this warning will still be seen when the card is pulled
out, not sure how to check for card removal.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f1a8abb0 18-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix PA predistortion HT40 mask

The commit 'ath9k_hw: Disable PAPRD for rates with low Tx power' changed
the code that sets the PAPRD rate masks to use only either the HT20 mask
or the HT40 mask. This is wrong, as the hardware can still use HT20 rates
even when configured for HT40, and the operating channel mode does not
affect PAPRD operation.
The register for the HT40 rate mask is applied as a mask on top of the
other registers to selectively disable PAPRD for specific rates on HT40
packets only.
This patch changes the code back to the old behavior which matches the
intended use of these registers. While with current cards this should not
make any practical difference (according to Atheros, the HT20 and HT40
mask should always be equal), it is more correct that way, and maybe
the HT40 mask will be used for some rare corner cases in the future.

Cc: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 55821324 16-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove baseband rfsilent support

When rfkill is enabled, ath9k_hw unnecessarily configured the baseband to
turn off based on GPIO input, however that code was hardcoded to GPIO 0
instead of ah->rfkill_gpio.
Since ath9k uses software rfkill anyway, this code is completely unnecessary
and should be removed in case anything else ever uses GPIO 0.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 45ef6a0b 15-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Configure appropriate Tx power when PAPRD fails

Target Tx power available in eeprom is for PAPRD. If PAPRD
fails, paprd scale factor needs to be detected from this
target tx power.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7072bf62 15-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Disable PAPRD for rates with low Tx power

When the drop in Tx power for a particular mcs rate exceeds
the paprd scale factor, paprd may not work properly. Disable
paprd for any such rates.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 895ad7eb 15-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Move get_streams() to hw.h

This helper can be used in multiple places. Also make
it inline returning u8.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1bf38661 13-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix PA predistortion training power selection

The EEPROM contains scale factors for the tx power, which define
the range of allowable difference between target power and training
power. If the difference is too big, PA predistortion cannot be used.
For 2.4 GHz there is only one scale factor, for 5 GHz there are
three, depending on the specific frequency range.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 62a957e9 11-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ah->txpower_indexoffset

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5f65c309 11-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ah->beacon_interval

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6da5a720 11-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up SREV version checks

There's no need to have separate callbacks for pre-AR9003 vs AR9003
SREV version checks, so just merge those into one function.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# df3c8b2b 11-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove antenna configuration eeprom ops and variables

AR9280 based hardware with 3 antennas and slow antenna diversity has
not been seen in the wild and ath9k does not support that form of
antenna diversity, so remove the EEPROM ops for it.
These EEPROM ops are currently only used for setting the
AR_PHY_SWITCH_COM register, which is being done in the EEPROM specific
file already.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4ddfcd7d 11-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up duplicate and unnused eeprom related defines

AR*_MAX_RATE_POWER => MAX_RATE_POWER
AR*_EEPROM_MODAL_SPURS => AR_EEPROM_MODAL_SPURS
AR*_OPFLAGS_* => AR5416_OPFLAGS_*
...

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0b5ead91 07-Dec-2010 Sujith Manoharan <Sujith.Manoharan@atheros.com>

ath9k_htc: Cleanup device identification

ath.ko is a common module shared between ath5k, ar9170usb, ath9k and ath9k_htc.
Adding driver specific data to the shared structure would impact all the
drivers. Handling USB device recognition for devices specific to ath9k_htc
can be handled within the driver itself.

Also, AR7010 refers to the processor used in both AR9280/AR9287 based
devices. Rename the device enumerations accordingly.

While at it, check properly for the bus type when choosing the EEPROM
base address for UB95.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 47c80de6 06-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Find the maximum number of chains that hw supports

Have it in ah->caps. This will be used during various
calibrations.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8060e169 06-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Enable extended synch for AR9485 to fix L0s recovery issue

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3050c914 06-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Enable hw initialization for AR9485

Also make it a supported mac

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 226afe68 02-Dec-2010 Joe Perches <joe@perches.com>

ath: Convert ath_print to ath_dbg

Remove ath/debug.h and the includes of these files.
Coalesce long formats.
Correct a few misspellings and missing "\n"s from these logging messages.
Remove unnecessary trailing space before a newline.
Remove ARRAY_SIZE casts, use printf type %zu

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ea066d5a 23-Nov-2010 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k: Add support for Adaptive Power Management

This feature is to mitigate the problem of certain 3
stream chips that exceed the PCIe power requirements.An EEPROM flag
controls which chips have APM enabled which is basically read from
miscellaneous configuration element of the EEPROM header.

This workaround will reduce power consumption by using 2 Tx chains for
Single and Double stream rates (5 GHz only).All self generated frames
(regardless of rate) are sent on 2 chains when this feature is
enabled(Chip Limitation).

Cc: Paul Shaw <paul.shaw@atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Tested-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c5d0855a 13-Nov-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: set default values for radar pulse detection

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4e8c14e9 10-Nov-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: add a private op for configuring radar pulse detection

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6ee63f55 10-Nov-2010 Senthil Balasubramanian <senthilkumar@atheros.com>

ath9k_hw: Fix low throughput issue with AR93xx

TX underruns were noticed when RTS/CTS preceded aggregates.
This issue was noticed in ar93xx family of chipsets only.
The workaround involves padding the RTS or CTS length up
to the min packet length of 256 bytes required by the
hardware by adding delimiters to the fist descriptor of
the aggregate.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7919a57b 30-Aug-2010 Andreas Herrmann <andreas.herrmann3@amd.com>

bitops: Provide generic sign_extend32 function

This patch moves code out from wireless drivers where two different
functions are defined in three code locations for the same purpose and
provides a common function to sign extend a 32-bit value.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 066dae93 07-Nov-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: rework tx queue selection and fix queue stopping/waking

The current ath9k tx queue handling code showed a few issues that could
lead to locking issues, tx stalls due to stopped queues, and maybe even
DMA issues.

The main source of these issues is that in some places the queue is
selected via skb queue mapping in places where this mapping may no
longer be valid. One such place is when data frames are transmitted via
the CAB queue (for powersave buffered frames). This is made even worse
by a lookup WMM AC values from the assigned tx queue (which is
undefined for the CAB queue).

This messed up the pending frame counting, which in turn caused issues
with queues getting stopped, but not woken again.

To fix these issues, this patch removes an unnecessary abstraction
separating a driver internal queue number from the skb queue number
(not to be confused with the hardware queue number).

It seems that this abstraction may have been necessary because of tx
queue preinitialization from the initvals. This patch avoids breakage
here by pushing the software <-> hardware queue mapping to the function
that assigns the tx queues and redefining the WMM AC definitions to
match the numbers used by mac80211 (also affects ath9k_htc).

To ensure consistency wrt. pending frame count tracking, these counters
are moved to the ath_txq struct, updated with the txq lock held, but
only where the tx queue selected by the skb queue map actually matches
the tx queue used by the driver for the frame.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Björn Smedman <bjorn.smedman@venatech.se>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# de40f316 19-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: extend ath9k_hw_set_txpowerlimit to test channel txpower

ath9k_hw_set_txpowerlimit gets an extra boolean parameter that - if set -
causes the rate txpower table and the regulatory limit to be calculated
and stored, without changing hardware registers.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 744bcb42 15-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: make ath9k_hw_gettsf32 static

It is now only used in hw.c

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5f841b41 27-Oct-2010 Rajkumar Manoharan <rmanoharan@atheros.com>

ath9k: Avoid HW opmode overridden on monitor mode changes

The HW opmode is blindly set to monitor type on monitor mode
change notification. This overrides the opmode when one of the
interfaces is still running as non-monitor iftype. So the monitoring
information needs to be maintained seperately.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d4659912 14-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove enum wireless_mode and its users

The wireless mode bitfield was only used to detect 2.4 and 5 GHz support,
which can be simplified by using ATH9K_HW_CAP_* capabilities.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cac4220b 08-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: add compile time checking for the size of the channel list

This prevents random memory corruption if the number of channels ever gets
changed without an update to the internal channel array size.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b5bfc568 08-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: move the cycle counter tracking to ath

Instead of keeping track of wraparound, clear the counters on every
access and keep separate deltas for ANI and later survey use.
Also moves the function for calculating the 'listen time' for ANI

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 95792178 04-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: merge ath9k_hw_ani_monitor_old and ath9k_hw_ani_monitor_new

After the last rounds of cleanup, these functions are now functionally
equivalent and can thus be merged.
Also get rid of some excessive (and redundant) debug messages.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8eb4980c 04-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove function pointer abstraction for internal ANI ops

The code gets more concise and readable when making the new ANI functions
fall back to the old ones if ANI v2 is disabled. This also makes further code
cleanup easier.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bfc472bb 04-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove code duplication in phy error counter handling

Split out the PHY error counter update from ath9k_hw_ani_monitor_*, reuse
it in ath9k_hw_proc_mib_event (merged from ath9k_hw_proc_mib_event_old
and ath9k_hw_proc_mib_event_new).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 093115b7 04-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up ANI state handling

ANI state is kept per channel, so instead of keeping an array of ANI states
with an arbitrary size of 255, move the ANI state into the channel struct.

Move some config settings that are not per-channel out of
the per-channel struct to save some memory.

With those changes, ath9k_ani_restart_old and ath9k_ani_restart_new can
be merged into a single function.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 435c1610 04-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up register write buffering

Throughout the code, DISABLE_REGWRITE_BUFFER is always called right after
REGWRITE_BUFFER_FLUSH. Since that's unlikely to change any time soon, that
makes keeping those ops separate rather pointless, as it only increases
code size and line number counts.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9dbebc7f 03-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: merge codepaths that access the cycle counter registers

The cycle counters are used by ANI to determine the amount of time that the
radio spent not receiving or transmitting. They're also used for debugging
purposes if the baseband watchdog on AR9003 detects a lockup.
In the future, we want to use these counters to determine the medium utilization
and export this information via survey. For that, we need to make sure that
the counter is only accessed from one place, which also ensures that
wraparounds won't occur at inconvenient points in time.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6497827f 03-Oct-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up calibration flags

The calibration actual calibration flags are only used by the per chip family
source files, so it makes more sense to define them in those files instead
of globally. That way the code has to test for less flags.

Also instead of using a separate callback for testing whether a particular
calibration type is supported, simply adjust ah->supp_cals in the calibration
init which is called right after the hardware reset, before any of the
calibrations are run.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9094a086 30-Sep-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove some useless calibration data

The percal struct and bitmask for the initial DC calibration are not
used anywhere, so they can be removed.

Signed-off-by: Felix Fietkau <nbd@openwrt.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d9891c78 29-Sep-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: keep calibrated noise floor values per channel

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 040e539e 08-Sep-2010 Bruno Randolf <br1@einfach.org>

ath9k: Use common ath key management functions

Use key management functions which have been moved to ath/key.c and remove
ath9k copies of these functions and other now unused definitions.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 364734fa 14-Sep-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove useless hw capability flags

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c2ba3342 03-Sep-2010 Rajkumar Manoharan <rmanoharan@atheros.com>

ath9k_hw: Restore ANI registers to default during partial reset for AR9271

For AR9271 chips, if partial reset is done while scanning, the cycpwrThr1
will be set to maximum. This causes the degrade in DL throughput.
So restore the ANI registers to default during the partial reset.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 21cc630f 02-Sep-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add functions to get/set antenna diversity configuration

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 754dc536 02-Sep-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add capability flag for Antenna diversity and combining feature

This is enabled only for ar9285.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 70cf1533 02-Aug-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: use AP beacon miss as a trigger for fast recalibration

When beacons get stuck in AP mode, the most likely cause is interference.
Such interference can often go on for a while, and too many consecutive
beacon misses can lead to connected clients getting dropped.

Since connected clients might not be subjected to the same interference
if that happens to be very local, the AP should try to deal with it as
good as it can. One way to do this is to trigger an NF calibration with
automatic baseband update right after the beacon miss. In my tests with
very strong interference, this allowed the AP to continue transmitting
beacons after only 2-3 misses, which allows a normal client to stay
connected.

With some of the newer - really sensitive - chips, the maximum noise
floor limit is very low, which can be problematic during very strong
interference. To avoid an endless loop of stuck beacons -> nfcal ->
periodic calibration -> stuck beacons, the beacon miss event also sets
a flag, which allows the calibration code to bypass the chip specific
maximum NF value. This flag is automatically cleared, as soon as the
first NF median goes back below the limits for all chains.

In my tests, this allowed an ath9k AP to survive very strong interference
(measured NF: -68, or sometimes even higher) without losing connectivity
to its clients. Even under these conditions, I was able to transmit
several mbits/s through the interface.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4254bc1c 30-Jul-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix a noise floor calibration related race condition

On AR5008-AR9002, other forms of calibration must not be started while
the noise floor calibration is running, as this can create invalid
readings which were sometimes not even recoverable by any further
calibration attempts.

This patch also ensures that the result of noise floor measurements
are processed faster and also allows the result of the initial
calibration on reset to make it into the NF history buffer

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 20bd2a09 30-Jul-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up per-channel calibration data

The noise floor history buffer is currently not kept per channel, which
can lead to problems when changing channels from a clean channel to a
noisy one. Also when switching from HT20 to HT40, the noise floor
history buffer is full of measurements, but none of them contain data
for the extension channel, which it needs quite a bit of time to recover
from.

This patch puts all the per-channel calibration data into a single data
structure, and gives the the driver control over whether that is used
per-channel or even not used for some channels.

For ath9k_htc, I decided to keep this per-channel in order to avoid
creating regressions.

For ath9k, the data is kept only for the operating channel, which saves
some space. ath9k_hw takes care of wiping old data when the operating
channel or its channel flags change.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bbacee13 11-Jul-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: merge noisefloor load implementations

AR5008+ and AR9003 currently use two separate implementations of the
ath9k_hw_loadnf function. There are three main differences:

- PHY registers for AR9003 are different
- AR9003 always uses 3 chains, earlier versions are more selective
- The AR9003 variant contains a fix for NF load timeouts

This patch merges the two implementations into one, storing the
register array in the ath_hw struct. The fix for NF load timeouts is
not just relevant for AR9003, but also important for earlier hardware,
so it's better to just keep one common implementation.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 54bd5006 01-Jul-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: clean up the noise floor calibration code to reduce code duplication

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f2552e28 01-Jul-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: sanitize noise floor values properly on all chips

This refactors the noise floor range checks to make them generic,
and adds proper ranges for each supported chip type.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f35376a4 29-Jun-2010 John W. Linville <linville@tuxdriver.com>

ath9k: make ath9k_hw_keysetmac static

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 99aeed9c 29-Jun-2010 John W. Linville <linville@tuxdriver.com>

ath9k: remove unused function ath9k_hw_keyisvalid

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6a0ec30a 21-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add pcieSerDesWrite to disable SERDES ASPM tweaks

This can be useful during testing of new ASPM tweaks which often
have to be done through the PCI Serializer-Deserializer (SERDES).

Cc: Aeolus Yang <aeolus.yang@atheros.com>
Cc: Madhan Jaganathan <madhan.jaganathan@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9a658d2b 21-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: fix ASPM setting for AR9003

The AR_WA register should not be read when in sleep state so
add a variable we can stash its value into for when we need
to set it. Additionally the AR_WA_D3_TO_L1_DISABLE_REAL
(bit 16) needs to be removed.

Cc: Aeolus Yang <aeolus.yang@atheros.com>
Cc: Madhan Jaganathan <madhan.jaganathan@atheros.com>
signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7b9a4b00 12-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_CAP_DS

This capability check is no longer used, so it can be removed along with
the now-obsolete ath9k_hw_getcapability function.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 16f2411f 12-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_CAP_MCAST_KEYSRCH

The driver always sets this to enabled, but this can be simplified with
a small change to ah->sta_id1_defaults instead.
This change also removes the now-obsolete ath9k_hw_setcapability function.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f32a4884 12-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_CAP_TKIP_SPLIT

This is only used as a workaround for an issue in one specific hw revision.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 71fca6e9 12-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_CAP_TKIP_MIC

TKIP MIC support is always enabled anyway.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9cc3271f 12-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_CAP_TXPOW

replace calls that read this capability with accesses to ath9k_hw's
regulatory data.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 716f7fc5 12-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove ATH9K_CAP_CIPHER

All of the ciphers that are tested for are always supported

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 717f6bed 11-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: add functions for controlling PA predistortion calibration

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4935250a 11-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: add support for parsing PA predistortion related EEPROM fields

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 96d159d0 11-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: remove a useless function for setting the mac address

ath9k_hw_setmac() only copies the mac address it is called with into
common->macaddr, yet in all call sites, the supplied mac address pointer
is already common->macaddr.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 41f3e54d 11-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: add a debugfs entry for ignoring CCA on the extension channel in HT40

Debugfs requires a u32 for bool knobs though so we turn the
ath9k_hw knob into a u32 as well.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a6d2055b 11-Jun-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: fix extending the rx timestamp with the hardware TSF

AR5416 and all newer chipsets use a 32 bit rx timestamp, so there
is no need to keep the 15 bit timestamp extending logic around.

This patch removes ath9k_hw_extend_tsf (replaced by a call to
ath9k_hw_gettsf64), and reduces the frequency of TSF reads, which
can improve performance in some cases.

This change also has the side effect of making rx timestamps
more accurate.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e36b27af 11-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: add new ANI implementation for AR9003

This adds support for ANI for AR9003. The implementation for
ANI for AR9003 is slightly different than the one used for
the older chipset families. It can technically be used for
the older families as well but this is not yet fully tested
so we only enable the new ANI for the AR5008, AR9001 and AR9002
families with a module parameter, force_new_ani.

The old ANI implementation is left intact.

Details of the new ANI implemention:

* ANI adjustment logic is now table driven so that each ANI level
setting is parameterized. This makes adjustments much more
deterministic than the old procedure based logic and allows
adjustments to be made incrementally to several parameters per
level.

* ANI register settings are now relative to INI values; so ANI
param zero level == INI value. Appropriate floor and ceiling
values are obeyed when adjustments are combined with INI values.

* ANI processing is done once per second rather that every 100ms.
The poll interval is now a set upon hardware initialization and
can be picked up by the core driver.

* OFDM error and CCK error processing are made in a round robin
fashion rather than allowing all OFDM adjustments to be made
before CCK adjustments.

* ANI adjusts MRC CCK off in the presence of high CCK errors

* When adjusting spur immunity (SI) and OFDM weak signal detection,
ANI now sets register values for the extension channel too

* When adjusting FIR step (ST), ANI now sets register for FIR step
low too

* FIR step adjustments now allow for an extra level of immunity for
extremely noisy environments

* The old Noise immunity setting (NI), which changes coarse low, size
desired, etc have been removed. Changing these settings could affect
up RIFS RX as well.

* CCK weak signal adjustment is no longer used

* ANI no longer enables phy error interrupts; in all cases phy hw
counting registers are used instead

* The phy error count (overflow) interrupts are also no longer used
for ANI adjustments. All ANI adjustments are made via the polling
routine and no adjustments are possible in the ISR context anymore

* A history settings buffer is now correctly used for each channel;
channel settings are initialized with the defaults but later
changes are restored when returning back to that channel

* When scanning, ANI is disabled settings are returned to (INI) defaults.

* OFDM phy error thresholds are now 400 & 1000 (errors/second units) for
low/high water marks, providing increased stability/hysteresis when
changing levels.

* Similarly CCK phy error thresholds are now 300 & 600 (errors/second)

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 40346b66 11-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: inform ANI calibration when scanning

The new ANI implementation will use this to skip ANI
calibration upon a scan. This cannot be ported to the
older ANI implementation unless default ANI values from
the ANI are also used upon a scan. This is essentially
what one of the things thenew ANI does.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ac0bb767 11-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: allow for spliting up ANI operations by family

The AR9003 hardware family will use a slightly modified ANI
implementation which has not yet been tested on the other hardware
families. To allow for this new ANI implementation a few ANI
calls need to be abstracted away. This patch just allows for
each hardware family to declare their own ANI ops and annotates
the current ANI implementation as old.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 73377256 11-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move clock definitions from hw.c to hw.h

These will be used by the ANI code next.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e9141f71 01-Jun-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k_hw: Fix async fifo for AR9287

Async fifo is now enabled only for versions 1.3 and above.
Enable it in the appropriate place, in the reset routine,
instead of process_ini().

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c5395b67 19-May-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: Enable TX IQ calibration on AR9003

To enable it we now disable and re-enable the PHY chips
after TX IQ calibration.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 77c2061d 18-May-2010 Walter Goldens <goldenstranger@yahoo.com>

wireless: fix several minor description typos

Signed-off-by: Walter Goldens <goldenstranger@yahoo.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6473d24d 13-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Enable Short GI in 20 Mhz for ar9287 and later chips

This patch enables short GI rx at all rates and tx at mcs15
for 20 Mhz channel width also.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# aea702b7 13-May-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add support for the AR9003 baseband watchdog

The baseband watchdog will monitor blocks of the baseband
through timers and will issue an interrupt when things are
detected to be stalled. It is only available on the AR9003
family.

Cc: Sam Ng <sam.ng@atheros.com>
Cc: Paul Shaw <paul.shaw@atheros.com>
Cc: Don Breslin <don.breslin@atheros.com>
Cc: Cliff Holden <cliff.holden@atheros.com
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 597a94b3 26-Apr-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: use the configured power limit for AR9003

Since the new AR9003 EEPROM code does tune the card for the configured
tx power level, we need to fill in the correct power limits in the TPC
part of the DMA descriptor.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6b42e8d0 26-Apr-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: fix fast clock handling for 5GHz channels

Combine multiple checks that were supposed to check for the same
conditions, but didn't. Always enable fast PLL clock on AR9280 2.0

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e5553724 26-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Fix usec to hw clock conversion in 5Ghz for ar9003

Fast clock operation (44Mhz) is enabled for 5Ghz in ar9003, so
take care of the conversion from usec to hw clock.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b360a884 26-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: disable TX IQ calibration for AR9003

Disable TX IQ calibration, it was prematurely enabled in
previous versions.

Cc: Paul Shaw <Paul.Shaw@Atheros.com>
Cc: Thomas Hammel <Thomas.Hammel@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c9c99e5e 19-Apr-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: check for specific rx stuck conditions and recover from them

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 20b3efd9 16-Apr-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k_hw: Add macros for multiple register writes

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ce01805a 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add LDPC support for AR9003

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5088c2f1 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Initialize and configure tx status for EDMA

Also add a function to clean up tx status ring.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b622a720 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move AR9002 mac ops to its own file

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 744d4025 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add function to configure tx status ring buffer

Also reset tx status ring suring chip reset.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cc610ac0 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Define abstraction for tx desc access

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6c94fdc9 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: skip WEP aggregation enable code for AR9003

The AR9002 hardware code enables aggregation for WEP but
mac80211 doesn't enable aggregation with WEP, and the AR9003
code family does not need this so skip it for now for AR9003
but leave the code and annotate we should eventually consider
how to remove this in consideration for the HAL unification
goals.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 78ec2677 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: skip asynch fifo enablement to AR9003

The asynch fifo code is specific to >= AR9287 so stuff it
into the AR9002 hardware family code and skip it for AR9003
cards.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ebd5a14a 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move the RF claim stuff to AR9002 hardware family

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6c84ce08 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Fill get_isr() for AR9003

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1547da37 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add OFDM spur mitigation for AR9003

We add this now as OFDM spur mitigation required accessing
the EEPROM for the AR9003 devices.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 15c9ee7a 15-Apr-2010 Senthil Balasubramanian <senthilkumar@atheros.com>

ath9k_hw: Implement AR9003 eeprom callbacks

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# df23acaa 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: complete AR9003 calibration

This goes with some new shiny TX IQ calibration that AR9003
hardware family supports.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 77d6d39a 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: abstract loading noisefloor

This is the last call on calib.c which acceses PHY stuff,
with this change we calib.c is now generic between both
all supported hardware families.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 55e82df4 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Abstract the routine which returns interrupt status

Also move interrupt related code to mac.c

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 991312d8 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move TX/RX gain INI stuff to its own hardware family code

The AR9003 TX/RX gain is currently initialized with the other
components, so for now AR9003 does not implment this callback,
after hardware bring up we can test moving the TX/RX gain there
as well and if it works well move them to its own callback as
well.

Since all INI stuff is now moved out hw.c no longer needs to
include and touch any original INI headers/structs.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d8f492b7 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move the cck channel 14 INI to the AR9002 hw code

This is specific to the AR9002 family only.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b3950e6a 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: split the generic hardware code by hardware family

Move out the generic hardware family code out into their own
files, we have one for AR5008, AR9001, and AR9002 family (ar9002_hw.c)
and another file for the new AR9003 hardware family (ar9003_hw.c).

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 795f5e2c 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: split calib code by hardware families

Calibration code touches phy registers and since these
change the calibration code needs to be abstracted.

Noise floor calibration is the only thing remaining but
since the remaining calls only touch the AR_PHY_AGC_CONTROL
register we'll just define that register conditionally, that
will be done separately. The goal is to remove the dependency
of ar9002_phy.h on calib.c

This also adds stubs to be filled for AR9003 calibration code.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 939ad86d 15-Apr-2010 Senthil Balasubramanian <senthilkumar@atheros.com>

ath9k_hw: the eep_map is used only for AR9280 PCI card ini fixup

We can reorganize the code in such a way that eep_map can be removed,
which makes the code more clearer.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 641d9921 15-Apr-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: Split out the function for reading the noise floor

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b5c80475 15-Apr-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: Add Rx EDMA support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 87d5efbb 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add abstraction to set/get link pointer

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 162c3be3 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Define tx control struct for AR9003

Store appropriate desc length which will be used by the
ath9k module while duplicating tx desc.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c16fcb49 15-Apr-2010 Felix Fietkau <nbd@openwrt.org>

ath9k_hw: Split off ANI control to the PHY ops

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 13ce3e99 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add initvals for the AR9003 hardware family

The AR9003 hardware family now initializes hardware by block
components and into stages: pre, core and init.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ad7b8060 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add few routines for rx edma support

* Set rx buf size in register 0x60
* Set rxdp on the respective hw rx queue (HP and LP queues)
* Process rx descriptor

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cee1f625 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add abstraction for rx enable

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ceb26445 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Fill few hw cap for edma

HP & LP queue depth and rx status length.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1adf02ff 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Add hw cap flag for EDMA for the AR9003 family

AR9003 supports extended DMA (EDMA), this comes with some
bells and whistles on top of the legacy DMA that we are used
to. Mark AR9003 and later chips EDMA capable.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8525f280 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: Add AR9003 PHY support

This add stubs for PHY support for the AR9003 hardware family.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# db3cc53a 15-Apr-2010 Senthil Balasubramanian <senthilkumar@atheros.com>

ath9k_hw: Add the PCI IDs for AR9300 and fill up the pci_id_tables

Also, clean up and reorganize the AR9287 macro to have better
ordering. We won't add the PCI ID to the supported device list
until we have some functional code for it.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 64773964 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add a private callback for PLL control computation

The PLL control computation used to program the AR_RTC_PLL_CONTROL
register varies between our harware so just add a private callback for it.
AR9003 will use its own callback.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8fe65368 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: Move some RF ops to the private callbacks

The PHY split is easier done in a few steps. First move
the RF ops to the private ops and rename them accordingly.
We split PHY stuff up first for the AR5008 and AR9002
families. There are some callbacks that AR9002 share
with the AR5008 familiy so we set those first, if AR9002
has some different callbacks it will override them upon
hardware init.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d70357d5 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: start building an abstraction layer for hardware routines

ath9k supports the AR5008, AR9001 and AR9002 family of Atheros
chipsets, all 802.11n. The new breed of 802.11n chips, the
AR9003 family will be supported as well soon. To help with its
support we're going to add a few callbacks for hardware routines
which differ considerably instead of adding branch checks for
the revision at runtime.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2eb46d9b 06-Apr-2010 Pavel Roskin <proski@gnu.org>

ath9k: simplify AR9220 fixup code for AR_AN_TOP2 register

Don't modify ah->iniModes, it's supposed to be constant. Instead, apply
the fixup when the data is written to the registers.

Change ath9k_hw_init_eeprom_fix() to only determine whether the fixup is
needed.

This allows similteneous support for AR9220 cards that need AR_AN_TOP2
fixup (such as Ubiquiti SR71-12) and those that don't need it (D-Link
DWA-552 rev A2).

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ffa49f82 31-Mar-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k_hw: Don't check devid for ath9k_htc

For USB devices, this check is invalid.
Remove the check so that new product IDs can be added.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 152d530d 31-Mar-2010 Pavel Roskin <proski@gnu.org>

ath9k: remove ah->mask_reg, it's never used properly

ah->mask_reg was used to hold different data throughout the driver.
ath9k_hw_init_interrupt_masks() used it to save the value written to
AR_IMR. ath9k_hw_set_interrupts() used it to hold the interrupt mask as
defined in enum ath9k_int. Those masks differ in many bits.

Use ah->imask instead of ah->mask_reg in ath9k_hw_set_interrupts() and
ath9k_hw_updatetxtriglevel(). That's what the code was meant to do.
ah->imask is initialized in ath9k_start(), so we don't need to
initialize it from ah->mask_reg.

Once it's done, ah->mask_reg becomes write-only, so it's replaced with a
local variable in ath9k_hw_init_interrupt_masks().

Signed-off-by: Pavel Roskin <proski@gnu.org>
Reported-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3069168c 31-Mar-2010 Pavel Roskin <proski@gnu.org>

ath9k: move imask from sc to ah

Add ah variable in the functions that didn't have it and used sc->imask.
Replace sc->sc_ah with ah in those functions.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 05020d23 17-Mar-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k_hw: add HTC init hardware call for special resets for AR9271

AR9271 needs a full reset only upon the first reset, add
a call for the driver to enable these special resets. We
can optimize this out later without an export.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 70807e99 17-Mar-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k_hw: update initialization values for AR9271

Update the register initialization values for AR9271.
This is based on our last review from our systems team.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 74bad5cb 23-Feb-2010 Pavel Roskin <proski@gnu.org>

ath9k: never read from the AR_IMR_S2 register

The AR_IMR_S2 register sometimes cannot be read correctly. Instead of a
valid value, 0xdeadbeef is returned. The driver has been observed
writing that value back to AR_IMR_S2 after changing a few bits.

Cache the register value in ah->imrs2_reg and always write chached value
to the register.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5ffaf8a3 02-Feb-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: add support for 802.11n bonded out AR2427

Some single chip family devices are sold in the market with
802.11n bonded out, these have no hardware capability for
802.11n but ath9k can still support them. These are called
AR2427.

Cc: stable@kernel.org
Reported-by: Rolf Leggewie <bugzilla.kernel.org@rolf.leggewie.biz>
Tested-by: Bernhard Reiter <ockham@raz.or.at>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e239d859 14-Jan-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: implement coverage class support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0005baf4 14-Jan-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: cleanup slot time and ack/cts timeout handling

Previously ath9k left the initialization of slot timing and ACK/CTS
timeout to the mode specific initvals. This does not handle short vs
long slot in 2.4 GHz and uses a rather strange value for the 2.4 GHz
ACK timeout (64 usec).
This patch uses the proper ath9k_hw functions for setting slot time and
timeouts and also implements the switch between short and long slot
time in 2.4 GHz

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 285f2dda 07-Jan-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Cleanup init/deinit routines

The device initialization and termination functions
were messy and convoluted. Introduce helper functions
to clarify init_softc() and simplify things in general.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0ce024cb 14-Dec-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Clarify Interrupt mitigation

ath9k currently supports only RX interrupt
mitigation.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a9a29ce6 26-Nov-2009 Gabor Juhos <juhosg@openwrt.org>

ath9k: enable 2GHz band only if the device supports it

Currently, the 2GHz band is enabled unconditionally, even if the device
does not support it.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f4709fdf 24-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: Fix maximum tx fifo settings for single stream devices

Atheros single stream AR9285 and AR9271 have half the PCU TX FIFO
buffer size of that of dual stream devices. Dual stream devices
have a max PCU TX FIFO size of 8 KB while single stream devices
have 4 KB. Single stream devices have an issue though and require
hardware only to use half of the amount of its capable PCU TX FIFO
size, 2 KB and this requires a change in software.

Technically a change would not have been required (except for frame
burst considerations of 128 bytes) if these devices would have been
able to use the full 4 KB of the PCU TX FIFO size but our systems
engineers recommend 2 KB to be used only. We enforce this through
software by reducing the max frame triggger level to 2 KB.

Fixing the max frame trigger level should then have a few benefits:

* The PER will now be adjusted as designed for underruns when the
max trigger level is reached. This should help alleviate the
bus as the rate control algorithm chooses a slower rate which
should ensure frames are transmitted properly under high system
bus load.

* The poll we use on our TX queues should now trigger and work
as designed for single stream devices. The hardware passes
data from each TX queue on the PCU TX FIFO queue respecting each
queue's priority. The new trigger level ensures this seeding of
the PCU TX FIFO queue occurs as designed which could mean avoiding
false resets and actually reseting hw correctly when a TX queue
is indeed stuck.

* Some undocumented / unsupported behaviour could have been triggered
when the max trigger level level was being set to 4 KB on single
stream devices. Its not clear what this issue was to me yet.

Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Cc: Bennyam Malavazi <bennyam.malavazi@atheros.com>
Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Shan Palanisamy <shan.palanisamy@atheros.com>
Cc: Paul Shaw <paul.shaw@atheros.com>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 545750d3 23-Nov-2009 Felix Fietkau <nbd@openwrt.org>

ath9k: properly use the mac80211 rate control api

This patch changes ath9k to pass proper MCS indexes and flags
between the RC and the rest of the driver code.
sc->cur_rate_table remains, as it's used by the RC code internally,
but the rest of the driver code no longer uses it, so a potential
new RC for ath9k would not have to update it.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 04658fba 13-Nov-2009 John W. Linville <linville@tuxdriver.com>

ath9k: remove warnings related to signed/unsigned type mismatch

CC [M] drivers/net/wireless/ath/ath9k/recv.o
drivers/net/wireless/ath/ath9k/recv.c: In function `ath_rx_prepare':
drivers/net/wireless/ath/ath9k/recv.c:208: warning: comparison is always true due to limited range of data type
drivers/net/wireless/ath/ath9k/recv.c:220: warning: comparison is always false due to limited range of data type

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 201cd6cc 15-Nov-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Remove a few unused functions

ATH9K_ANT_VARIABLE is the default diversity control used.
Consequently ath9k_hw_decrease_chain_power() does nothing.
ath9k_hw_setantennaswitch() is unused too.

Also, gbeacon_rate is unused.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c90017dd 13-Nov-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k_hw: Fix possible OOB array indexing in gen_timer_index[] on 64-bit

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 30cbd422 03-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move ath_extend_tsf() to hw code to share as ath9k_hw_extend_tsf()

This will be shared between ath9k and ath9k_htc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ae478cf6 19-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: make spur mitigation a callback

This only differs between single-chip solutions and non single-chip
solutions.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e68a060b 19-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: use a callback for frequency change

This avoids a branch on every channel change.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# dc51dd50 19-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: rename ath9k_hw_rf_free() to ath9k_hw_rf_free_ext_banks()

This clarifies this is only required for external radios.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 131d1d03 19-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: start documenting 802.11n RF anlong front ends

Document what we can about the RF analog front ends (radios)
of Atheros 802.11n devices. What should be clearer now is the
what we do for old pre AR5416 and AR5418 MAC based devices in
comparison to the modern sigle-chip 802.11n solutions.

All devices after AR9280 are single chip and require less
programming -- the RF registers no longer need to be initialized
as they all have the RF analog front end embedded together with
the MAC/BB; this includes the AR9271. Older devices such as the
ones with the AR5416 MACs (PCI) or AR5418 MACs (PCI-E) have an
external 2.4 GHz AR2133 radio or a dual band 2.4 GHz / 5 GHz
AR5133 radio. These external radios require additional programming
of the RF registers.

Clarify which parts are for what devices and which code is
shared. This patch has no functional changes.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8564328d 19-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: update register initialization/reset values for ar9271

This update the register initialization/reset values (aka initvals)
for ar9271 based on the last recommended values on 2009-06-04 by our
systems engineering team.

The changes account for:

* Supporting ar9271 1.0 and ar9271 1.1 together, the difference
is bb_spectral_scan_ena, for 1.0 we'll set this to 0x1.

* Ensuring we get the correct noise floor values -115 ~ -118
when we enable bb_enable_ant_div_lnadiv=0 and
mc_tx_def_ant_sel=1. Previous to this we would get noise
floor values in the range -50 ~ -80. To fix settings for
the registers:

- bb_ch1_xatten1_db
- bb_ch1_xatten2_db
- bb_ch1_xatten1_margin
- bb_ch1_xatten2_margin
- bb_ch1_gain_force
- bb_ch1_xatten2_hyst_margin
- bb_ch1_xatten1_hyst_margin
- bb_ch1_max_oc_gain

* 0x8120[2] mc_mic_new_location_enable is changed to 0x1. The MAC team
suggest to set this value.

* 0x9910[0] bb_spectral_scan_ena is changed to 0x0.
For ar9271 1.1 we don't need to enable this bit.

Cc: Stephen Chen <Stephen.Chen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f934c4d9 26-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: distinguish single-chip solutions on initial probe print

Devices with external radios have revisions which we can count on.
On single chip solutions these EEPROM values for these radio revision
also exist but are not meaningful as the radios are embedded onto the
same chip. Each single-chip device evolves together as one device.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2da4f01a 26-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move mac name and rf name helpers to hw code

These are shared between ath9k and the future ath9k_htc driver.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bc974f4a 28-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: define a common priv struct

hw code should never use private driver data, but
sometimes we need a backpointer so just stuff it on
the common ath struct.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7976b426 23-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add AR9271 srev and device ID to allow hw to support ar9271

This allows for hw support to be enabled for ar9271.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 63a75b91 18-Sep-2009 Senthil Balasubramanian <senthilkumar@atheros.com>

ath9k: Reduce PLL Settle time and eliminate redundant PLL calls.

Reduce PLL Settle time and eliminate redundant PLL calls. Also reduce
the LoadNF timeout from 10 msec to 250usec as the 10 msec timeout was
hit with AR9285 in some cases.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 193cd458 18-Sep-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Update INI release for AR9287

If the current channel is between 2412 and 2472 MHz and if the channel is
changing to 2484 MHz, then the registers 0xa1f4, 0xa1f8 and 0xa1fc need to be
programmed to the "japan_2484" values. Conversely, if the current channel
is 2484 MHz and if the channel is changing to one between 2412 and 2472 MHz, then
the three registers need to be programmed to the "normal" values.

This is needed for compliance with Japanese regulatory requirements.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 990b70ab 14-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move ATH9K_RSSI_BAD to hw.h

mac.c is now core driver independent.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cfe8cba9 14-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: clarify what hw code is and remove ath9k.h from a few files

hw code will be shared between ath9k and ath9k_htc.
Just a few more files are left to clean up, mark them as well.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e3d01bfc 14-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move ATH_AMPDU_LIMIT_MAX to hw.h

This is used by hw code.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 25c56eec 14-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: remove ath9k_ht_macmode

This is used just to determine how to program the MAC,
either for 20 MHz operation of 40 MHz so just use conf_is_ht40()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6420014c 13-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: remove ath9k 25 MHz HT40 spacing stuff

This was for supporting 25 MHz spacing for HT40, this is not used
as we use 20 MHz spacing instead for HT40 as per 802.11n. The hardware
is capable of it though so we leave the phymode definition and EEPROM
parsing for it. If some experimenter wants to work on this stuff stuff
you can add an extension enabling bool on ath_common and perhaps some
debugfs knob to enable it. Keep in mind you'll also need to update the
phymode with the AR_PHY_FC_DYN2040_EXT_CH which has been left on the
driver.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c46917bb 13-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: add common debug printing

ath9k uses this for now, ath9k_htc is expected to re-use this
as well. We lave ath5k as is, but it certainly can also be
converted later.

The ath9k module parameter and debugfs entry is kept.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cd9bf689 13-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: separate core driver and hw timer code

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b002a4a9 13-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: add ieee80211_hw to ath_common

Make use of it on hw code in ath9k to avoid
using the ath9k ath_softc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9e4bffd2 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros/ath9k: add common read/write ops and port ath9k to use it

In an effort to make hw code driver core agnostic read
and write operations are defined on the ath_common structure.
This patch adds that and makes ath9k use it. This allows
drivers like ath9k_htc to define its own read/write ops and
still rely on the same hw code. This also paves the way for
sharing code between ath9k/ath5k/ath9k_htc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 867633f0 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: Define bus agnostic bluetooth coex prep helper

We disable ASPM when enabling bluetooth coexistance. Disabling
ASPM is a bus specific operation. In the future other buses may
support bluetooth coexistance, an example is USB. To this end
move the current routine which disables ASPM into pci.c, and declare
it the PCI bt_coex_prep() helper. Additionally, since ASPM is
a PCI-Express primitive ensure we don't ever try to muck with ASPM
registers on non PCI-express devices.

This also cleans up hw.c to not include bus specific headers or
utilities.

Cc: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Zhifeng Cai <zhifeng.cai@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 27c51f1a 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move ath_common to ath_hw

This ensures that we can access common on hw related code
independent of the driver core.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1510718d 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros/ath9k: move macaddr, curaid, curbssid and bssidmask to common

These are common amongst ath9k and ath5k, so put them into the
common structure and make ath9k to use it. ar9170 can use macaddr,
and curbssid. We'll change ath5k and ar9170 separately.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f2b2143e 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: make ath9k_hw_setbssidmask() and ath9k_hw_write_associd() use ath_hw

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9ecdef4b 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: rename driver core and hw power save helpers

ath9k_hw_setpower_nolock --> ath9k_hw_setpower()
ath9k_hw_setpower() --> ath9k_setpower()

Also change the param for ath9k_setpower() to pass the ath_softc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8c77a569 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move ath9k_hw_setpower() to main.c

And we make it static.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a91d75ae 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move ath9k_ps_wakeup() and ath9k_ps_restore() to main.c

These are driver core helpers.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 766ec4a9 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: rename ath_btcoex_info to ath_btcoex_hw

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 75d7839f 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move driver core helpers to main.c

Keep on btcoex.c only hardware access helpers, move the
driver core specific code to main.c. To accomplish
this we had to split ath_init_btcoex_info() into two parts,
the driver core part -- ath_init_btcoex_timer() and the hw
specific part -- ath9k_hw_init_btcoex_hw_info(). This
highlights how ath_gen_timer is part of the driver core, not
hw related, so stuff that into ath_btcoex struct.

The ath9k_hw_btcoex_init() code is now put inline on
ath_init_softc() through a switch to it easier to follow,
since we did that we can now call ath_tx_get_qnum() from
the main.c instead of btcoex.c

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# af03abec 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move hw specific btcoex info to ath_hw

Since we now access it via the ath_hw declare the ath_hw pointer
at the header of some routines and se it. ath9k.h no longer needs to
access btcoex.h and to adjust for this move ath_btcoex_set_weight()
into btcoex.h and instead give main.c a helper for setting initial
values upon drv_start()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d8caa839 16-Sep-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Fix chip wakeup issue

Waking up the chip after powering it down fails sometimes.
In this case the CPU is locked for 200ms. Reduce this
interval to 10ms to avoid excessive busy looping.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 93b1b37f 16-Sep-2009 Vivek Natarajan <vnatarajan@atheros.com>

ath9k: Revamp PCIE workarounds

* Disable L1 state ONLY when device is in D3 mode.
* Clear bit 22 of register 0x4004.
* Handle power on/off properly

Not setting the workarounds properly resulted in the
disappearance of the card in certain cases.

Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# fe12946e 09-Sep-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Enable btcoex based on the subsystem id of the device

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# aeac355d 09-Sep-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Store subsystem id in struct hw_version

This subsystem id will be used later to turn on the btcoex
support.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7b6840ab 07-Sep-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Disable ASPM when btcoex is active

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1773912b 26-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Add Bluetooth Coexistence 3-wire support

This patch adds 3-wire bluetooth coex support for AR9285.
This support can be enabled through btcoex_enable modparam.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ff155a45 26-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Add infrastructure for generic hw timers

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 81fa16fb 26-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Remove hw capability bit meant for btcoex

We don't need a hw cap bit for btcoex anymore as btcoex scheme type
is enough to do this.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f14462c6 26-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Move btcoex related data to a separate struct

Also define macros for wlanactive and btactive (5 & 6) gpios.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 17d50d1d 26-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Move btcoex stuff from hw.[ch] to new btcoex.[ch]

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f985ad12 26-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Split ath9k_hw_btcoex_enable() into two logical pieces

This function currently does initialization + enable the
btcoex support. Split it into two logical functions which
does the above operations separately. Btcoex initialization
is done during attach time and enabling this feature is done
in start(). Also, add code to disable btcoex support in stop().

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a13883b0 25-Aug-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Reduce the frequency of PA offset calibration

PA calibration need not be done if the offset is not varying.
The current logic does PA calibration even if the offset is the
same.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 608b88cb 17-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath: move regulatory info into shared common structure

This moves the shared regulatory structure into the
common structure. We will use this ongoing for common
data.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 08fc5c1b 14-Aug-2009 Vivek Natarajan <vivek.natraj@gmail.com>

ath9k: Enable LEDs for AR9287 chipsets.

Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1cf6873a 12-Aug-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Remove duplicate variables

diversity_control and antenna_switch_swap are already
present in ath9k_ops_config. Remove duplicate occurrences
in ath_hw.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1aa8e847 12-Aug-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Remove has_hw_phycounters

PHY counters are available in all chipsets supported
by ath9k. Remove the check.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 54e4cec6 06-Aug-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Cleanup function return types

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d7e7d229 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: add initial hardware support for ar9271

We will finalize this after some driver core changes, for now
we leave this unsupported.

Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Zhifeng Cai <zhifeng.cai@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 475f5989 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: Remove _t postfix for ar9287_eeprom structure

We don't use typdefs on ath9k, remove that _t.

Cc: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 081b35ab 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free()

This makes it clear what this does.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f637cfd6 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: describe hw initialization better

During initialization ath9k tends to use "attach" to when we
initialize hardware due to the fact we used to attach a "HAL".
The notion of a HAL is long gone, so lets just be clear on what
we are doing.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 07c10c61 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: pass only one argument to hw attach

The softc is cached and set within the ath_hw struct.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8df5d1b7 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move devid cache setting to ath_init()

This lets us trim one argument off of hw initializer routines.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4f3acf81 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: move memory allocation of ath_hw to ath_init()

This lets us simplify attach code and arguments passed.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0b3acfa7 29-Jul-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Remove unused ath9k_hw_intrget()

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 96148326 24-Jul-2009 Gabor Juhos <juhosg@openwrt.org>

ath9k: fix race with IEEE80211_CONF_PS checks

There is a small window where the mac80211 changes the IEEE80211_CONF_PS
flag, and then informs the driver about the change. We have a race
condition if we are checking the flag in the same time. Avoid it by
introducing a local variable, and using that instead of checking the
IEEE80211_CONF_PS flag directly.

This fix the problem reported by Luis:
http://article.gmane.org/gmane.linux.kernel.wireless.general/34363

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ac88b6ec 22-Jul-2009 Vivek Natarajan <vivek.natraj@gmail.com>

ath9k: Add support for AR9287 based chipsets.

Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f9b604f6 20-Jun-2009 Gabor Juhos <juhosg@openwrt.org>

ath9k: make use ath9k_hw_wait int ath9k_hw_reset_tsf

We have a dedicated function for this kind of checks, use that
instead of duplicating the code.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b9b6e15a 14-Jul-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: remap ATH9K_MODE_*

There are a lot of gaps here.

Cc: Derek Smithies <derek@indranet.co.nz>
Cc: Chittajit Mitra <Chittajit.Mitra@Atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# dfe80a3f 14-Jul-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: remove ATH9K_MODE_11B

This saves us 2733 bytes.

text data bss dec hex filename
252265 3628 1584 257477 3edc5 ath9k-has-b-rate.ko
249905 3628 1584 255117 3e48d ath9k.ko

Cc: Derek Smithies <derek@indranet.co.nz>
Cc: Chittajit Mitra <Chittajit.Mitra@Atheros.com>
Siged-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3b319aae 13-Jun-2009 Johannes Berg <johannes@sipsolutions.net>

ath9k: port to cfg80211 rfkill

This ports the ath9k rfkill code to the new API offered by
cfg80211 and thus removes a lot of useless stuff.

("With this series a kernel panic, which is a regression, during module
unload disappears." -- Vasanthakumar Thiagarajan <vasanth@atheros.com>

Other patches in the series:

ath9k: Add helper to get ath9k specific current channel
ath9k: Make sure we have current channel in ah_curchan before rf
disable/enable

-- JWL)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Luis Rodriguez <mcgrof@gmail.com>
Tested-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8fbff4b8 08-May-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Cleanup ineffective return values

This patch makes the return type of some of the functions
void as those functions always return true

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4f0fc7c3 06-May-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: make private driver rate tables const

On x86 this allows us to do the following small savings:
shave off 23 % off of the module's data, and
shave off 6 % off of the module's text.

We save 456 bytes, for those counting.

$ size ath9k.ko
text data bss dec hex filename
250794 3628 1600 256022 3e816 ath9k.ko
$ size ath9k-old.ko
text data bss dec hex filename
239114 15308 1600 256022 3e816 ath9k-old.ko

$ du -b ath9k.ko
4034244 ath9k.ko
$ du -b ath9k-old.ko
4033788 ath9k-old.ko

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cbfe9468 13-Apr-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Use a consistent naming convention

This patch replaces old 'hal_' prefixes with 'ath9k_'.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 822b0dfc 13-Apr-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Remove unused channel flags

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 203c4805 30-Mar-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: put atheros wireless drivers into ath/

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>