History log of /linux-master/drivers/net/wireless/ti/wlcore/wlcore.h
Revision Date Author Comments
# f0092801 12-Sep-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

wifi: wlcore: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

wlcore_remove() returned zero unconditionally. With that converted to
return void instead, the wl12xx and wl18xx driver can be converted to
.remove_new trivially.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230912171249.755901-1-u.kleine-koenig@pengutronix.de


# cb88d01b 14-Jan-2021 Tony Lindgren <tony@atomide.com>

wlcore: Fix command execute failure 19 for wl12xx

We can currently get a "command execute failure 19" error on beacon loss
if the signal is weak:

wlcore: Beacon loss detected. roles:0xff
wlcore: Connection loss work (role_id: 0).
...
wlcore: ERROR command execute failure 19
...
WARNING: CPU: 0 PID: 1552 at drivers/net/wireless/ti/wlcore/main.c:803
...
(wl12xx_queue_recovery_work.part.0 [wlcore])
(wl12xx_cmd_role_start_sta [wlcore])
(wl1271_op_bss_info_changed [wlcore])
(ieee80211_prep_connection [mac80211])

Error 19 is defined as CMD_STATUS_WRONG_NESTING from the wlcore firmware,
and seems to mean that the firmware no longer wants to see the quirk
handling for WLCORE_QUIRK_START_STA_FAILS done.

This quirk got added with commit 18eab430700d ("wlcore: workaround
start_sta problem in wl12xx fw"), and it seems that this already got fixed
in the firmware long time ago back in 2012 as wl18xx never had this quirk
in place to start with.

As we no longer even support firmware that early, to me it seems that it's
safe to just drop WLCORE_QUIRK_START_STA_FAILS to fix the error. Looks
like earlier firmware got disabled back in 2013 with commit 0e284c074ef9
("wl12xx: increase minimum singlerole firmware version required").

If it turns out we still need WLCORE_QUIRK_START_STA_FAILS with any
firmware that the driver works with, we can simply revert this patch and
add extra checks for firmware version used.

With this fix wlcore reconnects properly after a beacon loss.

Cc: Raz Bouganim <r-bouganim@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210115065613.7731-1-tony@atomide.com


# 2b27bdcc 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details you should have received a copy of the gnu general
public license along with this program if not write to the free
software foundation inc 51 franklin st fifth floor boston ma 02110
1301 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 246 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 147b502b 24-Apr-2019 Paolo Bonzini <pbonzini@redhat.com>

wlcore: simplify/fix/optimize reg_ch_conf_pending operations

Bitmaps are defined on unsigned longs, so the usage of u32[2] in the
wlcore driver is incorrect. As noted by Peter Zijlstra, casting arrays
to a bitmap is incorrect for big-endian architectures.

When looking at it I observed that:

- operations on reg_ch_conf_pending is always under the wl_lock mutex,
so set_bit is overkill

- the only case where reg_ch_conf_pending is accessed a u32 at a time is
unnecessary too.

This patch cleans up everything in this area, and changes tmp_ch_bitmap
to have the proper alignment.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 3c83dd57 01-Oct-2018 Tony Lindgren <tony@atomide.com>

wlcore: Add support for optional wakeirq

Now with wlcore using PM runtime, we can also add support for Linux
generic wakeirq handling for it if configured in the dts file.

The wakeirq can be configured as the second interrupt in the dts file
with interrupts-extended property where it is the padconf irq of the OOB
GPIO pin used for wlcore interrupt.

Note that eventually we should also allow configuring wlcore to use the
SDIO dat1 IRQ for wake-up, and in that case the the wakeirq should be
configured to be the padconf interrupt of the dat1 pin and not the
padconf interrupt of the OOB GPIO pin.

Cc: Eyal Reizer <eyalr@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# fa2648a3 19-Jun-2018 Tony Lindgren <tony@atomide.com>

wlcore: Add support for runtime PM

We can update wlcore to use PM runtime by adding functions for
wlcore_runtime_suspend() and wlcore_runtime_resume() and replacing
calls to wl1271_ps_elp_wakeup() and wl1271_ps_elp_sleep() with calls
to pm_runtime_get_sync() and pm_runtime_put().

Note that the new wlcore_runtime_suspend() and wlcore_runtime_resume()
functions are based on simplified versions of wl1271_ps_elp_sleep() and
wl1271_ps_elp_wakeup().

We don't want to use the old functions as we can now take advantage of
the runtime PM usage count. And we don't need the old elp_work at all.
And we can also remove WL1271_FLAG_ELP_REQUESTED that is no longer needed.

Pretty much the only place where we are not just converting the existing
functions is wl1271_op_suspend() where we add pm_runtime_put_noidle()
to keep the calls paired.

As the next step is to implement runtime PM autosuspend, let's not add
wrapper functions for the generic runtime PM calls. We would be getting
rid of any wrapper functions anyways.

After autoidle we should be able to start using Linux generic wakeirqs
for the padconf interrupt.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# d382b9c0 19-Aug-2017 Reizer, Eyal <eyalr@ti.com>

wlcore: add missing nvs file name info for wilink8

The following commits:
commit c815fdebef44 ("wlcore: spi: Populate config firmware data")
commit d776fc86b82f ("wlcore: sdio: Populate config firmware data")

Populated the nvs entry for wilink6 and wilink7 only while it is
still needed for wilink8 as well.
This broke user space backward compatibility when upgrading from older
kernels, as the alternate mac address would not be read from the nvs that
is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin)
causing mac address change of the wlan interface.

This patch fix this and update the structure field with the same default
nvs file name that has been used before.

In addition, some distros hold a default wl1271-nvs.bin in the file
system with a bogus mac address (deadbeef...) that overrides the mac
address that is stored inside the device.
Warn users about this bogus mac address and use the internal mac address

Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data")
Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data")
Signed-off-by: Eyal Reizer <eyalr@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# c5aa9541 24-Aug-2016 Guy Mishol <guym@ti.com>

wl18xx: add time sync configuration api

Add time sync configuration api.
The new api allows to configure the synchronization
mode (STA/AP/MESH) and (in case of Mesh mode) the
master address of each zone.

Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 57fbcce3 12-Apr-2016 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove enum ieee80211_band

This enum is already perfectly aliased to enum nl80211_band, and
the only reason for it is that we get IEEE80211_NUM_BANDS out of
it. There's no really good reason to not declare the number of
bands in nl80211 though, so do that and remove the cfg80211 one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8cf77e17 06-Mar-2016 Eliad Peller <eliad@wizery.com>

wlcore/wl18xx: add radar_debug_mode handling

Add debugfs key (under CFG80211_CERTIFICATION_ONUS
configuration) to set/clear radar_debug_mode.
In this mode, the driver simply ignores radar
events (but prints them).

The fw is notified about this mode through
a special generic_cfg_feature command.

This mode is relevant only for ap mode. look for
it when initializing ap vif.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 3719c17e 22-Dec-2015 Shahar Patury <shaharp@ti.com>

wlcore/wl18xx: fw logger over sdio

Enable the FW Logger to work over the SDIO interface in addition to over UART
interface. In the new design we use fw internal memory instead of packet ram
that was used in older (wl12xx) design. This change reduces the impact on TP
and stability.

A new event was added to notify fw logger is ready for reading. Dynamic
configuration to debugfs was added as well.

Signed-off-by: Shahar Patury <shaharp@ti.com>
Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 32677b25 18-Sep-2015 Guodong Xu <guodong.xu@linaro.org>

wlcore: align reg_ch_conf_last[] to 64bit

Align fields reg_ch_conf_last and reg_ch_conf_pending of
struct wl1271{} to 64bit.

Without this, on 64bit ARM, wlcore_set_pending_regdomain_ch() fails at
the point it calls set_bit(ch_bit_idx, (long*)wl->reg_ch_conf_pending);
Here is the error message while doing iw wlan0 scan or connect:

[ 10.666857] wlcore: IRQ work
[ 10.670046] wlcore: intr: 0x40 (fw_rx_counter = 1, drv_rx_counter = 0, tx_results_counter = 0)
[ 10.678697] wlcore: WL1271_ACX_INTR_DATA
[ 10.682810] Unhandled fault: alignment fault (0x96000021) at 0xffffffc037a817f4
[ 10.690139] Internal error: : 96000021 [#1] PREEMPT SMP
[ 10.695366] Modules linked in:
[ 10.698437] CPU: 3 PID: 894 Comm: irq/60-wl18xx Tainted: G W 4.2.0-rc6-linaro-hikey #2
[ 10.707501] Hardware name: HiKey Development Board (DT)
[ 10.712733] task: ffffffc03a9d1680 ti: ffffffc039e18000 task.ti: ffffffc039e18000
[ 10.720239] PC is at set_bit+0x14/0x30
[ 10.724002] LR is at wlcore_set_pending_regdomain_ch+0x40/0x4c

Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# d1c54096 27-Jul-2015 Guy Mishol <guym@ti.com>

wl18xx: add dynamic fw traces

add option to dynamically configure the fw
which debug traces to open

Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 6f921fab 18-Mar-2015 Luciano Coelho <luca@coelho.fi>

wlcore: set irq_trigger in board files instead of hiding behind a quirk

The platform_quirk element in the platform data was used
to change the way the IRQ is triggered. When set,
the EDGE_IRQ quirk would change the irqflags used
and treat edge trigger differently from the rest.

Instead of hiding this irq flag setting behind the quirk,
have the board files set the irq_trigger explicitly.

This will allow us to use standard irq DT definitions
later on.

Signed-off-by: Luciano Coelho <luca@coelho.fi>
[Eliad - rebase, add irq_trigger field and pass it,
update board file changes]
Signed-off-by: Eliad Peller <eliad@wizery.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>


# 1cd91b2c 28-Dec-2014 Guy Mishol <guym@ti.com>

wlcore: add dfs region to reg domain update cmd

Add dfs region to the reg domain channel update command.

Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 830513ab 28-Dec-2014 Eliad Peller <eliad@wizery.com>

wlcore: add dfs master restart calls

call wlcore_cmd_dfs_master_restart when starting
the ap on a new channel (after csa is done).

Add a new WLVIF_FLAG_BEACON_DISABLED flag to
indicate that dfs_master_restart command
is required.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 750e9d15 28-Dec-2014 Eliad Peller <eliad@wizery.com>

wl18xx: add radar detection implementation

Add support for CAC start/stop commands, and pass
radar detection events from the fw to mac80211.

Bump fw name (to wl18xx-fw-4.bin) and min fw version
(to 8.9.*.*.11), and align event mailbox accordingly.

Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# e2f1e50f 28-Dec-2014 Kobi L <kobi.lev100@gmail.com>

wlcore: enable sleep during AP mode operation

Enable ELP authorization in AP mode and enable the use
of the wakeup bit in the ELP register.

Introduce AP role sleep configuration which is disabled
by default. When configured, it allows the AP to sleep
when ELP is authorized for it.

Signed-off-by: Kobi Leibovitch <kobi.lev100@gmail.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 6d5a748d 28-Dec-2014 Ram Amrani <ramrani@ti.com>

wlcore: add ability to reduce FW interrupts during suspend

Add the ability to mask FW interrupts on RX BA activity, PSM
entry/exit and fast-link notifications. This is used when the host
is suspended in order to decrease redundant wake ups.

Signed-off-by: Ram Amrani <ramrani@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 7d3b29e5 28-Dec-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl18xx: handle rc updates in a separate work

sta_rc_update runs in atomic context. thus, a new work
should be scheduled in order to configure the fw
with the required configuration.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 5e74b3aa 10-Jul-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl18xx/wl12xx: convert bitmaps to unsigned longs

The *_bit operations expect unsigned longs.
Instead of casting the pointers, simply define various
bitmaps as unsigned long (instead of u32).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ccb1df94 10-Jul-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl18xx: add smart config commands

These commands configures the fw to set key,
enter smart config mode, and exit it.

Add relevant hw ops as well.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 633e2713 06-Feb-2014 David Spinadel <david.spinadel@intel.com>

mac80211: split sched scan IEs

Split sched scan IEs to band specific and not band specific
blocks. Common IEs blocks may be sent to the FW once per command,
instead of per band.

This allows optimization of size of the command, which may be
required by some drivers (eg. iwlmvm with newer firmware version).

As this changes the mac80211 API, update all drivers to use the
new version correctly, even if they don't (yet) make use of the
split data.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# bc566f92 10-Feb-2014 Arik Nemtsov <arik@wizery.com>

wlcore: wl18xx: allow CCK rates for AP mode

12xx chips allow only OFDM rates in AP mode for BT-Coex purposes. This
is no longer required in 18xx chips, starting with FW 8.6.0.0.8.

Update the min allowed FW version in 18xx to support this functionality.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# abf0b249 10-Feb-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl12xx/wl18xx: configure iface_combinations per-hw

Each hw supports a different iface combinations.
Define the supported combinations in each driver,
and save it in wl->iface_combinations.

Since each driver defines its own combinations now,
it can also define its max supported channels, so
we no longer need to save and set it explicitly
in wlcore.

Update wl18xx interface combinations to allow
multiple APs.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 32f0fd5b 10-Feb-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl12xx/wl18xx: configure max_stations per-hw

Each hw supports a different max stations (connected to the
same ap). add a new wl->max_ap_stations and use it instead
of the current common AP_MAX_STATIONS.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# da08fdfa 10-Feb-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl12xx/wl18xx: configure num_links per-hw

Upcoming fw versions will have different max links support
(according to the hw). Get ready for it by configuring
wl->num_links per-hw, instead of using the const WL12XX_MAX_LINKS.

However, continue using WLCORE_MAX_LINKS in order to simplify
structs declarations (we use it in multiple bitmaps, and converting
them to dynamic arrays is just cumbersome).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 75fb4df7 10-Feb-2014 Eliad Peller <eliad@wizery.com>

wlcore/wl12xx/wl18xx: simplify fw_status handling

Instead of splitting the fw_status into 2 and using some
complex calculations, read the fw status and let each low-level
driver (wl12xx/wl18xx) convert it into a common struct.

This is required for the upcoming fw api changes, which
break the current logic anyway.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 02d0727c 10-Feb-2014 Nadim Zubidat <nadimz@ti.com>

wlcore: memset wl->rx_filter_enabled to zero after recovery

zero rx_filter_enabled array after recovery to avoid
cases were the driver will keep trying to clear a
filter which is not configured in FW.

Such case will cause consecutive recoveries due to
command execution failures.

While on it, convert rx_filter_enabled to bitmap,
to save some memory and make sparse happy (it
doesn't like sizeof(bool array)).

Signed-off-by: Nadim Zubidat <nadimz@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c83cb803 08-Sep-2013 Igal Chernobelsky <igalc@ti.com>

wlcore/wl18xx/wl12xx: FW log params per chip arch

FW memory block size and FW log end marker parameters
are added to wl structure and are initialized per
chip architecture.

convert_hwaddr hw operation is added to convert chip
dependent FW internal address.

Copy from FW log is also simplified to copy the entire
memory block as FW logger utility is repsponsible
for parsing of FW log content.

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>


# 71e996be 08-Sep-2013 Eliad Peller <eliad@wizery.com>

wlcore: add ap_event_mask

Add new ap_event_mask field, to indicate events that
should be unmasked only when there's an ap interface.

This is done in order to avoid spurious wakeups
when we don't care about the incoming event anyway.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>


# 187e52cc 17-Sep-2013 Arik Nemtsov <arik@wizery.com>

wlcore: ROC on AP channel before auth reply

Start a ROC on the AP channel beforing sending the authentication reply
to a connecting STA. This ROC is held up to 1 second via a timer. If the
station is authorized and added by mac80211, the ROC is extended until
the station is fully authorized.
We make sure not to ROC twice when several stations are connecting in
parallel and to only release the ROC when both the pending-reply timer
and the STA-state callbacks do not require it.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>


# d21553f8 12-Mar-2013 Igal Chernobelsky <igalc@ti.com>

wlcore: set max num of Rx BA sessions per chip

Maximum number of supported RX BA sessions depends on chip type.
wl18xx supports 5 RX BA sessions while wl12xx supports 3.

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


# 3a0a8d96 23-Jan-2013 Luciano Coelho <coelho@ti.com>

wlcore: remove unused set_power method

There is no platform-specific set_power method anymore. Power setting
is done in the bus modules (wlcore_sdio and wlcore_spi).

Signed-off-by: Luciano Coelho <coelho@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>


# 2e07d028 28-Nov-2012 Ido Yariv <ido@wizery.com>

wlcore: Always pass DMA-able buffers to mmc functions

Some of the mmc drivers initiate DMA transfers with buffers passed from
higher layers. This means that the driver shouldn't ever pass non
DMA-able buffers, such as ones that are unaligned, allocated on the
stack or static.

Fix a couple of calls to the mmc layer in which buffers which weren't
necessarily DMA-able were passed.

[Use sizeof(*wl->buffer_32) instead of sizeof(u32) -- Luca]

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 1c33db78 29-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore: use separate HW queue for each AC in each vif

Start using the new hw_queue mechanism in mac80211 and give each AC in
each vif its own hw_queue number. This allows us to stop an AC in a vif
independently from other vifs.

Change the Tx watermark handling functions to count packets per AC in
vif. From now on fast links should not be able to hurt the throughput
of slow links on the same AC but on different vifs.

Change internal queue mgmt functions to operate per vif, to support the
new Tx watermark granularity. Make the global versions of the queue
stop/start functions to use the global mac80211 API for queue mgmt. This
helps in situations where the driver currently doesn't know all the vifs
that reside in mac80211. Recovery is a good example for such a case.

[Moved hw_base_queue addition into the wlcore_tx_get_mac80211_queue()
function; changed WARN_ONs to WARN_ON_ONCEs; simplified for loops;
fixed new checkpatch warnings. -- Luca]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 9a100968 28-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore: use link count for single-STA-PSM optimization

Only allow a PSM STA to congest FW memory when it is the single active
link. Being a single STA doesn't imply a single link - there might be
other links on other roles.

[Changed WARN_ON to WARN_ON_ONCE -- Luca]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# f1626fd8 28-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl18xx: change priority calculations for links

Update the 18xx FW status private part to include Tx related link
priorities. Introduce new HW ops to determine link priority per chip
family.

For 18xx the changes are:
- Suspended links are at most low priority and Tx for them is stopped
beyond the suspend threshold.
- Active links now get their thresholds directly from FW
- There's a new "stop" threshold for active links, at which point a link
stops receiving new packets.

Update the min 18xx FW version required to make sure suspended links
bitmap is advertised by the FW.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 530abe19 28-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: add ACX_PEER_CAP command

ACX_PEER_CAP command is just ACX_PEER_HT_CAP, but allows
configuring the peer's support rates as well.

this is needed because we start the station role when
the remote rates are not known yet.

the two commands should be unified in future fw versions,
but for now add a new set_peer_cap per-hw op, that will
use ACX_PEER_CAP for 18xx, and ACX_PEER_HT_CAP for 12xx.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# b74324d1 03-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

wlcore/wl18xx/wl12xx: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Luciano Coelho <coelho@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0e810479 26-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore: improved Tx scheduling algorithm

Prioritize EDCA by choosing the AC before anything else. Use the
fast/slow link bitmap in FW to improve the scheduling algorithm for
the multi-link scenario.

Set packet thresholds to determine if a given link is high or low
priority according to its speed. A slow link will be given high priority
if the amount of packets queued for it in the FW is lower than the
slow-threshold. Similarly, a fast link will be given high priority if
the number of its packets queued in FW is smaller than the high-threshold.

The improved algorithm:
1. Choose optimal AC according to FW utilization
2. Traversing the VIFs in a round-robin fashion, try to choose a high
priority link. Links are traversed in a round-robin fashion inside a
VIF.
3. If no high priority links are found, choose the first non-empty
(low priority) link found in the round robin.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 583f8164 26-Nov-2012 Victor Goldenshtein <victorg@ti.com>

wlcore: restore default channel configuration

wlcore allocates two static structs wl1271_band_2ghz & wl1271_band_5ghz
which are used/modified by Reg-Domain e.g. some channel might be marked
as passive at some point. Make sure we don't keep stale settings around
if the HW is unregistered/registered during operation.

[Arik - use Tx-power constant and tweak commit message]

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 2718bf40 26-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: remove WLCORE_QUIRK_NO_ELP

all the current firmwares support elp, so
we can safely remove WLCORE_QUIRK_NO_ELP.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 3ea186d1 29-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: make sure session id is always zero for AP

The 12xx FW doesn't support non-zero session ids for AP-mode. Introduce
an appropriate quirk to make sure the session id is always zero when
needed.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 8675f9ab 27-Nov-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx/wl18xx: verify multi-role and single-role fw versions

Previously we were only checking the single-role firmware version.
Now add code to check for the firmware versions separately for each
firmware type.

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


# af4e94c5 27-Nov-2012 Luciano Coelho <coelho@ti.com>

wlcore: change way of checking the firmware version

The firmwares version string contain 5 integers. We used to consider
all the digits (except for the first one, which indicates the chip) as
linearly increasing version numbers. This is not correct, because
some of the integers indicate type of firmware (eg. single-role
vs. multi-role) or the internal project it was created for.

Besides, this varies a bit from chip to chip, so we need to make the
firmware version checks more flexible (eg. allow the lower driver to
ignore some of the integers). Additionally, we need to change the
code so that we only check for a linearly increasing number on the
fields where this actually makes sense.

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


# 986f3aa1 27-Nov-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move wl12xx chip ID defines to the lower driver

Move wl12xx-specific chip ID macros to the wl12xx driver and rename
them to 127X and 128X for clarity since both the "1" (2.4GHz) and the
"3" (2.4GHz and 5GHz) variants use the same chip ID.

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


# c108c905 26-Nov-2012 Luciano Coelho <coelho@ti.com>

wlcore: gather information about firmware stability

It's sometimes useful to gather information about the firmware
stability in long test runs, especially to see if problems are
recurring frequently or not. With this commit we count the number of
times a hardware recovery was issued and print it out during recovery
and in the driver_state in debugfs.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# de40750f 26-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl18xx/wl12xx: separate channel count between chips

18xx chips are capable of staying on 2 channels at the same time.
Introduce a chip-family specific parameter to set the number of channels
in the interface-combinations published by the driver.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 5f9b6777 26-Nov-2012 Arik Nemtsov <arik@wizery.com>

wlcore: use new set bandwidth command to adjusting channel BW

We support changing the channel BW when we started the STA role on
a 40Mhz bandwidth. Otherwise a reconnection is required.
Save the started channel width and use it when channel width updates
arrive.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 10199756 22-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: call ieee80211_sched_scan_stopped on interface removal

The interface might go down before we got the SCHED_STOPPED
event, so make sure to call ieee80211_sched_scan_stopped()
if the scanned interface is removed.

Replace sched_scanning with sched_vif in order to save
the scanned interface.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 6b70e7eb 25-Nov-2012 Victor Goldenshtein <victorg@ti.com>

wlcore: add new reg-domain configuration command

In 18xx the calibration process of the PHY Cortex domain
requires to perform an active calibration of the channel
before it can be used for transmission. To fulfill world
wide regulatory restrictions, fw should be always
synchronized/updated with current CRDA configuration.
Add a new "CMD_DFS_CHANNEL_CONFIG" command to update the
fw with current reg-domain, this command passes a bit map
of channels that are allowed to be used for transmission.

The driver shall update the fw during initialization and
after each change in the current reg-domain
configuration. The driver will save the channel number of
incoming beacons during the scan process, as they might
be a result of the passive scan on
"IEEE80211_CHAN_PASSIVE_SCAN" channel and will update the
fw accordingly once the scan is finished, the purpose of
this is to be ready in case of the authentication request
on one of these disabled (uncalibrated) channels.

The new command requires to wait for the fw completion
event "DFS_CHANNELS_CONFIG_COMPLETE_EVENT".

No scan commands (including the sched scan) can be
executed concurrently with the "CMD_DFS_CHANNEL_CONFIG",
wl->mutex ensures that.

[Arik - move reset of reg_ch_conf_last to safe place inside
op_stop_locked]
[Eliad - adjust to new event waiting api]

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 978cd3a0 22-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: save session_id per-link

A new session_id is generated on link allocation.
it is saved in a global array and used later, on tx.

The new fw api adds new bcast/global_session_id
fields to start_role(ap) command, and a new session_id
field to add_peer command. align the driver with it.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# c50a2825 22-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: update events enum/struct to new fw api

The event mailbox in wl18xx has a different
(non-compatible) structure.

Create common functions in wlcore to handle the
events, and call them from the chip-specific
event mailbox parsers.

This way, each driver (wl12xx/wl18xx) extracts
the event mailbox by itself according to its
own structure, and then calls the common
wlcore functions to handle it.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# fcab1890 22-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: update channel_switch/stop_channel_switch commands

Some fields were added to the channel_switch and
stop_channel_switch commands. Unfortunately,
the new 18xx channel_switch struct is not backward
compatible with the 12xx channel switch struct.

Add a new channel_switch op to wlcore, and update
the driver accordingly.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 0a1c720c 22-Nov-2012 Eliad Peller <eliad@wizery.com>

wl18xx: increase MAX_CHANNELS_5GHZ

Some regdomains have more than 23 valid 5ghz channels,
so 18xx's MAX_CHANNELS_5GHZ was increased to 32.

Since now we have different max 5ghz channels values
for wl12xx and wl18xx, add a new wl->max_channels_5ghz
field, and use it for scan channels configuration.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 78e28062 22-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: split 18xx and 12xx scan mechanism

The scan APIs of 12xx and 18xx are totally different.
Use some common functions as much as possible (e.g.
for setting scan channels), but split scan.c into
chip-specific scan.c files, each implementing its
own scan mechanism.

(in other words - move most of the current wlcore's
scan.c into wl12xx, and implement a similar mechanism
in 18xx, according to the new api)

New wlcore ops are introduced in order to call the
chip-specific scan functions.

The template indices used for each scan (regular/scheduled)
are also different between the chips, so set the correct
indices used for each scan type after identifying the chip.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# dabf37db 20-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: implement .remain_on_channel() callback

implement the reamin_on_channel() callback by starting
a dev role (already associated with the current vif)
on the requested channel/band.

This channel is usually different from the channel
of the sta role, so pass it to wl12xx_roc() as well,
and notify mac80211 (async) when the fw is ready
on the new channel.

Now, in case of offchannel tx, we should use the dev
role hlid, instead of the sta hlid.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Reviewed-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 18eab430 20-Nov-2012 Eliad Peller <eliad@wizery.com>

wlcore: workaround start_sta problem in wl12xx fw

for some reason, the wl12xx fw is not able to rx/tx
on the first start_sta cmd.
Workaround it by issuing a dummy start_sta + stop_sta
before starting the sta for the final time.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Reviewed-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 6f8d6b20 01-Sep-2012 Ido Yariv <ido@wizery.com>

wlcore: Load the NVS file asynchronously

The NVS file is loaded by the device's probe callback with the help of
request_firmware(). Since request_firmware() relies on udevd, the
modules cannot be loaded before hotplug events are handled.

Fix this by loading the NVS file asynchronously and continue
initialization only after the firmware request is over.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>


# 3992eb2b 01-Sep-2012 Ido Yariv <ido@wizery.com>

wlcore: Refactor probe

Move most of the device-specific probe functionality into setup(), a new
op. By doing this, wlcore_probe will be the first to request a firmware
from userspace, making it easier to load the NVS file asynchronously.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>


# 001e39a8 16-Aug-2012 Eliad Peller <eliad@wizery.com>

wlcore: use dynamic keep-alive template ids

Currently, all the (station) roles use the same
keep-alive template id (0). However, the klv
template ids shouldn't be shared by different
roles.

Implement a simple klv_templates bitmap, and let
each role allocate its own klv template id on
role initialization.

[Arik - remove invalidation of KLV template when getting into "idle".
This is already handled in unjoin]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>


# f4afbed9 02-Aug-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl18xx/wl12xx: allow up to 3 mac addresses

Allow 3 native mac addresses on 18xx. On 12xx allow 2 native mac
addresses and set the LAA bit to create a third mac address. This
enabled operation with a separate group interface.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>


# 26a309c7 29-Jul-2012 Igal Chernobelsky <igalc@ti.com>

wlcore/wl18xx/wl12xx: aggregation buffer size set

Aggregation buffer size is set separately per 18xx/12xx chip family.
For 18xx aggragation buffer is set to 13 pages to utilize all
the available tx/rx descriptors for aggregation.

[Arik - remove redundant parts from the patch]

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>


# 4cc53383 24-Jul-2012 Ido Yariv <ido@wizery.com>

wlcore: Prevent interaction with HW after recovery is queued

When a function requests to recover, it would normally abort and will
not send any additional commands to the HW. However, other threads may
not be aware of the failure and could try to communicate with the HW
after a recovery was queued, but before the recovery work began.

Fix this by introducing an intermediate state which is set when recovery
is queued, and modify all state checks accordingly.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>


# ff324317 11-Jul-2012 Yair Shapira <yair.shapira@ti.com>

wlcore/wl12xx: calibrator fem detect implementation

this completes the calibrator based fem detect logic in driver:
driver starts (by calibrator) in plt_mode PLT_FEM_DETECT
wlcore inits and starts plt on wl12xx
wl12xx fetches fem number from firmware and stores it in wl->fem_manuf
wl12xx immediatly returns (doesn't start radio, etc...)
wlcore returns the fem_manuf to calibrator using WL1271_TM_ATTR_DATA
plt_mode is stopped

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 7019c80e 11-Jul-2012 Yair Shapira <yair.shapira@ti.com>

wlcore: add plt_mode including new PLT_FEM_DETECT

add wl->plt_mode that is used to indicate different plt
working modes: this will be used to implement calibrator side
auto fem detection where driver asks firmware to detect
the wlan fem radio type and returns it to calibrator.

this is not implemented yet and plt_modes: PLT_ON and
PLT_FEM_DETECT currently behave the same.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 091185d6 03-Jul-2012 Arik Nemtsov <arik@wizery.com>

wlcore: define number of supported bands internally

Avoid using the IEEE80211_NUM_BANDS constant for arrays sizes etc, as
this can contain bands unsupported by the driver (e.g. 60Ghz). Use an
internal constant to determine the number of bands.

Signed-off-by: Arik Nemtsov <arik@wizery.com>


# 3df74f46 27-Jun-2012 Yoni Divinsky <yoni.divinsky@ti.com>

wlcore: add probe request templates for sched and one-shot scans

The driver configures the firmware template for probe requests during
the scan process. If the same template is used for one-shot and sched
scans they will override each other when running scans simultaneously.

This fix works only on firmwares later than X.3.9.2.112 for single
role and X.3.9.2.23 for multi-role.

[Some cleaning-up and renaming of the quirk to something smaller --
Luca.]

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 4a1ccce8 25-Jun-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx/wl18xx: check min FW version

Refuse to boot if the FW version is too old. The minimum version is set
per chip, with the option of setting it per PG in the future.

When boot fails because of an old FW, display a helpful message.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 01b3c0e4 14-Jun-2012 Victor Goldenshtein <victorg@ti.com>

wlcore: enable sched scan while connected

New wl12xx firmware supports scheduled scans also while connected.
Stop blocking sched scan requests when connected and add a quirk to
block in hardware that don't support it (currently wl18xx doesn't).

This requires FW version 6/7.3.10.2.112 for single-role and
6/7.5.6.0.25 for multi-role.

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


# b0f0ad39 19-Jun-2012 Ido Yariv <ido@wizery.com>

wlcore: Propagate errors from wl1271_raw_write32

Propagate errors from wl1271_raw_write32 and request for recovery when
appropriate.
Also rename prefixes of wlcore functions which their prototypes had to
be changed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 6134323f 18-Jun-2012 Ido Yariv <ido@wizery.com>

wlcore: Propagate errors from wl1271_raw_read32

Propagate errors from wl1271_raw_read32. Since the read functions had no
way of returning errors in-band, change their prototypes.
Also rename prefixes of wlcore functions which their prototypes had to
be changed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# eb96f841 18-Jun-2012 Ido Yariv <ido@wizery.com>

wlcore: Propagate errors from wl1271_write

Propagate errors from wl1271_write and request for recovery when
appropriate.
Also rename prefixes of wlcore functions which their prototypes had to
be changed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 045b9b5f 17-Jun-2012 Ido Yariv <ido@wizery.com>

wlcore: Propagate errors from wl1271_read

Propagate errors from wl1271_read and request for recovery when
appropriate.
Also rename prefixes of wlcore functions which their prototypes had to
be changed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# fa2adfcd 13-Jun-2012 Arik Nemtsov <arik@wizery.com>

wl18xx: sane defaults for HT capabilities

Introduce a default set of HT capabilities that are set according to the
number of antennas on the board. Move the HT setting code down to allow
the number of antennas to be set (and optionally overridden) before it.

Remove the "mimo" HT option, since the default mode now enables MIMO is
possible.

Use this opportunity to add a helper function for setting HT
capabilities and reduce the volume of the code a bit.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 26b5858a 28-Feb-2012 Luciano Coelho <coelho@ti.com>

wlcore: add a debugfs entry to allow changing the sleep mode by hand

For FW debugging purposes, we may need to change the sleep mode
(aka. sleep_auth) by hand, and set it to the mode we want. To allow
this, a debugfs entry is added.

Now we store the sleep_auth value that has been set and use that
instead of the quirk to decide whether we should enter ELP or not.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# 9fccc82e 13-May-2012 Ido Reis <idor@ti.com>

wl18xx: pad only last frame in aggregration buffer for PG2

In PG2 only the last frame in the aggregate buffer should be
aligned to the sdio block size. This frame's header msb should be
set to 0, while in all the previous frames in the aggregation
buffer, this bit should be set to 1.

[Add a HW op for setting the frame ctrl bit only for 18xx. Other minor
cleanups - Arik]

[Make the pre_pkt_send operation optional -- Luca]

Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# afbe3718 16-May-2012 Yoni Divinsky <yoni.divinsky@ti.com>

wlcore: do not send stop fwlog cmd if fw is hanged

If the driver received a watchdog interrupt then the
assumption is that the fw is hanged. Avoid sending
the stop fwlog command in case of a watchdog recovey
to avoid waiting for the 2 seconds timeout of the command.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# a1c597f2 17-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx/wl18xx: implement op_set_key per HW arch

The 12xx set_key just calls the common wlcore_set_key function, in order
to program the keys into the FW.

The 18xx variant changes the spare block count when a GEM or TKIP
key is set. Also modify the get_spare_blocks HW op for 18xx to return
the correct numbers of spare blocks, according to what is currently
set in FW.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 2c38849f 17-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore: stop queues on Tx flush

Stop network queues during Tx flush, and also drop other internal
mac80211 packets (mgmt) that may arrive when the queues are stopped.

When flush is done all driver queues are clear, forcefully if needed.

Protect the Tx flush operation with a new mutex, to prevent concurrency
that can mess us queue state.

Based on a patch by Eliad Peller <eliad@wizery.com>

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 66396114 17-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore: add stop reason bitmap for waking/starting queues

Allow the driver to wake/stop the queues for multiple reasons. A queue
is started when no stop-reasons exist.

Convert all wake/stop queue calls to use the new API.

Before, a stopped queue was almost synonymous a high-watermark on Tx.
Remove a bit of code in wl12xx_tx_reset() that relied on it.

Internal packets arriving from mac80211 are also discarded when a queue
is stopped. A notable exception to this is the watermark reason, which
is a "soft"-stop reason. We allow traffic to gradually come to a halt,
but we don't mind spurious packets here and there. This is merely a flow
regulation mechanism.

Based on a similar patch by Eliad Peller <eliadWizery.com>.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 32bb2c03 17-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx/wl18xx: handle spare blocks spacial cases per arch

Add a HW op for getting spare blocks.

12xx cards require 2 spare blocks for GEM encrypted SKBs, regardless
of VIFs or keys programmed into the FW.

18xx cards require 2 spare blocks when there are any connected TKIP or
GEM VIFs. For now always return 2 spare blocks, as this works with all
networks. The special case TKIP/GEM functionality is added at a later
patch.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 2c0133a4 17-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx/wl18xx: introduce quirk to remove TKIP header space

18xx chips do not require extra space in the TKIP header. Introduce a
new HW quirk to allow us to make this feature arch-specific. 12xx chip
will now have this quirk.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# bfb92ca1 15-May-2012 Eliad Peller <eliad@wizery.com>

wlcore: set wl->ht_cap per-band

Save the ht_cap IE per-band, so we can configure different
params to BG and A bands (we currently don't support MIMO
on A band)

[Small fix for rx_highest - Arik]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 7140df6e 09-May-2012 Luciano Coelho <coelho@ti.com>

wlcore: create private static_data area and add operation to parse it

The wl18xx firmware has more information in the static_data than
wl12xx. To be able to parse that in an abstracted way, this patch
adds a priv area to the static data struct and an operation that
allows the lower driver to parse it if necessary.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# 4987257c 09-May-2012 Luciano Coelho <coelho@ti.com>

wlcore: abstract debugfs fw_stats to be handled by the lower drivers

The FW statistics differ from hardware to hardware. This commit
prepares for hardware-specific implementation of the FW statistics
debugfs entries.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# 0afd04e5 09-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx/18xx: split fw_status struct into two

The number of RX packet descriptors may vary from chip to chip and
in different firmware versions. Unfortunately, the array that
contains the actual descriptors is in the middle of the fw_status
structure. To manage this, we split the struct into two so we can
calculate the offset of what comes after the array and access the last
elements more easily.

[Changed the STATUS_LEN macro to be placement agnostic - Arik]

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# c331b344 09-May-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: add plt_init op and move the code to wl12xx

PLT mode needs to be initialized differently for each chip. This
patch adds an operation to init PLT and moves the existing PLT
initialization into the wl12xx driver.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# 4b4887e9 09-May-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move rx_mem_pool_addr element to wl12xx

Only wl127x chips use the rx_mem_pool_addr values, which need to be
given to the firmware as part of the RX path. Move this from core to
the wl12xx driver.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# a5d751bb 09-May-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move ref_clock and tcxo_clock elements to wl12xx

Only wl12xx needs to get the ref_clock anc tcxo_clock values from the
platform data. Move these elements from the wl1271 structure to
wl12xx's private data.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# 8388569a 09-May-2012 Luciano Coelho <coelho@ti.com>

wlcore: rename wl12xx.h to wlcore_i.h

The wl12xx.h file now contains mostly definitions that are internal to
wlcore. Still, some things need to me moved to the public header, so
for now we keep including it in wlcore.h.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>


# ebc7e57d 09-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl18xx: enable MIMO/wide-chan rates in AP-mode rate config

Add a HW op to add extra enabled rates for AP-mode data-rates. Since
the rates might depend on channel properties, reconfigure AP-mode rates
when these change.

Implement the HW op for the 18xx family, where MIMO or wide-chan rates
can be added.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 83d08d3f 09-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore: track current channel type per vif

Track the current 802.11 channel type, defaulting to a NO_HT channel.
Update the channel type element when changed by mac80211.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 169da04f 09-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl18xx: add hw op for Rx HW checksum

Some chip families can checksum certain classes of Rx packets in FW.
Implement the Rx-checksum feature as a HW-op. For the 18xx chip-family,
set Rx-checsum according to indication from FW.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 2fc28de5 09-May-2012 Arik Nemtsov <arik@wizery.com>

wlcore/wl18xx: add hw op for setting Tx HW checksum

Some chip families are capable of checksumming certain classes of Tx
packets in HW. Indicate this fact in the netdev features and perform the
HW checksum by protocol type for the 18xx family.

Fix the location of the skb network header when we move it so we can
rely on it when setting the checksum.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 5f561f68 26-Apr-2012 Bartosz.Markowski@tieto.com <Bartosz.Markowski@tieto.com>

wlcore/wl12xx: implement better beacon loss handling

Make use of REGAINED_BSS_EVENT and instead of reporting connection
loss immediately on each BEACON_LOSE event, try if not regained
in reasonable period of time.

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


# dbe0a8cd 13-Mar-2012 Eyal Shapira <eyal@wizery.com>

wlcore: add RX filters driver state mgmt functions

More prep work to support wowlan wakeup patterns.
Added some wrappers that also keep the current filters state
updated in the driver.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 6bac40a6 11-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: adapt FW status for multiple families

Add room for a private data struct at the end of the common FW status.
Add a convenience "counters" struct inside the FW status.

The wl12xx family does not currently use the FW status private data.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 80cd6610 06-Dec-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move identify firmware function to a lower driver op

Different chip families have different firmware versions, so we need
to identify the firmware to enable quirks, reject the used version
etc. in the lower drivers. This commit turns the fw_ver_quirks
function into an identify_fw operation.

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


# 4a589a6f 13-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: set HT capabilities per chip-family

Set HT capabilities in the low-level HW driver. These are then used by
wlcore when registering with mac80211.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# fa7930af 13-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op to get rate-mask for AP-link in STA mode

In some chip-families, there are operating modes where we must mask-out
certain Tx rates, and/or tweak the rate-mask with special HW-specific
bits.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# e87288f0 05-Dec-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move runtime configuration struct to the lower driver

The configuration parameters vary with different chip families. Some
of the parameters used only by some chip families, others should have
different value depending on the family. Thus move the configuration
values from wlcore to wl12xx.

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


# 5d10b195 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: expand functionality of cmd_trigger HW op

Change the cmd_trigger op to include the write of the command buffer.

Also, instead of letting the lower driver access the cmd_box_addr element
directly, we now pass the address in the trigger_cmd operation, so it
doesn't have to be exported.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 8a9affc0 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op for vif init

Add an op for family-specific vif initialization. Currently unused,
but will be needed when wl18xx support is implemented.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 9d68d1ee 01-Dec-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: add hw_init operation

Move all the wl12xx-specific hw initialization procedures into a new
hw_init op. Move some commands and ACX functions to wl12xx.

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


# f83985bb 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: turn no-Tx-align quirk into Tx-align

Inverting the quirk flag to indicate Tx-alignment. This aligns it with
the similar Rx-side quirk.

The call to wl1271_set_block_size() decides whether SDIO block size
alignment can be used or not. In case we're using SPI, we can't use
the block size alignment, so the function returns false. So we set
the quirk when wl1271_set_block_size() returns true and let the wl12xx
lower driver unset the bit for wl127x (since it doesn't support this
quirk).

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 53d67a50 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: split Tx completion to immediate/delayed

One chip family employs immediate Tx completion, where knowledge of
completed packets is given as part of the FW status. Another is only
notified of Tx completion via the FW status, and has to read the
completion status of the packets from a different location.

Implement the wl12xx tx completion as a delayed Tx completion.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 4158149c 11-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op for getting rx packet data length

There is a difference in the way chip families report the length of data
in a single Rx packet. Abstract this into a HW op. Refactor the Rx data
handling function to allocate the correct size for the data, and avoid
trimming the skb.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# b14684a0 11-Dec-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: add prepare_read hw op for Rx data

The only difference in the read_data operations is that some chips
need to prepare the data to be read before reading. So instead of
having a mandatory read_data operation, we now have an option
prepare_data operation that only needs to be implemented for chips
that require it.

In the wl12xx lower driver, we only set the prepare_data operation for
wl127x chips.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# cd70f6a4 11-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op for getting rx buffer data alignment

An aligned data buffer is such where the Ethernet portion of the packet
starts on a 4-byte boundary. Some chip families support padding the Rx
data buffer to achieve such alignment, others rely on the host to perform
it.
Implement the HW op for getting alignment state in wl12xx. Add
support for HW-padded alignment in the Rx flow.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 5766435e 11-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore: introduce Rx block-size alignment HW quirk

For chip-families that support aligned buffers in the Rx side. The Rx
flow changes slightly for these chips.

Currently these modifications rely on a hard-coded block-size of 256.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 43a8bc5a 07-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add global elements to convert hw-rates to standard rates

Rates reported by HW can be different between chip families. Make the
rate-to-idx translation tables private per family and use them in a
common translation function. Add a global element to help determine
which rates are HW HT-rates.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 6f266e91 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op for setting frame length in tx_hw_desc

Each chip family indicates the length of a frame to the HW differently.
This includes different padding, alignment and other fields in the HW Tx
descriptor.

Put all wl12xx specific code in a hw op.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 4a3b97ee 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op for setting blocks in hw_tx_desc

Each chip family has a slightly different Tx descriptor. Set the
descriptor values according to family.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# b3b4b4b8 12-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: add hw op for calculating hw block count per packet

Each chip family has a different block size and calculates the total
number of HW blocks differently, with respect to alignment.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 3edab305 07-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: change GEM Tx-spare blocks per-vif

The number of spare Tx blocks must be changed when the GEM cipher is
engaged. Track set_key() operations to see if this is the case and
change the Tx HW spare block count accordingly. Set the number of spare
blocks for each operating mode from the low level driver.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 72b0624f 07-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: set the number of Tx descriptors per chip family

Each chip family can have a different amount of Tx descriptors. These
are set on init.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 96e0c683 07-Dec-2011 Arik Nemtsov <arik@wizery.com>

wlcore/wl12xx: create per-chip-family private storage

This storage is allocated in wlcore_alloc_hw and freed in free_hw. The
size of the storage is determined by the low-level driver.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 441101f6 30-Nov-2011 Luciano Coelho <coelho@ti.com>

wlcore: add quirk to disable ELP

ELP is a very complicated process in the firmware. Due to its
complexity, in some early firmware revisions, the ELP feature is
disabled. To support this cases, this patch adds a quirk that
disables ELP mode.

When ELP is not supported, do not attempt to enter ELP when requested by
the driver.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>


# 4263c5f2 30-Nov-2011 Luciano Coelho <coelho@ti.com>

wlcore: remove some unnecessary event mailbox address reads

We were reading the even mailbox address three times, which was
completely unnecessary and complicated things regarding partition
selection. Remove the unnecessry reads and set the address for
mailbox 1 and 2 after the first read.

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


# d203e59c 29-Nov-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: add quirk for legacy NVS support

Instead of checking the chip ID directly in the wlcore code to decide
whether to use the new or the old NVS format, we now use a quirk that
should be set by the low level driver to say that it needs to use the
old format.

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


# f16ff758 11-Apr-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: add command trigger and event ack operations

Different chips may use different bits in the interrupt trigger
register. Add operations to handle these differences.

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


# 30d9b4a5 11-Apr-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move MAC address reading operation to lower driver

Different chip families have the factory MAC address written in
different places. Add a new hardware operation to read the MAC
address, if available.

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


# dd5512eb 11-Apr-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move top initialization to wl12xx

The top registers initialization is very specific to the actual
hardware used, even the way in which we read from and write to the top
registers varies from chip to chip. This patch moves all top
registers initialization to wl12xx. Also add a boot op for the wlcore
module to call at the right time and a few callbacks with the common
called to be called from the lower drivers boot operations.

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


# 4ded91ce 11-Apr-2012 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: move get_pg_ver to the lower driver

The PG version depends on the actual hardware. This commit moves the
code used to read the PG version to the lower driver, by adding the
get_pg_ver hardware operation.

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


# 6f7dd16c 29-Nov-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: add chip-specific identify chip operation

Move the code that identifies the chip ID and selects the appropriate
firmware to an operation implemented by the lower driver. Also move
the quirks definitions into wlcore.h and rename to WLCORE_QUIRK_*.

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


# 00782136 29-Nov-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: implement chip-specific register tables

Add register tables support in wlcore, add some new IO functions to
read and write to chip-specific register and data addresses. Move
some common register values from wl12xx to wlcore and add the
registers table to wl12xx.

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


# 25a43d78 21-Nov-2011 Luciano Coelho <coelho@ti.com>

wlcore/wl12xx: implement chip-specific partition tables

Add partition tables to wlcore, move and reorganize partition setting
functions. Move wl12xx partition table to use the wlcore partition
table instead.

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


# c31be25a 21-Nov-2011 Luciano Coelho <coelho@ti.com>

wl12xx/wlcore: move wl1271 struct to wlcore and add ops

In order to add chip-specific operations and prepare for future
elements that need to be set by the lower driver, move the wl1271
structure to the wlcore.h file and add an empty placeholder for the
operations structure.

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


# ffeb501c 21-Nov-2011 Luciano Coelho <coelho@ti.com>

wl12xx/wlcore: initial split of probe

We need to set some parameters (eg. partition and register tables)
during probe of the lower driver, so split the probe function, leaving
most of it in wlcore, but moving the hw struct allocation to the lower
driver.

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


# b2ba99ff 20-Nov-2011 Luciano Coelho <coelho@ti.com>

wl12xx/wlcore: spin out the wl12xx probe from wlcore to a new wl12xx

Create a new small wl12xx module that only contains the probe
functions and depends entirely on wlcore otherwise.

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