Merge tag 'riscv-for-linus-4.15-rc2_cleanups' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / drivers / nfc / nxp-nci / nxp-nci.h
blob20408cbff4f10c2ac9d001bee50f9dfe9f26c2b4
1 /*
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
37 enum nxp_nci_mode {
38 NXP_NCI_MODE_COLD,
39 NXP_NCI_MODE_NCI,
40 NXP_NCI_MODE_FW
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;
52 size_t size;
53 size_t written;
55 const u8 *data;
56 size_t frame_size;
58 struct work_struct work;
59 struct completion cmd_completion;
61 int cmd_result;
64 struct nxp_nci_info {
65 struct nci_dev *ndev;
66 void *phy_id;
67 struct device *pdev;
69 enum nxp_nci_mode mode;
71 const 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 const struct nxp_nci_phy_ops *phy_ops,
86 unsigned int max_payload,
87 struct nci_dev **ndev);
88 void nxp_nci_remove(struct nci_dev *ndev);
90 #endif /* __LOCAL_NXP_NCI_H_ */