10 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 <>
10 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 <>
10 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

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

10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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 <>
10 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.

11 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

11 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 <>
11 years agowl1251: add reset handling
Grazvydas Ignotas [Tue, 20 Apr 2010 13:04:04 +0000 (16:04 +0300)]
wl1251: add reset handling

11 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

11 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 <>
11 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 <>
11 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 <>
11 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 <>
11 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 <>
11 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 <>
11 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 <>
11 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 <>
11 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 <>
11 years agocompat-wireless-2010-03-10
Grazvydas Ignotas [Mon, 19 Apr 2010 16:08:33 +0000 (19:08 +0300)]