aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@linux.intel.com>2013-04-29 11:13:27 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 18:26:08 -0400
commit9674da8759df0d6c0d24e1ede6e2a1acdef91e3c (patch)
tree97363dfcf38f1e7c6bfb8a9abd76302c617eb705 /include
parent1095e69f47926db6f1350a9d6a38626521580e87 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/uapi/linux/nfc.h6
2 files changed, 8 insertions, 0 deletions
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 5eb80bb3cbb2..3563dbdcaaf2 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -70,6 +70,7 @@ struct nfc_ops {
70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); 70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
71 int (*enable_se)(struct nfc_dev *dev, u32 secure_element); 71 int (*enable_se)(struct nfc_dev *dev, u32 secure_element);
72 int (*disable_se)(struct nfc_dev *dev, u32 secure_element); 72 int (*disable_se)(struct nfc_dev *dev, u32 secure_element);
73 int (*fw_upload)(struct nfc_dev *dev, const char *firmware_name);
73}; 74};
74 75
75#define NFC_TARGET_IDX_ANY -1 76#define NFC_TARGET_IDX_ANY -1
@@ -104,6 +105,7 @@ struct nfc_dev {
104 int targets_generation; 105 int targets_generation;
105 struct device dev; 106 struct device dev;
106 bool dev_up; 107 bool dev_up;
108 bool fw_upload_in_progress;
107 u8 rf_mode; 109 u8 rf_mode;
108 bool polling; 110 bool polling;
109 struct nfc_target *active_target; 111 struct nfc_target *active_target;
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 7c6f627a717d..b6cbd164f146 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -69,6 +69,8 @@
69 * starting a poll from a device which has a secure element enabled means 69 * starting a poll from a device which has a secure element enabled means
70 * we want to do SE based card emulation. 70 * we want to do SE based card emulation.
71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. 71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
72 * @NFC_CMD_FW_UPLOAD: Request to Load/flash firmware, or event to inform that
73 * some firmware was loaded
72 */ 74 */
73enum nfc_commands { 75enum nfc_commands {
74 NFC_CMD_UNSPEC, 76 NFC_CMD_UNSPEC,
@@ -92,6 +94,7 @@ enum nfc_commands {
92 NFC_CMD_DISABLE_SE, 94 NFC_CMD_DISABLE_SE,
93 NFC_CMD_LLC_SDREQ, 95 NFC_CMD_LLC_SDREQ,
94 NFC_EVENT_LLC_SDRES, 96 NFC_EVENT_LLC_SDRES,
97 NFC_CMD_FW_UPLOAD,
95/* private: internal use only */ 98/* private: internal use only */
96 __NFC_CMD_AFTER_LAST 99 __NFC_CMD_AFTER_LAST
97}; 100};
@@ -121,6 +124,7 @@ enum nfc_commands {
121 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter 124 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter
122 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter 125 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter
123 * @NFC_ATTR_SE: Available Secure Elements 126 * @NFC_ATTR_SE: Available Secure Elements
127 * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version
124 */ 128 */
125enum nfc_attrs { 129enum nfc_attrs {
126 NFC_ATTR_UNSPEC, 130 NFC_ATTR_UNSPEC,
@@ -143,6 +147,7 @@ enum nfc_attrs {
143 NFC_ATTR_LLC_PARAM_MIUX, 147 NFC_ATTR_LLC_PARAM_MIUX,
144 NFC_ATTR_SE, 148 NFC_ATTR_SE,
145 NFC_ATTR_LLC_SDP, 149 NFC_ATTR_LLC_SDP,
150 NFC_ATTR_FIRMWARE_NAME,
146/* private: internal use only */ 151/* private: internal use only */
147 __NFC_ATTR_AFTER_LAST 152 __NFC_ATTR_AFTER_LAST
148}; 153};
@@ -162,6 +167,7 @@ enum nfc_sdp_attr {
162#define NFC_SENSB_RES_MAXSIZE 12 167#define NFC_SENSB_RES_MAXSIZE 12
163#define NFC_SENSF_RES_MAXSIZE 18 168#define NFC_SENSF_RES_MAXSIZE 18
164#define NFC_GB_MAXSIZE 48 169#define NFC_GB_MAXSIZE 48
170#define NFC_FIRMWARE_NAME_MAXSIZE 32
165 171
166/* NFC protocols */ 172/* NFC protocols */
167#define NFC_PROTO_JEWEL 1 173#define NFC_PROTO_JEWEL 1