History log of /linux-master/drivers/net/wireless/ath/ath5k/reset.c
Revision Date Author Comments
# 273411d5 27-Jul-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

ath5k: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1].

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200727194930.GA1491@embeddedor


# 57fbcce3 12-Apr-2016 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove enum ieee80211_band

This enum is already perfectly aliased to enum nl80211_band, and
the only reason for it is that we get IEEE80211_NUM_BANDS out of
it. There's no really good reason to not declare the number of
bands in nl80211 though, so do that and remove the cfg80211 one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 0eb69ef3 28-Feb-2016 Bob Copeland <me@bobcopeland.com>

ath5k: fix incorrect indentation

smatch said:

drivers/net/wireless/ath/ath5k/phy.c:1449 ath5k_hw_channel() warn: inconsistent indenting
drivers/net/wireless/ath/ath5k/reset.c:637 ath5k_hw_on_hold() warn: inconsistent indenting
drivers/net/wireless/ath/ath5k/reset.c:702 ath5k_hw_nic_wakeup() warn: inconsistent indenting

All of these lines were indented a tabstop too far.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 4a2f248f 03-Mar-2015 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath5k: channel change fix

ath5k updates the channel pointer and after that it stops the Rx logic
and apply channel to HW. In case of channel switch, such sequence
creates a small window when a frame, which is received on the old
channel is considered as a frame received on the new one.

The most notable consequence of this situation occurs during the switch
from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
with CCK rate, e.g. beacon received at the 1mbps, causes the following
warning:

WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
invalid hw_rix: 1a
[..]
Call Trace:
[<802656a8>] show_stack+0x48/0x70
[<802dd92c>] warn_slowpath_common+0x88/0xbc
[<802dd98c>] warn_slowpath_fmt+0x2c/0x38
[<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
[<8028ac64>] tasklet_action+0x8c/0xf0
[<80075804>] __do_softirq+0x180/0x32c
[<80196ce8>] irq_exit+0x54/0x70
[<80041848>] ret_from_irq+0x0/0x4
[<80182fdc>] ioread32+0x4/0xc
[<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
[<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
[<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
[<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
[<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
[<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
[<8022c3f4>] process_one_work+0x28c/0x400
[<802df8f8>] worker_thread+0x258/0x3c0
[<801b5710>] kthread+0xe0/0xec
[<800418a8>] ret_from_kernel_thread+0x14/0x1c

The easiest way to reproduce this warning is to run scan with dualband
NIC in noisy environments, when the channel 11 runs multiple APs. In my
tests if the APs num >= 12, the warning appears in the first few
seconds of scanning.

In order to fix this, the Rx disable code moved to a higher level and
placed before the channel pointer update. This is also makes the code a
bit more symmetrical, since we disable and enable the Rx in the same
function.

In fact, at the pointer update time new frames should not appear,
because interrupt generation at this point should already be disabled.
The next patch should address this issue.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 8bfae4f9 03-Feb-2015 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath5k: fix spontaneus AR5312 freezes

Sometimes while CPU have some load and ath5k doing the wireless
interface reset the whole WiSoC completely freezes. Set of tests shows
that using atomic delay function while we wait interface reset helps to
avoid such freezes.

The easiest way to reproduce this issue: create a station interface,
start continous scan with wpa_supplicant and load CPU by something. Or
just create multiple station interfaces and put them all in continous
scan.

This patch partially reverts the commit 1846ac3dbec0 ("ath5k: Use
usleep_range where possible"), which replaces initial udelay()
by usleep_range().

I do not know actual source of this issue, but all looks like that HW
freeze is caused by transaction on internal SoC bus, while wireless
block is in reset state.

Also I should note that I do not know how many chips are affected, but I
did not see this issue with chips, other than AR5312.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Fixes: 1846ac3dbec0 ("ath5k: Use usleep_range where possible")
Reported-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 18874173 25-Feb-2013 Jiri Slaby <jirislaby@kernel.org>

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>


# c5e534e5 07-Feb-2013 Jiri Slaby <jirislaby@kernel.org>

NET: ath5k, check ath5k_eeprom_mode_from_channel retval

It can, if invalid argument given, return a negative value. In that
case we would access arrays out-of-bounds and such. Check the value
and yell loudly if that happened as it would be a bug in the
implementation. (Instead of silently corrupting memory.)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 957708f1 14-Nov-2012 Dan Carpenter <dan.carpenter@oracle.com>

ath5k: precedence error in ath5k_hw_nic_wakeup()

'|' has higher precedence than ?:. Since AR5K_PHY_TURBO_MODE is 0x1 and
"AR5K_PHY_TURBO_MODE | (ah->ah_radio == AR5K_RF2425)" is true then we
always set turbo to zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 516304b0 18-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>


# cede8b64 13-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>


# 3db1cd5c 19-Dec-2011 Rusty Russell <rusty@rustcorp.com.au>

net: fix assignment of 0/1 to bool variables.

DaveM said:
Please, this kind of stuff rots forever and not using bool properly
drives me crazy.

Joe Perches <joe@perches.com> gave me the spatch script:

@@
bool b;
@@
-b = 0
+b = false
@@
bool b;
@@
-b = 1
+b = true

I merely installed coccinelle, read the documentation and took credit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c47faa36 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>


# 1846ac3d 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Use usleep_range where possible

Use usleep_range where possible to reduce busy waits

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 931be260 26-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>


# 32c25464 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>


# 8d44a823 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>


# e0d687bd 14-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>


# 6340211c 11-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>


# f0064388 11-Jul-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: fix reference clock usec duration setting restore

enabling the sleep clock alters the AR5K_USEC_32 field, but disabling
it didn't restore it.

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


# 6a2a0e73 08-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>


# e4bbf2f5 07-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>


# 2753f87a 07-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: don't use volatile, it's not needed

Signed-off-by: Pavel Roskin <proski@gnu.org>

The reg variable is only used by __raw_writel() and __raw_readl(), which
should guarantee memory access in the right order.
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0a5d3813 07-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>


# d816ab26 15-Jun-2011 Pavel Roskin <proski@gnu.org>

ath5k: annotate reg in ath5k_hw_nic_reset() as __iomem

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


# a99168ee 01-Jun-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Disable fast channel switching by default

Disable fast channel change by default on AR2413/AR5413 due to
some bug reports (it still works for me but it's better to be safe).
Add a module parameter "fastchanswitch" in case anyone wants to enable
it and play with it.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e245292e 29-Apr-2011 John W. Linville <linville@tuxdriver.com>

ath5k: fix uninitialized var warning for txf2txs

CC [M] drivers/net/wireless/ath/ath5k/reset.o
drivers/net/wireless/ath/ath5k/reset.c: In function ‘ath5k_hw_init_core_clock’:
drivers/net/wireless/ath/ath5k/reset.c:100:51: warning: ‘txf2txs’ may be used uninitialized in this function

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


# 0207c0c5 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>


# 26a51ad7 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>


# e98b06b0 20-Dec-2010 Hauke Mehrtens <hauke@hauke-m.de>

ath5k: Use pci_is_pcie()

Use function pci_is_pcie() instead of accessing struct member directly.

CC: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4cebb34c 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Fix reset and interrupts for AHB type of devices.

On WiSoc we cannot access mac register before it is resetted.
It will crash hardware otherwise.

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>


# 8efa5d7d 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Check if pci pdev struct is initialized in common functions.

To be able to support other busses than PCI check if pci device
structure 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>


# acb091d6 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>


# c2b0ebef 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: No need to save/restore staid flags on reset

* Since we set antenna flags on phy init and ack bitrate
mode on pcu init, there is no need to save/restore sta_id
flags on ath5k_hw_reset. Also we don't need to re-set our
mac address because it's not affected by resets.

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

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


# 8aec7af9 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>


# f08fbf6c 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Update PLL programming for turbo/half/quarter

* Set correct PLL settings for each bwmode

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

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


# b405086b 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>


# 325089ab 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Small cleanup on tweak_initvals

* Now that we properly set rx/tx latencies for AR5311 remove
that old buggy part of code left inside ath5k_hw_tweak_initval_settings
that was never executed (you can't have an RF5112 radio on a mac older
than AR5212). Also use a magic value for 5311 PHY_SCAL value.

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

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


# c2975602 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>


# e088f23b 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Stop PCU on reset

* Stop PCU receive logic (DRU) durring reset
We need to be sure pcu is not active when trying to stop rx dma
right now this is done on ath5k_reset (base.c) but later we are
going to clean it up.

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

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


# d41174fa 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>


# 9320b5c4 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>


# b1ae1edf 30-Sep-2010 Ben Greear <greearb@candelatech.com>

ath5k: Allow ath5k to support virtual STA and AP interfaces.

Support up to 4 virtual APs and as many virtual STA interfaces
as desired.

This patch is ported forward from a patch that Patrick McHardy
did for me against 2.6.31.

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


# 8801df86 21-Aug-2010 Bob Copeland <me@bobcopeland.com>

ath5k: trivial spelling fixes

Fix some comments:
s/transmition/transmission/
s/puting/putting/

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a180a130 15-Aug-2010 Bob Copeland <me@bobcopeland.com>

ath5k: clean up some comments

This fixes a few misspellings, word repetitions, and some grammar
nits in ath5k comments. No code changes.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 418de6d9 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>


# 20fbed21 06-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: no need to save/restore the default antenna

Since ath5k_hw_set_antenna_mode() always writes the default antenna register
and is called at the end of reset, there is no need to separately save and
restore the default antenna.

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


# 0ca74027 06-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>


# 40ca22ea 18-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>


# 30bd3a30 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: clarify logic when to enable spur mitigation filter

The old code logically did not make sense and seems to have been confused by
the fact that we could have newer EEPROMs on older hardware. In any case the
spur mitigation filter was set if the srev was >= AR5K_SREV_AR5424.

Spur info is available only from EEPROM versions bigger than 5.3 but but the
EEPOM routines will use static values for older versions, so that should be
o.k.

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


# 230fc4f3 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: remove ATH_TRACE macro

Now that we have ftrace, it is not needed any more.

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


# a4b77097 14-May-2010 Joe Perches <joe@perches.com>

drivers/net: Remove unnecessary returns from void function()s

This patch removes from drivers/net/ all the unnecessary
return; statements that precede the last closing brace of
void functions.

It does not remove the returns that are immediately
preceded by a label as gcc doesn't like that.

It also does not remove null void functions with return.

Done via:
$ grep -rP --include=*.[ch] -l "return;\n}" net/ | \
xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }'

with some cleanups by hand.

Compile tested x86 allmodconfig only.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ccfe5552 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>


# 5f13bfac 09-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: read eeprom IQ calibration values correctly for G mode

we read the IQ correction values (i_cal and q_cal) for G mode from a wrong
location (the same shifts as for A mode is applied which is incorrect). use
correct locations, matching the docs and HAL sources.

also we should write IQ correction only when we have that information in the
EEPROM, starting from version 4. also write it in the same way as we do in the
periodic recalibration (enable last), just to be sure.

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


# a3b980fd 09-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: fix TSF reset

to reset the TSF, AR5K_BEACON_RESET_TSF has to be 1, not 0. also we have a
function for that so use it.

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


# ec182d97 18-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>


# 626ede6b 18-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>


# 5d6ce628 20-Jan-2010 Bob Copeland <me@bobcopeland.com>

ath5k: dont use external sleep clock in AP mode

When using the external sleep clock in AP mode, the
TSF increments too quickly, causing beacon interval
to be much lower than it is supposed to be, resulting
in lots of beacon-not-ready interrupts.

This fixes http://bugzilla.kernel.org/show_bug.cgi?id=14802.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6e08d228 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>


# 3578e6eb 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>


# e5e2647f 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>


# 8ce54c5a 06-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: enable Power-Save Polls by setting the association ID

mac80211 has long provided us the association ID. This isn't useful except
for Power-Save polling which now gets enabled. We can now poll for our
pending frames on the AP during power save.

You can review the details of Power-Save on the wireless wiki:

http://wireless.kernel.org/en/developers/Documentation/ieee80211/power-savings

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# be5d6b75 06-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>


# 91b9eb82 06-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: fix regression introduced upon the removal of AR5K_HIGH_ID()

The trick was to add four bytes whenever this was used. There
are two places where this was missed.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 954fecea 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>


# bcd8f54a 09-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>


# edd7fc70 09-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>


# 46026e8f 10-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>


# e6a3b616 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>


# 57e6c56d 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>


# 2bed03eb 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>


# 1889ba0a 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org>

ath5k: Put remaining EEPROM data on ee struct

* Put remaining EEPROM information on ee struct and remove is_hb63
function.

Now we also have rfkill stuff available.

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>


# a0823810 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>


# 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>