Commit graph

31 commits

Author SHA1 Message Date
Luciano Coelho
e4da3fbfbd Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into wl12xx-next 2011-12-01 12:14:48 +02:00
Lars-Peter Clausen
4e3309ba95 wireless: Remove redundant spi driver bus initialization
In ancient times it was necessary to manually initialize the bus field of an
spi_driver to spi_bus_type. These days this is done in spi_driver_register(),
so we can drop the manual assignment.

The patch was generated using the following coccinelle semantic patch:
// <smpl>
@@
identifier _driver;
@@
struct spi_driver _driver = {
	.driver = {
-		.bus = &spi_bus_type,
	},
};
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Dan Williams <dcbw@redhat.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Christian Lamparter <chunkeey@googlemail.com>
Cc: Luciano Coelho <coelho@ti.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Acked-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-28 14:43:58 -05:00
Luciano Coelho
ccb62000d5 wl12xx: use the same plat dev name for both SPI and SDIO
There's no need to have the bus name included in the platform device
name that we create.  The core driver doesn't need to know about the
type of bus it uses.  Any differences between the buses that need to
be handled differently in the core, can be passed in the platform data
(as the pwr_in_suspend boolean does).

Use "wl12xx" for the device name in both bus drivers.  Rename the
platform driver name to "wl12xx_driver", just to differentiate from
the platform device names.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-10-11 20:11:10 +03:00
Luciano Coelho
e5d3625e87 wl12xx: spi: use dev_err instead of wl1271_error
To prevent a useless dependency between the spi module and the wl12xx
module, we need to replace the wl1271_error macros with dev_err.

At the same time, remove the SPI data hexdump, since this produces way
too much data and is not particularly useful.  There's no
print_hex_dump() equivalent for dynamic debug, so it's hard to control
when the dumps are printed out.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-10-11 16:24:56 +03:00
Luciano Coelho
0f4e31222a wl12xx: move debugging definitions to a separate file
Separate the debugging macros and other definitions to a new debug.h
file.  This is be needed because the sdio and spi modules don't need
to depend on the wl12xx module anymore, but still need to include
wl12xx.h.  Currently they do depend on it, because of the debugging
global that wl12xx exports.  A future patch will remove this
dependency.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-10-11 16:19:05 +03:00
Felipe Balbi
a390e85cfe wl12xx: move common init code from bus modules to main
Move all common parts from sdio.c and spi.c to main.c, since they now
can be handled as part of the platform driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[added a bunch of fixes and a new pdata element]
[moved some new code into main.c as well]
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-10-11 16:01:09 +03:00
Felipe Balbi
0969d6793f wl12xx: add a platform device to the spi module
The platform device will be used to match the platform driver that
will be implemented by the core module.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported, cleaned-up and rephrased commit message]
[call platform_device_add() instead of platform_device_register()]
[store alloc'ed device platform directly in glue->core]
[fixed the length of memset(res...)]
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-10-11 16:01:00 +03:00
Felipe Balbi
b65019f661 wl12xx: add an spi glue struct to keep wl and device side-by-side
In order to fully abstract the bus, we need to save the device
structure *beside* wl1271, instead of inside it.

This will help re-structuring the driver so that we avoid the
duplicated code in the bus modules.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[forward-ported and cleaned up and rephrased commit message]
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-10-11 16:00:51 +03:00
Arik Nemtsov
c302b2c959 wl12xx: Use a single fw for both STA and AP roles
Firmware >= 6/7.3.0.0.75 (wl127x/wl128x) supports both
STA and AP roles.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-08-22 12:35:22 +03:00
John W. Linville
204d1641d2 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem 2011-07-08 11:03:36 -04:00
Felipe Balbi
ba2274c68e net: wl12xx: remove unnecessary prints
Those have little value. Remove those to
make the driver less noisy.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27 10:15:47 +03:00
Alexey Dobriyan
a6b7a40786 net: remove interrupt.h inclusion from netdevice.h
* remove interrupt.g inclusion from netdevice.h -- not needed
* fixup fallout, add interrupt.h and hardirq.h back where needed.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-06 22:55:11 -07:00
Ido Yariv
341b7cde6c wl12xx: Handle platforms without level trigger interrupts
Some platforms are incapable of triggering on level interrupts. Add a
platform quirks member in the platform data structure, as well as an
edge interrupt quirk which can be set on such platforms.

When the interrupt is requested with IRQF_TRIGGER_RISING, IRQF_ONESHOT
cannot be used, as we might miss interrupts that occur after the FW
status is cleared and before the threaded interrupt handler exits.

Moreover, when IRQF_ONESHOT is not set, iterating more than once in the
threaded interrupt handler introduces a few race conditions between this
handler and the hardirq handler. Currently this is worked around by
limiting the loop to one iteration only. This workaround has an impact
on performance. To remove to this restriction, the race conditions will
need to be addressed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:20 +03:00
Arik Nemtsov
1aed55fd78 wl12xx: 1281/1283 support - Use different FW file for AP mode wl127x/wl128x chips
Choose a different FW for AP-mode wl127x and wl128x chips, base on chip
ID at boot time.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:49:02 +03:00
Shahar Levi
5ea417ae77 wl12xx: 1281/1283 support - New boot sequence
Boot sequence support FREF clock and TCXO clock.
WL128x has two clocks input - TCXO and FREF.
TCXO is the main clock of the device, while FREF is used to sync
between the GPS and the cellular modem.
Auto-detection checks where TCXO is 32.736MHz or 16.368MHz, in that
case the FREF will be used as the WLAN/BT main clock.

[Use clock enumeration as defined in linux/wl12xx.h; remove
unnecessary else block in wl128x_switch_fref; remove unnecessary
change in main.c; remove some unnecessary debug prints and comments;
fix potential use of uninitialized value (pll_config) -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:48:58 +03:00
Luciano Coelho
a81159edf8 wl12xx: 1281/1283 support - add block size handling for sdio and spi
Add the the set_block_size op in the SDIO and in the SPI modules.
Since it is only used with SDIO, just explicitly set the op to NULL in
spi.c

Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:48 +03:00
Shahar Levi
5aa42346bb wl12xx: 1281/1283 support - Add Definitions
Definitions to support wl128x:
  - New FW file name
  - Chip ID
  - New PLL Configuration Algorithm macros that will be used at wl128x
    boot stage
  - Rename NVS macro name: wl127x and wl128x are using the same NVS
    file name. However, the ini parameters between them are
    different. The driver will validate the correct NVS size in
    wl1271_boot_upload_nvs().

[Cleaned up some of the definitions. -- Luca]

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19 16:19:46 +03:00
Luciano Coelho
5245e3a9f7 wl12xx: fix module author's email address in the spi and sdio modules
The MODULE_AUTHOR() macro in the main module (wl12xx) has been updated
to reflect one of the author's new email address, but the wl12xx_spi
and wl12xx_sdio modules haven't been updated.  This patches updates
them.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-04-04 15:22:11 -04:00
Ido Yariv
2da69b890f wl12xx: Switch to level trigger interrupts
The interrupt of the wl12xx is a level interrupt in nature, since the
interrupt line is not auto-reset. However, since resetting the interrupt
requires bus transactions, this cannot be done from an interrupt
context. Thus, requesting a level interrupt would require to disable the
irq and re-enable it after the HW is acknowledged. Since we now request
a threaded irq, this can also be done by specifying the IRQF_ONESHOT
flag.

Triggering on an edge can be problematic in some platforms, if the
sampling frequency is not sufficient for detecting very frequent
interrupts. In case an interrupt is missed, the driver will hang as the
interrupt line will stay high until it is acknowledged by the driver,
which will never happen.

Fix this by requesting a level triggered interrupt, with the
IRQF_ONESHOT flag.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00
Ido Yariv
a620865edf wl12xx: Switch to a threaded interrupt handler
To achieve maximal throughput, it is very important to react to
interrupts as soon as possible. Currently the interrupt handler wakes up
a worker for handling interrupts in process context. A cleaner and more
efficient design would be to request a threaded interrupt handler.  This
handler's priority is very high, and can do blocking operations such as
SDIO/SPI transactions.

Some work can be deferred, mostly calls to mac80211 APIs
(ieee80211_rx_ni and ieee80211_tx_status). By deferring such work to a
different worker, we can keep the irq handler thread more I/O
responsive. In addition, on multi-core systems the two threads can be
scheduled on different cores, which will improve overall performance.

The use of WL1271_FLAG_IRQ_PENDING & WL1271_FLAG_IRQ_RUNNING was
changed. For simplicity, always query the FW for more pending
interrupts. Since there are relatively long bursts of interrupts, the
extra FW status read overhead is negligible. In addition, this enables
registering the IRQ handler with the ONESHOT option.

Signed-off-by: Ido Yariv <ido@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03 16:10:46 +02:00
Arik Nemtsov
d75387ca62 wl12xx: add missing MODULE_FIRMWARE statment for AP-mode FW
In wl12xx cards AP-mode requires a separate FW file. Add this file to
the module info.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-01-24 22:58:18 +02:00
Dan Carpenter
0dd3866764 wl12xx: use after free in debug code
If debugging is turned on, then wl1271_dump() dereferences a freed
variable.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
2011-01-24 22:11:45 +02:00
Shahar Levi
00d201001b wl1271: Change wl12xx Files Names
All files name prefix removed due to the fact that wl12xx driver supports
wl1271 and wl1273.
Also the definition in Kconfig and header files changed respectively.

Signed-off-by: Shahar Levi <shahar_levi@ti.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
2010-11-22 16:45:09 +02:00
Kalle Valo
ef2f8d4577 wl1251: add wl1251 prefix to all 1251 files
Now that all 1271 files are split, we can add wl1251_ prefix to the files.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:49 -04:00
Juuso Oikarinen
8ec8beb283 wl12xx: Add support for block reading from a fixed register address
Add support for block reading (multiple bytes) from a fixed chipset
register address. This is required for the wl1271 TX data path.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:46 -04:00
Luciano Coelho
052a625a85 wl12xx: add support for fixed address in wl12xx_spi_read
In the wl1271 implementation, we need to read memory from the register
partition using fixed addresses.  This change adds the possibility to request
fixed address when calling wl12xx_spi_read() or wl12xx_spi_reg_read().

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:45 -04:00
Luciano Coelho
a336e26664 wl12xx: add wl12xx_spi_reg_read() and wl12xx_spi_reg_write() functions
In some cases we need to read more than 32 bits from the register area.
These functions were added to support that, like the existing
wl12xx_spi_mem_read() and wl12xx_spi_mem_write() already do for large blocks
in the memory area.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:45 -04:00
Kalle Valo
5262c12d16 wl12xx: allocate buffer the spi busy word from struct wl12xx
Needed for DMA transfers.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:43 -04:00
Kalle Valo
56343a3cfd wl12xx: allocate buffer spi read/write command buffer kzalloc()
Needed for DMA safe transfers.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:42 -04:00
Kalle Valo
8d47cdb617 wl12xx: reserve buffer for partition command in struct wl12xx
This is now DMA safe.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:42 -04:00
Kalle Valo
2f01a1f588 wl12xx: add driver
wl12xx is a driver for TI wl1251 802.11 chipset designed for embedded
devices, supporting both SDIO and SPI busses. Currently the driver
supports only SPI. Adding support 1253 (the 5 GHz version) should be
relatively easy. More information here:

http://focus.ti.com/general/docs/wtbu/wtbuproductcontent.tsp?contentId=4711&navigationId=12494&templateId=6123

(Collapsed original sequence of pre-merge patches into single commit for
initial merge. -- JWL)

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-05-06 15:14:54 -04:00