1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2014 NXP Semiconductors All rights reserved.
7 * Derived from PN544 device driver:
8 * Copyright (C) 2012 Intel Corporation. All rights reserved.
11 #ifndef __LOCAL_NXP_NCI_H_
12 #define __LOCAL_NXP_NCI_H_
14 #include <linux/completion.h>
15 #include <linux/firmware.h>
16 #include <linux/nfc.h>
17 #include <linux/platform_data/nxp-nci.h>
19 #include <net/nfc/nci_core.h>
21 #define NXP_NCI_FW_HDR_LEN 2
22 #define NXP_NCI_FW_CRC_LEN 2
24 #define NXP_NCI_FW_FRAME_LEN_MASK 0x03FF
32 struct nxp_nci_phy_ops {
33 int (*set_mode)(void *id, enum nxp_nci_mode mode);
34 int (*write)(void *id, struct sk_buff *skb);
37 struct nxp_nci_fw_info {
38 char name[NFC_FIRMWARE_NAME_MAXSIZE + 1];
39 const struct firmware *fw;
47 struct work_struct work;
48 struct completion cmd_completion;
58 enum nxp_nci_mode mode;
60 const struct nxp_nci_phy_ops *phy_ops;
61 unsigned int max_payload;
63 struct mutex info_lock;
65 struct nxp_nci_fw_info fw_info;
68 int nxp_nci_fw_download(struct nci_dev *ndev, const char *firmware_name);
69 void nxp_nci_fw_work(struct work_struct *work);
70 void nxp_nci_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb);
71 void nxp_nci_fw_work_complete(struct nxp_nci_info *info, int result);
73 int nxp_nci_probe(void *phy_id, struct device *pdev,
74 const struct nxp_nci_phy_ops *phy_ops,
75 unsigned int max_payload,
76 struct nci_dev **ndev);
77 void nxp_nci_remove(struct nci_dev *ndev);
79 #endif /* __LOCAL_NXP_NCI_H_ */