wlcore: Fix sdio out-of-sync power state (EXP)

wl1271_sdio_power_off() manually powers down the card, regardless of the
runtime pm state. If wl1271_sdio_power_on() is called before the card
was suspended by runtime PM, it will not power up the card.

As part of the HW detection, the chip's power is toggled. Since this
happens in the context of probing sdio, the power reference counter will
be higher than zero. As a result, when wl1271_sdio_power_off() is
called, the chip will be powered down while still having a positive
power reference counter. If the interface is quickly activated, the
driver might try to transfer data to a powered off chip.

Fix this by ensuring that wl1271_sdio_power_on() explicitly powers on
the chip in case runtime pm claims the chip is already powered on.

Also verify that the chip is indeed powered on before powering off, to
avoid wrong reference counter values in error cases.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
omap: blaze: initialize sdp4430_clk32kg to always_on (INTERNAL)

Signed-off-by: Luciano Coelho <coelho@ti.com>
HACK: quick extremely dirty hack to get rid of warning SPAM (INTERNAL)

This simply avoids getting a load of warnings like this when running
on OMAP:

[ 1568.144378] BUG: sleeping function called from invalid context at include/linux/freezer.h:46
[ 1568.144714] in_atomic(): 0, irqs_disabled(): 128, pid: 1615, name: ntpd
[ 1568.144714] INFO: lockdep is turned off.
[ 1568.144714] irq event stamp: 0
[ 1568.144714] hardirqs last  enabled at (0): [<  (null)>]   (null)
[ 1568.174133] hardirqs last disabled at (0): [<c00419c4>] copy_process+0x3ec/0x105c
[ 1568.174133] softirqs last  enabled at (0): [<c00419c4>] copy_process+0x3ec/0x105c
[ 1568.174133] softirqs last disabled at (0): [<  (null)>]   (null)
[ 1568.189880] [<c001e1e4>] (unwind_backtrace+0x0/0x148) from [<c0501afc>] (dump_stack+0x20/0x24)
[ 1568.205261] [<c0501afc>] (dump_stack+0x20/0x24) from [<c0077048>] (__might_sleep+0x130/0x134)
[ 1568.205261] [<c0077048>] (__might_sleep+0x130/0x134) from [<c0018998>] (do_signal+0x54/0x600)
[ 1568.223175] [<c0018998>] (do_signal+0x54/0x600) from [<c0018fa4>] (do_notify_resume+0x60/0x6c)
[ 1568.223175] [<c0018fa4>] (do_notify_resume+0x60/0x6c) from [<c00154e4>] (work_pending+0x24/0x28)

With this hack, it doesn't mean that your device will not crash to the
point of no return! Use it at your own risk.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wl18xx: release OCP bridge (yield issue) (INTERNAL)

Some PDSP Registers wake up value is such that OCP
bridge is stuck, this happens randomly.
Toggle BT and PHY reset till OCP is free during boot.

Signed-off-by: Orit Brayer <orit@ti.com>
Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
mac80211: function for low-level drivers to set netdev bits (INTERNAL)

Allow low-level drivers to change the feature bit for a vif's underlying
net_device struct.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wl18xx: use vif-init HW op setting netdev features (INTERNAL)

Use the vif_init op in the 18xx family to indicate support for
Tx HW-checksum in the netdev features.

Note: will be replaced with a HW init op

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
mac80211: add op to configure default key id to driver (INTERNAL)

When hw_accel is enabled and encryption type is set to WEP,
the driver should get the default key index from mac80211.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wl12xx: set default_wep_key when configured (INTERNAL)

When associating to an AP with WEP set the
default key upon association by implementing
the set_deafult_key_idx op.

Fixes auto-arp sent with wrong key_idx bug.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore: android: add wake_locks (INTERNAL)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore: android: set "any" trigger by default (INTERNAL)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
mac80211: don't stop beaconing when going offchannel (INTERNAL)

wl12xx manages the channel per-role, so there is no need
to explicitly stop beaconing when doing offchannel operations,
as the device will take care of it by itself.

This way we avoid redundant stop_ap/start_ap calls when
doing offchannel operations on another vif (e.g. auth)

NOTE: this patch shouldn't go upstream. we have to come up
with more generic multi-channel solution...

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore: wait for ROLE_STOP_COMPLETED event (INTERNAL)

We previously didn't wait for this event, as it wasn't
necessary, and sometimes the fw didn't send it.

However, this event is now needed again for some roaming
scenarios. if we'll encounter cases in which we don't get
the event - they will be treated as fw bugs.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore/wl18xx/wl12xx: add version and timestamp strings (INTERNAL)

In order to allow better version control, add version
and timestamp strings into the wl12xx module.

These strings will be printed on driver load, and when
reading the driver_state.

(this is not going to work well in compat, because it
copies all the files instead of compiling them in the
original tree, so the version of the compat tree will
appear as the driver version. we can workaround it
with the additional makefile hacks...)

NOTE: I couldn't find how to make one module recompile
when the .h file of another module was changed, so i
just duplicated it for now.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore: force recheck of version.h and use -dirty if needed (INTERNAL)

If the tree was changed and unstaged or if a new tag was added, we
were not regenerating the version.h file, so it would contain outdated
information.

To fix this, force the version.h file to be rechecked during make and
use __TIMESTAMP__ instead of using the shell's date command, so that
we don't regenerate it everytime.

Additionally, use --dirty in git describe to mark dirty trees as such.

Thanks Eliad for the help with this.

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

wlcore/wl12xx/wl18xx: don't force version check everytime (SQUASH)

With compat-wireless, we shouldn't force the version.h file checks,
otherwise it will overwrite what we generated in compat-wireless
itself.  This was only needed for dirty trees anyway.  The side-effect
is that the version will not be regenerated when the tree becomes
dirty.

Should be squashed with c062da59.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore/wl12xx/wl18xx: move version prints to module init (INTERNAL)

It's good to print out the driver version as early as possible, so we
can also catch problems with the probe.  Move the version info to init.

Also, change "compilation time" to "timestamp", because it doesn't
mean the compile time anymore but the modification time of the source
file that generates it.

Signed-off-by: Luciano Coelho <coelho@ti.com>
wlcore/wl12xx/wl18xx: add version.h to a new .gitignore file (INTERNAL)

This file is generated by the build process and we should not store it.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
mac80211: mark stopped sched scan only after driver does (INTERNAL)

Change internal state in mac80211 only after the driver
reports that sched scan was actually stopped.

Signed-off-by: Luciano Coelho <coelho@ti.com>
nl80211: report stopped sched scan only after driver does (INTERNAL)

Report NL80211_CMD_SCHED_SCAN_STOPPED and change internal
states in cfg80211 only after the driver reports that
sched scan was actually stopped.

Signed-off-by: Luciano Coelho <coelho@ti.com>
nl80211/cfg80211: add 'scan_cancel' command (INTERNAL)

Mostly from an energy consumption and cpu load perspective,
it can be useful to stop a triggered scan earlier, when one
finds the desired scan results.
Adding the ability to stop a scan from user space by exposing
new NL80211_CMD_SCAN_CANCEL API.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
mac80211: add 'scan_cancel' command (INTERNAL)

Implementing the scan_cancel operation in the mac80211,
by calling existing ieee80211_scan_cancel() function.

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