2 * NCI based driver for Samsung S3FWRN5 NFC chip
4 * Copyright (C) 2015 Samsung Electrnoics
5 * Robert Baldyga <r.baldyga@samsung.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2 or later, as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef __LOCAL_S3FWRN5_FIRMWARE_H_
21 #define __LOCAL_S3FWRN5_FIRMWARE_H_
23 /* FW Message Types */
24 #define S3FWRN5_FW_MSG_CMD 0x00
25 #define S3FWRN5_FW_MSG_RSP 0x01
26 #define S3FWRN5_FW_MSG_DATA 0x02
29 #define S3FWRN5_FW_RET_SUCCESS 0x00
30 #define S3FWRN5_FW_RET_MESSAGE_TYPE_INVALID 0x01
31 #define S3FWRN5_FW_RET_COMMAND_INVALID 0x02
32 #define S3FWRN5_FW_RET_PAGE_DATA_OVERFLOW 0x03
33 #define S3FWRN5_FW_RET_SECT_DATA_OVERFLOW 0x04
34 #define S3FWRN5_FW_RET_AUTHENTICATION_FAIL 0x05
35 #define S3FWRN5_FW_RET_FLASH_OPERATION_FAIL 0x06
36 #define S3FWRN5_FW_RET_ADDRESS_OUT_OF_RANGE 0x07
37 #define S3FWRN5_FW_RET_PARAMETER_INVALID 0x08
39 /* ---- FW Packet structures ---- */
40 #define S3FWRN5_FW_HDR_SIZE 4
42 struct s3fwrn5_fw_header
{
48 #define S3FWRN5_FW_CMD_RESET 0x00
50 #define S3FWRN5_FW_CMD_GET_BOOTINFO 0x01
52 struct s3fwrn5_fw_cmd_get_bootinfo_rsp
{
60 #define S3FWRN5_FW_CMD_ENTER_UPDATE_MODE 0x02
62 struct s3fwrn5_fw_cmd_enter_updatemode
{
67 #define S3FWRN5_FW_CMD_UPDATE_SECTOR 0x04
69 struct s3fwrn5_fw_cmd_update_sector
{
73 #define S3FWRN5_FW_CMD_COMPLETE_UPDATE_MODE 0x05
75 struct s3fwrn5_fw_image
{
76 const struct firmware
*fw
;
84 const void *custom_sig
;
88 struct s3fwrn5_fw_info
{
90 struct s3fwrn5_fw_image fw
;
91 char fw_name
[NFC_FIRMWARE_NAME_MAXSIZE
+ 1];
98 struct completion completion
;
103 void s3fwrn5_fw_init(struct s3fwrn5_fw_info
*fw_info
, const char *fw_name
);
104 int s3fwrn5_fw_setup(struct s3fwrn5_fw_info
*fw_info
);
105 bool s3fwrn5_fw_check_version(struct s3fwrn5_fw_info
*fw_info
, u32 version
);
106 int s3fwrn5_fw_download(struct s3fwrn5_fw_info
*fw_info
);
107 void s3fwrn5_fw_cleanup(struct s3fwrn5_fw_info
*fw_info
);
109 int s3fwrn5_fw_recv_frame(struct nci_dev
*ndev
, struct sk_buff
*skb
);
111 #endif /* __LOCAL_S3FWRN5_FIRMWARE_H_ */