Lines Matching +full:cmd +full:- +full:cnt +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-only
41 u8 val = isar->read_reg(isar->hw, ISAR_HIA); in waitforHIA()
45 t--; in waitforHIA()
46 val = isar->read_reg(isar->hw, ISAR_HIA); in waitforHIA()
48 pr_debug("%s: HIA after %dus\n", isar->name, timeout - t); in waitforHIA()
54 * if msg is NULL use isar->buf
62 isar->write_reg(isar->hw, ISAR_CTRL_H, creg); in send_mbox()
63 isar->write_reg(isar->hw, ISAR_CTRL_L, len); in send_mbox()
64 isar->write_reg(isar->hw, ISAR_WADR, 0); in send_mbox()
66 msg = isar->buf; in send_mbox()
68 isar->write_fifo(isar->hw, ISAR_MBOX, msg, len); in send_mbox()
69 if (isar->ch[0].bch.debug & DEBUG_HW_BFIFO) { in send_mbox()
73 hex_dump_to_buffer(msg + l, len - l, 32, 1, in send_mbox()
74 isar->log, 256, 1); in send_mbox()
75 pr_debug("%s: %s %02x: %s\n", isar->name, in send_mbox()
76 __func__, l, isar->log); in send_mbox()
81 isar->write_reg(isar->hw, ISAR_HIS, his); in send_mbox()
88 * if msg is NULL use isar->buf
94 msg = isar->buf; in rcv_mbox()
95 isar->write_reg(isar->hw, ISAR_RADR, 0); in rcv_mbox()
96 if (msg && isar->clsb) { in rcv_mbox()
97 isar->read_fifo(isar->hw, ISAR_MBOX, msg, isar->clsb); in rcv_mbox()
98 if (isar->ch[0].bch.debug & DEBUG_HW_BFIFO) { in rcv_mbox()
101 while (l < (int)isar->clsb) { in rcv_mbox()
102 hex_dump_to_buffer(msg + l, isar->clsb - l, 32, in rcv_mbox()
103 1, isar->log, 256, 1); in rcv_mbox()
104 pr_debug("%s: %s %02x: %s\n", isar->name, in rcv_mbox()
105 __func__, l, isar->log); in rcv_mbox()
110 isar->write_reg(isar->hw, ISAR_IIA, 0); in rcv_mbox()
116 isar->iis = isar->read_reg(isar->hw, ISAR_IIS); in get_irq_infos()
117 isar->cmsb = isar->read_reg(isar->hw, ISAR_CTRL_H); in get_irq_infos()
118 isar->clsb = isar->read_reg(isar->hw, ISAR_CTRL_L); in get_irq_infos()
119 pr_debug("%s: rcv_mbox(%02x,%02x,%d)\n", isar->name, in get_irq_infos()
120 isar->iis, isar->cmsb, isar->clsb); in get_irq_infos()
134 irq = isar->read_reg(isar->hw, ISAR_IRQBIT); in poll_mbox()
137 t--; in poll_mbox()
144 isar->name, isar->clsb, maxdelay - t); in poll_mbox()
154 isar->write_reg(isar->hw, ISAR_IRQBIT, 0); in ISARVersion()
155 isar->buf[0] = ISAR_MSG_HWVER; in ISARVersion()
156 isar->buf[1] = 0; in ISARVersion()
157 isar->buf[2] = 1; in ISARVersion()
159 return -1; in ISARVersion()
161 return -2; in ISARVersion()
162 if (isar->iis == ISAR_IIS_VNR) { in ISARVersion()
163 if (isar->clsb == 1) { in ISARVersion()
164 ver = isar->buf[0] & 0xf; in ISARVersion()
167 return -3; in ISARVersion()
169 return -4; in ISARVersion()
175 u32 saved_debug = isar->ch[0].bch.debug; in load_firmware()
176 int ret, cnt; in load_firmware() local
188 if (1 != isar->version) { in load_firmware()
190 isar->name, isar->version); in load_firmware()
191 return -EINVAL; in load_firmware()
194 isar->ch[0].bch.debug &= ~DEBUG_HW_BFIFO; in load_firmware()
196 isar->name, size / 2, size); in load_firmware()
197 cnt = 0; in load_firmware()
200 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
201 isar->write_reg(isar->hw, ISAR_IRQBIT, 0); in load_firmware()
202 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
203 while (cnt < size) { in load_firmware()
207 cnt += 3; in load_firmware()
211 if (cnt + left > size) { in load_firmware()
213 isar->name, size, cnt + left); in load_firmware()
214 ret = -EINVAL; in load_firmware()
217 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
221 ret = -ETIME; in load_firmware()
226 ret = -ETIME; in load_firmware()
229 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
230 if ((isar->iis != ISAR_IIS_DKEY) || isar->cmsb || isar->clsb) { in load_firmware()
232 isar->iis, isar->cmsb, isar->clsb); in load_firmware()
242 mp = isar->buf; in load_firmware()
246 left -= noc; in load_firmware()
247 cnt += noc; in load_firmware()
249 pr_debug("%s: load %3d words at %04x\n", isar->name, in load_firmware()
256 noc--; in load_firmware()
258 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
261 ret = -ETIME; in load_firmware()
266 ret = -ETIME; in load_firmware()
269 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
270 if ((isar->iis != ISAR_IIS_FIRM) || in load_firmware()
271 isar->cmsb || isar->clsb) { in load_firmware()
273 isar->iis, isar->cmsb, isar->clsb); in load_firmware()
274 ret = -EIO; in load_firmware()
279 isar->name, blk_head.len); in load_firmware()
281 isar->ch[0].bch.debug = saved_debug; in load_firmware()
283 cnt = 10; in load_firmware()
284 while (cnt--) in load_firmware()
286 isar->buf[0] = 0xff; in load_firmware()
287 isar->buf[1] = 0xfe; in load_firmware()
288 isar->bstat = 0; in load_firmware()
289 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
292 ret = -ETIME; in load_firmware()
297 ret = -ETIME; in load_firmware()
300 if ((isar->iis != ISAR_IIS_STDSP) || isar->cmsb || isar->clsb) { in load_firmware()
302 isar->iis, isar->cmsb, isar->clsb); in load_firmware()
303 ret = -EIO; in load_firmware()
306 pr_debug("%s: ISAR start dsp success\n", isar->name); in load_firmware()
310 isar->write_reg(isar->hw, ISAR_IRQBIT, ISAR_IRQSTA); in load_firmware()
311 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
312 cnt = 1000; /* max 1s */ in load_firmware()
313 while ((!isar->bstat) && cnt) { in load_firmware()
315 cnt--; in load_firmware()
317 if (!cnt) { in load_firmware()
319 ret = -ETIME; in load_firmware()
323 isar->name, isar->bstat); in load_firmware()
325 cnt = 10; in load_firmware()
326 while (cnt--) in load_firmware()
328 isar->iis = 0; in load_firmware()
329 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
332 ret = -ETIME; in load_firmware()
335 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
336 cnt = 10000; /* max 100 ms */ in load_firmware()
337 while ((isar->iis != ISAR_IIS_DIAG) && cnt) { in load_firmware()
339 cnt--; in load_firmware()
342 if (!cnt) { in load_firmware()
344 ret = -ETIME; in load_firmware()
347 if ((isar->cmsb == ISAR_CTRL_STST) && (isar->clsb == 1) in load_firmware()
348 && (isar->buf[0] == 0)) in load_firmware()
349 pr_debug("%s: ISAR selftest OK\n", isar->name); in load_firmware()
352 isar->cmsb, isar->clsb, isar->buf[0]); in load_firmware()
353 ret = -EIO; in load_firmware()
356 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
357 isar->iis = 0; in load_firmware()
360 ret = -ETIME; in load_firmware()
363 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
364 cnt = 30000; /* max 300 ms */ in load_firmware()
365 while ((isar->iis != ISAR_IIS_DIAG) && cnt) { in load_firmware()
367 cnt--; in load_firmware()
370 if (!cnt) { in load_firmware()
372 ret = -ETIME; in load_firmware()
375 if ((isar->cmsb == ISAR_CTRL_SWVER) && (isar->clsb == 1)) { in load_firmware()
377 isar->name, isar->buf[0]); in load_firmware()
380 " cnt(%d)\n", isar->name, isar->cmsb, in load_firmware()
381 isar->clsb, cnt); in load_firmware()
382 ret = -EIO; in load_firmware()
386 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
388 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
391 spin_lock_irqsave(isar->hwlock, flags); in load_firmware()
393 isar->ch[0].bch.debug = saved_debug; in load_firmware()
396 isar->write_reg(isar->hw, ISAR_IRQBIT, 0); in load_firmware()
397 spin_unlock_irqrestore(isar->hwlock, flags); in load_firmware()
404 pr_debug("%s: HL->LL FAXIND %x\n", ch->is->name, status); in deliver_status()
405 _queue_data(&ch->bch.ch, PH_CONTROL_IND, status, 0, NULL, GFP_ATOMIC); in deliver_status()
414 if (!ch->is->clsb) { in isar_rcv_frame()
415 pr_debug("%s; ISAR zero len frame\n", ch->is->name); in isar_rcv_frame()
416 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
419 if (test_bit(FLG_RX_OFF, &ch->bch.Flags)) { in isar_rcv_frame()
420 ch->bch.dropcnt += ch->is->clsb; in isar_rcv_frame()
421 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
424 switch (ch->bch.state) { in isar_rcv_frame()
427 ch->is->name, ch->is->iis, ch->is->cmsb, ch->is->clsb); in isar_rcv_frame()
428 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
433 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb); in isar_rcv_frame()
436 ch->is->name, ch->bch.nr, ch->is->clsb); in isar_rcv_frame()
437 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
440 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb)); in isar_rcv_frame()
441 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
444 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb); in isar_rcv_frame()
447 ch->is->name, ch->bch.nr, ch->is->clsb); in isar_rcv_frame()
448 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
451 if (ch->is->cmsb & HDLC_ERROR) { in isar_rcv_frame()
453 ch->is->name, ch->is->cmsb, ch->is->clsb); in isar_rcv_frame()
455 if (ch->is->cmsb & HDLC_ERR_RER) in isar_rcv_frame()
456 ch->bch.err_inv++; in isar_rcv_frame()
457 if (ch->is->cmsb & HDLC_ERR_CER) in isar_rcv_frame()
458 ch->bch.err_crc++; in isar_rcv_frame()
460 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
461 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
464 if (ch->is->cmsb & HDLC_FSD) in isar_rcv_frame()
465 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
466 ptr = skb_put(ch->bch.rx_skb, ch->is->clsb); in isar_rcv_frame()
467 rcv_mbox(ch->is, ptr); in isar_rcv_frame()
468 if (ch->is->cmsb & HDLC_FED) { in isar_rcv_frame()
469 if (ch->bch.rx_skb->len < 3) { /* last 2 are the FCS */ in isar_rcv_frame()
471 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
472 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
475 skb_trim(ch->bch.rx_skb, ch->bch.rx_skb->len - 2); in isar_rcv_frame()
476 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
480 if (ch->state != STFAX_ACTIV) { in isar_rcv_frame()
482 ch->is->name); in isar_rcv_frame()
483 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
484 if (ch->bch.rx_skb) in isar_rcv_frame()
485 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
488 if (!ch->bch.rx_skb) { in isar_rcv_frame()
489 ch->bch.rx_skb = mI_alloc_skb(ch->bch.maxlen, in isar_rcv_frame()
491 if (unlikely(!ch->bch.rx_skb)) { in isar_rcv_frame()
494 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
498 if (ch->cmd == PCTRL_CMD_FRM) { in isar_rcv_frame()
499 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb)); in isar_rcv_frame()
501 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
502 if (ch->is->cmsb & SART_NMD) { /* ABORT */ in isar_rcv_frame()
504 ch->is->name); in isar_rcv_frame()
505 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
506 send_mbox(ch->is, SET_DPS(ch->dpath) | in isar_rcv_frame()
509 ch->state = STFAX_ESCAPE; in isar_rcv_frame()
512 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
513 if (ch->is->cmsb & SART_NMD) in isar_rcv_frame()
517 if (ch->cmd != PCTRL_CMD_FRH) { in isar_rcv_frame()
519 ch->is->name, ch->cmd); in isar_rcv_frame()
520 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
521 if (ch->bch.rx_skb) in isar_rcv_frame()
522 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
526 if ((ch->bch.rx_skb->len + ch->is->clsb) > in isar_rcv_frame()
527 (ch->bch.maxlen + 2)) { in isar_rcv_frame()
529 ch->is->name, __func__); in isar_rcv_frame()
530 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
531 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
533 } else if (ch->is->cmsb & HDLC_ERROR) { in isar_rcv_frame()
535 ch->is->name, ch->is->cmsb, ch->is->clsb); in isar_rcv_frame()
536 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
537 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
540 if (ch->is->cmsb & HDLC_FSD) in isar_rcv_frame()
541 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
542 ptr = skb_put(ch->bch.rx_skb, ch->is->clsb); in isar_rcv_frame()
543 rcv_mbox(ch->is, ptr); in isar_rcv_frame()
544 if (ch->is->cmsb & HDLC_FED) { in isar_rcv_frame()
545 if (ch->bch.rx_skb->len < 3) { /* last 2 are the FCS */ in isar_rcv_frame()
547 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
548 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
551 skb_trim(ch->bch.rx_skb, ch->bch.rx_skb->len - 2); in isar_rcv_frame()
552 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
554 if (ch->is->cmsb & SART_NMD) { /* ABORT */ in isar_rcv_frame()
556 ch->is->name); in isar_rcv_frame()
557 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
558 if (ch->bch.rx_skb) in isar_rcv_frame()
559 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
560 send_mbox(ch->is, SET_DPS(ch->dpath) | in isar_rcv_frame()
562 ch->state = STFAX_ESCAPE; in isar_rcv_frame()
567 pr_info("isar_rcv_frame protocol (%x)error\n", ch->bch.state); in isar_rcv_frame()
568 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0); in isar_rcv_frame()
580 pr_debug("%s: ch%d tx_skb %d tx_idx %d\n", ch->is->name, ch->bch.nr, in isar_fill_fifo()
581 ch->bch.tx_skb ? ch->bch.tx_skb->len : -1, ch->bch.tx_idx); in isar_fill_fifo()
582 if (!(ch->is->bstat & in isar_fill_fifo()
583 (ch->dpath == 1 ? BSTAT_RDM1 : BSTAT_RDM2))) in isar_fill_fifo()
585 if (!ch->bch.tx_skb) { in isar_fill_fifo()
586 if (!test_bit(FLG_TX_EMPTY, &ch->bch.Flags) || in isar_fill_fifo()
587 (ch->bch.state != ISDN_P_B_RAW)) in isar_fill_fifo()
589 count = ch->mml; in isar_fill_fifo()
591 memset(ch->is->buf, ch->bch.fill[0], count); in isar_fill_fifo()
592 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
593 0, count, ch->is->buf); in isar_fill_fifo()
596 count = ch->bch.tx_skb->len - ch->bch.tx_idx; in isar_fill_fifo()
599 if (count > ch->mml) { in isar_fill_fifo()
601 count = ch->mml; in isar_fill_fifo()
605 ptr = ch->bch.tx_skb->data + ch->bch.tx_idx; in isar_fill_fifo()
606 if (!ch->bch.tx_idx) { in isar_fill_fifo()
607 pr_debug("%s: frame start\n", ch->is->name); in isar_fill_fifo()
608 if ((ch->bch.state == ISDN_P_B_T30_FAX) && in isar_fill_fifo()
609 (ch->cmd == PCTRL_CMD_FTH)) { in isar_fill_fifo()
614 &ch->bch.Flags); in isar_fill_fifo()
616 ch->is->name); in isar_fill_fifo()
619 &ch->bch.Flags); in isar_fill_fifo()
625 ch->bch.tx_idx += count; in isar_fill_fifo()
626 switch (ch->bch.state) { in isar_fill_fifo()
633 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
637 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
641 if (ch->state != STFAX_ACTIV) in isar_fill_fifo()
642 pr_debug("%s: not ACTIV\n", ch->is->name); in isar_fill_fifo()
643 else if (ch->cmd == PCTRL_CMD_FTH) in isar_fill_fifo()
644 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
646 else if (ch->cmd == PCTRL_CMD_FTM) in isar_fill_fifo()
647 send_mbox(ch->is, SET_DPS(ch->dpath) | ISAR_HIS_SDATA, in isar_fill_fifo()
650 pr_debug("%s: not FTH/FTM\n", ch->is->name); in isar_fill_fifo()
654 __func__, ch->bch.state); in isar_fill_fifo()
662 struct isar_ch *base = &isar->ch[0]; in sel_bch_isar()
666 if (base->dpath == dpath) in sel_bch_isar()
669 if (base->dpath == dpath) in sel_bch_isar()
677 pr_debug("%s: %s ch%d tx_skb %d tx_idx %d\n", ch->is->name, __func__, in send_next()
678 ch->bch.nr, ch->bch.tx_skb ? ch->bch.tx_skb->len : -1, in send_next()
679 ch->bch.tx_idx); in send_next()
680 if (ch->bch.state == ISDN_P_B_T30_FAX) { in send_next()
681 if (ch->cmd == PCTRL_CMD_FTH) { in send_next()
682 if (test_bit(FLG_LASTDATA, &ch->bch.Flags)) { in send_next()
684 test_and_set_bit(FLG_NMD_DATA, &ch->bch.Flags); in send_next()
686 } else if (ch->cmd == PCTRL_CMD_FTM) { in send_next()
687 if (test_bit(FLG_DLEETX, &ch->bch.Flags)) { in send_next()
688 test_and_set_bit(FLG_LASTDATA, &ch->bch.Flags); in send_next()
689 test_and_set_bit(FLG_NMD_DATA, &ch->bch.Flags); in send_next()
693 dev_kfree_skb(ch->bch.tx_skb); in send_next()
694 if (get_next_bframe(&ch->bch)) { in send_next()
696 test_and_clear_bit(FLG_TX_EMPTY, &ch->bch.Flags); in send_next()
697 } else if (test_bit(FLG_TX_EMPTY, &ch->bch.Flags)) { in send_next()
700 if (test_and_clear_bit(FLG_DLEETX, &ch->bch.Flags)) { in send_next()
702 &ch->bch.Flags)) { in send_next()
704 &ch->bch.Flags)) { in send_next()
706 send_mbox(ch->is, SET_DPS(ch->dpath) | in send_next()
709 test_and_set_bit(FLG_LL_OK, &ch->bch.Flags); in send_next()
713 } else if (test_bit(FLG_FILLEMPTY, &ch->bch.Flags)) { in send_next()
714 test_and_set_bit(FLG_TX_EMPTY, &ch->bch.Flags); in send_next()
724 pr_debug("%s: rdm %x\n", isar->name, rdm); in check_send()
727 if (ch && test_bit(FLG_ACTIVE, &ch->bch.Flags)) { in check_send()
728 if (ch->bch.tx_skb && (ch->bch.tx_skb->len > in check_send()
729 ch->bch.tx_idx)) in check_send()
737 if (ch && test_bit(FLG_ACTIVE, &ch->bch.Flags)) { in check_send()
738 if (ch->bch.tx_skb && (ch->bch.tx_skb->len > in check_send()
739 ch->bch.tx_idx)) in check_send()
755 u8 ril = ch->is->buf[0]; in isar_pump_status_rsp()
758 if (!test_and_clear_bit(ISAR_RATE_REQ, &ch->is->Flags)) in isar_pump_status_rsp()
761 pr_info("%s: wrong pstrsp ril=%d\n", ch->is->name, ril); in isar_pump_status_rsp()
764 switch (ch->is->buf[1]) { in isar_pump_status_rsp()
799 sprintf(ch->conmsg, "%s %s", dmril[ril], dmrim[rim]); in isar_pump_status_rsp()
800 pr_debug("%s: pump strsp %s\n", ch->is->name, ch->conmsg); in isar_pump_status_rsp()
805 u8 dps = SET_DPS(ch->dpath); in isar_pump_statev_modem()
809 pr_debug("%s: pump stev TIMER\n", ch->is->name); in isar_pump_statev_modem()
812 pr_debug("%s: pump stev CONNECT\n", ch->is->name); in isar_pump_statev_modem()
816 pr_debug("%s: pump stev NO CONNECT\n", ch->is->name); in isar_pump_statev_modem()
817 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in isar_pump_statev_modem()
821 pr_debug("%s: pump stev V24 OFF\n", ch->is->name); in isar_pump_statev_modem()
824 pr_debug("%s: pump stev CTS ON\n", ch->is->name); in isar_pump_statev_modem()
827 pr_debug("%s pump stev CTS OFF\n", ch->is->name); in isar_pump_statev_modem()
830 pr_debug("%s: pump stev CARRIER ON\n", ch->is->name); in isar_pump_statev_modem()
831 test_and_set_bit(ISAR_RATE_REQ, &ch->is->Flags); in isar_pump_statev_modem()
832 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in isar_pump_statev_modem()
835 pr_debug("%s: pump stev CARRIER OFF\n", ch->is->name); in isar_pump_statev_modem()
838 pr_debug("%s: pump stev DSR ON\n", ch->is->name); in isar_pump_statev_modem()
841 pr_debug("%s: pump stev DSR_OFF\n", ch->is->name); in isar_pump_statev_modem()
844 pr_debug("%s: pump stev REMOTE RETRAIN\n", ch->is->name); in isar_pump_statev_modem()
847 pr_debug("%s: pump stev REMOTE RENEGOTIATE\n", ch->is->name); in isar_pump_statev_modem()
850 pr_debug("%s: pump stev GSTN CLEAR\n", ch->is->name); in isar_pump_statev_modem()
853 pr_info("u%s: unknown pump stev %x\n", ch->is->name, devt); in isar_pump_statev_modem()
860 u8 dps = SET_DPS(ch->dpath); in isar_pump_statev_fax()
865 pr_debug("%s: pump stev TIMER\n", ch->is->name); in isar_pump_statev_fax()
868 pr_debug("%s: pump stev RSP_READY\n", ch->is->name); in isar_pump_statev_fax()
869 ch->state = STFAX_READY; in isar_pump_statev_fax()
872 if (test_bit(BC_FLG_ORIG, &ch->bch.Flags)) in isar_pump_statev_fax()
879 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
880 pr_debug("%s: pump stev LINE_TX_H\n", ch->is->name); in isar_pump_statev_fax()
881 ch->state = STFAX_CONT; in isar_pump_statev_fax()
882 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
886 ch->is->name, ch->state); in isar_pump_statev_fax()
890 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
891 pr_debug("%s: pump stev LINE_RX_H\n", ch->is->name); in isar_pump_statev_fax()
892 ch->state = STFAX_CONT; in isar_pump_statev_fax()
893 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
897 ch->is->name, ch->state); in isar_pump_statev_fax()
901 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
902 pr_debug("%s: pump stev LINE_TX_B\n", ch->is->name); in isar_pump_statev_fax()
903 ch->state = STFAX_CONT; in isar_pump_statev_fax()
904 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
908 ch->is->name, ch->state); in isar_pump_statev_fax()
912 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
913 pr_debug("%s: pump stev LINE_RX_B\n", ch->is->name); in isar_pump_statev_fax()
914 ch->state = STFAX_CONT; in isar_pump_statev_fax()
915 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
919 ch->is->name, ch->state); in isar_pump_statev_fax()
923 if (ch->state == STFAX_CONT) { in isar_pump_statev_fax()
924 pr_debug("%s: pump stev RSP_CONN\n", ch->is->name); in isar_pump_statev_fax()
925 ch->state = STFAX_ACTIV; in isar_pump_statev_fax()
926 test_and_set_bit(ISAR_RATE_REQ, &ch->is->Flags); in isar_pump_statev_fax()
927 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in isar_pump_statev_fax()
928 if (ch->cmd == PCTRL_CMD_FTH) { in isar_pump_statev_fax()
929 int delay = (ch->mod == 3) ? 1000 : 200; in isar_pump_statev_fax()
932 &ch->bch.Flags)) in isar_pump_statev_fax()
933 del_timer(&ch->ftimer); in isar_pump_statev_fax()
934 ch->ftimer.expires = in isar_pump_statev_fax()
937 &ch->bch.Flags); in isar_pump_statev_fax()
938 add_timer(&ch->ftimer); in isar_pump_statev_fax()
944 ch->is->name, ch->state); in isar_pump_statev_fax()
948 pr_debug("%s: pump stev FLAGS_DET\n", ch->is->name); in isar_pump_statev_fax()
952 ch->is->name, ch->state); in isar_pump_statev_fax()
953 if (ch->state == STFAX_ESCAPE) { in isar_pump_statev_fax()
955 switch (ch->newcmd) { in isar_pump_statev_fax()
957 ch->state = STFAX_READY; in isar_pump_statev_fax()
963 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
965 ch->state = STFAX_SILDET; in isar_pump_statev_fax()
969 ch->mod = ch->newmod; in isar_pump_statev_fax()
970 p1 = ch->newmod; in isar_pump_statev_fax()
971 ch->newmod = 0; in isar_pump_statev_fax()
972 ch->cmd = ch->newcmd; in isar_pump_statev_fax()
973 ch->newcmd = 0; in isar_pump_statev_fax()
974 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
975 ch->cmd, 1, &p1); in isar_pump_statev_fax()
976 ch->state = STFAX_LINE; in isar_pump_statev_fax()
977 ch->try_mod = 3; in isar_pump_statev_fax()
981 ch->is->name, ch->newcmd); in isar_pump_statev_fax()
984 } else if (ch->state == STFAX_ACTIV) { in isar_pump_statev_fax()
985 if (test_and_clear_bit(FLG_LL_OK, &ch->bch.Flags)) in isar_pump_statev_fax()
987 else if (ch->cmd == PCTRL_CMD_FRM) in isar_pump_statev_fax()
991 ch->state = STFAX_READY; in isar_pump_statev_fax()
992 } else if (ch->state != STFAX_SILDET) { in isar_pump_statev_fax()
994 ch->state = STFAX_READY; in isar_pump_statev_fax()
999 pr_debug("%s: pump stev RSP_SILDET\n", ch->is->name); in isar_pump_statev_fax()
1000 if (ch->state == STFAX_SILDET) { in isar_pump_statev_fax()
1001 ch->mod = ch->newmod; in isar_pump_statev_fax()
1002 p1 = ch->newmod; in isar_pump_statev_fax()
1003 ch->newmod = 0; in isar_pump_statev_fax()
1004 ch->cmd = ch->newcmd; in isar_pump_statev_fax()
1005 ch->newcmd = 0; in isar_pump_statev_fax()
1006 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
1007 ch->cmd, 1, &p1); in isar_pump_statev_fax()
1008 ch->state = STFAX_LINE; in isar_pump_statev_fax()
1009 ch->try_mod = 3; in isar_pump_statev_fax()
1013 pr_debug("%s: pump stev RSP_SILOFF\n", ch->is->name); in isar_pump_statev_fax()
1016 if (ch->state == STFAX_LINE) { in isar_pump_statev_fax()
1018 ch->is->name, ch->try_mod); in isar_pump_statev_fax()
1019 if (ch->try_mod--) { in isar_pump_statev_fax()
1020 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, in isar_pump_statev_fax()
1021 ch->cmd, 1, &ch->mod); in isar_pump_statev_fax()
1025 pr_debug("%s: pump stev RSP_FCERR\n", ch->is->name); in isar_pump_statev_fax()
1026 ch->state = STFAX_ESCAPE; in isar_pump_statev_fax()
1027 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, PCTRL_CMD_ESC, in isar_pump_statev_fax()
1042 switch (isar->iis & ISAR_IIS_MSCMSD) { in mISDNisar_irq()
1044 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1049 isar->name, isar->iis, isar->cmsb, in mISDNisar_irq()
1050 isar->clsb); in mISDNisar_irq()
1051 isar->write_reg(isar->hw, ISAR_IIA, 0); in mISDNisar_irq()
1055 isar->write_reg(isar->hw, ISAR_IIA, 0); in mISDNisar_irq()
1056 isar->bstat |= isar->cmsb; in mISDNisar_irq()
1057 check_send(isar, isar->cmsb); in mISDNisar_irq()
1061 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1063 if (isar->cmsb == BSTEV_TBO) in mISDNisar_irq()
1064 ch->bch.err_tx++; in mISDNisar_irq()
1065 if (isar->cmsb == BSTEV_RBO) in mISDNisar_irq()
1066 ch->bch.err_rdo++; in mISDNisar_irq()
1070 isar->name, isar->iis >> 6, isar->cmsb); in mISDNisar_irq()
1071 isar->write_reg(isar->hw, ISAR_IIA, 0); in mISDNisar_irq()
1074 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1077 if (ch->bch.state == ISDN_P_B_MODEM_ASYNC) in mISDNisar_irq()
1078 isar_pump_statev_modem(ch, isar->cmsb); in mISDNisar_irq()
1079 else if (ch->bch.state == ISDN_P_B_T30_FAX) in mISDNisar_irq()
1080 isar_pump_statev_fax(ch, isar->cmsb); in mISDNisar_irq()
1081 else if (ch->bch.state == ISDN_P_B_RAW) { in mISDNisar_irq()
1083 tt = isar->cmsb | 0x30; in mISDNisar_irq()
1091 _queue_data(&ch->bch.ch, PH_CONTROL_IND, in mISDNisar_irq()
1096 isar->name, ch->bch.state, in mISDNisar_irq()
1097 isar->cmsb); in mISDNisar_irq()
1100 isar->name, isar->iis, isar->cmsb, in mISDNisar_irq()
1101 isar->clsb); in mISDNisar_irq()
1102 isar->write_reg(isar->hw, ISAR_IIA, 0); in mISDNisar_irq()
1106 ch = sel_bch_isar(isar, isar->iis >> 6); in mISDNisar_irq()
1112 isar->name, isar->iis, isar->cmsb, in mISDNisar_irq()
1113 isar->clsb); in mISDNisar_irq()
1114 isar->write_reg(isar->hw, ISAR_IIA, 0); in mISDNisar_irq()
1124 pr_debug("%s: invalid msg his:%x\n", isar->name, isar->cmsb); in mISDNisar_irq()
1129 isar->name, isar->iis, isar->cmsb, isar->clsb); in mISDNisar_irq()
1140 pr_debug("%s: ftimer flags %lx\n", ch->is->name, ch->bch.Flags); in ftimer_handler()
1141 test_and_clear_bit(FLG_FTI_RUN, &ch->bch.Flags); in ftimer_handler()
1142 if (test_and_clear_bit(FLG_LL_CONN, &ch->bch.Flags)) in ftimer_handler()
1148 u8 dps = SET_DPS(ch->dpath); in setup_pump()
1151 switch (ch->bch.state) { in setup_pump()
1155 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, PMOD_BYPASS, 0, NULL); in setup_pump()
1158 if (test_bit(FLG_DTMFSEND, &ch->bch.Flags)) { in setup_pump()
1160 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, in setup_pump()
1163 param[0] = 40; /* REL -46 dbm */ in setup_pump()
1164 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, in setup_pump()
1170 if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) { in setup_pump()
1182 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, ctrl, 6, param); in setup_pump()
1186 if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) { in setup_pump()
1193 send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG, ctrl, 2, param); in setup_pump()
1194 ch->state = STFAX_NULL; in setup_pump()
1195 ch->newcmd = 0; in setup_pump()
1196 ch->newmod = 0; in setup_pump()
1197 test_and_set_bit(FLG_FTI_RUN, &ch->bch.Flags); in setup_pump()
1201 send_mbox(ch->is, dps | ISAR_HIS_PSTREQ, 0, 0, NULL); in setup_pump()
1207 u8 dps = SET_DPS(ch->dpath); in setup_sart()
1210 switch (ch->bch.state) { in setup_sart()
1212 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, SMODE_DISABLE, in setup_sart()
1217 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, SMODE_BINARY, in setup_sart()
1222 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, SMODE_HDLC, in setup_sart()
1229 send_mbox(ch->is, dps | ISAR_HIS_SARTCFG, ctrl, 2, param); in setup_sart()
1233 send_mbox(ch->is, dps | ISAR_HIS_BSTREQ, 0, 0, NULL); in setup_sart()
1239 u8 dps = SET_DPS(ch->dpath); in setup_iom2()
1242 if (ch->bch.nr == 2) { in setup_iom2()
1246 switch (ch->bch.state) { in setup_iom2()
1250 msg[1] = ch->dpath + 2; in setup_iom2()
1251 msg[3] = ch->dpath + 2; in setup_iom2()
1261 if (test_bit(FLG_DTMFSEND, &ch->bch.Flags)) in setup_iom2()
1266 send_mbox(ch->is, dps | ISAR_HIS_IOM2CFG, cmsb, 5, msg); in setup_iom2()
1268 send_mbox(ch->is, dps | ISAR_HIS_IOM2REQ, 0, 0, NULL); in setup_iom2()
1276 if (ch->bch.state == ISDN_P_NONE) { /* New Setup */ in modeisar()
1279 if (!ch->dpath) in modeisar()
1282 test_and_clear_bit(FLG_HDLC, &ch->bch.Flags); in modeisar()
1283 test_and_clear_bit(FLG_TRANSPARENT, &ch->bch.Flags); in modeisar()
1288 if (!test_and_set_bit(ISAR_DP2_USE, &ch->is->Flags)) in modeisar()
1289 ch->dpath = 2; in modeisar()
1291 &ch->is->Flags)) in modeisar()
1292 ch->dpath = 1; in modeisar()
1295 return -EBUSY; in modeisar()
1298 test_and_set_bit(FLG_HDLC, &ch->bch.Flags); in modeisar()
1301 &ch->bch.Flags); in modeisar()
1307 if (!test_and_set_bit(ISAR_DP1_USE, &ch->is->Flags)) in modeisar()
1308 ch->dpath = 1; in modeisar()
1311 "only with DP1\n", ch->is->name); in modeisar()
1312 return -EBUSY; in modeisar()
1316 pr_info("%s: protocol not known %x\n", ch->is->name, in modeisar()
1318 return -ENOPROTOOPT; in modeisar()
1321 pr_debug("%s: ISAR ch%d dp%d protocol %x->%x\n", ch->is->name, in modeisar()
1322 ch->bch.nr, ch->dpath, ch->bch.state, bprotocol); in modeisar()
1323 ch->bch.state = bprotocol; in modeisar()
1327 if (ch->bch.state == ISDN_P_NONE) { in modeisar()
1329 if (ch->dpath == 1) in modeisar()
1330 test_and_clear_bit(ISAR_DP1_USE, &ch->is->Flags); in modeisar()
1331 else if (ch->dpath == 2) in modeisar()
1332 test_and_clear_bit(ISAR_DP2_USE, &ch->is->Flags); in modeisar()
1333 ch->dpath = 0; in modeisar()
1334 ch->is->ctrl(ch->is->hw, HW_DEACT_IND, ch->bch.nr); in modeisar()
1336 ch->is->ctrl(ch->is->hw, HW_ACTIVATE_IND, ch->bch.nr); in modeisar()
1341 isar_pump_cmd(struct isar_ch *ch, u32 cmd, u8 para) in isar_pump_cmd() argument
1343 u8 dps = SET_DPS(ch->dpath); in isar_pump_cmd()
1347 ch->is->name, cmd, para, ch->bch.state); in isar_pump_cmd()
1348 switch (cmd) { in isar_pump_cmd()
1350 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1354 ch->state = STFAX_LINE; in isar_pump_cmd()
1355 ch->cmd = ctrl; in isar_pump_cmd()
1356 ch->mod = para; in isar_pump_cmd()
1357 ch->newmod = 0; in isar_pump_cmd()
1358 ch->newcmd = 0; in isar_pump_cmd()
1359 ch->try_mod = 3; in isar_pump_cmd()
1360 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1361 (ch->cmd == PCTRL_CMD_FTM) && (ch->mod == para)) in isar_pump_cmd()
1364 ch->newmod = para; in isar_pump_cmd()
1365 ch->newcmd = PCTRL_CMD_FTM; in isar_pump_cmd()
1368 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1372 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1376 ch->state = STFAX_LINE; in isar_pump_cmd()
1377 ch->cmd = ctrl; in isar_pump_cmd()
1378 ch->mod = para; in isar_pump_cmd()
1379 ch->newmod = 0; in isar_pump_cmd()
1380 ch->newcmd = 0; in isar_pump_cmd()
1381 ch->try_mod = 3; in isar_pump_cmd()
1382 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1383 (ch->cmd == PCTRL_CMD_FTH) && (ch->mod == para)) in isar_pump_cmd()
1386 ch->newmod = para; in isar_pump_cmd()
1387 ch->newcmd = PCTRL_CMD_FTH; in isar_pump_cmd()
1390 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1394 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1398 ch->state = STFAX_LINE; in isar_pump_cmd()
1399 ch->cmd = ctrl; in isar_pump_cmd()
1400 ch->mod = para; in isar_pump_cmd()
1401 ch->newmod = 0; in isar_pump_cmd()
1402 ch->newcmd = 0; in isar_pump_cmd()
1403 ch->try_mod = 3; in isar_pump_cmd()
1404 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1405 (ch->cmd == PCTRL_CMD_FRM) && (ch->mod == para)) in isar_pump_cmd()
1408 ch->newmod = para; in isar_pump_cmd()
1409 ch->newcmd = PCTRL_CMD_FRM; in isar_pump_cmd()
1412 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1416 if (ch->state == STFAX_READY) { in isar_pump_cmd()
1420 ch->state = STFAX_LINE; in isar_pump_cmd()
1421 ch->cmd = ctrl; in isar_pump_cmd()
1422 ch->mod = para; in isar_pump_cmd()
1423 ch->newmod = 0; in isar_pump_cmd()
1424 ch->newcmd = 0; in isar_pump_cmd()
1425 ch->try_mod = 3; in isar_pump_cmd()
1426 } else if ((ch->state == STFAX_ACTIV) && in isar_pump_cmd()
1427 (ch->cmd == PCTRL_CMD_FRH) && (ch->mod == para)) in isar_pump_cmd()
1430 ch->newmod = para; in isar_pump_cmd()
1431 ch->newcmd = PCTRL_CMD_FRH; in isar_pump_cmd()
1434 ch->state = STFAX_ESCAPE; in isar_pump_cmd()
1444 send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1); in isar_pump_cmd()
1459 isar->ch[i].mml = msg; in isar_setup()
1460 isar->ch[i].bch.state = 0; in isar_setup()
1461 isar->ch[i].dpath = i + 1; in isar_setup()
1462 modeisar(&isar->ch[i], ISDN_P_NONE); in isar_setup()
1471 int ret = -EINVAL; in isar_l2l1()
1476 switch (hh->prim) { in isar_l2l1()
1478 spin_lock_irqsave(ich->is->hwlock, flags); in isar_l2l1()
1484 spin_unlock_irqrestore(ich->is->hwlock, flags); in isar_l2l1()
1487 spin_lock_irqsave(ich->is->hwlock, flags); in isar_l2l1()
1488 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) in isar_l2l1()
1489 ret = modeisar(ich, ch->protocol); in isar_l2l1()
1492 spin_unlock_irqrestore(ich->is->hwlock, flags); in isar_l2l1()
1498 spin_lock_irqsave(ich->is->hwlock, flags); in isar_l2l1()
1501 spin_unlock_irqrestore(ich->is->hwlock, flags); in isar_l2l1()
1507 val = (u32 *)skb->data; in isar_l2l1()
1508 pr_debug("%s: PH_CONTROL | REQUEST %x/%x\n", ich->is->name, in isar_l2l1()
1509 hh->id, *val); in isar_l2l1()
1510 if ((hh->id == 0) && ((*val & ~DTMF_TONE_MASK) == in isar_l2l1()
1512 if (bch->state == ISDN_P_B_L2DTMF) { in isar_l2l1()
1520 tt -= 7; in isar_l2l1()
1522 spin_lock_irqsave(ich->is->hwlock, flags); in isar_l2l1()
1524 spin_unlock_irqrestore(ich->is->hwlock, flags); in isar_l2l1()
1527 __func__, bch->state); in isar_l2l1()
1528 return -EINVAL; in isar_l2l1()
1530 } else if ((hh->id == HW_MOD_FRM) || (hh->id == HW_MOD_FRH) || in isar_l2l1()
1531 (hh->id == HW_MOD_FTM) || (hh->id == HW_MOD_FTH)) { in isar_l2l1()
1536 test_bit(FLG_INITIALIZED, &bch->Flags)) { in isar_l2l1()
1537 pr_debug("%s: isar: new mod\n", ich->is->name); in isar_l2l1()
1538 isar_pump_cmd(ich, hh->id, *val); in isar_l2l1()
1542 ich->is->name); in isar_l2l1()
1543 ret = -EINVAL; in isar_l2l1()
1545 } else if (hh->id == HW_MOD_LASTDATA) in isar_l2l1()
1546 test_and_set_bit(FLG_DLEETX, &bch->Flags); in isar_l2l1()
1549 ich->is->name, hh->id); in isar_l2l1()
1550 ret = -EINVAL; in isar_l2l1()
1555 ich->is->name, __func__, hh->prim, hh->id); in isar_l2l1()
1556 ret = -EINVAL; in isar_l2l1()
1570 isar_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg) in isar_bctrl() argument
1574 int ret = -EINVAL; in isar_bctrl()
1577 pr_debug("%s: %s cmd:%x %p\n", ich->is->name, __func__, cmd, arg); in isar_bctrl()
1578 switch (cmd) { in isar_bctrl()
1580 test_and_clear_bit(FLG_OPEN, &bch->Flags); in isar_bctrl()
1581 cancel_work_sync(&bch->workq); in isar_bctrl()
1582 spin_lock_irqsave(ich->is->hwlock, flags); in isar_bctrl()
1585 spin_unlock_irqrestore(ich->is->hwlock, flags); in isar_bctrl()
1586 ch->protocol = ISDN_P_NONE; in isar_bctrl()
1587 ch->peer = NULL; in isar_bctrl()
1588 module_put(ich->is->owner); in isar_bctrl()
1596 ich->is->name, __func__, cmd); in isar_bctrl()
1604 modeisar(&isar->ch[0], ISDN_P_NONE); in free_isar()
1605 modeisar(&isar->ch[1], ISDN_P_NONE); in free_isar()
1606 del_timer(&isar->ch[0].ftimer); in free_isar()
1607 del_timer(&isar->ch[1].ftimer); in free_isar()
1608 test_and_clear_bit(FLG_INITIALIZED, &isar->ch[0].bch.Flags); in free_isar()
1609 test_and_clear_bit(FLG_INITIALIZED, &isar->ch[1].bch.Flags); in free_isar()
1615 int cnt = 3; in init_isar() local
1617 while (cnt--) { in init_isar()
1618 isar->version = ISARVersion(isar); in init_isar()
1619 if (isar->ch[0].bch.debug & DEBUG_HW) in init_isar()
1621 isar->name, isar->version, 3 - cnt); in init_isar()
1622 if (isar->version == 1) in init_isar()
1624 isar->ctrl(isar->hw, HW_RESET_REQ, 0); in init_isar()
1626 if (isar->version != 1) in init_isar()
1627 return -EINVAL; in init_isar()
1628 timer_setup(&isar->ch[0].ftimer, ftimer_handler, 0); in init_isar()
1629 test_and_set_bit(FLG_INITIALIZED, &isar->ch[0].bch.Flags); in init_isar()
1630 timer_setup(&isar->ch[1].ftimer, ftimer_handler, 0); in init_isar()
1631 test_and_set_bit(FLG_INITIALIZED, &isar->ch[1].bch.Flags); in init_isar()
1640 if (rq->adr.channel == 0 || rq->adr.channel > 2) in isar_open()
1641 return -EINVAL; in isar_open()
1642 if (rq->protocol == ISDN_P_NONE) in isar_open()
1643 return -EINVAL; in isar_open()
1644 bch = &isar->ch[rq->adr.channel - 1].bch; in isar_open()
1645 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in isar_open()
1646 return -EBUSY; /* b-channel can be only open once */ in isar_open()
1647 bch->ch.protocol = rq->protocol; in isar_open()
1648 rq->ch = &bch->ch; in isar_open()
1657 isar->hw = hw; in mISDNisar_init()
1659 isar->ch[i].bch.nr = i + 1; in mISDNisar_init()
1660 mISDN_initbchannel(&isar->ch[i].bch, MAX_DATA_MEM, 32); in mISDNisar_init()
1661 isar->ch[i].bch.ch.nr = i + 1; in mISDNisar_init()
1662 isar->ch[i].bch.ch.send = &isar_l2l1; in mISDNisar_init()
1663 isar->ch[i].bch.ch.ctrl = isar_bctrl; in mISDNisar_init()
1664 isar->ch[i].bch.hw = hw; in mISDNisar_init()
1665 isar->ch[i].is = isar; in mISDNisar_init()
1668 isar->init = &init_isar; in mISDNisar_init()
1669 isar->release = &free_isar; in mISDNisar_init()
1670 isar->firmware = &load_firmware; in mISDNisar_init()
1671 isar->open = &isar_open; in mISDNisar_init()