Lines Matching defs:card
42 /* Number of ports (per card) and cards supported
53 * of frames on the way down to the card
54 * so that we can keep the card busy
105 #define FST_MEMSIZE 0x100000 /* Size of card memory (1Mb) */
177 /* Interrupts from the card are caused by various events which are presented
318 /* Number of times the card thinks the host has
426 struct fst_card_info *card; /* Card we're associated with */
427 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 */
562 static void do_bottom_half_tx(struct fst_card_info *card);
563 static void do_bottom_half_rx(struct fst_card_info *card);
586 * a bit for the card indicating that there is work to do in the
587 * bottom half for the card. Note the limitation of 64 cards.
610 /* Call the bottom half for each card with work waiting
615 dbg(DBG_TX, "Calling tx bh for card %d\n", i);
638 /* Call the bottom half for each card with work waiting
644 "Calling rx & tx bh for card %d\n", i);
658 * Used to be a simple write to card control space but a glitch in the latest
664 fst_cpureset(struct fst_card_info *card)
669 if (card->family == FST_FAMILY_TXU) {
671 (card->device, PCI_INTERRUPT_LINE, &interrupt_line_register)) {
678 outw(0x440f, card->pci_conf + CNTRL_9054 + 2);
679 outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
683 outw(0x240f, card->pci_conf + CNTRL_9054 + 2);
687 outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
690 (card->device, PCI_INTERRUPT_LINE, interrupt_line_register)) {
696 regval = inl(card->pci_conf + CNTRL_9052);
698 outl(regval | 0x40000000, card->pci_conf + CNTRL_9052);
699 outl(regval & ~0x40000000, card->pci_conf + CNTRL_9052);
706 fst_cpurelease(struct fst_card_info *card)
708 if (card->family == FST_FAMILY_TXU) {
711 (void)readb(card->mem);
716 outw(0x040e, card->pci_conf + CNTRL_9054 + 2);
717 outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
719 (void)readb(card->ctlmem);
726 fst_clear_intr(struct fst_card_info *card)
728 if (card->family == FST_FAMILY_TXU) {
729 (void)readb(card->ctlmem);
733 outw(0x0543, card->pci_conf + INTCSR_9052);
737 /* Enable card interrupts
740 fst_enable_intr(struct fst_card_info *card)
742 if (card->family == FST_FAMILY_TXU)
743 outl(0x0f0c0900, card->pci_conf + INTCSR_9054);
745 outw(0x0543, card->pci_conf + INTCSR_9052);
748 /* Disable card interrupts
751 fst_disable_intr(struct fst_card_info *card)
753 if (card->family == FST_FAMILY_TXU)
754 outl(0x00000000, card->pci_conf + INTCSR_9054);
756 outw(0x0000, card->pci_conf + INTCSR_9052);
782 fst_init_dma(struct fst_card_info *card)
786 if (card->family == FST_FAMILY_TXU) {
787 pci_set_master(card->device);
788 outl(0x00020441, card->pci_conf + DMAMODE0);
789 outl(0x00020441, card->pci_conf + DMAMODE1);
790 outl(0x0, card->pci_conf + DMATHR);
797 fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
802 /* Everything is now set, just tell the card to go
805 FST_WRB(card, txDescrRing[port->index][txpos].bits,
825 fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
834 skb_put_data(skb, card->rx_dma_handle_host, len);
837 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
858 fst_rx_dma(struct fst_card_info *card, dma_addr_t dma, u32 mem, int len)
864 if (card->dmarx_in_progress)
867 outl(dma, card->pci_conf + DMAPADR0); /* Copy to here */
868 outl(mem, card->pci_conf + DMALADR0); /* from here */
869 outl(len, card->pci_conf + DMASIZ0); /* for this length */
870 outl(0x00000000c, card->pci_conf + DMADPR0); /* In this direction */
874 card->dmarx_in_progress = 1;
875 outb(0x03, card->pci_conf + DMACSR0); /* Start the transfer */
881 fst_tx_dma(struct fst_card_info *card, dma_addr_t dma, u32 mem, int len)
887 if (card->dmatx_in_progress)
890 outl(dma, card->pci_conf + DMAPADR1); /* Copy from here */
891 outl(mem, card->pci_conf + DMALADR1); /* to here */
892 outl(len, card->pci_conf + DMASIZ1); /* for this length */
893 outl(0x000000004, card->pci_conf + DMADPR1); /* In this direction */
897 card->dmatx_in_progress = 1;
898 outb(0x03, card->pci_conf + DMACSR1); /* Start the transfer */
908 struct fst_card_info *card;
913 card = port->card;
914 spin_lock_irqsave(&card->card_lock, flags);
915 mbval = FST_RDW(card, portMailbox[port->index][0]);
920 spin_unlock_irqrestore(&card->card_lock, flags);
922 spin_lock_irqsave(&card->card_lock, flags);
929 mbval = FST_RDW(card, portMailbox[port->index][0]);
937 FST_WRW(card, portMailbox[port->index][0], cmd);
945 spin_unlock_irqrestore(&card->card_lock, flags);
953 outputs |= FST_RDL(port->card, v24OpSts[port->index]);
954 FST_WRL(port->card, v24OpSts[port->index], outputs);
963 outputs = ~outputs & FST_RDL(port->card, v24OpSts[port->index]);
964 FST_WRL(port->card, v24OpSts[port->index], outputs);
979 struct fst_card_info *card;
982 card = port->card;
983 spin_lock_irqsave(&card->card_lock, flags);
987 FST_WRW(card, rxDescrRing[pi][i].ladr, (u16)offset);
988 FST_WRB(card, rxDescrRing[pi][i].hadr, (u8)(offset >> 16));
989 FST_WRW(card, rxDescrRing[pi][i].bcnt, cnv_bcnt(LEN_RX_BUFFER));
990 FST_WRW(card, rxDescrRing[pi][i].mcnt, LEN_RX_BUFFER);
991 FST_WRB(card, rxDescrRing[pi][i].bits, DMA_OWN);
994 spin_unlock_irqrestore(&card->card_lock, flags);
1006 struct fst_card_info *card;
1009 card = port->card;
1010 spin_lock_irqsave(&card->card_lock, flags);
1014 FST_WRW(card, txDescrRing[pi][i].ladr, (u16)offset);
1015 FST_WRB(card, txDescrRing[pi][i].hadr, (u8)(offset >> 16));
1016 FST_WRW(card, txDescrRing[pi][i].bcnt, 0);
1017 FST_WRB(card, txDescrRing[pi][i].bits, 0);
1022 spin_unlock_irqrestore(&card->card_lock, flags);
1028 fst_intr_te1_alarm(struct fst_card_info *card, struct fst_port_info *port)
1034 los = FST_RDB(card, suStatus.lossOfSignal);
1035 rra = FST_RDB(card, suStatus.receiveRemoteAlarm);
1036 ais = FST_RDB(card, suStatus.alarmIndicationSignal);
1072 fst_intr_ctlchg(struct fst_card_info *card, struct fst_port_info *port)
1076 signals = FST_RDL(card, v24DebouncedSts[port->index]);
1095 fst_log_rx_error(struct fst_card_info *card, struct fst_port_info *port,
1105 dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n",
1106 card->card_no, port->index, rxp);
1110 dbg(DBG_ASS, "Rx crc error on card %d port %d\n",
1111 card->card_no, port->index);
1115 dbg(DBG_ASS, "Rx frame error on card %d port %d\n",
1116 card->card_no, port->index);
1120 dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n",
1121 len, card->card_no, port->index);
1128 fst_recover_rx_error(struct fst_card_info *card, struct fst_port_info *port,
1141 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1148 dmabits = FST_RDB(card, rxDescrRing[pi][rxp].bits);
1155 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1164 fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
1177 dmabits = FST_RDB(card, rxDescrRing[pi][rxp].bits);
1183 if (card->dmarx_in_progress)
1187 len = FST_RDW(card, rxDescrRing[pi][rxp].mcnt);
1195 card->card_no, port->index);
1196 /* Return descriptor to card */
1197 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1210 fst_log_rx_error(card, port, dmabits, rxp, len);
1211 fst_recover_rx_error(card, port, dmabits, rxp, len);
1222 /* Return descriptor to card */
1223 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1235 if (len < FST_MIN_DMA_LEN || card->family == FST_FAMILY_TXP) {
1237 card->mem + BUF_OFFSET(rxBuffer[pi][rxp][0]),
1241 FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
1258 card->dma_skb_rx = skb;
1259 card->dma_port_rx = port;
1260 card->dma_len_rx = len;
1261 card->dma_rxpos = rxp;
1262 fst_rx_dma(card, card->rx_dma_handle_card,
1278 do_bottom_half_tx(struct fst_card_info *card)
1288 * Step through each port on this card
1292 for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
1297 while (!(FST_RDB(card, txDescrRing[pi][port->txpos].bits) &
1299 !(card->dmatx_in_progress)) {
1304 spin_lock_irqsave(&card->card_lock, flags);
1312 spin_unlock_irqrestore(&card->card_lock, flags);
1316 spin_lock_irqsave(&card->card_lock, flags);
1322 spin_unlock_irqrestore(&card->card_lock, flags);
1324 * card.
1326 FST_WRW(card, txDescrRing[pi][port->txpos].bcnt,
1329 card->family == FST_FAMILY_TXP) {
1331 memcpy_toio(card->mem +
1336 FST_WRB(card,
1345 memcpy(card->tx_dma_handle_host,
1347 card->dma_port_tx = port;
1348 card->dma_len_tx = skb->len;
1349 card->dma_txpos = port->txpos;
1350 fst_tx_dma(card,
1351 card->tx_dma_handle_card,
1378 do_bottom_half_rx(struct fst_card_info *card)
1384 /* Check for rx completions on all ports on this card */
1386 for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
1390 while (!(FST_RDB(card, rxDescrRing[pi][port->rxpos].bits)
1391 & DMA_OWN) && !(card->dmarx_in_progress)) {
1396 fst_q_work_item(&fst_work_intq, card->card_no);
1400 fst_intr_rx(card, port);
1412 struct fst_card_info *card = dev_id;
1421 /* Check to see if the interrupt was for this card
1425 dbg(DBG_INTR, "intr: %d %p\n", card->irq, card);
1426 if (card->state != FST_RUNNING) {
1427 pr_err("Interrupt received for card %d in a non running state (%d)\n",
1428 card->card_no, card->state);
1431 * a running card
1434 fst_clear_intr(card);
1439 fst_clear_intr(card);
1441 /* Is the interrupt for this card (handshake == 1)
1444 if (FST_RDB(card, interruptHandshake) == 1) {
1447 FST_WRB(card, interruptHandshake, 0xEE);
1449 if (card->family == FST_FAMILY_TXU) {
1452 dma_intcsr = inl(card->pci_conf + INTCSR_9054);
1457 outb(0x8, card->pci_conf + DMACSR0);
1458 fst_rx_dma_complete(card, card->dma_port_rx,
1459 card->dma_len_rx, card->dma_skb_rx,
1460 card->dma_rxpos);
1461 card->dmarx_in_progress = 0;
1468 outb(0x8, card->pci_conf + DMACSR1);
1469 fst_tx_dma_complete(card, card->dma_port_tx,
1470 card->dma_len_tx, card->dma_txpos);
1471 card->dmatx_in_progress = 0;
1478 int_retry_count = FST_RDL(card, interruptRetryCount);
1481 card->card_no, int_retry_count);
1482 FST_WRL(card, interruptRetryCount, 0);
1489 fst_q_work_item(&fst_work_intq, card->card_no);
1493 rdidx = FST_RDB(card, interruptEvent.rdindex) & 0x1f;
1494 wridx = FST_RDB(card, interruptEvent.wrindex) & 0x1f;
1496 event = FST_RDB(card, interruptEvent.evntbuff[rdidx]);
1497 port = &card->ports[event & 0x03];
1505 fst_intr_te1_alarm(card, port);
1513 fst_intr_ctlchg(card, port);
1533 dbg(DBG_ASS, "Tx underflow on card %d port %d\n",
1534 card->card_no, port->index);
1543 card->state = FST_IFAILED;
1547 pr_err("intr: unknown card event %d. ignored\n", event);
1555 FST_WRB(card, interruptEvent.rdindex, rdidx);
1563 check_started_ok(struct fst_card_info *card)
1568 if (FST_RDW(card, smcVersion) != SMC_VERSION) {
1570 FST_RDW(card, smcVersion), SMC_VERSION);
1571 card->state = FST_BADVERSION;
1574 if (FST_RDL(card, endOfSmcSignature) != END_SIG) {
1576 card->state = FST_BADVERSION;
1580 i = FST_RDB(card, taskStatus);
1582 card->state = FST_RUNNING;
1585 card->state = FST_HALTED;
1589 card->state = FST_HALTED;
1594 * number we assumed at card detection. Should never happen with
1597 if (FST_RDL(card, numberOfPorts) != card->nports) {
1598 pr_warn("Port count mismatch on card %d. Firmware thinks %d we say %d\n",
1599 card->card_no,
1600 FST_RDL(card, numberOfPorts), card->nports);
1605 set_conf_from_info(struct fst_card_info *card, struct fst_port_info *port,
1630 FST_WRB(card, portConfig[port->index].invertClock,
1633 FST_WRW(card, cardMode, info->cardMode);
1635 FST_WRL(card, suConfig.dataRate, info->lineSpeed);
1636 FST_WRB(card, suConfig.clocking, info->clockSource);
1644 FST_WRB(card, suConfig.framing, my_framing);
1645 FST_WRB(card, suConfig.structure, info->structure);
1646 FST_WRB(card, suConfig.interface, info->interface);
1647 FST_WRB(card, suConfig.coding, info->coding);
1648 FST_WRB(card, suConfig.lineBuildOut, info->lineBuildOut);
1649 FST_WRB(card, suConfig.equalizer, info->equalizer);
1650 FST_WRB(card, suConfig.transparentMode, info->transparentMode);
1651 FST_WRB(card, suConfig.loopMode, info->loopMode);
1652 FST_WRB(card, suConfig.range, info->range);
1653 FST_WRB(card, suConfig.txBufferMode, info->txBufferMode);
1654 FST_WRB(card, suConfig.rxBufferMode, info->rxBufferMode);
1655 FST_WRB(card, suConfig.startingSlot, info->startingSlot);
1656 FST_WRB(card, suConfig.losThreshold, info->losThreshold);
1658 FST_WRB(card, suConfig.enableIdleCode, 1);
1660 FST_WRB(card, suConfig.enableIdleCode, 0);
1661 FST_WRB(card, suConfig.idleCode, info->idleCode);
1694 gather_conf_info(struct fst_card_info *card, struct fst_port_info *port,
1703 info->nports = card->nports;
1704 info->type = card->type;
1705 info->state = card->state;
1712 /* Only mark information as valid if card is running.
1715 info->valid = ((card->state == FST_RUNNING) ? FSTVAL_ALL : FSTVAL_CARD)
1721 info->lineInterface = FST_RDW(card, portConfig[i].lineInterface);
1722 info->internalClock = FST_RDB(card, portConfig[i].internalClock);
1723 info->lineSpeed = FST_RDL(card, portConfig[i].lineSpeed);
1724 info->invertClock = FST_RDB(card, portConfig[i].invertClock);
1725 info->v24IpSts = FST_RDL(card, v24IpSts[i]);
1726 info->v24OpSts = FST_RDL(card, v24OpSts[i]);
1727 info->clockStatus = FST_RDW(card, clockStatus[i]);
1728 info->cableStatus = FST_RDW(card, cableStatus);
1729 info->cardMode = FST_RDW(card, cardMode);
1730 info->smcFirmwareVersion = FST_RDL(card, smcFirmwareVersion);
1736 if (card->family == FST_FAMILY_TXU) {
1750 if (card->type == FST_TYPE_TE1) {
1751 info->lineSpeed = FST_RDL(card, suConfig.dataRate);
1752 info->clockSource = FST_RDB(card, suConfig.clocking);
1753 info->framing = FST_RDB(card, suConfig.framing);
1754 info->structure = FST_RDB(card, suConfig.structure);
1755 info->interface = FST_RDB(card, suConfig.interface);
1756 info->coding = FST_RDB(card, suConfig.coding);
1757 info->lineBuildOut = FST_RDB(card, suConfig.lineBuildOut);
1758 info->equalizer = FST_RDB(card, suConfig.equalizer);
1759 info->loopMode = FST_RDB(card, suConfig.loopMode);
1760 info->range = FST_RDB(card, suConfig.range);
1761 info->txBufferMode = FST_RDB(card, suConfig.txBufferMode);
1762 info->rxBufferMode = FST_RDB(card, suConfig.rxBufferMode);
1763 info->startingSlot = FST_RDB(card, suConfig.startingSlot);
1764 info->losThreshold = FST_RDB(card, suConfig.losThreshold);
1765 if (FST_RDB(card, suConfig.enableIdleCode))
1766 info->idleCode = FST_RDB(card, suConfig.idleCode);
1770 FST_RDL(card, suStatus.receiveBufferDelay);
1772 FST_RDL(card, suStatus.framingErrorCount);
1774 FST_RDL(card, suStatus.codeViolationCount);
1775 info->crcErrorCount = FST_RDL(card, suStatus.crcErrorCount);
1776 info->lineAttenuation = FST_RDL(card, suStatus.lineAttenuation);
1777 info->lossOfSignal = FST_RDB(card, suStatus.lossOfSignal);
1779 FST_RDB(card, suStatus.receiveRemoteAlarm);
1781 FST_RDB(card, suStatus.alarmIndicationSignal);
1786 fst_set_iface(struct fst_card_info *card, struct fst_port_info *port,
1805 FST_WRW(card, portConfig[i].lineInterface, V35);
1810 FST_WRW(card, portConfig[i].lineInterface, V24);
1815 FST_WRW(card, portConfig[i].lineInterface, X21);
1820 FST_WRW(card, portConfig[i].lineInterface, X21D);
1825 FST_WRW(card, portConfig[i].lineInterface, T1);
1830 FST_WRW(card, portConfig[i].lineInterface, E1);
1843 FST_WRB(card, portConfig[i].internalClock, EXTCLK);
1847 FST_WRB(card, portConfig[i].internalClock, INTCLK);
1853 FST_WRL(card, portConfig[i].lineSpeed, sync.clock_rate);
1858 fst_get_iface(struct fst_card_info *card, struct fst_port_info *port,
1897 sync.clock_rate = FST_RDL(card, portConfig[i].lineSpeed);
1898 /* Lucky card and linux use same encoding here */
1899 sync.clock_type = FST_RDB(card, portConfig[i].internalClock) ==
1913 struct fst_card_info *card;
1923 card = port->card;
1930 fst_cpureset(card);
1931 card->state = FST_RESET;
1935 fst_cpurelease(card);
1936 card->state = FST_STARTING;
1957 /* Now copy the data to the card. */
1964 memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size);
1967 /* Writes to the memory of a card in the reset state constitute
1970 if (card->state == FST_RESET)
1971 card->state = FST_DOWNLOAD;
1977 /* If card has just been started check the shared memory config
1980 if (card->state == FST_STARTING) {
1981 check_started_ok(card);
1983 /* If everything checked out enable card interrupts */
1984 if (card->state == FST_RUNNING) {
1985 spin_lock_irqsave(&card->card_lock, flags);
1986 fst_enable_intr(card);
1987 FST_WRB(card, interruptHandshake, 0xEE);
1988 spin_unlock_irqrestore(&card->card_lock, flags);
1995 gather_conf_info(card, port, &info);
2007 if (card->state != FST_RUNNING) {
2008 pr_err("Attempt to configure card %d in non-running state (%d)\n",
2009 card->card_no, card->state);
2015 return set_conf_from_info(card, port, &info);
2024 struct fst_card_info *card;
2030 card = port->card;
2037 return fst_get_iface(card, port, ifs);
2046 return fst_set_iface(card, port, ifs);
2072 /* Only init things if card is actually running. This allows open to
2075 if (port->card->state == FST_RUNNING) {
2090 signals = FST_RDL(port->card, v24DebouncedSts[port->index]);
2105 if (port->card->state == FST_RUNNING) {
2144 struct fst_card_info *card;
2149 card = port->card;
2151 tx_dma_done = inb(card->pci_conf + DMACSR1);
2152 rx_dma_done = inb(card->pci_conf + DMACSR0);
2155 card->dmatx_in_progress, tx_dma_done, card->dmarx_in_progress,
2170 /* Setting currently fixed in FarSync card so we check and forget
2181 struct fst_card_info *card;
2184 card = port->card;
2187 dbg(DBG_ASS, "Tx timeout card %d port %d\n",
2188 card->card_no, port->index);
2199 struct fst_card_info *card;
2205 card = port->card;
2214 "Tried to transmit but no carrier on card %d port %d\n",
2215 card->card_no, port->index);
2232 spin_lock_irqsave(&card->card_lock, flags);
2240 spin_unlock_irqrestore(&card->card_lock, flags);
2254 dbg(DBG_ASS, "Tx queue overflow card %d port %d\n",
2255 card->card_no, port->index);
2261 spin_lock_irqsave(&card->card_lock, flags);
2266 spin_unlock_irqrestore(&card->card_lock, flags);
2269 fst_q_work_item(&fst_work_txq, card->card_no);
2292 fst_init_card(struct fst_card_info *card)
2297 /* We're working on a number of ports based on the card ID. If the
2301 for (i = 0; i < card->nports; i++) {
2302 err = register_hdlc_device(card->ports[i].dev);
2307 unregister_hdlc_device(card->ports[i].dev);
2313 port_to_dev(&card->ports[0])->name,
2314 port_to_dev(&card->ports[card->nports - 1])->name,
2315 type_strings[card->type], card->irq, card->nports);
2328 /* Initialise card when detected.
2335 struct fst_card_info *card;
2362 card = kzalloc(sizeof(struct fst_card_info), GFP_KERNEL);
2363 if (!card)
2369 pr_err("Failed to enable card. Err %d\n", -err);
2380 card->pci_conf = pci_resource_start(pdev, 1);
2381 card->phys_mem = pci_resource_start(pdev, 2);
2382 card->phys_ctlmem = pci_resource_start(pdev, 3);
2383 card->mem = ioremap(card->phys_mem, FST_MEMSIZE);
2384 if (!card->mem) {
2389 card->ctlmem = ioremap(card->phys_ctlmem, 0x10);
2390 if (!card->ctlmem) {
2395 dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem);
2398 if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) {
2399 pr_err("Unable to register interrupt %d\n", card->irq);
2405 card->irq = pdev->irq;
2406 card->type = ent->driver_data;
2407 card->family = ((ent->driver_data == FST_TYPE_T2P) ||
2412 card->nports = 1;
2414 card->nports = ((ent->driver_data == FST_TYPE_T2P) ||
2417 card->state = FST_UNINIT;
2418 spin_lock_init(&card->card_lock);
2420 for (i = 0; i < card->nports; i++) {
2421 struct net_device *dev = alloc_hdlcdev(&card->ports[i]);
2426 free_netdev(card->ports[i].dev);
2431 card->ports[i].dev = dev;
2432 card->ports[i].card = card;
2433 card->ports[i].index = i;
2434 card->ports[i].run = 0;
2441 * and basic card I/O.
2443 dev->mem_start = card->phys_mem
2445 dev->mem_end = card->phys_mem
2447 dev->base_addr = card->pci_conf;
2448 dev->irq = card->irq;
2457 card->device = pdev;
2459 dbg(DBG_PCI, "type %d nports %d irq %d\n", card->type,
2460 card->nports, card->irq);
2462 card->pci_conf, card->phys_mem, card->phys_ctlmem);
2464 /* Reset the card's processor */
2465 fst_cpureset(card);
2466 card->state = FST_RESET;
2469 fst_init_dma(card);
2472 pci_set_drvdata(pdev, card);
2474 /* Remainder of card setup */
2480 fst_card_array[no_of_cards_added] = card;
2481 card->card_no = no_of_cards_added++; /* Record instance and bump it */
2482 err = fst_init_card(card);
2485 if (card->family == FST_FAMILY_TXU) {
2488 card->rx_dma_handle_host =
2489 dma_alloc_coherent(&card->device->dev, FST_MAX_MTU,
2490 &card->rx_dma_handle_card, GFP_KERNEL);
2491 if (!card->rx_dma_handle_host) {
2496 card->tx_dma_handle_host =
2497 dma_alloc_coherent(&card->device->dev, FST_MAX_MTU,
2498 &card->tx_dma_handle_card, GFP_KERNEL);
2499 if (!card->tx_dma_handle_host) {
2508 dma_free_coherent(&card->device->dev, FST_MAX_MTU,
2509 card->rx_dma_handle_host, card->rx_dma_handle_card);
2511 fst_disable_intr(card);
2512 for (i = 0 ; i < card->nports ; i++)
2513 unregister_hdlc_device(card->ports[i].dev);
2515 fst_card_array[card->card_no] = NULL;
2517 for (i = 0 ; i < card->nports ; i++)
2518 free_netdev(card->ports[i].dev);
2520 free_irq(card->irq, card);
2522 iounmap(card->ctlmem);
2524 iounmap(card->mem);
2530 kfree(card);
2534 /* Cleanup and close down a card
2539 struct fst_card_info *card;
2542 card = pci_get_drvdata(pdev);
2544 for (i = 0; i < card->nports; i++) {
2545 struct net_device *dev = port_to_dev(&card->ports[i]);
2551 fst_disable_intr(card);
2552 free_irq(card->irq, card);
2554 iounmap(card->ctlmem);
2555 iounmap(card->mem);
2557 if (card->family == FST_FAMILY_TXU) {
2560 dma_free_coherent(&card->device->dev, FST_MAX_MTU,
2561 card->rx_dma_handle_host,
2562 card->rx_dma_handle_card);
2563 dma_free_coherent(&card->device->dev, FST_MAX_MTU,
2564 card->tx_dma_handle_host,
2565 card->tx_dma_handle_card);
2567 fst_card_array[card->card_no] = NULL;
2568 kfree(card);