NFC: nfcmrvl: add UART driver
[firefly-linux-kernel-4.4.55.git] / drivers / nfc / nfcmrvl / nfcmrvl.h
1 /**
2  * Marvell NFC driver
3  *
4  * Copyright (C) 2014, Marvell International Ltd.
5  *
6  * This software file (the "File") is distributed by Marvell International
7  * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8  * (the "License").  You may use, redistribute and/or modify this File in
9  * accordance with the terms and conditions of the License, a copy of which
10  * is available on the worldwide web at
11  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
12  *
13  * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
14  * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
15  * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
16  * this warranty disclaimer.
17  **/
18
19 #ifndef _NFCMRVL_H_
20 #define _NFCMRVL_H_
21
22 #include <linux/platform_data/nfcmrvl.h>
23
24 /* Define private flags: */
25 #define NFCMRVL_NCI_RUNNING                     1
26
27 #define NFCMRVL_EXT_COEX_ID                     0xE0
28 #define NFCMRVL_NOT_ALLOWED_ID                  0xE1
29 #define NFCMRVL_ACTIVE_ID                       0xE2
30 #define NFCMRVL_EXT_COEX_ENABLE                 1
31 #define NFCMRVL_GPIO_PIN_NFC_NOT_ALLOWED        0xA
32 #define NFCMRVL_GPIO_PIN_NFC_ACTIVE             0xB
33 #define NFCMRVL_NCI_MAX_EVENT_SIZE              260
34
35 /*
36 ** HCI defines
37 */
38
39 #define NFCMRVL_HCI_EVENT_HEADER_SIZE           0x04
40 #define NFCMRVL_HCI_EVENT_CODE                  0x04
41 #define NFCMRVL_HCI_NFC_EVENT_CODE              0xFF
42 #define NFCMRVL_HCI_COMMAND_CODE                0x01
43 #define NFCMRVL_HCI_OGF                         0x81
44 #define NFCMRVL_HCI_OCF                         0xFE
45
46 enum nfcmrvl_phy {
47         NFCMRVL_PHY_USB         = 0,
48         NFCMRVL_PHY_UART        = 1,
49 };
50
51
52 struct nfcmrvl_private {
53
54         unsigned long flags;
55
56         /* Platform configuration */
57         struct nfcmrvl_platform_data config;
58
59         struct nci_dev *ndev;
60
61         /*
62         ** PHY related information
63         */
64
65         /* PHY driver context */
66         void *drv_data;
67         /* PHY device */
68         struct device *dev;
69         /* PHY type */
70         enum nfcmrvl_phy phy;
71         /* Low level driver ops */
72         struct nfcmrvl_if_ops *if_ops;
73 };
74
75 struct nfcmrvl_if_ops {
76         int (*nci_open) (struct nfcmrvl_private *priv);
77         int (*nci_close) (struct nfcmrvl_private *priv);
78         int (*nci_send) (struct nfcmrvl_private *priv, struct sk_buff *skb);
79 };
80
81 void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
82 int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
83 struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
84                                 struct nfcmrvl_if_ops *ops,
85                                 struct device *dev,
86                                 struct nfcmrvl_platform_data *pdata);
87
88
89 void nfcmrvl_chip_reset(struct nfcmrvl_private *priv);
90
91 int nfcmrvl_parse_dt(struct device_node *node,
92                      struct nfcmrvl_platform_data *pdata);
93
94 #endif