xref: /openbmc/linux/drivers/nfc/st-nci/ndlc.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
146fe7771SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2ed06aeefSChristophe Ricard /*
3ed06aeefSChristophe Ricard  * NCI based Driver for STMicroelectronics NFC Chip
4ed06aeefSChristophe Ricard  *
5ed06aeefSChristophe Ricard  * Copyright (C) 2014-2015  STMicroelectronics SAS. All rights reserved.
6ed06aeefSChristophe Ricard  */
7ed06aeefSChristophe Ricard 
8ed06aeefSChristophe Ricard #ifndef __LOCAL_NDLC_H_
9ed06aeefSChristophe Ricard #define __LOCAL_NDLC_H_
10ed06aeefSChristophe Ricard 
11ed06aeefSChristophe Ricard #include <linux/skbuff.h>
12ed06aeefSChristophe Ricard #include <net/nfc/nfc.h>
13ed06aeefSChristophe Ricard 
143648dc6dSChristophe Ricard struct st_nci_se_status;
153648dc6dSChristophe Ricard 
16ed06aeefSChristophe Ricard /* Low Level Transport description */
17ed06aeefSChristophe Ricard struct llt_ndlc {
18ed06aeefSChristophe Ricard 	struct nci_dev *ndev;
19*7a5e98daSKrzysztof Kozlowski 	const struct nfc_phy_ops *ops;
20ed06aeefSChristophe Ricard 	void *phy_id;
21ed06aeefSChristophe Ricard 
22ed06aeefSChristophe Ricard 	struct timer_list t1_timer;
23ed06aeefSChristophe Ricard 	bool t1_active;
24ed06aeefSChristophe Ricard 
25ed06aeefSChristophe Ricard 	struct timer_list t2_timer;
26ed06aeefSChristophe Ricard 	bool t2_active;
27ed06aeefSChristophe Ricard 
28ed06aeefSChristophe Ricard 	struct sk_buff_head rcv_q;
29ed06aeefSChristophe Ricard 	struct sk_buff_head send_q;
30ed06aeefSChristophe Ricard 	struct sk_buff_head ack_pending_q;
31ed06aeefSChristophe Ricard 
32ed06aeefSChristophe Ricard 	struct work_struct sm_work;
33ed06aeefSChristophe Ricard 
34ed06aeefSChristophe Ricard 	struct device *dev;
35ed06aeefSChristophe Ricard 
36ed06aeefSChristophe Ricard 	/*
37ed06aeefSChristophe Ricard 	 * < 0 if hardware error occurred
38ed06aeefSChristophe Ricard 	 * and prevents normal operation.
39ed06aeefSChristophe Ricard 	 */
40ed06aeefSChristophe Ricard 	int hard_fault;
41ed06aeefSChristophe Ricard 	int powered;
42ed06aeefSChristophe Ricard };
43ed06aeefSChristophe Ricard 
44ed06aeefSChristophe Ricard int ndlc_open(struct llt_ndlc *ndlc);
45ed06aeefSChristophe Ricard void ndlc_close(struct llt_ndlc *ndlc);
46ed06aeefSChristophe Ricard int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb);
47ed06aeefSChristophe Ricard void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb);
48*7a5e98daSKrzysztof Kozlowski int ndlc_probe(void *phy_id, const struct nfc_phy_ops *phy_ops,
49*7a5e98daSKrzysztof Kozlowski 	       struct device *dev, int phy_headroom, int phy_tailroom,
50*7a5e98daSKrzysztof Kozlowski 	       struct llt_ndlc **ndlc_id, struct st_nci_se_status *se_status);
51ed06aeefSChristophe Ricard void ndlc_remove(struct llt_ndlc *ndlc);
52ed06aeefSChristophe Ricard #endif /* __LOCAL_NDLC_H__ */
53