patch-2.1.31 linux/drivers/net/cs89x0.c
Next file: linux/drivers/net/de4x5.c
Previous file: linux/drivers/net/bpqether.c
Back to the patch index
Back to the overall index
- Lines: 289
- Date:
Mon Mar 31 12:52:30 1997
- Orig file:
v2.1.30/linux/drivers/net/cs89x0.c
- Orig date:
Thu Feb 27 10:57:30 1997
diff -u --recursive --new-file v2.1.30/linux/drivers/net/cs89x0.c linux/drivers/net/cs89x0.c
@@ -25,6 +25,8 @@
: as an example. Disabled autoprobing in init_module(),
: not a good thing to do to other devices while Linux
: is running from all accounts.
+
+ Alan Cox : Removed 1.2 support, added 2.1 extra counters.
*/
static char *version =
@@ -32,10 +34,6 @@
/* ======================= configure the driver here ======================= */
-/* we also support 1.2.13 */
-#define SUPPORTS_1_2_13 0
-
-
/* use 0 for production, 1 for verification, >2 for debug */
#ifndef NET_DEBUG
#define NET_DEBUG 2
@@ -120,13 +118,8 @@
static int cs89x0_probe1(struct device *dev, int ioaddr);
static int net_open(struct device *dev);
static int net_send_packet(struct sk_buff *skb, struct device *dev);
-#if SUPPORTS_1_2_13
-static void net_interrupt(int irq, struct pt_regs *regs);
-static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
-#else
static void net_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static void set_multicast_list(struct device *dev);
-#endif
static void net_rx(struct device *dev);
static int net_close(struct device *dev);
static struct net_device_stats *net_get_stats(struct device *dev);
@@ -175,14 +168,14 @@
}
#endif
-int inline
+static int inline
readreg(struct device *dev, int portno)
{
outw(portno, dev->base_addr + ADD_PORT);
return inw(dev->base_addr + DATA_PORT);
}
-void inline
+static void inline
writereg(struct device *dev, int portno, int value)
{
outw(portno, dev->base_addr + ADD_PORT);
@@ -190,19 +183,19 @@
}
-int inline
+static int inline
readword(struct device *dev, int portno)
{
return inw(dev->base_addr + portno);
}
-void inline
+static void inline
writeword(struct device *dev, int portno, int value)
{
outw(value, dev->base_addr + portno);
}
-int
+static int
wait_eeprom_ready(struct device *dev)
{
int timeout = jiffies;
@@ -430,7 +423,7 @@
}
-void
+static void
control_dc_dc(struct device *dev, int on_not_off)
{
struct net_local *lp = (struct net_local *)dev->priv;
@@ -496,7 +489,7 @@
}
/* send a test packet - return true if carrier bits are ok */
-int
+static int
send_test_pkt(struct device *dev)
{
int ioaddr = dev->base_addr;
@@ -541,7 +534,7 @@
}
-int
+static int
detect_aui(struct device *dev)
{
struct net_local *lp = (struct net_local *)dev->priv;
@@ -557,7 +550,7 @@
return 0;
}
-int
+static int
detect_bnc(struct device *dev)
{
struct net_local *lp = (struct net_local *)dev->priv;
@@ -574,7 +567,7 @@
}
-void
+static void
write_irq(struct device *dev, int chip_type, int irq)
{
int i;
@@ -611,29 +604,11 @@
/* Allow interrupts to be generated by the chip */
writereg(dev, PP_BusCTL, ENABLE_IRQ | MEMORY_ON);
for (i = 2; i < CS8920_NO_INTS; i++) if ((1 << dev->irq) & lp->irq_map) {
-#if SUPPORTS_1_2_13
- if (request_irq (i, NULL, 0, "bogus") != -EBUSY) {
-#else
- if (request_irq (i, NULL, 0, "bogus", NULL) != -EBUSY) {
-#endif
-#if 0
- /* Twinkle the interrupt, and check if it's seen. */
- autoirq_setup(0);
- write_irq(dev, lp->chip_type, i);
- writereg(dev, PP_BufCFG, GENERATE_SW_INTERRUPT);
- if (i == autoirq_report(0) /* It's a good IRQ line! */
- && request_irq (dev->irq = i, &net_interrupt, 0, "cs89x0") == 0)
- break;
-#else
+ if (request_irq (i, NULL, 0, "cs8920", NULL) != -EBUSY) {
write_irq(dev, lp->chip_type, i);
writereg(dev, PP_BufCFG, GENERATE_SW_INTERRUPT);
-#if SUPPORTS_1_2_13
- if (request_irq (dev->irq = i, &net_interrupt, 0, "cs89x0") == 0)
-#else
if (request_irq (dev->irq = i, &net_interrupt, 0, "cs89x0", NULL) == 0)
-#endif
break;
-#endif
}
}
@@ -650,11 +625,7 @@
}
writereg(dev, PP_BusCTL, ENABLE_IRQ | MEMORY_ON);
write_irq(dev, lp->chip_type, dev->irq);
-#if SUPPORTS_1_2_13
- if (request_irq(dev->irq, &net_interrupt, 0, "cs89x0")) {
-#else
if (request_irq(dev->irq, &net_interrupt, 0, "cs89x0", NULL)) {
-#endif
return -EAGAIN;
}
}
@@ -685,11 +656,7 @@
printk("%s: EEPROM is configured for unavailable media\n", dev->name);
release_irq:
writereg(dev, PP_LineCTL, readreg(dev, PP_LineCTL) & ~(SERIAL_TX_ON | SERIAL_RX_ON));
-#if SUPPORTS_1_2_13
- free_irq(dev->irq);
-#else
free_irq(dev->irq, NULL);
-#endif
irq2dev_map[dev->irq] = 0;
return -EAGAIN;
}
@@ -782,14 +749,6 @@
dev->trans_start = jiffies;
}
- /* If some higher layer thinks we've missed an tx-done interrupt
- we are passed NULL. Caution: dev_tint() handles the cli()/sti()
- itself. */
- if (skb == NULL) {
- dev_tint(dev);
- return 0;
- }
-
/* Block a timer-based transmit from overlapping. This could better be
done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
if (set_bit(0, (void*)&dev->tbusy) != 0)
@@ -832,12 +791,7 @@
/* The typical workload of the driver:
Handle the network interface interrupts. */
-static void
-#if SUPPORTS_1_2_13
-net_interrupt(int irq, struct pt_regs * regs)
-#else
-net_interrupt(int irq, void *dev_id, struct pt_regs * regs)
-#endif
+static void net_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
struct device *dev = (struct device *)(irq2dev_map[irq]);
struct net_local *lp;
@@ -946,11 +900,11 @@
if (net_debug > 3)printk("%s: received %d byte packet of type %x\n",
dev->name, length,
(skb->data[ETH_ALEN+ETH_ALEN] << 8) | skb->data[ETH_ALEN+ETH_ALEN+1]);
-#if !SUPPORTS_1_2_13
+
skb->protocol=eth_type_trans(skb,dev);
-#endif
netif_rx(skb);
lp->stats.rx_packets++;
+ lp->stats.rx_bytes+=skb->len;
return;
}
@@ -966,11 +920,7 @@
dev->start = 0;
-#if SUPPORTS_1_2_13
- free_irq(dev->irq);
-#else
free_irq(dev->irq, NULL);
-#endif
irq2dev_map[dev->irq] = 0;
@@ -997,33 +947,6 @@
return &lp->stats;
}
-#if SUPPORTS_1_2_13
-/* Set or clear the multicast filter for this adaptor.
- num_addrs == -1 Promiscuous mode, receive all packets
- num_addrs == 0 Normal mode, clear multicast list
- num_addrs > 0 Multicast mode, receive normal and MC packets, and do
- best-effort filtering.
- */
-static void
-set_multicast_list(struct device *dev, int num_addrs, void *addrs)
-{
- struct net_local *lp = (struct net_local *)dev->priv;
-
- if (num_addrs == 0)
- lp->rx_mode = 0;
- else if (num_addrs > 0)
- lp->rx_mode = RX_MULTCAST_ACCEPT;
- else if (num_addrs == -1)
- lp->rx_mode = RX_ALL_ACCEPT;
-
- writereg(dev, PP_RxCTL, DEF_RX_ACCEPT | lp->rx_mode);
-
- /* in promiscuous mode, we accept errored packets, so we have to enable interrupts on them also */
- writereg(dev, PP_RxCFG, lp->curr_rx_cfg |
- (lp->rx_mode == RX_ALL_ACCEPT? (RX_CRC_ERROR_ENBL|RX_RUNT_ENBL|RX_EXTRA_DATA_ENBL) : 0));
-
-}
-#else
static void set_multicast_list(struct device *dev)
{
struct net_local *lp = (struct net_local *)dev->priv;
@@ -1047,11 +970,9 @@
writereg(dev, PP_RxCFG, lp->curr_rx_cfg |
(lp->rx_mode == RX_ALL_ACCEPT? (RX_CRC_ERROR_ENBL|RX_RUNT_ENBL|RX_EXTRA_DATA_ENBL) : 0));
}
-#endif
-static int
-set_mac_address(struct device *dev, void *addr)
+static int set_mac_address(struct device *dev, void *addr)
{
int i;
if (dev->start)
@@ -1066,10 +987,9 @@
return 0;
}
+
#ifdef MODULE
-#if SUPPORTS_1_2_13
-char kernel_version[] = UTS_RELEASE;
-#endif
+
static char namespace[16] = "";
static struct device dev_cs89x0 = {
NULL,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov