Commit 90d78c13 authored by Julien Lefrique's avatar Julien Lefrique Committed by Samuel Ortiz

NFC: NCI: Enable NFC-DEP in Listen A and Listen F

Send LA_SEL_INFO and LF_PROTOCOL_TYPE with NFC-DEP protocol enabled.
Configure 212 Kbit/s and 412 Kbit/s bit rates for Listen F.
Signed-off-by: default avatarJulien Lefrique <lefrique@marvell.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 772dccf4
...@@ -106,6 +106,16 @@ ...@@ -106,6 +106,16 @@
/* NCI Configuration Parameter Tags */ /* NCI Configuration Parameter Tags */
#define NCI_PN_ATR_REQ_GEN_BYTES 0x29 #define NCI_PN_ATR_REQ_GEN_BYTES 0x29
#define NCI_LA_SEL_INFO 0x32
#define NCI_LF_PROTOCOL_TYPE 0x50
#define NCI_LF_CON_BITR_F 0x54
/* NCI Configuration Parameters masks */
#define NCI_LA_SEL_INFO_ISO_DEP_MASK 0x20
#define NCI_LA_SEL_INFO_NFC_DEP_MASK 0x40
#define NCI_LF_PROTOCOL_TYPE_NFC_DEP_MASK 0x02
#define NCI_LF_CON_BITR_F_212 0x02
#define NCI_LF_CON_BITR_F_424 0x04
/* NCI Reset types */ /* NCI Reset types */
#define NCI_RESET_TYPE_KEEP_CONFIG 0x00 #define NCI_RESET_TYPE_KEEP_CONFIG 0x00
......
...@@ -474,6 +474,29 @@ static int nci_set_local_general_bytes(struct nfc_dev *nfc_dev) ...@@ -474,6 +474,29 @@ static int nci_set_local_general_bytes(struct nfc_dev *nfc_dev)
msecs_to_jiffies(NCI_SET_CONFIG_TIMEOUT)); msecs_to_jiffies(NCI_SET_CONFIG_TIMEOUT));
} }
static int nci_set_listen_parameters(struct nfc_dev *nfc_dev)
{
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
int rc;
__u8 val;
val = NCI_LA_SEL_INFO_NFC_DEP_MASK;
rc = nci_set_config(ndev, NCI_LA_SEL_INFO, 1, &val);
if (rc)
return rc;
val = NCI_LF_PROTOCOL_TYPE_NFC_DEP_MASK;
rc = nci_set_config(ndev, NCI_LF_PROTOCOL_TYPE, 1, &val);
if (rc)
return rc;
val = NCI_LF_CON_BITR_F_212 | NCI_LF_CON_BITR_F_424;
return nci_set_config(ndev, NCI_LF_CON_BITR_F, 1, &val);
}
static int nci_start_poll(struct nfc_dev *nfc_dev, static int nci_start_poll(struct nfc_dev *nfc_dev,
__u32 im_protocols, __u32 tm_protocols) __u32 im_protocols, __u32 tm_protocols)
{ {
...@@ -510,6 +533,12 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, ...@@ -510,6 +533,12 @@ static int nci_start_poll(struct nfc_dev *nfc_dev,
} }
} }
if (tm_protocols & NFC_PROTO_NFC_DEP_MASK) {
rc = nci_set_listen_parameters(nfc_dev);
if (rc)
pr_err("failed to set listen parameters\n");
}
param.im_protocols = im_protocols; param.im_protocols = im_protocols;
param.tm_protocols = tm_protocols; param.tm_protocols = tm_protocols;
rc = nci_request(ndev, nci_rf_discover_req, (unsigned long)&param, rc = nci_request(ndev, nci_rf_discover_req, (unsigned long)&param,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment