1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * NCI based driver for Samsung S3FWRN5 NFC chip
5 * Copyright (C) 2015 Samsung Electrnoics
6 * Robert Baldyga <r.baldyga@samsung.com>
9 #ifndef __LOCAL_S3FWRN5_FIRMWARE_H_
10 #define __LOCAL_S3FWRN5_FIRMWARE_H_
12 /* FW Message Types */
13 #define S3FWRN5_FW_MSG_CMD 0x00
14 #define S3FWRN5_FW_MSG_RSP 0x01
15 #define S3FWRN5_FW_MSG_DATA 0x02
18 #define S3FWRN5_FW_RET_SUCCESS 0x00
19 #define S3FWRN5_FW_RET_MESSAGE_TYPE_INVALID 0x01
20 #define S3FWRN5_FW_RET_COMMAND_INVALID 0x02
21 #define S3FWRN5_FW_RET_PAGE_DATA_OVERFLOW 0x03
22 #define S3FWRN5_FW_RET_SECT_DATA_OVERFLOW 0x04
23 #define S3FWRN5_FW_RET_AUTHENTICATION_FAIL 0x05
24 #define S3FWRN5_FW_RET_FLASH_OPERATION_FAIL 0x06
25 #define S3FWRN5_FW_RET_ADDRESS_OUT_OF_RANGE 0x07
26 #define S3FWRN5_FW_RET_PARAMETER_INVALID 0x08
28 /* ---- FW Packet structures ---- */
29 #define S3FWRN5_FW_HDR_SIZE 4
31 struct s3fwrn5_fw_header
{
37 #define S3FWRN5_FW_CMD_RESET 0x00
39 #define S3FWRN5_FW_CMD_GET_BOOTINFO 0x01
41 struct s3fwrn5_fw_cmd_get_bootinfo_rsp
{
49 #define S3FWRN5_FW_CMD_ENTER_UPDATE_MODE 0x02
51 struct s3fwrn5_fw_cmd_enter_updatemode
{
56 #define S3FWRN5_FW_CMD_UPDATE_SECTOR 0x04
58 struct s3fwrn5_fw_cmd_update_sector
{
62 #define S3FWRN5_FW_CMD_COMPLETE_UPDATE_MODE 0x05
64 struct s3fwrn5_fw_image
{
65 const struct firmware
*fw
;
73 const void *custom_sig
;
77 struct s3fwrn5_fw_info
{
79 struct s3fwrn5_fw_image fw
;
80 char fw_name
[NFC_FIRMWARE_NAME_MAXSIZE
+ 1];
87 struct completion completion
;
92 void s3fwrn5_fw_init(struct s3fwrn5_fw_info
*fw_info
, const char *fw_name
);
93 int s3fwrn5_fw_setup(struct s3fwrn5_fw_info
*fw_info
);
94 bool s3fwrn5_fw_check_version(struct s3fwrn5_fw_info
*fw_info
, u32 version
);
95 int s3fwrn5_fw_download(struct s3fwrn5_fw_info
*fw_info
);
96 void s3fwrn5_fw_cleanup(struct s3fwrn5_fw_info
*fw_info
);
98 int s3fwrn5_fw_recv_frame(struct nci_dev
*ndev
, struct sk_buff
*skb
);
100 #endif /* __LOCAL_S3FWRN5_FIRMWARE_H_ */