History log of /drivers/net/wireless/ti/wlcore/wlcore.h
Revision Date Author Comments
5e74b3aa6ffd80128e3df605bf27d8a6a3c04997 11-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>
ccb1df948085abcac0a91154e9cabeb563b65833 11-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>
633e27132625a0692440c4db58b901fb3cb67c55 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>
bc566f9203c2813a2e083677eb99c62b1cb14d03 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>
abf0b24912640c4fa94b0a2f22ee9d51c8521b16 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>
32f0fd5b700064f821105be041d0075decc4ec64 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>
da08fdfaf09f161c923c9d2b7db2fba8cc9c457c 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>
75fb4df7f804229372e073977615a149a4a28dc0 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>
02d0727ca3b0bc8194bd69cd52ddf9e4e2910890 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>
c83cb8031bdd7923c7c5ea87accede4a5fc3282a 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>
71e996bef90b23919f627a38367b9e8b44b77d37 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>
187e52cc3c9f5ee64136f8b5c4edcb4cf94693e7 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>
d21553f8900f735d2caedd1c6db75dbd67e5ab9e 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>
3a0a8d961e20132272887d9826738ce9b4d818f7 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>
2e07d02828759a506b5205b2cff40daa58df5bf7 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>
1c33db782d1d0d9be83feacbb065cd4956f485e7 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>
9a1009684df5295883ba2eb85066a23ed3c3f6a6 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>
f1626fd8983a5bc68ce2879865cce297eb96c0b4 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>
530abe195df6918d43c9381fd9a70b7e16d55036 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>
b74324d1048271240f65b2d91816d15e72dd80dd 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>
0e81047996fdde7fc9e8a1c01d532df1f53586fa 27-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>
583f81644ab34a1314827a1dffc7fc8fbad7dc0f 27-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>
2718bf409937655f9b0bbc174faee3ac2ecf1062 27-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>
3ea186d137f79da5e6af283e5803715da1eb6259 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>
8675f9abdf5b67a3f621fa99e1f0e0c8d8ae2531 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>
af4e94c56581b446b2010854a983ef722ad9ed1f 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>
986f3aa1666b4ef1e9e30672c73e19742b8abfd9 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>
c108c90535ae29099de88187a90b8411bc1fe9a1 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>
de40750f4b10aa236ae44a9a3f10f50998e1c345 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>
5f9b67770be4201f4449b0f180effecaac4e2686 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>
1019975640ec16d1753c06ac99207f4af6a721a2 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>
6b70e7eb70cd6c5ad445ec02f74b84131a4c721a 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>
978cd3a0b82969c1f85942e208f8a00412964ef6 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>
c50a282515dc7092f7318708a0f3ae7ca7342b9f 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>
fcab189027cdd68df7f97474d1419aaa4a82130c 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>
0a1c720c63be74bbfe416fa085d0783348e4d69b 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>
78e28062fea51c62280cd17fe6143ed583f83ba0 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>
dabf37dba405565ab46f4d1821c781730285b9ed 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>
18eab430700dc877bae38cf04f0b0574b4724f0a 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>
6f8d6b20bb0bdda333e781faf775db14cb4660dd 02-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>
3992eb2bf2b1f6d244cf527c922c0cbd810e69c5 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>
001e39a8effd5a9774153ca6ca67849a93b95852 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>
f4afbed9447c86e5d3cec5933ae74b902617987c 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>
26a309c7586140afd40628a7031993afbaae0f07 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>
4cc533830b7e6b309e8b73196c410951fc2bed91 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>
ff324317e6133ed4a88380eb675a93c76a9e0d5e 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>
7019c80eead86d246a7b6697011bc37b2bdd8539 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>
091185d6bc77d8177fe894b35d64d3ad081c7c30 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>
3df74f46d88e39a032eb2cc3f2a571b66082acba 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>
4a1ccce852882c174d2392d2d8db1d65f48d4a10 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>
01b3c0e4df483affb076405f129aa45bc2cde499 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>
b0f0ad39e3d2716fe9ca6e50ce4cda87eb409ee0 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>
6134323f42b0dbae8e8206414d26cb167b9bedfc 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>
eb96f841b9563ba34969be25615548635728faf5 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>
045b9b5f4172b2b21af0b9bf5e6dda51146d51a4 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>
fa2adfcdbd88124e8b7cc46c6363b1343dabc09d 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>
26b5858a67e4316ecd8159e2c0dc5591ef68226a 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>
9fccc82e19db0d63741cd6c3d2a8829fc8854406 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>
afbe37185c0ecad3442791be666b6851eba52318 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>
a1c597f2b22cdc228de3c58784b00e80b9b53e03 18-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>
2c38849f4a247673c8203a569444042e32d82410 18-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>
6639611467f34038aa63c5cb9f8d9e48171d6022 18-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>
32bb2c03f990d015c0fec67e9134ea8625aaf784 18-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>
2c0133a437905591cdaa39cf65a3f7188d20a094 18-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>
bfb92ca1332ce0073cfba5d8a7caee214ed3a787 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>
7140df6e51ecca70e8963f18e9836e62090221c2 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>
4987257c304bf5d12e7a5cedde1100ba7f14a8a3 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>
0afd04e5e5d8db505fbb0f98c6306242c0006503 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>
c331b344d5def33194427b24cb2190ff345f7f55 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>
4b4887e9710158dca6efd3646ba87f1da03ebe8b 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>
a5d751bb9298360f5547d30734aed4a54a8af3e4 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>
8388569a34396fccee22ae8348ca624959694ce0 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>
ebc7e57ddd01ffa4c996dde7095746259693755d 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>
83d08d3ff385c810a341a5c1b97a8c81df96673d 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>
169da04f523bafee46993b1efbddb913641aad56 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>
2fc28de5989e1c40fee4e92e2a8f3bdd47b1b34a 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>
5f561f686b90f51d97a1a6985175860200e55a2d 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>
dbe0a8cdb2ce1a9ea52805169dd06a8812bcd741 14-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>
6bac40a63aae9d0942496c9f350dbb7a6c88e3fa 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>
80cd661097f3cb1dcfe45cac983c55d03cdcf64d 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>
4a589a6f38cbde9500f8b5c350b0a03ca2b3fef0 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>
fa7930afa525e7f481f9d6984a301f69c2255ee4 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>
e87288f089d3ba1c10d2323c286f8145450fd250 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>
5d10b1957d4dd7b5f854a224fb30cc564405d4d9 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>
8a9affc08d676a9fe627361ab6767cdec0740af3 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>
9d68d1eea7fb4d05b5bd037da6a66329d640b2f1 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>
f83985bb5f8f0f25d44ab7b108a709a52aa1c5e0 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>
53d67a50cd17aca120dff20eb2a93e1665361688 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>
4158149c24e6f933809bc6fe03dbc3fb218b935b 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>
b14684a00439b7b154e63be9446fba19281b8bbc 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>
cd70f6a48b3fbb841a127361ee4ac0752f9d29a2 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>
5766435e2f704d0b2ec071639dcfd8f039aeb674 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>
43a8bc5a53c78b69b99824c9f38c333cea024c8a 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>
6f266e912c0733e77f63e9ad245db3c966b75942 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>
4a3b97eea216135cd37e6d3a4a6c551c201a6615 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>
b3b4b4b812018a06221b6d7b88a5540fccae2940 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>
3edab305dfd48415074a36f1cdd605dcae8463de 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>
72b0624fa5b766133fd0be9099724324b1f0d70e 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>
96e0c6837bb2db2f00d00f5295d0e9467e24a99f 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>
441101f67818cf5aaba7081fb05c8604a55c0949 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>
4263c5f27c0403ad750c4f2509e5396e630b6e6e 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>
d203e59c4b56d56916a804ebeb04b0e6d92adf4c 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>
f16ff75872b04fa6c779367ae24146c8a1729f2e 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>
30d9b4a58bc168620eed0fc6d90b2f05cd02a462 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>
dd5512eb6b8317069e80d70a624b6d350afebc9e 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>
4ded91ced98c3d35c0d36e9ac5e69589f7aad04a 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>
6f7dd16cb125468a5393861c22fbecfb52dd9653 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>
00782136b4d6e2316e0a2a55f3b1fba160e9576e 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>
25a43d78eb63281294793fdaab6108bef81d7648 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>
c31be25a7144ebc9b7a22128909bac7654d4c46b 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>
ffeb501c6cba803eefc46b570feccffe61a6d883 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>
b2ba99ff327f43684993c47a0f34bfa48f2ac210 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>