Lines Matching +full:exported +full:- +full:sram

1 /* ----------------------------------------------------------------------------
23 Am79C90 (C-LANCE) Data Sheet, 1994
47 -------------------------------------------------------------------------------
49 -------------------------------------------------------------------------------
63 4. There is a bad slow-down problem in this driver.
68 -------------------------------------------------------------------------------
70 -------------------------------------------------------------------------------
72 * 2.5.75-ac1 2003/07/11 Alan Cox <alan@lxorguk.ukuu.org.uk>
80 * Re-implement MULTI_TX dev->tbusy handling.
106 Bug fix: Make all non-exported functions private by using
112 ---------------------------------------------------------------------------- */
118 /* ----------------------------------------------------------------------------
120 ---------------------------------------------------------------------------- */
127 /* ----------------------------------------------------------------------------
129 ---------------------------------------------------------------------------- */
155 /* ----------------------------------------------------------------------------
157 ---------------------------------------------------------------------------- */
170 non-zero when the isr exits. We may not get another interrupt
177 also includes buffer management for the 32K x 8 SRAM to control up to
294 (0xFF - \
309 /* ----------------------------------------------------------------------------
311 ---------------------------------------------------------------------------- */
328 /* RFS1--Receive Status (RCVSTS) */
334 /* RFS2--Runt Packet Count (RNTPC) */
337 /* RFS3--Receive Collision Count (RCVCC) */
372 /* ----------------------------------------------------------------------------
374 ---------------------------------------------------------------------------- */
380 /* ----------------------------------------------------------------------------
384 ---------------------------------------------------------------------------- */
395 /* ----------------------------------------------------------------------------
397 ---------------------------------------------------------------------------- */
436 dev_dbg(&link->dev, "nmclan_attach()\n"); in nmclan_probe()
441 return -ENOMEM; in nmclan_probe()
443 lp->p_dev = link; in nmclan_probe()
444 link->priv = dev; in nmclan_probe()
446 spin_lock_init(&lp->bank_lock); in nmclan_probe()
447 link->resource[0]->end = 32; in nmclan_probe()
448 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; in nmclan_probe()
449 link->config_flags |= CONF_ENABLE_IRQ; in nmclan_probe()
450 link->config_index = 1; in nmclan_probe()
451 link->config_regs = PRESENT_OPTION; in nmclan_probe()
453 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; in nmclan_probe()
455 dev->netdev_ops = &mace_netdev_ops; in nmclan_probe()
456 dev->ethtool_ops = &netdev_ethtool_ops; in nmclan_probe()
457 dev->watchdog_timeo = TX_TIMEOUT; in nmclan_probe()
464 struct net_device *dev = link->priv; in nmclan_detach()
466 dev_dbg(&link->dev, "nmclan_detach\n"); in nmclan_detach()
475 /* ----------------------------------------------------------------------------
481 ---------------------------------------------------------------------------- */
488 case 0: /* register 0-15 */ in mace_read()
491 case 1: /* register 16-31 */ in mace_read()
492 spin_lock_irqsave(&lp->bank_lock, flags); in mace_read()
496 spin_unlock_irqrestore(&lp->bank_lock, flags); in mace_read()
502 /* ----------------------------------------------------------------------------
508 ---------------------------------------------------------------------------- */
515 case 0: /* register 0-15 */ in mace_write()
518 case 1: /* register 16-31 */ in mace_write()
519 spin_lock_irqsave(&lp->bank_lock, flags); in mace_write()
523 spin_unlock_irqrestore(&lp->bank_lock, flags); in mace_write()
528 /* ----------------------------------------------------------------------------
531 ---------------------------------------------------------------------------- */
544 return -1; in mace_init()
557 * Bit 2-1 PORTSEL[1-0] Port Select. in mace_init()
558 * 00 AUI/10Base-2 in mace_init()
559 * 01 10Base-T in mace_init()
564 * 0x00 for 10Base-2 in mace_init()
565 * 0x02 for 10Base-T in mace_init()
577 /* ASEL Auto Select. When set, the PORTSEL[1-0] bits are overridden, in mace_init()
591 return -1; in mace_init()
607 struct net_device *dev = link->priv; in nmclan_config()
614 dev_dbg(&link->dev, "nmclan_config\n"); in nmclan_config()
616 link->io_lines = 5; in nmclan_config()
627 dev->irq = link->irq; in nmclan_config()
628 dev->base_addr = link->resource[0]->start; in nmclan_config()
630 ioaddr = dev->base_addr; in nmclan_config()
638 memcpy(dev->dev_addr, buf, ETH_ALEN); in nmclan_config()
648 dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n", in nmclan_config()
653 return -ENODEV; in nmclan_config()
657 if(mace_init(lp, ioaddr, dev->dev_addr) == -1) in nmclan_config()
662 dev->if_port = if_port; in nmclan_config()
666 SET_NETDEV_DEV(dev, &link->dev); in nmclan_config()
675 dev->base_addr, dev->irq, if_names[dev->if_port], dev->dev_addr); in nmclan_config()
680 return -ENODEV; in nmclan_config()
685 dev_dbg(&link->dev, "nmclan_release\n"); in nmclan_release()
691 struct net_device *dev = link->priv; in nmclan_suspend()
693 if (link->open) in nmclan_suspend()
701 struct net_device *dev = link->priv; in nmclan_resume()
703 if (link->open) { in nmclan_resume()
712 /* ----------------------------------------------------------------------------
715 ---------------------------------------------------------------------------- */
721 struct pcmcia_device *link = &lp->link; in nmclan_reset()
728 dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%x, resetting...\n", in nmclan_reset()
737 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; in nmclan_reset()
742 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; in nmclan_reset()
745 mace_init(lp, dev->base_addr, dev->dev_addr); in nmclan_reset()
746 mace_write(lp, dev->base_addr, MACE_IMR, MACE_IMR_DEFAULT); in nmclan_reset()
752 /* ----------------------------------------------------------------------------
755 standard? If so, there should be defines to indicate 1=10Base-T,
756 2=10Base-2, etc. including limited automatic detection.]
757 ---------------------------------------------------------------------------- */
760 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) { in mace_config()
761 if (map->port <= 2) { in mace_config()
762 dev->if_port = map->port; in mace_config()
763 netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]); in mace_config()
765 return -EINVAL; in mace_config()
770 /* ----------------------------------------------------------------------------
773 ---------------------------------------------------------------------------- */
776 unsigned int ioaddr = dev->base_addr; in mace_open()
778 struct pcmcia_device *link = lp->p_dev; in mace_open()
781 return -ENODEV; in mace_open()
783 link->open++; in mace_open()
793 /* ----------------------------------------------------------------------------
796 ---------------------------------------------------------------------------- */
799 unsigned int ioaddr = dev->base_addr; in mace_close()
801 struct pcmcia_device *link = lp->p_dev; in mace_close()
803 dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); in mace_close()
808 link->open--; in mace_close()
817 strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); in netdev_get_drvinfo()
818 snprintf(info->bus_info, sizeof(info->bus_info), in netdev_get_drvinfo()
819 "PCMCIA 0x%lx", dev->base_addr); in netdev_get_drvinfo()
826 /* ----------------------------------------------------------------------------
833 driver." If _start_xmit returns non-zero, the "transmission
835 ---------------------------------------------------------------------------- */
840 struct pcmcia_device *link = lp->p_dev; in mace_tx_timeout()
842 netdev_notice(dev, "transmit timed out -- "); in mace_tx_timeout()
845 pcmcia_reset_card(link->socket); in mace_tx_timeout()
857 unsigned int ioaddr = dev->base_addr; in mace_start_xmit()
862 dev->name, (long)skb->len); in mace_start_xmit()
868 lp->tx_irq_disabled=1; in mace_start_xmit()
873 mace_tx_timeout will take care of timer-based retransmissions from in mace_start_xmit()
878 dev->stats.tx_bytes += skb->len; in mace_start_xmit()
879 lp->tx_free_frames--; in mace_start_xmit()
883 outw(skb->len, ioaddr + AM2150_XMT); in mace_start_xmit()
885 outsw(ioaddr + AM2150_XMT, skb->data, skb->len >> 1); in mace_start_xmit()
886 if (skb->len & 1) { in mace_start_xmit()
888 outb(skb->data[skb->len-1], ioaddr + AM2150_XMT); in mace_start_xmit()
892 if (lp->tx_free_frames > 0) in mace_start_xmit()
898 /* Re-enable MACE TX interrupts. */ in mace_start_xmit()
899 lp->tx_irq_disabled=0; in mace_start_xmit()
908 /* ----------------------------------------------------------------------------
911 ---------------------------------------------------------------------------- */
926 ioaddr = dev->base_addr; in mace_interrupt()
928 if (lp->tx_irq_disabled) { in mace_interrupt()
930 if (lp->tx_irq_disabled) in mace_interrupt()
933 msg = "Re-entering the interrupt handler"; in mace_interrupt()
966 dev->stats.tx_errors++; in mace_interrupt()
972 if (xmtrc & MACE_XMTRC_EXDEF) lp->mace_stats.exdef++; in mace_interrupt()
973 lp->mace_stats.xmtrc += (xmtrc & MACE_XMTRC_XMTRC); in mace_interrupt()
979 lp->mace_stats.xmtsv++; in mace_interrupt()
985 lp->mace_stats.uflo++; in mace_interrupt()
989 lp->mace_stats.lcol++; in mace_interrupt()
993 lp->mace_stats.more++; in mace_interrupt()
997 lp->mace_stats.one++; in mace_interrupt()
1001 lp->mace_stats.defer++; in mace_interrupt()
1005 lp->mace_stats.lcar++; in mace_interrupt()
1009 lp->mace_stats.rtry++; in mace_interrupt()
1015 dev->stats.tx_packets++; in mace_interrupt()
1016 lp->tx_free_frames++; in mace_interrupt()
1022 /* Jabber Error. Excessive transmit duration (20-150ms). */ in mace_interrupt()
1023 lp->mace_stats.jab++; in mace_interrupt()
1027 lp->mace_stats.babl++; in mace_interrupt()
1033 lp->mace_stats.cerr++; in mace_interrupt()
1037 lp->mace_stats.rcvcco++; in mace_interrupt()
1041 lp->mace_stats.rntpco++; in mace_interrupt()
1045 lp->mace_stats.mpco++; in mace_interrupt()
1049 } while ((status & ~MACE_IMR_DEFAULT) && (--IntrCnt)); in mace_interrupt()
1054 /* ----------------------------------------------------------------------------
1057 ---------------------------------------------------------------------------- */
1061 unsigned int ioaddr = dev->base_addr; in mace_rx()
1068 (RxCnt--) in mace_rx()
1073 " 0x%X.\n", dev->name, rx_framecnt, rx_status); in mace_rx()
1076 dev->stats.rx_errors++; in mace_rx()
1078 lp->mace_stats.oflo++; in mace_rx()
1081 lp->mace_stats.clsn++; in mace_rx()
1084 lp->mace_stats.fram++; in mace_rx()
1087 lp->mace_stats.fcs++; in mace_rx()
1090 short pkt_len = (rx_status & ~MACE_RCVFS_RCVSTS) - 4; in mace_rx()
1094 lp->mace_stats.rfs_rntpc += inb(ioaddr + AM2150_RCV); in mace_rx()
1096 lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); in mace_rx()
1108 *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV); in mace_rx()
1109 skb->protocol = eth_type_trans(skb, dev); in mace_rx()
1113 dev->stats.rx_packets++; in mace_rx()
1114 dev->stats.rx_bytes += pkt_len; in mace_rx()
1119 " %d.\n", dev->name, pkt_len); in mace_rx()
1120 dev->stats.rx_dropped++; in mace_rx()
1129 /* ----------------------------------------------------------------------------
1131 ---------------------------------------------------------------------------- */
1135 pr_debug(" rx_packets=%-7ld tx_packets=%ld\n", in pr_linux_stats()
1136 (long)pstats->rx_packets, (long)pstats->tx_packets); in pr_linux_stats()
1137 pr_debug(" rx_errors=%-7ld tx_errors=%ld\n", in pr_linux_stats()
1138 (long)pstats->rx_errors, (long)pstats->tx_errors); in pr_linux_stats()
1139 pr_debug(" rx_dropped=%-7ld tx_dropped=%ld\n", in pr_linux_stats()
1140 (long)pstats->rx_dropped, (long)pstats->tx_dropped); in pr_linux_stats()
1141 pr_debug(" multicast=%-7ld collisions=%ld\n", in pr_linux_stats()
1142 (long)pstats->multicast, (long)pstats->collisions); in pr_linux_stats()
1144 pr_debug(" rx_length_errors=%-7ld rx_over_errors=%ld\n", in pr_linux_stats()
1145 (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); in pr_linux_stats()
1146 pr_debug(" rx_crc_errors=%-7ld rx_frame_errors=%ld\n", in pr_linux_stats()
1147 (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); in pr_linux_stats()
1148 pr_debug(" rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", in pr_linux_stats()
1149 (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); in pr_linux_stats()
1151 pr_debug(" tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", in pr_linux_stats()
1152 (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); in pr_linux_stats()
1153 pr_debug(" tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", in pr_linux_stats()
1154 (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); in pr_linux_stats()
1156 (long)pstats->tx_window_errors); in pr_linux_stats()
1159 /* ----------------------------------------------------------------------------
1161 ---------------------------------------------------------------------------- */
1166 pr_debug(" xmtsv=%-7d uflo=%d\n", in pr_mace_stats()
1167 pstats->xmtsv, pstats->uflo); in pr_mace_stats()
1168 pr_debug(" lcol=%-7d more=%d\n", in pr_mace_stats()
1169 pstats->lcol, pstats->more); in pr_mace_stats()
1170 pr_debug(" one=%-7d defer=%d\n", in pr_mace_stats()
1171 pstats->one, pstats->defer); in pr_mace_stats()
1172 pr_debug(" lcar=%-7d rtry=%d\n", in pr_mace_stats()
1173 pstats->lcar, pstats->rtry); in pr_mace_stats()
1176 pr_debug(" exdef=%-7d xmtrc=%d\n", in pr_mace_stats()
1177 pstats->exdef, pstats->xmtrc); in pr_mace_stats()
1179 /* RFS1--Receive Status (RCVSTS) */ in pr_mace_stats()
1180 pr_debug(" oflo=%-7d clsn=%d\n", in pr_mace_stats()
1181 pstats->oflo, pstats->clsn); in pr_mace_stats()
1182 pr_debug(" fram=%-7d fcs=%d\n", in pr_mace_stats()
1183 pstats->fram, pstats->fcs); in pr_mace_stats()
1185 /* RFS2--Runt Packet Count (RNTPC) */ in pr_mace_stats()
1186 /* RFS3--Receive Collision Count (RCVCC) */ in pr_mace_stats()
1187 pr_debug(" rfs_rntpc=%-7d rfs_rcvcc=%d\n", in pr_mace_stats()
1188 pstats->rfs_rntpc, pstats->rfs_rcvcc); in pr_mace_stats()
1191 pr_debug(" jab=%-7d babl=%d\n", in pr_mace_stats()
1192 pstats->jab, pstats->babl); in pr_mace_stats()
1193 pr_debug(" cerr=%-7d rcvcco=%d\n", in pr_mace_stats()
1194 pstats->cerr, pstats->rcvcco); in pr_mace_stats()
1195 pr_debug(" rntpco=%-7d mpco=%d\n", in pr_mace_stats()
1196 pstats->rntpco, pstats->mpco); in pr_mace_stats()
1199 pr_debug(" mpc=%d\n", pstats->mpc); in pr_mace_stats()
1202 pr_debug(" rntpc=%d\n", pstats->rntpc); in pr_mace_stats()
1205 pr_debug(" rcvcc=%d\n", pstats->rcvcc); in pr_mace_stats()
1209 /* ----------------------------------------------------------------------------
1212 should be run single-threaded if the device is active. This is
1215 than use a special window-state variable.
1219 card's SRAM fast enough. If this happens, something is
1221 ---------------------------------------------------------------------------- */
1226 lp->mace_stats.rcvcc += mace_read(lp, ioaddr, MACE_RCVCC); in update_stats()
1227 lp->mace_stats.rntpc += mace_read(lp, ioaddr, MACE_RNTPC); in update_stats()
1228 lp->mace_stats.mpc += mace_read(lp, ioaddr, MACE_MPC); in update_stats()
1235 /* dev->stats.multicast; */ in update_stats()
1236 dev->stats.collisions = in update_stats()
1237 lp->mace_stats.rcvcco * 256 + lp->mace_stats.rcvcc; in update_stats()
1244 dev->stats.rx_length_errors = in update_stats()
1245 lp->mace_stats.rntpco * 256 + lp->mace_stats.rntpc; in update_stats()
1246 /* dev->stats.rx_over_errors */ in update_stats()
1247 dev->stats.rx_crc_errors = lp->mace_stats.fcs; in update_stats()
1248 dev->stats.rx_frame_errors = lp->mace_stats.fram; in update_stats()
1249 dev->stats.rx_fifo_errors = lp->mace_stats.oflo; in update_stats()
1250 dev->stats.rx_missed_errors = in update_stats()
1251 lp->mace_stats.mpco * 256 + lp->mace_stats.mpc; in update_stats()
1254 dev->stats.tx_aborted_errors = lp->mace_stats.rtry; in update_stats()
1255 dev->stats.tx_carrier_errors = lp->mace_stats.lcar; in update_stats()
1257 dev->stats.tx_fifo_errors = lp->mace_stats.uflo; in update_stats()
1258 dev->stats.tx_heartbeat_errors = lp->mace_stats.cerr; in update_stats()
1259 /* dev->stats.tx_window_errors; */ in update_stats()
1262 /* ----------------------------------------------------------------------------
1265 ---------------------------------------------------------------------------- */
1270 update_stats(dev->base_addr, dev); in mace_get_stats()
1272 pr_debug("%s: updating the statistics.\n", dev->name); in mace_get_stats()
1273 pr_linux_stats(&dev->stats); in mace_get_stats()
1274 pr_mace_stats(&lp->mace_stats); in mace_get_stats()
1276 return &dev->stats; in mace_get_stats()
1279 /* ----------------------------------------------------------------------------
1282 ---------------------------------------------------------------------------- */
1299 for (j = 32; j > 0; j--) in updateCRC()
1300 CRC[j] = CRC[j-1]; in updateCRC()
1309 /* ----------------------------------------------------------------------------
1317 ---------------------------------------------------------------------------- */
1348 /* ----------------------------------------------------------------------------
1356 ---------------------------------------------------------------------------- */
1360 int num_addrs = lp->multicast_num_addrs; in restore_multicast_list()
1361 int *ladrf = lp->multicast_ladrf; in restore_multicast_list()
1362 unsigned int ioaddr = dev->base_addr; in restore_multicast_list()
1366 dev->name, num_addrs); in restore_multicast_list()
1400 /* ----------------------------------------------------------------------------
1405 num_addrs == -1 Promiscuous mode, receive all packets
1408 best-effort filtering.
1412 ---------------------------------------------------------------------------- */
1426 dev->name, old); in set_multicast_list()
1432 lp->multicast_num_addrs = netdev_mc_count(dev); in set_multicast_list()
1437 memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN); in set_multicast_list()
1439 memcpy(adr, ha->addr, ETH_ALEN); in set_multicast_list()
1440 BuildLAF(lp->multicast_ladrf, adr); in set_multicast_list()
1452 unsigned int ioaddr = dev->base_addr; in restore_multicast_list()
1455 pr_debug("%s: restoring Rx mode to %d addresses.\n", dev->name, in restore_multicast_list()
1456 lp->multicast_num_addrs); in restore_multicast_list()
1458 if (dev->flags & IFF_PROMISC) { in restore_multicast_list()
1481 dev->name, old); in set_multicast_list()
1486 lp->multicast_num_addrs = netdev_mc_count(dev); in set_multicast_list()
1493 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),