102 #define DRV_NAME "3c501"
103 #define DRV_VERSION "2002/10/09"
114 #include <linux/module.h>
116 #include <linux/kernel.h>
117 #include <linux/fcntl.h>
120 #include <linux/string.h>
121 #include <linux/errno.h>
123 #include <linux/ethtool.h>
125 #include <linux/bitops.h>
127 #include <asm/uaccess.h>
130 #include <linux/netdevice.h>
141 static int io = 0x280;
161 static const unsigned ports[] = { 0x280, 0x300, 0};
162 const unsigned *
port;
177 err = el1_probe1(dev,
io);
178 }
else if (
io != 0) {
181 for (port = ports; *port && el1_probe1(dev, *port); port++)
201 .ndo_stop = el1_close,
202 .ndo_start_xmit = el_start_xmit,
203 .ndo_tx_timeout = el_timeout,
204 .ndo_set_rx_mode = set_multicast_list,
242 for (i = 0; i < 6; i++) {
251 if (station_addr[0] == 0x02 && station_addr[1] == 0x60 &&
252 station_addr[2] == 0x8c)
254 else if (station_addr[0] == 0x00 && station_addr[1] == 0x80 &&
255 station_addr[2] == 0xC8)
270 unsigned long irq_mask;
283 pr_warning(
"%s probe at %#x failed to detect IRQ line.\n",
299 pr_info(
"%s: %s EtherLink at %#lx, using %sIRQ %d.\n",
301 autoirq ?
"auto":
"assigned ", dev->
irq);
303 #ifdef CONFIG_IP_MULTICAST
304 pr_warning(
"WARNING: Use of the 3c501 in a multicast kernel is NOT recommended.\n");
310 lp = netdev_priv(dev);
353 spin_unlock_irqrestore(&lp->
lock, flags);
357 netif_start_queue(dev);
370 static void el_timeout(
struct net_device *dev)
376 pr_debug(
"%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n",
379 dev->
stats.tx_errors++;
385 netif_wake_queue(dev);
429 netif_stop_queue(dev);
435 unsigned char *
buf = skb->
data;
440 gp_start = 0x800 - (len +
pad);
464 spin_unlock_irqrestore(&lp->
lock, flags);
525 lp = netdev_priv(dev);
527 spin_lock(&lp->
lock);
540 pr_debug(
"%s: el_interrupt() aux=%#02x\n", dev->
name, axsr);
543 pr_warning(
"%s: Inconsistent state loading while not in tx\n",
555 pr_debug(
"%s: Interrupt while loading [txsr=%02x gp=%04x rp=%04x]\n",
560 spin_unlock(&lp->
lock);
567 if ((axsr & 0x80) && (txsr &
TX_READY) == 0) {
573 pr_debug(
"%s: Unusual interrupt during Tx, txsr=%02x axsr=%02x gp=%03x rp=%03x.\n",
574 dev->
name, txsr, axsr,
578 netif_wake_queue(dev);
584 pr_debug(
"%s: Transmit failed 16 times, Ethernet jammed?\n", dev->
name);
587 dev->
stats.tx_aborted_errors++;
588 netif_wake_queue(dev);
595 pr_debug(
"%s: retransmitting after a collision.\n", dev->
name);
604 dev->
stats.collisions++;
605 spin_unlock(&lp->
lock);
611 dev->
stats.tx_packets++;
614 (txsr &
TX_RDY) ?
"." :
"but tx is busy!");
620 netif_wake_queue(dev);
629 pr_debug(
"%s: rxsr=%02x txsr=%02x rp=%04x\n",
635 dev->
stats.rx_missed_errors++;
638 dev->
stats.rx_length_errors++;
651 pr_debug(
"%s: No packet seen, rxsr=%02x **resetting 3c501***\n",
665 spin_unlock(&lp->
lock);
681 static void el_receive(
struct net_device *dev)
690 pr_debug(
" el_receive %d.\n", pkt_len);
692 if (pkt_len < 60 || pkt_len > 1536) {
694 pr_debug(
"%s: bogus packet, length=%d\n",
696 dev->
stats.rx_over_errors++;
705 skb = netdev_alloc_skb(dev, pkt_len + 2);
713 pr_info(
"%s: Memory squeeze, dropping packet.\n", dev->
name);
714 dev->
stats.rx_dropped++;
726 dev->
stats.rx_packets++;
752 for (i = 0; i < 6; i++)
780 pr_info(
"%s: Shutting down Ethernet card at %#x.\n",
783 netif_stop_queue(dev);
805 static void set_multicast_list(
struct net_device *dev)
823 static void netdev_get_drvinfo(
struct net_device *dev,
841 static const struct ethtool_ops netdev_ethtool_ops = {
842 .get_drvinfo = netdev_get_drvinfo,
843 .get_msglevel = netdev_get_msglevel,
844 .set_msglevel = netdev_set_msglevel,
871 if (IS_ERR(dev_3c501))
872 return PTR_ERR(dev_3c501);