0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __LOCAL_NXP_NCI_H_
0012 #define __LOCAL_NXP_NCI_H_
0013
0014 #include <linux/completion.h>
0015 #include <linux/firmware.h>
0016 #include <linux/nfc.h>
0017
0018 #include <net/nfc/nci_core.h>
0019
0020 #define NXP_NCI_FW_HDR_LEN 2
0021 #define NXP_NCI_FW_CRC_LEN 2
0022
0023 #define NXP_NCI_FW_FRAME_LEN_MASK 0x03FF
0024
0025 enum nxp_nci_mode {
0026 NXP_NCI_MODE_COLD,
0027 NXP_NCI_MODE_NCI,
0028 NXP_NCI_MODE_FW
0029 };
0030
0031 struct nxp_nci_phy_ops {
0032 int (*set_mode)(void *id, enum nxp_nci_mode mode);
0033 int (*write)(void *id, struct sk_buff *skb);
0034 };
0035
0036 struct nxp_nci_fw_info {
0037 char name[NFC_FIRMWARE_NAME_MAXSIZE + 1];
0038 const struct firmware *fw;
0039
0040 size_t size;
0041 size_t written;
0042
0043 const u8 *data;
0044 size_t frame_size;
0045
0046 struct work_struct work;
0047 struct completion cmd_completion;
0048
0049 int cmd_result;
0050 };
0051
0052 struct nxp_nci_info {
0053 struct nci_dev *ndev;
0054 void *phy_id;
0055 struct device *pdev;
0056
0057 enum nxp_nci_mode mode;
0058
0059 const struct nxp_nci_phy_ops *phy_ops;
0060 unsigned int max_payload;
0061
0062 struct mutex info_lock;
0063
0064 struct nxp_nci_fw_info fw_info;
0065 };
0066
0067 int nxp_nci_fw_download(struct nci_dev *ndev, const char *firmware_name);
0068 void nxp_nci_fw_work(struct work_struct *work);
0069 void nxp_nci_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb);
0070 void nxp_nci_fw_work_complete(struct nxp_nci_info *info, int result);
0071
0072 int nxp_nci_probe(void *phy_id, struct device *pdev,
0073 const struct nxp_nci_phy_ops *phy_ops,
0074 unsigned int max_payload,
0075 struct nci_dev **ndev);
0076 void nxp_nci_remove(struct nci_dev *ndev);
0077
0078 #endif