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