cascardo/linux.git
10 years agoath10k: fix memleak in mac setup
Michal Kazior [Mon, 22 Jul 2013 12:13:30 +0000 (14:13 +0200)]
ath10k: fix memleak in mac setup

In some cases channel arrays were never freed.

The patch also unifies error handling in the mac
setup function.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: don't reset HTC endpoints unnecessarily
Michal Kazior [Mon, 22 Jul 2013 12:13:29 +0000 (14:13 +0200)]
ath10k: don't reset HTC endpoints unnecessarily

Endpoints are re-initialized upon HTC start anyway
so there's no need to do that twice in case of
restarting HTC (i.e. in case of hardware
recovery).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: prevent HTC from being used after stopping
Michal Kazior [Mon, 22 Jul 2013 12:13:28 +0000 (14:13 +0200)]
ath10k: prevent HTC from being used after stopping

It was possible to submit new HTC commands
after/while HTC stopped. This led to memory
corruption in some rare cases.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: create debugfs interface to trigger fw crash
Michal Kazior [Mon, 22 Jul 2013 12:08:51 +0000 (14:08 +0200)]
ath10k: create debugfs interface to trigger fw crash

This can be useful for testing. To perform a
forced firmware crash write 'crash' to
'simulate_fw_crash' debugfs file. E.g.

  echo crash > /sys/kernel/debug/ieee80211/phy1/ath10k/simulate_fw_crash

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix NULL dereference for injected packets
Michal Kazior [Tue, 16 Jul 2013 09:04:54 +0000 (11:04 +0200)]
ath10k: fix NULL dereference for injected packets

Tx processing functions dereference vif and caused
NULL to be dereferenced for injected frames.

Don't call these functions at all for injected
frames. It doesn't make much sense to do so
anyway.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: implement fw crash simulation command
Michal Kazior [Tue, 16 Jul 2013 07:54:36 +0000 (09:54 +0200)]
ath10k: implement fw crash simulation command

This can be useful to test FW crash handling.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: implement device recovery
Michal Kazior [Tue, 16 Jul 2013 07:54:35 +0000 (09:54 +0200)]
ath10k: implement device recovery

Restart the hardware if FW crashes.

If FW crashes during recovery we leave the
hardware in a "wedged" state to avoid recursive
recoveries.

When in "wedged" state userspace may bring
interfaces down (to issue stop()) and then bring
one interface (to issue start()) to reload
hardware manually.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: skip fw stats debugfs interface if device is down
Michal Kazior [Tue, 16 Jul 2013 07:38:59 +0000 (09:38 +0200)]
ath10k: skip fw stats debugfs interface if device is down

If the device is not running then there may be no
FW at all to send the query to. If the FW is
already there it might still trigger a crash if
the command is sent before the device is fully
initialized.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: store firmware files in memory
Michal Kazior [Tue, 16 Jul 2013 07:38:58 +0000 (09:38 +0200)]
ath10k: store firmware files in memory

Different FW versions may provide different
functions thus mean different hw capabilities
advertised to mac80211.

It is safe to swap firmware files on disk during
driver/device runtime without worries.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: defer hw setup to start/stop mac80211 hooks
Michal Kazior [Tue, 16 Jul 2013 07:38:57 +0000 (09:38 +0200)]
ath10k: defer hw setup to start/stop mac80211 hooks

This fixes suspend-to-disk. The hardware is now
re-initialized upon freeze/thaw properly.

This also makes suspend/resume re-initialize the
hardware as WoWLAN support is not done yet.

With some little work it should be possible to
support hw reconfiguration for hw/fw recovery.

HW must be initialized once before registering to
mac80211 because FW determinates what hw
capabilities can be advertised.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: make sure all resources are freed upon ath10k_stop()
Michal Kazior [Tue, 16 Jul 2013 07:38:56 +0000 (09:38 +0200)]
ath10k: make sure all resources are freed upon ath10k_stop()

This is necessary for proper hw reconfiguration
and to avoid memory leaks.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: move free_vdev_map initialization
Michal Kazior [Tue, 16 Jul 2013 07:38:55 +0000 (09:38 +0200)]
ath10k: move free_vdev_map initialization

This is necessary for hw reconfiguration to work.
Since mac80211 is not calling remove_interface()
is such case we must reset free_vdev_map.

Also use a define instead of a hardcoded value for
vdev map initialization.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: decouple suspend code
Michal Kazior [Tue, 16 Jul 2013 07:38:54 +0000 (09:38 +0200)]
ath10k: decouple suspend code

Split up fw-related and hw-related suspension code.

Although we don't advertise WoW support to
mac80211 yet it's useful to keep the code in
suspend/resume hooks.

At this point there's no need to keep pci pm ops.
In case of WoW mac80211 calls ath10k_suspend()
which should take care of entering low-power mode.
In case WoW is not available mac80211 will go
through regular interface teradown and use start/stop.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: reset BMI state upon init
Michal Kazior [Tue, 16 Jul 2013 07:38:53 +0000 (09:38 +0200)]
ath10k: reset BMI state upon init

This is necessary if we want to be able to restart
hw on-the-fly.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: allow deferred regd update
Michal Kazior [Tue, 16 Jul 2013 07:38:52 +0000 (09:38 +0200)]
ath10k: allow deferred regd update

Regulatory domain notification hook can be called
regardless of the hw state (i.e. before start
mac80211 callback).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: decouple core start/stop logic
Michal Kazior [Tue, 16 Jul 2013 07:38:51 +0000 (09:38 +0200)]
ath10k: decouple core start/stop logic

Enables code reuse for proper hw reconfiguration
that is in turn required for proper
suspend/hibernation/wowlan support.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: decouple pci start/stop logic
Michal Kazior [Tue, 16 Jul 2013 07:38:50 +0000 (09:38 +0200)]
ath10k: decouple pci start/stop logic

Split logic that prepares the device for BMI
phase/cleans up related resources.

This is necessary for ath10k to be able to restart
hw on the fly without reloading the module.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add missing debug prints
Michal Kazior [Fri, 5 Jul 2013 13:15:17 +0000 (16:15 +0300)]
ath10k: add missing debug prints

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: abort scan properly if wmi_scan_stop fails
Michal Kazior [Fri, 5 Jul 2013 13:15:16 +0000 (16:15 +0300)]
ath10k: abort scan properly if wmi_scan_stop fails

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: improve locking
Michal Kazior [Fri, 5 Jul 2013 13:15:15 +0000 (16:15 +0300)]
ath10k: improve locking

Add more lockdep asserts and a few conf_mutex
locks. It's better to be on the safe side.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: embed HTT struct inside ath10k
Michal Kazior [Fri, 5 Jul 2013 13:15:14 +0000 (16:15 +0300)]
ath10k: embed HTT struct inside ath10k

This reduces number of allocations and simplifies
memory managemnt.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: embed HTC struct inside ath10k
Michal Kazior [Fri, 5 Jul 2013 13:15:13 +0000 (16:15 +0300)]
ath10k: embed HTC struct inside ath10k

This reduces number of allocations and simplifies
memory managemnt.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: rename hif callback
Michal Kazior [Fri, 5 Jul 2013 13:15:12 +0000 (16:15 +0300)]
ath10k: rename hif callback

The `set_callbacks` is a more appopriate name for
the function. Let's leave `init` for something
else.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: change function to take struct ath10k as arg
Michal Kazior [Fri, 5 Jul 2013 13:15:11 +0000 (16:15 +0300)]
ath10k: change function to take struct ath10k as arg

This aligns it to the argument list of other
similar functions.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: provide errno if bmi read/write fails
Michal Kazior [Fri, 5 Jul 2013 13:15:10 +0000 (16:15 +0300)]
ath10k: provide errno if bmi read/write fails

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: lower print level for a message
Michal Kazior [Fri, 5 Jul 2013 13:15:09 +0000 (16:15 +0300)]
ath10k: lower print level for a message

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: silent warning in IBSS mode
Michal Kazior [Fri, 5 Jul 2013 13:15:08 +0000 (16:15 +0300)]
ath10k: silent warning in IBSS mode

There is no TIM IE generated in IBSS beacons by
mac80211.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix typo in define name
Michal Kazior [Fri, 5 Jul 2013 13:15:07 +0000 (16:15 +0300)]
ath10k: fix typo in define name

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: remove ath10k_bus
Michal Kazior [Fri, 5 Jul 2013 13:15:06 +0000 (16:15 +0300)]
ath10k: remove ath10k_bus

It serves no purpose.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: do not setup rts/frag thresholds for suspended interfaces
Michal Kazior [Fri, 5 Jul 2013 13:15:05 +0000 (16:15 +0300)]
ath10k: do not setup rts/frag thresholds for suspended interfaces

mac80211 calls for rts/frag threshold hooks before
any interface is brought back up again when
resuming.

We would set vdev parameters before given vdev is
created lading to a FW crash.

rts/frag thresholds will be re-set accordingly in
add_interface() hook anyway.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: setup rts/frag thresholds upon vdev creation
Michal Kazior [Fri, 5 Jul 2013 13:15:04 +0000 (16:15 +0300)]
ath10k: setup rts/frag thresholds upon vdev creation

mac80211 configures rts/frag thresholds per-hw not
per-vif. ath10k FW expects those values to be set
per-vdev (i.e. per-vif).

ath10k should now respect rts/frag thresholds set
before a given interface was brought up.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix possible deadlock
Michal Kazior [Fri, 5 Jul 2013 13:15:03 +0000 (16:15 +0300)]
ath10k: fix possible deadlock

It was possible to have a deadlock due to inverted
locking of local->iflist_mtx and
ath10k->conf_mutex.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix teardown ordering
Michal Kazior [Fri, 5 Jul 2013 13:15:02 +0000 (16:15 +0300)]
ath10k: fix teardown ordering

This should fix memory corruption if HIF is tried
to be restarted.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agomwifiex: code rearrangement in sdio.c
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:56 +0000 (19:17 -0700)]
mwifiex: code rearrangement in sdio.c

Some function definitions are moved to appropriate place
to avoid forward declarations.

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>
10 years agomwifiex: handle driver initialization error paths
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:55 +0000 (19:17 -0700)]
mwifiex: handle driver initialization error paths

mwifiex_fw_dpc() asynchronously takes care of firmware download
and initialization. Currently the error paths in mwifiex_fw_dpc()
are not handled. So if wrong firmware is downloaded, required
cleanup work is not performed. memory is leaked and workqueue
remains unterminated in this case.

mwifiex_terminate_workqueue() is moved to avoid forward
declaration.

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>
10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Thu, 25 Jul 2013 20:48:01 +0000 (16:48 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

10 years agobgmac: make bgmac depend on bcm47xx
Hauke Mehrtens [Tue, 23 Jul 2013 21:28:49 +0000 (23:28 +0200)]
bgmac: make bgmac depend on bcm47xx

bgmac uses bcm47xx_nvram.h which is only available when BCM47XX was
selected. Earlier BCMA_HOST_SOC depended on BCM47XX so this was not
build on any other archs, but that changed. We should modify this
driver to get access to the nvram or the variables through platform
data.

This fixes a build problem in linux-next reported by Stephen Rothwell:

drivers/net/ethernet/broadcom/bgmac.c:19:27: fatal error: bcm47xx_nvram.h: No such file or directory
 #include <bcm47xx_nvram.h>
                           ^

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowireless: rt2x00: rt2800usb: add RT3573 devices
Xose Vazquez Perez [Tue, 23 Jul 2013 12:55:15 +0000 (14:55 +0200)]
wireless: rt2x00: rt2800usb: add RT3573 devices

taken from Ralink linux and windows drivers:

0x1b75, 0x7733 AirLive 450Mbps Wireless-N Dual Band USB Adapter
0x0b05, 0x17bc ASUS USB-N66 450Mbps Dual Band USB Adapter
0x0b05, 0x17ad ASUS USB-N66 Dual Band N Network Adapter
0x050d, 0x1103 Belkin Wireless Adapter
0x148f, 0xf301 Cameo Ralink3573 3x3 single band USB dongle
0x7392, 0x7733 Edimax
0x0e66, 0x0020 Hawking HD45U Dual Band USB Wireless-N Adapter
0x0e66, 0x0021 Hawking HD45U Dual Band Wls-450N Adapter
0x04bb, 0x094e I-O DATA WN-AG450U Wireless LAN Adapter
0x0789, 0x016b Logitec LAN-W450AN/U2
0x0846, 0x9012 NETGEAR WNDA4100 N900 Wireless Dual Band USB Adapter
0x0846, 0x9019 NETGEAR WNDA4200D Wireless Dual Band USB Adapter
0x2019, 0xed19 Planex GW-USDual450
0x148f, 0x3573 Ralink 802.11n USB Wireless LAN Card
0x0df6, 0x0067 Sitecom Wireless Dualband Network Adapter N750 X6
0x0df6, 0x006a Sitecom Wireless Dualband Network Adapter N900 X7
0x0586, 0x3421 ZyXEL Dual-Band Wireless N450 USB Adapter

Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: users@rt2x00.serialmonkey.com
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix diversity combining for AR9285
Sujith Manoharan [Tue, 23 Jul 2013 10:55:17 +0000 (16:25 +0530)]
ath9k: Fix diversity combining for AR9285

When antenna diversity combining is enabled in the EEPROM,
the initial values for the MAIN/ALT config have to be
programmed correctly. This patch adds it for AR9285.

Since the diversity combining macros are common to all chip
families, remove the redundant AR9285 macros and move the
definitions to phy.h.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: modify mwifiex_ap_sta_limits to advertise support for P2P
Avinash Patil [Tue, 23 Jul 2013 02:17:58 +0000 (19:17 -0700)]
mwifiex: modify mwifiex_ap_sta_limits to advertise support for P2P

We support maximum simultaneous 2 non-AP station interfaces and
they can assume role of Station/P2P client/P2P GO.
Advertise this support to cfg80211 so that concurrent P2P/STA
operation is possible.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: remove duplicate structure host_cmd_tlv
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:57 +0000 (19:17 -0700)]
mwifiex: remove duplicate structure host_cmd_tlv

We already have 'struct mwifiex_ie_types_header' with same
definition. Hence host_cmd_tlv is removed in this patch.

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>
10 years agomwifiex: correction in mwifiex_check_fw_status() return status
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:54 +0000 (19:17 -0700)]
mwifiex: correction in mwifiex_check_fw_status() return status

For PCIe cards, when wrong firmware is downloaded, firmware is
failed to be ready in 10 seconds. We should return an error at
this point. But currently we are sending first command to firmware.
As expected firmware doesn't respond to this command and command
timeout occurs.

This patch fixes the problem by removing unnecessary 'ret'
variable modifications in "if (ret) {" block.
The block is just supposed to update "adapter->winner" flag.

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>
10 years agomwifiex: replace mdelay with msleep
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:53 +0000 (19:17 -0700)]
mwifiex: replace mdelay with msleep

It is observed that when wrong firmware is downloaded for
PCIe card, system hangs for 10 seconds. The reason is mdelay()
is used when firmware status is polled.

Replace mdelay with msleep(non-blocking API) to fix the issue.

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>
10 years agomwifiex: reduce firmware poll retries
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:52 +0000 (19:17 -0700)]
mwifiex: reduce firmware poll retries

After downloading the firmware, firmware status is checked by
reading a register. Polling interval is 100 msecs. Therefore 100
retries means the status is checked for 10 secs which is more than
sufficient for firmware to get ready.

This patch removes 1000 retries macro usage, because 100secs
time is not practical.

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>
10 years agomwifiex: add unregister_dev handler for usb interface
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:51 +0000 (19:17 -0700)]
mwifiex: add unregister_dev handler for usb interface

Clear the data pointer stored in USB interface structure in
this handler. This helps to return from mwifiex_usb_disconnect()
if driver deinitialization is already performed while handling
an error path for mwifiex_usb_probe().

USB8797 card gets enumerated twice. First enumeration is for
firmware download and second enumeration expects firmware
initialization. mwifiex_usb_probe() always takes care of
deinitialization for first enumeration after firmware download.

Also, this change matches our handling for SDIO and PCIe
interfaces.

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>
10 years agomwifiex: move if_ops.cleanup_if() call
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:50 +0000 (19:17 -0700)]
mwifiex: move if_ops.cleanup_if() call

As if_ops.init_if() is called in mwifiex_register(),
corresponding cleanup routine should be called in
mwifiex_unregister().

Currently it's there in mwifiex_adapter_cleanup(), hence
interface specific cleanup is not performed if driver
initialization is failed.

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>
10 years agomwifiex: remove unnecessary del_timer(cmd_timer)
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:49 +0000 (19:17 -0700)]
mwifiex: remove unnecessary del_timer(cmd_timer)

It is already there in mwifiex_unregister(). So unnecessary
call in mwifiex_adapter_cleanup() is removed in this patch.

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>
10 years agomwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:48 +0000 (19:17 -0700)]
mwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak

Currently it is in mwifiex_adapter_cleanup() which doesn't get
called if driver initialization is failed causing memory leak.

scan_delay_timer is initialized in mwifiex_register(), so it
should be deleted in mwifiex_unregister(). Hence it has been
moved to appropriate place.

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>
10 years agomwifiex: add PCIe shutdown handler to avoid system hang on reboot
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:47 +0000 (19:17 -0700)]
mwifiex: add PCIe shutdown handler to avoid system hang on reboot

If reboot command is issued when device is in connected state,
system hangs while booting. This issue is fixed by doing cleanup
in shutdown handler.

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>
10 years agomwifiex: correct max IE length check for WPS IE
Avinash Patil [Tue, 23 Jul 2013 02:17:46 +0000 (19:17 -0700)]
mwifiex: correct max IE length check for WPS IE

This patch is bug fix for an invalid boundry check for WPS IE.
We should check max IE length against defined macro; instead we were
checking it against size of pointer. Fix it.
Also move IE length check before allocation of memory.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: support to send deauth for P2P client
Stone Piao [Tue, 23 Jul 2013 02:17:45 +0000 (19:17 -0700)]
mwifiex: support to send deauth for P2P client

During P2P handshake, P2P client needs to send deauth after EAPOL
FAILURE to GO. We need add bss mode for P2P client when handle deauth
request.

Without this change, deauth can not be sent out from P2P client side.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: skip registering mgmt frame that has already registered
Stone Piao [Tue, 23 Jul 2013 02:17:44 +0000 (19:17 -0700)]
mwifiex: skip registering mgmt frame that has already registered

Before sending command to firmware, we need to check the frame type.
We skip registering the mgmt frame that has already been registered.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: discard deauth and disassoc event during WPS session
Stone Piao [Tue, 23 Jul 2013 02:17:43 +0000 (19:17 -0700)]
mwifiex: discard deauth and disassoc event during WPS session

Some GO will send deauth or disassoc packet at the end of WPS
handshake, which causes P2P connecion failure due to the race
condition between event path and data path.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: add tx info to skb when forming mgmt frame
Huawei Yang [Tue, 23 Jul 2013 02:17:42 +0000 (19:17 -0700)]
mwifiex: add tx info to skb when forming mgmt frame

In function 'mwifiex_write_data_complete' it need tx info to find
the mwifiex_private to updates statistics and wake up tx queues.
Or we may trigger tx queues timeout when transmitting lots of mgmt
frames.

Signed-off-by: Huawei Yang <harvey.huawei.yang@gmail.com>
Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: delete AP TX queues when bridged packets reach threshold
Avinash Patil [Tue, 23 Jul 2013 02:17:41 +0000 (19:17 -0700)]
mwifiex: delete AP TX queues when bridged packets reach threshold

Delete packets from TX queues for this mwifiex_private structure
when bridged packet count reaches maximum threshold. Bridged packets
from each RA List are deleted till they fall to low threshold of 128.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: maintain outstanding packet count for RA list instead of packet size
Avinash Patil [Tue, 23 Jul 2013 02:17:40 +0000 (19:17 -0700)]
mwifiex: maintain outstanding packet count for RA list instead of packet size

Maintain total outstanding packet count for RA list instead of total
outstanding size as packet count metric seems more reasonable for
checking threshold etc.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: rename pkt_count to ba_pkt_count in mwifiex_ra_list_tbl struct
Avinash Patil [Tue, 23 Jul 2013 02:17:39 +0000 (19:17 -0700)]
mwifiex: rename pkt_count to ba_pkt_count in mwifiex_ra_list_tbl struct

pkt_count is used to determine if BA can be formed on this RA list
by comparing it with randomly generated BA threshold. The pkt_count
variable name here is ambiguous and does not reflect its usage
correctly. Rename it to ba_pkt_count.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: remove stop_net_dev_queue operation in AP forwarding
Huawei Yang [Tue, 23 Jul 2013 02:17:38 +0000 (19:17 -0700)]
mwifiex: remove stop_net_dev_queue operation in AP forwarding

Under uAP mode mwifiex may stop all net tx queues on forwarding
packets. This may stop some tx queues and they never have chance
to be waked up. There is also no need to check tx_pending and
stop queues here. Because local host has such kind of check when
transmitting packets and it's not proper to have forwarding affect
local transmitting.

Signed-off-by: Huawei Yang <harvey.huawei.yang@gmail.com>
Reviewed-by: Avinash Patil <patila@marvell.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoiwl3945: better skb management in rx path
Eric Dumazet [Fri, 28 Jun 2013 15:05:06 +0000 (08:05 -0700)]
iwl3945: better skb management in rx path

Steinar reported reallocations of skb->head with IPv6, leading to
a warning in skb_try_coalesce()

It turns out iwl3945 has several problems :

1) skb->truesize is underestimated.
   We really consume PAGE_SIZE bytes for a fragment,
   not the frame length.
2) 128 bytes of initial headroom is a bit low and forces reallocations.
3) We can avoid consuming a full page for small enough frames.

Reported-by: Steinar H. Gunderson <sesse@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paul Stewart <pstew@google.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: drop -Werror compiler flag
Vladimir Kondratiev [Mon, 22 Jul 2013 09:53:48 +0000 (12:53 +0300)]
wil6210: drop -Werror compiler flag

In production code, don't use -Werror,
as it causes random compilation failures due to compiler version and options used.

With every new version of gcc, it becomes stricter and report more warnings.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoMAINTAINERS: update ath6kl git location
Kalle Valo [Mon, 22 Jul 2013 09:32:27 +0000 (12:32 +0300)]
MAINTAINERS: update ath6kl git location

The git tree is in github.com nowadays.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoMAINTAINERS: add ath10k
Kalle Valo [Mon, 22 Jul 2013 09:32:20 +0000 (12:32 +0300)]
MAINTAINERS: add ath10k

I forgot to add an entry to MAINTAINERS when submitting the driver.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Enable TCP/UDP checksum HW offload
Kirshenbaum Erez [Sun, 21 Jul 2013 08:34:37 +0000 (11:34 +0300)]
wil6210: Enable TCP/UDP checksum HW offload

Add support for TCP and UDP HW checksum offloading.
RX chain is allways configured for offload mode.
In case of checksum error in RX path the DMA L4 error bit(5)
will be set to 1 and driver will drop the packet.
TX checksum offloading is configrable (ethtool -K).
TX descriptors are configured for checksum offload according
to the SKB protocol type (TCP/UDP, IPV4/6), Upon mismatch drop
the TX packet (checksum required but not TCP/UDP IPV4/6 type).

Signed-off-by: Kirshenbaum Erez <erezk@wilocity.com>
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix error path in wil_tx_vring
Vladimir Kondratiev [Sun, 21 Jul 2013 08:34:36 +0000 (11:34 +0300)]
wil6210: fix error path in wil_tx_vring

Release fragments in the order of allocation; including one for skb head

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agocw1200: Fix incorrect endianness annotation in a header field
Solomon Peachy [Sat, 20 Jul 2013 04:02:25 +0000 (00:02 -0400)]
cw1200: Fix incorrect endianness annotation in a header field

Note that the driver doesn't directly use this field, but it should be
correctly defined in any case.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Release the RF bus after setting board values
Sujith Manoharan [Tue, 16 Jul 2013 06:33:22 +0000 (12:03 +0530)]
ath9k: Release the RF bus after setting board values

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Program correct initvals for FCC
Sujith Manoharan [Tue, 16 Jul 2013 06:33:21 +0000 (12:03 +0530)]
ath9k: Program correct initvals for FCC

* CUS217 specific initvals have to be programmed.
* iniAdditional is not used for AR9462/AR9565, remove it.
* Handle channel 2484 for regulatory compliance.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Use correct channel when switching bands
Sujith Manoharan [Tue, 16 Jul 2013 06:33:20 +0000 (12:03 +0530)]
ath9k: Use correct channel when switching bands

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fix FastChannelChange for AR9462/AR9565
Sujith Manoharan [Tue, 16 Jul 2013 06:33:19 +0000 (12:03 +0530)]
ath9k: Fix FastChannelChange for AR9462/AR9565

Right now, even though these chips support cross-band
FCC, the code is non-functional since we bail out early if
the channelFlags differ. Fix this so that cross-band
FCC works for cards that support this feature.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add a HW flag for FCC
Sujith Manoharan [Tue, 16 Jul 2013 06:33:18 +0000 (12:03 +0530)]
ath9k: Add a HW flag for FCC

Fast Channel Change across 2G/5G bands is supported
only by AR9462 and AR9565. Add a HW capability field
to indicate this.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move INI overrides to ar9003_hw_override_ini
Sujith Manoharan [Tue, 16 Jul 2013 06:33:17 +0000 (12:03 +0530)]
ath9k: Move INI overrides to ar9003_hw_override_ini

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmsmac: Further reduce log spam from tx phy messages
John Greene [Mon, 15 Jul 2013 18:33:34 +0000 (14:33 -0400)]
brcmsmac: Further reduce log spam from tx phy messages

Relegate 2 phy messages to debug status as they create excessive
log spam, noted in multiple bugzillas for brcmsmac v3.8 and up.
This is a follow on to net-next 99e94940697adec4f84758adb2db71f4a82c7ba5:
brcmsmac: Reduce log spam in heavy tx, make err print in debug

 brcmsmac bcma0:0: phyerr 0x10, rate 0x14
 brcmsmac bcma0:0: brcms_c_ampdu_dotxstatus_complete:
ampdu tx phy error (0x10)

Signed-off-by: John Greene <jogreene@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: fix handling of big addrl
Hauke Mehrtens [Mon, 15 Jul 2013 11:15:08 +0000 (13:15 +0200)]
bcma: fix handling of big addrl

The return value of bcma_erom_get_addr_desc() is a unsigned value and it
could wrap around in the two complement writing. This happens for one
core in the BCM4708 SoC.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: return correct error code when bus scan failed
Hauke Mehrtens [Mon, 15 Jul 2013 11:15:07 +0000 (13:15 +0200)]
bcma: return correct error code when bus scan failed

It is better to return the actual error code than just -1.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: add constants for new ARM based SoCs
Hauke Mehrtens [Mon, 15 Jul 2013 11:15:06 +0000 (13:15 +0200)]
bcma: add constants for new ARM based SoCs

These are the chipIDs of some ARM based SoCs from the BCM47xx line.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: make it possible to select SoC support without mips
Hauke Mehrtens [Mon, 15 Jul 2013 11:15:05 +0000 (13:15 +0200)]
bcma: make it possible to select SoC support without mips

To make it possible to use the SoC host interface with ARM SoCs do not
depend on the MIPS driver any more.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: add some more core names
Hauke Mehrtens [Mon, 15 Jul 2013 11:15:04 +0000 (13:15 +0200)]
bcma: add some more core names

These cores were found on a BCM4708 (chipid 53010), this is a ARM SoC
with two Cortex A9 cores.

bcma: bus0: Found chip with id 0xCF12, rev 0x00 and package 0x02
bcma: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x2A, class 0x0)
bcma: bus0: Core 1 found: DMA (manuf 0x4BF, id 0x502, rev 0x01, class 0x0)
bcma: bus0: Core 2 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 3 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 4 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 5 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x04, class 0x0)
bcma: bus0: Core 6 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
bcma: bus0: Core 7 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
bcma: bus0: Core 8 found: ARM Cortex A9 core (ihost) (manuf 0x4BF, id 0x510, rev 0x01, class 0x0)
bcma: bus0: Core 9 found: USB 2.0 (manuf 0x4BF, id 0x504, rev 0x01, class 0x0)
bcma: bus0: Core 10 found: USB 3.0 (manuf 0x4BF, id 0x505, rev 0x01, class 0x0)
bcma: bus0: Core 11 found: SDIO3 (manuf 0x4BF, id 0x503, rev 0x01, class 0x0)
bcma: bus0: Core 12 found: ARM Cortex A9 JTAG (manuf 0x4BF, id 0x506, rev 0x01, class 0x0)
bcma: bus0: Core 13 found: Denali DDR2/DDR3 memory controller (manuf 0x4BF, id 0x507, rev 0x01, class 0x0)
bcma: bus0: Core 14 found: ROM (manuf 0x4BF, id 0x508, rev 0x01, class 0x0)
bcma: bus0: Core 15 found: NAND flash controller (manuf 0x4BF, id 0x509, rev 0x01, class 0x0)
bcma: bus0: Core 16 found: SPI flash controller (manuf 0x4BF, id 0x50A, rev 0x01, class 0x0)

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix subtle race in wil_tx_vring
Vladimir Kondratiev [Thu, 11 Jul 2013 15:03:41 +0000 (18:03 +0300)]
wil6210: fix subtle race in wil_tx_vring

Finish all SW context modifications prior to notifying hardware

It used to be race condition: if HW finish Tx and issue Tx completion IRQ very fast,
prior to SW context update in wil_tx_vring, Tx completion will mis-handle descriptor, as
SW part will have no skb pointer stored.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Introduce struct for sw context
Vladimir Kondratiev [Thu, 11 Jul 2013 15:03:40 +0000 (18:03 +0300)]
wil6210: Introduce struct for sw context

Enable adding more data to the SW context.
For now, add flag "mapped_as_page", to separate decisions on free-ing skb
and type of DMA mapping.
This allows linking skb itself to any descriptor of fragmented skb.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Optimize Tx completion
Vladimir Kondratiev [Thu, 11 Jul 2013 15:03:39 +0000 (18:03 +0300)]
wil6210: Optimize Tx completion

No need to modify HW descriptor, as it will be re-initialized on Tx.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix wrong index in wil_vring_free
Vladimir Kondratiev [Thu, 11 Jul 2013 15:03:38 +0000 (18:03 +0300)]
wil6210: fix wrong index in wil_vring_free

When destroying Rx vring, branch for Rx used wrong Tx descriptor:
while SW context was taken for "head", HW descriptor was, by mistake,
taken from "tail"

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Align WMI header with latest FW
Vladimir Kondratiev [Thu, 11 Jul 2013 15:03:37 +0000 (18:03 +0300)]
wil6210: Align WMI header with latest FW

FW guys changed header structure; align driver code

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800usb: add USB device ID for Linksys AE3000
Gabor Juhos [Mon, 8 Jul 2013 14:08:35 +0000 (16:08 +0200)]
rt2x00: rt2800usb: add USB device ID for Linksys AE3000

The Linksys AE3000 device is based on the RT3573
chipset. The support for this chipset is available
already, and the AE3000 device works with the driver.

Only managed mode works correctly at the moment,
for AP mode additional changes are needed in the
driver.

Also add a new RT2800USB_RT3573 Kconfig option and
only enable support for RT3573 based devices if
that is enabled.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800usb: use correct [RT]XWI size for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:34 +0000 (16:08 +0200)]
rt2x00: rt2800usb: use correct [RT]XWI size for RT3593

The RT3593 chipset requires different [RT]XWI size
values. Modify the driver to use the correct values.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: enable RT3593 support
Gabor Juhos [Mon, 8 Jul 2013 14:08:33 +0000 (16:08 +0200)]
rt2x00: rt2800lib: enable RT3593 support

Support for the RT3593 has been implemented in
the previous changes, so it is safe to mark it
supported in the driver.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: enable RF3053 support
Gabor Juhos [Mon, 8 Jul 2013 14:08:32 +0000 (16:08 +0200)]
rt2x00: rt2800lib: enable RF3053 support

Support for the RF3053 has been implemented in
the previous changes, so it is safe to mark it
supported in the driver.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: enable VCO recalibration for RF3053
Gabor Juhos [Mon, 8 Jul 2013 14:08:31 +0000 (16:08 +0200)]
rt2x00: rt2800lib: enable VCO recalibration for RF3053

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add channel configuration for RF3053
Gabor Juhos [Mon, 8 Jul 2013 14:08:30 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add channel configuration for RF3053

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

Reference:
  RT3593_ChipSwitchChannel in chips/rt3593.c

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add rf_vals for RF3053
Gabor Juhos [Mon, 8 Jul 2013 14:08:29 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add rf_vals for RF3053

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

References:
  FreqItems3053 in chips/rt3593.c

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add default_power3 field for three-chain devices
Gabor Juhos [Mon, 8 Jul 2013 14:08:28 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add default_power3 field for three-chain devices

The actual code uses two default TX power values.
This is enough for 1T and for 2T devices however
on 3T devices another value is needed for the third
chain.

Add a new field to struct channel_info and initialize
it from the 'rt2800_probe_hw_mode' function. Also modify
the 'rt2800_config_channel' to handle the new field as
well.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: fix LNA_A[12] gain values for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:27 +0000 (16:08 +0200)]
rt2x00: rt2800lib: fix LNA_A[12] gain values for RT3593

The LNA_A[12] gain values are stored at a different
offset in the EEPROM on RT3593 based devices. However
the current code unconditionally reads those values
from the location used by other chipsets.

Fix the code to use the correct EEPROM offset.

Based on the DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

References:
  RT3593_EEPROM_RSSI2_OFFSET_ALNAGAIN1_24G_READ in include/chip/rt3593.h
  RT3593_EEPROM_RSSI2_OFFSET_ALNAGAIN2_5G_READ in include/chip/rt3593.h

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: hardcode TX mixer gain values for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:26 +0000 (16:08 +0200)]
rt2x00: rt2800lib: hardcode TX mixer gain values for RT3593

The reference code uses hardcoded zero TX mixer gain value
for RT3593. Do the same in the rt2x00 driver.

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

Reference:
  NICReadEEPROMParameters in common/rtmp_init.c

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: introduce rt2800_get_txmixer_gain_{24,5}g helpers
Gabor Juhos [Mon, 8 Jul 2013 14:08:25 +0000 (16:08 +0200)]
rt2x00: rt2800lib: introduce rt2800_get_txmixer_gain_{24,5}g helpers

Move the TX mixer gain reading code into separate
helper functions in preparation for RT3593 support.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: fix default TX power values for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:24 +0000 (16:08 +0200)]
rt2x00: rt2800lib: fix default TX power values for RT3593

The TX power values in the EEPROM are using
a different format for the RT3593 chip. The
default TX power value uses bits 0..4 only.
Bits 5..8 contains value for fine grained
power control. Additionally, the lower and
upper limits of the TX power values are the
same for both bands.

Improve the rt2800_txpower_to_dev function,
in order to compute the correct default power
values for the RT3593 chip as well.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add rt2800_txpower_to_dev helper
Gabor Juhos [Mon, 8 Jul 2013 14:08:23 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add rt2800_txpower_to_dev helper

Introduce a new helper function for converting
the default TX power values from EEPROM into
mac80211 values.

The change improves the readability and it makes
it easier to add support for other chipsets.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: fix antenna configuration for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:22 +0000 (16:08 +0200)]
rt2x00: rt2800lib: fix antenna configuration for RT3593

On the RT3593 chipset, BBP register 86 must be
configured by different values based on the RX
antenna numbers.

Configure this register from the 'rt2800_config_ant'
function.

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

Reference:
  RT3593_CONFIG_SET_BY_ANTENNA in include/chip/rt3593.h

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: fix BBP1_TX_ANTENNA field configuration for 3T devices
Gabor Juhos [Mon, 8 Jul 2013 14:08:21 +0000 (16:08 +0200)]
rt2x00: rt2800lib: fix BBP1_TX_ANTENNA field configuration for 3T devices

The field must be set to 2 instead of 0 for
devices with three TX chains.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add TX power configuration for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:20 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add TX power configuration for RT3593

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

References:
  RTMPReadTxPwrPerRateExt in chips/rt3593.c
  RT3593_AsicGetTxPowerOffset in chips/rt3593.c

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add BBP post initialization for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:19 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add BBP post initialization for RT3593

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

Reference:
  RT3593_PostBBPInitialization in chips/rt3553.c

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: rt2800lib: add RFCSR register initialization for RT3593
Gabor Juhos [Mon, 8 Jul 2013 14:08:18 +0000 (16:08 +0200)]
rt2x00: rt2800lib: add RFCSR register initialization for RT3593

Based on the Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

References:
  NICInitRT3593RFRegisters in chips/rt3593.c
  RT3593LoadRFNormalModeSetup in chips/rt3593.c

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>