Lines Matching refs:fc

185 	struct fritzcard *fc = p;  in ReadISAC_V1()  local
188 outb(idx, fc->addr + CHIP_INDEX); in ReadISAC_V1()
189 return inb(fc->addr + CHIP_WINDOW + (offset & 0xf)); in ReadISAC_V1()
195 struct fritzcard *fc = p; in WriteISAC_V1() local
198 outb(idx, fc->addr + CHIP_INDEX); in WriteISAC_V1()
199 outb(value, fc->addr + CHIP_WINDOW + (offset & 0xf)); in WriteISAC_V1()
205 struct fritzcard *fc = p; in ReadFiFoISAC_V1() local
207 outb(AVM_ISAC_FIFO, fc->addr + CHIP_INDEX); in ReadFiFoISAC_V1()
208 insb(fc->addr + CHIP_WINDOW, data, size); in ReadFiFoISAC_V1()
214 struct fritzcard *fc = p; in WriteFiFoISAC_V1() local
216 outb(AVM_ISAC_FIFO, fc->addr + CHIP_INDEX); in WriteFiFoISAC_V1()
217 outsb(fc->addr + CHIP_WINDOW, data, size); in WriteFiFoISAC_V1()
223 struct fritzcard *fc = p; in ReadISAC_V2() local
225 outl(offset, fc->addr + AVM_ISACX_INDEX); in ReadISAC_V2()
226 return 0xff & inl(fc->addr + AVM_ISACX_DATA); in ReadISAC_V2()
232 struct fritzcard *fc = p; in WriteISAC_V2() local
234 outl(offset, fc->addr + AVM_ISACX_INDEX); in WriteISAC_V2()
235 outl(value, fc->addr + AVM_ISACX_DATA); in WriteISAC_V2()
241 struct fritzcard *fc = p; in ReadFiFoISAC_V2() local
244 outl(off, fc->addr + AVM_ISACX_INDEX); in ReadFiFoISAC_V2()
246 data[i] = 0xff & inl(fc->addr + AVM_ISACX_DATA); in ReadFiFoISAC_V2()
252 struct fritzcard *fc = p; in WriteFiFoISAC_V2() local
255 outl(off, fc->addr + AVM_ISACX_INDEX); in WriteFiFoISAC_V2()
257 outl(data[i], fc->addr + AVM_ISACX_DATA); in WriteFiFoISAC_V2()
261 Sel_BCS(struct fritzcard *fc, u32 channel) in Sel_BCS() argument
263 if (test_bit(FLG_ACTIVE, &fc->bch[0].Flags) && in Sel_BCS()
264 (fc->bch[0].nr & channel)) in Sel_BCS()
265 return &fc->bch[0]; in Sel_BCS()
266 else if (test_bit(FLG_ACTIVE, &fc->bch[1].Flags) && in Sel_BCS()
267 (fc->bch[1].nr & channel)) in Sel_BCS()
268 return &fc->bch[1]; in Sel_BCS()
274 __write_ctrl_pci(struct fritzcard *fc, struct hdlc_hw *hdlc, u32 channel) { in __write_ctrl_pci() argument
277 outl(idx, fc->addr + CHIP_INDEX); in __write_ctrl_pci()
278 outl(hdlc->ctrl.ctrl, fc->addr + CHIP_WINDOW + HDLC_STATUS); in __write_ctrl_pci()
282 __write_ctrl_pciv2(struct fritzcard *fc, struct hdlc_hw *hdlc, u32 channel) { in __write_ctrl_pciv2() argument
283 outl(hdlc->ctrl.ctrl, fc->addr + (channel == 2 ? AVM_HDLC_STATUS_2 : in __write_ctrl_pciv2()
289 struct fritzcard *fc = bch->hw; in write_ctrl() local
292 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in write_ctrl()
293 pr_debug("%s: hdlc %c wr%x ctrl %x\n", fc->name, '@' + bch->nr, in write_ctrl()
295 switch (fc->type) { in write_ctrl()
297 __write_ctrl_pciv2(fc, hdlc, bch->nr); in write_ctrl()
300 __write_ctrl_pci(fc, hdlc, bch->nr); in write_ctrl()
322 read_status(struct fritzcard *fc, u32 channel) in read_status() argument
324 switch (fc->type) { in read_status()
326 return __read_status_pciv2(fc->addr, channel); in read_status()
328 return __read_status_pci(fc->addr, channel); in read_status()
335 enable_hwirq(struct fritzcard *fc) in enable_hwirq() argument
337 fc->ctrlreg |= AVM_STATUS0_ENA_IRQ; in enable_hwirq()
338 outb(fc->ctrlreg, fc->addr + 2); in enable_hwirq()
342 disable_hwirq(struct fritzcard *fc) in disable_hwirq() argument
344 fc->ctrlreg &= ~AVM_STATUS0_ENA_IRQ; in disable_hwirq()
345 outb(fc->ctrlreg, fc->addr + 2); in disable_hwirq()
351 struct fritzcard *fc = bch->hw; in modehdlc() local
355 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in modehdlc()
356 pr_debug("%s: hdlc %c protocol %x-->%x ch %d\n", fc->name, in modehdlc()
359 mode = (fc->type == AVM_FRITZ_PCIV2) ? HDLC_FIFO_SIZE_128 : 0; in modehdlc()
395 pr_info("%s: protocol not known %x\n", fc->name, protocol); in modehdlc()
408 struct fritzcard *fc = bch->hw; in hdlc_empty_fifo() local
410 pr_debug("%s: %s %d\n", fc->name, __func__, count); in hdlc_empty_fifo()
418 fc->name, bch->nr, count); in hdlc_empty_fifo()
424 if (fc->type == AVM_FRITZ_PCIV2) in hdlc_empty_fifo()
425 addr = fc->addr + (bch->nr == 2 ? in hdlc_empty_fifo()
428 addr = fc->addr + CHIP_WINDOW; in hdlc_empty_fifo()
429 outl(bch->nr == 2 ? AVM_HDLC_2 : AVM_HDLC_1, fc->addr); in hdlc_empty_fifo()
441 snprintf(fc->log, LOG_SIZE, "B%1d-recv %s %d ", in hdlc_empty_fifo()
442 bch->nr, fc->name, count); in hdlc_empty_fifo()
443 print_hex_dump_bytes(fc->log, DUMP_PREFIX_OFFSET, p, count); in hdlc_empty_fifo()
450 struct fritzcard *fc = bch->hw; in hdlc_fill_fifo() local
458 hdlc = &fc->hdlc[idx]; in hdlc_fill_fifo()
459 fs = (fc->type == AVM_FRITZ_PCIV2) ? in hdlc_fill_fifo()
482 pr_debug("%s.B%d: %d/%d/%d", fc->name, bch->nr, count, in hdlc_fill_fifo()
486 pr_debug("%s.B%d: fillempty %d\n", fc->name, bch->nr, count); in hdlc_fill_fifo()
489 if (fc->type == AVM_FRITZ_PCIV2) { in hdlc_fill_fifo()
490 __write_ctrl_pciv2(fc, hdlc, bch->nr); in hdlc_fill_fifo()
491 addr = fc->addr + (bch->nr == 2 ? in hdlc_fill_fifo()
494 __write_ctrl_pci(fc, hdlc, bch->nr); in hdlc_fill_fifo()
495 addr = fc->addr + CHIP_WINDOW; in hdlc_fill_fifo()
512 snprintf(fc->log, LOG_SIZE, "B%1d-send %s %d ", in hdlc_fill_fifo()
513 bch->nr, fc->name, count); in hdlc_fill_fifo()
514 print_hex_dump_bytes(fc->log, DUMP_PREFIX_OFFSET, p, count); in hdlc_fill_fifo()
538 struct fritzcard *fc = bch->hw; in HDLC_irq() local
543 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in HDLC_irq()
544 pr_debug("%s: ch%d stat %#x\n", fc->name, bch->nr, stat); in HDLC_irq()
545 if (fc->type == AVM_FRITZ_PCIV2) { in HDLC_irq()
555 fc->name, bch->nr, stat); in HDLC_irq()
578 fc->name); in HDLC_irq()
590 pr_warning("%s: ch%d stat %x XDU %s\n", fc->name, bch->nr, in HDLC_irq()
609 HDLC_irq_main(struct fritzcard *fc) in HDLC_irq_main() argument
614 stat = read_status(fc, 1); in HDLC_irq_main()
616 bch = Sel_BCS(fc, 1); in HDLC_irq_main()
620 pr_debug("%s: spurious ch1 IRQ\n", fc->name); in HDLC_irq_main()
622 stat = read_status(fc, 2); in HDLC_irq_main()
624 bch = Sel_BCS(fc, 2); in HDLC_irq_main()
628 pr_debug("%s: spurious ch2 IRQ\n", fc->name); in HDLC_irq_main()
635 struct fritzcard *fc = dev_id; in avm_fritz_interrupt() local
639 spin_lock(&fc->lock); in avm_fritz_interrupt()
640 sval = inb(fc->addr + 2); in avm_fritz_interrupt()
641 pr_debug("%s: irq stat0 %x\n", fc->name, sval); in avm_fritz_interrupt()
644 spin_unlock(&fc->lock); in avm_fritz_interrupt()
647 fc->irqcnt++; in avm_fritz_interrupt()
650 val = ReadISAC_V1(fc, ISAC_ISTA); in avm_fritz_interrupt()
651 mISDNisac_irq(&fc->isac, val); in avm_fritz_interrupt()
654 HDLC_irq_main(fc); in avm_fritz_interrupt()
655 spin_unlock(&fc->lock); in avm_fritz_interrupt()
662 struct fritzcard *fc = dev_id; in avm_fritzv2_interrupt() local
666 spin_lock(&fc->lock); in avm_fritzv2_interrupt()
667 sval = inb(fc->addr + 2); in avm_fritzv2_interrupt()
668 pr_debug("%s: irq stat0 %x\n", fc->name, sval); in avm_fritzv2_interrupt()
671 spin_unlock(&fc->lock); in avm_fritzv2_interrupt()
674 fc->irqcnt++; in avm_fritzv2_interrupt()
677 HDLC_irq_main(fc); in avm_fritzv2_interrupt()
679 val = ReadISAC_V2(fc, ISACX_ISTA); in avm_fritzv2_interrupt()
680 mISDNisac_irq(&fc->isac, val); in avm_fritzv2_interrupt()
683 pr_debug("%s: timer irq\n", fc->name); in avm_fritzv2_interrupt()
684 outb(fc->ctrlreg | AVM_STATUS0_RES_TIMER, fc->addr + 2); in avm_fritzv2_interrupt()
686 outb(fc->ctrlreg, fc->addr + 2); in avm_fritzv2_interrupt()
688 spin_unlock(&fc->lock); in avm_fritzv2_interrupt()
696 struct fritzcard *fc = bch->hw; in avm_l2l1B() local
703 spin_lock_irqsave(&fc->lock, flags); in avm_l2l1B()
709 spin_unlock_irqrestore(&fc->lock, flags); in avm_l2l1B()
712 spin_lock_irqsave(&fc->lock, flags); in avm_l2l1B()
717 spin_unlock_irqrestore(&fc->lock, flags); in avm_l2l1B()
723 spin_lock_irqsave(&fc->lock, flags); in avm_l2l1B()
726 spin_unlock_irqrestore(&fc->lock, flags); in avm_l2l1B()
738 inithdlc(struct fritzcard *fc) in inithdlc() argument
740 modehdlc(&fc->bch[0], -1); in inithdlc()
741 modehdlc(&fc->bch[1], -1); in inithdlc()
745 clear_pending_hdlc_ints(struct fritzcard *fc) in clear_pending_hdlc_ints() argument
749 val = read_status(fc, 1); in clear_pending_hdlc_ints()
750 pr_debug("%s: HDLC 1 STA %x\n", fc->name, val); in clear_pending_hdlc_ints()
751 val = read_status(fc, 2); in clear_pending_hdlc_ints()
752 pr_debug("%s: HDLC 2 STA %x\n", fc->name, val); in clear_pending_hdlc_ints()
756 reset_avm(struct fritzcard *fc) in reset_avm() argument
758 switch (fc->type) { in reset_avm()
760 fc->ctrlreg = AVM_STATUS0_RESET | AVM_STATUS0_DIS_TIMER; in reset_avm()
763 fc->ctrlreg = AVM_STATUS0_RESET; in reset_avm()
767 pr_notice("%s: reset\n", fc->name); in reset_avm()
768 disable_hwirq(fc); in reset_avm()
770 switch (fc->type) { in reset_avm()
772 fc->ctrlreg = AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER; in reset_avm()
773 disable_hwirq(fc); in reset_avm()
774 outb(AVM_STATUS1_ENA_IOM, fc->addr + 3); in reset_avm()
777 fc->ctrlreg = 0; in reset_avm()
778 disable_hwirq(fc); in reset_avm()
783 pr_notice("%s: S0/S1 %x/%x\n", fc->name, in reset_avm()
784 inb(fc->addr + 2), inb(fc->addr + 3)); in reset_avm()
788 init_card(struct fritzcard *fc) in init_card() argument
793 reset_avm(fc); /* disable IRQ */ in init_card()
794 if (fc->type == AVM_FRITZ_PCIV2) in init_card()
795 ret = request_irq(fc->irq, avm_fritzv2_interrupt, in init_card()
796 IRQF_SHARED, fc->name, fc); in init_card()
798 ret = request_irq(fc->irq, avm_fritz_interrupt, in init_card()
799 IRQF_SHARED, fc->name, fc); in init_card()
802 fc->name, fc->irq); in init_card()
806 spin_lock_irqsave(&fc->lock, flags); in init_card()
807 ret = fc->isac.init(&fc->isac); in init_card()
809 spin_unlock_irqrestore(&fc->lock, flags); in init_card()
811 fc->name, ret); in init_card()
814 clear_pending_hdlc_ints(fc); in init_card()
815 inithdlc(fc); in init_card()
816 enable_hwirq(fc); in init_card()
818 if (fc->type == AVM_FRITZ_PCIV2) { in init_card()
819 WriteISAC_V2(fc, ISACX_MASK, 0); in init_card()
820 WriteISAC_V2(fc, ISACX_CMDRD, 0x41); in init_card()
822 WriteISAC_V1(fc, ISAC_MASK, 0); in init_card()
823 WriteISAC_V1(fc, ISAC_CMDR, 0x41); in init_card()
825 spin_unlock_irqrestore(&fc->lock, flags); in init_card()
829 pr_notice("%s: IRQ %d count %d\n", fc->name, in init_card()
830 fc->irq, fc->irqcnt); in init_card()
831 if (!fc->irqcnt) { in init_card()
833 fc->name, fc->irq, 3 - cnt); in init_card()
834 reset_avm(fc); in init_card()
838 free_irq(fc->irq, fc); in init_card()
852 struct fritzcard *fc = bch->hw; in avm_bctrl() local
856 pr_debug("%s: %s cmd:%x %p\n", fc->name, __func__, cmd, arg); in avm_bctrl()
861 spin_lock_irqsave(&fc->lock, flags); in avm_bctrl()
864 spin_unlock_irqrestore(&fc->lock, flags); in avm_bctrl()
874 pr_info("%s: %s unknown prim(%x)\n", fc->name, __func__, cmd); in avm_bctrl()
880 channel_ctrl(struct fritzcard *fc, struct mISDN_ctrl_req *cq) in channel_ctrl() argument
894 ret = fc->isac.ctrl(&fc->isac, HW_TESTLOOP, cq->channel); in channel_ctrl()
897 ret = fc->isac.ctrl(&fc->isac, HW_TIMER3_VALUE, cq->p1); in channel_ctrl()
900 pr_info("%s: %s unknown Op %x\n", fc->name, __func__, cq->op); in channel_ctrl()
908 open_bchannel(struct fritzcard *fc, struct channel_req *rq) in open_bchannel() argument
916 bch = &fc->bch[rq->adr.channel - 1]; in open_bchannel()
932 struct fritzcard *fc = dch->hw; in avm_dctrl() local
936 pr_debug("%s: %s cmd:%x %p\n", fc->name, __func__, cmd, arg); in avm_dctrl()
941 err = fc->isac.open(&fc->isac, rq); in avm_dctrl()
943 err = open_bchannel(fc, rq); in avm_dctrl()
947 pr_info("%s: cannot get module\n", fc->name); in avm_dctrl()
950 pr_debug("%s: dev(%d) close from %p\n", fc->name, dch->dev.id, in avm_dctrl()
955 err = channel_ctrl(fc, arg); in avm_dctrl()
959 fc->name, __func__, cmd); in avm_dctrl()
966 setup_fritz(struct fritzcard *fc) in setup_fritz() argument
970 if (!request_region(fc->addr, 32, fc->name)) { in setup_fritz()
972 fc->name, fc->addr, fc->addr + 31); in setup_fritz()
975 switch (fc->type) { in setup_fritz()
977 val = inl(fc->addr); in setup_fritz()
978 outl(AVM_HDLC_1, fc->addr + CHIP_INDEX); in setup_fritz()
979 ver = inl(fc->addr + CHIP_WINDOW + HDLC_STATUS) >> 24; in setup_fritz()
981 pr_notice("%s: PCI stat %#x\n", fc->name, val); in setup_fritz()
982 pr_notice("%s: PCI 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(V1, ISAC, fc->isac); in setup_fritz()
987 fc->isac.type = IPAC_TYPE_ISAC; in setup_fritz()
990 val = inl(fc->addr); in setup_fritz()
991 ver = inl(fc->addr + AVM_HDLC_STATUS_1) >> 24; in setup_fritz()
993 pr_notice("%s: PCI V2 stat %#x\n", fc->name, val); in setup_fritz()
994 pr_notice("%s: PCI V2 Class %X Rev %d\n", fc->name, in setup_fritz()
996 pr_notice("%s: HDLC version %x\n", fc->name, ver & 0xf); in setup_fritz()
998 ASSIGN_FUNC(V2, ISAC, fc->isac); in setup_fritz()
999 fc->isac.type = IPAC_TYPE_ISACX; in setup_fritz()
1002 release_region(fc->addr, 32); in setup_fritz()
1003 pr_info("%s: AVM unknown type %d\n", fc->name, fc->type); in setup_fritz()
1006 pr_notice("%s: %s config irq:%d base:0x%X\n", fc->name, in setup_fritz()
1007 (fc->type == AVM_FRITZ_PCI) ? "AVM Fritz!CARD PCI" : in setup_fritz()
1008 "AVM Fritz!CARD PCIv2", fc->irq, fc->addr); in setup_fritz()