mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 15:27:36 +07:00
9dd0abd232
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms and conditions of the gnu general public license version 2 or later as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not see http www gnu org licenses extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 7 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190523091651.504392586@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
101 lines
2.3 KiB
C
101 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* NCI based driver for Samsung S3FWRN5 NFC chip
|
|
*
|
|
* Copyright (C) 2015 Samsung Electrnoics
|
|
* Robert Baldyga <r.baldyga@samsung.com>
|
|
*/
|
|
|
|
#ifndef __LOCAL_S3FWRN5_FIRMWARE_H_
|
|
#define __LOCAL_S3FWRN5_FIRMWARE_H_
|
|
|
|
/* FW Message Types */
|
|
#define S3FWRN5_FW_MSG_CMD 0x00
|
|
#define S3FWRN5_FW_MSG_RSP 0x01
|
|
#define S3FWRN5_FW_MSG_DATA 0x02
|
|
|
|
/* FW Return Codes */
|
|
#define S3FWRN5_FW_RET_SUCCESS 0x00
|
|
#define S3FWRN5_FW_RET_MESSAGE_TYPE_INVALID 0x01
|
|
#define S3FWRN5_FW_RET_COMMAND_INVALID 0x02
|
|
#define S3FWRN5_FW_RET_PAGE_DATA_OVERFLOW 0x03
|
|
#define S3FWRN5_FW_RET_SECT_DATA_OVERFLOW 0x04
|
|
#define S3FWRN5_FW_RET_AUTHENTICATION_FAIL 0x05
|
|
#define S3FWRN5_FW_RET_FLASH_OPERATION_FAIL 0x06
|
|
#define S3FWRN5_FW_RET_ADDRESS_OUT_OF_RANGE 0x07
|
|
#define S3FWRN5_FW_RET_PARAMETER_INVALID 0x08
|
|
|
|
/* ---- FW Packet structures ---- */
|
|
#define S3FWRN5_FW_HDR_SIZE 4
|
|
|
|
struct s3fwrn5_fw_header {
|
|
__u8 type;
|
|
__u8 code;
|
|
__u16 len;
|
|
};
|
|
|
|
#define S3FWRN5_FW_CMD_RESET 0x00
|
|
|
|
#define S3FWRN5_FW_CMD_GET_BOOTINFO 0x01
|
|
|
|
struct s3fwrn5_fw_cmd_get_bootinfo_rsp {
|
|
__u8 hw_version[4];
|
|
__u16 sector_size;
|
|
__u16 page_size;
|
|
__u16 frame_max_size;
|
|
__u16 hw_buffer_size;
|
|
};
|
|
|
|
#define S3FWRN5_FW_CMD_ENTER_UPDATE_MODE 0x02
|
|
|
|
struct s3fwrn5_fw_cmd_enter_updatemode {
|
|
__u16 hashcode_size;
|
|
__u16 signature_size;
|
|
};
|
|
|
|
#define S3FWRN5_FW_CMD_UPDATE_SECTOR 0x04
|
|
|
|
struct s3fwrn5_fw_cmd_update_sector {
|
|
__u32 base_address;
|
|
};
|
|
|
|
#define S3FWRN5_FW_CMD_COMPLETE_UPDATE_MODE 0x05
|
|
|
|
struct s3fwrn5_fw_image {
|
|
const struct firmware *fw;
|
|
|
|
char date[13];
|
|
u32 version;
|
|
const void *sig;
|
|
u32 sig_size;
|
|
const void *image;
|
|
u32 image_sectors;
|
|
const void *custom_sig;
|
|
u32 custom_sig_size;
|
|
};
|
|
|
|
struct s3fwrn5_fw_info {
|
|
struct nci_dev *ndev;
|
|
struct s3fwrn5_fw_image fw;
|
|
char fw_name[NFC_FIRMWARE_NAME_MAXSIZE + 1];
|
|
|
|
const void *sig;
|
|
u32 sig_size;
|
|
u32 sector_size;
|
|
u32 base_addr;
|
|
|
|
struct completion completion;
|
|
struct sk_buff *rsp;
|
|
char parity;
|
|
};
|
|
|
|
void s3fwrn5_fw_init(struct s3fwrn5_fw_info *fw_info, const char *fw_name);
|
|
int s3fwrn5_fw_setup(struct s3fwrn5_fw_info *fw_info);
|
|
bool s3fwrn5_fw_check_version(struct s3fwrn5_fw_info *fw_info, u32 version);
|
|
int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info);
|
|
void s3fwrn5_fw_cleanup(struct s3fwrn5_fw_info *fw_info);
|
|
|
|
int s3fwrn5_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb);
|
|
|
|
#endif /* __LOCAL_S3FWRN5_FIRMWARE_H_ */
|