pandora-kernel.git
13 years agoiwlwifi: fix possible data overwrite in hcmd callback
Stanislaw Gruszka [Wed, 20 Apr 2011 14:02:58 +0000 (16:02 +0200)]
iwlwifi: fix possible data overwrite in hcmd callback

My commit 3598e1774c94e55c71b585340e7dc4538f310e3f
"iwlwifi: fix enqueue hcmd race conditions" move hcmd callback after
command queue reclaim, to avoid call it with hcmd_lock. But since
queue read index was updated, cmd data can be overwritten. Fix problem
by calling callback before taking hcmd_lock and queue reclaim.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agossb: cc: add & fix defines
Rafał Miłecki [Wed, 20 Apr 2011 09:12:30 +0000 (11:12 +0200)]
ssb: cc: add & fix defines

We probably got false positive results for checking PLL being down.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Remove unused macros and structures
Sujith Manoharan [Wed, 20 Apr 2011 05:31:25 +0000 (11:01 +0530)]
ath9k_htc: Remove unused macros and structures

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Use power save wrappers when accessing HW
Sujith Manoharan [Wed, 20 Apr 2011 05:31:10 +0000 (11:01 +0530)]
ath9k_htc: Use power save wrappers when accessing HW

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Fix max A-MPDU size handling
Sujith Manoharan [Wed, 20 Apr 2011 05:31:00 +0000 (11:01 +0530)]
ath9k_htc: Fix max A-MPDU size handling

Set the maximum ampdu size of a station correctly
in the target by using the ampdu_factor.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Fix AMPDU subframe handling
Sujith Manoharan [Wed, 20 Apr 2011 09:03:28 +0000 (14:33 +0530)]
ath9k_htc: Fix AMPDU subframe handling

* Register the driver's maximum ampdu subframe limit to mac80211.
* Cleanup the target capabilities structure and fix an endian issue.
* Fix BTCOEX by sending a command to the target when the BT priority
  changes.
* Bump the required firmware version to 1.1

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: Fix warnings from -Wunused-but-set-variable
Sujith Manoharan [Wed, 20 Apr 2011 05:30:34 +0000 (11:00 +0530)]
ath9k: Fix warnings from -Wunused-but-set-variable

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agossb: cc: use correct min_msk for 0x4312
Rafał Miłecki [Tue, 19 Apr 2011 20:40:23 +0000 (22:40 +0200)]
ssb: cc: use correct min_msk for 0x4312

Default min_msk on my 0x4312 is 0x80000CBB, not 0xCBB. Now we follow
specs and wl (noticed in MMIO dumps).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agossb: pci: trivial: correct amount of maximum retries
Rafał Miłecki [Tue, 19 Apr 2011 20:40:22 +0000 (22:40 +0200)]
ssb: pci: trivial: correct amount of maximum retries

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Enable AR9340 support
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:20 +0000 (19:29 +0530)]
ath9k_hw: Enable AR9340 support

AR9340 is a AR9003 family built-in 2x2 wmac of ar934x SOCs. It is single band
in ar9341 SOC and dual band in ar9344/ar9342 SOCs.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Disable INTR_HOST1_FATAL to avoid interrupt strom with ar9430
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:19 +0000 (19:29 +0530)]
ath9k_hw: Disable INTR_HOST1_FATAL to avoid interrupt strom with ar9430

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Assign macversion based on devid for built-in wmac
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:18 +0000 (19:29 +0530)]
ath9k_hw: Assign macversion based on devid for built-in wmac

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: Add AR9340 platform id to id table
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:17 +0000 (19:29 +0530)]
ath9k: Add AR9340 platform id to id table

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Read iq calibration data only for active chains
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:16 +0000 (19:29 +0530)]
ath9k_hw: Read iq calibration data only for active chains

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Configure chain switch table and attenuation control only for active chains
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:15 +0000 (19:29 +0530)]
ath9k_hw: Configure chain switch table and attenuation control only for active chains

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Enable byte Tx/Rx data swap for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:14 +0000 (19:29 +0530)]
ath9k_hw: Enable byte Tx/Rx data swap for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Configure tuning capacitance value for AR9340 as well
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:13 +0000 (19:29 +0530)]
ath9k_hw: Configure tuning capacitance value for AR9340 as well

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Skip internal regulator configuration for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:12 +0000 (19:29 +0530)]
ath9k_hw: Skip internal regulator configuration for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Don't configure AR_CH0_THERM for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:11 +0000 (19:29 +0530)]
ath9k_hw: Don't configure AR_CH0_THERM for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Fix register offset AR_PHY_65NM_CH0_THERM for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:10 +0000 (19:29 +0530)]
ath9k_hw: Fix register offset AR_PHY_65NM_CH0_THERM for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Clean up rx/tx chain configuration before AGC/IQ cal
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:09 +0000 (19:29 +0530)]
ath9k_hw: Clean up rx/tx chain configuration before AGC/IQ cal

Use hw supported chains instead of hard coded values.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Configure RF channel freqency for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:08 +0000 (19:29 +0530)]
ath9k_hw: Configure RF channel freqency for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Read spur frequency information from eeprom for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:07 +0000 (19:29 +0530)]
ath9k_hw: Read spur frequency information from eeprom for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Initialize tx and rx gain table from initvals.h for ar9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:06 +0000 (19:29 +0530)]
ath9k_hw: Initialize tx and rx gain table from initvals.h for ar9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Don't do ani initialization for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:05 +0000 (19:29 +0530)]
ath9k_hw: Don't do ani initialization for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Initialize mode registers from initvals.h for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:04 +0000 (19:29 +0530)]
ath9k_hw: Initialize mode registers from initvals.h for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Add initvals.h for ar9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:03 +0000 (19:29 +0530)]
ath9k_hw: Add initvals.h for ar9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Configure pll control register accordingly for AR9340
Vasanthakumar Thiagarajan [Wed, 20 Apr 2011 04:56:15 +0000 (10:26 +0530)]
ath9k_hw: Configure pll control register accordingly for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Get AHB clock information from ath9k_platform_data
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:01 +0000 (19:29 +0530)]
ath9k_hw: Get AHB clock information from ath9k_platform_data

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

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Take care of few host interface register changes for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:59:00 +0000 (19:29 +0530)]
ath9k_hw: Take care of few host interface register changes for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_hw: Define devid and mac version for AR9340
Vasanthakumar Thiagarajan [Tue, 19 Apr 2011 13:58:59 +0000 (19:28 +0530)]
ath9k_hw: Define devid and mac version for AR9340

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoMerge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
John W. Linville [Mon, 25 Apr 2011 18:42:51 +0000 (14:42 -0400)]
Merge branch 'wireless-next-2.6' of git://git./linux/kernel/git/iwlwifi/iwlwifi-2.6

13 years agoMerge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca...
John W. Linville [Mon, 25 Apr 2011 18:36:35 +0000 (14:36 -0400)]
Merge branch 'for-linville' of git://git./linux/kernel/git/luca/wl12xx

13 years agoiwlagn: remove hw_ready variable
Johannes Berg [Wed, 13 Apr 2011 10:14:52 +0000 (03:14 -0700)]
iwlagn: remove hw_ready variable

This variable is only ever checked right after
the function that sets it, but the same function
will also return the status, so we can pass it
through instead of checking hw_ready later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: combine firmware code/data
Johannes Berg [Sat, 16 Apr 2011 15:29:24 +0000 (08:29 -0700)]
iwlagn: combine firmware code/data

On new hardware, ucode images always come in
pairs: code and data. Therefore, combine the
variables into an appropriate struct and use
that when both code and data are needed.

Also, combine allocation and copying so that
we have less code in total.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: implement synchronous firmware load
Johannes Berg [Fri, 22 Apr 2011 17:15:23 +0000 (10:15 -0700)]
iwlagn: implement synchronous firmware load

The current firmware loading mechanism in
iwlwifi is very hard to follow, and thus
hard to maintain. To make it easier, make
the firmware loading synchronous.

For now, as a side effect, this removes a
number of retry possibilities we had. It
isn't typical for this to fail, but if it
does happen we restart from scratch which
this also makes easier to do should it be
necessary.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: leave notification waits on firmware errors
Johannes Berg [Wed, 13 Apr 2011 10:14:49 +0000 (03:14 -0700)]
iwlagn: leave notification waits on firmware errors

When the firmware encounters an error while the
driver is waiting for a notification, it will
never get that notification. Therefore, instead
of timing out, bail out on errors when waiting
for notifications.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: make iwlagn_wait_notification return error code
Johannes Berg [Wed, 13 Apr 2011 10:14:48 +0000 (03:14 -0700)]
iwlagn: make iwlagn_wait_notification return error code

We're unlikely to care about the actual time spent
waiting, so make the function return an error code
which is less error prone in coding new uses.

Also, while at it, mark __must_check.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: extend notification wait function
Johannes Berg [Wed, 13 Apr 2011 10:14:47 +0000 (03:14 -0700)]
iwlagn: extend notification wait function

A notification wait function is called with the
command, but currently has no way of passing
data back to the caller -- fix that by adding a
void pointer to the function that can be used
between the caller and the function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: refactor up path
Johannes Berg [Wed, 13 Apr 2011 10:14:46 +0000 (03:14 -0700)]
iwlagn: refactor up path

Starting the device consists of many things,
refactor out enabling the hardware and also
return -ERFKILL when the rfkill signal is
found to be asserted (which makes more sense
anyway, but is also required now to make the
__iwl_up function return right away.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: refactor down path
Johannes Berg [Wed, 13 Apr 2011 10:14:45 +0000 (03:14 -0700)]
iwlagn: refactor down path

The iwl_down path really consists of multiple things,
refactor out the hardware resetting (including, of
course, related software state like irqs).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: clean up some exit code
Johannes Berg [Wed, 13 Apr 2011 10:14:44 +0000 (03:14 -0700)]
iwlagn: clean up some exit code

There's no point in running through iwl_down()
when we never registered with mac80211, as it
just cleans up internal structures that were
never initialised in this case. Therefore we
can also remove the special handling for this
case from __iwl_down().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agoiwlagn: simplify error table reading
Johannes Berg [Wed, 13 Apr 2011 10:14:43 +0000 (03:14 -0700)]
iwlagn: simplify error table reading

The current code to read the error table header
just hardcodes all the offsets, which is a bit
hard to understand. We can read in the entire
header (as much as we need) into a structure,
and then take the data from there, which makes
it easier to understand. To read a bigger blob
we also don't need to grab NIC access for each
word read, making the code more efficient.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 years agomac80211: explain padding in place of rate field
Johannes Berg [Mon, 18 Apr 2011 15:05:21 +0000 (17:05 +0200)]
mac80211: explain padding in place of rate field

Apparently this was confusing still ... add a
note that the byte is needed as padding.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Implement get_antenna and set_antenna callback functions
Ivo van Doorn [Mon, 18 Apr 2011 13:35:12 +0000 (15:35 +0200)]
rt2x00: Implement get_antenna and set_antenna callback functions

Implement the get_antenna and set_antenna callback functions, which will
allow clients to control the antenna for all non-11n hardware (Antenna handling
in rt2800 is still a bit magical, so we can't use the set_antenna for those drivers
yet).

To best support the set_antenna callback some modifications are needed in the
diversity handling. We should never look at the default antenna settings to determine
if software diversity is enabled. Instead we should set the diversity flag when
possible, which will allow the link_tuner to automatically pick up the tuning.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Implement get_ringparam callback function
Ivo van Doorn [Mon, 18 Apr 2011 13:34:41 +0000 (15:34 +0200)]
rt2x00: Implement get_ringparam callback function

With the get_ringparam callback function we can export ring parameters
to ethtool through the mac80211 interface.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Optimize register access in rt2800usb
Ivo van Doorn [Mon, 18 Apr 2011 13:34:22 +0000 (15:34 +0200)]
rt2x00: Optimize register access in rt2800usb

All register reads/writes in rt2800usb were previously done with
rt2800_register_read/rt2800_register_write. These however indirectly
call rt2x00usb_register_read/rt2x00usb_register_write which adds an
additional overhead of at least one call and several move instructions
to each register access.

Replacing the calls to rt2800_register_read/rt2800_register_write with
direct calls to rt2x00usb_register_read/rt2x00usb_register_write gets
rid of quite a number of instructions in the drivers hotpaths (IRQ
handling and txdone handling).

For consistency replace all references to rt2800_register_read/write
with the rt2x00usb_register_read/write variants.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Optimize register access in rt2800pci
Helmut Schaa [Mon, 18 Apr 2011 13:34:01 +0000 (15:34 +0200)]
rt2x00: Optimize register access in rt2800pci

All register reads/writes in rt2800pci were previously done with
rt2800_register_read/rt2800_register_write. These however indirectly
call rt2x00pci_register_read/rt2x00pci_register_write which adds an
additional overhead of at least one call and several move instructions
to each register access.

Replacing the calls to rt2800_register_read/rt2800_register_write with
direct calls to rt2x00pci_register_read/rt2x00pci_register_write gets
rid of quite a number of instructions in the drivers hotpaths (IRQ
handling and txdone handling).

For consistency replace all references to rt2800_register_read/write
with the rt2x00pci_register_read/write variants.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Merge rt2x00ht.c contents in other files.
Gertjan van Wingerde [Mon, 18 Apr 2011 13:33:41 +0000 (15:33 +0200)]
rt2x00: Merge rt2x00ht.c contents in other files.

The two functions that are in rt2x00ht.c can be much better placed
closer to the places where the call-sites of these functions are (one
in rt2x00config.c and one in rt2x00queue.c) allowing us to make these
functions static.
Also, conditional compilations doesn't seem to be necessary anymore as
802.11n support is quite common nowadays.

This makes the code a bit easier readable and searchable.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Enable support for RT53xx PCI devices by default.
Gertjan van Wingerde [Mon, 18 Apr 2011 13:33:20 +0000 (15:33 +0200)]
rt2x00: Enable support for RT53xx PCI devices by default.

Code seems to be feature-complete, so no reason to not enable
these devices by default.

Also, remove the sentence about the support for these devices being
non-functional.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: RT33xx device support is no longer experimental.
Gertjan van Wingerde [Mon, 18 Apr 2011 13:33:00 +0000 (15:33 +0200)]
rt2x00: RT33xx device support is no longer experimental.

The rt33xx devices support for both PCI and USB devices has been in
the tree for a couple of months now, and seems to be functional and
not in a worse shape than the support for rt28xx and rt30xx devices.

No longer mark it as experimental and enable the support for these
devices by default.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Add USB IDs.
Gertjan van Wingerde [Mon, 18 Apr 2011 13:32:33 +0000 (15:32 +0200)]
rt2x00: Add USB IDs.

Add USB IDs that are listed in the latest Ralink Windows and/or Linux drivers.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Allow dynamic addition of PCI/USB IDs.
Gertjan van Wingerde [Mon, 18 Apr 2011 13:32:13 +0000 (15:32 +0200)]
rt2x00: Allow dynamic addition of PCI/USB IDs.

Both USB and PCI drivers allow a system administrator to dynamically add
USB/PCI IDs to the device table that a driver supports via the
/sys/bus/{usb,pci,pci_express}/drivers/<driver-name>/new_id files.

However, for the rt2x00 drivers using this method currently crashes the
system with a NULL pointer failure.

This is due to the set-up of rt2x00 where the probe functions require a
rt2x00_ops structure in the driver_info field of the probed device. As
this field is empty for the dynamically added devices this fails for
these devices.

Fix this by introducing driver-specific probe wrappers that do nothing
but calling the bus-specific probe functions with the rt2x00_ops structure
as an argument, rather than depending on the driver_info field.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Linksys WUSB600N rev2 is a RT3572 device.
Gertjan van Wingerde [Mon, 18 Apr 2011 13:31:50 +0000 (15:31 +0200)]
rt2x00: Linksys WUSB600N rev2 is a RT3572 device.

Move the USB ID entry from the unknown devices to the list of RT35xx based
devices.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Always inline rt2x00pci_enable_interrupt
Helmut Schaa [Mon, 18 Apr 2011 13:31:31 +0000 (15:31 +0200)]
rt2x00: Always inline rt2x00pci_enable_interrupt

This allows the compiler to perform the necessary bitfield calculations
during compile time instead of run time and thus reduces the number of
instructions to run during each tasklet invocation. This should improve
performance in the RX hotpath.

This comes at the cost of a slight increase in the module size (for
example rt2800pci):

Before:
   text    data     bss     dec     hex filename
  14133     832       4   14969    3a79 drivers/net/wireless/rt2x00/rt2800pci.ko

After:
   text    data     bss     dec     hex filename
  14149     832       4   14985    3a89 drivers/net/wireless/rt2x00/rt2800pci.ko

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Decrease association time for USB devices
Ivo van Doorn [Mon, 18 Apr 2011 13:31:02 +0000 (15:31 +0200)]
rt2x00: Decrease association time for USB devices

When powersaving is enabled, assocaition times are very high
(for WPA2 networks, the time can easily be around the 3 seconds).

This is caused, because the flushing of the queues takes
too much time. Without the flushing callback mac80211 assumes
a timeout of 100ms while scanning. Limit all flush waiting
loops to the same maximum.

We can apply this maximum by passing the drop status to the
driver, which makes sure the driver performs extra actions
during the waiting for the queue to become empty.

After these changes, association times fall within the
healthy range of ~0.6 seconds with powersaving enabled.
The difference between association time between powersaving
enabled and disabled is now only ~0.1 second (which can also
be due to the measuring method).

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2800usb: add timer to handle TX_STA_FIFO
Johannes Stezenbach [Mon, 18 Apr 2011 13:30:36 +0000 (15:30 +0200)]
rt2800usb: add timer to handle TX_STA_FIFO

TX status is reported by the hardware when a packet has been
sent (or after TX failed after possible retries), which is some
time after the DMA completion.  Since the rt2800usb hardware can
not signal interrupts we have to use a timer, otherwise the
TX status would only be read by the next packet's TX DMA
completion, or by the watchdog thread.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2800usb: handle TX status timeouts
Johannes Stezenbach [Mon, 18 Apr 2011 13:30:01 +0000 (15:30 +0200)]
rt2800usb: handle TX status timeouts

The watchdog just triggers rt2800usb_work_txdone() when it
detects a TX status timeout, thus rt2800usb_work_txdone() needs to
handle this case.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: fix queue timeout checks
Johannes Stezenbach [Mon, 18 Apr 2011 13:29:38 +0000 (15:29 +0200)]
rt2x00: fix queue timeout checks

Add a timestamp to each queue entry which is updated whenever
the status of the entry changes, and remove the per-queue
timestamps.  The previous check was incorrect and caused both
false positives and false negatives.

With the corrected check it comes apparent that the TX status
usually times out on rt2800usb unless there is sufficient traffic
(i.e. the next TX will complete the previous TX status).

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2800usb: read TX_STA_FIFO asynchronously
Johannes Stezenbach [Mon, 18 Apr 2011 13:29:12 +0000 (15:29 +0200)]
rt2800usb: read TX_STA_FIFO asynchronously

Trying to fix the "TX status report missed" warnings
by reading the TX_STA_FIFO entries as quickly as possible.
The TX_STA_FIFO is too small in hardware, thus reading
it only from the workqueue is too slow and entries get lost.

Start an asynchronous read of the TX_STA_FIFO directly from
the TX URB completion callback (atomic context, thus it cannot
use the blocking rt2800_register_read()). If the async
read returns a valid FIFO entry, it is pushed into a larger
FIFO inside struct rt2x00_dev, until rt2800_txdone() picks
it up.

A .tx_dma_done callback is added to struct rt2x00lib_ops
to trigger the async read from the URB completion callback.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Use TXOP_HTTXOP for beacons
Helmut Schaa [Mon, 18 Apr 2011 13:28:50 +0000 (15:28 +0200)]
rt2x00: Use TXOP_HTTXOP for beacons

Use TXOP_HTTXOP for beacons to stay in sync with the legacy drivers.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Update TX_SW_CFG2 init value
Helmut Schaa [Mon, 18 Apr 2011 13:28:27 +0000 (15:28 +0200)]
rt2x00: Update TX_SW_CFG2 init value

Bring the TX_SW_CFG2 initialisation for rt305x devices in sync with the
ralink legacy drivers.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Use correct TBTT_SYNC config in AP mode
Helmut Schaa [Mon, 18 Apr 2011 13:28:04 +0000 (15:28 +0200)]
rt2x00: Use correct TBTT_SYNC config in AP mode

This seems to fix problems with some powersaving clients since a
positive value in TBTT_SYNC_CFG_TBTT_ADJUST introduces beacon skew,
which is not wanted in AP mode.

Also update the rest of the TBTT_SYNC config according to the
legacy drivers in AP mode.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Make rt2x00_queue_entry_for_each more flexible
Helmut Schaa [Mon, 18 Apr 2011 13:27:43 +0000 (15:27 +0200)]
rt2x00: Make rt2x00_queue_entry_for_each more flexible

Allow passing a void pointer to rt2x00_queue_entry_for_each which in
turn in provided to the callback function.

Furthermore, allow the callback function to stop processing by returning
true. And also notify the caller of rt2x00_queue_entry_for_each if the
loop was canceled by the callback.

No functional changes, just preparation for an upcoming patch.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Split rt2x00dev->flags
Ivo van Doorn [Mon, 18 Apr 2011 13:27:06 +0000 (15:27 +0200)]
rt2x00: Split rt2x00dev->flags

The number of flags defined for the rt2x00dev->flags field,
has been growing over the years. Currently we are approaching
the maximum number of bits which are available in the field.

A secondary problem, is that one part of the field are initialized only
during boot, because the driver requirements are initialized or device
requirements are loaded from the EEPROM. In both cases, the flags are
fixed and will not change during device operation. The other flags are
the device state, and will change frequently. So far this resulted in the fact
that for some flags, the atomic bit accessors are used, while for the others
the non-atomic variants are used.

By splitting the flags up into a "flags" and "cap_flags" we can put all flags
which are fixed inside "cap_flags". This field can then be read non-atomically.
In the "flags" field we keep the device state, which is going to be read atomically.

This adds more room for more flags in the future, and sanitizes the field access methods.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Fix stuck queue in tx failure case
Helmut Schaa [Mon, 18 Apr 2011 13:26:37 +0000 (15:26 +0200)]
rt2x00: Fix stuck queue in tx failure case

Since commit 0b7fde54f94979edc67bbf86b5adba702ebfefe8 "rt2x00: Protect
queue control with mutex" rt2x00 used rt2x00queue_pause_queue for
stopping a tx queue in mac80211. But in case of a failure in the tx
path rt2x00 still called ieee80211_stop_queue which stopped the queue
but prevented rt2x00queue_unpause_queue to wake the queue up again
resulting in a stuck tx queue.

Fix this by also using rt2x00queue_pause_queue in case of tx failures.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Enable WLAN LED on Ralink SoC (rt305x) devices
Layne Edwards [Mon, 18 Apr 2011 13:26:00 +0000 (15:26 +0200)]
rt2x00: Enable WLAN LED on Ralink SoC (rt305x) devices

This patch adds WLAN LED support to the mac80211 rt2x00 driver for
Ralink SoC (rt305x) devices.  The current WLAN LED drivers in
rt2800lib.c set the LED brightness via an MCU request, but do nothing
for SoC.  This patch checks for SoC and sets the register to enable the
WLAN LED (instead of an MCU request).  This enables the WLAN LED for
RT305x devices.

Signed-off-by: Layne Edwards <ledwards@astrumtech.net>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: assign keycache slots to unencrypted stations
Felix Fietkau [Sun, 17 Apr 2011 21:28:10 +0000 (23:28 +0200)]
ath9k: assign keycache slots to unencrypted stations

Frame filtering relies on having a valid destination index (keycache slot),
to keep track of the destination. Assigning a keycache slot (configured
to unencrypted, with no key data attached) improves powersave handling in
AP mode with no encryption.
The dummy keycache entry for a station is cleared, when a real key gets
added.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: fix powersave frame filtering/buffering in AP mode
Felix Fietkau [Sun, 17 Apr 2011 21:28:09 +0000 (23:28 +0200)]
ath9k: fix powersave frame filtering/buffering in AP mode

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

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: Fix beacon generation on foreign channel
Rajkumar Manoharan [Sun, 17 Apr 2011 16:08:10 +0000 (21:38 +0530)]
ath9k: Fix beacon generation on foreign channel

While leaving the oper channel, beacon generation is stopped
by mac80211 and beacon slots are marked as inactive.
During the scan, ath9k configures beacon timers
based on IEEE80211_CONF_OFFCHANNEL which inturn generates
beacon alert even though bslot is inactive.

ath9k fails to disable beacon alert while moving to offchannel
if none of the beacon slot is active. This is causing beacon
transmission on foreign channel. This patch enables swba
based on active bslots.

This issue was reported with two vifs (AP+STA) and triggered
scan in STA vif in unassociated state.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: add a function for setting the TIM bit for a specific station
Felix Fietkau [Sun, 17 Apr 2011 15:45:00 +0000 (17:45 +0200)]
mac80211: add a function for setting the TIM bit for a specific station

This allows a driver to buffer frames for a PS station and tell mac80211
to wake it up even though mac80211 does not have any buffered frames for
it.
This is necessary for properly handling aggregation related buffering,
in ath9k, because the driver needs to keep its frames in order to keep
track of the Block-ACK window.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Fix free slot value for cab queue
Rajkumar Manoharan [Sat, 16 Apr 2011 08:47:39 +0000 (14:17 +0530)]
ath9k_htc: Fix free slot value for cab queue

ath9k_htc_tx_get_slot can return zero as valid index.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Acked-by: Sujith Manoharan <Sujith.Manoharan@Atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomwifiex: optimize driver initialization code
Amitkumar Karwar [Sat, 16 Apr 2011 03:50:42 +0000 (20:50 -0700)]
mwifiex: optimize driver initialization code

1) removal of unnecessary mwifiex_device structure
2) avoid passing adapter pointer to mwifiex_init_sw()
3) remove local variable drv_mode_info in mwifiex_add_card()
4) type change in mwifiex_bss_attr to match mwifiex_private
5) removal of more wordy comments

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomwifiex: remove some macro definitions
Amitkumar Karwar [Sat, 16 Apr 2011 03:50:41 +0000 (20:50 -0700)]
mwifiex: remove some macro definitions

use corresponding macros defined in include/linux/ieee80211.h

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomwifiex: remove redundant local variables and comments
Yogesh Ashok Powar [Sat, 16 Apr 2011 03:50:40 +0000 (20:50 -0700)]
mwifiex: remove redundant local variables and comments

Remove some local variables (mainly function return values)
that are used only once. Also, one dummy function and some
wordy comments are removed.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: fix debugfs printk format warning
Randy Dunlap [Fri, 15 Apr 2011 23:20:05 +0000 (16:20 -0700)]
mac80211: fix debugfs printk format warning

Fix printf() format warning (tm_year is long int):

net/mac80211/debugfs_sta.c:113: warning: format '%d' expects type 'int', but argument 4 has type 'long int'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoiwlegacy: use pci_dev->revision
Sergei Shtylyov [Fri, 15 Apr 2011 15:23:11 +0000 (19:23 +0400)]
iwlegacy: use pci_dev->revision

Commit be663ab67077fac8e23eb8e231a8c1c94cb32e54 (iwlwifi: split the drivers for
agn and legacy devices 3945/4965) added code to read the 4965's revision ID from
the PCI configuration register while it's already stored by PCI subsystem in the
'revision' field of 'struct pci_dev'...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Cleanup HTC debugfs
Rajkumar Manoharan [Fri, 15 Apr 2011 10:12:24 +0000 (15:42 +0530)]
ath9k_htc: Cleanup HTC debugfs

Move the ath9k_htc debugfs under ieee80211 to be inline
with ath9k driver and it also helps to simplify debug code.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Acked-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k_htc: Add debugfs support to change debug mask
Rajkumar Manoharan [Fri, 15 Apr 2011 06:58:52 +0000 (12:28 +0530)]
ath9k_htc: Add debugfs support to change debug mask

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Acked-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath: fix 0x6C for beaconing/passive scan flags based on country IE
Luis R. Rodriguez [Thu, 14 Apr 2011 21:55:36 +0000 (14:55 -0700)]
ath: fix 0x6C for beaconing/passive scan flags based on country IE

The 0x6C regulatory domain is just like the 0x6A regulatory
domain but differs in that 0x6C will allow adhoc and active
scan on its channels only if we are associated to an AP
with a country IE that allows those channels. The
ath_reg_apply_beaconing_flags() does just this -- we respect
the manufacturer's intent on only enabling beaconing modes
of operation if and only if blessed by the country IE.

Cc: David Quan <david.quan@atheros.com>
Cc: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agorfkill: Regulator consumer driver for rfkill
Antonio Ospite [Wed, 13 Apr 2011 19:40:45 +0000 (21:40 +0200)]
rfkill: Regulator consumer driver for rfkill

Add a regulator consumer driver for rfkill to enable controlling radio
transmitters connected to voltage regulators using the regulator
framework.

A new "vrfkill" virtual supply is provided to use in platform code.

Signed-off-by: Guiming Zhuo <gmzhuo@gmail.com>
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/blueto...
John W. Linville [Tue, 19 Apr 2011 19:34:48 +0000 (15:34 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/padovan/bluetooth-next-2.6

13 years agoMerge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
John W. Linville [Tue, 19 Apr 2011 19:33:54 +0000 (15:33 -0400)]
Merge branch 'wireless-next-2.6' of git://git./linux/kernel/git/iwlwifi/iwlwifi-2.6

13 years agowl12xx: fix sparse warning about undeclared wl12xx_alloc_dummy_packet
Luciano Coelho [Fri, 1 Apr 2011 18:08:23 +0000 (21:08 +0300)]
wl12xx: fix sparse warning about undeclared wl12xx_alloc_dummy_packet

Fix sparse warning:

  CHECK   drivers/net/wireless/wl12xx/main.c
drivers/net/wireless/wl12xx/main.c:1246:17: warning: symbol 'wl12xx_alloc_dummy_packet' was not declared. Should it be static?

Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: remove unused conf_radio_params structure
Luciano Coelho [Fri, 1 Apr 2011 17:55:01 +0000 (20:55 +0300)]
wl12xx: remove unused conf_radio_params structure

This structure has not been used anymore since commit
e6b190ff3c2f4e4859502c41fa17b5c595e82000.

Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: move hardcoded hci_io_ds value into the conf struct
Luciano Coelho [Fri, 1 Apr 2011 17:48:02 +0000 (20:48 +0300)]
wl12xx: move hardcoded hci_io_ds value into the conf struct

Instead of hardcoding the hci_io_ds configuration that we write to the
SDIO_IO_DS top registed, read it from the default configuration so
that it's easier to change for different platforms.

Reported-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: use kstrtoul functions
Luciano Coelho [Fri, 1 Apr 2011 14:49:54 +0000 (17:49 +0300)]
wl12xx: use kstrtoul functions

Use the new kstrtoul functions instead of the deprecated strict_strtoul().

Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: Handle platforms without level trigger interrupts
Ido Yariv [Thu, 31 Mar 2011 08:07:01 +0000 (10:07 +0200)]
wl12xx: Handle platforms without level trigger interrupts

Some platforms are incapable of triggering on level interrupts. Add a
platform quirks member in the platform data structure, as well as an
edge interrupt quirk which can be set on such platforms.

When the interrupt is requested with IRQF_TRIGGER_RISING, IRQF_ONESHOT
cannot be used, as we might miss interrupts that occur after the FW
status is cleared and before the threaded interrupt handler exits.

Moreover, when IRQF_ONESHOT is not set, iterating more than once in the
threaded interrupt handler introduces a few race conditions between this
handler and the hardirq handler. Currently this is worked around by
limiting the loop to one iteration only. This workaround has an impact
on performance. To remove to this restriction, the race conditions will
need to be addressed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: Simplify TX blocks accounting
Ido Yariv [Thu, 31 Mar 2011 08:07:00 +0000 (10:07 +0200)]
wl12xx: Simplify TX blocks accounting

The total number of TX memory blocks may change when the dynamic memory
option is enabled. The current implementation only tracks the available
memory blocks, which over-complicates TX blocks accounting.

By tracking the number of allocated blocks, calculation of the number of
available blocks becomes simpler and cleaner. It simply equals the total
number of TX memory blocks minus the allocated ones.

Also, remove some unnecessary castings and use union member accesses
instead.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: Clean up the dummy packet mechanism
Ido Yariv [Thu, 31 Mar 2011 08:06:59 +0000 (10:06 +0200)]
wl12xx: Clean up the dummy packet mechanism

The current implementation allocates a skb each time one is requested by
the firmware. Since dummy packets are handled differently than regular
packets, the skb needs to be marked. Currently, this is done by
setting the pkt_type member to 5. This might not be safe, as we cannot
be sure that there won't be any other packets with this pkt_type value.

Since the packet does not change from one request to another, we can
simply allocate a dummy packet template and always send it. All changes
to the skb done during packet preparation must be reverted, so the same
skb can be reused.

The dummy packets are not transmitted, therefore there's no need to set
the BSSID or our own MAC address.

In addition, the header portion of the packet was zeroed by mistake, so
fix that as well.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: Clean up the block size alignment code
Ido Yariv [Thu, 31 Mar 2011 08:06:58 +0000 (10:06 +0200)]
wl12xx: Clean up the block size alignment code

Simplify and clean up the block size alignment code:
1. Set the block size according to the padding field type, as it cannot
   exceed the maximum value this field can hold.
2. Move the alignment code into a function instead of duplicating it in
   multiple places.
3. In the current implementation, the block_size member can be
   misleading because a zero value actually means that there's no need to
   align. Declare a block size alignment quirk instead.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: Clean up and fix the 128x boot sequence
Ido Yariv [Thu, 31 Mar 2011 08:06:57 +0000 (10:06 +0200)]
wl12xx: Clean up and fix the 128x boot sequence

Clean up the boot sequence code & fix the following issues:
1. Always read the registers' values and set the relevant bits instead of
   zeroing all other bits
2. Handle cases where wl1271_top_reg_read returns an error
3. Verify that the HW can detect the selected clock source
4. Remove 128x PG10 initialization code
5. Configure the MCS PLL to work in HP mode

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: fix "JOIN while associated" commentary
Ohad Ben-Cohen [Wed, 30 Mar 2011 17:18:31 +0000 (19:18 +0200)]
wl12xx: fix "JOIN while associated" commentary

Issuing multiple JOIN commands to the wl12xx's firmware, while
we're associated, might have undesired implications, so the driver
prints a message when that happens, and warn developers who check
out the source.

Update the commentary in order to consider the one valid scenario
where this can happen: roaming.

Cautiously keep the message for now, until we either gain confidence
there are no unintentional JOIN-while-associated events, or until
we move to the new multi-role fw who solves this multiple-join issue
for good.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: fix roaming
Ohad Ben-Cohen [Wed, 30 Mar 2011 14:35:59 +0000 (16:35 +0200)]
wl12xx: fix roaming

The wl12xx device normally drops all frames coming from BSSID
it is not joined with.

This behavior is configured today by the wl12xx driver in response
to a handful of ieee80211_bss_change and ieee80211_conf_changed
notification flags, such as BSS_CHANGED_ASSOC, BSS_CHANGED_BSSID,
IEEE80211_CONF_CHANGE_IDLE, etc..

This breaks when we roam to a new BSSID, where authentication frames
are sent before any BSS_CHANGED/CONF_CHANGED flags are received.
When this happens the hardware silently drops the authentication
responses, and the roaming fails.

Ideally this aggressive filtering behavior of the device should be disabled
upon a notification from mac80211. Such notification will take place
after multi-channel support will be added: mac80211 will likely send a
remain-on-channel notification to drivers when entering sensitive
states (like authentication), otherwise the firmware might jump to
different channels (to serve a different role).

Until those notifications materialize, disable the hw BSSID filter
when authentication requests are sent, so roaming would work.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: Handle duplicate calling of remove interface
Juuso Oikarinen [Tue, 29 Mar 2011 13:43:50 +0000 (16:43 +0300)]
wl12xx: Handle duplicate calling of remove interface

Because of the hardware recovery mechanism, its possible the
__wl1271_op_remove_interface is called twice. Currently, this leads to a
kernel crash even before a kernel WARNing can be issued.

Fix this.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: rearrange some ELP wake_up/sleep calls
Eliad Peller [Wed, 23 Mar 2011 20:22:15 +0000 (22:22 +0200)]
wl12xx: rearrange some ELP wake_up/sleep calls

ELP (Extremely/Enhanced Low Power, or something like that ;)) refers to
the powerstate of the 12xx chip, in which very low power is consumed,
and no commands (from the host) can be issued until the chip is woken up.

Wakeup/sleep commands must be protected by a wl->mutex, so it's generally
a good idea to call wakeup/sleep along with the mutex lock/unlock (where
needed). However, in some places the wl12xx driver calls wakeup/sleep in
some "inner" functions. This result in some "nested" wakeup/sleep calls
which might end up letting the chip go to sleep prematurely (e.g. during
event handling).

Fix it by rearranging the elp calls to come along with mutex_lock/unlock.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: configure channel/band while FW is off
Arik Nemtsov [Tue, 22 Mar 2011 08:07:47 +0000 (10:07 +0200)]
wl12xx: configure channel/band while FW is off

Initialize the channel and band from mac80211 conf even when the FW is
not yet loaded. This mitigates a bug in AP-mode where the channel was
never changed from its initial setting after FW boot and was therefore
never configured to FW.

Reported-by: Alexander Boukaty <alexanderb@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: use a bitmask instead of list of booleans in scanned_ch
Luciano Coelho [Mon, 21 Mar 2011 21:16:14 +0000 (23:16 +0200)]
wl12xx: use a bitmask instead of list of booleans in scanned_ch

We were using an array of booleans to mark the channels we had already
scanned.  This was causing a sparse error, because bool is not a type
with defined size.  To fix this, use bitmasks instead, which is much
cleaner anyway.

Thanks Johannes Berg for the idea.

Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: fix a couple of sparse warnings about undeclared functions
Luciano Coelho [Mon, 21 Mar 2011 17:26:41 +0000 (19:26 +0200)]
wl12xx: fix a couple of sparse warnings about undeclared functions

Fix the following sparse warnings:

drivers/net/wireless/wl12xx/main.c:1129:5: warning: symbol '__wl1271_plt_stop' was not declared. Should it be static?
drivers/net/wireless/wl12xx/main.c:2988:5: warning: symbol 'wl1271_op_ampdu_action' was not declared. Should it be static?

Both functions should be static.

Signed-off-by: Luciano Coelho <coelho@ti.com>
13 years agowl12xx: fix SG BT load value to reflect its new meaning
Luciano Coelho [Mon, 21 Mar 2011 15:58:32 +0000 (17:58 +0200)]
wl12xx: fix SG BT load value to reflect its new meaning

The Soft Gemini BT load ratio value has changed its meaning with FW
version 6.1.0.0.310.  It now means the passive scan compensation
percentage during A2DP EDR.  Instead of 50, we need to use 200.

Fix the SG configuration accordingly.

Signed-off-by: Luciano Coelho <coelho@ti.com>