2 * Marvell NFC driver: Firmware downloader
4 * Copyright (C) 2015, Marvell International Ltd.
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available on the worldwide web at
11 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
14 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
15 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
16 * this warranty disclaimer.
19 #ifndef __NFCMRVL_FW_DNLD_H__
20 #define __NFCMRVL_FW_DNLD_H__
22 #include <linux/workqueue.h>
24 #define NFCMRVL_FW_MAGIC 0x88888888
26 #define NCI_OP_PROP_BOOT_CMD 0x3A
28 #define NCI_CORE_LC_PROP_FW_DL 0xFD
29 #define NCI_CORE_LC_CONNID_PROP_FW_DL 0x02
31 #define HELPER_CMD_ENTRY_POINT 0x04
32 #define HELPER_CMD_PACKET_FORMAT 0xA5
33 #define HELPER_ACK_PACKET_FORMAT 0x5A
34 #define HELPER_RETRY_REQUESTED (1 << 15)
36 struct nfcmrvl_private
;
38 struct nfcmrvl_fw_uart_config
{
43 struct nfcmrvl_fw_i2c_config
{
47 struct nfcmrvl_fw_spi_config
{
51 struct nfcmrvl_fw_binary_config
{
55 struct nfcmrvl_fw_uart_config uart
;
56 struct nfcmrvl_fw_i2c_config i2c
;
57 struct nfcmrvl_fw_spi_config spi
;
66 struct nfcmrvl_fw_binary_config bootrom
;
67 struct nfcmrvl_fw_binary_config helper
;
68 struct nfcmrvl_fw_binary_config firmware
;
72 struct nfcmrvl_fw_dnld
{
73 char name
[NFC_FIRMWARE_NAME_MAXSIZE
+ 1];
74 const struct firmware
*fw
;
76 const struct nfcmrvl_fw
*header
;
77 const struct nfcmrvl_fw_binary_config
*binary_config
;
84 struct workqueue_struct
*rx_wq
;
85 struct work_struct rx_work
;
86 struct sk_buff_head rx_q
;
88 struct timer_list timer
;
91 int nfcmrvl_fw_dnld_init(struct nfcmrvl_private
*priv
);
92 void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private
*priv
);
93 void nfcmrvl_fw_dnld_abort(struct nfcmrvl_private
*priv
);
94 int nfcmrvl_fw_dnld_start(struct nci_dev
*ndev
, const char *firmware_name
);
95 void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private
*priv
,