• Home
  • Raw
  • Download

Lines Matching refs:card

106 _set_debug(struct tiger_hw *card)  in _set_debug()  argument
108 card->isac.dch.debug = debug; in _set_debug()
109 card->bc[0].bch.debug = debug; in _set_debug()
110 card->bc[1].bch.debug = debug; in _set_debug()
117 struct tiger_hw *card; in set_debug() local
122 list_for_each_entry(card, &Cards, list) in set_debug()
123 _set_debug(card); in set_debug()
136 nj_disable_hwirq(struct tiger_hw *card) in nj_disable_hwirq() argument
138 outb(0, card->base + NJ_IRQMASK0); in nj_disable_hwirq()
139 outb(0, card->base + NJ_IRQMASK1); in nj_disable_hwirq()
146 struct tiger_hw *card = p; in ReadISAC_nj() local
149 card->auxd &= 0xfc; in ReadISAC_nj()
150 card->auxd |= (offset >> 4) & 3; in ReadISAC_nj()
151 outb(card->auxd, card->base + NJ_AUXDATA); in ReadISAC_nj()
152 ret = inb(card->base + NJ_ISAC_OFF + ((offset & 0x0f) << 2)); in ReadISAC_nj()
159 struct tiger_hw *card = p; in WriteISAC_nj() local
161 card->auxd &= 0xfc; in WriteISAC_nj()
162 card->auxd |= (offset >> 4) & 3; in WriteISAC_nj()
163 outb(card->auxd, card->base + NJ_AUXDATA); in WriteISAC_nj()
164 outb(value, card->base + NJ_ISAC_OFF + ((offset & 0x0f) << 2)); in WriteISAC_nj()
170 struct tiger_hw *card = p; in ReadFiFoISAC_nj() local
172 card->auxd &= 0xfc; in ReadFiFoISAC_nj()
173 outb(card->auxd, card->base + NJ_AUXDATA); in ReadFiFoISAC_nj()
174 insb(card->base + NJ_ISAC_OFF, data, size); in ReadFiFoISAC_nj()
180 struct tiger_hw *card = p; in WriteFiFoISAC_nj() local
182 card->auxd &= 0xfc; in WriteFiFoISAC_nj()
183 outb(card->auxd, card->base + NJ_AUXDATA); in WriteFiFoISAC_nj()
184 outsb(card->base + NJ_ISAC_OFF, data, size); in WriteFiFoISAC_nj()
190 struct tiger_hw *card = bc->bch.hw; in fill_mem() local
193 pr_debug("%s: B%1d fill %02x len %d idx %d/%d\n", card->name, in fill_mem()
194 bc->bch.nr, fill, cnt, idx, card->send.idx); in fill_mem()
201 val = card->send.start[idx]; in fill_mem()
204 card->send.start[idx++] = val; in fill_mem()
205 if (idx >= card->send.size) in fill_mem()
213 struct tiger_hw *card = bc->bch.hw; in mode_tiger() local
215 pr_debug("%s: B%1d protocol %x-->%x\n", card->name, in mode_tiger()
221 fill_mem(bc, 0, card->send.size, 0xff); in mode_tiger()
224 if ((card->bc[0].bch.state == ISDN_P_NONE) && in mode_tiger()
225 (card->bc[1].bch.state == ISDN_P_NONE)) { in mode_tiger()
226 card->dmactrl = 0; in mode_tiger()
227 outb(card->dmactrl, card->base + NJ_DMACTRL); in mode_tiger()
228 outb(0, card->base + NJ_IRQMASK0); in mode_tiger()
240 bc->free = card->send.size / 2; in mode_tiger()
244 if (!card->dmactrl) { in mode_tiger()
245 card->dmactrl = 1; in mode_tiger()
246 outb(card->dmactrl, card->base + NJ_DMACTRL); in mode_tiger()
247 outb(0x0f, card->base + NJ_IRQMASK0); in mode_tiger()
254 bc->free = card->send.size / 2; in mode_tiger()
260 if (!card->dmactrl) { in mode_tiger()
261 card->dmactrl = 1; in mode_tiger()
262 outb(card->dmactrl, card->base + NJ_DMACTRL); in mode_tiger()
263 outb(0x0f, card->base + NJ_IRQMASK0); in mode_tiger()
267 pr_info("%s: %s protocol %x not handled\n", card->name, in mode_tiger()
271 card->send.dmacur = inl(card->base + NJ_DMA_READ_ADR); in mode_tiger()
272 card->recv.dmacur = inl(card->base + NJ_DMA_WRITE_ADR); in mode_tiger()
273 card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; in mode_tiger()
274 card->recv.idx = (card->recv.dmacur - card->recv.dmastart) >> 2; in mode_tiger()
276 card->name, __func__, in mode_tiger()
277 inb(card->base + NJ_DMACTRL), in mode_tiger()
278 inb(card->base + NJ_IRQMASK0), in mode_tiger()
279 inb(card->base + NJ_IRQSTAT0), in mode_tiger()
280 card->send.idx, in mode_tiger()
281 card->recv.idx); in mode_tiger()
286 nj_reset(struct tiger_hw *card) in nj_reset() argument
288 outb(0xff, card->base + NJ_CTRL); /* Reset On */ in nj_reset()
293 if (card->typ == NETJET_S_TJ320) /* TJ320 */ in nj_reset()
294 card->ctrlreg = 0x40; /* Reset Off and status read clear */ in nj_reset()
296 card->ctrlreg = 0x00; /* Reset Off and status read clear */ in nj_reset()
297 outb(card->ctrlreg, card->base + NJ_CTRL); in nj_reset()
301 card->auxd = 0; in nj_reset()
302 card->dmactrl = 0; in nj_reset()
303 outb(~NJ_ISACIRQ, card->base + NJ_AUXCTRL); in nj_reset()
304 outb(NJ_ISACIRQ, card->base + NJ_IRQMASK1); in nj_reset()
305 outb(card->auxd, card->base + NJ_AUXDATA); in nj_reset()
309 inittiger(struct tiger_hw *card) in inittiger() argument
313 card->dma_p = pci_alloc_consistent(card->pdev, NJ_DMA_SIZE, in inittiger()
314 &card->dma); in inittiger()
315 if (!card->dma_p) { in inittiger()
316 pr_info("%s: No DMA memory\n", card->name); in inittiger()
319 if ((u64)card->dma > 0xffffffff) { in inittiger()
320 pr_info("%s: DMA outside 32 bit\n", card->name); in inittiger()
324 card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_ATOMIC); in inittiger()
325 if (!card->bc[i].hsbuf) { in inittiger()
326 pr_info("%s: no B%d send buffer\n", card->name, i + 1); in inittiger()
329 card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_ATOMIC); in inittiger()
330 if (!card->bc[i].hrbuf) { in inittiger()
331 pr_info("%s: no B%d recv buffer\n", card->name, i + 1); in inittiger()
335 memset(card->dma_p, 0xff, NJ_DMA_SIZE); in inittiger()
337 card->send.start = card->dma_p; in inittiger()
338 card->send.dmastart = (u32)card->dma; in inittiger()
339 card->send.dmaend = card->send.dmastart + in inittiger()
341 card->send.dmairq = card->send.dmastart + in inittiger()
343 card->send.size = NJ_DMA_TXSIZE; in inittiger()
347 " size %zu u32\n", card->name, in inittiger()
348 card->send.dmastart, card->send.dmairq, in inittiger()
349 card->send.dmaend, card->send.start, card->send.size); in inittiger()
351 outl(card->send.dmastart, card->base + NJ_DMA_READ_START); in inittiger()
352 outl(card->send.dmairq, card->base + NJ_DMA_READ_IRQ); in inittiger()
353 outl(card->send.dmaend, card->base + NJ_DMA_READ_END); in inittiger()
355 card->recv.start = card->dma_p + (NJ_DMA_SIZE / 2); in inittiger()
356 card->recv.dmastart = (u32)card->dma + (NJ_DMA_SIZE / 2); in inittiger()
357 card->recv.dmaend = card->recv.dmastart + in inittiger()
359 card->recv.dmairq = card->recv.dmastart + in inittiger()
361 card->recv.size = NJ_DMA_RXSIZE; in inittiger()
365 " size %zu u32\n", card->name, in inittiger()
366 card->recv.dmastart, card->recv.dmairq, in inittiger()
367 card->recv.dmaend, card->recv.start, card->recv.size); in inittiger()
369 outl(card->recv.dmastart, card->base + NJ_DMA_WRITE_START); in inittiger()
370 outl(card->recv.dmairq, card->base + NJ_DMA_WRITE_IRQ); in inittiger()
371 outl(card->recv.dmaend, card->base + NJ_DMA_WRITE_END); in inittiger()
378 struct tiger_hw *card = bc->bch.hw; in read_dma() local
385 pr_info("%s: B%1d overrun at idx %d\n", card->name, in read_dma()
397 card->name, bc->bch.nr, cnt); in read_dma()
406 val = card->recv.start[idx++]; in read_dma()
409 if (idx >= card->recv.size) in read_dma()
426 snprintf(card->log, LOG_SIZE, in read_dma()
428 card->name, stat); in read_dma()
429 print_hex_dump_bytes(card->log, in read_dma()
437 card->name, bc->bch.nr, cnt); in read_dma()
442 card->name, bc->bch.nr); in read_dma()
445 card->name, bc->bch.nr); in read_dma()
448 card->name, bc->bch.nr, bc->bch.maxlen); in read_dma()
456 recv_tiger(struct tiger_hw *card, u8 irq_stat) in recv_tiger() argument
459 int cnt = card->recv.size / 2; in recv_tiger()
462 card->last_is0 &= ~NJ_IRQM0_WR_MASK; in recv_tiger()
463 card->last_is0 |= (irq_stat & NJ_IRQM0_WR_MASK); in recv_tiger()
468 idx = card->recv.size - 1; in recv_tiger()
470 if (test_bit(FLG_ACTIVE, &card->bc[0].bch.Flags)) in recv_tiger()
471 read_dma(&card->bc[0], idx, cnt); in recv_tiger()
472 if (test_bit(FLG_ACTIVE, &card->bc[1].bch.Flags)) in recv_tiger()
473 read_dma(&card->bc[1], idx, cnt); in recv_tiger()
478 resync(struct tiger_ch *bc, struct tiger_hw *card) in resync() argument
480 card->send.dmacur = inl(card->base | NJ_DMA_READ_ADR); in resync()
481 card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; in resync()
482 if (bc->free > card->send.size / 2) in resync()
483 bc->free = card->send.size / 2; in resync()
488 if (card->send.idx < ((card->send.size / 2) - 1)) in resync()
489 bc->idx = (card->recv.size / 2) - 1; in resync()
491 bc->idx = card->recv.size - 1; in resync()
493 pr_debug("%s: %s B%1d free %d idx %d/%d\n", card->name, in resync()
494 __func__, bc->bch.nr, bc->free, bc->idx, card->send.idx); in resync()
502 struct tiger_hw *card = bc->bch.hw; in fill_hdlc_flag() local
509 pr_debug("%s: %s B%1d %d state %x idx %d/%d\n", card->name, in fill_hdlc_flag()
511 bc->idx, card->send.idx); in fill_hdlc_flag()
513 resync(bc, card); in fill_hdlc_flag()
516 pr_debug("%s: B%1d hdlc encoded %d flags\n", card->name, in fill_hdlc_flag()
522 if (bc->idx >= card->send.size) in fill_hdlc_flag()
524 v = card->send.start[bc->idx]; in fill_hdlc_flag()
527 card->send.start[bc->idx++] = v; in fill_hdlc_flag()
530 snprintf(card->log, LOG_SIZE, "B%1d-send %s %d ", in fill_hdlc_flag()
531 bc->bch.nr, card->name, count); in fill_hdlc_flag()
532 print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, count); in fill_hdlc_flag()
539 struct tiger_hw *card = bc->bch.hw; in fill_dma() local
550 count = card->send.size >> 1; in fill_dma()
557 card->name, __func__, bc->bch.nr, count, bc->free, in fill_dma()
559 bc->idx, card->send.idx); in fill_dma()
563 resync(bc, card); in fill_dma()
567 pr_debug("%s: B%1d hdlc encoded %d in %d\n", card->name, in fill_dma()
585 if (bc->idx >= card->send.size) in fill_dma()
587 v = card->send.start[bc->idx]; in fill_dma()
590 card->send.start[bc->idx++] = v; in fill_dma()
594 if (bc->idx >= card->send.size) in fill_dma()
596 v = card->send.start[bc->idx]; in fill_dma()
600 card->send.start[bc->idx++] = v; in fill_dma()
604 snprintf(card->log, LOG_SIZE, "B%1d-send %s %d ", in fill_dma()
605 bc->bch.nr, card->name, count); in fill_dma()
606 print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, count); in fill_dma()
639 send_tiger_bc(struct tiger_hw *card, struct tiger_ch *bc) in send_tiger_bc() argument
643 bc->free += card->send.size / 2; in send_tiger_bc()
644 if (bc->free >= card->send.size) { in send_tiger_bc()
646 pr_info("%s: B%1d TX underrun state %x\n", card->name, in send_tiger_bc()
650 bc->free = card->send.size; in send_tiger_bc()
658 pr_debug("%s: B%1d TX no data free %d idx %d/%d\n", card->name, in send_tiger_bc()
659 bc->bch.nr, bc->free, bc->idx, card->send.idx); in send_tiger_bc()
662 if (bc->free == card->send.size) in send_tiger_bc()
669 send_tiger(struct tiger_hw *card, u8 irq_stat) in send_tiger() argument
674 if ((irq_stat & card->last_is0) & NJ_IRQM0_RD_MASK) { in send_tiger()
676 card->name, irq_stat, card->last_is0); in send_tiger()
679 card->last_is0 &= ~NJ_IRQM0_RD_MASK; in send_tiger()
680 card->last_is0 |= (irq_stat & NJ_IRQM0_RD_MASK); in send_tiger()
683 if (test_bit(FLG_ACTIVE, &card->bc[i].bch.Flags)) in send_tiger()
684 send_tiger_bc(card, &card->bc[i]); in send_tiger()
691 struct tiger_hw *card = dev_id; in nj_irq() local
694 spin_lock(&card->lock); in nj_irq()
695 s0val = inb(card->base | NJ_IRQSTAT0); in nj_irq()
696 s1val = inb(card->base | NJ_IRQSTAT1); in nj_irq()
699 spin_unlock(&card->lock); in nj_irq()
702 pr_debug("%s: IRQSTAT0 %02x IRQSTAT1 %02x\n", card->name, s0val, s1val); in nj_irq()
703 card->irqcnt++; in nj_irq()
705 val = ReadISAC_nj(card, ISAC_ISTA); in nj_irq()
707 mISDNisac_irq(&card->isac, val); in nj_irq()
712 outb(s0val, card->base | NJ_IRQSTAT0); in nj_irq()
717 card->recv.dmacur = inl(card->base | NJ_DMA_WRITE_ADR); in nj_irq()
718 card->recv.idx = (card->recv.dmacur - card->recv.dmastart) >> 2; in nj_irq()
719 if (card->recv.dmacur < card->recv.dmairq) in nj_irq()
724 card->send.dmacur = inl(card->base | NJ_DMA_READ_ADR); in nj_irq()
725 card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; in nj_irq()
726 if (card->send.dmacur < card->send.dmairq) in nj_irq()
731 pr_debug("%s: DMA Status %02x/%02x/%02x %d/%d\n", card->name, in nj_irq()
732 s1val, s0val, card->last_is0, in nj_irq()
733 card->recv.idx, card->send.idx); in nj_irq()
735 if (s0val != card->last_is0) { in nj_irq()
737 (card->last_is0 & NJ_IRQM0_RD_MASK)) in nj_irq()
739 send_tiger(card, s0val); in nj_irq()
741 (card->last_is0 & NJ_IRQM0_WR_MASK)) in nj_irq()
743 recv_tiger(card, s0val); in nj_irq()
746 spin_unlock(&card->lock); in nj_irq()
756 struct tiger_hw *card = bch->hw; in nj_l2l1B() local
762 spin_lock_irqsave(&card->lock, flags); in nj_l2l1B()
768 spin_unlock_irqrestore(&card->lock, flags); in nj_l2l1B()
771 spin_lock_irqsave(&card->lock, flags); in nj_l2l1B()
776 spin_unlock_irqrestore(&card->lock, flags); in nj_l2l1B()
782 spin_lock_irqsave(&card->lock, flags); in nj_l2l1B()
785 spin_unlock_irqrestore(&card->lock, flags); in nj_l2l1B()
807 struct tiger_hw *card = bch->hw; in nj_bctrl() local
811 pr_debug("%s: %s cmd:%x %p\n", card->name, __func__, cmd, arg); in nj_bctrl()
816 spin_lock_irqsave(&card->lock, flags); in nj_bctrl()
819 spin_unlock_irqrestore(&card->lock, flags); in nj_bctrl()
829 pr_info("%s: %s unknown prim(%x)\n", card->name, __func__, cmd); in nj_bctrl()
835 channel_ctrl(struct tiger_hw *card, struct mISDN_ctrl_req *cq) in channel_ctrl() argument
849 ret = card->isac.ctrl(&card->isac, HW_TESTLOOP, cq->channel); in channel_ctrl()
852 ret = card->isac.ctrl(&card->isac, HW_TIMER3_VALUE, cq->p1); in channel_ctrl()
855 pr_info("%s: %s unknown Op %x\n", card->name, __func__, cq->op); in channel_ctrl()
863 open_bchannel(struct tiger_hw *card, struct channel_req *rq) in open_bchannel() argument
871 bch = &card->bc[rq->adr.channel - 1].bch; in open_bchannel()
888 struct tiger_hw *card = dch->hw; in nj_dctrl() local
892 pr_debug("%s: %s cmd:%x %p\n", card->name, __func__, cmd, arg); in nj_dctrl()
897 err = card->isac.open(&card->isac, rq); in nj_dctrl()
899 err = open_bchannel(card, rq); in nj_dctrl()
903 pr_info("%s: cannot get module\n", card->name); in nj_dctrl()
906 pr_debug("%s: dev(%d) close from %p\n", card->name, dch->dev.id, in nj_dctrl()
911 err = channel_ctrl(card, arg); in nj_dctrl()
915 card->name, __func__, cmd); in nj_dctrl()
922 nj_init_card(struct tiger_hw *card) in nj_init_card() argument
927 spin_lock_irqsave(&card->lock, flags); in nj_init_card()
928 nj_disable_hwirq(card); in nj_init_card()
929 spin_unlock_irqrestore(&card->lock, flags); in nj_init_card()
931 card->irq = card->pdev->irq; in nj_init_card()
932 if (request_irq(card->irq, nj_irq, IRQF_SHARED, card->name, card)) { in nj_init_card()
934 card->name, card->irq); in nj_init_card()
935 card->irq = -1; in nj_init_card()
939 spin_lock_irqsave(&card->lock, flags); in nj_init_card()
940 nj_reset(card); in nj_init_card()
941 ret = card->isac.init(&card->isac); in nj_init_card()
944 ret = inittiger(card); in nj_init_card()
947 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_init_card()
948 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_init_card()
950 spin_unlock_irqrestore(&card->lock, flags); in nj_init_card()
956 nj_release(struct tiger_hw *card) in nj_release() argument
961 if (card->base_s) { in nj_release()
962 spin_lock_irqsave(&card->lock, flags); in nj_release()
963 nj_disable_hwirq(card); in nj_release()
964 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_release()
965 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_release()
966 card->isac.release(&card->isac); in nj_release()
967 spin_unlock_irqrestore(&card->lock, flags); in nj_release()
968 release_region(card->base, card->base_s); in nj_release()
969 card->base_s = 0; in nj_release()
971 if (card->irq > 0) in nj_release()
972 free_irq(card->irq, card); in nj_release()
973 if (card->isac.dch.dev.dev.class) in nj_release()
974 mISDN_unregister_device(&card->isac.dch.dev); in nj_release()
977 mISDN_freebchannel(&card->bc[i].bch); in nj_release()
978 kfree(card->bc[i].hsbuf); in nj_release()
979 kfree(card->bc[i].hrbuf); in nj_release()
981 if (card->dma_p) in nj_release()
982 pci_free_consistent(card->pdev, NJ_DMA_SIZE, in nj_release()
983 card->dma_p, card->dma); in nj_release()
985 list_del(&card->list); in nj_release()
987 pci_clear_master(card->pdev); in nj_release()
988 pci_disable_device(card->pdev); in nj_release()
989 pci_set_drvdata(card->pdev, NULL); in nj_release()
990 kfree(card); in nj_release()
995 nj_setup(struct tiger_hw *card) in nj_setup() argument
997 card->base = pci_resource_start(card->pdev, 0); in nj_setup()
998 card->base_s = pci_resource_len(card->pdev, 0); in nj_setup()
999 if (!request_region(card->base, card->base_s, card->name)) { in nj_setup()
1001 card->name, card->base, in nj_setup()
1002 (u32)(card->base + card->base_s - 1)); in nj_setup()
1003 card->base_s = 0; in nj_setup()
1006 ASSIGN_FUNC(nj, ISAC, card->isac); in nj_setup()
1012 setup_instance(struct tiger_hw *card) in setup_instance() argument
1017 snprintf(card->name, MISDN_MAX_IDLEN - 1, "netjet.%d", nj_cnt + 1); in setup_instance()
1019 list_add_tail(&card->list, &Cards); in setup_instance()
1022 _set_debug(card); in setup_instance()
1023 card->isac.name = card->name; in setup_instance()
1024 spin_lock_init(&card->lock); in setup_instance()
1025 card->isac.hwlock = &card->lock; in setup_instance()
1026 mISDNisac_init(&card->isac, card); in setup_instance()
1028 card->isac.dch.dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | in setup_instance()
1030 card->isac.dch.dev.D.ctrl = nj_dctrl; in setup_instance()
1032 card->bc[i].bch.nr = i + 1; in setup_instance()
1033 set_channelmap(i + 1, card->isac.dch.dev.channelmap); in setup_instance()
1034 mISDN_initbchannel(&card->bc[i].bch, MAX_DATA_MEM, in setup_instance()
1036 card->bc[i].bch.hw = card; in setup_instance()
1037 card->bc[i].bch.ch.send = nj_l2l1B; in setup_instance()
1038 card->bc[i].bch.ch.ctrl = nj_bctrl; in setup_instance()
1039 card->bc[i].bch.ch.nr = i + 1; in setup_instance()
1040 list_add(&card->bc[i].bch.ch.list, in setup_instance()
1041 &card->isac.dch.dev.bchannels); in setup_instance()
1042 card->bc[i].bch.hw = card; in setup_instance()
1044 err = nj_setup(card); in setup_instance()
1047 err = mISDN_register_device(&card->isac.dch.dev, &card->pdev->dev, in setup_instance()
1048 card->name); in setup_instance()
1051 err = nj_init_card(card); in setup_instance()
1058 nj_release(card); in setup_instance()
1067 struct tiger_hw *card; in nj_probe() local
1087 card = kzalloc(sizeof(struct tiger_hw), GFP_ATOMIC); in nj_probe()
1088 if (!card) { in nj_probe()
1093 card->pdev = pdev; in nj_probe()
1097 kfree(card); in nj_probe()
1112 card->typ = NETJET_S_TJ320; in nj_probe()
1114 card->typ = NETJET_S_TJ300; in nj_probe()
1116 card->base = pci_resource_start(pdev, 0); in nj_probe()
1117 card->irq = pdev->irq; in nj_probe()
1118 pci_set_drvdata(pdev, card); in nj_probe()
1119 err = setup_instance(card); in nj_probe()
1129 struct tiger_hw *card = pci_get_drvdata(pdev); in nj_remove() local
1131 if (card) in nj_remove()
1132 nj_release(card); in nj_remove()