Linux Audio

Check our new training course

In-person Linux kernel drivers training

Jun 16-20, 2025
Register
Loading...
Note: File does not exist in v3.5.6.
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2014  NXP Semiconductors  All rights reserved.
 4 *
 5 * Authors: Clément Perrochaud <clement.perrochaud@nxp.com>
 6 *
 7 * Derived from PN544 device driver:
 8 * Copyright (C) 2012  Intel Corporation. All rights reserved.
 9*/
10
11#ifndef __LOCAL_NXP_NCI_H_
12#define __LOCAL_NXP_NCI_H_
13
14#include <linux/completion.h>
15#include <linux/firmware.h>
16#include <linux/nfc.h>
17
18#include <net/nfc/nci_core.h>
19
20#define NXP_NCI_FW_HDR_LEN	2
21#define NXP_NCI_FW_CRC_LEN	2
22
23#define NXP_NCI_FW_FRAME_LEN_MASK	0x03FF
24
25enum nxp_nci_mode {
26	NXP_NCI_MODE_COLD,
27	NXP_NCI_MODE_NCI,
28	NXP_NCI_MODE_FW
29};
30
31struct nxp_nci_phy_ops {
32	int (*set_mode)(void *id, enum nxp_nci_mode mode);
33	int (*write)(void *id, struct sk_buff *skb);
34};
35
36struct nxp_nci_fw_info {
37	char name[NFC_FIRMWARE_NAME_MAXSIZE + 1];
38	const struct firmware *fw;
39
40	size_t size;
41	size_t written;
42
43	const u8 *data;
44	size_t frame_size;
45
46	struct work_struct work;
47	struct completion cmd_completion;
48
49	int cmd_result;
50};
51
52struct nxp_nci_info {
53	struct nci_dev *ndev;
54	void *phy_id;
55	struct device *pdev;
56
57	enum nxp_nci_mode mode;
58
59	const struct nxp_nci_phy_ops *phy_ops;
60	unsigned int max_payload;
61
62	struct mutex info_lock;
63
64	struct nxp_nci_fw_info fw_info;
65};
66
67int nxp_nci_fw_download(struct nci_dev *ndev, const char *firmware_name);
68void nxp_nci_fw_work(struct work_struct *work);
69void nxp_nci_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb);
70void nxp_nci_fw_work_complete(struct nxp_nci_info *info, int result);
71
72int nxp_nci_probe(void *phy_id, struct device *pdev,
73		  const struct nxp_nci_phy_ops *phy_ops,
74		  unsigned int max_payload,
75		  struct nci_dev **ndev);
76void nxp_nci_remove(struct nci_dev *ndev);
77
78#endif /* __LOCAL_NXP_NCI_H_ */