Commit graph

4317 commits

Author SHA1 Message Date
Sujith Manoharan 4b9b42bfe0 ath9k: Use bitops for calibration flags
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:47 -04:00
Sujith Manoharan 1e516ca7c9 ath9k: Handle abnormal NAV in AP mode
Beacon transmission would get stuck if the NAV is
an invalid value for some reason. Check and correct
the NAV value in the HW when this happens.

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

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

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

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:46 -04:00
Sujith Manoharan c694545568 ath9k: Fix calibration for AR9462
TX IQ calibration is disabled by default for AR9462, this
is done using the initvals (reg 0xa644).

But, to compensate for this, the AR_PHY_RX_DELAY register
should be set to the max allowed value when performing
calibration.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:46 -04:00
Jingoo Han 3f06534183 wireless: wil6210: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:43 -04:00
Jingoo Han 1348088d6f wireless: ath10k: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:43 -04:00
Jingoo Han 8f616c6d31 wireless: ath9k: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:38 -04:00
Jingoo Han b920e375be wireless: ath5k: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:37 -04:00
Sachin Kamat 5bb4101bc9 net: ath9k: Use NULL instead of false
The function returns a pointer. Hence return NULL instead of false.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:37 -04:00
Albert Pool 38e05a0e52 ar5523: Add USB ID of D-Link WUA-2340 rev A1
Signed-off-by: Albert Pool <albertpool@solcon.nl>
Reported-by: Michael Landrum <landrummd@gmail.com>
Acked-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:37 -04:00
Zefir Kurtisi 5e88ba6228 ath9k: replace snprintf() with scnprintf()
Whenever the return value of snprintf() is used to calculate
remaining buffer-space, we wanted to use sncprintf() instead.

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

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:35 -04:00
Sujith Manoharan bf7c756c5d 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>
2013-09-26 15:13:35 -04:00
Sujith Manoharan 7c9a72013b ath9k: Update AR9485 1.1 initvals
* Remove duplicate array mappings.
* Fix ETSI CCA compliance.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:31 -04:00
Sujith Manoharan 6d5228fe20 ath9k: Add and use initvals for channel 14
This is missing for AR9565.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:30 -04:00
Sujith Manoharan d3b371cb03 ath9k: Fix regulatory compliance for AR9462/AR9565
Adjust the CCA values based on the regulatory domain
present in the EEPROM.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:30 -04:00
Sujith Manoharan 3fcdd0a12e 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>
2013-09-26 15:13:30 -04:00
Sujith Manoharan 10631336eb 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>
2013-09-26 15:13:29 -04:00
Sujith Manoharan 1823a4212b 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>
2013-09-26 15:13:29 -04:00
Sujith Manoharan f96bd2ad22 ath9k: Add support for AR9565 v1.0.1 LNA diversity
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:28 -04:00
Sujith Manoharan 6ac2150927 ath9k: Use correct RX gain table for AR9565
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:28 -04:00
Sujith Manoharan c946868228 ath9k: Fix antenna diversity init for AR9565
Program the HW registers (AR_PHY_CCK_DETECT, AR_PHY_MC_GAIN_CTRL)
with the correct values for AR9565 to allow LNA combining.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:28 -04:00
Sujith Manoharan 7e12d6a496 ath9k: Bypass EEPROM for diversity cap for AR9565
Use a default antenna diversity value for AR9565 instead
of relying on the EEPROM/OTP programmed value.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:27 -04:00
Sujith Manoharan 1c6bbe4739 ath9k: Update initvals for AR9565 1.0
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:27 -04:00
John W. Linville 98497bb241 Merge branch 'for-linville' of git://github.com/kvalo/ath 2013-09-26 14:54:17 -04:00
Joe Perches 7367d0b573 drivers/net: Convert uses of compare_ether_addr to ether_addr_equal
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.

Done via cocci script: (and a little typing)

$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
-	!compare_ether_addr(a, b)
+	ether_addr_equal(a, b)

@@
expression a,b;
@@
-	compare_ether_addr(a, b)
+	!ether_addr_equal(a, b)

@@
expression a,b;
@@
-	!ether_addr_equal(a, b) == 0
+	ether_addr_equal(a, b)

@@
expression a,b;
@@
-	!ether_addr_equal(a, b) != 0
+	!ether_addr_equal(a, b)

@@
expression a,b;
@@
-	ether_addr_equal(a, b) == 0
+	!ether_addr_equal(a, b)

@@
expression a,b;
@@
-	ether_addr_equal(a, b) != 0
+	ether_addr_equal(a, b)

@@
expression a,b;
@@
-	!!ether_addr_equal(a, b)
+	ether_addr_equal(a, b)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-09-03 22:28:04 -04:00
Kalle Valo 763b8cd314 ath10k: add chip_id file to debugfs
So that's it's possible to query chip id from ath10k anytime.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:59:53 +03:00
Kalle Valo e01ae68c5d ath10k: check chip id from the soc register during probe
ath10k doesn't support qca988x hw1.0 boards anymore. Unfortunately
the PCI id is the same in hw1.0 and hw2.0 so ath10k tries to use
hw1.0 boards anyway. But without hw1.0 workarounds in place
ath10k just crashes horribly.

To avoid using hw1.0 boards at all add a chip id detection
and fail the probe if hw1.0 is detected:

[ 5265.786408] ath10k: ERROR: qca988x hw1.0 is not supported
[ 5265.786497] ath10k: Unsupported chip id 0x043200ff
[ 5265.786574] ath10k: could not register driver core (-95)
[ 5265.793191] ath10k_pci: probe of 0000:02:00.0 failed with error -95

Also add a warning if there's an unknown chip id but continue
the boot process normally anyway.

Reported-by: Zaki Bakar <zaki.bm@gmail.com>
Tested-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:54:16 +03:00
Kalle Valo e9780367b0 ath10k: simplify ath10k_ce_init() wake up handling
ath10k_ce_init() and the functions it calls wakeup
the chip multiple times. Simplify that to call
ath10k_pci_wake() only once. This also makes it
easier to add error handling when wakeup fails.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:08 +03:00
Kalle Valo 3aebe54b1c ath10k: convert ath10k_pci_wake() to return
We should not try to access hw if wakeup fails so add
proper error checking for that. Also add the timeout lenght
to the warning message.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:08 +03:00
Kalle Valo a40d3e420d ath10k: clean up ath10k_ce_completed_send_next_nolock()
The error handling was just weird, simplify it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo e479ed437b ath10k: convert ath10k_pci_reg_read/write32() to take struct ath10k
This is consistent with all other functions.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo aa5c1db445 ath10k: remove void pointer from struct ath10k_pci_compl
Void pointers are bad, mmkay.

No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo d88effbaa6 ath10k: make target_ce_config_wlan more readable
It's easier to read t if the field names are visible.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo 48e9c225ab ath10k: pci: make host_ce_config_wlan[] more readable
It's much more readable if struct entries in host_ce_config_wlan
are explicitly set.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo a18b5ed8d2 ath10k: remove un ar_pci->cacheline_sz field
cacheline_sz is not used anywhere and can be removed.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:38:18 +03:00
Michal Kazior d21fb959d1 ath10k: rename ce_ring_state to ath10k_ce_ring
The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:28:47 +03:00
Michal Kazior 2aa3911573 ath10k: rename ce_state to ath10k_ce_pipe
The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:50 +03:00
Michal Kazior 87263e5bb4 ath10k: rename hif_ce_pipe_info to ath10k_pci_pipe
The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:49 +03:00
Michal Kazior 6702bad406 ath10k: remove unused ce_attr parameters
Some parameters were unused and are not required.
They have no representation in firmware. Clean
them up.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:49 +03:00
Michal Kazior 774c7e8c2b ath10k: remove ce_op_state
It was only written to and never read back. No use
to keep it around.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:49 +03:00
Michal Kazior 39e4086a73 ath10k: use inline ce_state structure
Simplifies memory managament of ce_state.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:21:45 +03:00
Sujith Manoharan 27251e0087 ath9k: Enable D3/L1 ASPM fix for AR9462
AR9462 requires this HW fix for ASPM to work properly.
Also, since WARegVal is used only for the AR8003 family,
use AR_SREV_9300_20_OR_LATER.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 13:58:27 -04:00
Sujith Manoharan 65c1a4de59 ath9k: Remove unused ANI commands
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 13:58:27 -04:00
John W. Linville f3e979a52c Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2013-08-28 13:51:40 -04:00
John W. Linville 53b2f82848 ath9k: ar9003_eeprom.c:3618 fix variable name typo
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c: In function 'ar9003_hw_ant_ctrl_apply':
>> drivers/net/wireless/ath/ath9k/ar9003_eeprom.c:3618: warning: 'regval' is used uninitialized in this function

It seems obvious that 'regval' should have been 'value'...

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 11:05:36 -04:00
John W. Linville b35c809708 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Conflicts:
	drivers/net/wireless/iwlwifi/pcie/trans.c
	net/mac80211/ibss.c
2013-08-28 10:36:09 -04:00
Mohammed Shafi Shajakhan e2951f7ff8 ath10k: Fix mutex unlock balance
ath10k_debug_read_target_stats is properly
protected by data_lock (spinlock). Remove
the unwanted mutex_unlock(&ar->conf_mutex)

[ BUG: bad unlock balance detected! ]
-------------------------------------
kworker/u4:0/12459 is trying to release lock
(&ar->conf_mutex) at:
[<c16a170d>] mutex_unlock+0xd/0x10
but there are no more locks to release!

 Call Trace:
  [<c16a170d>] ? mutex_unlock+0xd/0x10
  [<c10b697d>] __lock_release+0x4d/0xe0
  [<f88ca0fc>] ? ath10k_debug_read_target_stats+0xac/0x290

  [<c16a170d>] ? mutex_unlock+0xd/0x10
  [<c10b6a5b>] lock_release+0x4b/0x150
  [<c16a1580>] __mutex_unlock_slowpath+0x70/0x150
  [<f88ca0fc>] ? ath10k_debug_read_target_stats+0xac/0x290

  [<c10b456b>] ? trace_hardirqs_on+0xb/0x10
  [<c16a170d>] mutex_unlock+0xd/0x10
  [<f88ca107>] ath10k_debug_read_target_stats+0xb7/0x290

  [<f88d337a>] ath10k_wmi_event_process+0x3fa/0x6e0

  [<c10b456b>] ? trace_hardirqs_on+0xb/0x10
  [<f88d36e1>] ath10k_wmi_event_work+0x21/0x40
               [ath10k_core]

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-08-28 07:08:27 +03:00
Sujith Manoharan e5614a91be ath9k: Fix DEBUG_FS dependency for ath9k
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-26 14:10:39 -04:00
Sujith Manoharan d4c04ba141 ath9k: Fix TX poll work locking
There is no need to call ath_txq_unlock_complete() in the
TX poll routine - frame completion is not done here,
so use ath_txq_unlock().

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-26 14:09:07 -04:00
Sujith Manoharan d1ae25a017 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>
2013-08-26 14:09:06 -04:00