History log of /drivers/net/wireless/ath/ath5k/ath5k.h
Revision Date Author Comments
093ec3c5337434f40d77c1af06c139da3e5ba6dc 10-Sep-2014 Paul Bolle <pebolle@tiscali.nl> ath5k: Remove AHB bus support

AHB bus support was added in v2.6.38, through commit a0b907ee2a71
("ath5k: Add AHB bus support."). That code can only be build if the
Kconfig symbol ATHEROS_AR231X is set. But that symbol has never been
added to the tree. So AHB bus support has always been dead code.

Let's remove all code that depends on ATHEROS_AR231X. If that symbol
ever gets added to the tree the AHB bus support can be re-added too.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
41881354f93a5e82f16c811f95e0700bf99283ec 13-Jun-2014 Mathy Vanhoef <vanhoefm@gmail.com> ath5k: support for FIF_FCSFAIL filter

When the FIF_FCSFAIL filter flag is set, pass frames with CRC errors.

Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4d70f2fbe12118c5526a1d761f8ef562cecbbc2c 14-Aug-2013 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> ath5k: enable support for 5 MHz and 10 MHz channels

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>
188741731ce1148c0f8ab63ff41c81ce56ac1e74 25-Feb-2013 Jiri Slaby <jslaby@suse.cz> ath5k: cleanup channel to eprom_mode function

Stop returning negative values from ath5k_eeprom_mode_from_channel.
Yell loudly about that case in that function instead and return the
default/zero/mode A. This cleans up the callers, but needs to pass ah
down to ath5k_eeprom_mode_from_channel for ATH5K_WARN. For that
purpose we also need the declaration to be moved to ath5k.h.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
987af54fa93b1c01eb3a85229bc93dfe77e6d2e1 05-Aug-2012 Nick Kossifidis <mickflemm@gmail.com> ath5k: Put power_level where it belongs and rename it

Put power_level to ah_txpower struct with the rest tx power infos and
also rename it to txp_requested to make more sense.

v2 make sure we don't memset it to zero on reset

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4ee73f338a528f44fd90496adfbfd9c119401850 11-Apr-2012 Michal Kazior <michal.kazior@tieto.com> mac80211: remove hw.conf.channel usage where possible

Removes hw.conf.channel usage from the following functions:
* ieee80211_mandatory_rates
* ieee80211_sta_get_rates
* ieee80211_frame_duration
* ieee80211_rts_duration
* ieee80211_ctstoself_duration

This is in preparation for multi-channel operation.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
227842d1176019512d24236f7fb894f0fadd30d1 19-Mar-2012 Joe Perches <joe@perches.com> ath5k: Introduce _ath5k_printk to reduce code/text

Macros can be converted to functions to reduce overall object size.

Convert the ATH5K_PRINTK macro to use _ath5k_printk.

Allyesconfig size is reduced ~10%

$ size drivers/net/wireless/ath/ath5k/built-in.o*
text data bss dec hex filename
211557 2032 40672 254261 3e135 drivers/net/wireless/ath/ath5k/built-in.o.new
235412 2032 47296 284740 45844 drivers/net/wireless/ath/ath5k/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
516304b0f45614fb8967dc86ff681499204cdbb1 19-Mar-2012 Joe Perches <joe@perches.com> ath: Add and use pr_fmt, convert printks to pr_<level>

Use a more current logging style.
Make sure all output is prefixed appropriately.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
da473b61ad9e25e2ac3efb58d95c5b573260c6a8 03-Mar-2012 Chun-Yeow Yeoh <yeohchunyeow@gmail.com> ath5k: allow AP and mesh mode to operate simultaneously

This patch allows the possibility of having the mesh point and AP to be operated
simultaneously in one single radio. Previously, mesh point fails to generate the
mesh beacon if virtual AP is created for the same radio.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cede8b64808f543fb5ed4991af330a0ae6026805 14-Feb-2012 Jonathan Bither <jonbither@gmail.com> ath5k:Remove __raw_read and __raw_write

By swithing from our __raw_read and __raw_write functions to ioread32 and iowrite32,
benchmarks on my desk with iperf went from 11MBps to 18.1MBps using the AHB bus
on an EnGenius ECB3500 running OpenWRT.

Signed-off-by: Jonathan Bither <jonbither@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
eb93992207dadb946a3b5cf4544957dc924a6f58 19-Dec-2011 Rusty Russell <rusty@rustcorp.com.au> module_param: make bool parameters really bool (net & drivers/net)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

(Thanks to Joe Perches for suggesting coccinelle for 0/1 -> true/false).

Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
b4cfb5d574cd9e23e41462061941f6ac68a41c80 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com> ath5k: Renumber hw queue ids

According to documentation higher DCUs have higher priority and should
be used for beacons and CAB traffic. More specifically DCU 9 should be
used for beacons and DCU 8 for CAB traffic, I assumed DCU 7 should be
OK for UAPSD traffic.

Note that DCU 8 and 9 are special because they can only be mapped to a single
QCU each but since we use a 1:1 mapping between QCUs and DCUs anyway we don't
have to change much.

P.S. I also did a few related cleanups on qcu.c and ath5k.h

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
86f62d9b705cdd4f04da5387a5c71ca6ee0a37c9 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com> ath5k: MRR support and 2GHz radio override belong in ah_capabilities

MRR support and 2GHz radio override belong in ah_capabilities and we
should use them (e.g. so far we used to set mrr descriptor without
checking if MRR support is enabled + we checked for MRR support 2
times, one by trying to set up an MRR descriptor and another one based
on MAC version).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c47faa364cfb249d5d7670fb7293a6f9acd8aa9e 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com> ath5k: Cleanups v2 + add kerneldoc on all hw functions

No functional changes

Add kernel doc for all ath5k_hw_* functions and strcucts. Also do some cleanup,
rename ath5k_hw_init_beacon to ath5k_hw_init_beacon_timers, remove an unused
variable from ath5k_hw_pcu_init and a few obsolete macros, mostly related to XR.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ce169aca0d823d38465127023e3d571816e6666c 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com> ath5k: Calibration re-work

Noise floor calibration does not interfere with traffic and should run more
often as part of our "short calibration". The full calibration is not the
noise floor calibration but the AGC + Gain_F (on RF5111 and RF5112) calibration
and should run less often because it does interfere with traffic.

So

Short calibration -> I/Q & NF Calibration
Long calibration -> Short + AGC + Gain_F

This patch was for some time on my pub/ dir on www.kernel.org and has been tested
by a few people and me. I think it's O.K. to go in.

I also changed ah_calibration to ah_iq_cal_needed to make more sense.

v2 Use a workqueue instead of a tasklet for calibration

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
fea9480786c0fc41901bddb9819dd036527a9e10 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com> ath5k: Add TXNOFRM to INT_TX_ALL

Add TXNOFRM to INT_TX_ALL since it's a TX interrupt too.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7ff7c82ee4339af277cface9071f81c5c10a9283 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com> ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers

Since card has 12 tx queues and we want to keep track of the interrupts
per queue we can't fit all these interrupt bits on a single register.
So we have 5 registers, the primary interrupt status register (PISR) and
the 4 secondary interupt status registers (SISRs).

In order to be able to read them all at once (atomic operation) Atheros
introduced the Read-And-Clear registers to make things easier. So when
reading RAC_PISR register, hw does a read on PISR and all SISRs, returns
the value of PISR, copies all SISR values to their shadow copies (RAC_SISRx)
and clears PISR and SISRs. This saves us from reading PISR/SISRs in a sequence.

So far we 've used this approach and MadWiFi/Windows driver etc also used it
for years.

It turns out this operation is not atomic after all (at least not on all cards)
That means it's possible to loose some interrupts because they came after the
copy step and hw cleared them on the clean step !

That's probably the reason we got missed beacons, got stuck queues etc and
couldn't figure out what was going on.

With this patch we switch from RaC operation to an alternative method (that
makes more sense IMHO anyway, I just chose to be on the safe side so far).
Instead of reading RAC registers, we read the normal PISR/SISR registers and
clear any bits we got by writing them back on the register. This will clear only
the bits we got on our read step and leave any new bits unaffected (at least
that's what docs say). So if any new interrupts come up we won't miss it.

I've tested this with an AR5213 and an AR2425 and it seems O.K.

Many thanks to Adrian Chadd for debuging this and reviewing the patch !

v2: Make sure we don't clear PISR bits that map to SISR generated interrupts
(added a comment on the code for this)

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
931be260ed54843edac37cb3ff09a40b86114b31 27-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: clean up base.h and its use

Remove unnecessary includes from base.h. Add includes to other files as
necessary. Don't include base.h unless needed.

Move declarations for functions in base.c from ath5k.h to base.h.

Use a better named define to protect base.h against double inclusion.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
32c254645f90a5a5486788c0deb30531fdb609c2 23-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value

When checking for the band, use channel->band.

Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take
ieee80211_channel. Change ath5k_hw_radio_revision() to take
ieee80211_band.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8d44a823c847c3d20e33c4c714ab48b700f41f14 23-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: remove most references to XR

XR is a proprietary feature of the chipset. It's not supported and
should not be supported.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2972cc1895a329ae977375d68b10d91f59167bbb 23-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: remove unused and write-only structures and fields

struct ath5k_avg_val is unused.

In struct ath5k_hw, lladdr, ah_radar and ah_mac_revision are write-only,
rxbufsize is unused, ah_phy is write-only and referenced by unused
macros.

In struct ath5k_vif, lladdr is write-only.

Remove AR5K_TUNE_RADAR_ALERT, which has no effect.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c5f3f45c4934d7e7dc266092debe88628d2cbb5d 21-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: remove ath5k_hw_get_capability(), don't use VEOL on AR5210

There are only two capabilities we need, and both are trivial to find.

ath5k_hw_hasbssidmask() is true on AR5212, but not on AR5210 or AR5211.

ath5k_hw_hasveol() is true on AR5211 and AR5212, but not on AR5210,
according to the HAL source.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
fabba0480637add5411b1dc59603cc71e3505a69 21-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: merge ath5k_{init, deinit}_hw() with their thin wrappers

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e0d687bd9df218ba3d97aac15919d30816d72dcb 15-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: merge ath5k_hw and ath5k_softc

Both ath5k_hw and ath5k_softc represent one instance of the hardware.
This duplication is historical and is not needed anymore.

Keep the name "ath5k_hw" for the merged structure and "ah" for the
variable pointing to it. "ath5k_hw" is shorter than "ath5k_softc", more
descriptive and more widely used.

Put the combined structure to ath5k.h where the old ath5k_softc used to
be. Move some code from base.h to ath5k.h as needed.

Remove memory allocation for struct ath5k_hw and the corresponding error
handling. Merge iobase and ah_iobase fields.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6340211c5f4775a52c98052fb5661565f79249fd 12-Jul-2011 Felix Fietkau <nbd@openwrt.org> ath5k: disable 32KHz sleep clock operation by default

While 32 KHz sleep clock might provide some power saving benefits,
it is also a major source of stability issues, on OpenWrt it produced
some reproducible data bus errors on register accesses on several
different MIPS platforms.

All the Atheros drivers that I can find do not enable this feature,
so it makes sense to leave it disabled in ath5k as well.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6a2a0e738225fc9ec063f84b79f0adf5c0ed176c 09-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: fix typos, bad comment formatting and GHz in place of MHz

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e4bbf2f541501dcde47ce687ffc6d238bd2f7813 08-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: fix formatting errors found by checkpatch.pl

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d2c7f7730e5660c812765acd57516f709ea35fc0 08-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: fix misplaced or extraneous braces found by checkpatch.pl

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ef82763d8dad6b2312ce388fd9af23dd2b4626d4 08-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: use KERN_WARNING in ATH5K_PRINTF

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
fdd55d14b7d3a721e60fdc8be12ec0beb9cda8c6 08-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: remove unneeded parentheses after return

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0a5d381348fcb12d27289b3a66824fb3481911ce 08-Jul-2011 Pavel Roskin <proski@gnu.org> ath5k: replace spaces with tabs as suggested by checkpatch.pl

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f5cbc8bac939f38c0c55cfaa348c170663a16767 16-Jun-2011 Pavel Roskin <proski@gnu.org> ath5k: minor cleanup

Move an extern variable declaration to a header file. Prefix all
functions with "ath5k_". Make ath5k_intr() static. Remove unneeded
forward declarations. Remove pointless "extern" in a function
declaration.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
fa9bfd61e03e8dbcf110a93b373234d17a732233 13-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: add a new bus op for reading the mac address

On AHB, the calibration data usually does not contain a valid MAC address,
the correct MAC address is stored in the board config.

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>
0cb9e06b6359bfa82f46c38a0b43e72d90b84081 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>
c266c71a9cbdccb40fb6f4c05d4ddaa6226e5eba 10-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: reduce interrupt load caused by rx/tx interrupts

While the rx/tx tasklet is pending, new unnecessary interrupts may arrive.
Decrease the load by temporarily disabling the interrupts until the tasklet
has completed.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ed8950857f728303a1463ac9267e72c278738bf6 10-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: remove ts_retry from ath5k_tx_status

Reusing the configured retry counts from the skb cb is more efficient than
reloading the data from uncached memory.
Replace ts_longretry (unused) with ts_final_retry which contains the retry
count for the final rate only

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
fe12081cb664cd5d412dc56de0585a80484b1331 10-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: remove ts_rate from ath5k_tx_status

It is no longer necessary for preparing mac80211 tx status

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b1ad1b6febb7772583c98d9a879fbbdb82a726a7 09-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: fix slot time handling

Set the slot time based on the mac80211 short slot vs long slot setting
instead of just forcing long slot for all CCK-enabled channels.
This slightly improves 802.11g mode performance in in my tests.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
488a50176c169eb36544b4f970c8bba68ede30a1 09-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: fix SIFS time handling

ath5k uses 8 usec as a sifs time, extracted from the initvals, whereas the
standard requires a sifs time of 10. The difference originates from the fact
that the SIFS register has an offset of 2 usec.
Fix the SIFS time definition to use the standard value of 10 usec and subtract
2 usecs when writing the SIFS register.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a27049e2c926bcf68360532a5ae66e408296ae85 09-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath5k: fix short preamble rate duration value

Subtract the difference in preamble duration (in usec) from the value
returned by ieee80211_generic_frame_duration.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
23ffaa89df16e55578318cfd852f23dcb37bf37b 08-Mar-2011 John W. Linville <linville@tuxdriver.com> ath5k: restrict AR5K_TX_QUEUE_ID_DATA_MAX to reflect the [0,3] range

This just matches reality...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Bob Copeland <me@bobcopeland.com>
7bb4568372856688bc070917265bce0b88bb7d4d 24-Feb-2011 Johannes Berg <johannes.berg@intel.com> mac80211: make tx() operation return void

The return value of the tx operation is commonly
misused by drivers, leading to errors. All drivers
will drop frames if they fail to TX the frame, and
they must also properly manage the queues (if they
didn't, mac80211 would already warn).

Removing the ability for drivers to return a BUSY
value also allows significant cleanups of the TX
TX handling code in mac80211.

Note that this also fixes a bug in ath9k_htc, the
old "return -1" there was wrong.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com> [ath5k]
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> [rt2x00]
Acked-by: Larry Finger <Larry.Finger@lwfinger.net> [b43, rtl8187, rtlwifi]
Acked-by: Luciano Coelho <coelho@ti.com> [wl12xx]
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12873372fe1f201813f1cc750a8af7d9193f445c 15-Feb-2011 Bob Copeland <me@bobcopeland.com> ath5k: move external function definitions to a header file

Johannes pointed out the mess of external function prototypes in the
mac80211-ops.c file. Woe to anyone who changes these functions...

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
76a9f6fd9adc5ce62b4ea36a099bb1458d4cb7a6 28-Jan-2011 Bruno Randolf <br1@einfach.org> ath5k: Fix short and long retry configuration

The register definition for retry configuration on AR5212 was wrong, and simply
copied over from AR5210. Update the register definitions from the documentation.

Let the short and long retries be configured from mac80211 and use the standard
values of 7 and 4 by default. Also we need to make sure we don't export more
retries than we are configured for to mac80211 (and the rate module) in
hw->max_rate_tries.

Also clean up the code by removing unused defines and variables and drop the
different values for "station retries" - if these need to be different it can
be handled tru ah_retry_long/short.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0207c0c51a37659a92232e665f2a7fadec170556 21-Dec-2010 Bruno Randolf <br1@einfach.org> ath5k: Use helper function to get eeprom mode from channel

Introduce a helper function to get the EEPROM mode from channel and remove
multiple similar switch statements. Also since it's now easy to get the EEPROM
mode from the channel, use them inside the functions which need it, instead of
passing a redundant ee_mode parameter.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
26a51ad7f285236ca593c57cffcaadd40514084a 21-Dec-2010 Bruno Randolf <br1@einfach.org> ath5k: Remove ATH5K_INI_RFGAIN defines, use band instead

Remove redundant defines.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
51f00622e5664ae77fd6c8670ddd402d9b77ccc8 21-Dec-2010 Bruno Randolf <br1@einfach.org> ath5k: Track current TX power separately from max TX power

Add a new variable to keep track of the currently configured tx power. Before
max_pwr was re-used for keeping the maximum allowed power as well as the
current configuration. Doing a min() on it allows you to lower the txpower, but
how would you be able to make it higher again?

This patch fixes that by adding a new variable ah_cur_pwr which is used instead
of txp_max_pwr to keep the current configuration. txp_max_pwr is used to check
if we are within the limits.

Another problem fixed by this patch is that it avoids setting a zero txpower
when things are initialized first and the current power is not yet set.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
26c7fc436422de5d6d2b491f777e965e96f5c3a2 21-Dec-2010 Bruno Randolf <br1@einfach.org> ath5k: Simplify powertable recalculation

Let ath5k_hw_txpower() decide if it can re-use the powertable or if it has to
be recalculated instead of passing a 'fast' flag from the outside.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a0b907ee2a71052fefdf6151764095f3f97b3275 02-Dec-2010 Felix Fietkau <nbd@openwrt.org> ath5k: Add AHB bus support.

AHB specific functions are now in ahb.c file. AHB bus is
compiled in when CONFIG_ATHEROS_AR231X is set in kernel.
All other platforms will use PCI bus.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e7aecd327d80b2f156b54769013aaccb2a20645a 02-Dec-2010 Felix Fietkau <nbd@openwrt.org> ath5k: Add a function to read chipset's MAC revision

Add bus dependent revision read function which is used to
determine chipset's MAC before hardware is initialized.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4aa5d783c9e1c72e4950ff34f388077ccecac74a 02-Dec-2010 Felix Fietkau <nbd@openwrt.org> ath5k: Use generic eeprom read from common ath_bus_opts struct.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e5b046d86fac609f636d127a38de94a175c7e83b 02-Dec-2010 Felix Fietkau <nbd@openwrt.org> ath5k: Move PCI bus functions to separate file.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
132b1c3ee38ea6fa0501004fd0f19acb554e5a44 02-Dec-2010 Felix Fietkau <nbd@openwrt.org> ath5k: Introduce ath5k_init_softc function as in ath9k

Split pci initialization into hardware specific
functions and softc structure initialization.
Make function naming similar to ones ath9k.
Introduce ath_bus_opts in ath5k for later
AHB bus integration.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8c2b418a07b4dc77d7efadb890ba9ad1a4161c3f 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Clean up turbo mode initvals/rfregs

* Clean up what's left of turbo mode, since we handle all
register modifications (rfbuffer comes next) on code there
is no need to have duplicated arrays.

* Rename change_channel to skip_pcu on initvals.c as we did
on reset.c

Signed-off-by: Nick Kossifidis <micklfemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
acb091d67c5c9649cf5d25055ef6fd64239a6762 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Cleanup turbo channel flags

* Clean up CHANNEL_T(URBO), use AR5K_BWMODE_40MHZ instead

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
8aec7af99b1e4594c4bb9e1c48005e6111f97e8e 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Support synth-only channel change for AR2413/AR5413

* Add synth-only channel change for AR2413/5413. When we call
ath5k_reset with a channel ath5k_hw_reset will first try to
set channel on PHY while PHY is running instead of doing a normal
full reset. To do this phy_init has to change to implement this
functionality.

* Clean up change_channel flag, what it really did was skip PCU
registers when setting initvals. This is done because on reset
PCU registers are not affected (except the registers we set
in pcu init and -due to hw problems- TSF). Use a new skip_pcu
flag that's not misleading instead. In the future we might use
that to also skip PCU reset and save us the TSF etc problems
(needs testing because standard practice is to reset everything).

* Use fast channel change only when setting channel, and set skip_pcu
to false only on init. When we reset the card due to DMA or PHY
problems skip pcu but never do a fast channel change.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
71ba1c30851575b43ba76b0f9c26ff5567e8136c 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Always set IFS intervals on reset

* Make sure we always set IFS timings even if no
coverage class is set. If we don't we'll miss the
needed changes for different bwmodes.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
eeb8832b3181d6ca8593051b68c466e5d2653bb3 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Set all IFS intervals, not just slot time

* Replace set_slot_time with set_ifs_intervals that also sets
the various inter-frame space intervals based on current bwmode.

* Clean up AR5210 mess from reset_tx_queue, AR5210 only has one
data queue and we set IFS intervals for that queue on set_ifs_intervals
so there is nothing left to do for 5210 on reset_tx_queue.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
61cde037234c4b8e6497a23f5f236c64cbf9d41d 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Extend rate_duration

* Extend ieee80211_generic_frame_duration to support the various
bwmodes.

* Better document what's going on with ack bitrates and update
write_rate_duration to support the standard ack bitrates (when
we don't set the high bit).

* Get rid of set_ack_bitrate_high and introduce a flag on ath5k_hw
for this (we only called the function on init anyway so there is no
difference).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
3017fcab416d8d1ee48ca16aa9a3062f600dab8e 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Extend get_default_sifs/slot_time

* Extend get_default_sifs/slot_time to include timings for turbo
half and quarter rate modes.

* AR5210 code for now uses timings already on core clock units
instead of usecs so rename them (we 'll clean it up later).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
b405086ba47678a5b8f6e7cd835a3d27ebb6f744 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Increase PHY settling parameters for turo mode

* On turbo mode increase PHY settling times, note that
we only increase switch settling time on AR5212 as indicated
by initvals.

* A few cleanups: Move frame control settings for AR5210 from
reset_tx_queue to tweak_initvals and remove phy_scal settings
from tweak_initvals (we tweak them alread on set_sleep_clock).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
c297560206adf0cda8ce38ef9b20b0a025754c4d 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Put core clock initialization on a new function

* Handle all usec parameters in one function. It's much cleaner
this way.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
fa3d2feeff4723cce8d4722902492d60b7f75fcc 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Add new field on ath5k_hw to track bandwidth modes

* Prepare for half/quarter/turbo support, introduce a new
ah_bwmode parameter and get rid of ah_turbo. Bwmode stands
for "bandwidth mode" and can have 4 values, default (20MHz),
turbo (40MHz), half rate (10MHz), and quarter rate (5MHz).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14fae2d4b61b890cea58d63091406b86ec9bafcd 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Use new function to stop beacon queue

* Since we only use ath5k_hw_stop_tx_dma to stop the beacon
queue, introduce a new function ath5k_hw_stop_beacon_queue so
that we can use that instead and have better control. In the future
we can add more beacon queue specific stuff there (maybe tweak
beacon timers or something), for now just call ath5k_hw_stop_tx_dma.

* Also since we don't call ath5k_hw_stop_rx/tx_dma from outside
dma.c, make them static.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
e8325ed87457e07b9ceeb1e7a31df787dd7ee106 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Check RXE when setting RXDP

* Make sure we are not trying to set RXDP while RX is active,
for now ignore the return value.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
d41174fabdae348c6583cf05aeb329da232c342c 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Add new function to stop rx/tx DMA

* Add a new function to stop rx/tx dma and use in when reset starts

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
9320b5c4a7260d9593102f378201d17e3f030739 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: Reset cleanup and generic cleanup

* No functional changes

* Clean up reset:
Introduce init functions for each unit and call them instead
of having everything inside ath5k_hw_reset (it's just c/p for
now so nothing changes except calling order -I tested it with
various cards and it's ok-)

* Further cleanups:
ofdm_timings belongs to phy.c
rate_duration belongs to pcu.c
clock functions are general and belong to reset.c (more to follow)

* Reorder functions for better organization:
We start with helpers and other functions follow in categories,
init functions are last

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
eef39befaae2a1559efe197d795c376a317af2af 16-Nov-2010 Bruno Randolf <br1@einfach.org> ath5k: Use generic EWMA library

Remove ath5k's private moving average implementation in favour of the generic
library version.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
631dd1a885b6d7e9f6f51b4e5b311c2bb04c323c 18-Oct-2010 Justin P. Mattock <justinmattock@gmail.com> Update broken web addresses in the kernel.

The patch below updates broken web addresses in the kernel

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Dimitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Acked-by: Ben Pfaff <blp@cs.stanford.edu>
Acked-by: Hans J. Koch <hjk@linutronix.de>
Reviewed-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9d119f3ebd074bde0b801f476a44ca60d222efb2 08-Oct-2010 Felix Fietkau <nbd@openwrt.org> ath5k: store the clock rate in common data on channel changes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7f896126017830b29cf501d246ee32b81e359acd 26-Sep-2010 Bruno Randolf <br1@einfach.org> ath5k: Check and fix ATIM window

This patch adds sanity-checks for the beacon timers and especially the ATIM
window to ath5k. It is basically the same what i did for madwifi two years ago
and fixes a problem in IBSS mode which has been described as "ramping" pings.

See the code comments for a more detailed description and these links:

http://madwifi-project.org/ticket/1154
http://madwifi-project.org/changeset/3867
http://thread.gmane.org/gmane.linux.drivers.madwifi.devel/6066

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4a79f2c517cce31c3b25aab0ec5078368b22c363 26-Sep-2010 Bruno Randolf <br1@einfach.org> ath5k: Remove unused variable for atim window

It's not used and it's unlikely we will ever implement ATIM.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
de8af45520f47d14397b603beefae3d2983ce787 17-Sep-2010 Bruno Randolf <br1@einfach.org> ath5k: Simplify cw_min/max and AIFS configuration

Get rid of overly complicated cw_min/max and AIFS configuration:

* Validate values in ath5k_hw_set_tx_queueprops(), so we can use them directly
without further checks or computation in ath5k_hw_reset_tx_queue().

* Simplifiy by using AR5K_TUNE_AIFS|CWMIN|CWMAX variables directly since we
don't support XR or B channels. That way we can also remove
AR5K_TXQ_USEDEFAULT and the confusing logic around it.

* Update data types: AIFS is u8, CW's are u16.

* Remove now unneeded variables in ath5k_hw.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4edd761f4075b03be5932682a2f7b9368dc9e536 17-Sep-2010 Bruno Randolf <br1@einfach.org> ath5k: Add watchdog for stuck TX queues

Since we do not know any better solution to the problem that TX queues can get
stuck, this adds a timer-based watchdog, which will check for stuck queues and
reset the hardware if necessary.

Ported from ath9k commit 164ace38536849966ffa377b1b1132993a5a375d.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
781f3136ff4cdd2b33149f2295fefa21f77b1c56 08-Sep-2010 Bruno Randolf <br1@einfach.org> ath5k: Use common crypt capabilities flags

Replace ah_aes_support and ah_combined_mic with common ath_crypt_caps
ATH_CRYPT_CAP_CIPHER_AESCCM and ATH_CRYPT_CAP_MIC_COMBINED.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d8878f83cf1cc0061e8b3bcf7dbd589410a51039 08-Sep-2010 Bruno Randolf <br1@einfach.org> ath5k: Remove old ath5k key handling functions

Remove the old ath5k key handling functions, since we now use the key
management in ath common.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b61279809860690fe5c9fcb40441008d31fabab6 15-Aug-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: remove own (wrong) IEEE80211_MAX_LEN

Use the version already supplied in include/linux/ieee80211.h.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
418de6d955fa1da0cb4332661a31d21f57e954ab 15-Aug-2010 Nick Kossifidis <mickflemm@gmail.com> ath5k: rename ath5k_hw_set_associd to _set_bssid

Although the named function also sets the aid, its main
purpose is configuring the bssid and we use that
everywhere else.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a66681935455bfbb95dfe42aa3182e3f5b1ff1b4 16-Jun-2010 Bruno Randolf <br1@einfach.org> ath5k: use direct function calls for descriptors when possible

Use direct function calls for ath5k_hw_setup_rx_desc() and
ath5k_hw_setup_mrr_tx_desc() instead of a function pointer which always pointed
to the same function in the case of ath5k_hw_setup_rx_desc() and which is
easily unified in the case of ath5k_hw_setup_mrr_tx_desc().

Also simplify the initialization function for the remaining function pointers.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
beade6363cbb5308ba9918d7547aa574ae08a8bd 16-Jun-2010 Bruno Randolf <br1@einfach.org> ath5k: fix some comment typos

Fix comment about dma sizes, brackets were missing. Replace 'insure' with
'ensure'.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0ca74027ac709f99aae1805e593c95843dd18234 07-Jun-2010 Bruno Randolf <br1@einfach.org> ath5k: new function for setting the antenna switch table

Collect all pieces concering the antenna switch table into one function.
Previously it was split up between ath5k_hw_reset() and
ath5k_hw_commit_eeprom_settings().

Also we need to set the antenna switch table when ath5k_hw_set_antenna_mode()
is called manually (by "iw phy0 antenna set", for example).

I'm not sure if we need to set the switchtable at the same place in
ath5k_hw_reset() as it was before - it is set later thru
ath5k_hw_set_antenna_mode() anyways - but i leave it there to avoid
problems(?).

Plus print switchtable registers in the debugfs file.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
40ca22eafeb61ee1419dd7c4c2698459183c582c 19-May-2010 Bruno Randolf <br1@einfach.org> ath5k: add sysfs files for ANI parameters

/sys/class/ieee80211/phy0/device/ani/ani_mode
/sys/class/ieee80211/phy0/device/ani/noise_immunity_level
/sys/class/ieee80211/phy0/device/ani/spur_level
/sys/class/ieee80211/phy0/device/ani/firstep_level
/sys/class/ieee80211/phy0/device/ani/ofdm_weak_signal_detection
/sys/class/ieee80211/phy0/device/ani/cck_weak_signal_detection
/sys/class/ieee80211/phy0/device/ani/noise_immunity_level_max
/sys/class/ieee80211/phy0/device/ani/spur_level_max
/sys/class/ieee80211/phy0/device/ani/firstep_level_max

sysfs has a lot of symlinks, so you can find the files also in other locations,
like (by PCI ID) /sys/devices/pci0000:00/0000:00:11.0/ani and others.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
afe86286a166881d2ae7ce4469036735254d1263 19-May-2010 Bruno Randolf <br1@einfach.org> ath5k: run NF calibration only every 60 seconds

Since NF calibration interferes with TX and RX and also has been the cause of
other problems (when it's run concurrently with ath5k_reset) we want to run it
less often - every 60 seconds for now.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9e04a7eb1fdf37bc8bc0d0f59e5fb737926f0152 19-May-2010 Bruno Randolf <br1@einfach.org> ath5k: move noise floor calibration into tasklet

Seperate noise floor calibration from other PHY calibration and move it to the
tasklet. This is the first step to more separation of different calibrations.

Also move out ath5k_hw_request_rfgain_probe(ah) so we have one clean function
for I/Q calibration on 5111x parts.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2111ac0d888767999c7dd6d1309dcc1fb8012022 02-Apr-2010 Bruno Randolf <br1@einfach.org> ath5k: Adaptive Noise Immunity (ANI) Implementation

This is an Adaptive Noise Imunity (ANI) implementation for ath5k. I have looked
at both ath9k and HAL sources (they are nearly the same), and even though i
have implemented some things differently, the basic algorithm is practically
the same, for now. I hope that this can serve as a clean start to improve the
algorithm later.

This also adds a possibility to manually control ANI settings, right now only
thru a debugfs file:
* set lowest sensitivity (=highest noise immunity):
echo sens-low > /sys/kernel/debug/ath5k/phy0/ani
* set highest sensitivity (=lowest noise immunity):
echo sens-high > /sys/kernel/debug/ath5k/phy0/ani
* automatically control immunity (default):
echo ani-on > /sys/kernel/debug/ath5k/phy0/ani
* to see the parameters in use and watch them change:
cat /sys/kernel/debug/ath5k/phy0/ani

Manually setting sensitivity will turn the automatic control off. You can also
control each of the five immunity parameters (noise immunity, spur immunity,
firstep, ofdm weak signal detection, cck weak signal detection) manually thru
the debugfs file.

This is tested on AR5414 and nearly doubles the thruput in a noisy 2GHz band.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a8c944f8a00dcc4ac6900efcddab1a0cf300c791 25-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: add capability flag for phyerror counters

Chipsets since revision AR5213A (0x59) have hardware counters for PHY errors
which we can read directly from the registers. Older hardware has to use the RX
descriptor status to get a count of PHY errors. This will be used in several
places in the ANI implementation, so a flag is useful.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
495391d715a310a7cbf622850e372d40ac86ef6e 25-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: simplify MIB counters

Let's keep MIB counter statistics in our own statistics structure and only
convert it to ieee80211_low_level_stats when needed by mac80211. Also we don't
need to read profile count registers in the MIB interrupt (they don't trigger
MIB interrupts).

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b4ea449df90684035985a77763fd1d2ff0eb9dad 25-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: keep beacon RSSI average

Keep an exponentially weighted moving average of the beacon RSSI in our BSS.
It will be used by the ANI implementation.

The averaging algorithm is copied from rt2x00, Thanks :)

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6a8a3f6b2ac02fb8542f2b36b0ecd9c48f7d9a7e 25-Mar-2010 Bruno Randolf <br1@thinktube.com> ath5k: move ath5k_hw_calibration_poll to base.c

It's not a phy related funtion; It has more to do with the interrupt handler
and tasklet scheduling, so it belongs to base.c.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a9167f96428b832bf94c89908e000e16c4eb7d5b 25-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: optimize ath5k_hw_calibration_poll

Optimize ath5k_hw_calibration_poll() since it is called on every singe
interrupt.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e65e1d7713da89d98f01c3f4267b2c9ecb03c16f 25-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: remove the use of SWI interrupt

We don't need to generate a software interrupt (SWI) just to schedule a tasklet
- we can just schedule the tasklet directly.

Rename constants, names, etc to reflect the fact that we don't use SWI any more.

Also move the flag handling into the tasklet and prepare it to behave correctly
when there are multiple flags present.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1063b176c072b936c43d0e6270168b19881ecb72 25-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: remove static calibration interval variable

Remove static variable ath5k_calinterval which was used as a constant. Use a
#define instead. Also we don't need ah_cal_intval.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
200763bb7503102aa364658e2b32cb2463a08d91 10-Mar-2010 John W. Linville <linville@tuxdriver.com> ath5k: remove unused beacon timer code

Signed-off-by: John W. Linville <linville@tuxdriver.com>
e9f08381cb117d66ad14474228ce02a27d6f62ae 01-Mar-2010 Andrew Blaich <ablaich@gmail.com> ath5k: fixing retries in ath5k_hw_setup_4word_tx_desc

The rate control algorithm, default is Minstrel for ath5k, determines
the number of retries to use for each rate. However, there exists in
ath5k_hw_setup_4word_tx_desc (which is called for AR5212 like devices)
a set number of retries defined by AR5K_TUNE_HWTXTRIES. The set
number of tries is added to the tx_tries0 variable setup by the rate
control algorithm. This changes the number of retries the rate
control algorithm considers necessary. By removing the
AR5K_TUNE_HWTXTRIES from the retry calculation the rate control
algorithm is given control over the number of retries.

Signed-off-by: Andrew Blaich <ablaich@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
919154540aa26e8c333c420b5b930e94ef7a6839 09-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: remove ah_gpio_npins

it's never used and we have a newer implementation in gpio.c.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a71bcebcb776e84dd765d2c7da51ed45a714e3ea 09-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: remove ah_mac_revision

it's not used, and we have ah_mac_srev.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ff5d96ce622271df430c715ebe3e0b7400059dc1 09-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: remove ah_magic

it's never used. probably a leftover from the old OpenHAL days...

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ccfe5552aeb18c87a4d0ecb8cb7512280435bfdd 09-Mar-2010 Bruno Randolf <br1@einfach.org> ath5k: remove double opmode definition

opmode (operating mode) was defined in struct ath5k_hw and struct ath5k_softc.
remove it from ath5k_hw and use only from ath5k_softc (sc->opmode).

(btw: what's the meaning of opmode when we have multiple interfaces?)

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8127fbdc417b5916b82e91400a4be1d9555feee7 27-Feb-2010 Benoit Papillault <benoit.papillault@free.fr> ath5k: Fix TX/RX padding for all frames

Currently, the padding position is based on
ieee80211_get_hdrlen_from_skb(). This is not correct since the HW does
padding on RX (and expect the same padding to be present on TX) at the
following position :

- management : 24 + 6 if 4-addr format
- control : 24 + 6 if 4-addr format
- data : 24 + 6 if 4-addr format + 2 if QoS
- invalid : 24 + 6 if 4-addr format

whereas ieee80211_get_hdrlen_from_skb() is :

- management : 24
- control : 16 except for ACK/CTS where it is 10
- data : 24 + 6 if 4-addr format + 2 if QoS + 2 if QoS & order
- invalid : 24

So, correct frames are not affected : management frames do not use
4-addr format, control frames have no body and invalid frames are ...
not valid by definition. However, in order to use monitor interface for
debugging purpose, one must be able to send/receive any frames, be it
correct or not. Such frames are affected by incorrect padding.

Moreover, since padding is added on TX, we need to remove it before
calling ieee80211_tx_status. This affect TX packets received by monitor
interfaces.

It has been tested between an ath5k based card (AR5212) and an ar9170usb
based card (netgear WNDA3100) using a frame generator and a monitor
interface for each card.

v2: Added ath5k_add_padding / ath5k_remove_padding

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ec182d976345b5eb671fe879ad73b90fe29a34e9 19-Feb-2010 Pavel Roskin <proski@gnu.org> ath5k: move ath5k_hw_register_timeout() into reset.c

ath5k_hw_register_timeout() was duplicated between phy.c and reset.c.
Since it is too big and too much used to be an inline function, move it
away from the ath5k.h header into reset.c. Remove _ATH5K_RESET and
_ATH5K_PHY defines.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a25d1e4cd7799570ecea6b5dcc4dbf5a6d5336bf 19-Feb-2010 Pavel Roskin <proski@gnu.org> ath5k: remove useless "extern" from function declarations

Adjust formatting of the affected lines to satisfy checkpatch.pl.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
626ede6b1aafb3a8cadfdd04b512fd1d3dc2113e 19-Feb-2010 Pavel Roskin <proski@gnu.org> ath5k: remove stale function declarations, make some functions static

Remove all unnecessary function declarations from ath5k.h. Comment out
unused functions. Remove ath5k_hw_get_tsf32(), which is too trivial to
be commented out. Make functions static if suggested by sparse. Make
ath5k_pm_ops static.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2ac2927a953a01c83df255118922cce1523d1a18 09-Feb-2010 Bob Copeland <me@bobcopeland.com> ath5k: use correct packet type when transmitting

The hardware needs to know what type of frames are being
sent in order to fill in various fields, for example the
timestamp in probe responses (before this patch, it was
always 0). Set it correctly when initializing the TX
descriptor.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a951ae2176b982574ffa197455db6c89359fd5eb 21-Jan-2010 Bob Copeland <me@bobcopeland.com> ath5k: fix setup for CAB queue

The beacon sent gating doesn't seem to work with any combination
of flags. Thus, buffered frames tend to stay buffered forever,
using up tx descriptors.

Instead, use the DBA gating and hold transmission of the buffered
frames until 80% of the beacon interval has elapsed using the ready
time. This fixes the following error in AP mode:

ath5k phy0: no further txbuf available, dropping packet

Add a comment to acknowledge that this isn't the best solution.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6e08d228b6d8e93d7b25b3573c6da7da179c2ae1 21-Dec-2009 Lukáš Turek <8an@praha12.net> ath5k: Implement mac80211 callback set_coverage_class

The callback sets slot time as specified in IEEE 802.11-2007 section
17.3.8.6 (for 20MHz channels only for now) and raises ACK and CTS
timeouts accordingly. The values are persistent, they are restored after
device reset.

Signed-off-by: Lukas Turek <8an@praha12.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3578e6ebb305e6bf7519f6e86741772892f4d51a 21-Dec-2009 Lukáš Turek <8an@praha12.net> ath5k: Reimplement clock rate to usec conversion

The original code was correct in 802.11a mode only, 802.11b/g uses
different clock rates. The new code uses values taken from FreeBSD HAL
and should be correct for all modes including turbo modes.

The former rate calculation was used by slope coefficient calculation
function ath5k_hw_write_ofdm_timings. However, this function requires
the 802.11a values even in 802.11g mode. Thus the use of
ath5k_hw_htoclock was replaced by hardcoded values. Possibly the slope
coefficient calculation is not related to clock rate at all.

Signed-off-by: Lukas Turek <8an@praha12.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e5e2647fd6ceef2cdc479954b84517535eb7febd 14-Oct-2009 Bob Copeland <me@bobcopeland.com> ath5k: use noise calibration from madwifi hal

This updates ath5k to calibrate the noise floor similar to the
way it is done in the madwifi hal and ath9k. Of note:

- we start NF measurement at the same time as AGC calibration,
but do not actually read the value until the periodic (long)
calibration
- we keep a history of the last few values read and write the
median back to the hardware for CCA
- we do not complain if NF calibration isn't complete, instead
we keep the last read value.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
be5d6b75e0fb3f7e23ea5325109ef4195f2b282a 07-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath5k: simplify passed params to ath5k_hw_set_associd()

We have access to common->curbssid and common->curaid so just
use those. Note that common->curaid is always 0 so this keeps
our current behaviour of always using 0 for now. Once we fix
storing the association ID passed by mac80211 this will
require no changes here.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13b81559200b8e54473e5b140323cbb5f2bb21c0 11-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros: define shared bssidmask setting

Also make ath5k and ath9k use it, and share register definitions.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e5aa847489e543e33a7c72898e72183871ce2916 11-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath5k: define ath_common ops

Only common ath read/write ops go through the common ops.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9adca126dbf4bf099bc7051deb6b566725a046dc 11-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath5k: allocate ath5k_hw prior to initializing hw

We can propagate better errors upon failed hw initialization,
and set up the ath_common structure for attach purposes. This
will become important once we start using the ath_common
for read/write ops.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
db7197184802578314d974e4b2bc961bdcec8f8c 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath5k: move ath_common to ath5k_hw

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
954fecea5d1df4d1dc7bf9a822a2fad308e8588e 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath5k: use common curbssid, bssidmask and macaddr

The ah_sta_id was really being used as the macaddr.
ath5k still does not use the association ID now passed
up by mac80211, that can be fixed later.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
bcd8f54a84ce99ade91c250a9bc850a9fd3389c1 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros: use get_unaligned_le*() for bssid mask setting

Historically some macro helpers have been users for this,
AR5K_LOW_ID() and AR5K_HIGH_ID(), use upstream unaligned
helpers instead. This applid to ath5k and ar9170. ath9k
already uses this.

Worth noting is ath5k uses an ah_sta_id but that is already
the MAC address combined with the associaiton ID, ah_sta_id
is really ETH_ALEN in size.

Cc: Bob Copeland <me@bobcopeland.com>
Cc: Nick Kossifidis <mick@madwifi-project.org>
Cc: Christian Lamparter <chunkeey@web.de>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
97a81f5c5033cb02ae56dd80ff9c38866c777bd8 27-Aug-2009 Pavel Roskin <proski@gnu.org> ath5k: don't use PCI ID to find the chip revision

AR5K_SREV is available even if the chip has been put to sleep. Relying
on the chip register allows binding non-standard PCI IDs by

echo VENDOR_ID PRODUCT_ID >/sys/bus/pci/drivers/ath5k/new_id

without having to specify the driver data as well.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ca5efbe243dde7d269b6bbae7feaa5e4740db36e 27-Aug-2009 Bob Copeland <me@bobcopeland.com> ath5k: clarify srev comparison for CCMP check

As Pavel Roskin noted, the check for mac version as copied from
legacy_hal made no sense. This replaces it with the equivalent
and makes up a suitable #define for the mac version legacy_hal
checked.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1c81874078dc96b8158ce7b0dab54afe43c8d03e 25-Aug-2009 Bob Copeland <me@bobcopeland.com> ath5k: add hardware CCMP encyption support

Recent ath5k hardware is capable of doing CCMP acceleration.
Enable it for the cards that support it.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
608b88cb34b0e70a538ee1fc334cc833ef691836 18-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>
6e220662bf9a2ba284e88a8c8867340c9f6da27e 10-Aug-2009 Nick Kossifidis <mick@madwifi-project.org> ath5k: Use SWI to trigger calibration

* Get rid of calibration timer, instead use a software interrupt
to schedule the calibration tasklet.

a) We don't need a timer for this, there is no need for accuracy
even with round_jiffies i think this is a waste of resources.
Also we don't need to run calibration if we are idle (no
interrupts).

b) When we add ANI support we 'll just extend the poll function
and calibration tasklet and handle all periodic phy calibration
on one place (much cleaner).

c) Having calibration on a tasklet is better since during calibration
we can't transmit or receive (antennas are detached to measure
noise floor), previously calibration could run in parallel with
tx/rx and interfere (packet loss).

v2: kill tasklet on stop_hw, stop/wake queues
v3: use time_is_before_eq_jiffies to compare timestamp with current
time

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
edd7fc7003f31da48d06e215a93ea966a22c2a03 10-Aug-2009 Nick Kossifidis <mick@madwifi-project.org> ath5k: Wakeup fixes

* Don't put chip to full sleep because there are problems during
wakeup. Instead hold MAC/Baseband on warm reset state via a new
function ath5k_hw_on_hold.

* Minor cleanups

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Tested-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
46026e8f487c075f9ec4d671348e351eb5e46d3e 11-Jun-2009 Bob Copeland <me@bobcopeland.com> ath5k: cleanup ath5k_hw struct

ah_gpios array isn't used, and ah_current_channel can be a pointer
instead of an embedded struct. Removing these and some other
write-only variables, and moving some things around for better
packing and cache utilization saves 116 bytes.

text data bss dec hex filename
121762 472 64 122298 1ddba ath5k_before.ko
121646 472 64 122182 1dd46 ath5k.ko

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a6ae0716e5c3b5f9dbe5ed8f473a6c7b89692365 10-Jun-2009 Bob Copeland <me@bobcopeland.com> ath5k: minor rfkill cleanup

Always enable rfkill since the ifdefs in the code is not really worth
the Kconfig option. Also fix a few code style things, and remove the
usage of the ah_gpio[] array so we can remove it later.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e6a3b61681dcb963e6465ffbc4330b44824f35e3 09-Jun-2009 Tobias Doerffel <tobias.doerffel@gmail.com> ath5k: added cfg80211 based rfkill support

This patch introduces initial rfkill support for the ath5k driver
based on rfkill support in the cfg80211 framework.
All rfkill related code is separated into newly created rfkill.c.

Changes to existing code are minimal:

* added a new data structure ath5k_rfkill to the ath5k_softc structure
* inserted calls to HW rfkill init/deinit routines
* ath5k_intr() has been extended to handle AR5K_INT_GPIO interrupts

Signed-off-by: John W. Linville <linville@tuxdriver.com>
57e6c56dbb52d680f61dd629759fe2974840ed93 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org> ath5k: Add Spur filter support on newer chips

* Add spur filter support for RF5413 and later chips

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
2bed03ebf62f9d013a455209bf30d7e086120443 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org> ath5k: Implement antenna control

* Add code to support the various antenna scenarios supported by hw

* For now hardcode the default scenario (single or dual omnis with
tx/rx diversity working and tx antenna handled by session -hw keeps
track on which antenna it got ack from each ap/station and maps each
ap/station to one of the antennas-).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
a082381044ce026e83dbd17f8837722b028fc07d 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org> ath5k: Allow user/driver to set txpower

* Now that we have regulatory control enable the driver to set
txpower on hw

* Also use txpower table offset so that we can match
power range set by user/driver with indices on power table.

Tested 2 different cards (a CM9 and an RF5112-based ubnt) and got
the same output using a remote machine to measure per-packet rssi
(conected the cards using attenuators). I also switched between
various tx power levels and i saw an equal power change on the remote
machine (so txpower changes as expected) and verified that we have
the same output on each rate.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
203c4805e91786f9a010bc7945a0fde70c9da28e 31-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>