Searched refs:ndlc (Results 1 - 9 of 9) sorted by relevance

/linux-4.4.14/drivers/nfc/st-nci/
H A Dndlc.c23 #include "ndlc.h"
54 print_hex_dump(KERN_DEBUG, "ndlc: ", DUMP_PREFIX_OFFSET, \
58 int ndlc_open(struct llt_ndlc *ndlc) ndlc_open() argument
61 ndlc->ops->enable(ndlc->phy_id); ndlc_open()
62 ndlc->powered = 1; ndlc_open()
67 void ndlc_close(struct llt_ndlc *ndlc) ndlc_close() argument
75 ndlc->ops->enable(ndlc->phy_id); ndlc_close()
77 nci_prop_cmd(ndlc->ndev, ST_NCI_CORE_PROP, ndlc_close()
80 ndlc->powered = 0; ndlc_close()
81 ndlc->ops->disable(ndlc->phy_id); ndlc_close()
85 int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb) ndlc_send() argument
87 /* add ndlc header */ ndlc_send()
92 skb_queue_tail(&ndlc->send_q, skb); ndlc_send()
94 schedule_work(&ndlc->sm_work); ndlc_send()
100 static void llt_ndlc_send_queue(struct llt_ndlc *ndlc) llt_ndlc_send_queue() argument
106 if (ndlc->send_q.qlen) llt_ndlc_send_queue()
108 ndlc->send_q.qlen, ndlc->ack_pending_q.qlen); llt_ndlc_send_queue()
110 while (ndlc->send_q.qlen) { llt_ndlc_send_queue()
111 skb = skb_dequeue(&ndlc->send_q); llt_ndlc_send_queue()
112 NDLC_DUMP_SKB("ndlc frame written", skb); llt_ndlc_send_queue()
113 r = ndlc->ops->write(ndlc->phy_id, skb); llt_ndlc_send_queue()
115 ndlc->hard_fault = r; llt_ndlc_send_queue()
121 skb_queue_tail(&ndlc->ack_pending_q, skb); llt_ndlc_send_queue()
123 /* start timer t1 for ndlc aknowledge */ llt_ndlc_send_queue()
124 ndlc->t1_active = true; llt_ndlc_send_queue()
125 mod_timer(&ndlc->t1_timer, time_sent + llt_ndlc_send_queue()
128 ndlc->t2_active = true; llt_ndlc_send_queue()
129 mod_timer(&ndlc->t2_timer, time_sent + llt_ndlc_send_queue()
134 static void llt_ndlc_requeue_data_pending(struct llt_ndlc *ndlc) llt_ndlc_requeue_data_pending() argument
139 while ((skb = skb_dequeue_tail(&ndlc->ack_pending_q))) { llt_ndlc_requeue_data_pending()
155 skb_queue_head(&ndlc->send_q, skb); llt_ndlc_requeue_data_pending()
159 static void llt_ndlc_rcv_queue(struct llt_ndlc *ndlc) llt_ndlc_rcv_queue() argument
165 if (ndlc->rcv_q.qlen) llt_ndlc_rcv_queue()
166 pr_debug("rcvQlen=%d\n", ndlc->rcv_q.qlen); llt_ndlc_rcv_queue()
168 while ((skb = skb_dequeue(&ndlc->rcv_q)) != NULL) { llt_ndlc_rcv_queue()
174 skb = skb_dequeue(&ndlc->ack_pending_q); llt_ndlc_rcv_queue()
176 del_timer_sync(&ndlc->t1_timer); llt_ndlc_rcv_queue()
177 del_timer_sync(&ndlc->t2_timer); llt_ndlc_rcv_queue()
178 ndlc->t2_active = false; llt_ndlc_rcv_queue()
179 ndlc->t1_active = false; llt_ndlc_rcv_queue()
182 llt_ndlc_requeue_data_pending(ndlc); llt_ndlc_rcv_queue()
183 llt_ndlc_send_queue(ndlc); llt_ndlc_rcv_queue()
184 /* start timer t1 for ndlc aknowledge */ llt_ndlc_rcv_queue()
186 ndlc->t1_active = true; llt_ndlc_rcv_queue()
187 mod_timer(&ndlc->t1_timer, time_sent + llt_ndlc_rcv_queue()
192 ndlc->t1_active = true; llt_ndlc_rcv_queue()
193 mod_timer(&ndlc->t1_timer, time_sent + llt_ndlc_rcv_queue()
201 nci_recv_frame(ndlc->ndev, skb); llt_ndlc_rcv_queue()
210 struct llt_ndlc *ndlc = container_of(work, struct llt_ndlc, sm_work); llt_ndlc_sm_work() local
212 llt_ndlc_send_queue(ndlc); llt_ndlc_sm_work()
213 llt_ndlc_rcv_queue(ndlc); llt_ndlc_sm_work()
215 if (ndlc->t1_active && timer_pending(&ndlc->t1_timer) == 0) { llt_ndlc_sm_work()
218 ndlc->t1_active = false; llt_ndlc_sm_work()
220 llt_ndlc_requeue_data_pending(ndlc); llt_ndlc_sm_work()
221 llt_ndlc_send_queue(ndlc); llt_ndlc_sm_work()
224 if (ndlc->t2_active && timer_pending(&ndlc->t2_timer) == 0) { llt_ndlc_sm_work()
226 ndlc->t2_active = false; llt_ndlc_sm_work()
227 ndlc->t1_active = false; llt_ndlc_sm_work()
228 del_timer_sync(&ndlc->t1_timer); llt_ndlc_sm_work()
229 del_timer_sync(&ndlc->t2_timer); llt_ndlc_sm_work()
230 ndlc_close(ndlc); llt_ndlc_sm_work()
231 ndlc->hard_fault = -EREMOTEIO; llt_ndlc_sm_work()
235 void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb) ndlc_recv() argument
239 ndlc->hard_fault = -EREMOTEIO; ndlc_recv()
240 ndlc_close(ndlc); ndlc_recv()
243 skb_queue_tail(&ndlc->rcv_q, skb); ndlc_recv()
246 schedule_work(&ndlc->sm_work); ndlc_recv()
252 struct llt_ndlc *ndlc = (struct llt_ndlc *)data; ndlc_t1_timeout() local
256 schedule_work(&ndlc->sm_work); ndlc_t1_timeout()
261 struct llt_ndlc *ndlc = (struct llt_ndlc *)data; ndlc_t2_timeout() local
265 schedule_work(&ndlc->sm_work); ndlc_t2_timeout()
272 struct llt_ndlc *ndlc; ndlc_probe() local
274 ndlc = devm_kzalloc(dev, sizeof(struct llt_ndlc), GFP_KERNEL); ndlc_probe()
275 if (!ndlc) ndlc_probe()
278 ndlc->ops = phy_ops; ndlc_probe()
279 ndlc->phy_id = phy_id; ndlc_probe()
280 ndlc->dev = dev; ndlc_probe()
281 ndlc->powered = 0; ndlc_probe()
283 *ndlc_id = ndlc; ndlc_probe()
286 init_timer(&ndlc->t1_timer); ndlc_probe()
287 ndlc->t1_timer.data = (unsigned long)ndlc; ndlc_probe()
288 ndlc->t1_timer.function = ndlc_t1_timeout; ndlc_probe()
290 init_timer(&ndlc->t2_timer); ndlc_probe()
291 ndlc->t2_timer.data = (unsigned long)ndlc; ndlc_probe()
292 ndlc->t2_timer.function = ndlc_t2_timeout; ndlc_probe()
294 skb_queue_head_init(&ndlc->rcv_q); ndlc_probe()
295 skb_queue_head_init(&ndlc->send_q); ndlc_probe()
296 skb_queue_head_init(&ndlc->ack_pending_q); ndlc_probe()
298 INIT_WORK(&ndlc->sm_work, llt_ndlc_sm_work); ndlc_probe()
300 return st_nci_probe(ndlc, phy_headroom, phy_tailroom, se_status); ndlc_probe()
304 void ndlc_remove(struct llt_ndlc *ndlc) ndlc_remove() argument
306 st_nci_remove(ndlc->ndev); ndlc_remove()
309 del_timer_sync(&ndlc->t1_timer); ndlc_remove()
310 del_timer_sync(&ndlc->t2_timer); ndlc_remove()
311 ndlc->t2_active = false; ndlc_remove()
312 ndlc->t1_active = false; ndlc_remove()
314 skb_queue_purge(&ndlc->rcv_q); ndlc_remove()
315 skb_queue_purge(&ndlc->send_q); ndlc_remove()
H A Dcore.c51 r = ndlc_open(info->ndlc); st_nci_open()
65 ndlc_close(info->ndlc); st_nci_close()
81 return ndlc_send(info->ndlc, skb); st_nci_send()
125 int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, st_nci_probe() argument
132 info = devm_kzalloc(ndlc->dev, st_nci_probe()
145 ndlc->ndev = nci_allocate_device(&st_nci_ops, protocols, st_nci_probe()
147 if (!ndlc->ndev) { st_nci_probe()
151 info->ndlc = ndlc; st_nci_probe()
153 nci_set_drvdata(ndlc->ndev, info); st_nci_probe()
155 r = st_nci_vendor_cmds_init(ndlc->ndev); st_nci_probe()
161 r = nci_register_device(ndlc->ndev); st_nci_probe()
167 return st_nci_se_init(ndlc->ndev, se_status); st_nci_probe()
170 nci_free_device(ndlc->ndev); st_nci_probe()
179 ndlc_close(info->ndlc); st_nci_remove()
H A DMakefile5 st-nci-objs = ndlc.o core.o se.o vendor_cmds.o
H A Dndlc.h55 int ndlc_open(struct llt_ndlc *ndlc);
56 void ndlc_close(struct llt_ndlc *ndlc);
57 int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb);
58 void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb);
62 void ndlc_remove(struct llt_ndlc *ndlc);
H A Dspi.c35 /* ndlc header */
52 struct llt_ndlc *ndlc; member in struct:st_nci_spi_phy
71 if (phy->ndlc->powered == 0 && phy->irq_active == 0) { st_nci_spi_enable()
106 if (phy->ndlc->hard_fault != 0) st_nci_spi_write()
107 return phy->ndlc->hard_fault; st_nci_spi_write()
112 * Send them back in the ndlc state machine. st_nci_spi_write()
123 ndlc_recv(phy->ndlc, skb_rx); st_nci_spi_write()
131 * Reads an ndlc frame and returns it in a newly allocated sk_buff.
157 phy->ndlc->hard_fault = 1; st_nci_spi_read()
186 * Reads an ndlc frame from the chip.
197 if (!phy || !phy->ndlc || irq != phy->spi_dev->irq) { st_nci_irq_thread_fn()
205 if (phy->ndlc->hard_fault) st_nci_irq_thread_fn()
208 if (!phy->ndlc->powered) { st_nci_irq_thread_fn()
217 ndlc_recv(phy->ndlc, skb); st_nci_irq_thread_fn()
349 &phy->ndlc, &phy->se_status); st_nci_spi_probe()
351 nfc_err(&dev->dev, "Unable to register ndlc layer\n"); st_nci_spi_probe()
372 ndlc_remove(phy->ndlc); st_nci_spi_remove()
H A Di2c.c34 /* ndlc header */
51 struct llt_ndlc *ndlc; member in struct:st_nci_i2c_phy
70 if (phy->ndlc->powered == 0 && phy->irq_active == 0) { st_nci_i2c_enable()
97 if (phy->ndlc->hard_fault != 0) st_nci_i2c_write()
98 return phy->ndlc->hard_fault; st_nci_i2c_write()
117 * Reads an ndlc frame and returns it in a newly allocated sk_buff.
171 * Reads an ndlc frame from the chip.
182 if (!phy || !phy->ndlc || irq != phy->i2c_dev->irq) { st_nci_irq_thread_fn()
190 if (phy->ndlc->hard_fault) st_nci_irq_thread_fn()
193 if (!phy->ndlc->powered) { st_nci_irq_thread_fn()
202 ndlc_recv(phy->ndlc, skb); st_nci_irq_thread_fn()
333 &phy->ndlc, &phy->se_status); st_nci_i2c_probe()
335 nfc_err(&client->dev, "Unable to register ndlc layer\n"); st_nci_i2c_probe()
356 ndlc_remove(phy->ndlc); st_nci_i2c_remove()
H A Dst-nci.h22 #include "ndlc.h"
133 struct llt_ndlc *ndlc; member in struct:st_nci_info
141 int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
H A Dse.c712 nci_hci_send_event(info->ndlc->ndev, ST_NCI_APDU_READER_GATE, st_nci_se_wt_timeout()
716 nci_hci_send_event(info->ndlc->ndev, ST_NCI_DEVICE_MGNT_GATE, st_nci_se_wt_timeout()
/linux-4.4.14/arch/mips/pci/
H A Dfixup-malta.c147 u8 odlc, ndlc; quirk_dlcsetup() local
151 ndlc = odlc | PIIX4_FUNC0_DLC_USBPR_EN | quirk_dlcsetup()
154 (void) pci_write_config_byte(dev, PIIX4_FUNC0_DLC, ndlc); quirk_dlcsetup()

Completed in 75 milliseconds