diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-29 15:34:08 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-06-04 15:34:32 -0400 |
commit | 34a85bfcfb84fe673833290ee071de0a10dd1cac (patch) | |
tree | df9ea2214670c454e21154b199010febc9e561f5 /drivers/nfc | |
parent | 9f2f8ba172d9a7f7f600ced18b05f6fd52b83396 (diff) |
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>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/pn533.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 2a7e4e8e4f11..d9763440b8e9 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -104,8 +104,14 @@ struct pn533_fw_version { | |||
104 | }; | 104 | }; |
105 | 105 | ||
106 | /* PN533_CMD_RF_CONFIGURATION */ | 106 | /* PN533_CMD_RF_CONFIGURATION */ |
107 | #define PN533_CFGITEM_TIMING 0x02 | ||
107 | #define PN533_CFGITEM_MAX_RETRIES 0x05 | 108 | #define PN533_CFGITEM_MAX_RETRIES 0x05 |
108 | 109 | ||
110 | #define PN533_CONFIG_TIMING_102 0xb | ||
111 | #define PN533_CONFIG_TIMING_204 0xc | ||
112 | #define PN533_CONFIG_TIMING_409 0xd | ||
113 | #define PN533_CONFIG_TIMING_819 0xe | ||
114 | |||
109 | #define PN533_CONFIG_MAX_RETRIES_NO_RETRY 0x00 | 115 | #define PN533_CONFIG_MAX_RETRIES_NO_RETRY 0x00 |
110 | #define PN533_CONFIG_MAX_RETRIES_ENDLESS 0xFF | 116 | #define PN533_CONFIG_MAX_RETRIES_ENDLESS 0xFF |
111 | 117 | ||
@@ -115,6 +121,12 @@ struct pn533_config_max_retries { | |||
115 | u8 mx_rty_passive_act; | 121 | u8 mx_rty_passive_act; |
116 | } __packed; | 122 | } __packed; |
117 | 123 | ||
124 | struct pn533_config_timing { | ||
125 | u8 rfu; | ||
126 | u8 atr_res_timeout; | ||
127 | u8 dep_timeout; | ||
128 | } __packed; | ||
129 | |||
118 | /* PN533_CMD_IN_LIST_PASSIVE_TARGET */ | 130 | /* PN533_CMD_IN_LIST_PASSIVE_TARGET */ |
119 | 131 | ||
120 | /* felica commands opcode */ | 132 | /* felica commands opcode */ |
@@ -2004,6 +2016,7 @@ static int pn533_probe(struct usb_interface *interface, | |||
2004 | struct usb_host_interface *iface_desc; | 2016 | struct usb_host_interface *iface_desc; |
2005 | struct usb_endpoint_descriptor *endpoint; | 2017 | struct usb_endpoint_descriptor *endpoint; |
2006 | struct pn533_config_max_retries max_retries; | 2018 | struct pn533_config_max_retries max_retries; |
2019 | struct pn533_config_timing timing; | ||
2007 | int in_endpoint = 0; | 2020 | int in_endpoint = 0; |
2008 | int out_endpoint = 0; | 2021 | int out_endpoint = 0; |
2009 | int rc = -ENOMEM; | 2022 | int rc = -ENOMEM; |
@@ -2115,6 +2128,18 @@ static int pn533_probe(struct usb_interface *interface, | |||
2115 | goto unregister_nfc_dev; | 2128 | goto unregister_nfc_dev; |
2116 | } | 2129 | } |
2117 | 2130 | ||
2131 | timing.rfu = PN533_CONFIG_TIMING_102; | ||
2132 | timing.atr_res_timeout = PN533_CONFIG_TIMING_204; | ||
2133 | timing.dep_timeout = PN533_CONFIG_TIMING_409; | ||
2134 | |||
2135 | rc = pn533_set_configuration(dev, PN533_CFGITEM_TIMING, | ||
2136 | (u8 *) &timing, sizeof(timing)); | ||
2137 | if (rc) { | ||
2138 | nfc_dev_err(&dev->interface->dev, | ||
2139 | "Error on setting RF timings"); | ||
2140 | goto unregister_nfc_dev; | ||
2141 | } | ||
2142 | |||
2118 | return 0; | 2143 | return 0; |
2119 | 2144 | ||
2120 | unregister_nfc_dev: | 2145 | unregister_nfc_dev: |