NFC: nfcmrvl: add firmware download support
[deliverable/linux.git] / drivers / nfc / nfcmrvl / nfcmrvl.h
CommitLineData
f26e30cc
AK
1/**
2 * Marvell NFC driver
3 *
3194c687 4 * Copyright (C) 2014-2015, Marvell International Ltd.
f26e30cc
AK
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
dc14bdef
VC
19#ifndef _NFCMRVL_H_
20#define _NFCMRVL_H_
21
22#include <linux/platform_data/nfcmrvl.h>
23
3194c687
VC
24#include "fw_dnld.h"
25
f26e30cc
AK
26/* Define private flags: */
27#define NFCMRVL_NCI_RUNNING 1
28
15203b4c
AK
29#define NFCMRVL_EXT_COEX_ID 0xE0
30#define NFCMRVL_NOT_ALLOWED_ID 0xE1
31#define NFCMRVL_ACTIVE_ID 0xE2
32#define NFCMRVL_EXT_COEX_ENABLE 1
33#define NFCMRVL_GPIO_PIN_NFC_NOT_ALLOWED 0xA
34#define NFCMRVL_GPIO_PIN_NFC_ACTIVE 0xB
f26e30cc
AK
35#define NFCMRVL_NCI_MAX_EVENT_SIZE 260
36
d0dcad8b
VC
37/*
38** NCI FW Parmaters
39*/
40
41#define NFCMRVL_PB_BAIL_OUT 0x11
3194c687
VC
42#define NFCMRVL_PROP_REF_CLOCK 0xF0
43#define NFCMRVL_PROP_SET_HI_CONFIG 0xF1
d0dcad8b 44
f1f1a7da
VC
45/*
46** HCI defines
47*/
48
49#define NFCMRVL_HCI_EVENT_HEADER_SIZE 0x04
50#define NFCMRVL_HCI_EVENT_CODE 0x04
51#define NFCMRVL_HCI_NFC_EVENT_CODE 0xFF
52#define NFCMRVL_HCI_COMMAND_CODE 0x01
53#define NFCMRVL_HCI_OGF 0x81
54#define NFCMRVL_HCI_OCF 0xFE
55
e097dc62
VC
56enum nfcmrvl_phy {
57 NFCMRVL_PHY_USB = 0,
58 NFCMRVL_PHY_UART = 1,
3194c687
VC
59 NFCMRVL_PHY_I2C = 2,
60 NFCMRVL_PHY_SPI = 3,
e097dc62
VC
61};
62
f26e30cc 63struct nfcmrvl_private {
f1f1a7da 64
dc14bdef
VC
65 unsigned long flags;
66
67 /* Platform configuration */
68 struct nfcmrvl_platform_data config;
69
3194c687 70 /* Parent dev */
f26e30cc 71 struct nci_dev *ndev;
4a2b947f 72
3194c687
VC
73 /* FW download context */
74 struct nfcmrvl_fw_dnld fw_dnld;
75
76 /* FW download support */
77 bool support_fw_dnld;
78
dc14bdef
VC
79 /*
80 ** PHY related information
81 */
4a2b947f 82
dc14bdef 83 /* PHY driver context */
f26e30cc 84 void *drv_data;
dc14bdef 85 /* PHY device */
f26e30cc 86 struct device *dev;
e097dc62
VC
87 /* PHY type */
88 enum nfcmrvl_phy phy;
dc14bdef 89 /* Low level driver ops */
f26e30cc
AK
90 struct nfcmrvl_if_ops *if_ops;
91};
92
93struct nfcmrvl_if_ops {
94 int (*nci_open) (struct nfcmrvl_private *priv);
95 int (*nci_close) (struct nfcmrvl_private *priv);
96 int (*nci_send) (struct nfcmrvl_private *priv, struct sk_buff *skb);
3194c687
VC
97 void (*nci_update_config)(struct nfcmrvl_private *priv,
98 const void *param);
f26e30cc
AK
99};
100
101void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
e1bf80c2 102int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
f26e30cc 103struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
dc14bdef
VC
104 struct nfcmrvl_if_ops *ops,
105 struct device *dev,
106 struct nfcmrvl_platform_data *pdata);
107
4a2b947f
VC
108
109void nfcmrvl_chip_reset(struct nfcmrvl_private *priv);
3194c687 110void nfcmrvl_chip_halt(struct nfcmrvl_private *priv);
dc14bdef
VC
111
112int nfcmrvl_parse_dt(struct device_node *node,
113 struct nfcmrvl_platform_data *pdata);
114
115#endif
This page took 0.115125 seconds and 5 git commands to generate.