diff options
Diffstat (limited to 'drivers/net/3c515.c')
-rw-r--r-- | drivers/net/3c515.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 91d1c4c24d9b..91f2232e6050 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -12,12 +12,12 @@ | |||
12 | Annapolis MD 21403 | 12 | Annapolis MD 21403 |
13 | 13 | ||
14 | 14 | ||
15 | 2000/2/2- Added support for kernel-level ISAPnP | 15 | 2000/2/2- Added support for kernel-level ISAPnP |
16 | by Stephen Frost <sfrost@snowman.net> and Alessandro Zummo | 16 | by Stephen Frost <sfrost@snowman.net> and Alessandro Zummo |
17 | Cleaned up for 2.3.x/softnet by Jeff Garzik and Alan Cox. | 17 | Cleaned up for 2.3.x/softnet by Jeff Garzik and Alan Cox. |
18 | 18 | ||
19 | 2001/11/17 - Added ethtool support (jgarzik) | 19 | 2001/11/17 - Added ethtool support (jgarzik) |
20 | 20 | ||
21 | 2002/10/28 - Locking updates for 2.5 (alan@redhat.com) | 21 | 2002/10/28 - Locking updates for 2.5 (alan@redhat.com) |
22 | 22 | ||
23 | */ | 23 | */ |
@@ -57,7 +57,6 @@ static int max_interrupt_work = 20; | |||
57 | #define RX_RING_SIZE 16 | 57 | #define RX_RING_SIZE 16 |
58 | #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */ | 58 | #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */ |
59 | 59 | ||
60 | #include <linux/config.h> | ||
61 | #include <linux/module.h> | 60 | #include <linux/module.h> |
62 | #include <linux/isapnp.h> | 61 | #include <linux/isapnp.h> |
63 | #include <linux/kernel.h> | 62 | #include <linux/kernel.h> |
@@ -188,9 +187,9 @@ enum corkscrew_cmd { | |||
188 | TotalReset = 0 << 11, SelectWindow = 1 << 11, StartCoax = 2 << 11, | 187 | TotalReset = 0 << 11, SelectWindow = 1 << 11, StartCoax = 2 << 11, |
189 | RxDisable = 3 << 11, RxEnable = 4 << 11, RxReset = 5 << 11, | 188 | RxDisable = 3 << 11, RxEnable = 4 << 11, RxReset = 5 << 11, |
190 | UpStall = 6 << 11, UpUnstall = (6 << 11) + 1, DownStall = (6 << 11) + 2, | 189 | UpStall = 6 << 11, UpUnstall = (6 << 11) + 1, DownStall = (6 << 11) + 2, |
191 | DownUnstall = (6 << 11) + 3, RxDiscard = 8 << 11, TxEnable = 9 << 11, | 190 | DownUnstall = (6 << 11) + 3, RxDiscard = 8 << 11, TxEnable = 9 << 11, |
192 | TxDisable = 10 << 11, TxReset = 11 << 11, FakeIntr = 12 << 11, | 191 | TxDisable = 10 << 11, TxReset = 11 << 11, FakeIntr = 12 << 11, |
193 | AckIntr = 13 << 11, SetIntrEnb = 14 << 11, SetStatusEnb = 15 << 11, | 192 | AckIntr = 13 << 11, SetIntrEnb = 14 << 11, SetStatusEnb = 15 << 11, |
194 | SetRxFilter = 16 << 11, SetRxThreshold = 17 << 11, | 193 | SetRxFilter = 16 << 11, SetRxThreshold = 17 << 11, |
195 | SetTxThreshold = 18 << 11, SetTxStart = 19 << 11, StartDMAUp = 20 << 11, | 194 | SetTxThreshold = 18 << 11, SetTxStart = 19 << 11, StartDMAUp = 20 << 11, |
196 | StartDMADown = (20 << 11) + 1, StatsEnable = 21 << 11, | 195 | StartDMADown = (20 << 11) + 1, StatsEnable = 21 << 11, |
@@ -339,15 +338,15 @@ static struct media_table { | |||
339 | mask:8, /* The transceiver-present bit in Wn3_Config. */ | 338 | mask:8, /* The transceiver-present bit in Wn3_Config. */ |
340 | next:8; /* The media type to try next. */ | 339 | next:8; /* The media type to try next. */ |
341 | short wait; /* Time before we check media status. */ | 340 | short wait; /* Time before we check media status. */ |
342 | } media_tbl[] = { | 341 | } media_tbl[] = { |
343 | { "10baseT", Media_10TP, 0x08, XCVR_10base2, (14 * HZ) / 10 }, | 342 | { "10baseT", Media_10TP, 0x08, XCVR_10base2, (14 * HZ) / 10 }, |
344 | { "10Mbs AUI", Media_SQE, 0x20, XCVR_Default, (1 * HZ) / 10}, | 343 | { "10Mbs AUI", Media_SQE, 0x20, XCVR_Default, (1 * HZ) / 10}, |
345 | { "undefined", 0, 0x80, XCVR_10baseT, 10000}, | 344 | { "undefined", 0, 0x80, XCVR_10baseT, 10000}, |
346 | { "10base2", 0, 0x10, XCVR_AUI, (1 * HZ) / 10}, | 345 | { "10base2", 0, 0x10, XCVR_AUI, (1 * HZ) / 10}, |
347 | { "100baseTX", Media_Lnk, 0x02, XCVR_100baseFx, (14 * HZ) / 10}, | 346 | { "100baseTX", Media_Lnk, 0x02, XCVR_100baseFx, (14 * HZ) / 10}, |
348 | { "100baseFX", Media_Lnk, 0x04, XCVR_MII, (14 * HZ) / 10}, | 347 | { "100baseFX", Media_Lnk, 0x04, XCVR_MII, (14 * HZ) / 10}, |
349 | { "MII", 0, 0x40, XCVR_10baseT, 3 * HZ}, | 348 | { "MII", 0, 0x40, XCVR_10baseT, 3 * HZ}, |
350 | { "undefined", 0, 0x01, XCVR_10baseT, 10000}, | 349 | { "undefined", 0, 0x01, XCVR_10baseT, 10000}, |
351 | { "Default", 0, 0xFF, XCVR_10baseT, 10000}, | 350 | { "Default", 0, 0xFF, XCVR_10baseT, 10000}, |
352 | }; | 351 | }; |
353 | 352 | ||
@@ -380,10 +379,10 @@ static int corkscrew_close(struct net_device *dev); | |||
380 | static void update_stats(int addr, struct net_device *dev); | 379 | static void update_stats(int addr, struct net_device *dev); |
381 | static struct net_device_stats *corkscrew_get_stats(struct net_device *dev); | 380 | static struct net_device_stats *corkscrew_get_stats(struct net_device *dev); |
382 | static void set_rx_mode(struct net_device *dev); | 381 | static void set_rx_mode(struct net_device *dev); |
383 | static struct ethtool_ops netdev_ethtool_ops; | 382 | static const struct ethtool_ops netdev_ethtool_ops; |
384 | |||
385 | 383 | ||
386 | /* | 384 | |
385 | /* | ||
387 | Unfortunately maximizing the shared code between the integrated and | 386 | Unfortunately maximizing the shared code between the integrated and |
388 | module version of the driver results in a complicated set of initialization | 387 | module version of the driver results in a complicated set of initialization |
389 | procedures. | 388 | procedures. |
@@ -613,7 +612,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr, | |||
613 | printk(KERN_INFO "%s: 3Com %s at %#3x,", dev->name, vp->product_name, ioaddr); | 612 | printk(KERN_INFO "%s: 3Com %s at %#3x,", dev->name, vp->product_name, ioaddr); |
614 | 613 | ||
615 | spin_lock_init(&vp->lock); | 614 | spin_lock_init(&vp->lock); |
616 | 615 | ||
617 | /* Read the station address from the EEPROM. */ | 616 | /* Read the station address from the EEPROM. */ |
618 | EL3WINDOW(0); | 617 | EL3WINDOW(0); |
619 | for (i = 0; i < 0x18; i++) { | 618 | for (i = 0; i < 0x18; i++) { |
@@ -692,7 +691,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr, | |||
692 | 691 | ||
693 | return register_netdev(dev); | 692 | return register_netdev(dev); |
694 | } | 693 | } |
695 | 694 | ||
696 | 695 | ||
697 | static int corkscrew_open(struct net_device *dev) | 696 | static int corkscrew_open(struct net_device *dev) |
698 | { | 697 | { |
@@ -716,7 +715,7 @@ static int corkscrew_open(struct net_device *dev) | |||
716 | } else if (vp->autoselect) { | 715 | } else if (vp->autoselect) { |
717 | /* Find first available media type, starting with 100baseTx. */ | 716 | /* Find first available media type, starting with 100baseTx. */ |
718 | dev->if_port = 4; | 717 | dev->if_port = 4; |
719 | while (!(vp->available_media & media_tbl[dev->if_port].mask)) | 718 | while (!(vp->available_media & media_tbl[dev->if_port].mask)) |
720 | dev->if_port = media_tbl[dev->if_port].next; | 719 | dev->if_port = media_tbl[dev->if_port].next; |
721 | 720 | ||
722 | if (corkscrew_debug > 1) | 721 | if (corkscrew_debug > 1) |
@@ -761,7 +760,7 @@ static int corkscrew_open(struct net_device *dev) | |||
761 | vp->product_name, dev)) return -EAGAIN; | 760 | vp->product_name, dev)) return -EAGAIN; |
762 | enable_dma(dev->dma); | 761 | enable_dma(dev->dma); |
763 | set_dma_mode(dev->dma, DMA_MODE_CASCADE); | 762 | set_dma_mode(dev->dma, DMA_MODE_CASCADE); |
764 | } else if (request_irq(dev->irq, &corkscrew_interrupt, SA_SHIRQ, | 763 | } else if (request_irq(dev->irq, &corkscrew_interrupt, IRQF_SHARED, |
765 | vp->product_name, dev)) { | 764 | vp->product_name, dev)) { |
766 | return -EAGAIN; | 765 | return -EAGAIN; |
767 | } | 766 | } |
@@ -872,7 +871,7 @@ static void corkscrew_timer(unsigned long data) | |||
872 | dev->name, media_tbl[dev->if_port].name); | 871 | dev->name, media_tbl[dev->if_port].name); |
873 | 872 | ||
874 | spin_lock_irqsave(&vp->lock, flags); | 873 | spin_lock_irqsave(&vp->lock, flags); |
875 | 874 | ||
876 | { | 875 | { |
877 | int old_window = inw(ioaddr + EL3_CMD) >> 13; | 876 | int old_window = inw(ioaddr + EL3_CMD) >> 13; |
878 | int media_status; | 877 | int media_status; |
@@ -912,7 +911,7 @@ static void corkscrew_timer(unsigned long data) | |||
912 | media_tbl[dev->if_port].next; | 911 | media_tbl[dev->if_port].next; |
913 | } | 912 | } |
914 | while (!(vp->available_media & media_tbl[dev->if_port].mask)); | 913 | while (!(vp->available_media & media_tbl[dev->if_port].mask)); |
915 | 914 | ||
916 | if (dev->if_port == 8) { /* Go back to default. */ | 915 | if (dev->if_port == 8) { /* Go back to default. */ |
917 | dev->if_port = vp->default_media; | 916 | dev->if_port = vp->default_media; |
918 | if (corkscrew_debug > 1) | 917 | if (corkscrew_debug > 1) |
@@ -941,7 +940,7 @@ static void corkscrew_timer(unsigned long data) | |||
941 | } | 940 | } |
942 | EL3WINDOW(old_window); | 941 | EL3WINDOW(old_window); |
943 | } | 942 | } |
944 | 943 | ||
945 | spin_unlock_irqrestore(&vp->lock, flags); | 944 | spin_unlock_irqrestore(&vp->lock, flags); |
946 | if (corkscrew_debug > 1) | 945 | if (corkscrew_debug > 1) |
947 | printk("%s: Media selection timer finished, %s.\n", | 946 | printk("%s: Media selection timer finished, %s.\n", |
@@ -1004,7 +1003,8 @@ static int corkscrew_start_xmit(struct sk_buff *skb, | |||
1004 | /* Calculate the next Tx descriptor entry. */ | 1003 | /* Calculate the next Tx descriptor entry. */ |
1005 | int entry = vp->cur_tx % TX_RING_SIZE; | 1004 | int entry = vp->cur_tx % TX_RING_SIZE; |
1006 | struct boom_tx_desc *prev_entry; | 1005 | struct boom_tx_desc *prev_entry; |
1007 | unsigned long flags, i; | 1006 | unsigned long flags; |
1007 | int i; | ||
1008 | 1008 | ||
1009 | if (vp->tx_full) /* No room to transmit with */ | 1009 | if (vp->tx_full) /* No room to transmit with */ |
1010 | return 1; | 1010 | return 1; |
@@ -1026,7 +1026,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb, | |||
1026 | outw(DownStall, ioaddr + EL3_CMD); | 1026 | outw(DownStall, ioaddr + EL3_CMD); |
1027 | /* Wait for the stall to complete. */ | 1027 | /* Wait for the stall to complete. */ |
1028 | for (i = 20; i >= 0; i--) | 1028 | for (i = 20; i >= 0; i--) |
1029 | if ((inw(ioaddr + EL3_STATUS) & CmdInProgress) == 0) | 1029 | if ((inw(ioaddr + EL3_STATUS) & CmdInProgress) == 0) |
1030 | break; | 1030 | break; |
1031 | if (prev_entry) | 1031 | if (prev_entry) |
1032 | prev_entry->next = isa_virt_to_bus(&vp->tx_ring[entry]); | 1032 | prev_entry->next = isa_virt_to_bus(&vp->tx_ring[entry]); |
@@ -1102,7 +1102,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb, | |||
1102 | int j; | 1102 | int j; |
1103 | outw(TxReset, ioaddr + EL3_CMD); | 1103 | outw(TxReset, ioaddr + EL3_CMD); |
1104 | for (j = 20; j >= 0; j--) | 1104 | for (j = 20; j >= 0; j--) |
1105 | if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress)) | 1105 | if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress)) |
1106 | break; | 1106 | break; |
1107 | } | 1107 | } |
1108 | outw(TxEnable, ioaddr + EL3_CMD); | 1108 | outw(TxEnable, ioaddr + EL3_CMD); |
@@ -1130,7 +1130,7 @@ static irqreturn_t corkscrew_interrupt(int irq, void *dev_id, | |||
1130 | latency = inb(ioaddr + Timer); | 1130 | latency = inb(ioaddr + Timer); |
1131 | 1131 | ||
1132 | spin_lock(&lp->lock); | 1132 | spin_lock(&lp->lock); |
1133 | 1133 | ||
1134 | status = inw(ioaddr + EL3_STATUS); | 1134 | status = inw(ioaddr + EL3_STATUS); |
1135 | 1135 | ||
1136 | if (corkscrew_debug > 4) | 1136 | if (corkscrew_debug > 4) |
@@ -1249,7 +1249,7 @@ static irqreturn_t corkscrew_interrupt(int irq, void *dev_id, | |||
1249 | outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); | 1249 | outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); |
1250 | 1250 | ||
1251 | } while ((status = inw(ioaddr + EL3_STATUS)) & (IntLatch | RxComplete)); | 1251 | } while ((status = inw(ioaddr + EL3_STATUS)) & (IntLatch | RxComplete)); |
1252 | 1252 | ||
1253 | spin_unlock(&lp->lock); | 1253 | spin_unlock(&lp->lock); |
1254 | 1254 | ||
1255 | if (corkscrew_debug > 4) | 1255 | if (corkscrew_debug > 4) |
@@ -1308,7 +1308,7 @@ static int corkscrew_rx(struct net_device *dev) | |||
1308 | vp->stats.rx_bytes += pkt_len; | 1308 | vp->stats.rx_bytes += pkt_len; |
1309 | /* Wait a limited time to go to next packet. */ | 1309 | /* Wait a limited time to go to next packet. */ |
1310 | for (i = 200; i >= 0; i--) | 1310 | for (i = 200; i >= 0; i--) |
1311 | if (! (inw(ioaddr + EL3_STATUS) & CmdInProgress)) | 1311 | if (! (inw(ioaddr + EL3_STATUS) & CmdInProgress)) |
1312 | break; | 1312 | break; |
1313 | continue; | 1313 | continue; |
1314 | } else if (corkscrew_debug) | 1314 | } else if (corkscrew_debug) |
@@ -1561,13 +1561,13 @@ static void netdev_set_msglevel(struct net_device *dev, u32 level) | |||
1561 | corkscrew_debug = level; | 1561 | corkscrew_debug = level; |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | static struct ethtool_ops netdev_ethtool_ops = { | 1564 | static const struct ethtool_ops netdev_ethtool_ops = { |
1565 | .get_drvinfo = netdev_get_drvinfo, | 1565 | .get_drvinfo = netdev_get_drvinfo, |
1566 | .get_msglevel = netdev_get_msglevel, | 1566 | .get_msglevel = netdev_get_msglevel, |
1567 | .set_msglevel = netdev_set_msglevel, | 1567 | .set_msglevel = netdev_set_msglevel, |
1568 | }; | 1568 | }; |
1569 | 1569 | ||
1570 | 1570 | ||
1571 | #ifdef MODULE | 1571 | #ifdef MODULE |
1572 | void cleanup_module(void) | 1572 | void cleanup_module(void) |
1573 | { | 1573 | { |
@@ -1584,7 +1584,7 @@ void cleanup_module(void) | |||
1584 | } | 1584 | } |
1585 | } | 1585 | } |
1586 | #endif /* MODULE */ | 1586 | #endif /* MODULE */ |
1587 | 1587 | ||
1588 | /* | 1588 | /* |
1589 | * Local variables: | 1589 | * Local variables: |
1590 | * compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -c 3c515.c" | 1590 | * compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -c 3c515.c" |