05 Jan, 2016
1 commit
-
Samuel Ortiz says:
====================
NFC 4.5 pull requestThis is the first NFC pull request for 4.5 and it brings:
- A new driver for the STMicroelectronics ST95HF NFC chipset.
The ST95HF is an NFC digital transceiver with an embedded analog
front-end and as such relies on the Linux NFC digital
implementation. This is the 3rd user of the NFC digital stack.- ACPI support for the ST st-nci and st21nfca drivers.
- A small improvement for the nfcsim driver, as we can now tune
the Rx delay through sysfs.- A bunch of minor cleanups and small fixes from Christophe Ricard,
for a few drivers and the NFC core code.
====================Signed-off-by: David S. Miller
30 Dec, 2015
4 commits
-
I've moved the check for "number_destination_params" forward
a few lines to avoid leaking "cmd".Fixes: caa575a86ec1 ('NFC: nci: fix possible crash in nci_core_conn_create')
Acked-by: Christophe Ricard
Signed-off-by: Dan Carpenter
Signed-off-by: Samuel Ortiz -
Add support for missing HCI event EVT_CONNECTIVITY and forward
it to userspace.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
net/nfc/nci/hci.c: In function nci_hci_connect_gate :
net/nfc/nci/hci.c:679: warning: comparison is always false due to limited range of data typeIn case of error, nci_hci_create_pipe() returns NCI_HCI_INVALID_PIPE,
and not a negative error code.Correct the check to fix this.
Acked-by: Geert Uytterhoeven
Reported-by: Dan Carpenter
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
The definition of DIGITAL_PROTO_NFCA_RF_TECH is modified to support
ISO14443 Type4A tags. Without this change it is not possible to start
polling for ISO14443 Type4A tags from the initiator side.Signed-off-by: Shikha Singh
Signed-off-by: Samuel Ortiz
02 Dec, 2015
1 commit
-
This patch is a cleanup to make following patch easier to
review.Goal is to move SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA
from (struct socket)->flags to a (struct socket_wq)->flags
to benefit from RCU protection in sock_wake_async()To ease backports, we rename both constants.
Two new helpers, sk_set_bit(int nr, struct sock *sk)
and sk_clear_bit(int net, struct sock *sk) are added so that
following patch can change their implementation.Signed-off-by: Eric Dumazet
Signed-off-by: David S. Miller
28 Oct, 2015
1 commit
-
This fixes a build error that seems to be toochain
dependent (Not seen with gcc v5.1):In file included from net/nfc/nci/rsp.c:36:0:
net/nfc/nci/rsp.c: In function ‘nci_rsp_packet’:
include/net/nfc/nci_core.h:355:12: error: inlining failed in call to
always_inline ‘nci_prop_rsp_packet’: function body not available
inline int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 opcode,Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz
27 Oct, 2015
6 commits
-
In some cases low level drivers might want to update the
SPI transfer clock (e.g. during firmware download).This patch adds this support. Without any modification the
driver will use the default SPI clock (from pdata or device tree).Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz -
SPI driver should be a module.
Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz -
Export nci_send_frame and nci_send_cmd symbols to allow drivers
to use it. This is needed for example if NCI is used during
firmware download phase.Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz -
Add support for proprietary commands useful mainly
for factory testings.Here is a list:
- FACTORY_MODE: Allow to set the driver into a mode where no
secure element are activated. It does not consider any
NFC_ATTR_VENDOR_DATA.
- HCI_CLEAR_ALL_PIPES: Allow to execute a HCI clear all pipes
command. It does not consider any NFC_ATTR_VENDOR_DATA.
- HCI_DM_PUT_DATA: Allow to configure specific CLF registry as
for example RF trimmings or low level drivers configurations
(I2C, SPI, SWP).
- HCI_DM_UPDATE_AID: Allow to configure an AID routing into the
CLF routing table following RF technology, CLF mode or protocol.
- HCI_DM_GET_INFO: Allow to retrieve CLF information.
- HCI_DM_GET_DATA: Allow to retrieve CLF configurable data such as
low level drivers configurations or RF trimmings.
- HCI_DM_LOAD: Allow to load a firmware into the CLF. A complete
packet can be more than 8KB.
- HCI_DM_RESET: Allow to run a CLF reset in order to "commit" CLF
configuration changes without CLF power off.
- HCI_GET_PARAM: Allow to retrieve an HCI CLF parameter (for example
the white list).
- HCI_DM_FIELD_GENERATOR: Allow to generate different kind of RF
technology. When using this command to anti-collision is done.
- HCI_LOOPBACK: Allow to echo a command and test the Dh to CLF
connectivity.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
Add some few code style fixes.
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
In order to manage in a better way the nci poll mode state machine,
add mode parameter to deactivate_target functions.
This way we can manage different target state.
mode parameter make sense only in nci core.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz
26 Oct, 2015
14 commits
-
Some gates might need to have their pipes explicitly created.
Add a call to nci_hci_create_pipe in nci_hci_connect_gate for
every gate that is different than NCI_HCI_LINK_MGMT_GATE or
NCI_HCI_ADMIN_GATE.In case of an error when opening a pipe, like in hci layer,
delete the pipe if it was created.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
When session_id is filled to 0xff, the pipe configuration is
probably incorrect and needs to be cleared.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
nci_hci_clear_all_pipes might be use full in some cases
for example after a firmware update.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
When receiving data in nci_hci_msg_rx_work, extract pipe
value using NCI_HCP_MSG_GET_PIPE macro.Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
When sending HCI data over NCI, HCI return code is part
of the NCI data. In order to get correctly the HCI return
code, we assume the NCI communication is successful and
extract the return code for the nci_hci functions return code.This is done because nci_to_errno does not match hci return
code value.Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
When sending HCI data over NCI, cmd information should be
present only on the first packet.
Each packet shall be specifically allocated and sent to the
NCI layer.Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
This functin takes as a parameter a pointer to the nci_dev
struct and the first byte from the values of the first domain
specific parameter that was used for the connection creation.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
If the number of destination speific parameters supplied is 0
the call will fail. If the first destination specific parameter
does not have a value, curr_id will be set to 0.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
Initially it was used to create hooks in the driver for
proprietary operations. Currently it is being used for hooks
for both proprietary and generic operations.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
The driver may be required to act when some responses or
notifications arrive. For example the NCI core does not have a
handler for NCI_OP_CORE_GET_CONFIG_RSP. The NFCC can send a
config response that has to be read by the driver and the packet
may contain vendor specific data.The Fields Peak driver needs to take certain actions when a reset
notification arrives (packet also not handled by the nfc core).The driver handlers do not interfere with the core and they are
called after the core processes the packet.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
This allows sending core commands from the driver. The driver
should be able to send NCI core commands like CORE_GET_CONFIG_CMD.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
The driver should know that it can continue with post setup where
setup left off. Being able to execute post_setup when setup fails
may force the developer to keep this state in the driver.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
FDP driver needs to send the firmware as regular packets
(not fragmented). The driver should have a way to
get the max packet size for a given connection.Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz -
For the firmware update the driver may use nci_send_data.
Signed-off-by: Robert Dolca
Signed-off-by: Samuel Ortiz
20 Oct, 2015
1 commit
-
The exit label performs device_unlock(&dev->dev);, which will fail when dev
is NULL, and nfc_put_device(dev);, which is not useful when dev is NULL, so
just exit the function immediately.Problem found using scripts/coccinelle/null/deref_null.cocci
Signed-off-by: Julia Lawall
Signed-off-by: Samuel Ortiz
03 Oct, 2015
1 commit
-
Since we do not know in which context drivers will call these
routines, they should use the unlocked version of nci_request,
i.e. __nci_request.
It is up to drivers to know/decide if they need to take the
req_lock mutex before calling those routines. When being called
from the NCI setup routine there is no need to do so as ops->setup
is called under req_lock.Signed-off-by: Samuel Ortiz
21 Aug, 2015
4 commits
-
A proprietary vendor command may send back useful data to the user
application.For example, the field level applied on the NFC router antenna.
Still based on net/wireless/nl80211.c implementation,
add nfc_vendor_cmd_alloc_reply_skb and nfc_vendor_cmd_reply in
order to send back over netlink data generated by a proprietary
command.Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
skb can be NULL and may lead to a NULL pointer error.
Add a check condition before setting HCI rx buffer.
Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
Some drivers needs to have ability to reinit NCI core, for example
after updating firmware in setup() of post_setup() callback. This
patch makes nci_core_reset() and nci_core_init() functions public,
to make it possible.Signed-off-by: Robert Baldyga
Signed-off-by: Samuel Ortiz -
Some drivers require non-standard configuration after NCI_CORE_INIT
request, because they need to know ndev->manufact_specific_info or
ndev->manufact_id. This patch adds post_setup handler allowing to do
such custom configuration.Signed-off-by: Robert Baldyga
Signed-off-by: Samuel Ortiz
17 Aug, 2015
2 commits
-
When NFC_ATTR_VENDOR_DATA is not set, data_len is 0 and data is NULL.
Fixes the following warning:
net/nfc/netlink.c:1536:3: warning: 'data' may be used uninitialized
+in this function [-Wmaybe-uninitialized]
return cmd->doit(dev, data, data_len);Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz -
NFC_ATTR_VENDOR_DATA is an optional vendor_cmd argument.
The current code was potentially using a non existing argument
leading to potential catastrophic results.Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard
Signed-off-by: Samuel Ortiz
16 Jun, 2015
1 commit
-
It was not possible to register a UART driver due
to a bad condition.Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz
13 Jun, 2015
1 commit
-
NCI deactivate management was modified to support all NCI
deactivation type. Problem is that all the API are not ready
yet for it.Problem is that with current code, when neard asks to deactivate
the tag it sends a deactivate SLEEP but nobody will then send a
IDLE deactivate. This IDLE deactivate is mandatory since NFC
controller can only be unlocked by DH.Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz
12 Jun, 2015
2 commits
-
Add support of Marvell NFC chip controlled over UART
Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz -
Some NFC controller supports UART as host interface.
As with SPI, a lot of code can be shared between vendor
drivers. This patch add the generic support of UART and
provides some extension API for vendor specific needs.This code is strongly inspired by the Bluetooth HCI ldisc
implementation. NCI UART vendor drivers will have to register
themselves to this layer via nci_uart_register.Underlying tty will have to be configured from user land
thanks to an ioctl.Signed-off-by: Vincent Cuissard
Signed-off-by: Samuel Ortiz
10 Jun, 2015
1 commit
-
Drivers implementing proprietary ops may need it now.
Signed-off-by: Samuel Ortiz