History log of /net/nfc/core.c
Revision Date Author Comments
3143a4ca610d6a3de0d8814ee6f5f7da6fc7fbfa 25-Feb-2014 Axel Lin <axel.lin@ingics.com> NFC: Move checking valid gb_len value to nfc_llcp_set_remote_gb

This checking is common for all caller, so move the checking to one place.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
365a721adbdfe5f6577a66b9b74c12dc98fbb4a3 24-Feb-2014 Axel Lin <axel.lin@ingics.com> NFC: Remove redundant test for dev->n_targets in nfc_find_target

Without this test, it returns NULL if dev->n_targets is 0 anyway.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
156cef80f2a1aea4f150dff5d990e8fbbd96d862 14-Feb-2014 Axel Lin <axel.lin@ingics.com> NFC: Use list_for_each_entry in nfc_find_se()

nfc_find_se() does not modify any list entry while iterating the list.
So use list_for_each_entry instead of list_for_each_entry_safe.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
a434c2407467a76c0e1416c45f7b31cfbe1b6b3b 22-Dec-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: Only warn on SE discovery error

SE discovery errors are currently overwriting the dev_up() return error.
This is wrong for many reasons:

- We don't want to report an error if we actually brought the device up
but it failed to discover SEs. By doing so we pretend we don't have an
NFC functional device even we do. The only thing we could not do was
checking for SEs availability. This is the false negative case.

- In some cases the actual device power up failed but the SE discovery
succeeded. Userspace then believes the device is up while it's not.
This is the false positive case.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
d31652a26bc9e752a99b6ac3b61353129934e451 14-Nov-2013 Arron Wang <arron.wang@intel.com> NFC: Fix target mode p2p link establishment

With commit e29a9e2ae165620d, we set the active_target pointer from
nfc_dep_link_is_up() in order to support the case where the target
detection and the DEP link setting are done atomically by the driver.
That can only happen in initiator mode, so we need to check for that
otherwise we fail to bring a p2p link in target mode.

Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
98b32decc83ed3137e3ddbc918b102f8fc406b6d 06-Dec-2013 Jeff Kirsher <jeffrey.t.kirsher@intel.com> nfc: Fix FSF address in file headers

Several files refer to an old address for the Free Software Foundation
in the file header comment. Resolve by replacing the address with
the URL <http://www.gnu.org/licenses/> so that we do not have to keep
updating the header comments anytime the address changes.

CC: linux-wireless@vger.kernel.org
CC: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
CC: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
CC: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e29a9e2ae165620d202f3ce45abd3a219b13ffb7 21-Aug-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: Set active target upon DEP up event reception

As we can potentially get DEP up events without having sent a netlink
command, we need to set the active target properly from dep_link_is_up.
Spontaneous DEP up events can come from devices that detected an active
p2p target. In that case there is no need to call the netlink DEP up
command as the link is already up and running.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
d8eb18eecaf358e37f4941c2b8cba3c4b8122b7f 23-Aug-2013 Arron Wang <arron.wang@intel.com> NFC: Export nfc_find_se()

This will be needed by all NFC driver implementing the SE ops.

Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
39525ee1dc78ca1f5f2fb1f764f7a141005fe440 30-Jul-2013 Arron Wang <arron.wang@intel.com> NFC: Update secure element state

The secure element state was not updated from the enable/disable ops,
leaving the SE state to disabled for ever.

Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2c3832834b95e0226da1d13229472978f78462c5 30-Jul-2013 Arron Wang <arron.wang@intel.com> NFC: Fix secure element state check

Another typo from the initial commit where we check for the secure
element type field instead of its state when enabling or disabling it.

Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
352a5f5fb3ad8f829cfd4248fe6119895bda881f 19-Jul-2013 Eric Lapuyade <eric.lapuyade@linux.intel.com> NFC: netlink: Add result of firmware operation to completion event

Result is added as an NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS attribute
containing the standard errno positive value of the completion result.
This event will be sent when the firmare download operation is done and
will contain the operation result.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
369f4d503ac12363f5d11b91f849377875d57598 24-Jul-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: Fix SE discovery failure warning condition

This is a typo coming from the initial implementation. se_discover fails
when it returns something different than zero and we should only display
a warning in that case.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9ea7187c53f63e31f2d1b2b1e474e31808565009 31-Jul-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: netlink: Rename CMD_FW_UPLOAD to CMD_FW_DOWNLOAD

Loading a firmware into a target is typically called firmware
download, not firmware upload. So we rename the netlink API to
NFC_CMD_FW_DOWNLOAD in order to avoid any terminology confusion from
userspace.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
c531c9ec2969860c98a8a47f501c4874278388d3 10-May-2013 Samuel Ortiz <sameo@linux.intel.com> 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>
ee656e9d0993144f4e4ad261aefeeaab9554cd3f 10-May-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: Remove and free all SEs when releasing an NFC device

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2757c3723c3d2b13e3a8bfaa034826f64e9cca43 10-May-2013 Samuel Ortiz <sameo@linux.intel.com> 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>
fed7c25ec0d4894edfc36bbe5c5231e52f45483a 10-May-2013 Samuel Ortiz <sameo@linux.intel.com> 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>
0a946301c2d3eac8673e556df820c0b6023ac6c3 10-May-2013 Samuel Ortiz <sameo@linux.intel.com> 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>
0b456c418a5595b9d67f300c9ac6a2441e774603 07-May-2013 Samuel Ortiz <sameo@linux.intel.com> 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>
9674da8759df0d6c0d24e1ede6e2a1acdef91e3c 29-Apr-2013 Eric Lapuyade <eric.lapuyade@linux.intel.com> 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>
be055b2f89b5842f41363b5655a33dffb51a8294 11-Apr-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: RFKILL support

All NFC devices will now get proper RFKILL support as long as they provide
some dev_up and dev_down hooks. Rfkilling an NFC device will bring it down
while it is left to userspace to bring it back up when being rfkill unblocked.
This is very similar to what Bluetooth does.

Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7757dc8a3e7658abb6e5fc7d825a38b27961d0c8 10-Apr-2013 Samuel Ortiz <sameo@linux.intel.com> NFC: Prevent polling when device is down

Some devices turn radio on whenever they're asked to start a poll.
To prevent that from happening, we just don't call into the driver
start_poll hook when the NFC device is down.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9f3b795a626ee79574595e06d1437fe0c7d51d29 01-Feb-2013 Michał Mirosław <mirq-linux@rere.qmqm.pl> driver-core: constify data for class_find_device()

All in-kernel users of class_find_device() don't really need mutable
data for match callback.

In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c)
this patch changes match callbacks to use const search data.

The const is propagated to rtc_class_open() and power_supply_get_by_name()
parameters.

Note that there's a dev reference leak in suspend_test.c that's not
touched in this patch.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
390a1bd8538132186ddb679cafe9e75b7ef7e2d2 19-Dec-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Initial Secure Element API

Each NFC adapter can have several links to different secure elements and
that property needs to be exported by the drivers.
A secure element link can be enabled and disabled, and card emulation will
be handled by the currently active one. Otherwise card emulation will be
host implemented.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
f0c9103813b3045bd5b43220b6a78c9908a45d24 26-Nov-2012 Eric Lapuyade <eric.lapuyade@linux.intel.com> NFC: Fixed nfc core and hci unregistration and cleanup

When an adapter is removed, it will unregister itself from hci and/or
nfc core. In order to do that safely, work tasks must first be canceled
and prevented to be scheduled again, before the hci or nfc device can be
destroyed.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0f450772224f99db3b8384bfb8f751889d0c4cb8 17-Oct-2012 Szymon Janc <szymon.janc@tieto.com> NFC: Fix some code style and whitespace issues

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7eda8b8e967781cfa5a04962502f9aa428f67e5f 22-Oct-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Use IDR library to assing NFC devices IDs

As a consequence the NFC device IDs won't be increasing all the time,
as IDR provides the first available ID.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
5bcf099c17323a8760620511b1b8e415c2783571 05-Oct-2012 Thierry Escande <thierry.escande@linux.intel.com> NFC: Set rf_mode to NFC_RF_NONE where necessary

rf_mode is now set to NFC_RF_NONE when a device gets allocated,
when the link goes down, and when stop polling.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
632c016ab8ba1f98262bd6242b38d73ee4ae652e 02-Oct-2012 Eric Lapuyade <eric.lapuyade@linux.intel.com> NFC: HCI check presence must not fail when driver doesn't support it

When the driver does not support checking the tag is still present, it
must return -EOPNOTSUPP. The NFC Core will then stop asking and not
report a tag lost event to user space.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
916082b073ebb7f4e064cebce0768e34cacde508 03-Oct-2012 Linus Torvalds <torvalds@linux-foundation.org> workqueue: avoid using deprecated functions

The network merge brought in a few users of functions that got
deprecated by the workqueue cleanups: the 'system_nrt_wq' is now the
same as the regular system_wq, since all workqueues are now non-
reentrant.

Similarly, remove one use of flush_work_sync() - the regular
flush_work() has become synchronous, and the "_sync()" version is thus
deprecated as being superfluous.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
474fee3db16c63bc440bfb93b57f72ecfc4246f0 23-Aug-2012 Tejun Heo <tj@kernel.org> 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>
5df16cad44f13293803ad3fbc4d49ae2c40e1f0f 12-Jun-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Add netlink module alias for NFC

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1155bb617a10a67d7a17d03abeee74c6fc85edf4 12-Jun-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Add modules alias for NFC sockets

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9eb334ac1709e8f135af341ce1dd0e6b4449c6d3 11-Jun-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: nfc_driver_failure() implementation

If the device is polling we sent a 0 target found event.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
d94f9c55ff22397cc3436840437da533e9263716 03-May-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: nfc_targets_found() should accept zero target found

The semantics for a zero target found event is that the polling operation
could not complete.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8668fdd6efb3a75e0d58a3287a47fa7e60a68a73 03-May-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Core must test the device polling state inside the device lock

There can ever be only one call to nfc_targets_found() after polling
has been engaged. This could be from a target discovered event from
the driver, or from an error handler to notify poll will never complete.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
456411ca812860d7ba06d3e4013ce1d8b9dbc7cd 11-Jun-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Driver failure API

This API should be used by drivers, HCI, SHDLC or NCI stacks to report an
unrecoverable error.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
cb3a4503f41f7f60bbc74a937bc30a0e143fc53c 21-May-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Call the DEP link down ops even when in target mode

Even in target mode we need to let the driver know that we want to
bring the DEP link down.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
73167ced31d15c04e57b9e0885ac05675e9195a4 31-May-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Introduce target mode rx data callback

This routine will be called by drivers whenever they receive data in target
mode. This should be unexpected events and as such should be handled by a
standalone API (i.e. not as a callback pointer from an existing API).

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
be9ae4ce4ee66e211815122ab4f41913efed4fec 16-May-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Introduce target mode tx ops

And rename the initiator mode data exchange ops for consistency sake.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
f212ad5e993e7efb996fc8ce94a5de8f0bd06d41 31-May-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Set the NFC device RF mode appropriately

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
fc40a8c1a06ab7db45da790693dd9802612a055c 01-Jun-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Add target mode activation netlink event

Userspace gets a netlink event upon target mode activation.
The LLCP layer is also signaled when we get an ATR_REQ in order to get
the remote general bytes.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
fe7c580073280c15bb4eb4f82bf20dddc1a68383 15-May-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Add target mode protocols to the polling loop startup routine

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
ab73b751303bc60d7d9fba875c958dedfe14754c 10-Apr-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Export LLCP general bytes getter

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
d4ccb132801aeeb2cfd18c4b4b7fa0043ab37f80 07-May-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Specify usage for targets found and target lost events

It is now specified that nfc_target_found() and nfc_target_lost() core
functions must not be called from an atomic context. This allow us to
serialize calls and protect the targets table using the nfc device lock
instead of a spinlock.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
900994332675f84a9fbbb33ff089474614c7f2fe 07-May-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Cache the core NFC active target pointer instead of its index

The NFC Core now caches the active nfc target pointer, thereby avoiding
the need to lookup the target table for each invocation of a driver ops.
Consequently, pn533, HCI and NCI now directly receive an nfc_target
pointer instead of a target index.

Cc: Ilan Elias <ilane@ti.com>
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
95c961747284a6b83a5e2d81240e214b0fa3464d 15-Apr-2012 Eric Dumazet <eric.dumazet@gmail.com> net: cleanup unsigned to unsigned int

Use of "unsigned int" is preferred to bare "unsigned" in net tree.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c8d56ae78653c02fc6e6f304a18f860302481c2d 10-Apr-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Add Core support to generate tag lost event

Some HW/drivers get notifications when a tag moves out of the radio field.
This notification is now forwarded to user space through netlink.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
144612cacc0b5c230f0b3aebc3a3a53854c332ee 10-Apr-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Changed target activated state logic

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
01ae0eea9bed132a9c4a2c207dbf8e05b0051071 10-Apr-2012 Eric Lapuyade <eric.lapuyade@intel.com> NFC: Fix next target_idx type and rename for clarity

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c4fbb6515a4dcec83d340247639b5644c4745528 10-Apr-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: The core part should generate the target index

The target index can be used by userspace to uniquely identify a target
and thus should be kept unique, per NFC adapter. Moreover, some protocols
do not provide a logical index when discovering new targets, so we have to
generate one for them.
For NCI or pn533 to fetch their logical index, we added a logical_idx field
to the target structure.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e1da0efa2ee71df957b280bcfa41f82ce6986a1d 10-Apr-2012 Eric Lapuyade <eric.lapuyade@linux.intel.com> NFC: Export target lost function

NFC drivers will call this routine when they detect that a tag leaves the
RF field. This will eventually lead to the corresponding netlink event
to be sent.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0a40acb24602783fcf6881f915659148aa9807d7 05-Mar-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Core code identation fixes

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
47807d3dbb62e93850cbcb797db1a9ee1806f986 05-Mar-2012 Samuel Ortiz <sameo@linux.intel.com> NFC: Remove the rf mode parameter from the DEP link up routine

When calling nfc_dep_link_up, we implicitely are in initiator mode.
Which means we also can provide the general bytes as a function argument,
as all drivers will eventually request them.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
25a1d9dc850b1bdcc4760eb625f0a67057f54d26 18-Jan-2012 Ilan Elias <ilane@ti.com> NFC: NFC core layer should not set the target_idx

The NFC core layer should not set the target_idx.
Instead, the driver layer (e.g. NCI, PN533) should set the
target_idx, so that it will be able to identify the target
when its I/F (e.g. activate_target) is called.
This is required in order to support multiple targets.
Note that currently supported drivers (PN533 and NCI) don't
use the target_idx in their implementation.

Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d646960f7986fefb460a2b062d5ccc8ccfeacc3a 14-Dec-2011 Samuel Ortiz <sameo@linux.intel.com> NFC: Initial LLCP support

This patch is an initial implementation for the NFC Logical Link Control
protocol. It's also known as NFC peer to peer mode.
This is a basic implementation as it lacks SDP (services Discovery
Protocol), frames aggregation support, and frame rejecion parsing.
Follow up patches will implement those missing features.
This code has been tested against a Nexus S phone implementing LLCP 1.0.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
541d920b05b538ec0d9ae8ce619ee4fc6fb19e32 14-Dec-2011 Samuel Ortiz <sameo@linux.intel.com> NFC: Set and get DEP general bytes

Without an API for setting and getting the local and remote general bytes,
drivers won't be able to properly establish a DEP link.
This API also allows them to propagate the remote general bytes they get
from the DEP link establishment up to the LLCP layer.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1ed28f610653e9b18433c6d87e9d333b7e3e886e 14-Dec-2011 Samuel Ortiz <sameo@linux.intel.com> NFC: Add a DEP link control netlink command

NFC-DEP (Data Exchange Protocol) is an NFC MAC layer.
This command allows to enable and disable the DEP link on to which e.g.
LLCP can run.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7c7cd3bfec68fee33b30d177df6a6a0c4bbdc59d 14-Dec-2011 Samuel Ortiz <sameo@linux.intel.com> NFC: Add tx skb allocation routine

This is a factorization of the current rawsock tx skb allocation routine,
as it will be used by the LLCP code.
We also rename nfc_alloc_skb to nfc_alloc_recv_skb for consistency sake.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
52858b51b2c779a8f9db32accf774b165522ad81 14-Dec-2011 Samuel Ortiz <sameo@linux.intel.com> NFC: Add function name to the NFC pr_fmt() routine

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
538af1344ab21cd2b638e779c2e82550a886b26e 29-Nov-2011 Joe Perches <joe@perches.com> nfc: Remove unused nfc_printk and nfc_<level> macros

All uses have been removed, so killing what's not necessary.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
20c239c1390bd6f3bb389fe1a7e8307f29f52563 29-Nov-2011 Joe Perches <joe@perches.com> nfc: Convert nfc_dbg to pr_debug

Using the standard debugging mechanisms is better than
subsystem specific ones when the subsystem doesn't use
a specific struct.

Coalesce long formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ed1e0ad8816389ceefa2d94a9a3d3520088e410f 29-Nov-2011 Joe Perches <joe@perches.com> nfc: Use standard logging styles

Using the normal logging styles is preferred over
subsystem specific styles when the subsystem does
not take a specific struct.

Convert nfc_<level> specific messages to pr_<level>
Add newlines to uses.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8b3fe7b591b3c50061a8701f8eda14033420577b 18-Sep-2011 Ilan Elias <ilane@ti.com> NFC: Add dev_up and dev_down control operations

Add 2 new nfc control operations:
dev_up to turn on the nfc device
dev_down to turn off the nfc device

Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e8753043f9fbabffbf087c7f4b514c50ef89541e 19-Aug-2011 Samuel Ortiz <sameo@linux.intel.com> NFC: Reserve tx head and tail room

We can have the NFC core layer allocating the tx head and tail
room for the drivers and avoid 1 or more SKBs copy on write on
the Tx path.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
23b7869c0fd08d73c9f83a2db88a13312d6198bb 02-Jul-2011 Lauro Ramos Venancio <lauro.venancio@openbossa.org> NFC: add the NFC socket raw protocol

This socket protocol is used to perform data exchange with NFC
targets.

Signed-off-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c7fe3b52c1283b8ba810eb6ecddf1c8a0bcc13ab 02-Jul-2011 Aloisio Almeida Jr <aloisio.almeida@openbossa.org> NFC: add NFC socket family

Signed-off-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4d12b8b129f170d0fc3188de1e51a2a1b0f87730 02-Jul-2011 Lauro Ramos Venancio <lauro.venancio@openbossa.org> NFC: add nfc generic netlink interface

The NFC generic netlink interface exports the NFC control operations
to the user space.

Signed-off-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3e256b8f8dfa309a80b5dece388d85d9a9801a29 02-Jul-2011 Lauro Ramos Venancio <lauro.venancio@openbossa.org> NFC: add nfc subsystem core

The NFC subsystem core is responsible for providing the device driver
interface. It is also responsible for providing an interface to the control
operations and data exchange.

Signed-off-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>