History log of /linux-master/drivers/net/wireless/ath/ath9k/pci.c
Revision Date Author Comments
# d6e71dd1 22-Nov-2023 Wu Yunchuan <yunchuan@nfschina.com>

wifi: ath9k: Remove unnecessary (void*) conversions

No need cast (void *) to (struct owl_ctx *), (struct ath_hw *),
(struct cmd_buf *) or other types.

Signed-off-by: Wu Yunchuan <yunchuan@nfschina.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230919045226.524544-1-yunchuan@nfschina.com


# 061115fb 22-Jul-2023 Dongliang Mu <dzm91@hust.edu.cn>

wifi: ath9k: fix printk specifier

Smatch reports:

ath_pci_probe() warn: argument 4 to %lx specifier is cast from pointer
ath_ahb_probe() warn: argument 4 to %lx specifier is cast from pointer

Fix it by modifying %lx to %p in the printk format string.

Note that with this change, the pointer address will be printed as a
hashed value by default. This is appropriate because the kernel
should not leak kernel pointers to user space in an informational
message. If someone wants to see the real address for debugging
purposes, this can be achieved with the no_hash_pointers kernel option.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230723040403.296723-1-dzm91@hust.edu.cn


# b3a663f0 06-Dec-2022 Wenli Looi <wlooi@ucalgary.ca>

wifi: ath9k: remove most hidden macro dependencies on ah

Adds an explicit _ah parameter to most macros that previously had a
hidden dependency on ah. This makes the code more compliant with the
style guide.

This change does not appear to affect the final binary.

Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/c8369317-cf84-f0e3-fe8-9b6e22e43a6a@ucalgary.ca


# 923a1346 26-Jun-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

ath: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below.

While at it, some 'dma_set_mask()/dma_set_coherent_mask()' have been
updated to a much less verbose 'dma_set_mask_and_coherent()'.

@@ @@
- PCI_DMA_BIDIRECTIONAL
+ DMA_BIDIRECTIONAL

@@ @@
- PCI_DMA_TODEVICE
+ DMA_TO_DEVICE

@@ @@
- PCI_DMA_FROMDEVICE
+ DMA_FROM_DEVICE

@@ @@
- PCI_DMA_NONE
+ DMA_NONE

@@
expression e1, e2, e3;
@@
- pci_alloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
- pci_zalloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
- pci_free_consistent(e1, e2, e3, e4)
+ dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_map_single(e1, e2, e3, e4)
+ dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_unmap_single(e1, e2, e3, e4)
+ dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
- pci_map_page(e1, e2, e3, e4, e5)
+ dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
- pci_unmap_page(e1, e2, e3, e4)
+ dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_map_sg(e1, e2, e3, e4)
+ dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_unmap_sg(e1, e2, e3, e4)
+ dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+ dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_device(e1, e2, e3, e4)
+ dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+ dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+ dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
- pci_dma_mapping_error(e1, e2)
+ dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
- pci_set_dma_mask(e1, e2)
+ dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
- pci_set_consistent_dma_mask(e1, e2)
+ dma_set_coherent_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/9150bd6cde9ad592aff8ee3ad94dffa90b004e89.1624720959.git.christophe.jaillet@wanadoo.fr


# 9a8ab2bf 13-Jul-2020 Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

ath9k: Check the return value of pcie_capability_read_*()

On failure pcie_capability_read_dword() sets it's last parameter, val
to 0. However, with Patch 14/14, it is possible that val is set to ~0 on
failure. This would introduce a bug because (x & x) == (~0 & x).

This bug can be avoided without changing the function's behaviour if the
return value of pcie_capability_read_dword is checked to confirm success.

Check the return value of pcie_capability_read_dword() to ensure success.

Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200713175529.29715-2-refactormyself@gmail.com


# 5d7e4b49 24-Jul-2019 Chuhong Yuan <hslester96@gmail.com>

ath: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# a78613c0 25-Jul-2018 Bjorn Helgaas <bhelgaas@google.com>

ath9k: Remove unnecessary include of <linux/pci-aspm.h>

The ath9k driver doesn't need anything provided by pci-aspm.h, so remove
the unnecessary include of it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Sinan Kaya <okaya@kernel.org>
Acked-by: Kalle Valo <kvalo@codeaurora.org>


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

ath9k: add MSI support

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

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


# 129e12a9 28-Jul-2017 Rosen Penev <rosenp@gmail.com>

ath9k: Add Dell Wireless 1802 with wowlan capability

Add the Dell Wireless 1802 card as an AR9462 in the ath9k pci list.
Note that the wowlan feature is supported and has been tested
successfully.

Signed-off by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 050fd820 06-Apr-2017 Damien Thébault <damien@dtbo.net>

ath9k: Add Dell Wireless 1601 with wowlan capability

Add the Dell Wireless 1601 card as an AR9462 in the ath9k pci list.
Note that the wowlan feature is supported and has been tested
successfully.

Signed-off-by: Damien Thébault <damien@dtbo.net>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 79e57dd1 08-Nov-2016 Vittorio Gambaletta (VittGam) <linux-wireless@vittgam.net>

ath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards.

The active_high LED of my Wistron DNMA-92 is still being recognized as
active_low on 4.7.6 mainline. When I was preparing my former commit
0f9edcdd88a9 ("ath9k: Fix LED polarity for some Mini PCI AR9220 MB92
cards.") to fix that I must have somehow messed up with testing, because
I tested the final version of that patch before sending it, and it was
apparently working; but now it is not working on 4.7.6 mainline.

I initially added the PCI_DEVICE_SUB section for 0x0029/0x2096 above the
PCI_VDEVICE section for 0x0029; but then I moved the former below the
latter after seeing how 0x002A sections were sorted in the file.

This turned out to be wrong: if a generic PCI_VDEVICE entry (that has
both subvendor and subdevice IDs set to PCI_ANY_ID) is put before a more
specific one (PCI_DEVICE_SUB), then the generic PCI_VDEVICE entry will
match first and will be used.

With this patch, 0x0029/0x2096 has finally got active_high LED on 4.7.6.

While I'm at it, let's fix 0x002A too by also moving its generic definition
below its specific ones.

Fixes: 0f9edcdd88a9 ("ath9k: Fix LED polarity for some Mini PCI AR9220 MB92 cards.")
Cc: <stable@vger.kernel.org> #4.7+
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
[kvalo@qca.qualcomm.com: improve the commit log based on email discussions]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 56398519 09-Jul-2016 Martin Blumenstingl <martin.blumenstingl@googlemail.com>

ath9k: simplify the code-paths when not using the built-in EEPROM

There were two paths in the code for "external" eeprom sources. The code
in eeprom.c only handled the cases where the eeprom data was loaded via
request_firmware. ahb.c and pci.c on the other hand had some duplicate
code which was only used when the eeprom data was passed via
ath9k_platform_data.
With this change all eeprom data handling is now unified in eeprom.c.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0f27ac40 29-Jun-2016 Eduardo Abinader <eduardo.abinader@riverbed.com>

ath9k: return false when reading wrong eeprom offset

Just setting the proper return for reading beyond the eeprom data.

Signed-off-by: Eduardo Abinader <eduardo.abinader@riverbed.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0f9edcdd 10-Apr-2016 Vittorio Gambaletta (VittGam) <linux-wireless@vittgam.net>

ath9k: Fix LED polarity for some Mini PCI AR9220 MB92 cards.

The Wistron DNMA-92 and Compex WLM200NX have inverted LED polarity
(active high instead of active low).

The same PCI Subsystem ID is used by both cards, which are based on
the same Atheros MB92 design.

Cc: <linux-wireless@vger.kernel.org>
Cc: <ath9k-devel@qca.qualcomm.com>
Cc: <ath9k-devel@lists.ath9k.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


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

ath9k: Check WOW triggers properly

This patch makes sure that valid WOW triggers
are present before trying to suspend the device.
Also, introduce and use ATH_OP_WOW_ENABLED to
bypass PCI suspend and clear it in resume().

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


# edea2acb 04-Jan-2015 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Update PCI IDs for AR9565

This patch adds several new PCI IDs for AR9565.

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


# f1c488a7 06-Dec-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"

This reverts commit d32394fae95741d733b174ec1446f27765f80233.

It has been reported to cause problems, Jeremiah writes:
On an Acer C720 laptop if a suspend is performed the screen
freezes, the machine locks up, and according to the indicator
lights it does not enter suspend. A hard reset is required to
get it running again.

Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
Cc: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d32394fa 09-Nov-2014 Arend van Spriel <arend@broadcom.com>

ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries

Use the helper to get rid of the file operations per debugfs file. The
struct ath9k_softc pointer is set as device driver data to be obtained
in the seq_file read operation.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

ath9k: Fix LED configuration

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

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


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

ath9k_hw: make support for PC-OEM cards optional

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

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


# 9baa3c34 08-Aug-2014 Benoit Taine <benoit.taine@lip6.fr>

PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use

We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to
meet kernel coding style guidelines. This issue was reported by checkpatch.

A simplified version of the semantic patch that makes this change is as
follows (http://coccinelle.lip6.fr/):

// <smpl>

@@
identifier i;
declarer name DEFINE_PCI_DEVICE_TABLE;
initializer z;
@@

- DEFINE_PCI_DEVICE_TABLE(i)
+ const struct pci_device_id i[]
= z;

// </smpl>

[bhelgaas: add semantic patch]
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>


# 78b21949 11-Jun-2014 Felix Fietkau <nbd@openwrt.org>

ath9k: Implement hw_scan support

Implement hw_scan support for enabling multi-channel cuncurrency.

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


# 1c48f988 22-May-2014 Rajkumar Manoharan <rmanohar@qti.qualcomm.com>

ath9k: fix sleep timer during suspend

On idle state, sleep timer is scheduled to put the chip into fullsleep.
But during suspend, this timer is scheduled after the chip is moved to
fullsleep forcibily. This is causing below unnecessary error messages
in kernel log during suspend.

ath: phy2: timeout (100000 us) on reg 0x806c: 0xdeadbeef & 0x01f00000
!= 0x00000000
ath: phy2: RX failed to go idle in 10 ms RXSM=0xdeadbeef
ath: phy2: DMA failed to stop in 10 ms AR_CR=0xdeadbeef AR_DIAG_SW=0xdeadbeef
DMADBG_7=0xdeadbeef

Reported-by: Arkh4mKn1ght <arkh4mkn1ght@gmail.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4f157547 08-May-2014 Helmut Schaa <helmut.schaa@googlemail.com>

amend "ath9k: Allow platform override without EEPROM override"

Originally Helmut posted a v2 of the "ath9k: Allow platform override
without EEPROM override", but I had prematurely commited the original
as commit 552a515707a. This commit restores the tree to what Helmut
intended with his v2 submission. -- JWL

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8c7ae357 23-Apr-2014 Rajkumar Manoharan <rmanohar@qti.qualcomm.com>

ath9k: fix race in setting ATH_OP_INVALID

The commit "ath9k: move sc_flags to ath_common" moved setting
ATH_OP_INVALID flag below ieee80211_register_hw. This is causing
the flag never being cleared randomly as the drv_start is called
prior to setting flag. Fix this by setting the flag prior to
register_hw.

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


# eefa01dd 27-Feb-2014 Oleksij Rempel <linux@rempel-privat.de>

ath9k: move sc_flags to ath_common

we will need it for ath9k_htc, may be other drivers too

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9c36254c 08-Jan-2014 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Update WB335 PCI IDs

* Add new AR9565 1.0/1.0.1/1.1 IDs
* Change Dell/Lenovo/Samsung cards to 2-Antenna with diversity.

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


# 4dd35640 23-Oct-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Identify Killer Wireless cards

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


# 96581132 23-Oct-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add WB335 PCI IDs

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


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

ath9k: Use correct PCIE initvals for AR9485

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

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

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


# bf7c756c 04-Sep-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add DELL 1707 to supported card table

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


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

ath9k: Identify WB335 Antenna configuration

There are 2 types of WB335 cards, 1-antenna and 2-antenna.
Identify them based on PCI subsystem IDs, this will be used
for MCI/BTCOEX tweaks.

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


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

ath9k: Identify CUS252 cards

These cards are based on WB335/AR9565.

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


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

ath9k: Enable antenna diversity for WB335

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


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

ath9k: Fix ASPM workaround usage

The PCIE Workaround register (AR_WA/0x4004) is used to handle
various hardware quirks. For AR9002 chips, AR_WA_D3_L1_DISABLE
is used to prevent the HW from automatically entering L1 state
when D3 is enforced.

AR_WA_D3_L1_DISABLE has to be enabled for a few AR9280 based
cards, mark them based on their PCI subdevice/subvendor IDs
and enforce it in ar9002_hw_configpcipowersave().

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


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

ath9k: Fix ASPM for AR9462

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

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


# f4d90704 20-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add one more PCI ID for CUS198

This is a AR9485/WB225 based card.

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


# 2952f6ef 05-Aug-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Add more PCI IDs for WB225 cards

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


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

ath9k: Enable WLAN/BT Ant Diversity for WB225/WB195

A custom solution for Asus is WB195 based and supports
WLAN/BT Rx diversity. Identify this card and set the
capability.

CUS198/CUS230, which are based on WB225 also support
WLAN/BT Rx diversity.

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


# fca3c21d 20-Jun-2013 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Enable WoW only for supported models

Since platform support is required for WoW, identify and
and enable Wow only for supported cards.

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


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

ath9k: Add PCI IDs for CUS217

CUS217 is a card based on AR9462.

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


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

ath9k: Modify IDs to identify CUS230

CUS198 and CUS230 are similar cards, both
are AR9485 + xLNA solutions. But, the subsystem IDs
differ - identify CUS230 explicitly to make things
clearer.

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


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

ath9k: Add custom parameters for CUS198

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

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

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


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

ath9k: use the devres API for allocations/mappings

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


# a875621e 05-Dec-2012 Bjorn Helgaas <bhelgaas@google.com>

ath9k: Use standard #defines for PCIe Capability ASPM fields

Use the standard #defines for PCIe Capability ASPM fields.

Previously we used PCIE_LINK_STATE_L0S and PCIE_LINK_STATE_L1 directly, but
these are defined for the Linux ASPM interfaces, e.g.,
pci_disable_link_state(), and only coincidentally match the actual register
bits. PCIE_LINK_STATE_CLKPM, also part of that interface, does not match
the register bit.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>


# 88427588 29-Nov-2012 Hauke Mehrtens <hauke@hauke-m.de>

ath9k: use SIMPLE_DEV_PM_OPS

ath9k does not provide any runtime pm callbacks, so support for
PM_RUNTIME is not needed and we could go to PM_SLEEP.
This also makes it possible to use SIMPLE_DEV_PM_OPS instead of
manually filling struct dev_pm_ops.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


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

ath9k: Remove unused workaround

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

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


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

ath9k: improve suspend/resume reliability

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

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


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

ath9k: fix ASPM initialization on resume

ath_pci_aspm_init is only called on card init, so PCI registers get reset
after a suspend/resume cycle.

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


# 046b6802 21-Sep-2012 Sujith Manoharan <c_manoha@qualcomm.com>

ath9k: Disable ASPM only for AR9285

Currently, ASPM is disabled for all WLAN+BT combo chipsets
when BTCOEX is enabled. This is incorrect since the workaround
is required only for WB195, which is a AR9285+AR3011 combo
solution. Fix this by checking for the HW version when enabling
the workaround.

Cc: stable@vger.kernel.org
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Tested-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0c8070f9 09-Sep-2012 Sujith Manoharan <c_manoha@qualcomm.com>

ath9k: Add PCI ID for AR9565

Enable AR9565.

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


# 08bd1080 24-Jul-2012 Jiang Liu <jiang.liu@huawei.com>

ath9k: Use PCI Express Capability accessors

Use PCI Express Capability access functions to simplify ath9k driver.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>


# e19f15ac 08-Aug-2012 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: stop btcoex on device suspend

During suspend, the device will be moved to FULLSLEEP state.
As btcoex is never been stopped, the btcoex timer is running
and tries to access hw on fullsleep state. Fix that.

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


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

ath9k: Add PID/VID support for AR1111

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

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


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

ath9k: do not disable hardware while wow is enabled

Hardware needs to be AWAKE and should maintain association
with the AP to process WoW triggers any time

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


# 781b14a3 04-Jun-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath9k: Use atomic operations

The 'sc_flags' variable is being used in a number of places
with no locking whatsoever. This patch converts the usage
of sc_flags to atomic ops.

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


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

ath9k: Handle ASPM properly

ASPM has to be disabled when BTCOEX is in use, do this properly
by calling the bus-specific ASPM init routine after the
BTCOEX scheme has been determined.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.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>


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

ath9k_hw: make bluetooth coexistence support optional at compile time

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

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

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

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


# c0c11741 16-Nov-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: rework power state handling

Turning off the radio when mac80211 tells the driver that it's idle is not
a good idea, as idle interfaces might still occasionally scan or send packets.
The only time the radio can be safely turned off is when drv_stop has been
called. In the mean time, use sc->ps_idle only to indicate network sleep vs
full sleep.
Move the LED GPIO changes out of the PCI suspend/resume path, the start/stop
functions already take care of that.

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


# 9d9779e7 03-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

drivers/net: Add module.h to drivers who were implicitly using it

The device.h header was including module.h, making it present for
most of these drivers. But we want to clean that up. Call out the
include of module.h in the modular network drivers.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


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

ath9k: Rename AR9480 into AR9462

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

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


# c5d2593b 14-Sep-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath9k: Fix PS wrappers and enabling LED

in ath_pci_resume it seems we are not enabling LED properly, in addition
we have a PS wrapper fix for this

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


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

ath9k_hw: Add support for AR946/8x chipsets.

This patch adds support for AR946/8x chipets.

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


# a508a6ea 23-Aug-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>

ath9k: add AR9580 support

This has been tested in STA and AP mode by Florian.

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


# 22c55e6e 24-Aug-2011 John W. Linville <linville@tuxdriver.com>

ath9k: remove replicated null check in ath_pci_aspm_init

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


# 292121dc 13-Aug-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: remove a bogus WARN_ON

On embedded hardware it's normal to not have a PCI device for the PCI
bridge that the wifi card is attached to. pdev->bus->self will be
NULL in that case. In that case, simply return without emitting an
useless kernel stack trace.

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


# f82b4bde 12-Aug-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: Move ath9k_init_crypto to common

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


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

ath9k: do btcoex ASPM disabling at initialization time

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

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

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


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

ath9k: remove ->config_pci_powersave() redundant argument

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

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


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

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

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


# 581c9c4f 22-Jul-2011 Sergei Shtylyov <sshtylyov@ru.mvista.com>

ath9k: use pci_dev->subsystem_device

The driver reads PCI subsystem ID from the PCI configuration register while it's
already stored by the PCI subsystem in the 'subsystem_device' field of 'struct
pci_dev'...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


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

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

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

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

Bug was introduced by:

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

ath9k: Add support for newer AR9285 chipsets.

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

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

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


# c31eb8e9 28-Jun-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

ath9k: Fix suspend/resume when no interface is UP

When no interface has been brought up, the chip's power
state continued as AWAKE. So during resume, the chip never
been powered up.

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


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

ath9k: Drag the driver to the year 2011

The Times They Are a-Changin'.

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


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 9ac58615 24-Jan-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: fold struct ath_wiphy into struct ath_softc

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


# 7545daf4 24-Jan-2011 Felix Fietkau <nbd@openwrt.org>

ath9k: remove support for virtual wiphys

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


# db7ec38d 21-Dec-2010 Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

ath9k: Reset keycache on resume

It looks like some hardware registers are left into undefined state
after suspend/resume. At minimum, this can cause odd issues related to
key cache and hardware trying to encrypt/decrypt frames unexpectedly.
This seems to happen even when there is no keys configured, i.e., hardware
can end up touching TX frames just based of invalid key cache context
even if the driver is not asking a specific entry to be used. In
addition, RX can likely be affected. This patch fixes this issue.

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


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

ath9k: 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>


# afe68d0a 20-Dec-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: fix aphy / wiphy idle mismatch

ath9k supports its own set of virtual wiphys, and it uses
the mac80211 idle notifications to know when a device needs
to be idle or not. We recently changed ath9k to force idle
on driver stop() and on resume but forgot to take into account
ath9k's own virtual wiphy idle states. These are used internally
by ath9k to check if the device's radio should be powered down
on each idle call. Without this change its possible that the
device could have been forced off but the virtual wiphy idle
was left on.

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Amod Bodas <amod.bodas@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d584747b 20-Dec-2010 Rajkumar Manoharan <rmanoharan@atheros.com>

ath9k: Fix warnings on card removal

The recently added warning message on power change failure
is not needed on device removal.

ath: Failed to wakeup in 500us
------------[ cut here ]------------
WARNING: at drivers/net/wireless/ath/ath9k/hw.c:1618
ath9k_hw_setpower+0x61f/0x630 [ath9k_hw]()
Hardware name: 64756D6
Pid: 540, comm: kworker/u:3 Not tainted 2.6.37-rc6-wl #37
Call Trace:
[<ffffffff810501aa>] warn_slowpath_common+0x7a/0xb0
[<ffffffffa056e280>] ? ath9k_iowrite32+0x0/0x90 [ath9k]
[<ffffffff810501f5>] warn_slowpath_null+0x15/0x20
[<ffffffffa05226ef>] ath9k_hw_setpower+0x61f/0x630 [ath9k_hw]
[<ffffffffa05700e5>] ath9k_ps_wakeup+0x85/0xd0 [ath9k]
[<ffffffffa0570685>] ath9k_configure_filter+0x25/0x80 [ath9k]
[<ffffffffa04dde43>] ieee80211_configure_filter+0x133/0x190 [mac80211]
[<ffffffffa04ee502>] ieee80211_do_stop+0x132/0x540 [mac80211]
[<ffffffff813466ff>] ? _raw_spin_unlock_bh+0x1f/0x30
[<ffffffff812b6923>] ? dev_deactivate+0x1c3/0x1e0
[<ffffffffa04ee925>] ieee80211_stop+0x15/0x20 [mac80211]
[<ffffffff8129d1b6>] __dev_close+0x56/0x90

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


# a08e7ade 07-Dec-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: fix assumptions for idle calls on suspend/resume

mac80211 will notify drivers when to go idle and ath9k
assumed that it would get further notifications for idle
states after a device stop() config call but as per agreed
semantics the idle state of the radio is left up to driver
after mac80211 issues the stop() callback. The driver is
resposnbile for ensuring the device remains idle after
that even between suspend / resume calls.

This fixes suspend/resume when you issue suspend and resume
twice on ath9k when ath9k_stop() was already called. We need
to put the radio to full sleep in order for resume to work
correctly.

What might seem fishy is we are turning the radio off
after resume. The reason why we do this is because we know
we should not have anything enabled after a mac80211 tells
us to stop(), if we resume and never get a start() we won't
get another stop() by mac80211 so to be safe always bring
the 802.11 device with the radio disabled after resume,
this ensures that if we suspend we already have the radio
disabled and only a start() will ever trigger it on.

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Amod Bodas <amod.bodas@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1435894d 06-Dec-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Add device id of AR9485 to pci table

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


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

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

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


# 3800276a 02-Dec-2010 Joe Perches <joe@perches.com>

ath: Convert ath_print(.., ATH_DBG_FATAL to ath_err

So these errors are always emitted at KERN_ERR level.
Remove ARRAY_SIZE casts, use printf type %zu

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


# a05b5d45 16-Nov-2010 Felix Fietkau <nbd@openwrt.org>

ath9k: add support for reading eeprom from platform data on PCI devices

Some embedded boards store platform data for connected PCIe AR92xx
chips in the system flash instead of a separate EEPROM chip.

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


# f0e94b47 15-Oct-2010 Rafael J. Wysocki <rjw@rjwysocki.net>

ath9k: Convert to new PCI PM framework

The ath9k driver uses the legacy PCI power management (suspend
and resume) callbacks that apparently cause intermittent problems
to happen (the adapter sometimes doesn't resume correctly on my
Acer Ferrari One). Make it use the new PCI PM and let the PCI core
code handle the PCI-specific details of power transitions.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c96c31e4 26-Jul-2010 Joe Perches <joe@perches.com>

drivers/net/wireless: Use wiphy_<level>

Standardize the logging macros used.

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


# 0efabd51 11-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: enable AR9003 PCI IDs

All AR9003 features are now complete so enable AR9003
support.

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


# ab1d8644 17-May-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: remove AR9003 from PCI IDs for now

We tried to squeeze as much AR9003 support into this kernel
release cycle but there are a few features which are still
being tested and developed. Some of these features are critical
to the stable operation of AR9003 so for now disable AR9003 support
all together. This will get re-enabled once all necessary features
are in place but very likely will not happen for 2.6.35.

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


# 733f0ea4 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: add the PCI ID for the first AR9300 device

The first AR9003 hardware family device supported is the
AR9300, which has the vendor:device id 168c:0030

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


# 497ad9ad 31-Mar-2010 Sujith <Sujith.Manoharan@atheros.com>

ath: Add a bus type field

This can be used to store the bus types ( AHB/PCI/USB ).

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


# 5ffaf8a3 02-Feb-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: add support for 802.11n bonded out AR2427

Some single chip family devices are sold in the market with
802.11n bonded out, these have no hardware capability for
802.11n but ath9k can still support them. These are called
AR2427.

Cc: stable@kernel.org
Reported-by: Rolf Leggewie <bugzilla.kernel.org@rolf.leggewie.biz>
Tested-by: Bernhard Reiter <ockham@raz.or.at>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ab5132a2 30-Jan-2010 Pavel Roskin <proski@gnu.org>

ath9k: fix access to freed data on unload

Calling ath_bus_cleanup() after ieee80211_free_hw() resulted in access
to common->bus_ops, which is already freed as part of the device data.

Remove the cleanup field in struct ath_bus_ops, as it was never used
properly. Remove ath_bus_cleanup(). Merge cleanup functions in place
of the ath_bus_cleanup() calls. Take care not to use any device data
after ieee80211_free_hw().

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


# 5e4ea1f0 13-Jan-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Fix panic on driver load

The device has to be marked as invalid before
registering the ISR. HW initialization takes place
after the ISR has been registered, and the invalid
flag is eventually cleared in the ->stop() callback.

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


# 285f2dda 07-Jan-2010 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Cleanup init/deinit routines

The device initialization and termination functions
were messy and convoluted. Introduce helper functions
to clarify init_softc() and simplify things in general.

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


# a3aa1884 07-Jan-2010 Alexey Dobriyan <adobriyan@gmail.com>

drivers/net/: use DEFINE_PCI_DEVICE_TABLE()

Use DEFINE_PCI_DEVICE_TABLE() so we get place PCI ids table into correct section
in every case.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 83bd11a0 23-Dec-2009 Tobias Klauser <tklauser@distanz.ch>

ath9k: Storage class should be before const qualifier

The C99 specification states in section 6.11.5:

The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f934c4d9 26-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: distinguish single-chip solutions on initial probe print

Devices with external radios have revisions which we can count on.
On single chip solutions these EEPROM values for these radio revision
also exist but are not meaningful as the radios are embedded onto the
same chip. Each single-chip device evolves together as one device.

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


# 2da4f01a 26-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k_hw: move mac name and rf name helpers to hw code

These are shared between ath9k and the future ath9k_htc driver.

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


# bc974f4a 28-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: define a common priv struct

hw code should never use private driver data, but
sometimes we need a backpointer so just stuff it on
the common ath struct.

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


# 475a6e4d 23-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: use common read/write ops on pci and debug code

PCI and debug code will not be shared between ath9k and
ath9k_htc, so make that code use the common read/write ops.

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


# 5bb12791 14-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: move bus ops to ath_common

This is the last part to make ath9k hw code core driver agnostic.
I believe ath9k_htc can now use use the hw code unmodified.

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


# 867633f0 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: Define bus agnostic bluetooth coex prep helper

We disable ASPM when enabling bluetooth coexistance. Disabling
ASPM is a bus specific operation. In the future other buses may
support bluetooth coexistance, an example is USB. To this end
move the current routine which disables ASPM into pci.c, and declare
it the PCI bt_coex_prep() helper. Additionally, since ASPM is
a PCI-Express primitive ensure we don't ever try to muck with ASPM
registers on non PCI-express devices.

This also cleans up hw.c to not include bus specific headers or
utilities.

Cc: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: Zhifeng Cai <zhifeng.cai@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# aeac355d 09-Sep-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Store subsystem id in struct hw_version

This subsystem id will be used later to turn on the btcoex
support.

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


# f020979d 07-Sep-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com>

ath9k: Remove unnecessary casting to u8 in pci_read_config_byte() call

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


# fc548af8 02-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: claim irq for ath9k, not ath for pci

ath9k ahb requests an IRQ and indicates 'ath9k' claimed it,
ath9k pci requests an IRQ and indicates 'ath' claims it;
since 'ath' is another module sync both ahb and pci to claim
the irq using 'ath9k'.

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


# 580171f7 02-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: propagate errors on ath_init_device() and request_irq()

We've cleaned up ath_init_device() and its children enough
to pass meaninful errors back from probe. When this fails
it means our device could not be initialized and a meaninful
error will have been passed.

Do the same for request_irq() and also synchronize the error
messages while at it.

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


# db6be53c 02-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: propagate ieee80211_alloc_hw() failure

The -ENOMEM was never being passed on failure.
While at it use dev_err() as ahb does upon failure.

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


# 08fc5c1b 14-Aug-2009 Vivek Natarajan <vivek.natraj@gmail.com>

ath9k: Enable LEDs for AR9287 chipsets.

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


# 523c36fc 12-Aug-2009 Sujith <Sujith.Manoharan@atheros.com>

ath9k: Fix bug in PCI resume

This patch fixes a bug where the device was enabled
before restoring the PCI state.

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


# 1e40bcfa 03-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath9k: distinguish between device initialization and ath_softc init

We re-label the device driver initialization routines from the
ath_softc, the "Software Carrier" fillers. This should make it
clearer what each of these do.

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


# ac88b6ec 22-Jul-2009 Vivek Natarajan <vivek.natraj@gmail.com>

ath9k: Add support for AR9287 based chipsets.

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


# f0214843 16-Jun-2009 Jouni Malinen <jouni.malinen@atheros.com>

ath9k: Fix PCI FATAL interrupts by restoring RETRY_TIMEOUT disabling

An earlier commit, 'ath9k: remove dummy PCI "retry timeout" fix', removed
code that was documented to disable RETRY_TIMEOUT register (PCI reg
0x41) since it was claimed to be a no-op. However, it turns out that
there are some combinations of hosts and ath9k-supported cards for
which this is not a no-op (reg 0x41 has value 0x80, not 0) and this
code (or something similar) is needed. In such cases, the driver may
be next to unusable due to very frequent PCI FATAL interrupts from the
card.

Reverting the earlier commit, i.e., restoring the RETRY_TIMEOUT
disabling, seems to resolve the issue. Since the removal of this code
was not based on any known issue and was purely a cleanup change, the
safest option here is to just revert that commit. Should there be
desire to clean this up in the future, the change will need to be
tested with a more complete coverage of cards and host systems.

http://bugzilla.kernel.org/show_bug.cgi?id=13483

Cc: stable@kernel.org
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 19d337df 02-Jun-2009 Johannes Berg <johannes@sipsolutions.net>

rfkill: rewrite

This patch completely rewrites the rfkill core to address
the following deficiencies:

* all rfkill drivers need to implement polling where necessary
rather than having one central implementation

* updating the rfkill state cannot be done from arbitrary
contexts, forcing drivers to use schedule_work and requiring
lots of code

* rfkill drivers need to keep track of soft/hard blocked
internally -- the core should do this

* the rfkill API has many unexpected quirks, for example being
asymmetric wrt. alloc/free and register/unregister

* rfkill can call back into a driver from within a function the
driver called -- this is prone to deadlocks and generally
should be avoided

* rfkill-input pointlessly is a separate module

* drivers need to #ifdef rfkill functions (unless they want to
depend on or select RFKILL) -- rfkill should provide inlines
that do nothing if it isn't compiled in

* the rfkill structure is not opaque -- drivers need to initialise
it correctly (lots of sanity checking code required) -- instead
force drivers to pass the right variables to rfkill_alloc()

* the documentation is hard to read because it always assumes the
reader is completely clueless and contains way TOO MANY CAPS

* the rfkill code needlessly uses a lot of locks and atomic
operations in locked sections

* fix LED trigger to actually change the LED when the radio state
changes -- this wasn't done before

Tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> [thinkpad]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
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>