xref: /openbmc/linux/drivers/nfc/st-nci/ndlc.h (revision 3648dc6d27f648b8e3ce9b48874627a833d53c3a)
1ed06aeefSChristophe Ricard /*
2ed06aeefSChristophe Ricard  * NCI based Driver for STMicroelectronics NFC Chip
3ed06aeefSChristophe Ricard  *
4ed06aeefSChristophe Ricard  * Copyright (C) 2014-2015  STMicroelectronics SAS. All rights reserved.
5ed06aeefSChristophe Ricard  *
6ed06aeefSChristophe Ricard  * This program is free software; you can redistribute it and/or modify it
7ed06aeefSChristophe Ricard  * under the terms and conditions of the GNU General Public License,
8ed06aeefSChristophe Ricard  * version 2, as published by the Free Software Foundation.
9ed06aeefSChristophe Ricard  *
10ed06aeefSChristophe Ricard  * This program is distributed in the hope that it will be useful,
11ed06aeefSChristophe Ricard  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12ed06aeefSChristophe Ricard  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13ed06aeefSChristophe Ricard  * GNU General Public License for more details.
14ed06aeefSChristophe Ricard  *
15ed06aeefSChristophe Ricard  * You should have received a copy of the GNU General Public License
16ed06aeefSChristophe Ricard  * along with this program; if not, see <http://www.gnu.org/licenses/>.
17ed06aeefSChristophe Ricard  */
18ed06aeefSChristophe Ricard 
19ed06aeefSChristophe Ricard #ifndef __LOCAL_NDLC_H_
20ed06aeefSChristophe Ricard #define __LOCAL_NDLC_H_
21ed06aeefSChristophe Ricard 
22ed06aeefSChristophe Ricard #include <linux/skbuff.h>
23ed06aeefSChristophe Ricard #include <net/nfc/nfc.h>
24ed06aeefSChristophe Ricard 
25*3648dc6dSChristophe Ricard struct st_nci_se_status;
26*3648dc6dSChristophe Ricard 
27ed06aeefSChristophe Ricard /* Low Level Transport description */
28ed06aeefSChristophe Ricard struct llt_ndlc {
29ed06aeefSChristophe Ricard 	struct nci_dev *ndev;
30ed06aeefSChristophe Ricard 	struct nfc_phy_ops *ops;
31ed06aeefSChristophe Ricard 	void *phy_id;
32ed06aeefSChristophe Ricard 
33ed06aeefSChristophe Ricard 	struct timer_list t1_timer;
34ed06aeefSChristophe Ricard 	bool t1_active;
35ed06aeefSChristophe Ricard 
36ed06aeefSChristophe Ricard 	struct timer_list t2_timer;
37ed06aeefSChristophe Ricard 	bool t2_active;
38ed06aeefSChristophe Ricard 
39ed06aeefSChristophe Ricard 	struct sk_buff_head rcv_q;
40ed06aeefSChristophe Ricard 	struct sk_buff_head send_q;
41ed06aeefSChristophe Ricard 	struct sk_buff_head ack_pending_q;
42ed06aeefSChristophe Ricard 
43ed06aeefSChristophe Ricard 	struct work_struct sm_work;
44ed06aeefSChristophe Ricard 
45ed06aeefSChristophe Ricard 	struct device *dev;
46ed06aeefSChristophe Ricard 
47ed06aeefSChristophe Ricard 	/*
48ed06aeefSChristophe Ricard 	 * < 0 if hardware error occurred
49ed06aeefSChristophe Ricard 	 * and prevents normal operation.
50ed06aeefSChristophe Ricard 	 */
51ed06aeefSChristophe Ricard 	int hard_fault;
52ed06aeefSChristophe Ricard 	int powered;
53ed06aeefSChristophe Ricard };
54ed06aeefSChristophe Ricard 
55ed06aeefSChristophe Ricard int ndlc_open(struct llt_ndlc *ndlc);
56ed06aeefSChristophe Ricard void ndlc_close(struct llt_ndlc *ndlc);
57ed06aeefSChristophe Ricard int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb);
58ed06aeefSChristophe Ricard void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb);
59ed06aeefSChristophe Ricard int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,
60*3648dc6dSChristophe Ricard 	       int phy_headroom, int phy_tailroom, struct llt_ndlc **ndlc_id,
61*3648dc6dSChristophe Ricard 	       struct st_nci_se_status *se_status);
62ed06aeefSChristophe Ricard void ndlc_remove(struct llt_ndlc *ndlc);
63ed06aeefSChristophe Ricard #endif /* __LOCAL_NDLC_H__ */
64