Lines Matching defs:card

44 /*      Number of ports (per card) and cards supported
54 * of frames on the way down to the card
55 * so that we can keep the card busy
105 #define FST_MEMSIZE 0x100000 /* Size of card memory (1Mb) */
175 /* Interrupts from the card are caused by various events which are presented
316 /* Number of times the card thinks the host has
425 struct fst_card_info *card; /* Card we're associated with */
426 int index; /* Port index on the card */
443 /* Per card information
452 unsigned int type; /* Type index of card */
453 unsigned int state; /* State of card */
455 unsigned short pci_conf; /* PCI card config in I/O space */
459 int card_no; /* Inst of the card on the system */
567 static void do_bottom_half_tx(struct fst_card_info *card);
568 static void do_bottom_half_rx(struct fst_card_info *card);
593 * a bit for the card indicating that there is work to do in the
594 * bottom half for the card. Note the limitation of 64 cards.
619 * Call the bottom half for each card with work waiting
624 dbg(DBG_TX, "Calling tx bh for card %d\n", i);
649 * Call the bottom half for each card with work waiting
655 "Calling rx & tx bh for card %d\n", i);
669 * Used to be a simple write to card control space but a glitch in the latest
675 fst_cpureset(struct fst_card_info *card)
680 if (card->family == FST_FAMILY_TXU) {
682 (card->device, PCI_INTERRUPT_LINE, &interrupt_line_register)) {
690 outw(0x440f, card->pci_conf + CNTRL_9054 + 2);
691 outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
696 outw(0x240f, card->pci_conf + CNTRL_9054 + 2);
701 outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
704 (card->device, PCI_INTERRUPT_LINE, interrupt_line_register)) {
710 regval = inl(card->pci_conf + CNTRL_9052);
712 outl(regval | 0x40000000, card->pci_conf + CNTRL_9052);
713 outl(regval & ~0x40000000, card->pci_conf + CNTRL_9052);
720 fst_cpurelease(struct fst_card_info *card)
722 if (card->family == FST_FAMILY_TXU) {
726 (void) readb(card->mem);
732 outw(0x040e, card->pci_conf + CNTRL_9054 + 2);
733 outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
735 (void) readb(card->ctlmem);
742 fst_clear_intr(struct fst_card_info *card)
744 if (card->family == FST_FAMILY_TXU) {
745 (void) readb(card->ctlmem);
749 outw(0x0543, card->pci_conf + INTCSR_9052);
753 /* Enable card interrupts
756 fst_enable_intr(struct fst_card_info *card)
758 if (card->family == FST_FAMILY_TXU) {
759 outl(0x0f0c0900, card->pci_conf + INTCSR_9054);
761 outw(0x0543, card->pci_conf + INTCSR_9052);
765 /* Disable card interrupts
768 fst_disable_intr(struct fst_card_info *card)
770 if (card->family == FST_FAMILY_TXU) {
771 outl(0x00000000, card->pci_conf + INTCSR_9054);
773 outw(0x0000, card->pci_conf + INTCSR_9052);
801 fst_init_dma(struct fst_card_info *card)
806 if (card->family == FST_FAMILY_TXU) {
807 pci_set_master(card->device);
808 outl(0x00020441, card->pci_conf + DMAMODE0);
809 outl(0x00020441, card->pci_conf + DMAMODE1);
810 outl(0x0, card->pci_conf + DMATHR);
817 fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
823 * Everything is now set, just tell the card to go
826 FST_WRB(card, txDescrRing[port->index][txpos].bits,
847 fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
856 skb_put_data(skb, card->rx_dma_handle_host, len);
859 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
881 fst_rx_dma(struct fst_card_info *card, dma_addr_t dma, u32 mem, int len)
888 if (card->dmarx_in_progress) {
892 outl(dma, card->pci_conf + DMAPADR0); /* Copy to here */
893 outl(mem, card->pci_conf + DMALADR0); /* from here */
894 outl(len, card->pci_conf + DMASIZ0); /* for this length */
895 outl(0x00000000c, card->pci_conf + DMADPR0); /* In this direction */
900 card->dmarx_in_progress = 1;
901 outb(0x03, card->pci_conf + DMACSR0); /* Start the transfer */
908 fst_tx_dma(struct fst_card_info *card, dma_addr_t dma, u32 mem, int len)
915 if (card->dmatx_in_progress) {
919 outl(dma, card->pci_conf + DMAPADR1); /* Copy from here */
920 outl(mem, card->pci_conf + DMALADR1); /* to here */
921 outl(len, card->pci_conf + DMASIZ1); /* for this length */
922 outl(0x000000004, card->pci_conf + DMADPR1); /* In this direction */
927 card->dmatx_in_progress = 1;
928 outb(0x03, card->pci_conf + DMACSR1); /* Start the transfer */
938 struct fst_card_info *card;
943 card = port->card;
944 spin_lock_irqsave(&card->card_lock, flags);
945 mbval = FST_RDW(card, portMailbox[port->index][0]);
950 spin_unlock_irqrestore(&card->card_lock, flags);
952 spin_lock_irqsave(&card->card_lock, flags);
959 mbval = FST_RDW(card, portMailbox[port->index][0]);
968 FST_WRW(card, portMailbox[port->index][0], cmd);
976 spin_unlock_irqrestore(&card->card_lock, flags);
984 outputs |= FST_RDL(port->card, v24OpSts[port->index]);
985 FST_WRL(port->card, v24OpSts[port->index], outputs);
994 outputs = ~outputs & FST_RDL(port->card, v24OpSts[port->index]);
995 FST_WRL(port->card, v24OpSts[port->index], outputs);
1011 struct fst_card_info *card;
1014 card = port->card;
1015 spin_lock_irqsave(&card->card_lock, flags);
1019 FST_WRW(card, rxDescrRing[pi][i].ladr, (u16) offset);
1020 FST_WRB(card, rxDescrRing[pi][i].hadr, (u8) (offset >> 16));
1021 FST_WRW(card, rxDescrRing[pi][i].bcnt, cnv_bcnt(LEN_RX_BUFFER));
1022 FST_WRW(card, rxDescrRing[pi][i].mcnt, LEN_RX_BUFFER);
1023 FST_WRB(card, rxDescrRing[pi][i].bits, DMA_OWN);
1026 spin_unlock_irqrestore(&card->card_lock, flags);
1039 struct fst_card_info *card;
1042 card = port->card;
1043 spin_lock_irqsave(&card->card_lock, flags);
1047 FST_WRW(card, txDescrRing[pi][i].ladr, (u16) offset);
1048 FST_WRB(card, txDescrRing[pi][i].hadr, (u8) (offset >> 16));
1049 FST_WRW(card, txDescrRing[pi][i].bcnt, 0);
1050 FST_WRB(card, txDescrRing[pi][i].bits, 0);
1055 spin_unlock_irqrestore(&card->card_lock, flags);
1061 fst_intr_te1_alarm(struct fst_card_info *card, struct fst_port_info *port)
1067 los = FST_RDB(card, suStatus.lossOfSignal);
1068 rra = FST_RDB(card, suStatus.receiveRemoteAlarm);
1069 ais = FST_RDB(card, suStatus.alarmIndicationSignal);
1107 fst_intr_ctlchg(struct fst_card_info *card, struct fst_port_info *port)
1111 signals = FST_RDL(card, v24DebouncedSts[port->index]);
1130 fst_log_rx_error(struct fst_card_info *card, struct fst_port_info *port,
1141 dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n",
1142 card->card_no, port->index, rxp);
1146 dbg(DBG_ASS, "Rx crc error on card %d port %d\n",
1147 card->card_no, port->index);
1151 dbg(DBG_ASS, "Rx frame error on card %d port %d\n",
1152 card->card_no, port->index);
1156 dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n",
1157 len, card->card_no, port->index);
1164 fst_recover_rx_error(struct fst_card_info *card, struct fst_port_info *port,
1178 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1185 dmabits = FST_RDB(card, rxDescrRing[pi][rxp].bits);
1192 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1203 fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
1216 dmabits = FST_RDB(card, rxDescrRing[pi][rxp].bits);
1222 if (card->dmarx_in_progress) {
1227 len = FST_RDW(card, rxDescrRing[pi][rxp].mcnt);
1236 card->card_no, port->index);
1237 /* Return descriptor to card */
1238 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1251 fst_log_rx_error(card, port, dmabits, rxp, len);
1252 fst_recover_rx_error(card, port, dmabits, rxp, len);
1262 /* Return descriptor to card */
1263 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1276 if ((len < FST_MIN_DMA_LEN) || (card->family == FST_FAMILY_TXP)) {
1278 card->mem + BUF_OFFSET(rxBuffer[pi][rxp][0]),
1282 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1299 card->dma_skb_rx = skb;
1300 card->dma_port_rx = port;
1301 card->dma_len_rx = len;
1302 card->dma_rxpos = rxp;
1303 fst_rx_dma(card, card->rx_dma_handle_card,
1320 do_bottom_half_tx(struct fst_card_info *card)
1331 * Step through each port on this card
1335 for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
1340 while (!(FST_RDB(card, txDescrRing[pi][port->txpos].bits) &
1342 !(card->dmatx_in_progress)) {
1348 spin_lock_irqsave(&card->card_lock, flags);
1356 spin_unlock_irqrestore(&card->card_lock, flags);
1361 spin_lock_irqsave(&card->card_lock, flags);
1367 spin_unlock_irqrestore(&card->card_lock, flags);
1370 * card.
1372 FST_WRW(card, txDescrRing[pi][port->txpos].bcnt,
1375 (card->family == FST_FAMILY_TXP)) {
1377 memcpy_toio(card->mem +
1382 FST_WRB(card,
1391 memcpy(card->tx_dma_handle_host,
1393 card->dma_port_tx = port;
1394 card->dma_len_tx = skb->len;
1395 card->dma_txpos = port->txpos;
1396 fst_tx_dma(card,
1397 card->tx_dma_handle_card,
1426 do_bottom_half_rx(struct fst_card_info *card)
1432 /* Check for rx completions on all ports on this card */
1434 for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
1438 while (!(FST_RDB(card, rxDescrRing[pi][port->rxpos].bits)
1439 & DMA_OWN) && !(card->dmarx_in_progress)) {
1445 fst_q_work_item(&fst_work_intq, card->card_no);
1449 fst_intr_rx(card, port);
1462 struct fst_card_info *card = dev_id;
1472 * Check to see if the interrupt was for this card
1476 dbg(DBG_INTR, "intr: %d %p\n", card->irq, card);
1477 if (card->state != FST_RUNNING) {
1478 pr_err("Interrupt received for card %d in a non running state (%d)\n",
1479 card->card_no, card->state);
1483 * a running card
1486 fst_clear_intr(card);
1491 fst_clear_intr(card);
1494 * Is the interrupt for this card (handshake == 1)
1497 if (FST_RDB(card, interruptHandshake) == 1) {
1500 FST_WRB(card, interruptHandshake, 0xEE);
1502 if (card->family == FST_FAMILY_TXU) {
1506 dma_intcsr = inl(card->pci_conf + INTCSR_9054);
1512 outb(0x8, card->pci_conf + DMACSR0);
1513 fst_rx_dma_complete(card, card->dma_port_rx,
1514 card->dma_len_rx, card->dma_skb_rx,
1515 card->dma_rxpos);
1516 card->dmarx_in_progress = 0;
1524 outb(0x8, card->pci_conf + DMACSR1);
1525 fst_tx_dma_complete(card, card->dma_port_tx,
1526 card->dma_len_tx, card->dma_txpos);
1527 card->dmatx_in_progress = 0;
1535 int_retry_count = FST_RDL(card, interruptRetryCount);
1538 card->card_no, int_retry_count);
1539 FST_WRL(card, interruptRetryCount, 0);
1547 fst_q_work_item(&fst_work_intq, card->card_no);
1551 rdidx = FST_RDB(card, interruptEvent.rdindex) & 0x1f;
1552 wridx = FST_RDB(card, interruptEvent.wrindex) & 0x1f;
1554 event = FST_RDB(card, interruptEvent.evntbuff[rdidx]);
1555 port = &card->ports[event & 0x03];
1563 fst_intr_te1_alarm(card, port);
1571 fst_intr_ctlchg(card, port);
1591 dbg(DBG_ASS, "Tx underflow on card %d port %d\n",
1592 card->card_no, port->index);
1601 card->state = FST_IFAILED;
1605 pr_err("intr: unknown card event %d. ignored\n", event);
1613 FST_WRB(card, interruptEvent.rdindex, rdidx);
1621 check_started_ok(struct fst_card_info *card)
1626 if (FST_RDW(card, smcVersion) != SMC_VERSION) {
1628 FST_RDW(card, smcVersion), SMC_VERSION);
1629 card->state = FST_BADVERSION;
1632 if (FST_RDL(card, endOfSmcSignature) != END_SIG) {
1634 card->state = FST_BADVERSION;
1638 if ((i = FST_RDB(card, taskStatus)) == 0x01) {
1639 card->state = FST_RUNNING;
1642 card->state = FST_HALTED;
1646 card->state = FST_HALTED;
1651 * number we assumed at card detection. Should never happen with
1654 if (FST_RDL(card, numberOfPorts) != card->nports) {
1655 pr_warn("Port count mismatch on card %d. Firmware thinks %d we say %d\n",
1656 card->card_no,
1657 FST_RDL(card, numberOfPorts), card->nports);
1662 set_conf_from_info(struct fst_card_info *card, struct fst_port_info *port,
1687 FST_WRB(card, portConfig[port->index].invertClock,
1690 FST_WRW(card, cardMode, info->cardMode);
1692 FST_WRL(card, suConfig.dataRate, info->lineSpeed);
1693 FST_WRB(card, suConfig.clocking, info->clockSource);
1701 FST_WRB(card, suConfig.framing, my_framing);
1702 FST_WRB(card, suConfig.structure, info->structure);
1703 FST_WRB(card, suConfig.interface, info->interface);
1704 FST_WRB(card, suConfig.coding, info->coding);
1705 FST_WRB(card, suConfig.lineBuildOut, info->lineBuildOut);
1706 FST_WRB(card, suConfig.equalizer, info->equalizer);
1707 FST_WRB(card, suConfig.transparentMode, info->transparentMode);
1708 FST_WRB(card, suConfig.loopMode, info->loopMode);
1709 FST_WRB(card, suConfig.range, info->range);
1710 FST_WRB(card, suConfig.txBufferMode, info->txBufferMode);
1711 FST_WRB(card, suConfig.rxBufferMode, info->rxBufferMode);
1712 FST_WRB(card, suConfig.startingSlot, info->startingSlot);
1713 FST_WRB(card, suConfig.losThreshold, info->losThreshold);
1715 FST_WRB(card, suConfig.enableIdleCode, 1);
1717 FST_WRB(card, suConfig.enableIdleCode, 0);
1718 FST_WRB(card, suConfig.idleCode, info->idleCode);
1752 gather_conf_info(struct fst_card_info *card, struct fst_port_info *port,
1761 info->nports = card->nports;
1762 info->type = card->type;
1763 info->state = card->state;
1770 /* Only mark information as valid if card is running.
1773 info->valid = ((card->state == FST_RUNNING) ? FSTVAL_ALL : FSTVAL_CARD)
1779 info->lineInterface = FST_RDW(card, portConfig[i].lineInterface);
1780 info->internalClock = FST_RDB(card, portConfig[i].internalClock);
1781 info->lineSpeed = FST_RDL(card, portConfig[i].lineSpeed);
1782 info->invertClock = FST_RDB(card, portConfig[i].invertClock);
1783 info->v24IpSts = FST_RDL(card, v24IpSts[i]);
1784 info->v24OpSts = FST_RDL(card, v24OpSts[i]);
1785 info->clockStatus = FST_RDW(card, clockStatus[i]);
1786 info->cableStatus = FST_RDW(card, cableStatus);
1787 info->cardMode = FST_RDW(card, cardMode);
1788 info->smcFirmwareVersion = FST_RDL(card, smcFirmwareVersion);
1795 if (card->family == FST_FAMILY_TXU) {
1812 if (card->type == FST_TYPE_TE1) {
1813 info->lineSpeed = FST_RDL(card, suConfig.dataRate);
1814 info->clockSource = FST_RDB(card, suConfig.clocking);
1815 info->framing = FST_RDB(card, suConfig.framing);
1816 info->structure = FST_RDB(card, suConfig.structure);
1817 info->interface = FST_RDB(card, suConfig.interface);
1818 info->coding = FST_RDB(card, suConfig.coding);
1819 info->lineBuildOut = FST_RDB(card, suConfig.lineBuildOut);
1820 info->equalizer = FST_RDB(card, suConfig.equalizer);
1821 info->loopMode = FST_RDB(card, suConfig.loopMode);
1822 info->range = FST_RDB(card, suConfig.range);
1823 info->txBufferMode = FST_RDB(card, suConfig.txBufferMode);
1824 info->rxBufferMode = FST_RDB(card, suConfig.rxBufferMode);
1825 info->startingSlot = FST_RDB(card, suConfig.startingSlot);
1826 info->losThreshold = FST_RDB(card, suConfig.losThreshold);
1827 if (FST_RDB(card, suConfig.enableIdleCode))
1828 info->idleCode = FST_RDB(card, suConfig.idleCode);
1832 FST_RDL(card, suStatus.receiveBufferDelay);
1834 FST_RDL(card, suStatus.framingErrorCount);
1836 FST_RDL(card, suStatus.codeViolationCount);
1837 info->crcErrorCount = FST_RDL(card, suStatus.crcErrorCount);
1838 info->lineAttenuation = FST_RDL(card, suStatus.lineAttenuation);
1839 info->lossOfSignal = FST_RDB(card, suStatus.lossOfSignal);
1841 FST_RDB(card, suStatus.receiveRemoteAlarm);
1843 FST_RDB(card, suStatus.alarmIndicationSignal);
1848 fst_set_iface(struct fst_card_info *card, struct fst_port_info *port,
1870 FST_WRW(card, portConfig[i].lineInterface, V35);
1875 FST_WRW(card, portConfig[i].lineInterface, V24);
1880 FST_WRW(card, portConfig[i].lineInterface, X21);
1885 FST_WRW(card, portConfig[i].lineInterface, X21D);
1890 FST_WRW(card, portConfig[i].lineInterface, T1);
1895 FST_WRW(card, portConfig[i].lineInterface, E1);
1908 FST_WRB(card, portConfig[i].internalClock, EXTCLK);
1912 FST_WRB(card, portConfig[i].internalClock, INTCLK);
1918 FST_WRL(card, portConfig[i].lineSpeed, sync.clock_rate);
1923 fst_get_iface(struct fst_card_info *card, struct fst_port_info *port,
1963 sync.clock_rate = FST_RDL(card, portConfig[i].lineSpeed);
1964 /* Lucky card and linux use same encoding here */
1965 sync.clock_type = FST_RDB(card, portConfig[i].internalClock) ==
1980 struct fst_card_info *card;
1990 card = port->card;
1997 fst_cpureset(card);
1998 card->state = FST_RESET;
2002 fst_cpurelease(card);
2003 card->state = FST_STARTING;
2027 /* Now copy the data to the card. */
2034 memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size);
2037 /* Writes to the memory of a card in the reset state constitute
2040 if (card->state == FST_RESET) {
2041 card->state = FST_DOWNLOAD;
2047 /* If card has just been started check the shared memory config
2050 if (card->state == FST_STARTING) {
2051 check_started_ok(card);
2053 /* If everything checked out enable card interrupts */
2054 if (card->state == FST_RUNNING) {
2055 spin_lock_irqsave(&card->card_lock, flags);
2056 fst_enable_intr(card);
2057 FST_WRB(card, interruptHandshake, 0xEE);
2058 spin_unlock_irqrestore(&card->card_lock, flags);
2066 gather_conf_info(card, port, &info);
2080 if (card->state != FST_RUNNING) {
2081 pr_err("Attempt to configure card %d in non-running state (%d)\n",
2082 card->card_no, card->state);
2089 return set_conf_from_info(card, port, &info);
2094 return fst_get_iface(card, port, ifr);
2103 return fst_set_iface(card, port, ifr);
2134 /* Only init things if card is actually running. This allows open to
2137 if (port->card->state == FST_RUNNING) {
2152 signals = FST_RDL(port->card, v24DebouncedSts[port->index]);
2168 if (port->card->state == FST_RUNNING) {
2207 struct fst_card_info *card;
2212 card = port->card;
2214 tx_dma_done = inb(card->pci_conf + DMACSR1);
2215 rx_dma_done = inb(card->pci_conf + DMACSR0);
2218 card->dmatx_in_progress, tx_dma_done, card->dmarx_in_progress,
2234 * Setting currently fixed in FarSync card so we check and forget
2245 struct fst_card_info *card;
2248 card = port->card;
2251 dbg(DBG_ASS, "Tx timeout card %d port %d\n",
2252 card->card_no, port->index);
2263 struct fst_card_info *card;
2269 card = port->card;
2278 "Tried to transmit but no carrier on card %d port %d\n",
2279 card->card_no, port->index);
2297 spin_lock_irqsave(&card->card_lock, flags);
2305 spin_unlock_irqrestore(&card->card_lock, flags);
2321 dbg(DBG_ASS, "Tx queue overflow card %d port %d\n",
2322 card->card_no, port->index);
2329 spin_lock_irqsave(&card->card_lock, flags);
2334 spin_unlock_irqrestore(&card->card_lock, flags);
2337 fst_q_work_item(&fst_work_txq, card->card_no);
2361 fst_init_card(struct fst_card_info *card)
2366 /* We're working on a number of ports based on the card ID. If the
2370 for (i = 0; i < card->nports; i++) {
2371 err = register_hdlc_device(card->ports[i].dev);
2376 unregister_hdlc_device(card->ports[i].dev);
2382 port_to_dev(&card->ports[0])->name,
2383 port_to_dev(&card->ports[card->nports - 1])->name,
2384 type_strings[card->type], card->irq, card->nports);
2397 * Initialise card when detected.
2404 struct fst_card_info *card;
2433 card = kzalloc(sizeof(struct fst_card_info), GFP_KERNEL);
2434 if (card == NULL)
2439 pr_err("Failed to enable card. Err %d\n", -err);
2449 card->pci_conf = pci_resource_start(pdev, 1);
2450 card->phys_mem = pci_resource_start(pdev, 2);
2451 card->phys_ctlmem = pci_resource_start(pdev, 3);
2452 if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) {
2457 if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) {
2462 dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem);
2465 if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) {
2466 pr_err("Unable to register interrupt %d\n", card->irq);
2472 card->irq = pdev->irq;
2473 card->type = ent->driver_data;
2474 card->family = ((ent->driver_data == FST_TYPE_T2P) ||
2479 card->nports = 1;
2481 card->nports = ((ent->driver_data == FST_TYPE_T2P) ||
2484 card->state = FST_UNINIT;
2485 spin_lock_init ( &card->card_lock );
2487 for ( i = 0 ; i < card->nports ; i++ ) {
2488 struct net_device *dev = alloc_hdlcdev(&card->ports[i]);
2492 free_netdev(card->ports[i].dev);
2497 card->ports[i].dev = dev;
2498 card->ports[i].card = card;
2499 card->ports[i].index = i;
2500 card->ports[i].run = 0;
2507 * and basic card I/O.
2509 dev->mem_start = card->phys_mem
2511 dev->mem_end = card->phys_mem
2513 dev->base_addr = card->pci_conf;
2514 dev->irq = card->irq;
2523 card->device = pdev;
2525 dbg(DBG_PCI, "type %d nports %d irq %d\n", card->type,
2526 card->nports, card->irq);
2528 card->pci_conf, card->phys_mem, card->phys_ctlmem);
2530 /* Reset the card's processor */
2531 fst_cpureset(card);
2532 card->state = FST_RESET;
2535 fst_init_dma(card);
2538 pci_set_drvdata(pdev, card);
2540 /* Remainder of card setup */
2546 fst_card_array[no_of_cards_added] = card;
2547 card->card_no = no_of_cards_added++; /* Record instance and bump it */
2548 err = fst_init_card(card);
2551 if (card->family == FST_FAMILY_TXU) {
2555 card->rx_dma_handle_host =
2556 dma_alloc_coherent(&card->device->dev, FST_MAX_MTU,
2557 &card->rx_dma_handle_card, GFP_KERNEL);
2558 if (card->rx_dma_handle_host == NULL) {
2563 card->tx_dma_handle_host =
2564 dma_alloc_coherent(&card->device->dev, FST_MAX_MTU,
2565 &card->tx_dma_handle_card, GFP_KERNEL);
2566 if (card->tx_dma_handle_host == NULL) {
2575 dma_free_coherent(&card->device->dev, FST_MAX_MTU,
2576 card->rx_dma_handle_host, card->rx_dma_handle_card);
2578 fst_disable_intr(card);
2579 for (i = 0 ; i < card->nports ; i++)
2580 unregister_hdlc_device(card->ports[i].dev);
2582 fst_card_array[card->card_no] = NULL;
2584 for (i = 0 ; i < card->nports ; i++)
2585 free_netdev(card->ports[i].dev);
2587 free_irq(card->irq, card);
2589 iounmap(card->ctlmem);
2591 iounmap(card->mem);
2597 kfree(card);
2602 * Cleanup and close down a card
2607 struct fst_card_info *card;
2610 card = pci_get_drvdata(pdev);
2612 for (i = 0; i < card->nports; i++) {
2613 struct net_device *dev = port_to_dev(&card->ports[i]);
2618 fst_disable_intr(card);
2619 free_irq(card->irq, card);
2621 iounmap(card->ctlmem);
2622 iounmap(card->mem);
2624 if (card->family == FST_FAMILY_TXU) {
2628 dma_free_coherent(&card->device->dev, FST_MAX_MTU,
2629 card->rx_dma_handle_host,
2630 card->rx_dma_handle_card);
2631 dma_free_coherent(&card->device->dev, FST_MAX_MTU,
2632 card->tx_dma_handle_host,
2633 card->tx_dma_handle_card);
2635 fst_card_array[card->card_no] = NULL;
2636 kfree(card);