openwrt/staging/blogic.git
12 years agomwifiex: process remain on channel expired event
Stone Piao [Wed, 26 Sep 2012 03:23:37 +0000 (20:23 -0700)]
mwifiex: process remain on channel expired event

Process remain on channel expired event, and notify cfg80211.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: implement remain_on_channel and cancel_remain_on_channel
Stone Piao [Wed, 26 Sep 2012 03:23:36 +0000 (20:23 -0700)]
mwifiex: implement remain_on_channel and cancel_remain_on_channel

Add a new command to implement remain_on_channel and
cancel_remain_on_channel.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: report received management frames to cfg80211
Stone Piao [Wed, 26 Sep 2012 03:23:35 +0000 (20:23 -0700)]
mwifiex: report received management frames to cfg80211

Process the management frames received from firmware and report
them to cfg80211.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Kevin Gan <ganhy@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: implement cfg80211 mgmt_frame_register handler
Stone Piao [Wed, 26 Sep 2012 03:23:34 +0000 (20:23 -0700)]
mwifiex: implement cfg80211 mgmt_frame_register handler

Add a new command to implement mgmt_frame_register.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: advertise mgmt_stype to cfg80211
Stone Piao [Wed, 26 Sep 2012 03:23:33 +0000 (20:23 -0700)]
mwifiex: advertise mgmt_stype to cfg80211

Advertise supported management frame types to cfg80211.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: implement cfg80211 mgmt_tx handler
Stone Piao [Wed, 26 Sep 2012 03:23:32 +0000 (20:23 -0700)]
mwifiex: implement cfg80211 mgmt_tx handler

Implement mgmt_tx in cfg80211 ops through data path.
Advertise probe resp offload and skip to send probe resp in AP
or GO mode.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: fix coding style issue
Stone Piao [Wed, 26 Sep 2012 03:23:31 +0000 (20:23 -0700)]
mwifiex: fix coding style issue

Remove unnecessary blank lines and extra tab.

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Add a debugfs file to adjust antenna diversity
Sujith Manoharan [Wed, 26 Sep 2012 02:25:18 +0000 (07:55 +0530)]
ath9k: Add a debugfs file to adjust antenna diversity

Location: /<debugfs>/ieee80211/phy#/ath9k/diversity

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Handle errors properly in MCI initialization
Sujith Manoharan [Wed, 26 Sep 2012 02:24:43 +0000 (07:54 +0530)]
ath9k: Handle errors properly in MCI initialization

The MCI initialization path has various points of failures,
handle these to ensure that we bail out correctly in such
cases.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Fix rx filtering issue for older chips
Thomas Wagner [Tue, 25 Sep 2012 16:02:55 +0000 (21:32 +0530)]
ath9k: Fix rx filtering issue for older chips

We need to have the promiscuous mode enabled for older
chipsets so that the olderchips hardware does not
filters out some valid/necessary frames that need
to be sent to mac80211. Fix this by enabling promiscus
mode for all the chipsets whose macversion <= AR9160
chipsets. This should fix
https://bugzilla.kernel.org/show_bug.cgi?id=45591

shafi: made the fix generic by having the frame filtering
disabled for chipsets older than AR9280.

Cc: Javier Cardona <javier@cozybit.com>
Signed-off-by: Thomas Wagner <Thomas.Wagner@hs-rm.de>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobcma: change delays to follow timers-howto guide
Rafał Miłecki [Tue, 25 Sep 2012 08:17:22 +0000 (10:17 +0200)]
bcma: change delays to follow timers-howto guide

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoMerge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca...
John W. Linville [Fri, 28 Sep 2012 17:49:21 +0000 (13:49 -0400)]
Merge branch 'for-linville' of git://git./linux/kernel/git/luca/wl12xx

12 years agoMerge tag 'nfc-next-3.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
John W. Linville [Fri, 28 Sep 2012 14:55:00 +0000 (10:55 -0400)]
Merge tag 'nfc-next-3.7-2' of git://git./linux/kernel/git/sameo/nfc-3.0

So says Samuel Ortiz <sameo@linux.intel.com>:

The 2nd NFC pull request for 3.7.

- A couple of wrong context sleep fixes.
- An LLCP rwlock intizialisation fix.
- A missing mutex unlocking for pn533.
- LLCP raw sockets support. This is going to be used for NFC sniffing.
- A build fix for llc_shdlc. It fixes a build error triggered by code that's
  living in wireless-next.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agowlcore: protect wlcore_op_set_key with mutex
Eliad Peller [Mon, 3 Sep 2012 15:27:58 +0000 (18:27 +0300)]
wlcore: protect wlcore_op_set_key with mutex

wlcore_op_set_key() calls wl18xx_set_key(),
which in turn executes some of his function
calls without acquiring wl->mutex and making
sure the fw is awake.

Adding mutex_lock()/ps_elp_wakeup() calls is
not enough, as wl18xx_set_key() calls
wl1271_tx_flush() which can't be called while
the mutex is taken.

Add the required calls to wlcore_op_set_key,
but limit the queues_stop and flushing
to the only encryption types in which
a spare block might be needed (GEM and TKIP).

[Arik - move state != ON check]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: decrease elp timeout
Eliad Peller [Sun, 2 Sep 2012 10:30:04 +0000 (13:30 +0300)]
wlcore: decrease elp timeout

The current elp timeout (the same as the dynamic
ps timeout - 1500ms) is too high. Usually,
wl1271_ps_elp_sleep() get called right after tx/rx,
which is fine, but some command might get sent
even when there is no traffic (e.g. ht changes
triggered by beacon frames), and leaving the
device awake for 1500ms in this case is redundant.

Use a timeout of 30ms.
The fw won't enter elp anyway before the dynamic-ps
timeout was expired as well (and it entered ps
successfully).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Load the NVS file asynchronously
Ido Yariv [Sat, 1 Sep 2012 22:32:47 +0000 (01:32 +0300)]
wlcore: Load the NVS file asynchronously

The NVS file is loaded by the device's probe callback with the help of
request_firmware(). Since request_firmware() relies on udevd, the
modules cannot be loaded before hotplug events are handled.

Fix this by loading the NVS file asynchronously and continue
initialization only after the firmware request is over.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Refactor probe
Ido Yariv [Sun, 2 Sep 2012 09:29:27 +0000 (12:29 +0300)]
wlcore: Refactor probe

Move most of the device-specific probe functionality into setup(), a new
op. By doing this, wlcore_probe will be the first to request a firmware
from userspace, making it easier to load the NVS file asynchronously.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Allow memory access when the FW crashes
Ido Yariv [Tue, 21 Aug 2012 14:17:13 +0000 (17:17 +0300)]
wlcore: Allow memory access when the FW crashes

When the no_recovery flag is used, the recovery work will not restart
the FW and the state will not be set to 'on'. To enable post-mortem
analysis, allow memory access in the 'restarting' state.

Also, since the FW might not be operational, don't fail the read/write
operations if elp_wakeup fails.

Reported-by: Arkady Miasnikov <a-miasnikov@ti.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: use dynamic keep-alive template ids
Eliad Peller [Thu, 16 Aug 2012 10:52:47 +0000 (13:52 +0300)]
wlcore: use dynamic keep-alive template ids

Currently, all the (station) roles use the same
keep-alive template id (0). However, the klv
template ids shouldn't be shared by different
roles.

Implement a simple klv_templates bitmap, and let
each role allocate its own klv template id on
role initialization.

[Arik - remove invalidation of KLV template when getting into "idle".
This is already handled in unjoin]

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: invalidate keep-alive template on disconnection
Eliad Peller [Thu, 16 Aug 2012 10:32:32 +0000 (13:32 +0300)]
wlcore: invalidate keep-alive template on disconnection

Previously, invalidation of the keep-alive template was
done when going idle. However, while removing the
idle-handling we didn't move the keep-alive template
invalidation to another place.

This finally resulted in fw error when trying to use
the keep-alive template by another role.

(Note that we still have an error here - each role
should have its unique keep-alive template id, while
currently they all use CMD_TEMPL_KLV_IDX_NULL_DATA (0).
This only works now because we don't support concurrent
connected stations yet)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl18xx: default to siso40 in 2.4ghz with a single antenna
Arik Nemtsov [Wed, 15 Aug 2012 16:11:43 +0000 (19:11 +0300)]
wl18xx: default to siso40 in 2.4ghz with a single antenna

The driver used siso20 in this case for legacy reasons.

Reported-by: Ido Reis <idor@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Fix unbalanced interrupts enablement
Ido Yariv [Wed, 15 Aug 2012 15:29:04 +0000 (18:29 +0300)]
wlcore: Fix unbalanced interrupts enablement

The interrupt line is enabled by wl12xx_enable_interrupts and
wl18xx_enable_interrupts, but it will not be disabled in all failure
paths. Fix this.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Don't recover during boot
Ido Yariv [Wed, 15 Aug 2012 12:09:30 +0000 (15:09 +0300)]
wlcore: Don't recover during boot

While recursive recovery is avoided during shutdown, a new recovery may
be queued when the FW boots. The recovery work will then try to stop an
already stopped hardware, which will most likely result in a kernel
panic.

Fix this by verifying that wl->state is on before queueing a new
recovery.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore/wl18xx: add phy_fw_version_str to debugfs driver_state
Yair Shapira [Tue, 7 Aug 2012 14:38:21 +0000 (17:38 +0300)]
wlcore/wl18xx: add phy_fw_version_str to debugfs driver_state

add phy_fw_version_str to debugfs driver_state file.
information is taken during boot and stored in wl->chip.phy_fw_ver_str.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: spi: use private max-buf-size limit
Arik Nemtsov [Mon, 6 Aug 2012 08:21:39 +0000 (11:21 +0300)]
wlcore: spi: use private max-buf-size limit

Limit SPI transmissions to the wl12xx max buffer size, as only 12xx was
tested with SPI.

This allows us to remove the global aggregation buffer constant.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl18xx: number_of_assembled_ant5 indicates if A band is enabled
Yair Shapira [Sun, 5 Aug 2012 13:51:16 +0000 (16:51 +0300)]
wl18xx: number_of_assembled_ant5 indicates if A band is enabled

Use number_of_assembled_ant5 phy param to indicate if A band is enabled:
if number_of_assembled_ant5 != 0 then it is enabled otherwise it is
disabled.

This aligns with phy implementation that uses this param both to indicate
if band is active and the number of antennas.

This parameter replaces enable_11a module param that was removed.

User-Space applications can use wlconf and/or INI files to disable A band
using this parameter.

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: allow up to 3 running STA interfaces in combinations
Arik Nemtsov [Thu, 2 Aug 2012 19:00:34 +0000 (22:00 +0300)]
wlcore: allow up to 3 running STA interfaces in combinations

This allows us to have a p2p-management interface (in STA mode),
as we as a group dedicated interface.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: lazy-enable device roles
Eliad Peller [Thu, 26 Jul 2012 14:17:06 +0000 (17:17 +0300)]
wlcore: lazy-enable device roles

Enable device roles just before starting it.
This way, a single device role should be enough
for all vifs, as we can't use concurrent device
roles (which require ROC) anyway.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: always use wlvif->role_id for scans
Eliad Peller [Thu, 26 Jul 2012 14:17:05 +0000 (17:17 +0300)]
wlcore: always use wlvif->role_id for scans

enabled (but not-started) sta role should be good enough
for scanning (both normal and scheduled), so use it
instead of the device_role.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: make debug prints work without dynamic debug
Arik Nemtsov [Thu, 2 Aug 2012 12:27:51 +0000 (15:27 +0300)]
wlcore: make debug prints work without dynamic debug

Make debug prints operational when dynamic debug is not defined.
This allows better debugging in production environments.

Change the driver prefix to "wlcore" while were at it.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore/wl18xx/wl12xx: allow up to 3 mac addresses
Arik Nemtsov [Thu, 2 Aug 2012 17:37:21 +0000 (20:37 +0300)]
wlcore/wl18xx/wl12xx: allow up to 3 mac addresses

Allow 3 native mac addresses on 18xx. On 12xx allow 2 native mac
addresses and set the LAA bit to create a third mac address. This
enabled operation with a separate group interface.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: resume() only if sta is associated
Eliad Peller [Wed, 1 Aug 2012 15:44:22 +0000 (18:44 +0300)]
wlcore: resume() only if sta is associated

mac80211's resume() callback might get called even if
the sta is not associated (but only up). The
resume sequence in this case results in configuring
the wake-up conditions of a non-started role, which
causes fw assertion.

Fix it by bailing out if the STA is not connected
(like we do on suspend()).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: configure wowlan regardless of wakeup conditions
Eyal Shapira [Thu, 2 Aug 2012 04:15:19 +0000 (07:15 +0300)]
wlcore: configure wowlan regardless of wakeup conditions

wowlan filters should be configured in any case in suspend/resume.
This shouldn't be dependent on whether wakeup conditions are the
same for suspend and resume states. Only the FW command to
reconfigure wakeup conditions should be avoided in such a case.

Reported-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore/wl18xx/wl12xx: aggregation buffer size set
Igal Chernobelsky [Sun, 29 Jul 2012 15:21:12 +0000 (18:21 +0300)]
wlcore/wl18xx/wl12xx: aggregation buffer size set

Aggregation buffer size is set separately per 18xx/12xx chip family.
For 18xx aggragation buffer is set to 13 pages to utilize all
the available tx/rx descriptors for aggregation.

[Arik - remove redundant parts from the patch]

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl18xx/wl12xx: defines for Tx/Rx descriptors num
Igal Chernobelsky [Tue, 31 Jul 2012 11:48:46 +0000 (14:48 +0300)]
wl18xx/wl12xx: defines for Tx/Rx descriptors num

Use defines for number of Tx/Rx descriptors.

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: tx_flush - optimize flow and force Tx during the flush
Arik Nemtsov [Sun, 29 Jul 2012 09:18:32 +0000 (12:18 +0300)]
wlcore: tx_flush - optimize flow and force Tx during the flush

Force Tx during the flush if there are packets pending in the driver.
This actually solves a bug where we would get called from the mac80211
wq context, which would prevent tx_work from getting queued, even when
the mutex is unlocked.

Don't stop the queues needlessly if there's nothing to flush. Use a
larger delay when sleeping to give the driver a chance to flush and
avoid cpu busy looping. Re-arrange the loop so the last iteration is
not wasted.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: make Tx flush timings more verbose
Arik Nemtsov [Mon, 23 Jul 2012 20:50:45 +0000 (23:50 +0300)]
wlcore: make Tx flush timings more verbose

Print how much time a flush took. This will help debug the time it takes
to switch between channels.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: allow only the lowest OFDM rate for p2p setup frames
Arik Nemtsov [Mon, 23 Jul 2012 12:18:29 +0000 (15:18 +0300)]
wlcore: allow only the lowest OFDM rate for p2p setup frames

The IEEE80211_TX_CTL_NO_CCK_RATE flag is only set for mgmt packets
transmitted during p2p connection setup. Make sure to use the lowest
OFDM rate guarantee the peer always hears us.
Change the p2p rate policy to contain only the 6mpbs rate to acheive
this effect.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: AP mode - send non-data packets with basic rates
Arik Nemtsov [Mon, 23 Jul 2012 07:38:18 +0000 (10:38 +0300)]
wlcore: AP mode - send non-data packets with basic rates

This solves interoperability issues with peer that don't seem to "hear"
management packets transmitted in higher rates. Based on a previous
patch by Igal Chernobelsky.

Cc: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: cancel recovery_work on stop() instead of remove_interface()
Eliad Peller [Sun, 29 Jul 2012 11:37:29 +0000 (14:37 +0300)]
wlcore: cancel recovery_work on stop() instead of remove_interface()

recovery_work should be cancelled when stopping the device,
not when removing an interface (this is probably a leftover
from the single-role days)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl18xx: increase rx_ba_win_size to 32
Ido Reis [Mon, 25 Jun 2012 15:51:54 +0000 (18:51 +0300)]
wl18xx: increase rx_ba_win_size to 32

The new FWs support a bigger BA window.

Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Prevent interaction with HW after recovery is queued
Ido Yariv [Tue, 24 Jul 2012 16:18:49 +0000 (19:18 +0300)]
wlcore: Prevent interaction with HW after recovery is queued

When a function requests to recover, it would normally abort and will
not send any additional commands to the HW. However, other threads may
not be aware of the failure and could try to communicate with the HW
after a recovery was queued, but before the recovery work began.

Fix this by introducing an intermediate state which is set when recovery
is queued, and modify all state checks accordingly.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: consider single fw case
Eliad Peller [Wed, 25 Jul 2012 11:22:21 +0000 (14:22 +0300)]
wlcore: consider single fw case

When a single fw is being used for both single-role
and multi-role cases (e.g. 18xx), wl->mr_fw_name is
NULL, which results in NULL dereference while trying
to load the multi-role fw.

In this case, always use the single-role fw, and avoid
redundant fw switch by checking for this case in
wl12xx_need_fw_change() as well.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl18xx: update default phy configuration for pg2
Ido Reis [Thu, 12 Jul 2012 21:12:08 +0000 (00:12 +0300)]
wl18xx: update default phy configuration for pg2

default switch configuration set to pg2 chips (rdl 1/2/3/4).
removed hacks for specific board types.
pg1.x boards are now supported only using module params
or specific conf files.

Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl12xx: remove duplicated include from main.c
Wei Yongjun [Sun, 26 Aug 2012 01:47:06 +0000 (09:47 +0800)]
wl12xx: remove duplicated include from main.c

Remove duplicated include.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowlcore: Declare MODULE_FIRMWARE usage
Tim Gardner [Wed, 29 Aug 2012 19:09:33 +0000 (13:09 -0600)]
wlcore: Declare MODULE_FIRMWARE usage

Declare any firmware that might be used by this driver.
If all drivers declare their firmware usage, then a sufficiently
complete list of firmware files can then be used to pare down
the external linux-firmware package to just the files in actual use.

Cc: Luciano Coelho <coelho@ti.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agowl12xx: use module_platform_driver
Luciano Coelho [Thu, 27 Sep 2012 09:02:38 +0000 (12:02 +0300)]
wl12xx: use module_platform_driver

Use a module_platform_driver declaration instead of replicating the
init and exit functions in the driver.

Based on the patch for wl18xx by Devendra Naga.

Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agoNFC: Fix sleeping in atomic when releasing socket
Szymon Janc [Wed, 26 Sep 2012 12:22:10 +0000 (14:22 +0200)]
NFC: Fix sleeping in atomic when releasing socket

nfc_llcp_socket_release is calling lock_sock/release_sock while holding
write lock for rwlock. Use bh_lock/unlock_sock instead.

BUG: sleeping function called from invalid context at net/core/sock.c:2138
in_atomic(): 1, irqs_disabled(): 0, pid: 56, name: kworker/1:1
4 locks held by kworker/1:1/56:
Pid: 56, comm: kworker/1:1 Not tainted 3.5.0-999-nfc+ #7
Call Trace:
[<ffffffff810952c5>] __might_sleep+0x145/0x200
[<ffffffff815d7686>] lock_sock_nested+0x36/0xa0
[<ffffffff81731569>] ? _raw_write_lock+0x49/0x50
[<ffffffffa04aa100>] ? nfc_llcp_socket_release+0x30/0x200 [nfc]
[<ffffffffa04aa122>] nfc_llcp_socket_release+0x52/0x200 [nfc]
[<ffffffffa04ab9f0>] nfc_llcp_mac_is_down+0x20/0x30 [nfc]
[<ffffffffa04a6fea>] nfc_dep_link_down+0xaa/0xf0 [nfc]
[<ffffffffa04a9bb5>] nfc_llcp_timeout_work+0x15/0x20 [nfc]
[<ffffffff810825f7>] process_one_work+0x197/0x7c0
[<ffffffff81082596>] ? process_one_work+0x136/0x7c0
[<ffffffff8172fbc9>] ? __schedule+0x419/0x9c0
[<ffffffffa04a9ba0>] ? nfc_llcp_build_gb+0x1b0/0x1b0 [nfc]
[<ffffffff81083090>] worker_thread+0x190/0x4c0
[<ffffffff81082f00>] ? rescuer_thread+0x2a0/0x2a0
[<ffffffff81088d1e>] kthread+0xae/0xc0
[<ffffffff810caafd>] ? trace_hardirqs_on+0xd/0x10
[<ffffffff8173acc4>] kernel_thread_helper+0x4/0x10
[<ffffffff81732174>] ? retint_restore_args+0x13/0x13
[<ffffffff81088c70>] ? flush_kthread_worker+0x150/0x150
[<ffffffff8173acc0>] ? gs_change+0x13/0x13

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Fix sleeping in invalid context when netlink socket is closed
Szymon Janc [Wed, 26 Sep 2012 12:17:12 +0000 (14:17 +0200)]
NFC: Fix sleeping in invalid context when netlink socket is closed

netlink_register_notifier requires notify functions to not sleep.
nfc_stop_poll locks device mutex and must not be called from notifier.
Create workqueue that will handle this for all devices.

BUG: sleeping function called from invalid context at kernel/mutex.c:269
in_atomic(): 0, irqs_disabled(): 0, pid: 4497, name: neard
1 lock held by neard/4497:
Pid: 4497, comm: neard Not tainted 3.5.0-999-nfc+ #5
Call Trace:
[<ffffffff810952c5>] __might_sleep+0x145/0x200
[<ffffffff81743dde>] mutex_lock_nested+0x2e/0x50
[<ffffffff816ffd19>] nfc_stop_poll+0x39/0xb0
[<ffffffff81700a17>] nfc_genl_rcv_nl_event+0x77/0xc0
[<ffffffff8174aa8c>] notifier_call_chain+0x5c/0x120
[<ffffffff8174abd6>] __atomic_notifier_call_chain+0x86/0x140
[<ffffffff8174ab50>] ? notifier_call_chain+0x120/0x120
[<ffffffff815e1347>] ? skb_dequeue+0x67/0x90
[<ffffffff8174aca6>] atomic_notifier_call_chain+0x16/0x20
[<ffffffff8162119a>] netlink_release+0x24a/0x280
[<ffffffff815d7aa8>] sock_release+0x28/0xa0
[<ffffffff815d7be7>] sock_close+0x17/0x30
[<ffffffff811b2a7c>] __fput+0xcc/0x250
[<ffffffff811b2c0e>] ____fput+0xe/0x10
[<ffffffff81085009>] task_work_run+0x69/0x90
[<ffffffff8101b951>] do_notify_resume+0x81/0xd0
[<ffffffff8174ef22>] int_signal+0x12/0x17

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Add dummy nfc_llc_shdlc_register definition
John W. Linville [Wed, 26 Sep 2012 17:39:10 +0000 (13:39 -0400)]
NFC: Add dummy nfc_llc_shdlc_register definition

This is used when CONFIG_NFC_SHDLC is disabled.

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: LLCP raw socket support
Thierry Escande [Wed, 26 Sep 2012 16:16:44 +0000 (18:16 +0200)]
NFC: LLCP raw socket support

This adds support for socket of type SOCK_RAW to LLCP.
sk_buff are copied and sent to raw sockets with a 2 bytes extra header:
The first byte header contains the nfc adapter index.
The second one contains flags:
- 0x01 - Direction (0=RX, 1=TX)
- 0x02-0x80 - Reserved
A raw socket has to be explicitly bound to a nfc adapter. This is achieved
by specifying the adapter index to be bound to in the dev_idx field of the
sockaddr_nfc_llcp struct passed to bind().

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Fix missing mutex unlock in pn533_send_cmd_frame_async
Szymon Janc [Thu, 27 Sep 2012 07:16:54 +0000 (09:16 +0200)]
NFC: Fix missing mutex unlock in pn533_send_cmd_frame_async

If command allocation failed cmd_lock was not released and deadlock
would occur.

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Use dynamic initialization for rwlocks
Szymon Janc [Tue, 25 Sep 2012 10:42:50 +0000 (12:42 +0200)]
NFC: Use dynamic initialization for rwlocks

If rwlock is dynamically allocated but statically initialized it is
missing proper lockdep annotation.

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
Pid: 3352, comm: neard Not tainted 3.5.0-999-nfc+ #2
Call Trace:
[<ffffffff810c8526>] __lock_acquire+0x8f6/0x1bf0
[<ffffffff81739045>] ? printk+0x4d/0x4f
[<ffffffff810c9eed>] lock_acquire+0x9d/0x220
[<ffffffff81702bfe>] ? nfc_llcp_sock_from_sn+0x4e/0x160
[<ffffffff81746724>] _raw_read_lock+0x44/0x60
[<ffffffff81702bfe>] ? nfc_llcp_sock_from_sn+0x4e/0x160
[<ffffffff81702bfe>] nfc_llcp_sock_from_sn+0x4e/0x160
[<ffffffff817034a7>] nfc_llcp_get_sdp_ssap+0xa7/0x1b0
[<ffffffff81706353>] llcp_sock_bind+0x173/0x210
[<ffffffff815d9c94>] sys_bind+0xe4/0x100
[<ffffffff8139209e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[<ffffffff8174ea69>] system_call_fastpath+0x16/0x1b

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agowl18xx: use module_platform_driver
Devendra Naga [Wed, 29 Aug 2012 17:33:01 +0000 (23:03 +0530)]
wl18xx: use module_platform_driver

the driver's init and exit routines can be implemented with the
module_platform_driver, as the init and exit code is same as
that of the module_platform_driver

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
12 years agonfc: add dummy nfc_llc_shdlc_register definition
John W. Linville [Wed, 26 Sep 2012 17:30:16 +0000 (13:30 -0400)]
nfc: add dummy nfc_llc_shdlc_register definition

This is used when CONFIG_NFC_SHDLC is disabled.

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath5k: add missing breaks in ath5k_hw_set_spur_mitigation_filter
John W. Linville [Mon, 24 Sep 2012 18:30:19 +0000 (14:30 -0400)]
ath5k: add missing breaks in ath5k_hw_set_spur_mitigation_filter

https://bugzilla.kernel.org/show_bug.cgi?id=47681

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: fix BT sleep state on chip wakeup
Rajkumar Manoharan [Mon, 24 Sep 2012 08:34:24 +0000 (14:04 +0530)]
ath9k_hw: fix BT sleep state on chip wakeup

Whenever both WLAN and BT in/out sleep mode, sometimes WLAN
is not able to take back the shared LNA control after resumes
from sleep mode. The idea is that for WLAN to check if BT owns
LNA control and BT is in sleep mode when WLAN just resumes from
sleep mode. If the condition is true, do a BTCOEX_RC_WARM_RESET
for WLAN to take back the control of shared LNA.
Now the issue is the BT sleep value read from MCI register is
overlooked by assigning u32 into u8. Hence the above condition never
be met so that WLAN used to report beacon losses and frequent
connection drops.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Tested-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agort2x00: Replace open coded interface checking with interface combinations.
Gertjan van Wingerde [Sun, 23 Sep 2012 18:22:54 +0000 (20:22 +0200)]
rt2x00: Replace open coded interface checking with interface combinations.

Mac80211 has formal infrastructure to specify which interface combinations
are supported. Make use of this facility in favor of open coding it
ourselves.
So far we only have to specify we can support multiple AP interfaces,
no other combinations are supported.

Inspired by an earlier patch from Paul Fertser.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agort2x00: Deprecate max_sta_intf field of struct rt2x00_ops.
Gertjan van Wingerde [Sun, 23 Sep 2012 18:22:53 +0000 (20:22 +0200)]
rt2x00: Deprecate max_sta_intf field of struct rt2x00_ops.

All drivers set this value to 1, so there is no need (currently) to let
drivers set this.
Therefor, remove the field; we can always add it back when it is needed.

Inspired by an earlier patch from Paul Fertser.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: potential corruption in mwifiex_update_uap_custom_ie()
Dan Carpenter [Sun, 23 Sep 2012 16:33:00 +0000 (19:33 +0300)]
mwifiex: potential corruption in mwifiex_update_uap_custom_ie()

ap_custom_ie is a struct mwifiex_ie_list which is quite different and
also larger than struct mwifiex_ie.  It's a difference between 4196
bytes and 262.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Stone Piao <piaoyun@marvell.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k: Disable ASPM only for AR9285
Sujith Manoharan [Fri, 21 Sep 2012 18:44:28 +0000 (00:14 +0530)]
ath9k: Disable ASPM only for AR9285

Currently, ASPM is disabled for all WLAN+BT combo chipsets
when BTCOEX is enabled. This is incorrect since the workaround
is required only for WB195, which is a AR9285+AR3011 combo
solution. Fix this by checking for the HW version when enabling
the workaround.

Cc: stable@vger.kernel.org
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Tested-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Tue, 25 Sep 2012 19:55:02 +0000 (15:55 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

12 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Tue, 25 Sep 2012 19:54:32 +0000 (15:54 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

12 years agoMerge tag 'nfc-next-3.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
John W. Linville [Tue, 25 Sep 2012 19:50:56 +0000 (15:50 -0400)]
Merge tag 'nfc-next-3.7-1' of git://git./linux/kernel/git/sameo/nfc-3.0

So says Samuel Ortiz <sameo@linux.intel.com>:

This is the first NFC pull request for the 3.7 merge window.

With this one we get:

- HCI and LLC layers separation. We now can support various LLC
  protocols for HCI drivers, SHDLC being one of them. This will be needed as
  we're planning to support raw HCI chipsets that do the SHDLC encapsulation
  in firmware. So for now we have an SHDLC and a NOP LLC layers.

- pn533 command queueing implementation. This simplifies the pn533 locking
  logic and fixes a kernel warning.

- NCI p2p initiator mode implementation.

- Replace custom workqueues with system ones, for HCI and LLCP.

- Raw pn544 driver removal, as scheduled on the features-removal.txt file.

- A few HCI, SHDLC and LLCP fixes.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agocfg80211: Fix regulatory check for 60GHz band frequencies
Vladimir Kondratiev [Sun, 23 Sep 2012 07:49:54 +0000 (09:49 +0200)]
cfg80211: Fix regulatory check for 60GHz band frequencies

The current regulatory code on cfg80211 performs a check to
see if a regulatory rule belongs to an IEEE band so that if
a Country IE is received and no rules are specified for a
band (which is allowed by IEEE) those bands are left intact.
The current band check assumes a rule is bound to a band
if the rule's start or end frequency is less than 2 GHz
apart from the center of frequency being inspected.

In order to support 60 GHz for 802.11ad we need to increase
this to account for the channel spacing of 2160 MHz whereby
a channel somewhere in the middle of a regulatory rule may
be more than 2 GHz apart from either the beginning or
end of the frequency rule.

Without a fix for this even though channels 1-3 are allowed world
wide on the rule (57240 - 63720 @ 2160), channel 2 at 60480 MHz
will end up getting disabled given that it is 3240 MHz from
both the frequency rule start and end frequency. Fix this by
using 2 GHz separation assumption for the 2.4 and 5 GHz bands
but for 60 GHz use a 10 GHz separation before assuming a rule
is not part of the band.

Since we have no 802.11ad drivers yet merged this change has
no impact to existing Linux upstream device drivers.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 years agoNFC: Fix typo negociating -> negotiating
Waldemar Rymarkiewicz [Mon, 24 Sep 2012 06:07:07 +0000 (08:07 +0200)]
NFC: Fix typo negociating -> negotiating

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Don't handle consequent RSET frames after UA
Waldemar Rymarkiewicz [Fri, 21 Sep 2012 12:02:46 +0000 (14:02 +0200)]
NFC: Don't handle consequent RSET frames after UA

During processing incoming RSET frame chip, possibly due to
its internal timout, can retrnasmit an another RSET which
is next queued for processing in shdlc layer.

In case when we accept processed RSET skip those remaining on
the rcv queue until chip will send it's first S or I frame.
This will mean the chip completed connection as well.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Handle RSET in SHDLC_CONNECTING state
Waldemar Rymarkiewicz [Thu, 20 Sep 2012 06:59:11 +0000 (08:59 +0200)]
NFC: Handle RSET in SHDLC_CONNECTING state

As queue_work() does not guarantee immediate execution of sm_work it
can happen in crossover RSET usecase that connect timer will constantly
change the shdlc state from NEGOTIATING to CONNECTING before shdlc has
chance to handle incoming frame.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Acked-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: xmit from hci ops must return 0 or negative
Waldemar Rymarkiewicz [Thu, 20 Sep 2012 06:59:10 +0000 (08:59 +0200)]
NFC: xmit from hci ops must return 0 or negative

xmit callback provided by a driver encapsulates upper layers
data and sends it to the hardware. So, HCI does not know the
exact amount of data being sent and thus can't handle partially
sent frames properly.

Therefore, the driver must return 0 for completely sent frame or
negative for failure.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Acked-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoMAINTAINERS: Add NFC specific mailing list
Samuel Ortiz [Wed, 18 Jul 2012 10:58:51 +0000 (12:58 +0200)]
MAINTAINERS: Add NFC specific mailing list

linux-nfc@lists.01.org is where all the Linux NFC related discussions take
place, and one can also send kernel patches there.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Remove the pn544 raw driver
Cong Wang [Tue, 18 Sep 2012 17:31:58 +0000 (19:31 +0200)]
NFC: Remove the pn544 raw driver

This was scheduled for 3.6, we're late.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Add HCI module description
Eric Lapuyade [Tue, 18 Sep 2012 17:25:38 +0000 (19:25 +0200)]
NFC: Add HCI module description

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Fix LLC registration definitions for ANSI compliance
Eric Lapuyade [Tue, 18 Sep 2012 17:24:37 +0000 (19:24 +0200)]
NFC: Fix LLC registration definitions for ANSI compliance

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Move the pn544_hci dereference below the NULL test
Wei Yongjun [Sat, 8 Sep 2012 13:19:44 +0000 (21:19 +0800)]
NFC: Move the pn544_hci dereference below the NULL test

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Move the nfcwilink dereference below the NULL test
Wei Yongjun [Sat, 8 Sep 2012 01:53:22 +0000 (09:53 +0800)]
NFC: Move the nfcwilink dereference below the NULL test

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Remove unneeded LLC symbols export
Samuel Ortiz [Tue, 18 Sep 2012 17:17:33 +0000 (19:17 +0200)]
NFC: Remove unneeded LLC symbols export

After fixing the LLC Makefile, we no longer need those exports.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Changed HCI and PN544 HCI driver to use the new HCI LLC Core
Eric Lapuyade [Tue, 18 Sep 2012 17:45:48 +0000 (19:45 +0200)]
NFC: Changed HCI and PN544 HCI driver to use the new HCI LLC Core

The previous shdlc HCI driver and its header are removed from the tree.
PN544 now registers directly with HCI and passes the name of the llc it
requires (shdlc).
HCI instantiation now allocates the required llc instance. The llc is
started when the HCI device is brought up.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Add an shdlc llc module to llc core
Eric Lapuyade [Thu, 13 Sep 2012 15:11:37 +0000 (17:11 +0200)]
NFC: Add an shdlc llc module to llc core

This is used by HCI drivers such as the one for the pn544 which require
communications between HCI and the chip to use shdlc.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Add a nop (passthrough) llc module to llc core
Eric Lapuyade [Thu, 13 Sep 2012 15:10:48 +0000 (17:10 +0200)]
NFC: Add a nop (passthrough) llc module to llc core

This is a passthrough llc. It can be used by HCI drivers that don't
need link layer control. HCI will then write directly to the driver, and
driver will deliver incoming frames directly to HCI without any
processing.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Add an LLC Core layer to HCI
Eric Lapuyade [Thu, 13 Sep 2012 15:10:00 +0000 (17:10 +0200)]
NFC: Add an LLC Core layer to HCI

The LLC layer manages modules that control the link layer protocol (such
as shdlc) between HCI and an HCI driver. The driver must simply specify
the required llc when it registers with HCI.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Modified hci_transceive to become an asynchronous operation
Eric Lapuyade [Tue, 11 Sep 2012 08:43:50 +0000 (10:43 +0200)]
NFC: Modified hci_transceive to become an asynchronous operation

This enables the completion callback to be called from a different
context, preventing a possible deadlock if the callback resulted in the
invocation of a nested call to the currently locked nfc_dev.
This is also more in line with the im_transceive nfc_ops for NFC Core or
NCI drivers which already behave asynchronously.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Add a public nfc_hci_send_cmd_async method
Eric Lapuyade [Tue, 11 Sep 2012 08:42:54 +0000 (10:42 +0200)]
NFC: Add a public nfc_hci_send_cmd_async method

This method initiates execution of an HCI cmd. Result will be delivered
through an asynchronous callback.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Changed the HCI cmd execution callback prototype
Eric Lapuyade [Tue, 11 Sep 2012 08:41:41 +0000 (10:41 +0200)]
NFC: Changed the HCI cmd execution callback prototype

Make it match the data_exchange_cb_t so that it can be used directly in
the implementation of an asynchronous hci_transceive

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Correct outgoing frame before requeueing
Waldemar Rymarkiewicz [Fri, 7 Sep 2012 09:08:30 +0000 (11:08 +0200)]
NFC: Correct outgoing frame before requeueing

Driver must handle its data added to the frame, so at this point
removeing control field of shdlc frame is enough.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Acked-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Remove crc generation from shdlc layer
Waldemar Rymarkiewicz [Fri, 7 Sep 2012 09:08:29 +0000 (11:08 +0200)]
NFC: Remove crc generation from shdlc layer

Checksum is specific for a chip spcification and it varies
(in size and type) between different hardware. It should be
handled in the driver then.

Moreover, shdlc spec doesn't mention crc as a part of the frame.

Update pn544_hci driver as well.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Acked-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Fix possible LLCP memory leak
Wei Yongjun [Sun, 2 Sep 2012 13:21:46 +0000 (21:21 +0800)]
NFC: Fix possible LLCP memory leak

nfc_llcp_build_tlv() malloced the memory and should be free in
nfc_llcp_build_gb() after used, and the same in the error handling
case, otherwise it will cause memory leak.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Remove pointless conditional before HCI kfree_skb()
Wei Yongjun [Tue, 28 Aug 2012 13:02:40 +0000 (21:02 +0800)]
NFC: Remove pointless conditional before HCI kfree_skb()

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Set the IRQF_ONESHOT flag from the pn544_hci IRQ handler request
Samuel Ortiz [Fri, 24 Aug 2012 22:40:16 +0000 (00:40 +0200)]
NFC: Set the IRQF_ONESHOT flag from the pn544_hci IRQ handler request

As we don't have a primary handler but only a threaded one, __setup_irq()
ends up failing if we don't set this flag.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Don't use WQ_MEM_RECLAIM for pn533
Tejun Heo [Wed, 22 Aug 2012 23:28:46 +0000 (16:28 -0700)]
NFC: Don't use WQ_MEM_RECLAIM for pn533

NFC driver doesn't sit in memory reclaim path and has no reason to use
WQ_MEM_RECLAIM.  Drop WQ_MEM_RECLAIM from pn533->wq and use
alloc_ordered_workqueue() instead of WQ_UNBOUND w/ max_active == 1.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Use system_nrt_wq instead of custom ones
Tejun Heo [Wed, 22 Aug 2012 23:22:16 +0000 (16:22 -0700)]
NFC: Use system_nrt_wq instead of custom ones

NFC is using a number of custom ordered workqueues w/ WQ_MEM_RECLAIM.
WQ_MEM_RECLAIM is unnecessary unless NFC is gonna be used as transport
for storage device, and all use cases match one work item to one
ordered workqueue - IOW, there's no actual ordering going on at all
and using system_nrt_wq gives the same behavior.

There's nothing to be gained by using custom workqueues.  Use
system_nrt_wq instead and drop all the custom ones.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Remove repeated code for NULL check
Syam Sidhardhan [Wed, 15 Aug 2012 19:25:43 +0000 (00:55 +0530)]
NFC: Remove repeated code for NULL check

This patch remove the repeated code for checking llcp_sock &
llcp_sock->dev against NULL.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Use module_platform_driver macro for nfcwilink.c
Syam Sidhardhan [Wed, 15 Aug 2012 08:34:10 +0000 (14:04 +0530)]
NFC: Use module_platform_driver macro for nfcwilink.c

Simplify the code by make use of module_platform_driver macro.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Implement NCI dep_link_up and dep_link_down
Ilan Elias [Wed, 15 Aug 2012 08:46:24 +0000 (11:46 +0300)]
NFC: Implement NCI dep_link_up and dep_link_down

During NFC-DEP target activation, store the remote
general bytes to be used later in dep_link_up.
When dep_link_up is called, activate the NFC-DEP target,
and forward the remote general bytes.
When dep_link_down is called, deactivate the target.

Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Parse NCI NFC-DEP activation params
Ilan Elias [Wed, 15 Aug 2012 08:46:23 +0000 (11:46 +0300)]
NFC: Parse NCI NFC-DEP activation params

Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Set local general bytes in nci_start_poll
Ilan Elias [Wed, 15 Aug 2012 08:46:22 +0000 (11:46 +0300)]
NFC: Set local general bytes in nci_start_poll

If initiator protocol is NFC-DEP, set the local general bytes
in nci_start_poll.

Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoNFC: Queue pn533 commands
Samuel Ortiz [Fri, 17 Aug 2012 21:47:54 +0000 (23:47 +0200)]
NFC: Queue pn533 commands

Instead of returning EBUSY when getting a command while another one is
running, we queue them. Upon completion of the pending command, the next
one is processed.
Besides the fact that it simplifies the pn533 locking scheme, it also
comes with the nice side effect of fixing the following warning:

[   82.274297] =====================================
[   82.274297] [ BUG: bad unlock balance detected! ]
[   82.274298] 3.5.0-rc1+ #1 Not tainted
[   82.274299] -------------------------------------
[   82.274300] kworker/u:1/16 is trying to release lock (&dev->cmd_lock) at:
[   82.274305] [<ffffffff8144f246>] mutex_unlock+0x9/0xb
[   82.274305] but there are no more locks to release!
[   82.274306]
[   82.274306] other info that might help us debug this:
[   82.274306] 2 locks held by kworker/u:1/16:
[   82.274311]  #0:  (pn533){.+.+..}, at: [<ffffffff8103a67d>]
+process_one_work+0x145/0x2e2
[   82.274314]  #1:  ((&dev->cmd_work)){+.+...}, at: [<ffffffff8103a67d>]
+process_one_work+0x145/0x2e2
[   82.274314]
[   82.274314] stack backtrace:
[   82.274315] Pid: 16, comm: kworker/u:1 Not tainted 3.5.0-rc1+ #1
[   82.274315] Call Trace:
[   82.274317]  [<ffffffff8144f246>] ? mutex_unlock+0x9/0xb
[   82.274321]  [<ffffffff81059841>] print_unlock_inbalance_bug+0xda/0xe4
[   82.274323]  [<ffffffff8105c74c>] lock_release_non_nested+0xb2/0x232
[   82.274325]  [<ffffffff8105a61e>] ? mark_held_locks+0x6d/0x95
[   82.274326]  [<ffffffff8144f246>] ? mutex_unlock+0x9/0xb
[   82.274328]  [<ffffffff81451105>] ? _raw_spin_unlock_irqrestore+0x40/0x5c
[   82.274329]  [<ffffffff8144f246>] ? mutex_unlock+0x9/0xb
[   82.274330]  [<ffffffff8105ca42>] lock_release+0x176/0x1ac
[   82.274333]  [<ffffffff8123de14>] ? pn533_send_complete+0xa8/0xa8
[   82.274334]  [<ffffffff8144f1d6>] __mutex_unlock_slowpath+0xb0/0x117
[   82.274336]  [<ffffffff8144f246>] mutex_unlock+0x9/0xb
[   82.274337]  [<ffffffff8123de65>] pn533_wq_cmd_complete+0x51/0x55
[   82.274338]  [<ffffffff8103a6db>] process_one_work+0x1a3/0x2e2
[   82.274340]  [<ffffffff8103a67d>] ? process_one_work+0x145/0x2e2
[   82.274341]  [<ffffffff8103b119>] worker_thread+0xcf/0x153
[   82.274343]  [<ffffffff8103b04a>] ? manage_workers.isra.22+0x16b/0x16b
[   82.274344]  [<ffffffff8103b04a>] ? manage_workers.isra.22+0x16b/0x16b
[   82.274346]  [<ffffffff8103eb11>] kthread+0x95/0x9d
[   82.274348]  [<ffffffff81452ef4>] kernel_thread_helper+0x4/0x10
[   82.274351]  [<ffffffff81046561>] ? finish_task_switch+0x45/0xc3
[   82.274352]  [<ffffffff814514f0>] ? retint_restore_args+0x13/0x13
[   82.274353]  [<ffffffff8103ea7c>] ? __init_kthread_worker+0x55/0x55
[   82.274354]  [<ffffffff81452ef0>] ? gs_change+0x13/0x13

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
12 years agoath5k: disable HW crypto in management frame
Chun-Yeow Yeoh [Fri, 14 Sep 2012 10:26:11 +0000 (18:26 +0800)]
ath5k: disable HW crypto in management frame

Hardware support for MFP is not available in ath5k. Thus,
this implementation allows the mac80211 stack to do the
actuall crypto operation.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agocarl9170: connect to 11w protected networks
Christian Lamparter [Sun, 2 Sep 2012 12:25:50 +0000 (14:25 +0200)]
carl9170: connect to 11w protected networks

Previously, it was not possible to connect to
networks which requires 11w to be supported by
the stations.

While the documentation hints that there's some
hardware support for offloading MFP "decryption",
this simple implementation relies on the mac80211
stack to do the actual crypto operations.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agop54: connect to 11w protected networks
Christian Lamparter [Fri, 7 Sep 2012 23:48:19 +0000 (01:48 +0200)]
p54: connect to 11w protected networks

Previously, it was not possible to connect to
networks which requires 11w to be supported by
the stations.

Note:

As all current (and old) firmwares corrupt
incoming, protected management frames, the
decryption offloading needs to be disabled.
This will be done automatically if needed.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlegacy: use eth_broadcast_addr
Johannes Berg [Wed, 19 Sep 2012 09:57:17 +0000 (11:57 +0200)]
iwlegacy: use eth_broadcast_addr

Instead of copying from a constant array
(which is still needed for other purposes)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>