11 years agowl1251: Add support for idle mode compat-wireless master
Jarkko Nikula [Mon, 4 Apr 2011 08:04:58 +0000 (11:04 +0300)]
wl1251: Add support for idle mode

On Nokia N900 the wl1251 consumes the most power when the interface is up
but not associated to access point (that supports PSM). In terms of battery
current consumption, the consumption is ~180 mA higher when the interface is
up but not associated and only ~5 mA higher when associated compared to
interface down and driver not loaded cases.

This patch adds support for the mac80211 idle notifications. Chip is put into
idle very much the same way when entering into PSM by utilizing the Extreme
Low Power (ELP) mode. I.e. idle is entered by setting necessary conditions
in wl1251_ps_set_mode followed by a call to wl1251_ps_elp_sleep.

It seems it is just enough the authorize ELP mode followed by
CMD_DISCONNECT (thanks to Kalle Valo about the idea to use it).
Without disconnect command the chip remains somewhat active and stays
consuming ~20 mA. Idle mode is left by same way than PSM. The wl1251_join
call is used to revert the CMD_DISCONNECT. Without it association to AP
doesn't work when trying second time.

With this patch the interface up but not associated case the battery current
consumption is less than 1 mA higher compared to interface down case.

Signed-off-by: Jarkko Nikula <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowl1251: Prepare for idle mode support
Jarkko Nikula [Mon, 4 Apr 2011 08:04:57 +0000 (11:04 +0300)]
wl1251: Prepare for idle mode support

RFC for WL1251 idle mode support brought a few issues that are worth to
update before adding the idle mode support.

Since the idle mode can reuse the code that is now used in Power Save Mode
(PSM), the flag psm in struct wl1251 is changed to variable station_mode
to be able to distinguish between PSM and idle modes.

As the station mode is different than the power power save mode command
that is sent to chip, the enum wl1251_cmd_ps_mod values are used only when
communicating with the chip and new enum wl1251_station_mode values are used
inside the driver.

Confusing comment about psm and elp relation is removed since the PSM is
actually activated by putting the chip into Entreme Low Power (ELP) mode.

Signed-off-by: Jarkko Nikula <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowl1251: Send synchronization timeout event in any state
Yuri Ershov [Wed, 27 Oct 2010 13:11:27 +0000 (17:11 +0400)]
wl1251: Send synchronization timeout event in any state

Send synchronization timeout event in any state to let the firmware monitor
the connection state.

Signed-off-by: Janne Ylalehto <>
Reviewed-by: Juuso Oikarinen <>
Signed-off-by: Luciano Coelho <>
Signed-off-by: Yuri Ershov <>
11 years agowl1251: fix deadlock with ieee80211 beacon filter calls
Yuri Ershov [Wed, 27 Oct 2010 10:47:25 +0000 (14:47 +0400)]
wl1251: fix deadlock with ieee80211 beacon filter calls

Lockdep shows that there is a deadlock when calling ieee80211_rssi_changed()
under wl->mutex. Fix it by releasing mutex before calling mac80211 functions.
This patch is based on Work-In-Progress patch sent by Kalle Valo.

Signed-off-by: Vidhya Govindan <>
Signed-off-by: Yuri Ershov <>
11 years agowl1251: Fix memory leaks in SPI initialization
Yuri Ershov [Wed, 27 Oct 2010 10:46:19 +0000 (14:46 +0400)]
wl1251: Fix memory leaks in SPI initialization

This patch fixes two memory leaks in the SPI initialization code.

Signed-off-by: Yuri Ershov <>
11 years agowl1251: Fix memory leak in data path command handling
Yuri Ershov [Wed, 27 Oct 2010 10:45:18 +0000 (14:45 +0400)]
wl1251: Fix memory leak in data path command handling

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

Signed-off-by: Yuri Ershov <>
11 years agowl1251: Fix TSF calculation
Yuri Ershov [Wed, 27 Oct 2010 10:44:18 +0000 (14:44 +0400)]
wl1251: Fix TSF calculation

Cast MSB part of current TSF to unsigned long long to prevent loss of
significant bits. MSB should be shifted on 32 bits.

Signed-off-by: Yuri Kululin <>
Signed-off-by: Yuri Ershov <>
11 years agoFIF_PROBE_REQ hack to build on old c-w
Grazvydas Ignotas [Fri, 29 Oct 2010 09:29:41 +0000 (12:29 +0300)]
FIF_PROBE_REQ hack to build on old c-w

11 years agowl1251: use ELP wakeup interrupt instead of polling
Grazvydas Ignotas [Wed, 27 Oct 2010 21:39:40 +0000 (00:39 +0300)]
wl1251: use ELP wakeup interrupt instead of polling

The chip can generate an interrupt on ELP wakeup, make use of it instead
of polling the status register. This reduces wakeup time to ~7ms from
~8-20ms (the wait loop was sleeping, so could take up to 20ms depending
on how system timer is configured). Note that DEBUG_PSM does not report
this accurately as it only measures jiffies.

This patch also moves atomic portion of interrupt processing to main.c
to avoid code duplication.

Signed-off-by: Grazvydas Ignotas <>
11 years agowl1251: cancel elp_work early
Grazvydas Ignotas [Wed, 27 Oct 2010 13:17:49 +0000 (16:17 +0300)]
wl1251: cancel elp_work early

While working on PS I've noticed elp_work is kicking rather often, and
sometimes the chip is put to sleep before 5ms delay expires. This
seems to happen because by the time wl1251_ps_elp_wakeup is called
elp_work might still be pending, and if the processing takes longer
(for example interrupts may take some time to process), elp_work might
get started and hit the mutex. After main thread finishes work it
calls wl1251_ps_elp_sleep, which can no longer cancel old work (as
it's already started) and schedules yet another work needlessly. The
elp_work then gets the mutex and puts the chip to sleep too early.

Fix this by cancelling work in wl1251_ps_elp_wakeup instead.

Signed-off-by: Grazvydas Ignotas <>
11 years agowl1251: remove wl1251_ps_set_elp function
Grazvydas Ignotas [Wed, 27 Oct 2010 10:44:11 +0000 (13:44 +0300)]
wl1251: remove wl1251_ps_set_elp function

wl1251_ps_set_elp() only does acx_sleep_auth call and takes the chip
from/to ELP, however all callers of wl1251_ps_set_mode() have already
taken the chip out of ELP and puts it back to ELP when they finish.
This makes ELP calls (and register writes they result in) superfluous.

So remove wl1251_ps_set_elp function and call acx_sleep_auth directly.

Signed-off-by: Grazvydas Ignotas <>
11 years agowl1251: implement filtering
Grazvydas Ignotas [Tue, 26 Oct 2010 15:51:49 +0000 (18:51 +0300)]
wl1251: implement filtering

Finish up filtering code and enable it. mac80211 no longer requires
to be atomic in .configure_filter callback, so remove filter_work.
The new filtering code makes sure it doesn't enable BSSID filtering
while BSSID is not set so that association works properly. This
allows removing hack in wl1251_cmd_join.

Signed-off-by: Grazvydas Ignotas <>
11 years agowl1251: fix channel switching in monitor mode
David Gnedt [Sun, 30 Jan 2011 19:11:21 +0000 (20:11 +0100)]
wl1251: fix channel switching in monitor mode

Use the ENABLE_RX command for channel switching when no interface is present
(monitor mode only).
The advantage of ENABLE_RX is that it leaves the tx data path disabled in
firmware, whereas the usual JOIN command seems to transmit some frames at
firmware level.

Signed-off-by: David Gnedt <>
11 years agowl1251: split RX and TX data path initialisation
David Gnedt [Sun, 30 Jan 2011 19:11:06 +0000 (20:11 +0100)]
wl1251: split RX and TX data path initialisation

Split up data path initialisation into RX and TX data path initialisation
functions. This change is required for channel switching in monitor mode.

Signed-off-by: David Gnedt <>
11 years agowl1251: fix scan behaviour while not associated
David Gnedt [Sun, 30 Jan 2011 19:10:50 +0000 (20:10 +0100)]
wl1251: fix scan behaviour while not associated

With a dissacociated card I often encoutered very long scan delays.

My guess is that it has something to do with the cards DTIM handling and
another firmware bug mentioned in the TI WLAN driver, which is described as
the card may never end scanning if the channel is overloaded because it
can't send probe requests. I think the firmware somehow also tries to
receive DTIM messages when the BSSID is not set. Therefore most of the time
it waits for DTIM messages and can't do scanning work.

Anyway we can workaround this misbehaviour by setting the HIGH_PRIORITY
bit for scans in disassociated state.

[ add missing include and remove debug
portion that got comments on l-w]
Signed-off-by: David Gnedt <>
11 years agowl1251: set rate index and preamble flag on received packets
David Gnedt [Sun, 30 Jan 2011 19:11:10 +0000 (20:11 +0100)]
wl1251: set rate index and preamble flag on received packets

Set the rate index rate_idx and preamble flag RX_FLAG_SHORTPRE on received

Signed-off-by: David Gnedt <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowl1251: enable adhoc mode
David Gnedt [Sun, 30 Jan 2011 19:11:04 +0000 (20:11 +0100)]
wl1251: enable adhoc mode

Enable adhoc support in wl1251 driver.

Signed-off-by: David Gnedt <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowl1251: enable beacon early termination while in power-saving mode
David Gnedt [Sun, 30 Jan 2011 19:10:57 +0000 (20:10 +0100)]
wl1251: enable beacon early termination while in power-saving mode

Port the beacon early termination feature from wl1251 driver version
included in the Maemo Fremantle kernel.
It is enabled when going to power-saving mode and disabled when leaving
power-saving mode.

Signed-off-by: David Gnedt <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowl1251: fix 4-byte TX buffer alignment
David Gnedt [Sun, 30 Jan 2011 19:10:48 +0000 (20:10 +0100)]
wl1251: fix 4-byte TX buffer alignment

This implements TX buffer alignment for cloned or too small skb by
copying and replacing the original skb.
Recent changes in wireless-testing seems to make this really necessary.

Signed-off-by: David Gnedt <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowl1251: fix queue stopping/waking for TX path
David Gnedt [Sun, 30 Jan 2011 19:10:46 +0000 (20:10 +0100)]
wl1251: fix queue stopping/waking for TX path

The queue stopping/waking functionality was broken in a way that could
cause the TX to stall if the right circumstances are met.

The problem was caused by tx_work, which is scheduled on each TX operation.
If the firmware buffer is full, tx_work does nothing. In combinition with
stopped queues or non-continues transfers, tx_work is never scheduled again.
Moreover the low watermark introduced by
9df86e2e702c6d5547aced7f241addd2d698bb11 never takes effect because of some
old code.

Solve this by scheduling tx_work every time tx_queue is non-empty and
firmware buffer is freed on tx_complete.

This also solves a possible but unlikely case: If less frames than the high
watermark are queued, but more than firmware buffer can hold. This results
in queues staying awake but the only scheduled tx_work doesn't transfer all
frames, so the remaining frames are stuck in the queue until more frames
get queued and tx_work is scheduled again.

Signed-off-by: David Gnedt <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
11 years agowireless, wl1251: Fix potential NULL pointer dereference in wl1251_op_bss_info_changed()
Jesper Juhl [Thu, 3 Feb 2011 20:14:01 +0000 (21:14 +0100)]
wireless, wl1251: Fix potential NULL pointer dereference in wl1251_op_bss_info_changed()

In drivers/net/wireless/wl12xx/wl1251_main.c:wl1251_op_bss_info_changed() we make
a call to ieee80211_beacon_get() which may return NULL, but we do not
check the return value before dereferencing the pointer.

Signed-off-by: Jesper Juhl <>
Signed-off-by: John W. Linville <>
11 years agoFix spelling mistakes in comments
Stefan Weil [Sun, 2 Jan 2011 14:12:42 +0000 (15:12 +0100)]
Fix spelling mistakes in comments

milisecond -> millisecond
 meassge -> message

Cc: Kalle Valo <>
Cc: Jiri Kosina <>
Signed-off-by: Stefan Weil <>
Signed-off-by: Jiri Kosina <>
11 years agowl1251: fix ELP_CTRL register reads
Grazvydas Ignotas [Tue, 8 Jun 2010 11:33:31 +0000 (14:33 +0300)]
wl1251: fix ELP_CTRL register reads

Reading the ELP_CTRL register with sdio_readb causes problems because
hardware seems to be performing a write using stuff bits in the request
(those bits contain write data in write request). This indicates that it
actually expects RAW (read after write) type of request, so perform that
when reading ELP_CTRL instead. Also cache last written value so we know
what to write when doing RAW request.

Because of the above it was not possible to wake the chip from ELP power
saving mode, PM had to be disabled to have the driver usable in SDIO
mode. After this patch PM is functional.

For backporting to 2.6.34 or earlier, this patch depends on
6c1f716e8154ee9315534782b9b1eedea0559a24, which adds the
required SDIO funcion.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: Fix queue stopping/waking for TX path
Denis 'GNUtoo' Carikli [Fri, 27 Aug 2010 21:48:19 +0000 (23:48 +0200)]
wl1251: Fix queue stopping/waking for TX path

This patch was adapted from 06f7bc7db79fabe6b2ec16eff0f59e4acc21eb72
(from linus's linux-2.6 tree of

here's the original message:
    The queue stopping/waking functionality was broken in a way that could
    cause huge latencies in TX transfers and even cause the TX to stall in the
    right circumstances. Correct these problems.

Signed-off-by: Denis 'GNUtoo' Carikli <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agodebug: remove roaming events
Grazvydas Ignotas [Thu, 19 Aug 2010 20:36:30 +0000 (23:36 +0300)]
debug: remove roaming events

I've seen enough of them

12 years agosome temp. diagnostic code
Grazvydas Ignotas [Tue, 17 Aug 2010 14:34:18 +0000 (17:34 +0300)]
some temp. diagnostic code

12 years agowl1251: wait for join command complete event
Grazvydas Ignotas [Mon, 16 Aug 2010 16:37:28 +0000 (19:37 +0300)]
wl1251: 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.

Based on wl1271 patch 99d84c1de8fdf5f9b09f07fdbc628857a040bf8b
by Luciano Coelho.

Signed-off-by: Grazvydas Ignotas <>
12 years agowl1251: fix beacon filter table structure
Grazvydas Ignotas [Mon, 16 Aug 2010 16:03:33 +0000 (19:03 +0300)]
wl1251: fix beacon filter table structure

The beacon filter table configuration ACX structure had certain elements
reversed, fix it to match TI driver.

Based on wl1271 patch 1937e742639c03a6fe77239c3003ce9602302117 by
Juuso Oikarinen.

Signed-off-by: Grazvydas Ignotas <>
12 years agowl1251: fix event handling mechanism
Grazvydas Ignotas [Mon, 16 Aug 2010 14:44:46 +0000 (17:44 +0300)]
wl1251: fix event handling mechanism

In case both A and B events occured simultaneously, current code
would only process A and clear both interrupts. Make it process both
events instead.

Based on wl1271 patches by Juuso Oikarinen:

Signed-off-by: Grazvydas Ignotas <>
12 years agowl1251: add missing __packed modifier for some structs
Grazvydas Ignotas [Mon, 16 Aug 2010 13:19:37 +0000 (16:19 +0300)]
wl1251: add missing __packed modifier for some structs

Several acx and cmd structures are missing __packed modifier, add it.
This was noticed while comparing them with corresponding wl1271 code.

Signed-off-by: Grazvydas Ignotas <>
12 years agodrivers/net/wireless/wl12xx: Use available error codes
Julia Lawall [Mon, 16 Aug 2010 16:25:21 +0000 (18:25 +0200)]
drivers/net/wireless/wl12xx: Use available error codes

In each case, error codes are stored in ret, but the return value is always
0.  Return ret instead.

The semantic match that finds this problem is as follows:

// <smpl>
local idexpression x;
constant C;

if (...) { ...
  x = -C
  ... when != x
  return <+...x...+>;
  return NULL;
* return ...;
// </smpl>

Signed-off-by: Julia Lawall <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: fix trigger scan timeout usage
Yuri Kululin [Fri, 13 Aug 2010 09:46:12 +0000 (13:46 +0400)]
wl1251: fix trigger scan timeout usage

Use appropriate command (CMD_TRIGGER_SCAN_TO) instead of scan command
(CMD_SCAN) to configure trigger scan timeout.

This was broken in commit 3a98c30f3e8bb1f32b5bcb74a39647b3670de275.

This fix address the bug reported here:

Signed-off-by: Yuri Ershov <>
Signed-off-by: Yuri Kululin <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agodrivers/net/wireless/wl12xx: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:15:10 +0000 (23:15 +0200)]
drivers/net/wireless/wl12xx: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (

// <smpl>
expression from,to,size,flag;
statement S;

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agodrivers/net: use __packed annotation
Eric Dumazet [Wed, 2 Jun 2010 18:10:09 +0000 (18:10 +0000)]
drivers/net: use __packed annotation

cleanup patch.

Use new __packed annotation in drivers/net/

Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
12 years agowl1251: update hw/fw version info in wiphy struct
John W. Linville [Wed, 28 Jul 2010 20:59:41 +0000 (16:59 -0400)]
wl1251: update hw/fw version info in wiphy struct

This makes the information available through ethtool...

Signed-off-by: John W. Linville <>
Acked-by: Kalle Valo <>
12 years agowl1251: fix sparse-generated warnings
John W. Linville [Wed, 21 Jul 2010 16:25:10 +0000 (12:25 -0400)]
wl1251: fix sparse-generated warnings

CHECK   drivers/net/wireless/wl12xx/wl1251_tx.c
drivers/net/wireless/wl12xx/wl1251_tx.c:118:32: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_tx.c:118:32:    expected unsigned short [unsigned] [usertype] frag_threshold
drivers/net/wireless/wl12xx/wl1251_tx.c:118:32:    got restricted __le16 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_tx.c:164:24: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_tx.c:164:24:    expected unsigned short [unsigned] [usertype] length
drivers/net/wireless/wl12xx/wl1251_tx.c:164:24:    got restricted __le16 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_tx.c:166:22: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_tx.c:166:22:    expected unsigned short [unsigned] [usertype] rate
drivers/net/wireless/wl12xx/wl1251_tx.c:166:22:    got restricted __le16 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_tx.c:167:29: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_tx.c:167:29:    expected unsigned int [unsigned] [usertype] expiry_time
drivers/net/wireless/wl12xx/wl1251_tx.c:167:29:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_tx.c:200:43: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/wl12xx/wl1251_tx.c:200:43:    expected restricted __le16 [usertype] fc
drivers/net/wireless/wl12xx/wl1251_tx.c:200:43:    got unsigned short [unsigned] [assigned] [usertype] fc
  CHECK   drivers/net/wireless/wl12xx/wl1251_cmd.c
drivers/net/wireless/wl12xx/wl1251_cmd.c:428:39: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_cmd.c:428:39:    expected unsigned int [unsigned] [usertype] rx_config_options
drivers/net/wireless/wl12xx/wl1251_cmd.c:428:39:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_cmd.c:429:39: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_cmd.c:429:39:    expected unsigned int [unsigned] [usertype] rx_filter_options
drivers/net/wireless/wl12xx/wl1251_cmd.c:429:39:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_cmd.c:435:29: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_cmd.c:435:29:    expected unsigned short [unsigned] [usertype] tx_rate
drivers/net/wireless/wl12xx/wl1251_cmd.c:435:29:    got restricted __le16 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_cmd.c:439:47: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_cmd.c:439:47:    expected unsigned int [unsigned] [usertype] min_duration
drivers/net/wireless/wl12xx/wl1251_cmd.c:439:47:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/wl12xx/wl1251_cmd.c:441:47: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl12xx/wl1251_cmd.c:441:47:    expected unsigned int [unsigned] [usertype] max_duration
drivers/net/wireless/wl12xx/wl1251_cmd.c:441:47:    got restricted __le32 [usertype] <noident>
  CHECK   drivers/net/wireless/wl12xx/wl1251_boot.c
drivers/net/wireless/wl12xx/wl1251_boot.c:228:22: warning: symbol 'interrupt' shadows an earlier one
/home/linville/git/wireless-next-2.6/arch/x86/include/asm/hw_irq.h:132:13: originally declared here

Signed-off-by: John W. Linville <>
12 years agowl12xx: Use MODULE_ALIAS macro at correct postion for SPI bus
Ameya Palande [Mon, 5 Jul 2010 14:12:38 +0000 (17:12 +0300)]
wl12xx: Use MODULE_ALIAS macro at correct postion for SPI bus

(Changed title, was "wl1251: Use MODULE_ALIAS macro at correct postion
for SPI bus".  -- JWL)

Signed-off-by: Ameya Palande <>
Acked-by: Luciano Coelho <>
Signed-off-by: John W. Linville <>
12 years agowl1251: fix a memory leak in probe
Grazvydas Ignotas [Fri, 4 Jun 2010 23:25:47 +0000 (02:25 +0300)]
wl1251: fix a memory leak in probe

wl1251_sdio_probe() error path is missing wl1251_free_hw, add it.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agoRevert "wl1251: prevent scan when connected"
Grazvydas Ignotas [Fri, 13 Aug 2010 12:36:53 +0000 (15:36 +0300)]
Revert "wl1251: prevent scan when connected"

This reverts commit a56d9e0efc83aefa89c9df1053bfaeb69b8ce141.
We have a proper fix now.

12 years agowl1251: prevent scan when connected Release-2010-05/1
Grazvydas Ignotas [Fri, 19 Mar 2010 21:00:02 +0000 (23:00 +0200)]
wl1251: prevent scan when connected

12 years agocompat: fix uevent_suppress on 2.6.29 or older kernels
Grazvydas Ignotas [Thu, 22 Apr 2010 13:39:34 +0000 (16:39 +0300)]
compat: fix uevent_suppress on 2.6.29 or older kernels

Missing uevent_suppress is causing two uevents instead of one, which is
confusing udev and sometimes causing firmware load to fail due to race
condition, so let's add it.

Signed-off-by: Grazvydas Ignotas <>
12 years agowl1251: add reset handling
Grazvydas Ignotas [Tue, 20 Apr 2010 13:04:04 +0000 (16:04 +0300)]
wl1251: add reset handling

12 years agowl1251: use sdio_readb_ext for ELP to work
Grazvydas Ignotas [Mon, 19 Apr 2010 19:30:05 +0000 (22:30 +0300)]
wl1251: use sdio_readb_ext for ELP to work

12 years agowl1251: add support for dedicated IRQ line
Grazvydas Ignotas [Fri, 16 Apr 2010 10:22:12 +0000 (13:22 +0300)]
wl1251: add support for dedicated IRQ line

wl1251 has WLAN_IRQ pin for generating interrupts to host processor,
which is mandatory in SPI mode and optional in SDIO mode (which can
use SDIO interrupts instead). However TI recommends using deditated
IRQ line for SDIO too.

Add support for using dedicated interrupt line with SDIO, but also leave
ability to switch to SDIO interrupts in case it's needed.

Signed-off-by: Grazvydas Ignotas <>
Reviewed-by: Bob Copeland <>
Signed-off-by: John W. Linville <>
12 years agowl1251: register platform_device to pass board data
Grazvydas Ignotas [Thu, 15 Apr 2010 15:23:23 +0000 (18:23 +0300)]
wl1251: register platform_device to pass board data

wl1251 is embedded chip that can be connected using SDIO bus, and is not
an actual SDIO card. For this reason there is a need to pass some board
specific data, like 'EEPROM is attached' flag or power control callback.

However currently there is no way to pass this data through SDIO subsystem,
so this patch registers dummy platform_device to allow that, until we
have a better solution to this.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: read default MAC address from EEPROM when available
Grazvydas Ignotas [Wed, 14 Apr 2010 10:05:48 +0000 (13:05 +0300)]
wl1251: read default MAC address from EEPROM when available

Some wl1251 hardware configurations (like in WG7210 module) have
EEPROM attached where NVS data is kept, which includes MAC address.

In such configurations, let's read default MAC address from EEPROM,
instead of using random one.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: don't require NVS data when EEPROM is used
Grazvydas Ignotas [Mon, 12 Apr 2010 22:21:40 +0000 (01:21 +0300)]
wl1251: don't require NVS data when EEPROM is used

If EEPROM is used, NVS data is now loaded but ignored.
Stop loading it to avoid need of dummy NVS file for modules with EEPROM.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: use DRIVER_NAME macro in wl1251_spi_driver
Kalle Valo [Fri, 2 Apr 2010 12:31:46 +0000 (15:31 +0300)]
wl1251: use DRIVER_NAME macro in wl1251_spi_driver

Better use the macro for consistency, the content is the same anyway.

Signed-off-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: fix potential crash
Grazvydas Ignotas [Thu, 11 Mar 2010 15:45:26 +0000 (17:45 +0200)]
wl1251: fix potential crash

In case debugfs does not init for some reason (or is disabled
on older kernels) driver does not allocate stats.fw_stats
structure, but tries to clear it later and trips on a NULL

Unable to handle kernel NULL pointer dereference at virtual address
PC is at __memzero+0x24/0x80
[<bf0ddb88>] (wl1251_debugfs_reset+0x0/0x30 [wl1251])
[<bf0d6a2c>] (wl1251_op_stop+0x0/0x12c [wl1251])
[<bf0bc228>] (ieee80211_stop_device+0x0/0x74 [mac80211])
[<bf0b0d10>] (ieee80211_stop+0x0/0x4ac [mac80211])
[<c02deeac>] (dev_close+0x0/0xb4)
[<c02deac0>] (dev_change_flags+0x0/0x184)
[<c031f478>] (devinet_ioctl+0x0/0x704)
[<c0320720>] (inet_ioctl+0x0/0x100)

Add a NULL pointer check to fix this.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: reduce eeprom read wait time
Grazvydas Ignotas [Thu, 11 Mar 2010 15:45:07 +0000 (17:45 +0200)]
wl1251: reduce eeprom read wait time

4sec wait is way too pessimistic, TI driver uses 40ms here,
and testing shows that is ebough, so let's also use that.
While at it, add useful sounding comment from the TI driver.

Signed-off-by: Grazvydas Ignotas <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: fix ELP_CTRL register accesses when using SDIO
Grazvydas Ignotas [Thu, 11 Mar 2010 15:44:57 +0000 (17:44 +0200)]
wl1251: fix ELP_CTRL register accesses when using SDIO

For some unknown reason ELP_CTRL can't be accesed using
sdio_memcpy_* functions (any attemts to do so result in timeouts):

 wl1251: ERROR sdio write failed (-110)
 wl1251: ERROR sdio read failed (-110)
 wl1251: WARNING WLAN not ready

To fix this, add special IO functions for ELP_CTRL access that are
using sdio_readb/sdio_writeb. Similar handling is done in TI
reference driver from Android code drop.

Signed-off-by: Grazvydas Ignotas <>
Cc: Bob Copeland <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agowl1251: make local symbols static
Grazvydas Ignotas [Fri, 12 Mar 2010 10:28:41 +0000 (12:28 +0200)]
wl1251: make local symbols static

Make local functions and data static, also constify
some structures. While at it, clean up unneeded includes.

Signed-off-by: Grazvydas Ignotas <>
Cc: Bob Copeland <>
Acked-by: Kalle Valo <>
Signed-off-by: John W. Linville <>
12 years agocompat-wireless-2010-03-10
Grazvydas Ignotas [Mon, 19 Apr 2010 16:08:33 +0000 (19:08 +0300)]