1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _NFCMRVL_H_
20#define _NFCMRVL_H_
21
22#include <linux/platform_data/nfcmrvl.h>
23
24#include "fw_dnld.h"
25
26
27#define NFCMRVL_NCI_RUNNING 1
28#define NFCMRVL_PHY_ERROR 2
29
30#define NFCMRVL_EXT_COEX_ID 0xE0
31#define NFCMRVL_NOT_ALLOWED_ID 0xE1
32#define NFCMRVL_ACTIVE_ID 0xE2
33#define NFCMRVL_EXT_COEX_ENABLE 1
34#define NFCMRVL_GPIO_PIN_NFC_NOT_ALLOWED 0xA
35#define NFCMRVL_GPIO_PIN_NFC_ACTIVE 0xB
36#define NFCMRVL_NCI_MAX_EVENT_SIZE 260
37
38
39
40
41
42#define NFCMRVL_PB_BAIL_OUT 0x11
43#define NFCMRVL_PROP_REF_CLOCK 0xF0
44#define NFCMRVL_PROP_SET_HI_CONFIG 0xF1
45
46
47
48
49
50#define NFCMRVL_HCI_EVENT_HEADER_SIZE 0x04
51#define NFCMRVL_HCI_EVENT_CODE 0x04
52#define NFCMRVL_HCI_NFC_EVENT_CODE 0xFF
53#define NFCMRVL_HCI_COMMAND_CODE 0x01
54#define NFCMRVL_HCI_OGF 0x81
55#define NFCMRVL_HCI_OCF 0xFE
56
57enum nfcmrvl_phy {
58 NFCMRVL_PHY_USB = 0,
59 NFCMRVL_PHY_UART = 1,
60 NFCMRVL_PHY_I2C = 2,
61 NFCMRVL_PHY_SPI = 3,
62};
63
64struct nfcmrvl_private {
65
66 unsigned long flags;
67
68
69 struct nfcmrvl_platform_data config;
70
71
72 struct nci_dev *ndev;
73
74
75 struct nfcmrvl_fw_dnld fw_dnld;
76
77
78 bool support_fw_dnld;
79
80
81
82
83
84
85 void *drv_data;
86
87 struct device *dev;
88
89 enum nfcmrvl_phy phy;
90
91 struct nfcmrvl_if_ops *if_ops;
92};
93
94struct nfcmrvl_if_ops {
95 int (*nci_open) (struct nfcmrvl_private *priv);
96 int (*nci_close) (struct nfcmrvl_private *priv);
97 int (*nci_send) (struct nfcmrvl_private *priv, struct sk_buff *skb);
98 void (*nci_update_config)(struct nfcmrvl_private *priv,
99 const void *param);
100};
101
102void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
103int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
104struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
105 void *drv_data,
106 struct nfcmrvl_if_ops *ops,
107 struct device *dev,
108 struct nfcmrvl_platform_data *pdata);
109
110
111void nfcmrvl_chip_reset(struct nfcmrvl_private *priv);
112void nfcmrvl_chip_halt(struct nfcmrvl_private *priv);
113
114int nfcmrvl_parse_dt(struct device_node *node,
115 struct nfcmrvl_platform_data *pdata);
116
117#endif
118