• Home
  • Raw
  • Download

Lines Matching refs:card

93 _set_debug(struct tiger_hw *card)  in _set_debug()  argument
95 card->isac.dch.debug = debug; in _set_debug()
96 card->bc[0].bch.debug = debug; in _set_debug()
97 card->bc[1].bch.debug = debug; in _set_debug()
104 struct tiger_hw *card; in set_debug() local
109 list_for_each_entry(card, &Cards, list) in set_debug()
110 _set_debug(card); in set_debug()
123 nj_disable_hwirq(struct tiger_hw *card) in nj_disable_hwirq() argument
125 outb(0, card->base + NJ_IRQMASK0); in nj_disable_hwirq()
126 outb(0, card->base + NJ_IRQMASK1); in nj_disable_hwirq()
133 struct tiger_hw *card = p; in ReadISAC_nj() local
136 card->auxd &= 0xfc; in ReadISAC_nj()
137 card->auxd |= (offset >> 4) & 3; in ReadISAC_nj()
138 outb(card->auxd, card->base + NJ_AUXDATA); in ReadISAC_nj()
139 ret = inb(card->base + NJ_ISAC_OFF + ((offset & 0x0f) << 2)); in ReadISAC_nj()
146 struct tiger_hw *card = p; in WriteISAC_nj() local
148 card->auxd &= 0xfc; in WriteISAC_nj()
149 card->auxd |= (offset >> 4) & 3; in WriteISAC_nj()
150 outb(card->auxd, card->base + NJ_AUXDATA); in WriteISAC_nj()
151 outb(value, card->base + NJ_ISAC_OFF + ((offset & 0x0f) << 2)); in WriteISAC_nj()
157 struct tiger_hw *card = p; in ReadFiFoISAC_nj() local
159 card->auxd &= 0xfc; in ReadFiFoISAC_nj()
160 outb(card->auxd, card->base + NJ_AUXDATA); in ReadFiFoISAC_nj()
161 insb(card->base + NJ_ISAC_OFF, data, size); in ReadFiFoISAC_nj()
167 struct tiger_hw *card = p; in WriteFiFoISAC_nj() local
169 card->auxd &= 0xfc; in WriteFiFoISAC_nj()
170 outb(card->auxd, card->base + NJ_AUXDATA); in WriteFiFoISAC_nj()
171 outsb(card->base + NJ_ISAC_OFF, data, size); in WriteFiFoISAC_nj()
177 struct tiger_hw *card = bc->bch.hw; in fill_mem() local
180 pr_debug("%s: B%1d fill %02x len %d idx %d/%d\n", card->name, in fill_mem()
181 bc->bch.nr, fill, cnt, idx, card->send.idx); in fill_mem()
188 val = card->send.start[idx]; in fill_mem()
191 card->send.start[idx++] = val; in fill_mem()
192 if (idx >= card->send.size) in fill_mem()
200 struct tiger_hw *card = bc->bch.hw; in mode_tiger() local
202 pr_debug("%s: B%1d protocol %x-->%x\n", card->name, in mode_tiger()
208 fill_mem(bc, 0, card->send.size, 0xff); in mode_tiger()
211 if ((card->bc[0].bch.state == ISDN_P_NONE) && in mode_tiger()
212 (card->bc[1].bch.state == ISDN_P_NONE)) { in mode_tiger()
213 card->dmactrl = 0; in mode_tiger()
214 outb(card->dmactrl, card->base + NJ_DMACTRL); in mode_tiger()
215 outb(0, card->base + NJ_IRQMASK0); in mode_tiger()
227 bc->free = card->send.size / 2; in mode_tiger()
231 if (!card->dmactrl) { in mode_tiger()
232 card->dmactrl = 1; in mode_tiger()
233 outb(card->dmactrl, card->base + NJ_DMACTRL); in mode_tiger()
234 outb(0x0f, card->base + NJ_IRQMASK0); in mode_tiger()
241 bc->free = card->send.size / 2; in mode_tiger()
247 if (!card->dmactrl) { in mode_tiger()
248 card->dmactrl = 1; in mode_tiger()
249 outb(card->dmactrl, card->base + NJ_DMACTRL); in mode_tiger()
250 outb(0x0f, card->base + NJ_IRQMASK0); in mode_tiger()
254 pr_info("%s: %s protocol %x not handled\n", card->name, in mode_tiger()
258 card->send.dmacur = inl(card->base + NJ_DMA_READ_ADR); in mode_tiger()
259 card->recv.dmacur = inl(card->base + NJ_DMA_WRITE_ADR); in mode_tiger()
260 card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; in mode_tiger()
261 card->recv.idx = (card->recv.dmacur - card->recv.dmastart) >> 2; in mode_tiger()
263 card->name, __func__, in mode_tiger()
264 inb(card->base + NJ_DMACTRL), in mode_tiger()
265 inb(card->base + NJ_IRQMASK0), in mode_tiger()
266 inb(card->base + NJ_IRQSTAT0), in mode_tiger()
267 card->send.idx, in mode_tiger()
268 card->recv.idx); in mode_tiger()
273 nj_reset(struct tiger_hw *card) in nj_reset() argument
275 outb(0xff, card->base + NJ_CTRL); /* Reset On */ in nj_reset()
280 if (card->typ == NETJET_S_TJ320) /* TJ320 */ in nj_reset()
281 card->ctrlreg = 0x40; /* Reset Off and status read clear */ in nj_reset()
283 card->ctrlreg = 0x00; /* Reset Off and status read clear */ in nj_reset()
284 outb(card->ctrlreg, card->base + NJ_CTRL); in nj_reset()
288 card->auxd = 0; in nj_reset()
289 card->dmactrl = 0; in nj_reset()
290 outb(~NJ_ISACIRQ, card->base + NJ_AUXCTRL); in nj_reset()
291 outb(NJ_ISACIRQ, card->base + NJ_IRQMASK1); in nj_reset()
292 outb(card->auxd, card->base + NJ_AUXDATA); in nj_reset()
296 inittiger(struct tiger_hw *card) in inittiger() argument
300 card->dma_p = dma_alloc_coherent(&card->pdev->dev, NJ_DMA_SIZE, in inittiger()
301 &card->dma, GFP_ATOMIC); in inittiger()
302 if (!card->dma_p) { in inittiger()
303 pr_info("%s: No DMA memory\n", card->name); in inittiger()
306 if ((u64)card->dma > 0xffffffff) { in inittiger()
307 pr_info("%s: DMA outside 32 bit\n", card->name); in inittiger()
311 card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_ATOMIC); in inittiger()
312 if (!card->bc[i].hsbuf) { in inittiger()
313 pr_info("%s: no B%d send buffer\n", card->name, i + 1); in inittiger()
316 card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_ATOMIC); in inittiger()
317 if (!card->bc[i].hrbuf) { in inittiger()
318 pr_info("%s: no B%d recv buffer\n", card->name, i + 1); in inittiger()
322 memset(card->dma_p, 0xff, NJ_DMA_SIZE); in inittiger()
324 card->send.start = card->dma_p; in inittiger()
325 card->send.dmastart = (u32)card->dma; in inittiger()
326 card->send.dmaend = card->send.dmastart + in inittiger()
328 card->send.dmairq = card->send.dmastart + in inittiger()
330 card->send.size = NJ_DMA_TXSIZE; in inittiger()
334 " size %zu u32\n", card->name, in inittiger()
335 card->send.dmastart, card->send.dmairq, in inittiger()
336 card->send.dmaend, card->send.start, card->send.size); in inittiger()
338 outl(card->send.dmastart, card->base + NJ_DMA_READ_START); in inittiger()
339 outl(card->send.dmairq, card->base + NJ_DMA_READ_IRQ); in inittiger()
340 outl(card->send.dmaend, card->base + NJ_DMA_READ_END); in inittiger()
342 card->recv.start = card->dma_p + (NJ_DMA_SIZE / 2); in inittiger()
343 card->recv.dmastart = (u32)card->dma + (NJ_DMA_SIZE / 2); in inittiger()
344 card->recv.dmaend = card->recv.dmastart + in inittiger()
346 card->recv.dmairq = card->recv.dmastart + in inittiger()
348 card->recv.size = NJ_DMA_RXSIZE; in inittiger()
352 " size %zu u32\n", card->name, in inittiger()
353 card->recv.dmastart, card->recv.dmairq, in inittiger()
354 card->recv.dmaend, card->recv.start, card->recv.size); in inittiger()
356 outl(card->recv.dmastart, card->base + NJ_DMA_WRITE_START); in inittiger()
357 outl(card->recv.dmairq, card->base + NJ_DMA_WRITE_IRQ); in inittiger()
358 outl(card->recv.dmaend, card->base + NJ_DMA_WRITE_END); in inittiger()
365 struct tiger_hw *card = bc->bch.hw; in read_dma() local
372 pr_info("%s: B%1d overrun at idx %d\n", card->name, in read_dma()
384 card->name, bc->bch.nr, cnt); in read_dma()
393 val = card->recv.start[idx++]; in read_dma()
396 if (idx >= card->recv.size) in read_dma()
413 snprintf(card->log, LOG_SIZE, in read_dma()
415 card->name, stat); in read_dma()
416 print_hex_dump_bytes(card->log, in read_dma()
424 card->name, bc->bch.nr, cnt); in read_dma()
429 card->name, bc->bch.nr); in read_dma()
432 card->name, bc->bch.nr); in read_dma()
435 card->name, bc->bch.nr, bc->bch.maxlen); in read_dma()
443 recv_tiger(struct tiger_hw *card, u8 irq_stat) in recv_tiger() argument
446 int cnt = card->recv.size / 2; in recv_tiger()
449 card->last_is0 &= ~NJ_IRQM0_WR_MASK; in recv_tiger()
450 card->last_is0 |= (irq_stat & NJ_IRQM0_WR_MASK); in recv_tiger()
455 idx = card->recv.size - 1; in recv_tiger()
457 if (test_bit(FLG_ACTIVE, &card->bc[0].bch.Flags)) in recv_tiger()
458 read_dma(&card->bc[0], idx, cnt); in recv_tiger()
459 if (test_bit(FLG_ACTIVE, &card->bc[1].bch.Flags)) in recv_tiger()
460 read_dma(&card->bc[1], idx, cnt); in recv_tiger()
465 resync(struct tiger_ch *bc, struct tiger_hw *card) in resync() argument
467 card->send.dmacur = inl(card->base | NJ_DMA_READ_ADR); in resync()
468 card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; in resync()
469 if (bc->free > card->send.size / 2) in resync()
470 bc->free = card->send.size / 2; in resync()
475 if (card->send.idx < ((card->send.size / 2) - 1)) in resync()
476 bc->idx = (card->recv.size / 2) - 1; in resync()
478 bc->idx = card->recv.size - 1; in resync()
480 pr_debug("%s: %s B%1d free %d idx %d/%d\n", card->name, in resync()
481 __func__, bc->bch.nr, bc->free, bc->idx, card->send.idx); in resync()
489 struct tiger_hw *card = bc->bch.hw; in fill_hdlc_flag() local
496 pr_debug("%s: %s B%1d %d state %x idx %d/%d\n", card->name, in fill_hdlc_flag()
498 bc->idx, card->send.idx); in fill_hdlc_flag()
500 resync(bc, card); in fill_hdlc_flag()
503 pr_debug("%s: B%1d hdlc encoded %d flags\n", card->name, in fill_hdlc_flag()
509 if (bc->idx >= card->send.size) in fill_hdlc_flag()
511 v = card->send.start[bc->idx]; in fill_hdlc_flag()
514 card->send.start[bc->idx++] = v; in fill_hdlc_flag()
517 snprintf(card->log, LOG_SIZE, "B%1d-send %s %d ", in fill_hdlc_flag()
518 bc->bch.nr, card->name, count); in fill_hdlc_flag()
519 print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, count); in fill_hdlc_flag()
526 struct tiger_hw *card = bc->bch.hw; in fill_dma() local
537 count = card->send.size >> 1; in fill_dma()
544 card->name, __func__, bc->bch.nr, count, bc->free, in fill_dma()
546 bc->idx, card->send.idx); in fill_dma()
550 resync(bc, card); in fill_dma()
554 pr_debug("%s: B%1d hdlc encoded %d in %d\n", card->name, in fill_dma()
572 if (bc->idx >= card->send.size) in fill_dma()
574 v = card->send.start[bc->idx]; in fill_dma()
577 card->send.start[bc->idx++] = v; in fill_dma()
581 if (bc->idx >= card->send.size) in fill_dma()
583 v = card->send.start[bc->idx]; in fill_dma()
587 card->send.start[bc->idx++] = v; in fill_dma()
591 snprintf(card->log, LOG_SIZE, "B%1d-send %s %d ", in fill_dma()
592 bc->bch.nr, card->name, count); in fill_dma()
593 print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, count); in fill_dma()
625 send_tiger_bc(struct tiger_hw *card, struct tiger_ch *bc) in send_tiger_bc() argument
629 bc->free += card->send.size / 2; in send_tiger_bc()
630 if (bc->free >= card->send.size) { in send_tiger_bc()
632 pr_info("%s: B%1d TX underrun state %x\n", card->name, in send_tiger_bc()
636 bc->free = card->send.size; in send_tiger_bc()
644 pr_debug("%s: B%1d TX no data free %d idx %d/%d\n", card->name, in send_tiger_bc()
645 bc->bch.nr, bc->free, bc->idx, card->send.idx); in send_tiger_bc()
648 if (bc->free == card->send.size) in send_tiger_bc()
655 send_tiger(struct tiger_hw *card, u8 irq_stat) in send_tiger() argument
660 if ((irq_stat & card->last_is0) & NJ_IRQM0_RD_MASK) { in send_tiger()
662 card->name, irq_stat, card->last_is0); in send_tiger()
665 card->last_is0 &= ~NJ_IRQM0_RD_MASK; in send_tiger()
666 card->last_is0 |= (irq_stat & NJ_IRQM0_RD_MASK); in send_tiger()
669 if (test_bit(FLG_ACTIVE, &card->bc[i].bch.Flags)) in send_tiger()
670 send_tiger_bc(card, &card->bc[i]); in send_tiger()
677 struct tiger_hw *card = dev_id; in nj_irq() local
680 spin_lock(&card->lock); in nj_irq()
681 s0val = inb(card->base | NJ_IRQSTAT0); in nj_irq()
682 s1val = inb(card->base | NJ_IRQSTAT1); in nj_irq()
685 spin_unlock(&card->lock); in nj_irq()
688 pr_debug("%s: IRQSTAT0 %02x IRQSTAT1 %02x\n", card->name, s0val, s1val); in nj_irq()
689 card->irqcnt++; in nj_irq()
691 val = ReadISAC_nj(card, ISAC_ISTA); in nj_irq()
693 mISDNisac_irq(&card->isac, val); in nj_irq()
698 outb(s0val, card->base | NJ_IRQSTAT0); in nj_irq()
703 card->recv.dmacur = inl(card->base | NJ_DMA_WRITE_ADR); in nj_irq()
704 card->recv.idx = (card->recv.dmacur - card->recv.dmastart) >> 2; in nj_irq()
705 if (card->recv.dmacur < card->recv.dmairq) in nj_irq()
710 card->send.dmacur = inl(card->base | NJ_DMA_READ_ADR); in nj_irq()
711 card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; in nj_irq()
712 if (card->send.dmacur < card->send.dmairq) in nj_irq()
717 pr_debug("%s: DMA Status %02x/%02x/%02x %d/%d\n", card->name, in nj_irq()
718 s1val, s0val, card->last_is0, in nj_irq()
719 card->recv.idx, card->send.idx); in nj_irq()
721 if (s0val != card->last_is0) { in nj_irq()
723 (card->last_is0 & NJ_IRQM0_RD_MASK)) in nj_irq()
725 send_tiger(card, s0val); in nj_irq()
727 (card->last_is0 & NJ_IRQM0_WR_MASK)) in nj_irq()
729 recv_tiger(card, s0val); in nj_irq()
732 spin_unlock(&card->lock); in nj_irq()
742 struct tiger_hw *card = bch->hw; in nj_l2l1B() local
748 spin_lock_irqsave(&card->lock, flags); in nj_l2l1B()
754 spin_unlock_irqrestore(&card->lock, flags); in nj_l2l1B()
757 spin_lock_irqsave(&card->lock, flags); in nj_l2l1B()
762 spin_unlock_irqrestore(&card->lock, flags); in nj_l2l1B()
768 spin_lock_irqsave(&card->lock, flags); in nj_l2l1B()
771 spin_unlock_irqrestore(&card->lock, flags); in nj_l2l1B()
793 struct tiger_hw *card = bch->hw; in nj_bctrl() local
797 pr_debug("%s: %s cmd:%x %p\n", card->name, __func__, cmd, arg); in nj_bctrl()
802 spin_lock_irqsave(&card->lock, flags); in nj_bctrl()
805 spin_unlock_irqrestore(&card->lock, flags); in nj_bctrl()
815 pr_info("%s: %s unknown prim(%x)\n", card->name, __func__, cmd); in nj_bctrl()
821 channel_ctrl(struct tiger_hw *card, struct mISDN_ctrl_req *cq) in channel_ctrl() argument
835 ret = card->isac.ctrl(&card->isac, HW_TESTLOOP, cq->channel); in channel_ctrl()
838 ret = card->isac.ctrl(&card->isac, HW_TIMER3_VALUE, cq->p1); in channel_ctrl()
841 pr_info("%s: %s unknown Op %x\n", card->name, __func__, cq->op); in channel_ctrl()
849 open_bchannel(struct tiger_hw *card, struct channel_req *rq) in open_bchannel() argument
857 bch = &card->bc[rq->adr.channel - 1].bch; in open_bchannel()
874 struct tiger_hw *card = dch->hw; in nj_dctrl() local
878 pr_debug("%s: %s cmd:%x %p\n", card->name, __func__, cmd, arg); in nj_dctrl()
883 err = card->isac.open(&card->isac, rq); in nj_dctrl()
885 err = open_bchannel(card, rq); in nj_dctrl()
889 pr_info("%s: cannot get module\n", card->name); in nj_dctrl()
892 pr_debug("%s: dev(%d) close from %p\n", card->name, dch->dev.id, in nj_dctrl()
897 err = channel_ctrl(card, arg); in nj_dctrl()
901 card->name, __func__, cmd); in nj_dctrl()
908 nj_init_card(struct tiger_hw *card) in nj_init_card() argument
913 spin_lock_irqsave(&card->lock, flags); in nj_init_card()
914 nj_disable_hwirq(card); in nj_init_card()
915 spin_unlock_irqrestore(&card->lock, flags); in nj_init_card()
917 card->irq = card->pdev->irq; in nj_init_card()
918 if (request_irq(card->irq, nj_irq, IRQF_SHARED, card->name, card)) { in nj_init_card()
920 card->name, card->irq); in nj_init_card()
921 card->irq = -1; in nj_init_card()
925 spin_lock_irqsave(&card->lock, flags); in nj_init_card()
926 nj_reset(card); in nj_init_card()
927 ret = card->isac.init(&card->isac); in nj_init_card()
930 ret = inittiger(card); in nj_init_card()
933 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_init_card()
934 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_init_card()
936 spin_unlock_irqrestore(&card->lock, flags); in nj_init_card()
942 nj_release(struct tiger_hw *card) in nj_release() argument
947 if (card->base_s) { in nj_release()
948 spin_lock_irqsave(&card->lock, flags); in nj_release()
949 nj_disable_hwirq(card); in nj_release()
950 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_release()
951 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_release()
952 spin_unlock_irqrestore(&card->lock, flags); in nj_release()
953 card->isac.release(&card->isac); in nj_release()
954 release_region(card->base, card->base_s); in nj_release()
955 card->base_s = 0; in nj_release()
957 if (card->irq > 0) in nj_release()
958 free_irq(card->irq, card); in nj_release()
959 if (device_is_registered(&card->isac.dch.dev.dev)) in nj_release()
960 mISDN_unregister_device(&card->isac.dch.dev); in nj_release()
963 mISDN_freebchannel(&card->bc[i].bch); in nj_release()
964 kfree(card->bc[i].hsbuf); in nj_release()
965 kfree(card->bc[i].hrbuf); in nj_release()
967 if (card->dma_p) in nj_release()
968 dma_free_coherent(&card->pdev->dev, NJ_DMA_SIZE, card->dma_p, in nj_release()
969 card->dma); in nj_release()
971 list_del(&card->list); in nj_release()
973 pci_clear_master(card->pdev); in nj_release()
974 pci_disable_device(card->pdev); in nj_release()
975 pci_set_drvdata(card->pdev, NULL); in nj_release()
976 kfree(card); in nj_release()
981 nj_setup(struct tiger_hw *card) in nj_setup() argument
983 card->base = pci_resource_start(card->pdev, 0); in nj_setup()
984 card->base_s = pci_resource_len(card->pdev, 0); in nj_setup()
985 if (!request_region(card->base, card->base_s, card->name)) { in nj_setup()
987 card->name, card->base, in nj_setup()
988 (u32)(card->base + card->base_s - 1)); in nj_setup()
989 card->base_s = 0; in nj_setup()
992 ASSIGN_FUNC(nj, ISAC, card->isac); in nj_setup()
998 setup_instance(struct tiger_hw *card) in setup_instance() argument
1003 snprintf(card->name, MISDN_MAX_IDLEN - 1, "netjet.%d", nj_cnt + 1); in setup_instance()
1005 list_add_tail(&card->list, &Cards); in setup_instance()
1008 _set_debug(card); in setup_instance()
1009 card->isac.name = card->name; in setup_instance()
1010 spin_lock_init(&card->lock); in setup_instance()
1011 card->isac.hwlock = &card->lock; in setup_instance()
1012 mISDNisac_init(&card->isac, card); in setup_instance()
1014 card->isac.dch.dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | in setup_instance()
1016 card->isac.dch.dev.D.ctrl = nj_dctrl; in setup_instance()
1018 card->bc[i].bch.nr = i + 1; in setup_instance()
1019 set_channelmap(i + 1, card->isac.dch.dev.channelmap); in setup_instance()
1020 mISDN_initbchannel(&card->bc[i].bch, MAX_DATA_MEM, in setup_instance()
1022 card->bc[i].bch.hw = card; in setup_instance()
1023 card->bc[i].bch.ch.send = nj_l2l1B; in setup_instance()
1024 card->bc[i].bch.ch.ctrl = nj_bctrl; in setup_instance()
1025 card->bc[i].bch.ch.nr = i + 1; in setup_instance()
1026 list_add(&card->bc[i].bch.ch.list, in setup_instance()
1027 &card->isac.dch.dev.bchannels); in setup_instance()
1028 card->bc[i].bch.hw = card; in setup_instance()
1030 err = nj_setup(card); in setup_instance()
1033 err = mISDN_register_device(&card->isac.dch.dev, &card->pdev->dev, in setup_instance()
1034 card->name); in setup_instance()
1037 err = nj_init_card(card); in setup_instance()
1044 nj_release(card); in setup_instance()
1053 struct tiger_hw *card; in nj_probe() local
1073 card = kzalloc(sizeof(struct tiger_hw), GFP_KERNEL); in nj_probe()
1074 if (!card) { in nj_probe()
1079 card->pdev = pdev; in nj_probe()
1083 kfree(card); in nj_probe()
1098 card->typ = NETJET_S_TJ320; in nj_probe()
1100 card->typ = NETJET_S_TJ300; in nj_probe()
1102 card->base = pci_resource_start(pdev, 0); in nj_probe()
1103 pci_set_drvdata(pdev, card); in nj_probe()
1104 err = setup_instance(card); in nj_probe()
1114 struct tiger_hw *card = pci_get_drvdata(pdev); in nj_remove() local
1116 if (card) in nj_remove()
1117 nj_release(card); in nj_remove()