NFC: Configure pn533 RF timings
Those define the ATR_RES response timeout after which the pn533 considers the target to be mute. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -104,8 +104,14 @@ struct pn533_fw_version {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* PN533_CMD_RF_CONFIGURATION */
|
/* PN533_CMD_RF_CONFIGURATION */
|
||||||
|
#define PN533_CFGITEM_TIMING 0x02
|
||||||
#define PN533_CFGITEM_MAX_RETRIES 0x05
|
#define PN533_CFGITEM_MAX_RETRIES 0x05
|
||||||
|
|
||||||
|
#define PN533_CONFIG_TIMING_102 0xb
|
||||||
|
#define PN533_CONFIG_TIMING_204 0xc
|
||||||
|
#define PN533_CONFIG_TIMING_409 0xd
|
||||||
|
#define PN533_CONFIG_TIMING_819 0xe
|
||||||
|
|
||||||
#define PN533_CONFIG_MAX_RETRIES_NO_RETRY 0x00
|
#define PN533_CONFIG_MAX_RETRIES_NO_RETRY 0x00
|
||||||
#define PN533_CONFIG_MAX_RETRIES_ENDLESS 0xFF
|
#define PN533_CONFIG_MAX_RETRIES_ENDLESS 0xFF
|
||||||
|
|
||||||
@@ -115,6 +121,12 @@ struct pn533_config_max_retries {
|
|||||||
u8 mx_rty_passive_act;
|
u8 mx_rty_passive_act;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
struct pn533_config_timing {
|
||||||
|
u8 rfu;
|
||||||
|
u8 atr_res_timeout;
|
||||||
|
u8 dep_timeout;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
/* PN533_CMD_IN_LIST_PASSIVE_TARGET */
|
/* PN533_CMD_IN_LIST_PASSIVE_TARGET */
|
||||||
|
|
||||||
/* felica commands opcode */
|
/* felica commands opcode */
|
||||||
@@ -2004,6 +2016,7 @@ static int pn533_probe(struct usb_interface *interface,
|
|||||||
struct usb_host_interface *iface_desc;
|
struct usb_host_interface *iface_desc;
|
||||||
struct usb_endpoint_descriptor *endpoint;
|
struct usb_endpoint_descriptor *endpoint;
|
||||||
struct pn533_config_max_retries max_retries;
|
struct pn533_config_max_retries max_retries;
|
||||||
|
struct pn533_config_timing timing;
|
||||||
int in_endpoint = 0;
|
int in_endpoint = 0;
|
||||||
int out_endpoint = 0;
|
int out_endpoint = 0;
|
||||||
int rc = -ENOMEM;
|
int rc = -ENOMEM;
|
||||||
@@ -2115,6 +2128,18 @@ static int pn533_probe(struct usb_interface *interface,
|
|||||||
goto unregister_nfc_dev;
|
goto unregister_nfc_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timing.rfu = PN533_CONFIG_TIMING_102;
|
||||||
|
timing.atr_res_timeout = PN533_CONFIG_TIMING_204;
|
||||||
|
timing.dep_timeout = PN533_CONFIG_TIMING_409;
|
||||||
|
|
||||||
|
rc = pn533_set_configuration(dev, PN533_CFGITEM_TIMING,
|
||||||
|
(u8 *) &timing, sizeof(timing));
|
||||||
|
if (rc) {
|
||||||
|
nfc_dev_err(&dev->interface->dev,
|
||||||
|
"Error on setting RF timings");
|
||||||
|
goto unregister_nfc_dev;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unregister_nfc_dev:
|
unregister_nfc_dev:
|
||||||
|
Reference in New Issue
Block a user