Lines Matching full:fc

173 	struct fritzcard *fc = p;  in ReadISAC_V1()  local
176 outb(idx, fc->addr + CHIP_INDEX); in ReadISAC_V1()
177 return inb(fc->addr + CHIP_WINDOW + (offset & 0xf)); in ReadISAC_V1()
183 struct fritzcard *fc = p; in WriteISAC_V1() local
186 outb(idx, fc->addr + CHIP_INDEX); in WriteISAC_V1()
187 outb(value, fc->addr + CHIP_WINDOW + (offset & 0xf)); in WriteISAC_V1()
193 struct fritzcard *fc = p; in ReadFiFoISAC_V1() local
195 outb(AVM_ISAC_FIFO, fc->addr + CHIP_INDEX); in ReadFiFoISAC_V1()
196 insb(fc->addr + CHIP_WINDOW, data, size); in ReadFiFoISAC_V1()
202 struct fritzcard *fc = p; in WriteFiFoISAC_V1() local
204 outb(AVM_ISAC_FIFO, fc->addr + CHIP_INDEX); in WriteFiFoISAC_V1()
205 outsb(fc->addr + CHIP_WINDOW, data, size); in WriteFiFoISAC_V1()
211 struct fritzcard *fc = p; in ReadISAC_V2() local
213 outl(offset, fc->addr + AVM_ISACX_INDEX); in ReadISAC_V2()
214 return 0xff & inl(fc->addr + AVM_ISACX_DATA); in ReadISAC_V2()
220 struct fritzcard *fc = p; in WriteISAC_V2() local
222 outl(offset, fc->addr + AVM_ISACX_INDEX); in WriteISAC_V2()
223 outl(value, fc->addr + AVM_ISACX_DATA); in WriteISAC_V2()
229 struct fritzcard *fc = p; in ReadFiFoISAC_V2() local
232 outl(off, fc->addr + AVM_ISACX_INDEX); in ReadFiFoISAC_V2()
234 data[i] = 0xff & inl(fc->addr + AVM_ISACX_DATA); in ReadFiFoISAC_V2()
240 struct fritzcard *fc = p; in WriteFiFoISAC_V2() local
243 outl(off, fc->addr + AVM_ISACX_INDEX); in WriteFiFoISAC_V2()
245 outl(data[i], fc->addr + AVM_ISACX_DATA); in WriteFiFoISAC_V2()
249 Sel_BCS(struct fritzcard *fc, u32 channel) in Sel_BCS() argument
251 if (test_bit(FLG_ACTIVE, &fc->bch[0].Flags) && in Sel_BCS()
252 (fc->bch[0].nr & channel)) in Sel_BCS()
253 return &fc->bch[0]; in Sel_BCS()
254 else if (test_bit(FLG_ACTIVE, &fc->bch[1].Flags) && in Sel_BCS()
255 (fc->bch[1].nr & channel)) in Sel_BCS()
256 return &fc->bch[1]; in Sel_BCS()
262 __write_ctrl_pci(struct fritzcard *fc, struct hdlc_hw *hdlc, u32 channel) { in __write_ctrl_pci() argument
265 outl(idx, fc->addr + CHIP_INDEX); in __write_ctrl_pci()
266 outl(hdlc->ctrl.ctrl, fc->addr + CHIP_WINDOW + HDLC_STATUS); in __write_ctrl_pci()
270 __write_ctrl_pciv2(struct fritzcard *fc, struct hdlc_hw *hdlc, u32 channel) { in __write_ctrl_pciv2() argument
271 outl(hdlc->ctrl.ctrl, fc->addr + (channel == 2 ? AVM_HDLC_STATUS_2 : in __write_ctrl_pciv2()
277 struct fritzcard *fc = bch->hw; in write_ctrl() local
280 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in write_ctrl()
281 pr_debug("%s: hdlc %c wr%x ctrl %x\n", fc->name, '@' + bch->nr, in write_ctrl()
283 switch (fc->type) { in write_ctrl()
285 __write_ctrl_pciv2(fc, hdlc, bch->nr); in write_ctrl()
288 __write_ctrl_pci(fc, hdlc, bch->nr); in write_ctrl()
310 read_status(struct fritzcard *fc, u32 channel) in read_status() argument
312 switch (fc->type) { in read_status()
314 return __read_status_pciv2(fc->addr, channel); in read_status()
316 return __read_status_pci(fc->addr, channel); in read_status()
323 enable_hwirq(struct fritzcard *fc) in enable_hwirq() argument
325 fc->ctrlreg |= AVM_STATUS0_ENA_IRQ; in enable_hwirq()
326 outb(fc->ctrlreg, fc->addr + 2); in enable_hwirq()
330 disable_hwirq(struct fritzcard *fc) in disable_hwirq() argument
332 fc->ctrlreg &= ~AVM_STATUS0_ENA_IRQ; in disable_hwirq()
333 outb(fc->ctrlreg, fc->addr + 2); in disable_hwirq()
339 struct fritzcard *fc = bch->hw; in modehdlc() local
343 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in modehdlc()
344 pr_debug("%s: hdlc %c protocol %x-->%x ch %d\n", fc->name, in modehdlc()
347 mode = (fc->type == AVM_FRITZ_PCIV2) ? HDLC_FIFO_SIZE_128 : 0; in modehdlc()
384 pr_info("%s: protocol not known %x\n", fc->name, protocol); in modehdlc()
397 struct fritzcard *fc = bch->hw; in hdlc_empty_fifo() local
399 pr_debug("%s: %s %d\n", fc->name, __func__, count); in hdlc_empty_fifo()
407 fc->name, bch->nr, count); in hdlc_empty_fifo()
413 if (fc->type == AVM_FRITZ_PCIV2) in hdlc_empty_fifo()
414 addr = fc->addr + (bch->nr == 2 ? in hdlc_empty_fifo()
417 addr = fc->addr + CHIP_WINDOW; in hdlc_empty_fifo()
418 outl(bch->nr == 2 ? AVM_HDLC_2 : AVM_HDLC_1, fc->addr); in hdlc_empty_fifo()
430 snprintf(fc->log, LOG_SIZE, "B%1d-recv %s %d ", in hdlc_empty_fifo()
431 bch->nr, fc->name, count); in hdlc_empty_fifo()
432 print_hex_dump_bytes(fc->log, DUMP_PREFIX_OFFSET, p, count); in hdlc_empty_fifo()
439 struct fritzcard *fc = bch->hw; in hdlc_fill_fifo() local
447 hdlc = &fc->hdlc[idx]; in hdlc_fill_fifo()
448 fs = (fc->type == AVM_FRITZ_PCIV2) ? in hdlc_fill_fifo()
471 pr_debug("%s.B%d: %d/%d/%d", fc->name, bch->nr, count, in hdlc_fill_fifo()
475 pr_debug("%s.B%d: fillempty %d\n", fc->name, bch->nr, count); in hdlc_fill_fifo()
478 if (fc->type == AVM_FRITZ_PCIV2) { in hdlc_fill_fifo()
479 __write_ctrl_pciv2(fc, hdlc, bch->nr); in hdlc_fill_fifo()
480 addr = fc->addr + (bch->nr == 2 ? in hdlc_fill_fifo()
483 __write_ctrl_pci(fc, hdlc, bch->nr); in hdlc_fill_fifo()
484 addr = fc->addr + CHIP_WINDOW; in hdlc_fill_fifo()
501 snprintf(fc->log, LOG_SIZE, "B%1d-send %s %d ", in hdlc_fill_fifo()
502 bch->nr, fc->name, count); in hdlc_fill_fifo()
503 print_hex_dump_bytes(fc->log, DUMP_PREFIX_OFFSET, p, count); in hdlc_fill_fifo()
526 struct fritzcard *fc = bch->hw; in HDLC_irq() local
531 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in HDLC_irq()
532 pr_debug("%s: ch%d stat %#x\n", fc->name, bch->nr, stat); in HDLC_irq()
533 if (fc->type == AVM_FRITZ_PCIV2) { in HDLC_irq()
543 fc->name, bch->nr, stat); in HDLC_irq()
566 fc->name); in HDLC_irq()
578 pr_warn("%s: ch%d stat %x XDU %s\n", fc->name, bch->nr, in HDLC_irq()
597 HDLC_irq_main(struct fritzcard *fc) in HDLC_irq_main() argument
602 stat = read_status(fc, 1); in HDLC_irq_main()
604 bch = Sel_BCS(fc, 1); in HDLC_irq_main()
608 pr_debug("%s: spurious ch1 IRQ\n", fc->name); in HDLC_irq_main()
610 stat = read_status(fc, 2); in HDLC_irq_main()
612 bch = Sel_BCS(fc, 2); in HDLC_irq_main()
616 pr_debug("%s: spurious ch2 IRQ\n", fc->name); in HDLC_irq_main()
623 struct fritzcard *fc = dev_id; in avm_fritz_interrupt() local
627 spin_lock(&fc->lock); in avm_fritz_interrupt()
628 sval = inb(fc->addr + 2); in avm_fritz_interrupt()
629 pr_debug("%s: irq stat0 %x\n", fc->name, sval); in avm_fritz_interrupt()
632 spin_unlock(&fc->lock); in avm_fritz_interrupt()
635 fc->irqcnt++; in avm_fritz_interrupt()
638 val = ReadISAC_V1(fc, ISAC_ISTA); in avm_fritz_interrupt()
639 mISDNisac_irq(&fc->isac, val); in avm_fritz_interrupt()
642 HDLC_irq_main(fc); in avm_fritz_interrupt()
643 spin_unlock(&fc->lock); in avm_fritz_interrupt()
650 struct fritzcard *fc = dev_id; in avm_fritzv2_interrupt() local
654 spin_lock(&fc->lock); in avm_fritzv2_interrupt()
655 sval = inb(fc->addr + 2); in avm_fritzv2_interrupt()
656 pr_debug("%s: irq stat0 %x\n", fc->name, sval); in avm_fritzv2_interrupt()
659 spin_unlock(&fc->lock); in avm_fritzv2_interrupt()
662 fc->irqcnt++; in avm_fritzv2_interrupt()
665 HDLC_irq_main(fc); in avm_fritzv2_interrupt()
667 val = ReadISAC_V2(fc, ISACX_ISTA); in avm_fritzv2_interrupt()
668 mISDNisac_irq(&fc->isac, val); in avm_fritzv2_interrupt()
671 pr_debug("%s: timer irq\n", fc->name); in avm_fritzv2_interrupt()
672 outb(fc->ctrlreg | AVM_STATUS0_RES_TIMER, fc->addr + 2); in avm_fritzv2_interrupt()
674 outb(fc->ctrlreg, fc->addr + 2); in avm_fritzv2_interrupt()
676 spin_unlock(&fc->lock); in avm_fritzv2_interrupt()
684 struct fritzcard *fc = bch->hw; in avm_l2l1B() local
691 spin_lock_irqsave(&fc->lock, flags); in avm_l2l1B()
697 spin_unlock_irqrestore(&fc->lock, flags); in avm_l2l1B()
700 spin_lock_irqsave(&fc->lock, flags); in avm_l2l1B()
705 spin_unlock_irqrestore(&fc->lock, flags); in avm_l2l1B()
711 spin_lock_irqsave(&fc->lock, flags); in avm_l2l1B()
714 spin_unlock_irqrestore(&fc->lock, flags); in avm_l2l1B()
726 inithdlc(struct fritzcard *fc) in inithdlc() argument
728 modehdlc(&fc->bch[0], -1); in inithdlc()
729 modehdlc(&fc->bch[1], -1); in inithdlc()
733 clear_pending_hdlc_ints(struct fritzcard *fc) in clear_pending_hdlc_ints() argument
737 val = read_status(fc, 1); in clear_pending_hdlc_ints()
738 pr_debug("%s: HDLC 1 STA %x\n", fc->name, val); in clear_pending_hdlc_ints()
739 val = read_status(fc, 2); in clear_pending_hdlc_ints()
740 pr_debug("%s: HDLC 2 STA %x\n", fc->name, val); in clear_pending_hdlc_ints()
744 reset_avm(struct fritzcard *fc) in reset_avm() argument
746 switch (fc->type) { in reset_avm()
748 fc->ctrlreg = AVM_STATUS0_RESET | AVM_STATUS0_DIS_TIMER; in reset_avm()
751 fc->ctrlreg = AVM_STATUS0_RESET; in reset_avm()
755 pr_notice("%s: reset\n", fc->name); in reset_avm()
756 disable_hwirq(fc); in reset_avm()
758 switch (fc->type) { in reset_avm()
760 fc->ctrlreg = AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER; in reset_avm()
761 disable_hwirq(fc); in reset_avm()
762 outb(AVM_STATUS1_ENA_IOM, fc->addr + 3); in reset_avm()
765 fc->ctrlreg = 0; in reset_avm()
766 disable_hwirq(fc); in reset_avm()
771 pr_notice("%s: S0/S1 %x/%x\n", fc->name, in reset_avm()
772 inb(fc->addr + 2), inb(fc->addr + 3)); in reset_avm()
776 init_card(struct fritzcard *fc) in init_card() argument
781 reset_avm(fc); /* disable IRQ */ in init_card()
782 if (fc->type == AVM_FRITZ_PCIV2) in init_card()
783 ret = request_irq(fc->irq, avm_fritzv2_interrupt, in init_card()
784 IRQF_SHARED, fc->name, fc); in init_card()
786 ret = request_irq(fc->irq, avm_fritz_interrupt, in init_card()
787 IRQF_SHARED, fc->name, fc); in init_card()
790 fc->name, fc->irq); in init_card()
794 spin_lock_irqsave(&fc->lock, flags); in init_card()
795 ret = fc->isac.init(&fc->isac); in init_card()
797 spin_unlock_irqrestore(&fc->lock, flags); in init_card()
799 fc->name, ret); in init_card()
802 clear_pending_hdlc_ints(fc); in init_card()
803 inithdlc(fc); in init_card()
804 enable_hwirq(fc); in init_card()
806 if (fc->type == AVM_FRITZ_PCIV2) { in init_card()
807 WriteISAC_V2(fc, ISACX_MASK, 0); in init_card()
808 WriteISAC_V2(fc, ISACX_CMDRD, 0x41); in init_card()
810 WriteISAC_V1(fc, ISAC_MASK, 0); in init_card()
811 WriteISAC_V1(fc, ISAC_CMDR, 0x41); in init_card()
813 spin_unlock_irqrestore(&fc->lock, flags); in init_card()
817 pr_notice("%s: IRQ %d count %d\n", fc->name, in init_card()
818 fc->irq, fc->irqcnt); in init_card()
819 if (!fc->irqcnt) { in init_card()
821 fc->name, fc->irq, 3 - cnt); in init_card()
822 reset_avm(fc); in init_card()
826 free_irq(fc->irq, fc); in init_card()
840 struct fritzcard *fc = bch->hw; in avm_bctrl() local
844 pr_debug("%s: %s cmd:%x %p\n", fc->name, __func__, cmd, arg); in avm_bctrl()
849 spin_lock_irqsave(&fc->lock, flags); in avm_bctrl()
852 spin_unlock_irqrestore(&fc->lock, flags); in avm_bctrl()
862 pr_info("%s: %s unknown prim(%x)\n", fc->name, __func__, cmd); in avm_bctrl()
868 channel_ctrl(struct fritzcard *fc, struct mISDN_ctrl_req *cq) in channel_ctrl() argument
882 ret = fc->isac.ctrl(&fc->isac, HW_TESTLOOP, cq->channel); in channel_ctrl()
885 ret = fc->isac.ctrl(&fc->isac, HW_TIMER3_VALUE, cq->p1); in channel_ctrl()
888 pr_info("%s: %s unknown Op %x\n", fc->name, __func__, cq->op); in channel_ctrl()
896 open_bchannel(struct fritzcard *fc, struct channel_req *rq) in open_bchannel() argument
904 bch = &fc->bch[rq->adr.channel - 1]; in open_bchannel()
920 struct fritzcard *fc = dch->hw; in avm_dctrl() local
924 pr_debug("%s: %s cmd:%x %p\n", fc->name, __func__, cmd, arg); in avm_dctrl()
929 err = fc->isac.open(&fc->isac, rq); in avm_dctrl()
931 err = open_bchannel(fc, rq); in avm_dctrl()
935 pr_info("%s: cannot get module\n", fc->name); in avm_dctrl()
938 pr_debug("%s: dev(%d) close from %p\n", fc->name, dch->dev.id, in avm_dctrl()
943 err = channel_ctrl(fc, arg); in avm_dctrl()
947 fc->name, __func__, cmd); in avm_dctrl()
954 setup_fritz(struct fritzcard *fc) in setup_fritz() argument
958 if (!request_region(fc->addr, 32, fc->name)) { in setup_fritz()
960 fc->name, fc->addr, fc->addr + 31); in setup_fritz()
963 switch (fc->type) { in setup_fritz()
965 val = inl(fc->addr); in setup_fritz()
966 outl(AVM_HDLC_1, fc->addr + CHIP_INDEX); in setup_fritz()
967 ver = inl(fc->addr + CHIP_WINDOW + HDLC_STATUS) >> 24; in setup_fritz()
969 pr_notice("%s: PCI stat %#x\n", fc->name, val); in setup_fritz()
970 pr_notice("%s: PCI Class %X Rev %d\n", fc->name, in setup_fritz()
972 pr_notice("%s: HDLC version %x\n", fc->name, ver & 0xf); in setup_fritz()
974 ASSIGN_FUNC(V1, ISAC, fc->isac); in setup_fritz()
975 fc->isac.type = IPAC_TYPE_ISAC; in setup_fritz()
978 val = inl(fc->addr); in setup_fritz()
979 ver = inl(fc->addr + AVM_HDLC_STATUS_1) >> 24; in setup_fritz()
981 pr_notice("%s: PCI V2 stat %#x\n", fc->name, val); in setup_fritz()
982 pr_notice("%s: PCI V2 Class %X Rev %d\n", fc->name, in setup_fritz()
984 pr_notice("%s: HDLC version %x\n", fc->name, ver & 0xf); in setup_fritz()
986 ASSIGN_FUNC(V2, ISAC, fc->isac); in setup_fritz()
987 fc->isac.type = IPAC_TYPE_ISACX; in setup_fritz()
990 release_region(fc->addr, 32); in setup_fritz()
991 pr_info("%s: AVM unknown type %d\n", fc->name, fc->type); in setup_fritz()
994 pr_notice("%s: %s config irq:%d base:0x%X\n", fc->name, in setup_fritz()
995 (fc->type == AVM_FRITZ_PCI) ? "AVM Fritz!CARD PCI" : in setup_fritz()
996 "AVM Fritz!CARD PCIv2", fc->irq, fc->addr); in setup_fritz()