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 ---------------------------------------------------------------------------- */
545 return -1; in mace_init()
558 * Bit 2-1 PORTSEL[1-0] Port Select. in mace_init()
559 * 00 AUI/10Base-2 in mace_init()
560 * 01 10Base-T in mace_init()
565 * 0x00 for 10Base-2 in mace_init()
566 * 0x02 for 10Base-T in mace_init()
578 /* ASEL Auto Select. When set, the PORTSEL[1-0] bits are overridden, in mace_init()
592 return -1; in mace_init()
608 struct net_device *dev = link->priv; in nmclan_config()
615 dev_dbg(&link->dev, "nmclan_config\n"); in nmclan_config()
617 link->io_lines = 5; in nmclan_config()
628 dev->irq = link->irq; in nmclan_config()
629 dev->base_addr = link->resource[0]->start; in nmclan_config()
631 ioaddr = dev->base_addr; in nmclan_config()
649 dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n", in nmclan_config()
658 if(mace_init(lp, ioaddr, dev->dev_addr) == -1) in nmclan_config()
663 dev->if_port = if_port; in nmclan_config()
667 SET_NETDEV_DEV(dev, &link->dev); in nmclan_config()
676 dev->base_addr, dev->irq, if_names[dev->if_port], dev->dev_addr); in nmclan_config()
681 return -ENODEV; in nmclan_config()
686 dev_dbg(&link->dev, "nmclan_release\n"); in nmclan_release()
692 struct net_device *dev = link->priv; in nmclan_suspend()
694 if (link->open) in nmclan_suspend()
702 struct net_device *dev = link->priv; in nmclan_resume()
704 if (link->open) { in nmclan_resume()
713 /* ----------------------------------------------------------------------------
716 ---------------------------------------------------------------------------- */
722 struct pcmcia_device *link = &lp->link; in nmclan_reset()
729 dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%x, resetting...\n", in nmclan_reset()
738 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; in nmclan_reset()
743 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; in nmclan_reset()
746 mace_init(lp, dev->base_addr, dev->dev_addr); in nmclan_reset()
747 mace_write(lp, dev->base_addr, MACE_IMR, MACE_IMR_DEFAULT); in nmclan_reset()
753 /* ----------------------------------------------------------------------------
756 standard? If so, there should be defines to indicate 1=10Base-T,
757 2=10Base-2, etc. including limited automatic detection.]
758 ---------------------------------------------------------------------------- */
761 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) { in mace_config()
762 if (map->port <= 2) { in mace_config()
763 WRITE_ONCE(dev->if_port, map->port); in mace_config()
764 netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]); in mace_config()
766 return -EINVAL; in mace_config()
771 /* ----------------------------------------------------------------------------
774 ---------------------------------------------------------------------------- */
777 unsigned int ioaddr = dev->base_addr; in mace_open()
779 struct pcmcia_device *link = lp->p_dev; in mace_open()
782 return -ENODEV; in mace_open()
784 link->open++; in mace_open()
794 /* ----------------------------------------------------------------------------
797 ---------------------------------------------------------------------------- */
800 unsigned int ioaddr = dev->base_addr; in mace_close()
802 struct pcmcia_device *link = lp->p_dev; in mace_close()
804 dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); in mace_close()
809 link->open--; in mace_close()
818 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); in netdev_get_drvinfo()
819 snprintf(info->bus_info, sizeof(info->bus_info), in netdev_get_drvinfo()
820 "PCMCIA 0x%lx", dev->base_addr); in netdev_get_drvinfo()
827 /* ----------------------------------------------------------------------------
834 driver." If _start_xmit returns non-zero, the "transmission
836 ---------------------------------------------------------------------------- */
841 struct pcmcia_device *link = lp->p_dev; in mace_tx_timeout()
843 netdev_notice(dev, "transmit timed out -- "); in mace_tx_timeout()
846 pcmcia_reset_card(link->socket); in mace_tx_timeout()
858 unsigned int ioaddr = dev->base_addr; in mace_start_xmit()
863 dev->name, (long)skb->len); in mace_start_xmit()
869 lp->tx_irq_disabled=1; in mace_start_xmit()
874 mace_tx_timeout will take care of timer-based retransmissions from in mace_start_xmit()
879 dev->stats.tx_bytes += skb->len; in mace_start_xmit()
880 lp->tx_free_frames--; in mace_start_xmit()
884 outw(skb->len, ioaddr + AM2150_XMT); in mace_start_xmit()
886 outsw(ioaddr + AM2150_XMT, skb->data, skb->len >> 1); in mace_start_xmit()
887 if (skb->len & 1) { in mace_start_xmit()
889 outb(skb->data[skb->len-1], ioaddr + AM2150_XMT); in mace_start_xmit()
893 if (lp->tx_free_frames > 0) in mace_start_xmit()
899 /* Re-enable MACE TX interrupts. */ in mace_start_xmit()
900 lp->tx_irq_disabled=0; in mace_start_xmit()
909 /* ----------------------------------------------------------------------------
912 ---------------------------------------------------------------------------- */
927 ioaddr = dev->base_addr; in mace_interrupt()
929 if (lp->tx_irq_disabled) { in mace_interrupt()
931 if (lp->tx_irq_disabled) in mace_interrupt()
934 msg = "Re-entering the interrupt handler"; in mace_interrupt()
967 dev->stats.tx_errors++; in mace_interrupt()
973 if (xmtrc & MACE_XMTRC_EXDEF) lp->mace_stats.exdef++; in mace_interrupt()
974 lp->mace_stats.xmtrc += (xmtrc & MACE_XMTRC_XMTRC); in mace_interrupt()
980 lp->mace_stats.xmtsv++; in mace_interrupt()
986 lp->mace_stats.uflo++; in mace_interrupt()
990 lp->mace_stats.lcol++; in mace_interrupt()
994 lp->mace_stats.more++; in mace_interrupt()
998 lp->mace_stats.one++; in mace_interrupt()
1002 lp->mace_stats.defer++; in mace_interrupt()
1006 lp->mace_stats.lcar++; in mace_interrupt()
1010 lp->mace_stats.rtry++; in mace_interrupt()
1016 dev->stats.tx_packets++; in mace_interrupt()
1017 lp->tx_free_frames++; in mace_interrupt()
1023 /* Jabber Error. Excessive transmit duration (20-150ms). */ in mace_interrupt()
1024 lp->mace_stats.jab++; in mace_interrupt()
1028 lp->mace_stats.babl++; in mace_interrupt()
1034 lp->mace_stats.cerr++; in mace_interrupt()
1038 lp->mace_stats.rcvcco++; in mace_interrupt()
1042 lp->mace_stats.rntpco++; in mace_interrupt()
1046 lp->mace_stats.mpco++; in mace_interrupt()
1050 } while ((status & ~MACE_IMR_DEFAULT) && (--IntrCnt)); in mace_interrupt()
1055 /* ----------------------------------------------------------------------------
1058 ---------------------------------------------------------------------------- */
1062 unsigned int ioaddr = dev->base_addr; in mace_rx()
1069 (RxCnt--) in mace_rx()
1074 " 0x%X.\n", dev->name, rx_framecnt, rx_status); in mace_rx()
1077 dev->stats.rx_errors++; in mace_rx()
1079 lp->mace_stats.oflo++; in mace_rx()
1082 lp->mace_stats.clsn++; in mace_rx()
1085 lp->mace_stats.fram++; in mace_rx()
1088 lp->mace_stats.fcs++; in mace_rx()
1091 short pkt_len = (rx_status & ~MACE_RCVFS_RCVSTS) - 4; in mace_rx()
1095 lp->mace_stats.rfs_rntpc += inb(ioaddr + AM2150_RCV); in mace_rx()
1097 lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); in mace_rx()
1109 *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV); in mace_rx()
1110 skb->protocol = eth_type_trans(skb, dev); in mace_rx()
1114 dev->stats.rx_packets++; in mace_rx()
1115 dev->stats.rx_bytes += pkt_len; in mace_rx()
1120 " %d.\n", dev->name, pkt_len); in mace_rx()
1121 dev->stats.rx_dropped++; in mace_rx()
1130 /* ----------------------------------------------------------------------------
1132 ---------------------------------------------------------------------------- */
1136 pr_debug(" rx_packets=%-7ld tx_packets=%ld\n", in pr_linux_stats()
1137 (long)pstats->rx_packets, (long)pstats->tx_packets); in pr_linux_stats()
1138 pr_debug(" rx_errors=%-7ld tx_errors=%ld\n", in pr_linux_stats()
1139 (long)pstats->rx_errors, (long)pstats->tx_errors); in pr_linux_stats()
1140 pr_debug(" rx_dropped=%-7ld tx_dropped=%ld\n", in pr_linux_stats()
1141 (long)pstats->rx_dropped, (long)pstats->tx_dropped); in pr_linux_stats()
1142 pr_debug(" multicast=%-7ld collisions=%ld\n", in pr_linux_stats()
1143 (long)pstats->multicast, (long)pstats->collisions); in pr_linux_stats()
1145 pr_debug(" rx_length_errors=%-7ld rx_over_errors=%ld\n", in pr_linux_stats()
1146 (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); in pr_linux_stats()
1147 pr_debug(" rx_crc_errors=%-7ld rx_frame_errors=%ld\n", in pr_linux_stats()
1148 (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); in pr_linux_stats()
1149 pr_debug(" rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", in pr_linux_stats()
1150 (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); in pr_linux_stats()
1152 pr_debug(" tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", in pr_linux_stats()
1153 (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); in pr_linux_stats()
1154 pr_debug(" tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", in pr_linux_stats()
1155 (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); in pr_linux_stats()
1157 (long)pstats->tx_window_errors); in pr_linux_stats()
1160 /* ----------------------------------------------------------------------------
1162 ---------------------------------------------------------------------------- */
1167 pr_debug(" xmtsv=%-7d uflo=%d\n", in pr_mace_stats()
1168 pstats->xmtsv, pstats->uflo); in pr_mace_stats()
1169 pr_debug(" lcol=%-7d more=%d\n", in pr_mace_stats()
1170 pstats->lcol, pstats->more); in pr_mace_stats()
1171 pr_debug(" one=%-7d defer=%d\n", in pr_mace_stats()
1172 pstats->one, pstats->defer); in pr_mace_stats()
1173 pr_debug(" lcar=%-7d rtry=%d\n", in pr_mace_stats()
1174 pstats->lcar, pstats->rtry); in pr_mace_stats()
1177 pr_debug(" exdef=%-7d xmtrc=%d\n", in pr_mace_stats()
1178 pstats->exdef, pstats->xmtrc); in pr_mace_stats()
1180 /* RFS1--Receive Status (RCVSTS) */ in pr_mace_stats()
1181 pr_debug(" oflo=%-7d clsn=%d\n", in pr_mace_stats()
1182 pstats->oflo, pstats->clsn); in pr_mace_stats()
1183 pr_debug(" fram=%-7d fcs=%d\n", in pr_mace_stats()
1184 pstats->fram, pstats->fcs); in pr_mace_stats()
1186 /* RFS2--Runt Packet Count (RNTPC) */ in pr_mace_stats()
1187 /* RFS3--Receive Collision Count (RCVCC) */ in pr_mace_stats()
1188 pr_debug(" rfs_rntpc=%-7d rfs_rcvcc=%d\n", in pr_mace_stats()
1189 pstats->rfs_rntpc, pstats->rfs_rcvcc); in pr_mace_stats()
1192 pr_debug(" jab=%-7d babl=%d\n", in pr_mace_stats()
1193 pstats->jab, pstats->babl); in pr_mace_stats()
1194 pr_debug(" cerr=%-7d rcvcco=%d\n", in pr_mace_stats()
1195 pstats->cerr, pstats->rcvcco); in pr_mace_stats()
1196 pr_debug(" rntpco=%-7d mpco=%d\n", in pr_mace_stats()
1197 pstats->rntpco, pstats->mpco); in pr_mace_stats()
1200 pr_debug(" mpc=%d\n", pstats->mpc); in pr_mace_stats()
1203 pr_debug(" rntpc=%d\n", pstats->rntpc); in pr_mace_stats()
1206 pr_debug(" rcvcc=%d\n", pstats->rcvcc); in pr_mace_stats()
1210 /* ----------------------------------------------------------------------------
1213 should be run single-threaded if the device is active. This is
1216 than use a special window-state variable.
1220 card's SRAM fast enough. If this happens, something is
1222 ---------------------------------------------------------------------------- */
1227 lp->mace_stats.rcvcc += mace_read(lp, ioaddr, MACE_RCVCC); in update_stats()
1228 lp->mace_stats.rntpc += mace_read(lp, ioaddr, MACE_RNTPC); in update_stats()
1229 lp->mace_stats.mpc += mace_read(lp, ioaddr, MACE_MPC); in update_stats()
1236 /* dev->stats.multicast; */ in update_stats()
1237 dev->stats.collisions = in update_stats()
1238 lp->mace_stats.rcvcco * 256 + lp->mace_stats.rcvcc; in update_stats()
1245 dev->stats.rx_length_errors = in update_stats()
1246 lp->mace_stats.rntpco * 256 + lp->mace_stats.rntpc; in update_stats()
1247 /* dev->stats.rx_over_errors */ in update_stats()
1248 dev->stats.rx_crc_errors = lp->mace_stats.fcs; in update_stats()
1249 dev->stats.rx_frame_errors = lp->mace_stats.fram; in update_stats()
1250 dev->stats.rx_fifo_errors = lp->mace_stats.oflo; in update_stats()
1251 dev->stats.rx_missed_errors = in update_stats()
1252 lp->mace_stats.mpco * 256 + lp->mace_stats.mpc; in update_stats()
1255 dev->stats.tx_aborted_errors = lp->mace_stats.rtry; in update_stats()
1256 dev->stats.tx_carrier_errors = lp->mace_stats.lcar; in update_stats()
1258 dev->stats.tx_fifo_errors = lp->mace_stats.uflo; in update_stats()
1259 dev->stats.tx_heartbeat_errors = lp->mace_stats.cerr; in update_stats()
1260 /* dev->stats.tx_window_errors; */ in update_stats()
1263 /* ----------------------------------------------------------------------------
1266 ---------------------------------------------------------------------------- */
1271 update_stats(dev->base_addr, dev); in mace_get_stats()
1273 pr_debug("%s: updating the statistics.\n", dev->name); in mace_get_stats()
1274 pr_linux_stats(&dev->stats); in mace_get_stats()
1275 pr_mace_stats(&lp->mace_stats); in mace_get_stats()
1277 return &dev->stats; in mace_get_stats()
1280 /* ----------------------------------------------------------------------------
1283 ---------------------------------------------------------------------------- */
1300 for (j = 32; j > 0; j--) in updateCRC()
1301 CRC[j] = CRC[j-1]; in updateCRC()
1310 /* ----------------------------------------------------------------------------
1318 ---------------------------------------------------------------------------- */
1349 /* ----------------------------------------------------------------------------
1357 ---------------------------------------------------------------------------- */
1361 int num_addrs = lp->multicast_num_addrs; in restore_multicast_list()
1362 int *ladrf = lp->multicast_ladrf; in restore_multicast_list()
1363 unsigned int ioaddr = dev->base_addr; in restore_multicast_list()
1367 dev->name, num_addrs); in restore_multicast_list()
1401 /* ----------------------------------------------------------------------------
1406 num_addrs == -1 Promiscuous mode, receive all packets
1409 best-effort filtering.
1413 ---------------------------------------------------------------------------- */
1427 dev->name, old); in set_multicast_list()
1433 lp->multicast_num_addrs = netdev_mc_count(dev); in set_multicast_list()
1438 memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN); in set_multicast_list()
1440 memcpy(adr, ha->addr, ETH_ALEN); in set_multicast_list()
1441 BuildLAF(lp->multicast_ladrf, adr); in set_multicast_list()
1453 unsigned int ioaddr = dev->base_addr; in restore_multicast_list()
1456 pr_debug("%s: restoring Rx mode to %d addresses.\n", dev->name, in restore_multicast_list()
1457 lp->multicast_num_addrs); in restore_multicast_list()
1459 if (dev->flags & IFF_PROMISC) { in restore_multicast_list()
1482 dev->name, old); in set_multicast_list()
1487 lp->multicast_num_addrs = netdev_mc_count(dev); in set_multicast_list()
1494 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),