mac80211: purge all pending ROCs on reconfig

A remain-on-channel work item may be queued, causing interfaces to start
on the wrong channel during reconfig.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl12xx: recovery elp_wakeup optimizations

We now do several optimizations related to recovery situations:

  We fail elp_wakeup if we have SDIO errors (otherwise we just waste time)

  We now call elp_wakeup inside the recovery work routine to ensure that
  FW is awake for recovery operations (such as ewading core dump, on-
  demand fwlog etc...). This is done prior to disabling wl-interrupts.

  The call to elp_wakeup was removed from userspace recovery trigger routines
  (such as libnl and debugfs) because it is now redundent

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wl12xx: fix some line spacing

Remove trailing blanks...

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wl12xx: triggering FW assert to perform recovery

Driver based FW recovery was modified. It is now trying to trigger
FW assert and waiting for WATCHDOG interrupt before continuing with
recovery.

This is done to allow FW to perform cleanups and halt gracefully
before recovery is performed. This allows for safe reading of
on-demand fwlog, core_dump, etc...

FW assert triggering is done by writing 0xcafecafe to FW address 0x1c
and then triggering PHY_RX_HEADER FW interrupt which is its highest
priority interrupt.

There is a timeout of 100ms waiting for WATCHDOG interrupt.

In case timeout is reached or we get ELP or SDIO errors, we resume
recovery without reading fwlog, core_dump, etc beacuse we assume that
FW is not responding...

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wl12xx: decrease elp timeout to 20ms

The current elp timeout set to 200 ms is too high.
While its purpose was to avoid going to ELP
during Tx/Rx the problem is that it keeps the
device awake also after issuing commands when there's
no traffic. In Android this is a real problem as
RSSI is polled by the framework every 3 seconds
and keeping the chip out of ELP for 200ms each time
has a significant power consumption effect.

Fix that by changing to 20ms. This prevents excessive
real elp sleeps and wakeups during Rx/Tx with 12xx.
There's no real need any more for setting a hard
coded 5ms while in forced_ps.

The fw won't enter elp anyways before the dynamic-ps
timeout expired as well (and it entered ps
successfully).

(Based on a similar patch by Eliad for wlcore)

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wl12xx: Copy FW log as entire mem block

FW log copy is simplified to copy the entire
memory block as FW logger utility is repsponsible
for parsing of FW log content.
(Similar commit was applied to wl18xx:
wlcore/wl18xx/wl12xx: FW log params per chip arch)

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
mac80211: purge offchannel Tx on reconfig

Offchannel Tx occuring during reconfig can cause us the low level driver
to start various operations on the wrong channel, similar to remain on
channel operations. Purge them before reconfig.

Reported-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl12xx: disable elp sleep while in plt mode

We now disable elp sleep during plt mode to allow normal operation of
plt tools such as calibrator.

Having elp_sleep enabled during plt mode is actually not required and
in fact it distupt plt operations such as rx statistics etc...

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wl12xx: check for required fw change while enable or disable role

In certain scenarios our current hooks for checking required
fw change aren't enough and we could be left in MR even though
we've gone back to a single interface. This is of course not
good as we prefer running with the SR FW which contains goodies
like BTCOEX.

An example scanerio is when running P2P GO + STA and then
removing the P2P GO.

Fix it by adding checks for fw change also while enable or
disable roles.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wl12xx: mutually exclude PLT and normal power modes

Small fix done to ensure that PLT mode and normal driver power
mode (ifconfig/add_interface) are mutually excluded.

This is partially based on wl18xx (R8) commit 6620ca8fe29d

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wl12xx: FW recovery trigger assert bug fix

The bug was in the partition mapping. It seems that .mem3 partition that
we used to write 'magic' 0xCAFECAFE to address 0x1C is actually in use (it
contains the struct part of the FW_STATUS). It is in use although the size
of the partition is set to 0

The fix was to save old partition, map a new partition with .mem part set to
address 0x1C and remap previous partition after writing 0xCAFECAFE.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
wl12xx: fix list_add/list_del

add list_del even if wl in off state

Signed-off-by: Ofir Luzon <ofirluzon@ti.com>
wl12xx: improve some debug logs

These turned out to be useful so add them.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
mac80211: warn on enabling beacon while off channel

This can cause the beaconing to start on the wrong channel.
Several such races were fixed but still add a WARN_ON as
we'd like to know if something like that still happens.

Signed-off-by: Eyal Shapira <eyal@wizery.com>