wl1271: Fix memory leak in scan command handling

This patch fixes a memory leak in the scan command handling code.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Configure clock-request drive mode to open-drain

This patch configures the wl1271 chipset clock-request line to be
driver in open-drain mode instead of push-pull.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Warnings caused by wrong format specifiers fixed

There were wrong format specifiers in wl1271_sdio.c in some debug
outputs. This has been causing warnings on some platforms.

Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Fix memory leak in cmd_data_path

Fix a trivial memory leak in cmd_data_path.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Update busyword checking mechanism

After the busy-words, if the firmware did not complete by the end of the
first (fixed) busy-word, a flip of the CS line is required to enable clocking
out the actual read data.

This patch changes the mechanism such that the CS line is flipped after each
busyword.

Also, the busy-word mechanism is finally enabled, and the number of fixed
busywords reduced to the minimum.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Remove device MAC-address randomization

This patch removes the MAC address randomization from the driver. This removes
a nasty Nokia-OUI dependency from the driver.

With this patch, unless an address is explicitly configured to the driver
by the user, only a zero address will be configured, and the driver will be
unable to start.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: wait for join command complete event

Poll for join command completion instead of waiting blindly for 10 msecs.
There is a timeout of 100 msecs, if the command doesn't complete by then, we
return an error code.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: wait for disconnect command complete event

Wait for the DISCONNECT_EVENT_COMPLETE_ID event after sending a disconnect
command.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: remove deprecated usage of RX status noise

The noise element in the ieee80211_rx_status struct has been deprecated in
commit "mac80211: deprecate RX status noise".  Remove the usage of this
element from wl1271_rx.c to avoid warnings.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Disable connection monitoring while not associated

The wl1271 does not support disabling the connection monitor feature.
Perform the next best thing by increasing the beacon-loss threshold and
BSS_LOSE event timeout to the maximum values.

This is needed, because we really don't want any random probe-requests during
scanning or especially while in ad-hoc mode and not beaconing.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Fix ad-hoc mode handling

Fix the driver to better reflect the ad-hoc related configuration from the
mac80211.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Update beacon interval properly for ad-hoc

Configure the hardware beacon interval to whatever requested by the
mac80211.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Removed checking of PSM from handling BSS_LOST_EVENT

Change the driver to call ieee80211_beacon_loss function always when
BSS_LOST_EVENT is received. Reason for the change is that entering PSM
might fail before driver receives BSS_LOST_EVENT. In such case the
driver would disable PSM and the stack would not be notified about beacon
loss and connection loss detection would be delayed by tens of seconds.

Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Fix memory leak in firmware crash scenario

The driver tx-queue flush operation leaks broadcast-frames. This leak occurs
if the driver is shut down while there are frames in TX buffers (such as in
a firmware crash scenario.) Fix the leak.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Configure probe-request template when associated

Configure a probe-request template to the wl1271 when associated - the
wl1271 will use this to attempt to recover a connection when beacon loss
is detected.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
wl1271: Disconnect if PSM entry fails

If PSM entry fails despite of retries, assume that the AP has been lost,
and indicate connection loss to the mac80211. This is much safer than
remaining in active mode.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Activate SDIO for WL12XX