diff options
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 85 |
1 files changed, 29 insertions, 56 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index df92bcde9bcf..580ec444a654 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -79,14 +79,6 @@ MODULE_FIRMWARE(FIRMWARE_NAME); | |||
79 | */ | 79 | */ |
80 | INT_MODULE_PARM(if_port, 0); | 80 | INT_MODULE_PARM(if_port, 0); |
81 | 81 | ||
82 | #ifdef PCMCIA_DEBUG | ||
83 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
84 | static const char *version = | ||
85 | "smc91c92_cs.c 1.123 2006/11/09 Donald Becker, becker@scyld.com.\n"; | ||
86 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
87 | #else | ||
88 | #define DEBUG(n, args...) | ||
89 | #endif | ||
90 | 82 | ||
91 | #define DRV_NAME "smc91c92_cs" | 83 | #define DRV_NAME "smc91c92_cs" |
92 | #define DRV_VERSION "1.123" | 84 | #define DRV_VERSION "1.123" |
@@ -323,7 +315,7 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
323 | struct smc_private *smc; | 315 | struct smc_private *smc; |
324 | struct net_device *dev; | 316 | struct net_device *dev; |
325 | 317 | ||
326 | DEBUG(0, "smc91c92_attach()\n"); | 318 | dev_dbg(&link->dev, "smc91c92_attach()\n"); |
327 | 319 | ||
328 | /* Create new ethernet device */ | 320 | /* Create new ethernet device */ |
329 | dev = alloc_etherdev(sizeof(struct smc_private)); | 321 | dev = alloc_etherdev(sizeof(struct smc_private)); |
@@ -371,7 +363,7 @@ static void smc91c92_detach(struct pcmcia_device *link) | |||
371 | { | 363 | { |
372 | struct net_device *dev = link->priv; | 364 | struct net_device *dev = link->priv; |
373 | 365 | ||
374 | DEBUG(0, "smc91c92_detach(0x%p)\n", link); | 366 | dev_dbg(&link->dev, "smc91c92_detach\n"); |
375 | 367 | ||
376 | if (link->dev_node) | 368 | if (link->dev_node) |
377 | unregister_netdev(dev); | 369 | unregister_netdev(dev); |
@@ -746,7 +738,7 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | |||
746 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); | 738 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); |
747 | /* Now, turn on the interrupt for both card functions */ | 739 | /* Now, turn on the interrupt for both card functions */ |
748 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); | 740 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); |
749 | DEBUG(2, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", | 741 | dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", |
750 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), | 742 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), |
751 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); | 743 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); |
752 | } | 744 | } |
@@ -860,12 +852,6 @@ static int check_sig(struct pcmcia_device *link) | |||
860 | 852 | ||
861 | ======================================================================*/ | 853 | ======================================================================*/ |
862 | 854 | ||
863 | #define CS_EXIT_TEST(ret, svc, label) \ | ||
864 | if (ret != 0) { \ | ||
865 | cs_error(link, svc, ret); \ | ||
866 | goto label; \ | ||
867 | } | ||
868 | |||
869 | static int smc91c92_config(struct pcmcia_device *link) | 855 | static int smc91c92_config(struct pcmcia_device *link) |
870 | { | 856 | { |
871 | struct net_device *dev = link->priv; | 857 | struct net_device *dev = link->priv; |
@@ -875,7 +861,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
875 | unsigned int ioaddr; | 861 | unsigned int ioaddr; |
876 | u_long mir; | 862 | u_long mir; |
877 | 863 | ||
878 | DEBUG(0, "smc91c92_config(0x%p)\n", link); | 864 | dev_dbg(&link->dev, "smc91c92_config\n"); |
879 | 865 | ||
880 | smc->manfid = link->manf_id; | 866 | smc->manfid = link->manf_id; |
881 | smc->cardid = link->card_id; | 867 | smc->cardid = link->card_id; |
@@ -891,12 +877,15 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
891 | } else { | 877 | } else { |
892 | i = smc_config(link); | 878 | i = smc_config(link); |
893 | } | 879 | } |
894 | CS_EXIT_TEST(i, RequestIO, config_failed); | 880 | if (i) |
881 | goto config_failed; | ||
895 | 882 | ||
896 | i = pcmcia_request_irq(link, &link->irq); | 883 | i = pcmcia_request_irq(link, &link->irq); |
897 | CS_EXIT_TEST(i, RequestIRQ, config_failed); | 884 | if (i) |
885 | goto config_failed; | ||
898 | i = pcmcia_request_configuration(link, &link->conf); | 886 | i = pcmcia_request_configuration(link, &link->conf); |
899 | CS_EXIT_TEST(i, RequestConfiguration, config_failed); | 887 | if (i) |
888 | goto config_failed; | ||
900 | 889 | ||
901 | if (smc->manfid == MANFID_MOTOROLA) | 890 | if (smc->manfid == MANFID_MOTOROLA) |
902 | mot_config(link); | 891 | mot_config(link); |
@@ -1001,7 +990,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1001 | 990 | ||
1002 | if (smc->cfg & CFG_MII_SELECT) { | 991 | if (smc->cfg & CFG_MII_SELECT) { |
1003 | if (smc->mii_if.phy_id != -1) { | 992 | if (smc->mii_if.phy_id != -1) { |
1004 | DEBUG(0, " MII transceiver at index %d, status %x.\n", | 993 | dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", |
1005 | smc->mii_if.phy_id, j); | 994 | smc->mii_if.phy_id, j); |
1006 | } else { | 995 | } else { |
1007 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 996 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
@@ -1011,7 +1000,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1011 | 1000 | ||
1012 | config_undo: | 1001 | config_undo: |
1013 | unregister_netdev(dev); | 1002 | unregister_netdev(dev); |
1014 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ | 1003 | config_failed: |
1015 | smc91c92_release(link); | 1004 | smc91c92_release(link); |
1016 | return -ENODEV; | 1005 | return -ENODEV; |
1017 | } /* smc91c92_config */ | 1006 | } /* smc91c92_config */ |
@@ -1026,7 +1015,7 @@ config_failed: /* CS_EXIT_TEST() calls jump to here... */ | |||
1026 | 1015 | ||
1027 | static void smc91c92_release(struct pcmcia_device *link) | 1016 | static void smc91c92_release(struct pcmcia_device *link) |
1028 | { | 1017 | { |
1029 | DEBUG(0, "smc91c92_release(0x%p)\n", link); | 1018 | dev_dbg(&link->dev, "smc91c92_release\n"); |
1030 | if (link->win) { | 1019 | if (link->win) { |
1031 | struct net_device *dev = link->priv; | 1020 | struct net_device *dev = link->priv; |
1032 | struct smc_private *smc = netdev_priv(dev); | 1021 | struct smc_private *smc = netdev_priv(dev); |
@@ -1123,10 +1112,10 @@ static int smc_open(struct net_device *dev) | |||
1123 | struct smc_private *smc = netdev_priv(dev); | 1112 | struct smc_private *smc = netdev_priv(dev); |
1124 | struct pcmcia_device *link = smc->p_dev; | 1113 | struct pcmcia_device *link = smc->p_dev; |
1125 | 1114 | ||
1126 | #ifdef PCMCIA_DEBUG | 1115 | dev_dbg(&link->dev, "%s: smc_open(%p), ID/Window %4.4x.\n", |
1127 | DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", | ||
1128 | dev->name, dev, inw(dev->base_addr + BANK_SELECT)); | 1116 | dev->name, dev, inw(dev->base_addr + BANK_SELECT)); |
1129 | if (pc_debug > 1) smc_dump(dev); | 1117 | #ifdef PCMCIA_DEBUG |
1118 | smc_dump(dev); | ||
1130 | #endif | 1119 | #endif |
1131 | 1120 | ||
1132 | /* Check that the PCMCIA card is still here. */ | 1121 | /* Check that the PCMCIA card is still here. */ |
@@ -1161,7 +1150,7 @@ static int smc_close(struct net_device *dev) | |||
1161 | struct pcmcia_device *link = smc->p_dev; | 1150 | struct pcmcia_device *link = smc->p_dev; |
1162 | unsigned int ioaddr = dev->base_addr; | 1151 | unsigned int ioaddr = dev->base_addr; |
1163 | 1152 | ||
1164 | DEBUG(0, "%s: smc_close(), status %4.4x.\n", | 1153 | dev_dbg(&link->dev, "%s: smc_close(), status %4.4x.\n", |
1165 | dev->name, inw(ioaddr + BANK_SELECT)); | 1154 | dev->name, inw(ioaddr + BANK_SELECT)); |
1166 | 1155 | ||
1167 | netif_stop_queue(dev); | 1156 | netif_stop_queue(dev); |
@@ -1228,7 +1217,7 @@ static void smc_hardware_send_packet(struct net_device * dev) | |||
1228 | u_char *buf = skb->data; | 1217 | u_char *buf = skb->data; |
1229 | u_int length = skb->len; /* The chip will pad to ethernet min. */ | 1218 | u_int length = skb->len; /* The chip will pad to ethernet min. */ |
1230 | 1219 | ||
1231 | DEBUG(2, "%s: Trying to xmit packet of length %d.\n", | 1220 | pr_debug("%s: Trying to xmit packet of length %d.\n", |
1232 | dev->name, length); | 1221 | dev->name, length); |
1233 | 1222 | ||
1234 | /* send the packet length: +6 for status word, length, and ctl */ | 1223 | /* send the packet length: +6 for status word, length, and ctl */ |
@@ -1283,7 +1272,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb, | |||
1283 | 1272 | ||
1284 | netif_stop_queue(dev); | 1273 | netif_stop_queue(dev); |
1285 | 1274 | ||
1286 | DEBUG(2, "%s: smc_start_xmit(length = %d) called," | 1275 | pr_debug("%s: smc_start_xmit(length = %d) called," |
1287 | " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); | 1276 | " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); |
1288 | 1277 | ||
1289 | if (smc->saved_skb) { | 1278 | if (smc->saved_skb) { |
@@ -1330,7 +1319,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb, | |||
1330 | } | 1319 | } |
1331 | 1320 | ||
1332 | /* Otherwise defer until the Tx-space-allocated interrupt. */ | 1321 | /* Otherwise defer until the Tx-space-allocated interrupt. */ |
1333 | DEBUG(2, "%s: memory allocation deferred.\n", dev->name); | 1322 | pr_debug("%s: memory allocation deferred.\n", dev->name); |
1334 | outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); | 1323 | outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); |
1335 | spin_unlock_irqrestore(&smc->lock, flags); | 1324 | spin_unlock_irqrestore(&smc->lock, flags); |
1336 | 1325 | ||
@@ -1395,7 +1384,7 @@ static void smc_eph_irq(struct net_device *dev) | |||
1395 | 1384 | ||
1396 | SMC_SELECT_BANK(0); | 1385 | SMC_SELECT_BANK(0); |
1397 | ephs = inw(ioaddr + EPH); | 1386 | ephs = inw(ioaddr + EPH); |
1398 | DEBUG(2, "%s: Ethernet protocol handler interrupt, status" | 1387 | pr_debug("%s: Ethernet protocol handler interrupt, status" |
1399 | " %4.4x.\n", dev->name, ephs); | 1388 | " %4.4x.\n", dev->name, ephs); |
1400 | /* Could be a counter roll-over warning: update stats. */ | 1389 | /* Could be a counter roll-over warning: update stats. */ |
1401 | card_stats = inw(ioaddr + COUNTER); | 1390 | card_stats = inw(ioaddr + COUNTER); |
@@ -1435,7 +1424,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1435 | 1424 | ||
1436 | ioaddr = dev->base_addr; | 1425 | ioaddr = dev->base_addr; |
1437 | 1426 | ||
1438 | DEBUG(3, "%s: SMC91c92 interrupt %d at %#x.\n", dev->name, | 1427 | pr_debug("%s: SMC91c92 interrupt %d at %#x.\n", dev->name, |
1439 | irq, ioaddr); | 1428 | irq, ioaddr); |
1440 | 1429 | ||
1441 | spin_lock(&smc->lock); | 1430 | spin_lock(&smc->lock); |
@@ -1444,7 +1433,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1444 | if ((saved_bank & 0xff00) != 0x3300) { | 1433 | if ((saved_bank & 0xff00) != 0x3300) { |
1445 | /* The device does not exist -- the card could be off-line, or | 1434 | /* The device does not exist -- the card could be off-line, or |
1446 | maybe it has been ejected. */ | 1435 | maybe it has been ejected. */ |
1447 | DEBUG(1, "%s: SMC91c92 interrupt %d for non-existent" | 1436 | pr_debug("%s: SMC91c92 interrupt %d for non-existent" |
1448 | "/ejected device.\n", dev->name, irq); | 1437 | "/ejected device.\n", dev->name, irq); |
1449 | handled = 0; | 1438 | handled = 0; |
1450 | goto irq_done; | 1439 | goto irq_done; |
@@ -1458,7 +1447,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1458 | 1447 | ||
1459 | do { /* read the status flag, and mask it */ | 1448 | do { /* read the status flag, and mask it */ |
1460 | status = inw(ioaddr + INTERRUPT) & 0xff; | 1449 | status = inw(ioaddr + INTERRUPT) & 0xff; |
1461 | DEBUG(3, "%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, | 1450 | pr_debug("%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, |
1462 | status, mask); | 1451 | status, mask); |
1463 | if ((status & mask) == 0) { | 1452 | if ((status & mask) == 0) { |
1464 | if (bogus_cnt == INTR_WORK) | 1453 | if (bogus_cnt == INTR_WORK) |
@@ -1503,7 +1492,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1503 | smc_eph_irq(dev); | 1492 | smc_eph_irq(dev); |
1504 | } while (--bogus_cnt); | 1493 | } while (--bogus_cnt); |
1505 | 1494 | ||
1506 | DEBUG(3, " Restoring saved registers mask %2.2x bank %4.4x" | 1495 | pr_debug(" Restoring saved registers mask %2.2x bank %4.4x" |
1507 | " pointer %4.4x.\n", mask, saved_bank, saved_pointer); | 1496 | " pointer %4.4x.\n", mask, saved_bank, saved_pointer); |
1508 | 1497 | ||
1509 | /* restore state register */ | 1498 | /* restore state register */ |
@@ -1511,7 +1500,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1511 | outw(saved_pointer, ioaddr + POINTER); | 1500 | outw(saved_pointer, ioaddr + POINTER); |
1512 | SMC_SELECT_BANK(saved_bank); | 1501 | SMC_SELECT_BANK(saved_bank); |
1513 | 1502 | ||
1514 | DEBUG(3, "%s: Exiting interrupt IRQ%d.\n", dev->name, irq); | 1503 | pr_debug("%s: Exiting interrupt IRQ%d.\n", dev->name, irq); |
1515 | 1504 | ||
1516 | irq_done: | 1505 | irq_done: |
1517 | 1506 | ||
@@ -1562,7 +1551,7 @@ static void smc_rx(struct net_device *dev) | |||
1562 | rx_status = inw(ioaddr + DATA_1); | 1551 | rx_status = inw(ioaddr + DATA_1); |
1563 | packet_length = inw(ioaddr + DATA_1) & 0x07ff; | 1552 | packet_length = inw(ioaddr + DATA_1) & 0x07ff; |
1564 | 1553 | ||
1565 | DEBUG(2, "%s: Receive status %4.4x length %d.\n", | 1554 | pr_debug("%s: Receive status %4.4x length %d.\n", |
1566 | dev->name, rx_status, packet_length); | 1555 | dev->name, rx_status, packet_length); |
1567 | 1556 | ||
1568 | if (!(rx_status & RS_ERRORS)) { | 1557 | if (!(rx_status & RS_ERRORS)) { |
@@ -1573,7 +1562,7 @@ static void smc_rx(struct net_device *dev) | |||
1573 | skb = dev_alloc_skb(packet_length+2); | 1562 | skb = dev_alloc_skb(packet_length+2); |
1574 | 1563 | ||
1575 | if (skb == NULL) { | 1564 | if (skb == NULL) { |
1576 | DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name); | 1565 | pr_debug("%s: Low memory, packet dropped.\n", dev->name); |
1577 | dev->stats.rx_dropped++; | 1566 | dev->stats.rx_dropped++; |
1578 | outw(MC_RELEASE, ioaddr + MMU_CMD); | 1567 | outw(MC_RELEASE, ioaddr + MMU_CMD); |
1579 | return; | 1568 | return; |
@@ -1733,7 +1722,7 @@ static void smc_reset(struct net_device *dev) | |||
1733 | struct smc_private *smc = netdev_priv(dev); | 1722 | struct smc_private *smc = netdev_priv(dev); |
1734 | int i; | 1723 | int i; |
1735 | 1724 | ||
1736 | DEBUG(0, "%s: smc91c92 reset called.\n", dev->name); | 1725 | pr_debug("%s: smc91c92 reset called.\n", dev->name); |
1737 | 1726 | ||
1738 | /* The first interaction must be a write to bring the chip out | 1727 | /* The first interaction must be a write to bring the chip out |
1739 | of sleep mode. */ | 1728 | of sleep mode. */ |
@@ -2050,18 +2039,6 @@ static u32 smc_get_link(struct net_device *dev) | |||
2050 | return ret; | 2039 | return ret; |
2051 | } | 2040 | } |
2052 | 2041 | ||
2053 | #ifdef PCMCIA_DEBUG | ||
2054 | static u32 smc_get_msglevel(struct net_device *dev) | ||
2055 | { | ||
2056 | return pc_debug; | ||
2057 | } | ||
2058 | |||
2059 | static void smc_set_msglevel(struct net_device *dev, u32 val) | ||
2060 | { | ||
2061 | pc_debug = val; | ||
2062 | } | ||
2063 | #endif | ||
2064 | |||
2065 | static int smc_nway_reset(struct net_device *dev) | 2042 | static int smc_nway_reset(struct net_device *dev) |
2066 | { | 2043 | { |
2067 | struct smc_private *smc = netdev_priv(dev); | 2044 | struct smc_private *smc = netdev_priv(dev); |
@@ -2085,10 +2062,6 @@ static const struct ethtool_ops ethtool_ops = { | |||
2085 | .get_settings = smc_get_settings, | 2062 | .get_settings = smc_get_settings, |
2086 | .set_settings = smc_set_settings, | 2063 | .set_settings = smc_set_settings, |
2087 | .get_link = smc_get_link, | 2064 | .get_link = smc_get_link, |
2088 | #ifdef PCMCIA_DEBUG | ||
2089 | .get_msglevel = smc_get_msglevel, | ||
2090 | .set_msglevel = smc_set_msglevel, | ||
2091 | #endif | ||
2092 | .nway_reset = smc_nway_reset, | 2065 | .nway_reset = smc_nway_reset, |
2093 | }; | 2066 | }; |
2094 | 2067 | ||