platform/kernel/linux-amlogic.git
11 years agoBluetooth: Update stop_discovery to use HCI request
Andre Guedes [Tue, 30 Apr 2013 18:29:33 +0000 (15:29 -0300)]
Bluetooth: Update stop_discovery to use HCI request

This patch modifies the stop_discovery function so it uses the HCI
request framework.

The HCI request is built according to the current discovery state
(inquiry, LE scanning or name resolving) and a complete callback is
register to handle the command complete event for the stop discovery
command. This way, we move all stop_discovery mgmt handling code
spread in hci_event.c to a single place in mgmt.c.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Use HCI request in interleaved discovery
Andre Guedes [Tue, 30 Apr 2013 18:29:32 +0000 (15:29 -0300)]
Bluetooth: Use HCI request in interleaved discovery

In order to have a better HCI error handling in interleaved discovery
functionality, we should use the HCI request framework.

This patch updates le_scan_disable_work function so it uses the
HCI request framework instead of the hci_send_cmd helper. A complete
callback is registered (le_scan_disable_work_complete function) so we
are able to trigger the inquiry procedure (if we are running the
interleaved discovery) or to stop the discovery procedure (if we are
running LE-only discovery).

This patch also removes the extra logic in hci_cc_le_set_scan_enable
to trigger the inquiry procedure and the mgmt_interleaved_discovery
function since they become useless.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Move discovery macros to hci_core.h
Andre Guedes [Tue, 30 Apr 2013 18:29:31 +0000 (15:29 -0300)]
Bluetooth: Move discovery macros to hci_core.h

Some of discovery macros will be used in hci_core so we need to
define them in common place such as hci_core.h. Thus, this patch
moves discovery macros to hci_core.h and also adds the DISCOV_
prefix to them.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Make mgmt_start_discovery_failed static
Andre Guedes [Tue, 30 Apr 2013 18:29:30 +0000 (15:29 -0300)]
Bluetooth: Make mgmt_start_discovery_failed static

mgmt_start_discovery_failed is now only used in mgmt.c so we can
make it a local function. This patch also moves the mgmt_start_
discovery_failed definition up in mgmt.c to avoid forward
declaration.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove start discovery handling from hci_event.c
Andre Guedes [Tue, 30 Apr 2013 18:29:29 +0000 (15:29 -0300)]
Bluetooth: Remove start discovery handling from hci_event.c

Since all mgmt start discovery command complete events are now handled
in start_discovery_complete callback in mgmt.c, we can remove this
handling from hci_event.c.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Update start_discovery to use HCI request
Andre Guedes [Tue, 30 Apr 2013 18:29:28 +0000 (15:29 -0300)]
Bluetooth: Update start_discovery to use HCI request

This patch modifies the start_discovery function so it uses the HCI
request framework.

We build the HCI request according to the discovery type (add inquiry
or LE scan HCI commands) and run the HCI request. We also register
the start_discovery_complete callback which handles mgmt command
complete events for this command. This way, we move all start_
discovery mgmt handling code spread in hci_event.c to a single place
in mgmt.c.

This patch also merges the LE-only and interleaved discovery type
cases since these cases are pretty much the same now.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Make inquiry_cache_flush non-static
Andre Guedes [Tue, 30 Apr 2013 18:29:27 +0000 (15:29 -0300)]
Bluetooth: Make inquiry_cache_flush non-static

In order to use HCI request framework in start_discovery, we'll need
to call inquiry_cache_flush in mgmt.c. Therefore, this patch adds the
hci_ prefix to inquiry_cache_flush and makes it non-static.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix multiple LE socket handling
Johan Hedberg [Mon, 29 Apr 2013 16:35:45 +0000 (19:35 +0300)]
Bluetooth: Fix multiple LE socket handling

The LE ATT server socket needs to be superseded by any ATT client
sockets. Previously this was done by looking at the hcon->out variable
(indicating whether the connection is outgoing or incoming) which is a
too crude way of determining whether the server socket needs to be
picked or not (an outgoing connection doesn't necessarily mean that an
ATT client socket has triggered it).

This patch extends the ATT server socket lookup function
(l2cap_le_conn_ready) to be used for all LE connections (regardless of
the hcon->out value) and adds an internal check into the function for
the existence of any ATT client sockets (in which case the server socket
should be skipped). For this to work reliably all lookups must be done
while the l2cap_conn->chan_lock is held, meaning also that the call to
l2cap_chan_add needs to be changed to its lockless __l2cap_chan_add
counterpart.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove useless hci_conn disc_timeout setting
Johan Hedberg [Mon, 29 Apr 2013 16:35:44 +0000 (19:35 +0300)]
Bluetooth: Remove useless hci_conn disc_timeout setting

There's no need to reset disc_timeout in l2cap_le_conn_ready since
HCI_DISCONN_TIMEOUT is the default when the hci_conn is created and
there should be no way for it to get changed between creation and
l2cap_le_conn_ready being called.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Simplify hci_conn_hold/drop logic for L2CAP
Johan Hedberg [Mon, 29 Apr 2013 16:35:43 +0000 (19:35 +0300)]
Bluetooth: Simplify hci_conn_hold/drop logic for L2CAP

The L2CAP code has been incrementing the hci_conn reference for each
l2cap_chan instance in the l2cap_conn list. Likewise, the reference is
dropped each time an l2cap_chan is removed from the list. The reference
counting policy with respect to removal has been clear and explicit in
the l2cap_chan_del function, however for addition the function
calling 2cap_chan_add has always had to do a separate hci_conn_hold
call.

What made the counting even more hard to follow is that the
hci_connect() procedure increments the reference and the L2CAP layer
making this call took advantage of it to use it as its own reference.

This patch aims to clarify things by having the call to hci_conn_hold
inside __l2cap_chan_add, thereby removing the need to do it in the
functions calling __l2cap_chan_add. The reference count for hci_connect
is still kept as it's necessary for users such as mgmt_pair_device,
however for the L2CAP layer it means that an extra call to hci_conn_drop
must be performed once l2cap_chan_add has been done.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove unnecessary L2CAP channel state check
Johan Hedberg [Mon, 29 Apr 2013 16:35:42 +0000 (19:35 +0300)]
Bluetooth: Remove unnecessary L2CAP channel state check

In l2cap_att_channel() we're only interested in the BT_CONNECTED state
so this state can directly be passed to l2cap_global_chan_by_scid().
This way there's no need to do any additional state check later.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove useless sk variable in l2cap_le_conn_ready
Johan Hedberg [Mon, 29 Apr 2013 16:35:41 +0000 (19:35 +0300)]
Bluetooth: Remove useless sk variable in l2cap_le_conn_ready

The sk variable is of quite little use since it's only used to simplify
access in the two bt_sk() calls.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix duplicate call to l2cap_chan_ready()
Johan Hedberg [Mon, 29 Apr 2013 16:35:40 +0000 (19:35 +0300)]
Bluetooth: Fix duplicate call to l2cap_chan_ready()

In l2cap_le_conn_ready() after doing l2cap_chann_add() the LE channel is
part of the list which is subsequently iterated in l2cap_conn_ready() in
this loop each channel will get l2cap_chan_ready() called which would
result in trying to set the channel two times into BT_CONNECTED state.
Instead it makes sense to just add the channel but not call chan_ready
in l2cap_le_conn_ready, which is what this patch does.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Add clarifying comment to l2cap_conn_ready()
Johan Hedberg [Mon, 29 Apr 2013 16:35:39 +0000 (19:35 +0300)]
Bluetooth: Add clarifying comment to l2cap_conn_ready()

There is an extra call to smp_conn_security() for outgoing LE
connections from l2cap_conn_ready() but the reason for this call is far
from clear. After a bit of commit history research and using git blame I
found out that this extra call is for socket-less pairing processes
added by commit 160dc6ac1. This patch adds a clarifying comment to the
code for this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix hardcoding ATT CID in __l2cap_chan_add()
Johan Hedberg [Mon, 29 Apr 2013 16:35:38 +0000 (19:35 +0300)]
Bluetooth: Fix hardcoding ATT CID in __l2cap_chan_add()

Since in the future more than the ATT CID may be permissible we should
not be hardcoding it for all LE connections in __l2cap_chan_add().
Instead, the source ATT CID should only be set if the destination is
also ATT, and in other cases we should just use the existing dynamic CID
allocation function.

Assigning scid based on dcid means that whenever __l2cap_chan_add() is
called that chan->dcid is properly initialized. l2cap_le_conn_ready()
wasn't initializing is properly so this is also taken care of in this
patch.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix EBUSY condition test in l2cap_chan_connect
Johan Hedberg [Mon, 29 Apr 2013 16:35:37 +0000 (19:35 +0300)]
Bluetooth: Fix EBUSY condition test in l2cap_chan_connect

The current test in l2cap_chan_connect is intended to protect against
multiple conflicting connect attempts. However, it assumes that there
will ever only be a single CID that is connected to, which is not true.
We do need to check for conflicts with connect attempts to the same
destination CID but this check is not in anyway specific to LE but can
be applied to BR/EDR as well.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix LE vs BR/EDR selection when connecting
Johan Hedberg [Mon, 29 Apr 2013 16:35:36 +0000 (19:35 +0300)]
Bluetooth: Fix LE vs BR/EDR selection when connecting

The choice between LE and BR/EDR should be made on the destination
address type instead of the destination CID. This is particularly
important when in the future more than one CID will be allowed for LE.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Rename L2CAP_CID_LE_DATA to L2CAP_CID_ATT
Johan Hedberg [Mon, 29 Apr 2013 16:35:35 +0000 (19:35 +0300)]
Bluetooth: Rename L2CAP_CID_LE_DATA to L2CAP_CID_ATT

In future Core Specification versions the ATT CID will be just one of
many possible CIDs that can be used for data transfer. Therefore, it
makes sense to rename the define for the ATT CID to something less
ambigous.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Handle LE L2CAP signalling in its own function
Johan Hedberg [Mon, 29 Apr 2013 16:35:33 +0000 (19:35 +0300)]
Bluetooth: Handle LE L2CAP signalling in its own function

The LE L2CAP signalling channel follows its own rules and will continue
to evolve independently from the BR/EDR signalling channel. Therefore,
it makes sense to have a clear split from BR/EDR by having a dedicated
function for handling LE signalling commands.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agomwifiex: channel switch handling for station
Amitkumar Karwar [Tue, 18 Jun 2013 23:36:58 +0000 (16:36 -0700)]
mwifiex: channel switch handling for station

After receiving channel switch announcement from AP, scan and
association on that channel is blocked for DFS_CHAN_MOVE_TIME
(10 seconds). Hence station will be able to connect to the AP,
once it is moved to new channel.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: add basic 11h support for station
Amitkumar Karwar [Wed, 19 Jun 2013 15:49:05 +0000 (08:49 -0700)]
mwifiex: add basic 11h support for station

This patch adds code to parse requested AP's 11h capabilities
and add 11h information in association request.

Also, deauth is sent to the AP after receiving channel switch
announcement event from firmware. This happens when AP advertises
WLAN_EID_CHANNEL_SWITCH IE in it's beacon.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcm80211: fix null pointer access
Antonio Quartulli [Wed, 19 Jun 2013 11:35:31 +0000 (13:35 +0200)]
brcm80211: fix null pointer access

Do not unconditionally access the chan variable in
brcmf_cfg80211_mgmt_tx() as it may be NULL.
Use freq instead.

Introduced by c2ff8cad64233b539c71a27e2a6e324001143ef0
("brcm80211: make mgmt_tx in brcmfmac accept a NULL channel")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: code rearrangement for better readability
Amitkumar Karwar [Tue, 18 Jun 2013 23:36:56 +0000 (16:36 -0700)]
mwifiex: code rearrangement for better readability

Use negative check (if(!bss_desc)) and return failure
instead of failing a NULL check later in
mwifiex_check_network_compatibility() routine.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agortlwifi: rtl8192cu: Fix duplicate if test
Larry Finger [Tue, 18 Jun 2013 18:25:05 +0000 (13:25 -0500)]
rtlwifi: rtl8192cu: Fix duplicate if test

A typo causes routine rtl92cu_phy_rf6052_set_cck_txpower() to test the
same condition twice. The problem was found using cppcheck-1.49, and the
proper fix was verified against the pre-mac80211 version of the code.

This patch was originally included as commit 1288aa4, but was accidentally
reverted in a later patch.

Reported-by: David Binderman <dcb314@hotmail.com> [original report]
Reported-by: Andrea Morello <andrea.merello@gmail.com> [report of accidental reversion]
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: stable <stable@vger.kernel.org> [back to 2.6.39]
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: add sdio sg list support
Franky Lin [Tue, 18 Jun 2013 11:29:29 +0000 (13:29 +0200)]
brcmfmac: add sdio sg list support

Add scatter gather list support for better rx glom performance.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: replace brcmf_sdioh_request_buffer with brcmf_sdio_buffrw
Franky Lin [Tue, 18 Jun 2013 11:29:28 +0000 (13:29 +0200)]
brcmfmac: replace brcmf_sdioh_request_buffer with brcmf_sdio_buffrw

Introducing a new SDIO block data access interface function
brcmf_sdio_buffrw. It will act as a unified interface function for any block
data access to WiFi dongle through SDIO interface. This patch enables
the support for single skb transmission.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove redundant chip ID check in dhd_sdio
Franky Lin [Tue, 18 Jun 2013 11:29:27 +0000 (13:29 +0200)]
brcmfmac: remove redundant chip ID check in dhd_sdio

There is an ID table registered to SDIO stack which consists of all SDIO devices
supported by brcmfmac. It is not necessary to have an extra check.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: simplify dpc handling using atomic operations
Arend van Spriel [Tue, 18 Jun 2013 11:29:26 +0000 (13:29 +0200)]
brcmfmac: simplify dpc handling using atomic operations

Instead of allocating an empty list item and queue that for
the dpc data worker to dequeue an atomic counter is used.

Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: consolidate mac_descriptor related function names
Arend van Spriel [Tue, 18 Jun 2013 11:29:25 +0000 (13:29 +0200)]
brcmfmac: consolidate mac_descriptor related function names

Just cleaning up and being consistent in naming operations
related to struct brcmf_fws_mac_descriptor objects.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove dependency with nl80211.h
Arend van Spriel [Tue, 18 Jun 2013 11:29:24 +0000 (13:29 +0200)]
brcmfmac: remove dependency with nl80211.h

The firmware-signalling code used NL80211_NUM_ACS, but it has
its own definition enum brcmf_fws_fifo, which is more appropriate
to use. This effectively removes the need to include nl80211.h.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: rename variable prec to more appropriate name, ie. fifo
Arend van Spriel [Tue, 18 Jun 2013 11:29:23 +0000 (13:29 +0200)]
brcmfmac: rename variable prec to more appropriate name, ie. fifo

The term prec (precedence) is different from the fifo number. Rename
use of prec with fifo to be consistent and clear.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Only use credits for bcmc when firmware indicates it.
Hante Meuleman [Tue, 18 Jun 2013 11:29:22 +0000 (13:29 +0200)]
brcmfmac: Only use credits for bcmc when firmware indicates it.

The firmware will sent an event message when bc/mc traffic should
be sent to the device using credit mechanism.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Program initvals for CUS217
Sujith Manoharan [Tue, 18 Jun 2013 10:12:38 +0000 (15:42 +0530)]
ath9k: Program initvals for CUS217

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Add initvals required for CUS217
Sujith Manoharan [Tue, 18 Jun 2013 10:12:37 +0000 (15:42 +0530)]
ath9k: Add initvals required for CUS217

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Add PCI IDs for CUS217
Sujith Manoharan [Tue, 18 Jun 2013 10:12:36 +0000 (15:42 +0530)]
ath9k: Add PCI IDs for CUS217

CUS217 is a card based on AR9462.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath10k: off by one sanity check
Dan Carpenter [Tue, 18 Jun 2013 07:28:46 +0000 (10:28 +0300)]
ath10k: off by one sanity check

This should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: register serial flash as platform device
Rafał Miłecki [Tue, 18 Jun 2013 05:33:40 +0000 (07:33 +0200)]
ssb: register serial flash as platform device

This allows writing MTD driver working as a platform driver. In
platform_data it will receive struct ssb_sflash, which contains all
important data about flash (window, size).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Modify IDs to identify CUS230
Sujith Manoharan [Tue, 18 Jun 2013 04:43:43 +0000 (10:13 +0530)]
ath9k: Modify IDs to identify CUS230

CUS198 and CUS230 are similar cards, both
are AR9485 + xLNA solutions. But, the subsystem IDs
differ - identify CUS230 explicitly to make things
clearer.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Add support for 5G-XLNA/AR9462
Sujith Manoharan [Tue, 18 Jun 2013 04:43:42 +0000 (10:13 +0530)]
ath9k: Add support for 5G-XLNA/AR9462

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Update AR9462 2.0 initvals
Sujith Manoharan [Tue, 18 Jun 2013 04:43:41 +0000 (10:13 +0530)]
ath9k: Update AR9462 2.0 initvals

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Convert a couple of debug messages
Sujith Manoharan [Tue, 18 Jun 2013 04:43:40 +0000 (10:13 +0530)]
ath9k: Convert a couple of debug messages

Use the REGULATORY debug level to print the target power
details. EEPROM can be used for other purposes and this
spams the log.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Merge HWTIMER debug level with BTCOEX
Sujith Manoharan [Tue, 18 Jun 2013 04:43:39 +0000 (10:13 +0530)]
ath9k: Merge HWTIMER debug level with BTCOEX

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca...
John W. Linville [Tue, 18 Jun 2013 18:45:21 +0000 (14:45 -0400)]
Merge branch 'for-linville' of git://git./linux/kernel/git/luca/wl12xx

11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Tue, 18 Jun 2013 18:43:50 +0000 (14:43 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-fixes

11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Tue, 18 Jun 2013 18:04:51 +0000 (14:04 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

11 years agortlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND
Larry Finger [Mon, 17 Jun 2013 18:25:49 +0000 (13:25 -0500)]
rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND

This is a new device for this driver.

Reported-by: Tobias Kluge <zielscheibe@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Tobias Kluge <zielscheibe@gmail.com>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: add struct for serial flash
Rafał Miłecki [Mon, 17 Jun 2013 17:56:20 +0000 (19:56 +0200)]
ssb: add struct for serial flash

This data allow writing for example MTD driver.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: use const for serial flash hardware table
Rafał Miłecki [Mon, 17 Jun 2013 17:19:20 +0000 (19:19 +0200)]
bcma: use const for serial flash hardware table

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: use const for serial flash hardware table
Rafał Miłecki [Mon, 17 Jun 2013 17:19:19 +0000 (19:19 +0200)]
ssb: use const for serial flash hardware table

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: update core (en|dis)abling functions
Rafał Miłecki [Mon, 17 Jun 2013 16:34:32 +0000 (18:34 +0200)]
bcma: update core (en|dis)abling functions

Broadocm updated their code, this may be needed for newer hardware or
some corner cases.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Fix ANI for AP mode
Sujith Manoharan [Mon, 17 Jun 2013 08:54:36 +0000 (14:24 +0530)]
ath9k: Fix ANI for AP mode

The commit "ath9k: Fix ANI monitoring" reverted an earlier
commit that adjusted ANI to improve performance. But, this causes
adverse effects in AP mode (as reported by Felix based on an OpenWrt
report). Use the older INI/period configuration for now until more
testing is done.

Cc: Felix Fietkau <nbd@openwrt.org>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Fix LNA gpio for AR9485
Sujith Manoharan [Mon, 17 Jun 2013 01:31:47 +0000 (07:01 +0530)]
ath9k: Fix LNA gpio for AR9485

The commit "ath9k: Add custom parameters for CUS198" didn't
pass the correct gpio value to ath9k_hw_cfg_output(). Fix it.

Reported-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: fix memory corruption when unsetting multicast list
Daniel Drake [Fri, 14 Jun 2013 19:24:24 +0000 (15:24 -0400)]
mwifiex: fix memory corruption when unsetting multicast list

When trying to unset a previously-set multicast list (i.e. the new list
has 0 entries), mwifiex_set_multicast_list() was calling down to
mwifiex_request_set_multicast_list() while leaving
mcast_list.num_multicast_addr as an uninitialized value.

We were arriving at mwifiex_cmd_mac_multicast_adr() which would then
proceed to do an often huge memcpy of
mcast_list.num_multicast_addr*ETH_ALEN bytes, causing memory corruption
and hard to debug crashes.

Fix this by setting mcast_list.num_multicast_addr to 0 when no multicast
list is provided. Similarly, fix up the logic in
mwifiex_request_set_multicast_list() to unset the multicast list that
was previously sent to the hardware in such cases.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: Add module parameter for regdomain
Avinash Patil [Mon, 10 Jun 2013 22:40:07 +0000 (15:40 -0700)]
mwifiex: Add module parameter for regdomain

Allow a regulatory domain country code to be specified at boot
using a module argument.  This overrides the firmware regulatory
mode.

This patch also enables uAP to operate in 11a mode with hostapd.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agonet: wireless: wl1251: Fix commenting style
Sachin Kamat [Wed, 29 May 2013 10:18:23 +0000 (15:48 +0530)]
net: wireless: wl1251: Fix commenting style

Make the commenting style consistent with networking block comment
style as suggested by checkpatch.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agonet: wireless: wl1251: Use module_spi_driver macro
Sachin Kamat [Wed, 29 May 2013 10:18:22 +0000 (15:48 +0530)]
net: wireless: wl1251: Use module_spi_driver macro

module_spi_driver() eliminates some boiler plate and makes code
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agonet/wireless/ti/wlcore/spi: Use module_spi_driver to register driver
Peter Huewe [Mon, 20 May 2013 19:52:40 +0000 (21:52 +0200)]
net/wireless/ti/wlcore/spi: Use module_spi_driver to register driver

Removing some boilerplate by using module_spi_driver instead of calling
register and unregister in the otherwise empty init/exit functions

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: fix occasional AP TX stop after recovery
Victor Goldenshtein [Sun, 12 May 2013 09:35:31 +0000 (12:35 +0300)]
wlcore: fix occasional AP TX stop after recovery

The fw_status wasn't zeroed during allocation, resulting
in uninitialized var usage, and finally causing AP
traffic stop after recovery.

The wrong value in fw_status_2->counters.tx_lnk_free_pkts
led to a bad lnk->allocated_pkts calculation in
wlcore_fw_status(), causing wl18xx_lnk_low_prio() to return
FALSE (lnk->allocated_pkts > thold).
This eventually blocked the link in wlcore_tx_work_locked(),
as wl1271_skb_dequeue() continuously returned NULL.

Fix it by zeroing wl->fw_status_1/2 during allocation.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: hold jiffies in unsigned long
Arik Nemtsov [Sun, 12 May 2013 09:35:30 +0000 (12:35 +0300)]
wlcore: hold jiffies in unsigned long

u32 can be incorrect (too small) for some architectures.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: cancel channel switch work on interface removal
Arik Nemtsov [Sun, 12 May 2013 09:35:29 +0000 (12:35 +0300)]
wlcore: cancel channel switch work on interface removal

Otherwise, if the work is pending, we might get
a bad dereference after the interface is removed.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: set default_wep_key when configured
Yoni Divinsky [Sun, 12 May 2013 09:35:28 +0000 (12:35 +0300)]
wlcore: set default_wep_key when configured

When associating to an AP with WEP set the
default key upon association by implementing
the set_deafult_key_idx op.

Fixes auto-arp sent with wrong key_idx bug.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowl18xx: use locally administered MAC address if not available from fuse
Luciano Coelho [Wed, 8 May 2013 09:54:56 +0000 (12:54 +0300)]
wl18xx: use locally administered MAC address if not available from fuse

In some R&D chips, the device may be left untrimmed and with the MAC
address missing from fuse ROM.  In order to support those devices,
apply a random locally administered MAC address instead.

Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: configure rates in multiple cases
Eliad Peller [Tue, 7 May 2013 12:41:08 +0000 (15:41 +0300)]
wlcore: configure rates in multiple cases

The current code configures the peer caps only on BSS_CHANGED_HT
notification. However, we have to configure the peer caps
(and rates) even when HT is not enabled. Otherwise, the fw
continues working with low rates.

Configure the peer caps when sta_exists is true (i.e. when
we extracted the sta rates, e.g. on association).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: move sysfs handling to a separate file
Luciano Coelho [Fri, 3 May 2013 23:46:38 +0000 (02:46 +0300)]
wlcore: move sysfs handling to a separate file

Instead of doing all the sysfs file handling in the main file, move it
to a new sysfs source file to reduce the amount of code in a single
file.

Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowlcore: some non-functional clean-ups in main.c
Luciano Coelho [Fri, 3 May 2013 22:06:11 +0000 (01:06 +0300)]
wlcore: some non-functional clean-ups in main.c

Remove unnecessary includes; remove duplicate and useless defines; fix
copyright notice and remove some unnecessary line breaks.

Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agowl18xx: FDSP Code RAM Corruption fix
Ido Reis [Tue, 27 Nov 2012 06:44:51 +0000 (08:44 +0200)]
wl18xx: FDSP Code RAM Corruption fix

In PG2.0 there is an issue where PHY's FDSP Code RAM sometimes gets
corrupted when exiting from ELP mode. This issue is related to FDSP
Code RAM clock implementation.

PG2.1 introduces a HW fix for this issue that requires the driver to
change the FDSP Code Ram clock settings (mux it to ATGP clock instead
of its own clock).

This workaround uses PHY_FPGA_SPARE_1 register and is relevant to WL8
PG2.1 devices.

The fix is also backward compatible with older PG2.0 devices where the
register PHY_FPGA_SPARE_1 is not used and not connected.

The fix is done in the wl18xx_pre_upload function (must be performed
before uploading the FW code) and includes the following steps:

1. Disable FDSP clock
2. Set ATPG clock toward FDSP Code RAM rather than its own clock.
3. Re-enable FDSP clock

Signed-off-by: Yair Shapira <yair.shapira@ti.com>
Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
11 years agoorinoco_usb: fix memory leak in ezusb_access_ltv() when device disconnected
Alexey Khoroshilov [Thu, 13 Jun 2013 20:26:11 +0000 (00:26 +0400)]
orinoco_usb: fix memory leak in ezusb_access_ltv() when device disconnected

If "device is disconnected" check occurs to be true in ezusb_access_ltv(),
it just return -ENODEV. But that means request_context is leaked since
there are no any references to it anymore.
The patch adds a call to ezusb_request_context_put() before return.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Add custom parameters for CUS198
Sujith Manoharan [Thu, 13 Jun 2013 17:21:26 +0000 (22:51 +0530)]
ath9k: Add custom parameters for CUS198

CUS198 is a card based on AR9485. There are differences
between the base reference design HB125 and CUS198.
Identify such cards based on the PCI subsystem IDs and
set HW parameters appropriately.

Addresses this bug - https://bugzilla.kernel.org/show_bug.cgi?id=49201

Cc: jkp@iki.fi
Cc: gfmichaud@gmail.com
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge tag 'nfc-next-3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
John W. Linville [Fri, 14 Jun 2013 17:34:39 +0000 (13:34 -0400)]
Merge tag 'nfc-next-3.11-1' of git://git./linux/kernel/git/sameo/nfc-next

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

"These are the pending NFC patches for the 3.11 merge window.

It contains the pending fixes that were on nfc-fixes (nfc-fixes-3.10-2),
along with a few more for the pn544 and pn533 drivers, the LLCP
disconnection path and an LLCP memory leak.

Highlights for this one are:

- An initial secure element API. NFC chipsets can carry an embedded
  secure element or get access to the SIM one. In both cases they
  control the secure elements and this API provides a way to discover,
  enable and disable the available SEs. It also exports that to
  userspace in order for SE focused middleware to actually do something
  with them (e.g. payments).

- NCI over SPI support. SPI is the most complex NCI specified transport
  layer and we now have support for it in the kernel. The next step will
  be to implement drivers for NCI chipsets using this transport like
  e.g. bcm2079x.

- NFC p2p hardware simulation driver. We now have an nfcsim driver that
  is mostly a loopback device between 2 NFC interfaces. It also
  implements the rest of the NFC core API like polling and target
  detection. This driver, with neard running on top of it, allows us to
  completely test the LLCP, SNEP and Handover implementation without
  physical hardware.

- A Firmware update netlink API. Most (All ?) HCI chipsets have a
  special firmware update mode where applications can push a new
  firmware that will be flashed. We now have a netlink API for providing
  that mode to e.g. nfctool."

Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Fri, 14 Jun 2013 17:18:24 +0000 (13:18 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

11 years agoNFC: mei_phy: Clean up file
Valentin Ilie [Fri, 7 Jun 2013 19:01:55 +0000 (22:01 +0300)]
NFC: mei_phy: Clean up file

Fix checkpatch warnings.
Replace __attribute__((__packed__)) with __packed.
Replace spaces with tabs.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Fix the well known services endianness
Samuel Ortiz [Mon, 3 Jun 2013 10:10:04 +0000 (12:10 +0200)]
NFC: llcp: Fix the well known services endianness

The WKS (Well Known Services) bitmask should be transmitted in big endian
order. Picky implementations will refuse to establish an LLCP link when the
WKS bit 0 is not set to 1. The vast majority of implementations out there
are not that picky though...

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Set the LLC Link Management well known service bit
Samuel Ortiz [Tue, 28 May 2013 13:41:32 +0000 (15:41 +0200)]
NFC: llcp: Set the LLC Link Management well known service bit

In order to advertise our LLCP support properly and to follow the LLCP
specs requirements, we need to initialize the WKS (Well-Known Services)
bitfield to 1 as SAP 0 is the only mandatory supported service.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Do not send pending Tx frames when the remote is not ready
Samuel Ortiz [Tue, 28 May 2013 13:03:17 +0000 (15:03 +0200)]
NFC: llcp: Do not send pending Tx frames when the remote is not ready

When we receive a RNR, the remote is busy processing the last received
frame. We set a local flag for that, and we should send a SYMM when it
is set instead of sending any pending frame.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Fix non blocking sockets connections
Samuel Ortiz [Fri, 3 May 2013 16:29:30 +0000 (18:29 +0200)]
NFC: llcp: Fix non blocking sockets connections

Without the new LLCP_CONNECTING state, non blocking sockets will be
woken up with a POLLHUP right after calling connect() because their
state is stuck at LLCP_CLOSED.
That prevents userspace from implementing any proper non blocking
socket based NFC p2p client.

Cc: stable@vger.kernel.org
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add a nfc hardware simulation driver
Thierry Escande [Thu, 6 Jun 2013 14:23:23 +0000 (16:23 +0200)]
NFC: Add a nfc hardware simulation driver

This driver declares two virtual NFC devices supporting NFC-DEP protocol.
An LLCP connection can be established between them and all packets sent
from one device is sent back to the other, acting as loopback devices.

Once established, the LLCP link can be disconnected by disabling the target
device (with rfkill, nfctool, or neard disable-adapter test script).

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Fix a potential memory leak
Thierry Escande [Wed, 5 Jun 2013 15:15:59 +0000 (17:15 +0200)]
NFC: Fix a potential memory leak

In nfc_llcp_tx_work() the sk_buff is not freed when the llcp_sock
is null and the PDU is an I one.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Keep socket alive until the DISC PDU is actually sent
Thierry Escande [Tue, 4 Jun 2013 09:34:51 +0000 (11:34 +0200)]
NFC: Keep socket alive until the DISC PDU is actually sent

This patch keeps the socket alive and therefore does not remove
it from the sockets list in the local until the DISC PDU has been
actually sent. Otherwise we would reply with DM PDUs before sending
the DISC one.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Rename nfc_llcp_disconnect() to nfc_llcp_send_disconnect()
Thierry Escande [Tue, 4 Jun 2013 09:34:50 +0000 (11:34 +0200)]
NFC: Rename nfc_llcp_disconnect() to nfc_llcp_send_disconnect()

nfc_llcp_send_disconnect() already exists but is not used.
nfc_llcp_disconnect() naming is not consistent with other PDU
sending functions.
This patch removes nfc_llcp_send_disconnect() and renames
nfc_llcp_disconnect()

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Fix ACR122 related debug output
Olivier Guiter [Mon, 3 Jun 2013 10:02:29 +0000 (12:02 +0200)]
NFC: pn533: Fix ACR122 related debug output

Instead of dumping ACR122 frames as errors, we use the print_hex_dump()
dynamic debug APIs.
We also print an accurate IC version, as the ACR122 is pn532 based.

Signed-off-by: Olivier Guiter <olivier.guiter@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add secure element enablement netlink API
Samuel Ortiz [Fri, 10 May 2013 15:07:32 +0000 (17:07 +0200)]
NFC: Add secure element enablement netlink API

Enabling or disabling an NFC accessible secure element through netlink
requires giving both an NFC controller and a secure element indexes.
Once enabled the secure element will handle card emulation once polling
starts.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add secure element enablement internal API
Samuel Ortiz [Fri, 10 May 2013 14:15:32 +0000 (16:15 +0200)]
NFC: Add secure element enablement internal API

Called via netlink, this API will enable or disable a specific secure
element. When a secure element is enabled, it will handle card emulation
and more generically ISO-DEP target mode, i.e. all target mode cases
except for p2p target mode.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Remove and free all SEs when releasing an NFC device
Samuel Ortiz [Fri, 10 May 2013 13:53:29 +0000 (15:53 +0200)]
NFC: Remove and free all SEs when releasing an NFC device

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Send netlink events for secure elements additions and removals
Samuel Ortiz [Fri, 10 May 2013 13:47:37 +0000 (15:47 +0200)]
NFC: Send netlink events for secure elements additions and removals

When an NFC driver or host controller stack discovers a secure element,
it will call nfc_add_se(). In order for userspace applications to use
these secure elements, a netlink event will then be sent with the SE
index and its type. With that information userspace applications can
decide wether or not to enable SEs, through their indexes.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add secure elements addition and removal API
Samuel Ortiz [Fri, 10 May 2013 13:28:38 +0000 (15:28 +0200)]
NFC: Add secure elements addition and removal API

This API will allow NFC drivers to add and remove the secure elements
they know about or detect. Typically this should be called (asynchronously
or not) from the driver or the host interface stack detect_se hook.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Extend and fix the internal secure element API
Samuel Ortiz [Fri, 10 May 2013 09:57:06 +0000 (11:57 +0200)]
NFC: Extend and fix the internal secure element API

Secure elements need to be discovered after enabling the NFC controller.
This is typically done by the NCI core and the HCI drivers (HCI does not
specify how to discover SEs, it is left to the specific drivers).
Also, the SE enable/disable API explicitely takes a SE index as its
argument.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Remove the static supported_se field
Samuel Ortiz [Tue, 7 May 2013 17:22:11 +0000 (19:22 +0200)]
NFC: Remove the static supported_se field

Supported secure elements are typically found during a discovery process
initiated when the NFC controller is up and running. For a given NFC
chipset there can be many configurations (embedded SE or not, with or
without a SIM card wired to the NFC controller SWP interface, etc...) and
thus driver code will never know before hand which SEs are available.
So we remove this field, it will be replaced by a real SE discovery
mechanism.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Copy NFCID2 through ATR_REQ
Samuel Ortiz [Mon, 27 May 2013 13:29:11 +0000 (15:29 +0200)]
NFC: pn533: Copy NFCID2 through ATR_REQ

When using NFC-F we should copy the NFCID2 buffer that we got from
SENSF_RES through the ATR_REQ NFCID3 buffer. Not doing so violates
NFC Forum digital requirement #189.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Use 0x3 for SENSF_REQ Time Slot Number (TSN)
Samuel Ortiz [Mon, 27 May 2013 12:59:40 +0000 (14:59 +0200)]
NFC: pn533: Use 0x3 for SENSF_REQ Time Slot Number (TSN)

LLCP validation requires TSN to be 0x03 for type F.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add NCI over SPI receive
Frederic Danis [Wed, 29 May 2013 13:35:04 +0000 (15:35 +0200)]
NFC: Add NCI over SPI receive

Before any operation, driver interruption is de-asserted to prevent
race condition between TX and RX.

Transaction starts by emitting "Direct read" and acknowledged mode
bytes. Then packet length is read allowing to allocate correct NCI
socket buffer. After that payload is retrieved.

A delay after the transaction can be added.
This delay is determined by the driver during nci_spi_allocate_device()
call and can be 0.

If acknowledged mode is set:
- CRC of header and payload is checked
- if frame reception fails (CRC error): NACK is sent
- if received frame has ACK or NACK flag: unblock nci_spi_send()

Payload is passed to NCI module.

At the end, driver interruption is re asserted.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add NCI over SPI send
Frederic Danis [Wed, 29 May 2013 13:35:03 +0000 (15:35 +0200)]
NFC: Add NCI over SPI send

Before any operation, driver interruption is de-asserted to prevent
race condition between TX and RX.

The NCI over SPI header is added in front of NCI packet.
If acknowledged mode is set, CRC-16-CCITT is added to the packet.
Then the packet is forwarded to SPI module to be sent.

A delay after the transaction is added.
This delay is determined by the driver during nci_spi_allocate_device()
call and can be 0.

After data has been sent, driver interruption is re-asserted.

If acknowledged mode is set, nci_spi_send will block until
acknowledgment is received.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add basic NCI over SPI
Frederic Danis [Wed, 29 May 2013 13:35:02 +0000 (15:35 +0200)]
NFC: Add basic NCI over SPI

The NFC Forum defines a transport interface based on
Serial Peripheral Interface (SPI) for the NFC Controller
Interface (NCI).

This module implements the SPI transport of NCI, calling SPI module
directly to read/write data to NFC controller (NFCC).

NFCC driver should provide functions performing device open and close.
It should also provide functions asserting/de-asserting interruption
to prevent TX/RX race conditions.
NFCC driver can also fix a delay between transactions if needed by
the hardware.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: HCI: Follow a positive code path in the HCI ops implementations
Samuel Ortiz [Fri, 24 May 2013 23:21:21 +0000 (01:21 +0200)]
NFC: HCI: Follow a positive code path in the HCI ops implementations

Exiting on the error case is more typical to the kernel coding style.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: HCI: Implement fw_upload ops
Eric Lapuyade [Mon, 29 Apr 2013 15:47:42 +0000 (17:47 +0200)]
NFC: HCI: Implement fw_upload ops

This is a simple forward to the HCI driver. When driver is done with the
operation, it shall directly notify NFC Core by calling
nfc_fw_upload_done().

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Add firmware upload netlink command
Eric Lapuyade [Mon, 29 Apr 2013 15:13:27 +0000 (17:13 +0200)]
NFC: Add firmware upload netlink command

As several NFC chipsets can have their firmwares upgraded and
reflashed, this patchset adds a new netlink command to trigger
that the driver loads or flashes a new firmware. This will allows
userspace triggered firmware upgrade through netlink.
The firmware name or hint is passed as a parameter, and the driver
will eventually fetch the firmware binary through the request_firmware
API.
The cmd can only be executed when the nfc dev is not in use. Actual
firmware loading/flashing is an asynchronous operation. Result of the
operation shall send a new event up to user space through the nfc dev
multicast socket. During operation, the nfc dev is not openable and
thus not usable.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: NCI: Fix skb->dev usage
Frederic Danis [Wed, 22 May 2013 09:36:17 +0000 (11:36 +0200)]
NFC: NCI: Fix skb->dev usage

skb->dev is used for carrying a net_device pointer and not
an nci_dev pointer.

Remove usage of skb-dev to carry nci_dev and replace it by parameter
in nci_recv_frame(), nci_send_frame() and driver send() functions.

NfcWilink driver is also updated to use those functions.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Fix error return code in pn533_probe()
Wei Yongjun [Tue, 7 May 2013 12:07:52 +0000 (20:07 +0800)]
NFC: pn533: Fix error return code in pn533_probe()

Fix to return -ENOMEM in the nfc device alloc error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn544: Remove Felica and Jewel device presence check
Arron Wang [Mon, 22 Apr 2013 09:21:27 +0000 (17:21 +0800)]
NFC: pn544: Remove Felica and Jewel device presence check

There is no builtin command for driver to check the presence of
Felica and Jewel device, it is more reasonable for the userspace
daemon neard to build seperate commands to check the presence of
the card.

Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn544: Identify Type F NFC-DEP through NFCID2
Arron Wang [Mon, 22 Apr 2013 09:21:04 +0000 (17:21 +0800)]
NFC: pn544: Identify Type F NFC-DEP through NFCID2

NFCID2 is defined as the first 2 manufacturer ID (IDm) bytes.
NFC DEP (NFC peer to peer) devices Type-F NFCID2 must start with
0x01fe according to the NFC Digital Specification.
By checking those first 2 bytes we send the right command either to the
reader gate when NFCID2 != 0x1fe (The NFC tag case) or to the NFCIP1 gate
when seeing an NFC DEP device (The NFC peer to peer case).

Without this fix, Felica (Type F) tags are not properly detected with this
driver.

Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoMerge branch 'for-linville-ath10k' of git://github.com/kvalo/ath6kl
John W. Linville [Thu, 13 Jun 2013 17:34:29 +0000 (13:34 -0400)]
Merge branch 'for-linville-ath10k' of git://github.com/kvalo/ath6kl