Lines Matching refs:bcs

208 static void __fcpci_write_ctrl(struct fritz_bcs *bcs, int which)  in __fcpci_write_ctrl()  argument
210 struct fritz_adapter *adapter = bcs->adapter; in __fcpci_write_ctrl()
211 int idx = bcs->channel ? AVM_IDX_HDLC_2 : AVM_IDX_HDLC_1; in __fcpci_write_ctrl()
214 'A' + bcs->channel, which, bcs->ctrl.ctrl); in __fcpci_write_ctrl()
217 outl(bcs->ctrl.ctrl, adapter->io + AVM_DATA + HDLC_CTRL); in __fcpci_write_ctrl()
220 static void fcpci_write_ctrl(struct fritz_bcs *bcs, int which) in fcpci_write_ctrl() argument
222 struct fritz_adapter *adapter = bcs->adapter; in fcpci_write_ctrl()
226 __fcpci_write_ctrl(bcs, which); in fcpci_write_ctrl()
298 static void fcpci2_write_ctrl(struct fritz_bcs *bcs, int which) in fcpci2_write_ctrl() argument
300 struct fritz_adapter *adapter = bcs->adapter; in fcpci2_write_ctrl()
301 int offset = bcs->channel ? AVM_HDLC_STATUS_2 : AVM_HDLC_STATUS_1; in fcpci2_write_ctrl()
304 'A' + bcs->channel, which, bcs->ctrl.ctrl); in fcpci2_write_ctrl()
306 outl(bcs->ctrl.ctrl, adapter->io + offset); in fcpci2_write_ctrl()
327 static void __fcpnp_write_ctrl(struct fritz_bcs *bcs, int which) in __fcpnp_write_ctrl() argument
329 struct fritz_adapter *adapter = bcs->adapter; in __fcpnp_write_ctrl()
330 unsigned char idx = bcs->channel ? AVM_IDX_HDLC_2 : AVM_IDX_HDLC_1; in __fcpnp_write_ctrl()
333 'A' + bcs->channel, which, bcs->ctrl.ctrl); in __fcpnp_write_ctrl()
337 outb(bcs->ctrl.sr.mode, in __fcpnp_write_ctrl()
340 outb(bcs->ctrl.sr.xml, in __fcpnp_write_ctrl()
343 outb(bcs->ctrl.sr.cmd, in __fcpnp_write_ctrl()
347 static void fcpnp_write_ctrl(struct fritz_bcs *bcs, int which) in fcpnp_write_ctrl() argument
349 struct fritz_adapter *adapter = bcs->adapter; in fcpnp_write_ctrl()
353 __fcpnp_write_ctrl(bcs, which); in fcpnp_write_ctrl()
359 static inline void B_L1L2(struct fritz_bcs *bcs, int pr, void *arg) in B_L1L2() argument
361 struct hisax_if *ifc = (struct hisax_if *) &bcs->b_if; in B_L1L2()
367 static void hdlc_fill_fifo(struct fritz_bcs *bcs) in hdlc_fill_fifo() argument
369 struct fritz_adapter *adapter = bcs->adapter; in hdlc_fill_fifo()
370 struct sk_buff *skb = bcs->tx_skb; in hdlc_fill_fifo()
381 bcs->ctrl.sr.cmd &= ~HDLC_CMD_XME; in hdlc_fill_fifo()
382 if (bcs->tx_skb->len > fifo_size) { in hdlc_fill_fifo()
385 count = bcs->tx_skb->len; in hdlc_fill_fifo()
386 if (bcs->mode != L1_MODE_TRANS) in hdlc_fill_fifo()
387 bcs->ctrl.sr.cmd |= HDLC_CMD_XME; in hdlc_fill_fifo()
389 DBG(0x40, "hdlc_fill_fifo %d/%d", count, bcs->tx_skb->len); in hdlc_fill_fifo()
390 p = bcs->tx_skb->data; in hdlc_fill_fifo()
391 skb_pull(bcs->tx_skb, count); in hdlc_fill_fifo()
392 bcs->tx_cnt += count; in hdlc_fill_fifo()
393 bcs->ctrl.sr.xml = ((count == fifo_size) ? 0 : count); in hdlc_fill_fifo()
399 __fcpci_write_ctrl(bcs, 3); in hdlc_fill_fifo()
405 fcpci2_write_ctrl(bcs, 3); in hdlc_fill_fifo()
407 (bcs->channel ? AVM_HDLC_FIFO_2 : AVM_HDLC_FIFO_1), in hdlc_fill_fifo()
413 __fcpnp_write_ctrl(bcs, 3); in hdlc_fill_fifo()
420 static inline void hdlc_empty_fifo(struct fritz_bcs *bcs, int count) in hdlc_empty_fifo() argument
422 struct fritz_adapter *adapter = bcs->adapter; in hdlc_empty_fifo()
424 unsigned char idx = bcs->channel ? AVM_IDX_HDLC_2 : AVM_IDX_HDLC_1; in hdlc_empty_fifo()
427 if (bcs->rcvidx + count > HSCX_BUFMAX) { in hdlc_empty_fifo()
431 p = bcs->rcvbuf + bcs->rcvidx; in hdlc_empty_fifo()
432 bcs->rcvidx += count; in hdlc_empty_fifo()
443 (bcs->channel ? AVM_HDLC_FIFO_2 : AVM_HDLC_FIFO_1), in hdlc_empty_fifo()
455 static inline void hdlc_rpr_irq(struct fritz_bcs *bcs, u32 stat) in hdlc_rpr_irq() argument
457 struct fritz_adapter *adapter = bcs->adapter; in hdlc_rpr_irq()
463 bcs->ctrl.sr.xml = 0; in hdlc_rpr_irq()
464 bcs->ctrl.sr.cmd |= HDLC_CMD_RRS; in hdlc_rpr_irq()
465 adapter->write_ctrl(bcs, 1); in hdlc_rpr_irq()
466 bcs->ctrl.sr.cmd &= ~HDLC_CMD_RRS; in hdlc_rpr_irq()
467 adapter->write_ctrl(bcs, 1); in hdlc_rpr_irq()
468 bcs->rcvidx = 0; in hdlc_rpr_irq()
476 hdlc_empty_fifo(bcs, len); in hdlc_rpr_irq()
478 if ((stat & HDLC_STAT_RME) || (bcs->mode == L1_MODE_TRANS)) { in hdlc_rpr_irq()
480 (bcs->mode == L1_MODE_TRANS)) { in hdlc_rpr_irq()
481 skb = dev_alloc_skb(bcs->rcvidx); in hdlc_rpr_irq()
485 memcpy(skb_put(skb, bcs->rcvidx), bcs->rcvbuf, in hdlc_rpr_irq()
486 bcs->rcvidx); in hdlc_rpr_irq()
488 B_L1L2(bcs, PH_DATA | INDICATION, skb); in hdlc_rpr_irq()
490 bcs->rcvidx = 0; in hdlc_rpr_irq()
493 bcs->channel, stat); in hdlc_rpr_irq()
494 bcs->rcvidx = 0; in hdlc_rpr_irq()
499 static inline void hdlc_xdu_irq(struct fritz_bcs *bcs) in hdlc_xdu_irq() argument
501 struct fritz_adapter *adapter = bcs->adapter; in hdlc_xdu_irq()
506 bcs->ctrl.sr.xml = 0; in hdlc_xdu_irq()
507 bcs->ctrl.sr.cmd |= HDLC_CMD_XRS; in hdlc_xdu_irq()
508 adapter->write_ctrl(bcs, 1); in hdlc_xdu_irq()
509 bcs->ctrl.sr.cmd &= ~HDLC_CMD_XRS; in hdlc_xdu_irq()
510 adapter->write_ctrl(bcs, 1); in hdlc_xdu_irq()
512 if (!bcs->tx_skb) { in hdlc_xdu_irq()
516 skb_push(bcs->tx_skb, bcs->tx_cnt); in hdlc_xdu_irq()
517 bcs->tx_cnt = 0; in hdlc_xdu_irq()
518 hdlc_fill_fifo(bcs); in hdlc_xdu_irq()
521 static inline void hdlc_xpr_irq(struct fritz_bcs *bcs) in hdlc_xpr_irq() argument
525 skb = bcs->tx_skb; in hdlc_xpr_irq()
530 hdlc_fill_fifo(bcs); in hdlc_xpr_irq()
533 bcs->tx_cnt = 0; in hdlc_xpr_irq()
534 bcs->tx_skb = NULL; in hdlc_xpr_irq()
535 B_L1L2(bcs, PH_DATA | CONFIRM, (void *) skb->truesize); in hdlc_xpr_irq()
539 static void hdlc_irq_one(struct fritz_bcs *bcs, u32 stat) in hdlc_irq_one() argument
541 DBG(0x10, "ch%d stat %#x", bcs->channel, stat); in hdlc_irq_one()
544 hdlc_rpr_irq(bcs, stat); in hdlc_irq_one()
548 hdlc_xdu_irq(bcs); in hdlc_irq_one()
552 hdlc_xpr_irq(bcs); in hdlc_irq_one()
565 hdlc_irq_one(&adapter->bcs[nr], stat); in hdlc_irq()
569 static void modehdlc(struct fritz_bcs *bcs, int mode) in modehdlc() argument
571 struct fritz_adapter *adapter = bcs->adapter; in modehdlc()
574 'A' + bcs->channel, bcs->mode, mode); in modehdlc()
576 if (bcs->mode == mode) in modehdlc()
579 bcs->ctrl.ctrl = 0; in modehdlc()
580 bcs->ctrl.sr.cmd = HDLC_CMD_XRS | HDLC_CMD_RRS; in modehdlc()
583 bcs->ctrl.sr.mode = HDLC_MODE_TRANS; in modehdlc()
584 adapter->write_ctrl(bcs, 5); in modehdlc()
588 bcs->rcvidx = 0; in modehdlc()
589 bcs->tx_cnt = 0; in modehdlc()
590 bcs->tx_skb = NULL; in modehdlc()
592 bcs->ctrl.sr.mode = HDLC_MODE_TRANS; in modehdlc()
594 bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG; in modehdlc()
595 adapter->write_ctrl(bcs, 5); in modehdlc()
596 bcs->ctrl.sr.cmd = HDLC_CMD_XRS; in modehdlc()
597 adapter->write_ctrl(bcs, 1); in modehdlc()
598 bcs->ctrl.sr.cmd = 0; in modehdlc()
601 bcs->mode = mode; in modehdlc()
606 struct fritz_bcs *bcs = ifc->priv; in fritz_b_l2l1() local
614 if (bcs->tx_skb) in fritz_b_l2l1()
617 bcs->tx_skb = skb; in fritz_b_l2l1()
619 hdlc_fill_fifo(bcs); in fritz_b_l2l1()
623 DBG(4,"B%d,PH_ACTIVATE_REQUEST %d", bcs->channel + 1, mode); in fritz_b_l2l1()
624 modehdlc(bcs, mode); in fritz_b_l2l1()
625 B_L1L2(bcs, PH_ACTIVATE | INDICATION, NULL); in fritz_b_l2l1()
628 DBG(4,"B%d,PH_DEACTIVATE_REQUEST", bcs->channel + 1); in fritz_b_l2l1()
629 modehdlc(bcs, L1_MODE_NULL); in fritz_b_l2l1()
630 B_L1L2(bcs, PH_DEACTIVATE | INDICATION, NULL); in fritz_b_l2l1()
796 adapter->bcs[0].mode = -1; in fcpcipnp_setup()
797 adapter->bcs[1].mode = -1; in fcpcipnp_setup()
798 modehdlc(&adapter->bcs[0], L1_MODE_NULL); in fcpcipnp_setup()
799 modehdlc(&adapter->bcs[1], L1_MODE_NULL); in fcpcipnp_setup()
838 adapter->bcs[i].adapter = adapter; in new_adapter()
839 adapter->bcs[i].channel = i; in new_adapter()
840 adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i]; in new_adapter()
841 adapter->bcs[i].b_if.ifc.l2l1 = fritz_b_l2l1; in new_adapter()
847 b_if[i] = &adapter->bcs[i].b_if; in new_adapter()