Lines Matching refs:ch
68 if (isar->ch[0].bch.debug & DEBUG_HW_BFIFO) { in send_mbox()
97 if (isar->ch[0].bch.debug & DEBUG_HW_BFIFO) { in rcv_mbox()
174 u32 saved_debug = isar->ch[0].bch.debug; in load_firmware()
193 isar->ch[0].bch.debug &= ~DEBUG_HW_BFIFO; in load_firmware()
280 isar->ch[0].bch.debug = saved_debug; in load_firmware()
392 isar->ch[0].bch.debug = saved_debug; in load_firmware()
401 deliver_status(struct isar_ch *ch, int status) in deliver_status() argument
403 pr_debug("%s: HL->LL FAXIND %x\n", ch->is->name, status); in deliver_status()
404 _queue_data(&ch->bch.ch, PH_CONTROL_IND, status, 0, NULL, GFP_ATOMIC); in deliver_status()
408 isar_rcv_frame(struct isar_ch *ch) in isar_rcv_frame() argument
413 if (!ch->is->clsb) { in isar_rcv_frame()
414 pr_debug("%s; ISAR zero len frame\n", ch->is->name); in isar_rcv_frame()
415 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
418 if (test_bit(FLG_RX_OFF, &ch->bch.Flags)) { in isar_rcv_frame()
419 ch->bch.dropcnt += ch->is->clsb; in isar_rcv_frame()
420 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
423 switch (ch->bch.state) { in isar_rcv_frame()
426 ch->is->name, ch->is->iis, ch->is->cmsb, ch->is->clsb); in isar_rcv_frame()
427 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
432 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb); in isar_rcv_frame()
435 ch->is->name, ch->bch.nr, ch->is->clsb); in isar_rcv_frame()
436 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
439 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb)); in isar_rcv_frame()
440 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
443 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb); in isar_rcv_frame()
446 ch->is->name, ch->bch.nr, ch->is->clsb); in isar_rcv_frame()
447 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
450 if (ch->is->cmsb & HDLC_ERROR) { in isar_rcv_frame()
452 ch->is->name, ch->is->cmsb, ch->is->clsb); in isar_rcv_frame()
454 if (ch->is->cmsb & HDLC_ERR_RER) in isar_rcv_frame()
455 ch->bch.err_inv++; in isar_rcv_frame()
456 if (ch->is->cmsb & HDLC_ERR_CER) in isar_rcv_frame()
457 ch->bch.err_crc++; in isar_rcv_frame()
459 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
460 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
463 if (ch->is->cmsb & HDLC_FSD) in isar_rcv_frame()
464 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
465 ptr = skb_put(ch->bch.rx_skb, ch->is->clsb); in isar_rcv_frame()
466 rcv_mbox(ch->is, ptr); in isar_rcv_frame()
467 if (ch->is->cmsb & HDLC_FED) { in isar_rcv_frame()
468 if (ch->bch.rx_skb->len < 3) { /* last 2 are the FCS */ in isar_rcv_frame()
470 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
471 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
474 skb_trim(ch->bch.rx_skb, ch->bch.rx_skb->len - 2); in isar_rcv_frame()
475 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
479 if (ch->state != STFAX_ACTIV) { in isar_rcv_frame()
481 ch->is->name); in isar_rcv_frame()
482 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
483 if (ch->bch.rx_skb) in isar_rcv_frame()
484 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
487 if (!ch->bch.rx_skb) { in isar_rcv_frame()
488 ch->bch.rx_skb = mI_alloc_skb(ch->bch.maxlen, in isar_rcv_frame()
490 if (unlikely(!ch->bch.rx_skb)) { in isar_rcv_frame()
493 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
497 if (ch->cmd == PCTRL_CMD_FRM) { in isar_rcv_frame()
498 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb)); in isar_rcv_frame()
500 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
501 if (ch->is->cmsb & SART_NMD) { /* ABORT */ in isar_rcv_frame()
503 ch->is->name); in isar_rcv_frame()
504 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
505 send_mbox(ch->is, SET_DPS(ch->dpath) | in isar_rcv_frame()
508 ch->state = STFAX_ESCAPE; in isar_rcv_frame()
511 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
512 if (ch->is->cmsb & SART_NMD) in isar_rcv_frame()
513 deliver_status(ch, HW_MOD_NOCARR); in isar_rcv_frame()
516 if (ch->cmd != PCTRL_CMD_FRH) { in isar_rcv_frame()
518 ch->is->name, ch->cmd); in isar_rcv_frame()
519 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
520 if (ch->bch.rx_skb) in isar_rcv_frame()
521 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
525 if ((ch->bch.rx_skb->len + ch->is->clsb) > in isar_rcv_frame()
526 (ch->bch.maxlen + 2)) { in isar_rcv_frame()
528 ch->is->name, __func__); in isar_rcv_frame()
529 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
530 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
532 } else if (ch->is->cmsb & HDLC_ERROR) { in isar_rcv_frame()
534 ch->is->name, ch->is->cmsb, ch->is->clsb); in isar_rcv_frame()
535 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
536 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
539 if (ch->is->cmsb & HDLC_FSD) in isar_rcv_frame()
540 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
541 ptr = skb_put(ch->bch.rx_skb, ch->is->clsb); in isar_rcv_frame()
542 rcv_mbox(ch->is, ptr); in isar_rcv_frame()
543 if (ch->is->cmsb & HDLC_FED) { in isar_rcv_frame()
544 if (ch->bch.rx_skb->len < 3) { /* last 2 are the FCS */ in isar_rcv_frame()
546 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
547 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
550 skb_trim(ch->bch.rx_skb, ch->bch.rx_skb->len - 2); in isar_rcv_frame()
551 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
553 if (ch->is->cmsb & SART_NMD) { /* ABORT */ in isar_rcv_frame()
555 ch->is->name); in isar_rcv_frame()
556 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
557 if (ch->bch.rx_skb) in isar_rcv_frame()
558 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
559 send_mbox(ch->is, SET_DPS(ch->dpath) | in isar_rcv_frame()
561 ch->state = STFAX_ESCAPE; in isar_rcv_frame()
562 deliver_status(ch, HW_MOD_NOCARR); in isar_rcv_frame()
566 pr_info("isar_rcv_frame protocol (%x)error\n", ch->bch.state); in isar_rcv_frame()
567 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
573 isar_fill_fifo(struct isar_ch *ch) in isar_fill_fifo() argument
579 pr_debug("%s: ch%d tx_skb %d tx_idx %d\n", ch->is->name, ch->bch.nr, in isar_fill_fifo()
580 ch->bch.tx_skb ? ch->bch.tx_skb->len : -1, ch->bch.tx_idx); in isar_fill_fifo()
581 if (!(ch->is->bstat & in isar_fill_fifo()
582 (ch->dpath == 1 ? BSTAT_RDM1 : BSTAT_RDM2))) in isar_fill_fifo()
584 if (!ch->bch.tx_skb) { in isar_fill_fifo()
585 if (!test_bit(FLG_TX_EMPTY, &ch->bch.Flags) || in isar_fill_fifo()
586 (ch->bch.state != ISDN_P_B_RAW)) in isar_fill_fifo()
588 count = ch->mml; in isar_fill_fifo()
590 memset(ch->is->buf, ch->bch.fill[0], count); in isar_fill_fifo()
591 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
592 0, count, ch->is->buf); in isar_fill_fifo()
595 count = ch->bch.tx_skb->len - ch->bch.tx_idx; in isar_fill_fifo()
598 if (count > ch->mml) { in isar_fill_fifo()
600 count = ch->mml; in isar_fill_fifo()
604 ptr = ch->bch.tx_skb->data + ch->bch.tx_idx; in isar_fill_fifo()
605 if (!ch->bch.tx_idx) { in isar_fill_fifo()
606 pr_debug("%s: frame start\n", ch->is->name); in isar_fill_fifo()
607 if ((ch->bch.state == ISDN_P_B_T30_FAX) && in isar_fill_fifo()
608 (ch->cmd == PCTRL_CMD_FTH)) { in isar_fill_fifo()
613 &ch->bch.Flags); in isar_fill_fifo()
615 ch->is->name); in isar_fill_fifo()
618 &ch->bch.Flags); in isar_fill_fifo()
624 ch->bch.tx_idx += count; in isar_fill_fifo()
625 switch (ch->bch.state) { in isar_fill_fifo()
632 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
636 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
640 if (ch->state != STFAX_ACTIV) in isar_fill_fifo()
641 pr_debug("%s: not ACTIV\n", ch->is->name); in isar_fill_fifo()
642 else if (ch->cmd == PCTRL_CMD_FTH) in isar_fill_fifo()
643 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
645 else if (ch->cmd == PCTRL_CMD_FTM) in isar_fill_fifo()
646 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
649 pr_debug("%s: not FTH/FTM\n", ch->is->name); in isar_fill_fifo()
653 __func__, ch->bch.state); in isar_fill_fifo()
661 struct isar_ch *base = &isar->ch[0]; in sel_bch_isar()
674 send_next(struct isar_ch *ch) in send_next() argument
676 pr_debug("%s: %s ch%d tx_skb %d tx_idx %d\n", ch->is->name, __func__, in send_next()
677 ch->bch.nr, ch->bch.tx_skb ? ch->bch.tx_skb->len : -1, in send_next()
678 ch->bch.tx_idx); in send_next()
679 if (ch->bch.state == ISDN_P_B_T30_FAX) { in send_next()
680 if (ch->cmd == PCTRL_CMD_FTH) { in send_next()
681 if (test_bit(FLG_LASTDATA, &ch->bch.Flags)) { in send_next()
683 test_and_set_bit(FLG_NMD_DATA, &ch->bch.Flags); in send_next()
685 } else if (ch->cmd == PCTRL_CMD_FTM) { in send_next()
686 if (test_bit(FLG_DLEETX, &ch->bch.Flags)) { in send_next()
687 test_and_set_bit(FLG_LASTDATA, &ch->bch.Flags); in send_next()
688 test_and_set_bit(FLG_NMD_DATA, &ch->bch.Flags); in send_next()
692 dev_kfree_skb(ch->bch.tx_skb); in send_next()
693 if (get_next_bframe(&ch->bch)) { in send_next()
694 isar_fill_fifo(ch); in send_next()
695 test_and_clear_bit(FLG_TX_EMPTY, &ch->bch.Flags); in send_next()
696 } else if (test_bit(FLG_TX_EMPTY, &ch->bch.Flags)) { in send_next()
697 isar_fill_fifo(ch); in send_next()
699 if (test_and_clear_bit(FLG_DLEETX, &ch->bch.Flags)) { in send_next()
701 &ch->bch.Flags)) { in send_next()
703 &ch->bch.Flags)) { in send_next()
705 send_mbox(ch->is, SET_DPS(ch->dpath) | in send_next()
708 test_and_set_bit(FLG_LL_OK, &ch->bch.Flags); in send_next()
710 deliver_status(ch, HW_MOD_CONNECT); in send_next()
712 } else if (test_bit(FLG_FILLEMPTY, &ch->bch.Flags)) { in send_next()
713 test_and_set_bit(FLG_TX_EMPTY, &ch->bch.Flags); in send_next()
721 struct isar_ch *ch; in check_send() local
725 ch = sel_bch_isar(isar, 1); in check_send()
726 if (ch && test_bit(FLG_ACTIVE, &ch->bch.Flags)) { in check_send()
727 if (ch->bch.tx_skb && (ch->bch.tx_skb->len > in check_send()
728 ch->bch.tx_idx)) in check_send()
729 isar_fill_fifo(ch); in check_send()
731 send_next(ch); in check_send()
735 ch = sel_bch_isar(isar, 2); in check_send()
736 if (ch && test_bit(FLG_ACTIVE, &ch->bch.Flags)) { in check_send()
737 if (ch->bch.tx_skb && (ch->bch.tx_skb->len > in check_send()
738 ch->bch.tx_idx)) in check_send()
739 isar_fill_fifo(ch); in check_send()
741 send_next(ch); in check_send()
753 isar_pump_status_rsp(struct isar_ch *ch) { in isar_pump_status_rsp() argument
754 u8 ril = ch->is->buf[0]; in isar_pump_status_rsp()
757 if (!test_and_clear_bit(ISAR_RATE_REQ, &ch->is->Flags)) in isar_pump_status_rsp()
760 pr_info("%s: wrong pstrsp ril=%d\n", ch->is->name, ril); in isar_pump_status_rsp()
763 switch (ch->is->buf[1]) { in isar_pump_status_rsp()
798 sprintf(ch->conmsg, "%s %s", dmril[ril], dmrim[rim]); in isar_pump_status_rsp()
799 pr_debug("%s: pump strsp %s\n", ch->is->name, ch->conmsg); in isar_pump_status_rsp()
803 isar_pump_statev_modem(struct isar_ch *ch, u8 devt) { in isar_pump_statev_modem() argument
804 u8 dps = SET_DPS(ch->dpath); in isar_pump_statev_modem()
808 pr_debug("%s: pump stev TIMER\n", ch->is->name); in isar_pump_statev_modem()
811 pr_debug("%s: pump stev CONNECT\n", ch->is->name); in isar_pump_statev_modem()
812 deliver_status(ch, HW_MOD_CONNECT); in isar_pump_statev_modem()
815 pr_debug("%s: pump stev NO CONNECT\n", ch->is->name); in isar_pump_statev_modem()
816 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in isar_pump_statev_modem()
817 deliver_status(ch, HW_MOD_NOCARR); in isar_pump_statev_modem()
820 pr_debug("%s: pump stev V24 OFF\n", ch->is->name); in isar_pump_statev_modem()
823 pr_debug("%s: pump stev CTS ON\n", ch->is->name); in isar_pump_statev_modem()
826 pr_debug("%s pump stev CTS OFF\n", ch->is->name); in isar_pump_statev_modem()
829 pr_debug("%s: pump stev CARRIER ON\n", ch->is->name); in isar_pump_statev_modem()
830 test_and_set_bit(ISAR_RATE_REQ, &ch->is->Flags); in isar_pump_statev_modem()
831 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in isar_pump_statev_modem()
834 pr_debug("%s: pump stev CARRIER OFF\n", ch->is->name); in isar_pump_statev_modem()
837 pr_debug("%s: pump stev DSR ON\n", ch->is->name); in isar_pump_statev_modem()
840 pr_debug("%s: pump stev DSR_OFF\n", ch->is->name); in isar_pump_statev_modem()
843 pr_debug("%s: pump stev REMOTE RETRAIN\n", ch->is->name); in isar_pump_statev_modem()
846 pr_debug("%s: pump stev REMOTE RENEGOTIATE\n", ch->is->name); in isar_pump_statev_modem()
849 pr_debug("%s: pump stev GSTN CLEAR\n", ch->is->name); in isar_pump_statev_modem()
852 pr_info("u%s: unknown pump stev %x\n", ch->is->name, devt); in isar_pump_statev_modem()
858 isar_pump_statev_fax(struct isar_ch *ch, u8 devt) { in isar_pump_statev_fax() argument
859 u8 dps = SET_DPS(ch->dpath); in isar_pump_statev_fax()
864 pr_debug("%s: pump stev TIMER\n", ch->is->name); in isar_pump_statev_fax()
867 pr_debug("%s: pump stev RSP_READY\n", ch->is->name); in isar_pump_statev_fax()
868 ch->state = STFAX_READY; in isar_pump_statev_fax()
869 deliver_status(ch, HW_MOD_READY); in isar_pump_statev_fax()
871 if (test_bit(BC_FLG_ORIG, &ch->bch.Flags)) in isar_pump_statev_fax()
878 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
879 pr_debug("%s: pump stev LINE_TX_H\n", ch->is->name); in isar_pump_statev_fax()
880 ch->state = STFAX_CONT; in isar_pump_statev_fax()
881 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
885 ch->is->name, ch->state); in isar_pump_statev_fax()
889 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
890 pr_debug("%s: pump stev LINE_RX_H\n", ch->is->name); in isar_pump_statev_fax()
891 ch->state = STFAX_CONT; in isar_pump_statev_fax()
892 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
896 ch->is->name, ch->state); in isar_pump_statev_fax()
900 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
901 pr_debug("%s: pump stev LINE_TX_B\n", ch->is->name); in isar_pump_statev_fax()
902 ch->state = STFAX_CONT; in isar_pump_statev_fax()
903 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
907 ch->is->name, ch->state); in isar_pump_statev_fax()
911 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
912 pr_debug("%s: pump stev LINE_RX_B\n", ch->is->name); in isar_pump_statev_fax()
913 ch->state = STFAX_CONT; in isar_pump_statev_fax()
914 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
918 ch->is->name, ch->state); in isar_pump_statev_fax()
922 if (ch->state == STFAX_CONT) { in isar_pump_statev_fax()
923 pr_debug("%s: pump stev RSP_CONN\n", ch->is->name); in isar_pump_statev_fax()
924 ch->state = STFAX_ACTIV; in isar_pump_statev_fax()
925 test_and_set_bit(ISAR_RATE_REQ, &ch->is->Flags); in isar_pump_statev_fax()
926 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in isar_pump_statev_fax()
927 if (ch->cmd == PCTRL_CMD_FTH) { in isar_pump_statev_fax()
928 int delay = (ch->mod == 3) ? 1000 : 200; in isar_pump_statev_fax()
931 &ch->bch.Flags)) in isar_pump_statev_fax()
932 del_timer(&ch->ftimer); in isar_pump_statev_fax()
933 ch->ftimer.expires = in isar_pump_statev_fax()
936 &ch->bch.Flags); in isar_pump_statev_fax()
937 add_timer(&ch->ftimer); in isar_pump_statev_fax()
939 deliver_status(ch, HW_MOD_CONNECT); in isar_pump_statev_fax()
943 ch->is->name, ch->state); in isar_pump_statev_fax()
947 pr_debug("%s: pump stev FLAGS_DET\n", ch->is->name); in isar_pump_statev_fax()
951 ch->is->name, ch->state); in isar_pump_statev_fax()
952 if (ch->state == STFAX_ESCAPE) { in isar_pump_statev_fax()
954 switch (ch->newcmd) { in isar_pump_statev_fax()
956 ch->state = STFAX_READY; in isar_pump_statev_fax()
962 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
964 ch->state = STFAX_SILDET; in isar_pump_statev_fax()
968 ch->mod = ch->newmod; in isar_pump_statev_fax()
969 p1 = ch->newmod; in isar_pump_statev_fax()
970 ch->newmod = 0; in isar_pump_statev_fax()
971 ch->cmd = ch->newcmd; in isar_pump_statev_fax()
972 ch->newcmd = 0; in isar_pump_statev_fax()
973 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
974 ch->cmd, 1, &p1); in isar_pump_statev_fax()
975 ch->state = STFAX_LINE; in isar_pump_statev_fax()
976 ch->try_mod = 3; in isar_pump_statev_fax()
980 ch->is->name, ch->newcmd); in isar_pump_statev_fax()
983 } else if (ch->state == STFAX_ACTIV) { in isar_pump_statev_fax()
984 if (test_and_clear_bit(FLG_LL_OK, &ch->bch.Flags)) in isar_pump_statev_fax()
985 deliver_status(ch, HW_MOD_OK); in isar_pump_statev_fax()
986 else if (ch->cmd == PCTRL_CMD_FRM) in isar_pump_statev_fax()
987 deliver_status(ch, HW_MOD_NOCARR); in isar_pump_statev_fax()
989 deliver_status(ch, HW_MOD_FCERROR); in isar_pump_statev_fax()
990 ch->state = STFAX_READY; in isar_pump_statev_fax()
991 } else if (ch->state != STFAX_SILDET) { in isar_pump_statev_fax()
993 ch->state = STFAX_READY; in isar_pump_statev_fax()
994 deliver_status(ch, HW_MOD_FCERROR); in isar_pump_statev_fax()
998 pr_debug("%s: pump stev RSP_SILDET\n", ch->is->name); in isar_pump_statev_fax()
999 if (ch->state == STFAX_SILDET) { in isar_pump_statev_fax()
1000 ch->mod = ch->newmod; in isar_pump_statev_fax()
1001 p1 = ch->newmod; in isar_pump_statev_fax()
1002 ch->newmod = 0; in isar_pump_statev_fax()
1003 ch->cmd = ch->newcmd; in isar_pump_statev_fax()
1004 ch->newcmd = 0; in isar_pump_statev_fax()
1005 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
1006 ch->cmd, 1, &p1); in isar_pump_statev_fax()
1007 ch->state = STFAX_LINE; in isar_pump_statev_fax()
1008 ch->try_mod = 3; in isar_pump_statev_fax()
1012 pr_debug("%s: pump stev RSP_SILOFF\n", ch->is->name); in isar_pump_statev_fax()
1015 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
1017 ch->is->name, ch->try_mod); in isar_pump_statev_fax()
1018 if (ch->try_mod--) { in isar_pump_statev_fax()
1019 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
1020 ch->cmd, 1, &ch->mod); in isar_pump_statev_fax()
1024 pr_debug("%s: pump stev RSP_FCERR\n", ch->is->name); in isar_pump_statev_fax()
1025 ch->state = STFAX_ESCAPE; in isar_pump_statev_fax()
1026 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, PCTRL_CMD_ESC, in isar_pump_statev_fax()
1028 deliver_status(ch, HW_MOD_FCERROR); in isar_pump_statev_fax()
1038 struct isar_ch *ch; in mISDNisar_irq() local
1043 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1044 if (ch) in mISDNisar_irq()
1045 isar_rcv_frame(ch); in mISDNisar_irq()
1060 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1061 if (ch) { in mISDNisar_irq()
1063 ch->bch.err_tx++; in mISDNisar_irq()
1065 ch->bch.err_rdo++; in mISDNisar_irq()
1073 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1074 if (ch) { in mISDNisar_irq()
1076 if (ch->bch.state == ISDN_P_B_MODEM_ASYNC) in mISDNisar_irq()
1077 isar_pump_statev_modem(ch, isar->cmsb); in mISDNisar_irq()
1078 else if (ch->bch.state == ISDN_P_B_T30_FAX) in mISDNisar_irq()
1079 isar_pump_statev_fax(ch, isar->cmsb); in mISDNisar_irq()
1080 else if (ch->bch.state == ISDN_P_B_RAW) { in mISDNisar_irq()
1090 _queue_data(&ch->bch.ch, PH_CONTROL_IND, in mISDNisar_irq()
1095 isar->name, ch->bch.state, in mISDNisar_irq()
1105 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1106 if (ch) { in mISDNisar_irq()
1108 isar_pump_status_rsp(ch); in mISDNisar_irq()
1137 struct isar_ch *ch = from_timer(ch, t, ftimer); in ftimer_handler() local
1139 pr_debug("%s: ftimer flags %lx\n", ch->is->name, ch->bch.Flags); in ftimer_handler()
1140 test_and_clear_bit(FLG_FTI_RUN, &ch->bch.Flags); in ftimer_handler()
1141 if (test_and_clear_bit(FLG_LL_CONN, &ch->bch.Flags)) in ftimer_handler()
1142 deliver_status(ch, HW_MOD_CONNECT); in ftimer_handler()
1146 setup_pump(struct isar_ch *ch) { in setup_pump() argument
1147 u8 dps = SET_DPS(ch->dpath); in setup_pump()
1150 switch (ch->bch.state) { in setup_pump()
1154 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, PMOD_BYPASS, 0, NULL); in setup_pump()
1157 if (test_bit(FLG_DTMFSEND, &ch->bch.Flags)) { in setup_pump()
1159 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, in setup_pump()
1163 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, in setup_pump()
1169 if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) { in setup_pump()
1181 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, ctrl, 6, param); in setup_pump()
1185 if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) { in setup_pump()
1192 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, ctrl, 2, param); in setup_pump()
1193 ch->state = STFAX_NULL; in setup_pump()
1194 ch->newcmd = 0; in setup_pump()
1195 ch->newmod = 0; in setup_pump()
1196 test_and_set_bit(FLG_FTI_RUN, &ch->bch.Flags); in setup_pump()
1200 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in setup_pump()
1205 setup_sart(struct isar_ch *ch) { in setup_sart() argument
1206 u8 dps = SET_DPS(ch->dpath); in setup_sart()
1209 switch (ch->bch.state) { in setup_sart()
1211 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, SMODE_DISABLE, in setup_sart()
1216 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, SMODE_BINARY, in setup_sart()
1221 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, SMODE_HDLC, in setup_sart()
1228 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, ctrl, 2, param); in setup_sart()
1232 send_mbox(ch->is, dps | ISAR_HIS_BSTREQ, 0, 0, NULL); in setup_sart()
1237 setup_iom2(struct isar_ch *ch) { in setup_iom2() argument
1238 u8 dps = SET_DPS(ch->dpath); in setup_iom2()
1241 if (ch->bch.nr == 2) { in setup_iom2()
1245 switch (ch->bch.state) { in setup_iom2()
1249 msg[1] = ch->dpath + 2; in setup_iom2()
1250 msg[3] = ch->dpath + 2; in setup_iom2()
1260 if (test_bit(FLG_DTMFSEND, &ch->bch.Flags)) in setup_iom2()
1265 send_mbox(ch->is, dps | ISAR_HIS_IOM2CFG, cmsb, 5, msg); in setup_iom2()
1267 send_mbox(ch->is, dps | ISAR_HIS_IOM2REQ, 0, 0, NULL); in setup_iom2()
1272 modeisar(struct isar_ch *ch, u32 bprotocol) in modeisar() argument
1275 if (ch->bch.state == ISDN_P_NONE) { /* New Setup */ in modeisar()
1278 if (!ch->dpath) in modeisar()
1281 test_and_clear_bit(FLG_HDLC, &ch->bch.Flags); in modeisar()
1282 test_and_clear_bit(FLG_TRANSPARENT, &ch->bch.Flags); in modeisar()
1287 if (!test_and_set_bit(ISAR_DP2_USE, &ch->is->Flags)) in modeisar()
1288 ch->dpath = 2; in modeisar()
1290 &ch->is->Flags)) in modeisar()
1291 ch->dpath = 1; in modeisar()
1297 test_and_set_bit(FLG_HDLC, &ch->bch.Flags); in modeisar()
1300 &ch->bch.Flags); in modeisar()
1306 if (!test_and_set_bit(ISAR_DP1_USE, &ch->is->Flags)) in modeisar()
1307 ch->dpath = 1; in modeisar()
1310 "only with DP1\n", ch->is->name); in modeisar()
1315 pr_info("%s: protocol not known %x\n", ch->is->name, in modeisar()
1320 pr_debug("%s: ISAR ch%d dp%d protocol %x->%x\n", ch->is->name, in modeisar()
1321 ch->bch.nr, ch->dpath, ch->bch.state, bprotocol); in modeisar()
1322 ch->bch.state = bprotocol; in modeisar()
1323 setup_pump(ch); in modeisar()
1324 setup_iom2(ch); in modeisar()
1325 setup_sart(ch); in modeisar()
1326 if (ch->bch.state == ISDN_P_NONE) { in modeisar()
1328 if (ch->dpath == 1) in modeisar()
1329 test_and_clear_bit(ISAR_DP1_USE, &ch->is->Flags); in modeisar()
1330 else if (ch->dpath == 2) in modeisar()
1331 test_and_clear_bit(ISAR_DP2_USE, &ch->is->Flags); in modeisar()
1332 ch->dpath = 0; in modeisar()
1333 ch->is->ctrl(ch->is->hw, HW_DEACT_IND, ch->bch.nr); in modeisar()
1335 ch->is->ctrl(ch->is->hw, HW_ACTIVATE_IND, ch->bch.nr); in modeisar()
1340 isar_pump_cmd(struct isar_ch *ch, u32 cmd, u8 para) in isar_pump_cmd() argument
1342 u8 dps = SET_DPS(ch->dpath); in isar_pump_cmd()
1346 ch->is->name, cmd, para, ch->bch.state); in isar_pump_cmd()
1349 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1353 ch->state = STFAX_LINE; in isar_pump_cmd()
1354 ch->cmd = ctrl; in isar_pump_cmd()
1355 ch->mod = para; in isar_pump_cmd()
1356 ch->newmod = 0; in isar_pump_cmd()
1357 ch->newcmd = 0; in isar_pump_cmd()
1358 ch->try_mod = 3; in isar_pump_cmd()
1359 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1360 (ch->cmd == PCTRL_CMD_FTM) && (ch->mod == para)) in isar_pump_cmd()
1361 deliver_status(ch, HW_MOD_CONNECT); in isar_pump_cmd()
1363 ch->newmod = para; in isar_pump_cmd()
1364 ch->newcmd = PCTRL_CMD_FTM; in isar_pump_cmd()
1367 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1371 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1375 ch->state = STFAX_LINE; in isar_pump_cmd()
1376 ch->cmd = ctrl; in isar_pump_cmd()
1377 ch->mod = para; in isar_pump_cmd()
1378 ch->newmod = 0; in isar_pump_cmd()
1379 ch->newcmd = 0; in isar_pump_cmd()
1380 ch->try_mod = 3; in isar_pump_cmd()
1381 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1382 (ch->cmd == PCTRL_CMD_FTH) && (ch->mod == para)) in isar_pump_cmd()
1383 deliver_status(ch, HW_MOD_CONNECT); in isar_pump_cmd()
1385 ch->newmod = para; in isar_pump_cmd()
1386 ch->newcmd = PCTRL_CMD_FTH; in isar_pump_cmd()
1389 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1393 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1397 ch->state = STFAX_LINE; in isar_pump_cmd()
1398 ch->cmd = ctrl; in isar_pump_cmd()
1399 ch->mod = para; in isar_pump_cmd()
1400 ch->newmod = 0; in isar_pump_cmd()
1401 ch->newcmd = 0; in isar_pump_cmd()
1402 ch->try_mod = 3; in isar_pump_cmd()
1403 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1404 (ch->cmd == PCTRL_CMD_FRM) && (ch->mod == para)) in isar_pump_cmd()
1405 deliver_status(ch, HW_MOD_CONNECT); in isar_pump_cmd()
1407 ch->newmod = para; in isar_pump_cmd()
1408 ch->newcmd = PCTRL_CMD_FRM; in isar_pump_cmd()
1411 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1415 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1419 ch->state = STFAX_LINE; in isar_pump_cmd()
1420 ch->cmd = ctrl; in isar_pump_cmd()
1421 ch->mod = para; in isar_pump_cmd()
1422 ch->newmod = 0; in isar_pump_cmd()
1423 ch->newcmd = 0; in isar_pump_cmd()
1424 ch->try_mod = 3; in isar_pump_cmd()
1425 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1426 (ch->cmd == PCTRL_CMD_FRH) && (ch->mod == para)) in isar_pump_cmd()
1427 deliver_status(ch, HW_MOD_CONNECT); in isar_pump_cmd()
1429 ch->newmod = para; in isar_pump_cmd()
1430 ch->newcmd = PCTRL_CMD_FRH; in isar_pump_cmd()
1433 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1443 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1); in isar_pump_cmd()
1458 isar->ch[i].mml = msg; in isar_setup()
1459 isar->ch[i].bch.state = 0; in isar_setup()
1460 isar->ch[i].dpath = i + 1; in isar_setup()
1461 modeisar(&isar->ch[i], ISDN_P_NONE); in isar_setup()
1466 isar_l2l1(struct mISDNchannel *ch, struct sk_buff *skb) in isar_l2l1() argument
1468 struct bchannel *bch = container_of(ch, struct bchannel, ch); in isar_l2l1()
1488 ret = modeisar(ich, ch->protocol); in isar_l2l1()
1493 _queue_data(ch, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, in isar_l2l1()
1501 _queue_data(ch, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, in isar_l2l1()
1569 isar_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg) in isar_bctrl() argument
1571 struct bchannel *bch = container_of(ch, struct bchannel, ch); in isar_bctrl()
1585 ch->protocol = ISDN_P_NONE; in isar_bctrl()
1586 ch->peer = NULL; in isar_bctrl()
1603 modeisar(&isar->ch[0], ISDN_P_NONE); in free_isar()
1604 modeisar(&isar->ch[1], ISDN_P_NONE); in free_isar()
1605 del_timer(&isar->ch[0].ftimer); in free_isar()
1606 del_timer(&isar->ch[1].ftimer); in free_isar()
1607 test_and_clear_bit(FLG_INITIALIZED, &isar->ch[0].bch.Flags); in free_isar()
1608 test_and_clear_bit(FLG_INITIALIZED, &isar->ch[1].bch.Flags); in free_isar()
1618 if (isar->ch[0].bch.debug & DEBUG_HW) in init_isar()
1627 timer_setup(&isar->ch[0].ftimer, ftimer_handler, 0); in init_isar()
1628 test_and_set_bit(FLG_INITIALIZED, &isar->ch[0].bch.Flags); in init_isar()
1629 timer_setup(&isar->ch[1].ftimer, ftimer_handler, 0); in init_isar()
1630 test_and_set_bit(FLG_INITIALIZED, &isar->ch[1].bch.Flags); in init_isar()
1643 bch = &isar->ch[rq->adr.channel - 1].bch; in isar_open()
1646 bch->ch.protocol = rq->protocol; in isar_open()
1647 rq->ch = &bch->ch; in isar_open()
1658 isar->ch[i].bch.nr = i + 1; in mISDNisar_init()
1659 mISDN_initbchannel(&isar->ch[i].bch, MAX_DATA_MEM, 32); in mISDNisar_init()
1660 isar->ch[i].bch.ch.nr = i + 1; in mISDNisar_init()
1661 isar->ch[i].bch.ch.send = &isar_l2l1; in mISDNisar_init()
1662 isar->ch[i].bch.ch.ctrl = isar_bctrl; in mISDNisar_init()
1663 isar->ch[i].bch.hw = hw; in mISDNisar_init()
1664 isar->ch[i].is = isar; in mISDNisar_init()