GitHub/LineageOS/android_kernel_samsung_universal7580.git
14 years agoath9k: remove unneeded calculation of minimal calibration power
Pavel Roskin [Tue, 6 Jul 2010 16:51:27 +0000 (12:51 -0400)]
ath9k: remove unneeded calculation of minimal calibration power

Remove tMinCalPower from ath9k_hw_set_def_power_cal_table(), as it's
never used.  Remove corresponding arguments of the functions calculating
that value.

Original patch by Prarit Bhargava <prarit@redhat.com>

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Fix the LED behaviour in idle unassociated state.
Vivek Natarajan [Wed, 23 Jun 2010 06:38:29 +0000 (12:08 +0530)]
ath9k: Fix the LED behaviour in idle unassociated state.

LED should be ON when the radio is put into FULL SLEEP mode during the idle
unassociated state.

Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
John W. Linville [Tue, 13 Jul 2010 19:31:51 +0000 (15:31 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-2.6

14 years agop54: update MAINTAINERS
Christian Lamparter [Mon, 12 Jul 2010 17:01:41 +0000 (19:01 +0200)]
p54: update MAINTAINERS

Michael has been out of the scene for a while now,
but despite Michael's absence, p54 is still maintained.

Cc: Michael Wu <aluminum.tape@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: merge noisefloor load implementations
Felix Fietkau [Sun, 11 Jul 2010 13:44:42 +0000 (15:44 +0200)]
ath9k: merge noisefloor load implementations

AR5008+ and AR9003 currently use two separate implementations of the
ath9k_hw_loadnf function. There are three main differences:

 - PHY registers for AR9003 are different
 - AR9003 always uses 3 chains, earlier versions are more selective
 - The AR9003 variant contains a fix for NF load timeouts

This patch merges the two implementations into one, storing the
register array in the ath_hw struct. The fix for NF load timeouts is
not just relevant for AR9003, but also important for earlier hardware,
so it's better to just keep one common implementation.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: validate the TID in the tx status information
Felix Fietkau [Sun, 11 Jul 2010 10:48:44 +0000 (12:48 +0200)]
ath9k: validate the TID in the tx status information

Occasionally the hardware can send out tx status information with the wrong
TID. In that case, the BA status cannot be trusted and the aggregate
must be retransmitted.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: report the TID in the tx status on AR5008-AR9002
Felix Fietkau [Sun, 11 Jul 2010 10:48:43 +0000 (12:48 +0200)]
ath9k_hw: report the TID in the tx status on AR5008-AR9002

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: prevent a fast channel change after a rx DMA stuck issue
Felix Fietkau [Sun, 11 Jul 2010 10:48:42 +0000 (12:48 +0200)]
ath9k_hw: prevent a fast channel change after a rx DMA stuck issue

If the receive path gets stuck, a full hardware reset is necessary to
recover from it. If this happens during a scan, the whole scan might fail,
as each channel change bypasses the full reset sequence.
Fix this by resetting the fast channel change flag if stopping the
receive path fails.

This will reduce the number of error messages that look like this:
ath: DMA failed to stop in 10 ms AR_CR=0x00000024 AR_DIAG_SW=0x40000020

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: fix an off-by-one error in the PDADC boundaries calculation
Felix Fietkau [Sun, 11 Jul 2010 10:48:41 +0000 (12:48 +0200)]
ath9k_hw: fix an off-by-one error in the PDADC boundaries calculation

PDADC values were only generated for values surrounding the target
index, however not for the target index itself, leading to a minor
error in the generated curve.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: fix a sign error in the IQ calibration code
Felix Fietkau [Sun, 11 Jul 2010 10:48:40 +0000 (12:48 +0200)]
ath9k_hw: fix a sign error in the IQ calibration code

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: fix antenna diversity on AR9285
Felix Fietkau [Sun, 11 Jul 2010 10:48:39 +0000 (12:48 +0200)]
ath9k_hw: fix antenna diversity on AR9285

On AR9285, the antenna switch configuration register uses more than just
16 bits. Because of an arbitrary mask applied to the EEPROM value that
stores this configuration, diversity was broken in some cases, leading
to a significant degradation in signal strength.
Fix this by changing the callback to return a 32 bit value and remove
the arbitrary mask.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Move driver callback functions into the ops structure
Ivo van Doorn [Sun, 11 Jul 2010 10:31:23 +0000 (12:31 +0200)]
rt2x00: Move driver callback functions into the ops structure

All callback functions are gathered in rt2x00dev->ops except
for the callback functions which are used in rt2800lib to
acces rt2800pci/usb.

Move the priv pointer from rt2x00dev to rt2x00dev->ops and
rename it to drv to make it obvious that it is the driver callback
structure.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Move common firmware loading into rt2800lib
Ivo van Doorn [Sun, 11 Jul 2010 10:30:37 +0000 (12:30 +0200)]
rt2x00: Move common firmware loading into rt2800lib

Large parts of the firmware initialization are shared
between rt2800pci and rt2800usb. Move this code into
rt2800lib.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Add missing TSF sync mode for AP operation
Helmut Schaa [Sun, 11 Jul 2010 10:30:13 +0000 (12:30 +0200)]
rt2x00: Add missing TSF sync mode for AP operation

Currently rt2x00 uses the TSF_SYNC_BEACON mode for all beaconing
interface types. However, TSF_SYNC_BEACON is meant for IBSS networks and
thus implements TSF merging in the hardware. Rename TSF_SYNC_BEACON to
TSF_SYNC_ADHOC to better express its purpose and introduce the missing
TSF sync mode TSF_SYNC_AP_NONE which should be used for beaconing modes
that don't need TSF merging.

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>
14 years agort2x00: Don't initialize beacon interval to 0 on rt2800 devices
Helmut Schaa [Sun, 11 Jul 2010 10:29:49 +0000 (12:29 +0200)]
rt2x00: Don't initialize beacon interval to 0 on rt2800 devices

Activating the TBTT interrupt when a beacon interval of 0 is configured
results in an interrupt storm causing the machine to hang. Hence,
initialize the beacon interval to a reasonable default of 100TUs.

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>
14 years agort2x00: Remove set_tim callback from PCI drivers
Helmut Schaa [Sun, 11 Jul 2010 10:29:26 +0000 (12:29 +0200)]
rt2x00: Remove set_tim callback from PCI drivers

Using the set_tim callback without managing the DTIM count and the
broad- and multicast buffering in hw, fw or the driver results in wrong
DTIM count values being sent out in beacons. Since all PCI drivers
fetch new beacons periodically and hence get an updated TIM we can just
remove the set_tim callback from these.

The rt2x00 USB drivers don't update the beacon periodically and thus
rely on the set_tim callback to get a correct TIM for beacon
transmission. USB devices still suffer from the DTIM count being wrong
under some circumstances but removing the set_tim callback from these
would cause more harm then good.

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>
14 years agort2x00: Use separate mac80211_ops for rt2800pci and rt2800usb
Helmut Schaa [Sun, 11 Jul 2010 10:28:54 +0000 (12:28 +0200)]
rt2x00: Use separate mac80211_ops for rt2800pci and rt2800usb

Use separate mac80211_ops for rt2800pci and rt2800usb in preparation
for further fixes. This shouldn't introduce functional changes.

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>
14 years agort2x00: Use pretbtt irq for fetching beacons on rt2800pci
Helmut Schaa [Sun, 11 Jul 2010 10:28:23 +0000 (12:28 +0200)]
rt2x00: Use pretbtt irq for fetching beacons on rt2800pci

Updating the beacon on pre tbtt instead of beacondone allows much lower
latency in regard to TIM updates. Hence, use the pre tbtt interrupt for
updating the beacon in rt2800pci (older devices don't provide a pre tbtt
interrupt).

Also, add a new driver flag to indicate if a driver has pre tbtt support
or not and implement the according behavior in rt2x00lib.

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>
14 years agort2x00: Implement broad- and multicast buffering
Helmut Schaa [Sun, 11 Jul 2010 10:27:58 +0000 (12:27 +0200)]
rt2x00: Implement broad- and multicast buffering

Although mac80211 buffers broad- and mutlicast frames for us in AP mode
we still have to send them out after a DTIM beacon. Implement this
behavior by sending out the buffered frames when the beacondone
interrupt is processed.

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>
14 years agort2x00: Allow beacon update without scheduling a work
Helmut Schaa [Sun, 11 Jul 2010 10:27:26 +0000 (12:27 +0200)]
rt2x00: Allow beacon update without scheduling a work

Since all rt2x00 PCI drivers use threaded interrupts now we don't need
to schedule a work just to update the beacon. The only place where the
beacon still gets updated in atomic context is from the set_tim
callback. Hence, move the work scheduling there.

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>
14 years agort2x00: Convert rt2x00 to use threaded interrupts
Helmut Schaa [Sun, 11 Jul 2010 10:26:48 +0000 (12:26 +0200)]
rt2x00: Convert rt2x00 to use threaded interrupts

Use threaded interrupts for all rt2x00 PCI devices.

This has several generic advantages:
- Reduce the time we spend in hard irq context
- Use non-atmic mac80211 functions for rx/tx

Furthermore implementing broad- and multicast buffering will be
much easier in process context while maintaining low latency and
updating the beacon just before transmission (pre tbtt interrupt)
can also be done in process context.

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>
14 years agort2x00: Make rt2800_write_beacon only export to GPL
Ivo van Doorn [Sun, 11 Jul 2010 10:26:12 +0000 (12:26 +0200)]
rt2x00: Make rt2800_write_beacon only export to GPL

rt2800_write_beacon is the only function which uses
EXPORT_SYMBOL instead of EXPORT_SYMBOL_GPL. All symbols
in rt2x00 should however use the GPL restricted export.

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>
14 years agort2x00: Implement watchdog monitoring
Ivo van Doorn [Sun, 11 Jul 2010 10:25:46 +0000 (12:25 +0200)]
rt2x00: Implement watchdog monitoring

Implement watchdog monitoring for USB devices (PCI support can
be added later). This will determine if URBs being uploaded to
the hardware are actually returning. Both rt2500usb and rt2800usb
have shown that URBs being uploaded can remain hanging without
being released by the hardware.
By using this watchdog, a queue can be reset when this occurs.
For rt2800usb it has been tested that the connection is preserved
even though this interruption.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Fix vgc_level_reg handling
Ivo van Doorn [Sun, 11 Jul 2010 10:25:17 +0000 (12:25 +0200)]
rt2x00: Fix vgc_level_reg handling

Currently vgc_level_reg and vgc_level are equal to eachother,
while the purpose of vgc_level_reg is the value last written
to the register and is remembered through link tuning resets.
The vgc_level is the currently active level, which is
reset during link tuning resets.

The usage of these variables depends on the drivers, some drivers
need both, while others need only one of the two.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Disable link tuning while scanning
Ivo van Doorn [Sun, 11 Jul 2010 10:24:47 +0000 (12:24 +0200)]
rt2x00: Disable link tuning while scanning

While scanning the link tuner must be disabled. Otherwise
it will interfere with receiving all beacons for each channel
due to changing sensitivity levels.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Rename CONFIG_DISABLE_LINK_TUNING
Ivo van Doorn [Sun, 11 Jul 2010 10:24:22 +0000 (12:24 +0200)]
rt2x00: Rename CONFIG_DISABLE_LINK_TUNING

Rename CONFIG_DISABLE_LINK_TUNING to DRIVER_SUPPORT_LINK_TUNING
Link tuning support is not only based on EEPROM decisions, but
also if the device actually supports it.

Currently only rt2500usb doesn't support link tuning because
of hardware problems. But rt2800usb is also suspected of having
problems with link tuning.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Convert AGC value from descriptor to RSSI (dBm)
Ivo van Doorn [Sun, 11 Jul 2010 10:23:50 +0000 (12:23 +0200)]
rt2x00: Convert AGC value from descriptor to RSSI (dBm)

The RSSI values in the RXWI descriptor aren't true RSSI
values. Instead they are more like the AGC values similar
to rt61pci. And as such, it needs the same conversion
before it can be passed to rt2x00lib/mac80211.

This requires the struct queue_entry to be passed to
rt2800_process_rxwi rather then the skb structure which
is contained in the queue_entry. This is required to
obtain the lna_gain information from the rt2x00_dev structure.

This fixes connection problems when using wpa_supplicant
which would try to connect to the worst AP's rather then the
best ones.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Limit txpower by eeprom values
Helmut Schaa [Sun, 11 Jul 2010 10:23:09 +0000 (12:23 +0200)]
rt2x00: Limit txpower by eeprom values

Limit the txpower per rate by the approriate values in the eeprom.
This avoids too high txpower values resulting in bad tx performance.

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>
14 years agohostap: fixup strlen() math
Dan Carpenter [Sat, 10 Jul 2010 22:10:42 +0000 (00:10 +0200)]
hostap: fixup strlen() math

In hostap_add_interface() we do:
sprintf(dev->name, "%s%s", prefix, name);

dev->name has IFNAMSIZ (16) characters.
prefix is local->dev->name.
name is "wds%d"

strlen() returns the number of characters in the string not counting the
NULL so if we have a string with 11 characters we get "12345678901wds%d"
which is 16 characters and a NULL so we're past the end of the array.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoadm8211: fix memory leak
Kulikov Vasiliy [Sat, 10 Jul 2010 12:28:57 +0000 (16:28 +0400)]
adm8211: fix memory leak

We must free priv->eeprom allocated in adm8211_read_eeprom().

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoprism54: call BUG_ON() earlier
Dan Carpenter [Sat, 10 Jul 2010 08:53:38 +0000 (10:53 +0200)]
prism54: call BUG_ON() earlier

This test is off by one because strlen() doesn't include the NULL
terminator.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: use __packed annotation
Luciano Coelho [Fri, 9 Jul 2010 11:10:58 +0000 (14:10 +0300)]
wl1271: use __packed annotation

This patch changes __attribute__ ((packed)) annotations to __packed in wl1271
code that was introduced in a recent patch in wireless-testing.

Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agolibertas: Added support for host sleep feature
Amitkumar Karwar [Thu, 8 Jul 2010 01:13:48 +0000 (06:43 +0530)]
libertas: Added support for host sleep feature

Existing "ethtool -s ethX wol X" command configures hostsleep
parameters, but those are activated only during suspend/resume,
there is no way to configure host sleep without actual suspend.

This patch adds debugfs command to enable/disable host sleep based on
already configured host sleep parameters using wol command.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agocfg80211: ignore spurious deauth
Johannes Berg [Mon, 12 Jul 2010 12:46:43 +0000 (14:46 +0200)]
cfg80211: ignore spurious deauth

Ever since mac80211/drivers are no longer
fully in charge of keeping track of the
auth status, trying to make them do so will
fail. Instead of warning and reporting the
deauthentication to userspace, cfg80211 must
simply ignore it so that spurious
deauthentications, e.g. before starting
authentication, aren't seen by userspace as
actual deauthentications.

Cc: stable@kernel.org
Reported-by: Paul Stewart <pstew@google.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoMAINTAINERS: mark adm8211 as an orphan
John W. Linville [Mon, 12 Jul 2010 20:03:07 +0000 (16:03 -0400)]
MAINTAINERS: mark adm8211 as an orphan

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoiwlagn: fix the bit mask of a FH register in stop Tx DMA flow
Emmanuel Grumbach [Tue, 29 Jun 2010 18:29:49 +0000 (11:29 -0700)]
iwlagn: fix the bit mask of a FH register in stop Tx DMA flow

When we stop the Tx DMA channels, we poll bits 16:31 in
FH_TSSR_RX_STATUS_REG. From 4965 and up, only the bits 16:26 are legal.
Bits 27:31 are not used and are always unset.
Polling them will lead to fail on timeout but since the timeout is quite
small, the stall was not felt.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
14 years agoiwlagn: more generic description for iwlagn devices
Wey-Yi Guy [Thu, 1 Jul 2010 23:45:58 +0000 (16:45 -0700)]
iwlagn: more generic description for iwlagn devices

Intel Wireless WiFi Next Gen AGN support two major categories:
 1. Intel Wireless WiFi 4965 AGN device
 2. Intel Wireless-N/Advanced-N/Ultimate-N family

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
14 years agoiwlwifi: correct descriptions of advanced ucode errors
Jay Sternberg [Fri, 2 Jul 2010 22:49:10 +0000 (15:49 -0700)]
iwlwifi: correct descriptions of advanced ucode errors

ucode errors were redefined in new ucode images and all new errors
were showing as advanced sysasserts which was misleading. new errors
are not sequential so additional lookup table added.  errors do not
overlap so both are used to support older and newer ucode images.

Signed-off-by: Jay Sternberg <jay.e.sternberg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
14 years agoiwlwifi: enable 6050 series Gen2 devices
Shanyu Zhao [Wed, 30 Jun 2010 00:27:27 +0000 (17:27 -0700)]
iwlwifi: enable 6050 series Gen2 devices

To enable 6050 series Gen 2 devices:
1) new PCI_IDs are added;
2) new EEPROM version and calibration version numbers defined;
3) new hardware REV number defined;

Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
14 years agowl1271: use per-channel max tx power passed by mac80211 when scanning
Luciano Coelho [Thu, 8 Jul 2010 14:50:08 +0000 (17:50 +0300)]
wl1271: use per-channel max tx power passed by mac80211 when scanning

We were always using the max transmit power when scanning.  Now we use the
values passed to the driver by the mac80211 stack, so that we comply with
regulations.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: rewritten scanning code
Luciano Coelho [Thu, 8 Jul 2010 14:50:07 +0000 (17:50 +0300)]
wl1271: rewritten scanning code

This patch is a complete rewrite of the scanning code.  It now includes a
state machine to scan all four possible sets of channels independently:
2.4GHz active, 2.4GHz passive, 5GHz active and 5GHz passive.  The wl1271
firmware doesn't allow these sets to be mixed, so up to several scan commands
have to be issued.  This patch also allows scanning more than 24 channels per
set, by breaking the sets into smaller parts if needed (the firmware can scan
a maximum of 24 channels at a time).

Previously, the scanning code was erroneously scanning all channels possible
actively, not complying with the CRDA values.  This is also fixed with this
patch.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: moved scan operations to a separate file
Luciano Coelho [Thu, 8 Jul 2010 14:50:06 +0000 (17:50 +0300)]
wl1271: moved scan operations to a separate file

The scanning code is going to get a bit more complex, with proper support for
active/passive scans together with 2.4GHz and 5GHz.  In the future, also a
new type of scan (periodic scan) will be added.  When all this is
implemented, the code is going to be much more complex, so we'd better
separate it into a separate file.

This patch doesn't have any impact on functionality.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Update interface to temporarily disable dynamic PS
Juuso Oikarinen [Thu, 8 Jul 2010 14:50:05 +0000 (17:50 +0300)]
wl1271: Update interface to temporarily disable dynamic PS

The mac80211 interface to temporarily disable dynamic PS changed, make
corresponding changes to the driver.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Fix warning when disconnecting and ad-hoc network
Juuso Oikarinen [Thu, 8 Jul 2010 14:50:04 +0000 (17:50 +0300)]
wl1271: Fix warning when disconnecting and ad-hoc network

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Disable dynamic PS based on BT co-ext sense events
Juuso Oikarinen [Thu, 8 Jul 2010 14:50:03 +0000 (17:50 +0300)]
wl1271: Disable dynamic PS based on BT co-ext sense events

This patch requests mac80211 to disable dynamic PSM based on sense events
coming from the firmware. Effectively, whenever there is bluetooth traffic,
the mac80211 is forced into full PSM mode.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Update hardware ARP filtering configuration handling
Juuso Oikarinen [Thu, 8 Jul 2010 14:50:02 +0000 (17:50 +0300)]
wl1271: Update hardware ARP filtering configuration handling

The interface for hardware ARP configuration changed in the mac80211. Change
driver accordingly.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: read fem manufacturer value from nvs
Luciano Coelho [Thu, 8 Jul 2010 14:50:01 +0000 (17:50 +0300)]
wl1271: read fem manufacturer value from nvs

We should read the fem manufacturer value from the NVS, so we can modify it
easily and use a consistent value throughout the configuration.  Previously
we had to set the FEM value in the NVS and in the driver's initialization
parameters.  This patch removes the latter.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Work around AP's with broken ps-poll functionality
Juuso Oikarinen [Thu, 8 Jul 2010 14:50:00 +0000 (17:50 +0300)]
wl1271: Work around AP's with broken ps-poll functionality

Some AP's (such as Zyxel Prestige 600) have totally broken ps-poll
functionality. When powersave is enabled, these AP's will set the TIM bit for
a STA in beacons, but when the STA responds with a ps-poll, the AP does not
respond with data.

The wl1271 firmware is able to send an indication to the host, when this
problem occurs. This patch adds implementation, which temporarily disables
power-save in response to this indication, allowing the AP to transmit whatever
data it has buffered for the STA / whatever data is inbound at that time.

This patch does not make these AP's work reliably in PSM, but improves the
chances of inbound data getting through.

The side effect of this patch is increased power consumption when using a
faulty AP.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Use all basic rates for ps-poll, instead of just the slowest
Juuso Oikarinen [Thu, 8 Jul 2010 14:49:59 +0000 (17:49 +0300)]
wl1271: Use all basic rates for ps-poll, instead of just the slowest

This improves ps-poll handling in WLAN PSM. It also improves performance,
including WLAN-BT co-existence reliability.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Use the ARP configuration function from mac80211
Juuso Oikarinen [Thu, 8 Jul 2010 14:49:58 +0000 (17:49 +0300)]
wl1271: Use the ARP configuration function from mac80211

This patch updates the driver to use the ARP configuration function from the
mac80211. Also, clean up IPv6 support from the ACX function as ARP is not
used with that protocol version.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Add TSF handling
Juuso Oikarinen [Thu, 8 Jul 2010 14:49:57 +0000 (17:49 +0300)]
wl1271: Add TSF handling

Add functionality to pass the current TSF (mac time) to the mac80211. This is
needed for ad-hoc merging.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Remove calibration from join command
Juuso Oikarinen [Thu, 8 Jul 2010 14:49:56 +0000 (17:49 +0300)]
wl1271: Remove calibration from join command

This patch removes the calibration performed on the first join command. The
reasoning is that this is unnecessary as devices get their calibration data
via the NVS file, and because the commands break BT coexistence.

This is actually safe, because of the implementation the calibration
was executed on the first JOIN anyway, after an ifdown/ifup the devices have
relied on the NVS for calibration anyway (== most of the time.)

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: remove wep dependency
John W. Linville [Wed, 7 Jul 2010 19:07:49 +0000 (15:07 -0400)]
mac80211: remove wep dependency

The current mac80211 code assumes that WEP is always available.  If WEP
fails to initialize, ieee80211_register_hw will always fail.

In some cases (e.g. FIPS certification), the cryptography used by WEP is
unavailable.  However, in such cases there is no good reason why CCMP
encryption (or even no link level encryption) cannot be used.  So, this
patch removes mac80211's assumption that WEP (and TKIP) will always be
available for use.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix a buffer leak in A-MPDU completion
Felix Fietkau [Wed, 7 Jul 2010 17:42:09 +0000 (19:42 +0200)]
ath9k: fix a buffer leak in A-MPDU completion

When ath_tx_complete_aggr() is called, it's responsible for returning
all buffers in the linked list. This was not done when the STA lookup
failed, leading to a race condition that could leak a few buffers when
a STA just disconnected.
Fix this by immediately returning all buffers to the free list in this case.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix a potential buffer leak in the STA teardown path
Felix Fietkau [Wed, 7 Jul 2010 17:42:08 +0000 (19:42 +0200)]
ath9k: fix a potential buffer leak in the STA teardown path

It looks like it might be possible for a TID to be paused, while still
holding some queued buffers, however ath_tx_node_cleanup currently only
iterates over active TIDs.
Fix this by always checking every allocated TID for the STA that is being
cleaned up.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoNET: nl80211, fix lock imbalance and netdev referencing
Jiri Slaby [Wed, 7 Jul 2010 13:02:46 +0000 (15:02 +0200)]
NET: nl80211, fix lock imbalance and netdev referencing

Stanse found that nl80211_set_wiphy imporperly handles a lock and netdev
reference and contains unreachable code. It is because there return statement
isntead of assignment to result variable. Fix that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jouni Malinen <j@w1.fi>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: fix memory leak in ath9k_hif_usb_alloc_urbs
Rajkumar Manoharan [Wed, 7 Jul 2010 09:49:18 +0000 (15:19 +0530)]
ath9k_htc: fix memory leak in ath9k_hif_usb_alloc_urbs

Failure cases within ath9k_hif_usb_alloc_urbs are failed
to release allocated memory.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl12xx: Use MODULE_ALIAS macro at correct postion for SPI bus
Ameya Palande [Mon, 5 Jul 2010 14:12:38 +0000 (17:12 +0300)]
wl12xx: Use MODULE_ALIAS macro at correct postion for SPI bus

(Changed title, was "wl1251: Use MODULE_ALIAS macro at correct postion
for SPI bus".  -- JWL)

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoMerge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
John W. Linville [Tue, 6 Jul 2010 18:19:01 +0000 (14:19 -0400)]
Merge branch 'wireless-next-2.6' of git://git./linux/kernel/git/iwlwifi/iwlwifi-2.6

14 years agoiwlwifi: adding enhance sensitivity table entries
Wey-Yi Guy [Mon, 28 Jun 2010 20:05:17 +0000 (13:05 -0700)]
iwlwifi: adding enhance sensitivity table entries

For newer devices (6000g2a and 6000g2b), the sensitivity table send to
uCode require additional table entries to help sensitivity calibration.

All the additional entries has fix data for now, but do expect the value
will be change in the future when device become more stable.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
14 years agoiwlwifi: generic parameter define for _agn device
Wey-Yi Guy [Thu, 24 Jun 2010 21:08:05 +0000 (14:08 -0700)]
iwlwifi: generic parameter define for _agn device

Code clean up to change name from having 5000 as part of name which easy
to confuse and think it is for 5000 series devices to more
generic _agn name since it is being used by multiple _agn devices.

No functional changes.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agoiwlwifi: debugfs file for txfifo command testing
Wey-Yi Guy [Thu, 24 Jun 2010 20:18:36 +0000 (13:18 -0700)]
iwlwifi: debugfs file for txfifo command testing

Add debugfs file for REPLY_TXFIFO_FLUSH host command testing.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agoiwlwifi: add support for device tx flush request
Wey-Yi Guy [Thu, 24 Jun 2010 20:18:35 +0000 (13:18 -0700)]
iwlwifi: add support for device tx flush request

"Flush" request can come from two different sources, it can either from
mac80211, or from device when the operation is needed. Here
adding the support for device issue "flush" request.

When receive tx complete with status is TX_STATUS_FAIL_RFKILL_FLUSH,
issue REPLY_TXFIFO_FLUSH command to uCode to flush out all the tx frames
in queues.

In this condition, since mac80211 has no knowledge of "flush" operation,
driver need to stop all the tx queues and wait for the operation
completed before wake up the queues for frames transmission.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agoiwlwifi: add mac80211 flush callback support
Wey-Yi Guy [Thu, 24 Jun 2010 20:22:36 +0000 (13:22 -0700)]
iwlwifi: add mac80211 flush callback support

Adding flush callback support in the driver. Two type of flush can be
issued by mac80211:
1. drop = true: frame drop is ok, issue REPLY_TXFIFO_FLUSH host command
to uCode to drop all the frames in tx fifo queues; then return the
control back to mac80211
2. drop = false: wait for either all the frames in tx fifo queues been
transmitted, or timeout; then return the control back to mac80211

If the flush request coming from mac80211, mac80211 will make sure there
are no additional frames push down to driver before flush operation is
completed.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agoiwlwifi: tx fifo queue flush command
Wey-Yi Guy [Thu, 24 Jun 2010 20:18:33 +0000 (13:18 -0700)]
iwlwifi: tx fifo queue flush command

Add host command and structure for tx fifo queue flush

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agoiwlwifi: add debug print for parsing firmware TLV
Wey-Yi Guy [Tue, 22 Jun 2010 21:31:45 +0000 (14:31 -0700)]
iwlwifi: add debug print for parsing firmware TLV

When parsing TLV during loading firmware, if encounter any TLV error,
log the error message to help debugging.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agoiwlwifi: fix fw_restart module parameter
Wey-Yi Guy [Mon, 21 Jun 2010 23:52:55 +0000 (16:52 -0700)]
iwlwifi: fix fw_restart module parameter

fw_restart module parameter was broken by the recent check for stuck
queue patch, driver check the fx_restart module parameter
before reload the firmware; but the stuck queue timer kick in after
firmware error and reload the firmware even fw_restart=0. In this case,
driver should not reload the firmware, it is important to help debugging
uCode error.

The only case we can ignore the module parameter is when user request
firmware reload from debugfs, which can bypass the checking and perform
firmware reload all the time.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
14 years agominstrel_ht: fix check for downgrading of top2 rate
Ming Lei [Thu, 1 Jul 2010 15:19:50 +0000 (23:19 +0800)]
minstrel_ht: fix check for downgrading of top2 rate

The check should be against current top2 rate, instead of
current top rate.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agominstrel_ht: fix updating rate with best probability
Ming Lei [Thu, 1 Jul 2010 15:18:42 +0000 (23:18 +0800)]
minstrel_ht: fix updating rate with best probability

The throughput should be considered when updating rate
with best probability.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix crash with WEP in ad-hoc mode
Felix Fietkau [Fri, 2 Jul 2010 12:45:22 +0000 (14:45 +0200)]
ath9k: fix crash with WEP in ad-hoc mode

Commit eed8e22f0133e8278b1f8079fcb452f1f9692f9d added support for using
multicast key lookup to support per-vif/sta keys for AP and ad-hoc.
Unfortunately, it also introduced a crash in ad-hoc mode when the sta
pointer is NULL, which happens when setting up an interface with WEP
keys. This patch fixes it by falling back to the assigned key index.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix false positives in the baseband hang check
Felix Fietkau [Thu, 1 Jul 2010 22:09:52 +0000 (00:09 +0200)]
ath9k: fix false positives in the baseband hang check

ath9k_hw_check_alive() occasionally returns false, as the hardware
is still processing data in a specific state. Fix this issue by
repeating the test a few times with longer delay inbetween attempts.
This gets rid of excessive hardware resets that appear frequently on
some AR9132 based devices, but could also happen on AR9280.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Björn Smedman <bjorn.smedman@venatech.se>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: clean up the noise floor calibration code to reduce code duplication
Felix Fietkau [Thu, 1 Jul 2010 22:09:51 +0000 (00:09 +0200)]
ath9k_hw: clean up the noise floor calibration code to reduce code duplication

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: sanitize noise floor values properly on all chips
Felix Fietkau [Thu, 1 Jul 2010 22:09:50 +0000 (00:09 +0200)]
ath9k_hw: sanitize noise floor values properly on all chips

This refactors the noise floor range checks to make them generic,
and adds proper ranges for each supported chip type.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: sync initvals for ar9001 and ar9002 with Atheros
Felix Fietkau [Thu, 1 Jul 2010 22:09:49 +0000 (00:09 +0200)]
ath9k_hw: sync initvals for ar9001 and ar9002 with Atheros

This includes the following changes/fixes:

 - a bugfix for stuck beacon issues
 - timing changes for improved performance
 - AGC setting improvements
 - fixes for high temperature issues on some chips

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: reformat the ar5008, ar9001 and ar9002 initvals to match ar9003
Felix Fietkau [Thu, 1 Jul 2010 22:09:48 +0000 (00:09 +0200)]
ath9k_hw: reformat the ar5008, ar9001 and ar9002 initvals to match ar9003

This format is generated by the initval tool, available at:
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/initvals-tool.git

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: fix a few inconsistencies in initval array names
Felix Fietkau [Thu, 1 Jul 2010 22:09:47 +0000 (00:09 +0200)]
ath9k_hw: fix a few inconsistencies in initval array names

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoiwlwifi: remove key information during device restart
Reinette Chatre [Mon, 21 Jun 2010 21:23:47 +0000 (14:23 -0700)]
iwlwifi: remove key information during device restart

When there is a firmware error or the firmware is reloaded for some other
reason we currently clear all station information, including keys
associated with them. A problem is that we do not clear some other
information regarding keys that are not stored in the station structs.

The consequence of this is that when the device is reconfigured after the
firmware reload we can, among other things, run out of key indices.

This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=16232
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2221

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
14 years agoath9k_htc: Add LED support for AR7010
Sujith [Wed, 30 Jun 2010 09:16:31 +0000 (14:46 +0530)]
ath9k_htc: Add LED support for AR7010

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac82011: Allow selection of minstrel_ht as default rc algorithm
Helmut Schaa [Wed, 30 Jun 2010 06:48:42 +0000 (08:48 +0200)]
mac82011: Allow selection of minstrel_ht as default rc algorithm

Allow selection of minstrel_ht as default rate control algorithm. At
the moment minstrel_ht can only be requested by the driver code but
not selected as default in make menuconfig. Fix this by using
minstrel_ht when minstrel was selected as default and minstrel_ht
is available.

This change won't affect legacy devices as minstrel_ht falls back to
minstrel in that case.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix TSF after reset on AR913x
Felix Fietkau [Wed, 30 Jun 2010 00:07:48 +0000 (02:07 +0200)]
ath9k: fix TSF after reset on AR913x

When issuing a reset, the TSF value is lost in the hardware because of
the 913x specific cold reset. As with some AR9280 cards, the TSF needs
to be preserved in software here.

Additionally, there's an issue that frequently prevents a successful
TSF write directly after the chip reset. In this case, repeating the
TSF write after the initval-writes usually works.

This patch detects failed TSF writes and recovers from them, taking
into account the delay caused by the initval writes.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Björn Smedman <bjorn.smedman@venatech.se>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Fix compile warning when debug disabled
Ivo van Doorn [Tue, 29 Jun 2010 19:49:50 +0000 (21:49 +0200)]
rt2x00: Fix compile warning when debug disabled

CC [M]  drivers/net/wireless/rt2x00/rt2800lib.o
drivers/net/wireless/rt2x00/rt2800lib.c: In function 'rt2800_ampdu_action':
drivers/net/wireless/rt2x00/rt2800lib.c:2821: warning: unused variable 'rt2x00dev'

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>
14 years agort2x00: Always set BBP_CSR_CFG_BBP_RW_MODE to 1
Ivo van Doorn [Tue, 29 Jun 2010 19:49:26 +0000 (21:49 +0200)]
rt2x00: Always set BBP_CSR_CFG_BBP_RW_MODE to 1

Latest rt2870 legacy driver also sets BBP_CSR_CFG_BBP_RW_MODE to 1
when reading or writing the EEPROM. This means we can make the
BBP reading and writing completely equal on all platforms.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Fix antenna initialization
Ivo van Doorn [Tue, 29 Jun 2010 19:49:05 +0000 (21:49 +0200)]
rt2x00: Fix antenna initialization

Legacy driver indicates that BBP1_TX_ANTENNA must be set
to 0 for TXPATH values of 1 and 3. So the previous statement
that nothing should be done for TXPATH = 3, is false.

Furthermore, remove the false BBP3_RX_ANTENNA initialization
when TXPATH is 1 for PCI and SOC devices. This field will always
be overridden in the next switch statement, making this initialization
bogus. History of this line indicates it was there from the beginning,
and was once caught as typo. Instead of replacing the line with the
correct line, the correct line was added...

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>
14 years agort2x00: Fix IEEE80211_HT_CAP_RX_STBC assignment
Ivo van Doorn [Tue, 29 Jun 2010 19:48:37 +0000 (21:48 +0200)]
rt2x00: Fix IEEE80211_HT_CAP_RX_STBC assignment

IEEE80211_HT_CAP_RX_STBC is a 2 bit flag, and should thus
never be set as normal flag. Instead we must read the number
of RX paths from the EEPROM and set the IEEE80211_HT_CAP_RX_STBC
with the correct value (using the same logic as the number of TX
streams).

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: fix beacon reset on rt2800
Helmut Schaa [Tue, 29 Jun 2010 19:48:06 +0000 (21:48 +0200)]
rt2x00: fix beacon reset on rt2800

When an interface is removed the according beacon entry should be reset.
The current approach to only clear the first word is not enough to stop
the device from sending out the beacon, hence resulting in beacons being
sent out for already removed interfaces.

Fix this by invalidating the entire TXWI in front of the beacon instead
of only the first word.

Also clear all beacons during startup in the same way.

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>
14 years agort2x00: Disable link tuning in AP mode
Helmut Schaa [Tue, 29 Jun 2010 19:47:37 +0000 (21:47 +0200)]
rt2x00: Disable link tuning in AP mode

Since the link tuning is based on average RSSI values taken from all received
frames it doesn't make sense to enable it in AP mode where every associated
station provides independent RSSI values. Furthermore the legacy drivers
don't enable link tuning in AP mode as well.

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>
14 years agort2x00: Fix beacon updates in rt61pci
Helmut Schaa [Tue, 29 Jun 2010 19:47:10 +0000 (21:47 +0200)]
rt2x00: Fix beacon updates in rt61pci

Fix rt61pci beacon updates in the same way as rt2800pci. rt61pci didn't
update the beacon template after each beacon interval, resulting in the
DTIM count being incorrect (if DTIM period > 1). Fix this by calling
rt2x00lib_beacondone after the current beacon was sent out.

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>
14 years agort2x00: Fix beacon updates in rt2800pci
Helmut Schaa [Tue, 29 Jun 2010 19:46:43 +0000 (21:46 +0200)]
rt2x00: Fix beacon updates in rt2800pci

rt2800pci didn't update the beacon template after each beacon interval,
resulting in the DTIM count being incorrect (if DTIM period > 1). Fix this
by calling rt2x00lib_beacondone after the current beacon was sent out.

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>
14 years agort2x00: Enable multiBSS in rt2800
Ivo van Doorn [Tue, 29 Jun 2010 19:45:31 +0000 (21:45 +0200)]
rt2x00: Enable multiBSS in rt2800

MAC_BSSID_DW1_BSS_ID_MASK must be set to the mask 3, to
enable 8 BSSID's. The MAC_BSSID_DW1_BSS_BCN_NUM is initialized
to 7 to enable the 8 beacons.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Tested-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Align rt2800 EEPROM validation to Ralink vendor driver.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:44:50 +0000 (21:44 +0200)]
rt2x00: Align rt2800 EEPROM validation to Ralink vendor driver.

Align with the latest versions of the Ralink legacy driver(s).

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>
14 years agort2x00: Correctly detect 93C86 EEPROMs in rt2800pci.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:44:18 +0000 (21:44 +0200)]
rt2x00: Correctly detect 93C86 EEPROMs in rt2800pci.

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>
14 years agoeeprom_93cx6: Add support for 93c86 EEPROMs.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:43:44 +0000 (21:43 +0200)]
eeprom_93cx6: Add support for 93c86 EEPROMs.

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>
14 years agort2x00: Split of TXWI writing to write_tx_data callback in rt2800usb.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:43:03 +0000 (21:43 +0200)]
rt2x00: Split of TXWI writing to write_tx_data callback in rt2800usb.

Align with the way PCI devices are handled, even though it is not
strictly necessary.

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>
14 years agort2x00: Rename driver write_tx_datadesc callback function.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:42:23 +0000 (21:42 +0200)]
rt2x00: Rename driver write_tx_datadesc callback function.

Now that the {usb,pci} specific write_tx_data functions are no longer
present we can rename the write_tx_datadesc callback function back to
its old name.

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>
14 years agort2x00: Move common txdone handling to rt2x00lib_txdone.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:41:40 +0000 (21:41 +0200)]
rt2x00: Move common txdone handling to rt2x00lib_txdone.

Now that the write_tx_data functions are merged, also merge the relevant
parts of the txdone handling into common code, rather than {usb,pci}
specific code.

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>
14 years agort2x00: Merge PCI and USB versions of write_tx_data into single function.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:41:05 +0000 (21:41 +0200)]
rt2x00: Merge PCI and USB versions of write_tx_data into single function.

Now that rt2x00pci_write_tx_data and rt2x00usb_write_tx_data are similar
we can merge them in a single function in rt2x00queue.c.

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>
14 years agort2x00: Move filling of TX URB to rt2x00usb_kick_tx_entry function.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:40:34 +0000 (21:40 +0200)]
rt2x00: Move filling of TX URB to rt2x00usb_kick_tx_entry function.

There is no need to fill the TX URB this early, and moving it to the
rt2x00usb_kick_tx_entry function allows us to merge the PCI and USB
variants of the write_tx_data function.

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>
14 years agort2x00: Fix frame dumping for USB devices.
Gertjan van Wingerde [Tue, 29 Jun 2010 19:40:02 +0000 (21:40 +0200)]
rt2x00: Fix frame dumping for USB devices.

We forgot to clear the SKBDESC_DESC_IN_SKB when the descriptor was removed
from the front of the skb.

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>
14 years agort2x00: Remove unneeded variable
Ivo van Doorn [Tue, 29 Jun 2010 19:39:29 +0000 (21:39 +0200)]
rt2x00: Remove unneeded variable

The update_bssid is set only when BSS_CHANGED_BSSID is used,
but the check if that field is true is done later in the function
but also only when BSS_CHANGED_BSSID is set. This makes the
variable useless, as it can never result in a negative check.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Write the BSSID to register when interface is added
Ivo van Doorn [Tue, 29 Jun 2010 19:38:55 +0000 (21:38 +0200)]
rt2x00: Write the BSSID to register when interface is added

For the Master mode case, we initialized the BSSID as the MAC
address, but never wrote it into the registers. This causes
Hardware crypto to break in Master mode when receiving frames
which require the BSSID to be filled in.

This is safe for STA mode since the BSSID will be initialized
to 00:00:00:00:00 at this point, but will be set to the correct
value later when the device associates.

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>