2 * Copyright (C) 2014 NXP Semiconductors All rights reserved.
4 * Authors: Clément Perrochaud <clement.perrochaud@nxp.com>
6 * Derived from PN544 device driver:
7 * Copyright (C) 2012 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LOCAL_NXP_NCI_H_
23 #define __LOCAL_NXP_NCI_H_
25 #include <linux/completion.h>
26 #include <linux/firmware.h>
27 #include <linux/nfc.h>
28 #include <linux/platform_data/nxp-nci.h>
30 #include <net/nfc/nci_core.h>
32 #define NXP_NCI_FW_HDR_LEN 2
33 #define NXP_NCI_FW_CRC_LEN 2
35 #define NXP_NCI_FW_FRAME_LEN_MASK 0x03FF
43 struct nxp_nci_phy_ops
{
44 int (*set_mode
)(void *id
, enum nxp_nci_mode mode
);
45 int (*write
)(void *id
, struct sk_buff
*skb
);
48 struct nxp_nci_fw_info
{
49 char name
[NFC_FIRMWARE_NAME_MAXSIZE
+ 1];
50 const struct firmware
*fw
;
58 struct work_struct work
;
59 struct completion cmd_completion
;
69 enum nxp_nci_mode mode
;
71 struct nxp_nci_phy_ops
*phy_ops
;
72 unsigned int max_payload
;
74 struct mutex info_lock
;
76 struct nxp_nci_fw_info fw_info
;
79 int nxp_nci_fw_download(struct nci_dev
*ndev
, const char *firmware_name
);
80 void nxp_nci_fw_work(struct work_struct
*work
);
81 void nxp_nci_fw_recv_frame(struct nci_dev
*ndev
, struct sk_buff
*skb
);
82 void nxp_nci_fw_work_complete(struct nxp_nci_info
*info
, int result
);
84 int nxp_nci_probe(void *phy_id
, struct device
*pdev
,
85 struct nxp_nci_phy_ops
*phy_ops
, unsigned int max_payload
,
86 struct nci_dev
**ndev
);
87 void nxp_nci_remove(struct nci_dev
*ndev
);
89 #endif /* __LOCAL_NXP_NCI_H_ */