diff options
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index fd9d6e34fda4..7b6fe89f9db0 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -103,7 +103,6 @@ struct smc_private { | |||
103 | u_short manfid; | 103 | u_short manfid; |
104 | u_short cardid; | 104 | u_short cardid; |
105 | 105 | ||
106 | dev_node_t node; | ||
107 | struct sk_buff *saved_skb; | 106 | struct sk_buff *saved_skb; |
108 | int packets_waiting; | 107 | int packets_waiting; |
109 | void __iomem *base; | 108 | void __iomem *base; |
@@ -323,14 +322,11 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
323 | return -ENOMEM; | 322 | return -ENOMEM; |
324 | smc = netdev_priv(dev); | 323 | smc = netdev_priv(dev); |
325 | smc->p_dev = link; | 324 | smc->p_dev = link; |
326 | link->priv = dev; | ||
327 | 325 | ||
328 | spin_lock_init(&smc->lock); | 326 | spin_lock_init(&smc->lock); |
329 | link->io.NumPorts1 = 16; | 327 | link->io.NumPorts1 = 16; |
330 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 328 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
331 | link->io.IOAddrLines = 4; | 329 | link->io.IOAddrLines = 4; |
332 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | ||
333 | link->irq.Handler = &smc_interrupt; | ||
334 | link->conf.Attributes = CONF_ENABLE_IRQ; | 330 | link->conf.Attributes = CONF_ENABLE_IRQ; |
335 | link->conf.IntType = INT_MEMORY_AND_IO; | 331 | link->conf.IntType = INT_MEMORY_AND_IO; |
336 | 332 | ||
@@ -363,8 +359,7 @@ static void smc91c92_detach(struct pcmcia_device *link) | |||
363 | 359 | ||
364 | dev_dbg(&link->dev, "smc91c92_detach\n"); | 360 | dev_dbg(&link->dev, "smc91c92_detach\n"); |
365 | 361 | ||
366 | if (link->dev_node) | 362 | unregister_netdev(dev); |
367 | unregister_netdev(dev); | ||
368 | 363 | ||
369 | smc91c92_release(link); | 364 | smc91c92_release(link); |
370 | 365 | ||
@@ -453,7 +448,6 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
453 | 448 | ||
454 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 449 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
455 | link->conf.Status = CCSR_AUDIO_ENA; | 450 | link->conf.Status = CCSR_AUDIO_ENA; |
456 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | ||
457 | link->io.IOAddrLines = 16; | 451 | link->io.IOAddrLines = 16; |
458 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 452 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
459 | link->io.NumPorts2 = 8; | 453 | link->io.NumPorts2 = 8; |
@@ -652,7 +646,6 @@ static int osi_config(struct pcmcia_device *link) | |||
652 | 646 | ||
653 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 647 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
654 | link->conf.Status = CCSR_AUDIO_ENA; | 648 | link->conf.Status = CCSR_AUDIO_ENA; |
655 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | ||
656 | link->io.NumPorts1 = 64; | 649 | link->io.NumPorts1 = 64; |
657 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 650 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
658 | link->io.NumPorts2 = 8; | 651 | link->io.NumPorts2 = 8; |
@@ -877,7 +870,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
877 | if (i) | 870 | if (i) |
878 | goto config_failed; | 871 | goto config_failed; |
879 | 872 | ||
880 | i = pcmcia_request_irq(link, &link->irq); | 873 | i = pcmcia_request_irq(link, smc_interrupt); |
881 | if (i) | 874 | if (i) |
882 | goto config_failed; | 875 | goto config_failed; |
883 | i = pcmcia_request_configuration(link, &link->conf); | 876 | i = pcmcia_request_configuration(link, &link->conf); |
@@ -887,7 +880,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
887 | if (smc->manfid == MANFID_MOTOROLA) | 880 | if (smc->manfid == MANFID_MOTOROLA) |
888 | mot_config(link); | 881 | mot_config(link); |
889 | 882 | ||
890 | dev->irq = link->irq.AssignedIRQ; | 883 | dev->irq = link->irq; |
891 | 884 | ||
892 | if ((if_port >= 0) && (if_port <= 2)) | 885 | if ((if_port >= 0) && (if_port <= 2)) |
893 | dev->if_port = if_port; | 886 | dev->if_port = if_port; |
@@ -960,17 +953,13 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
960 | SMC_SELECT_BANK(0); | 953 | SMC_SELECT_BANK(0); |
961 | } | 954 | } |
962 | 955 | ||
963 | link->dev_node = &smc->node; | ||
964 | SET_NETDEV_DEV(dev, &link->dev); | 956 | SET_NETDEV_DEV(dev, &link->dev); |
965 | 957 | ||
966 | if (register_netdev(dev) != 0) { | 958 | if (register_netdev(dev) != 0) { |
967 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); | 959 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); |
968 | link->dev_node = NULL; | ||
969 | goto config_undo; | 960 | goto config_undo; |
970 | } | 961 | } |
971 | 962 | ||
972 | strcpy(smc->node.dev_name, dev->name); | ||
973 | |||
974 | printk(KERN_INFO "%s: smc91c%s rev %d: io %#3lx, irq %d, " | 963 | printk(KERN_INFO "%s: smc91c%s rev %d: io %#3lx, irq %d, " |
975 | "hw_addr %pM\n", | 964 | "hw_addr %pM\n", |
976 | dev->name, name, (rev & 0x0f), dev->base_addr, dev->irq, | 965 | dev->name, name, (rev & 0x0f), dev->base_addr, dev->irq, |
@@ -1239,7 +1228,6 @@ static void smc_hardware_send_packet(struct net_device * dev) | |||
1239 | dev_kfree_skb_irq(skb); | 1228 | dev_kfree_skb_irq(skb); |
1240 | dev->trans_start = jiffies; | 1229 | dev->trans_start = jiffies; |
1241 | netif_start_queue(dev); | 1230 | netif_start_queue(dev); |
1242 | return; | ||
1243 | } | 1231 | } |
1244 | 1232 | ||
1245 | /*====================================================================*/ | 1233 | /*====================================================================*/ |
@@ -1254,7 +1242,7 @@ static void smc_tx_timeout(struct net_device *dev) | |||
1254 | dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2)); | 1242 | dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2)); |
1255 | dev->stats.tx_errors++; | 1243 | dev->stats.tx_errors++; |
1256 | smc_reset(dev); | 1244 | smc_reset(dev); |
1257 | dev->trans_start = jiffies; | 1245 | dev->trans_start = jiffies; /* prevent tx timeout */ |
1258 | smc->saved_skb = NULL; | 1246 | smc->saved_skb = NULL; |
1259 | netif_wake_queue(dev); | 1247 | netif_wake_queue(dev); |
1260 | } | 1248 | } |
@@ -1369,7 +1357,6 @@ static void smc_tx_err(struct net_device * dev) | |||
1369 | smc->packets_waiting--; | 1357 | smc->packets_waiting--; |
1370 | 1358 | ||
1371 | outw(saved_packet, ioaddr + PNR_ARR); | 1359 | outw(saved_packet, ioaddr + PNR_ARR); |
1372 | return; | ||
1373 | } | 1360 | } |
1374 | 1361 | ||
1375 | /*====================================================================*/ | 1362 | /*====================================================================*/ |
@@ -1589,8 +1576,6 @@ static void smc_rx(struct net_device *dev) | |||
1589 | } | 1576 | } |
1590 | /* Let the MMU free the memory of this packet. */ | 1577 | /* Let the MMU free the memory of this packet. */ |
1591 | outw(MC_RELEASE, ioaddr + MMU_CMD); | 1578 | outw(MC_RELEASE, ioaddr + MMU_CMD); |
1592 | |||
1593 | return; | ||
1594 | } | 1579 | } |
1595 | 1580 | ||
1596 | /*====================================================================== | 1581 | /*====================================================================== |
@@ -1621,10 +1606,10 @@ static void set_rx_mode(struct net_device *dev) | |||
1621 | rx_cfg_setting = RxStripCRC | RxEnable | RxAllMulti; | 1606 | rx_cfg_setting = RxStripCRC | RxEnable | RxAllMulti; |
1622 | else { | 1607 | else { |
1623 | if (!netdev_mc_empty(dev)) { | 1608 | if (!netdev_mc_empty(dev)) { |
1624 | struct dev_mc_list *mc_addr; | 1609 | struct netdev_hw_addr *ha; |
1625 | 1610 | ||
1626 | netdev_for_each_mc_addr(mc_addr, dev) { | 1611 | netdev_for_each_mc_addr(ha, dev) { |
1627 | u_int position = ether_crc(6, mc_addr->dmi_addr); | 1612 | u_int position = ether_crc(6, ha->addr); |
1628 | multicast_table[position >> 29] |= 1 << ((position >> 26) & 7); | 1613 | multicast_table[position >> 29] |= 1 << ((position >> 26) & 7); |
1629 | } | 1614 | } |
1630 | } | 1615 | } |
@@ -1640,8 +1625,6 @@ static void set_rx_mode(struct net_device *dev) | |||
1640 | outw(rx_cfg_setting, ioaddr + RCR); | 1625 | outw(rx_cfg_setting, ioaddr + RCR); |
1641 | SMC_SELECT_BANK(2); | 1626 | SMC_SELECT_BANK(2); |
1642 | spin_unlock_irqrestore(&smc->lock, flags); | 1627 | spin_unlock_irqrestore(&smc->lock, flags); |
1643 | |||
1644 | return; | ||
1645 | } | 1628 | } |
1646 | 1629 | ||
1647 | /*====================================================================== | 1630 | /*====================================================================== |
@@ -1804,23 +1787,30 @@ static void media_check(u_long arg) | |||
1804 | SMC_SELECT_BANK(1); | 1787 | SMC_SELECT_BANK(1); |
1805 | media |= (inw(ioaddr + CONFIG) & CFG_AUI_SELECT) ? 2 : 1; | 1788 | media |= (inw(ioaddr + CONFIG) & CFG_AUI_SELECT) ? 2 : 1; |
1806 | 1789 | ||
1790 | SMC_SELECT_BANK(saved_bank); | ||
1791 | spin_unlock_irqrestore(&smc->lock, flags); | ||
1792 | |||
1807 | /* Check for pending interrupt with watchdog flag set: with | 1793 | /* Check for pending interrupt with watchdog flag set: with |
1808 | this, we can limp along even if the interrupt is blocked */ | 1794 | this, we can limp along even if the interrupt is blocked */ |
1809 | if (smc->watchdog++ && ((i>>8) & i)) { | 1795 | if (smc->watchdog++ && ((i>>8) & i)) { |
1810 | if (!smc->fast_poll) | 1796 | if (!smc->fast_poll) |
1811 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); | 1797 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); |
1798 | local_irq_save(flags); | ||
1812 | smc_interrupt(dev->irq, dev); | 1799 | smc_interrupt(dev->irq, dev); |
1800 | local_irq_restore(flags); | ||
1813 | smc->fast_poll = HZ; | 1801 | smc->fast_poll = HZ; |
1814 | } | 1802 | } |
1815 | if (smc->fast_poll) { | 1803 | if (smc->fast_poll) { |
1816 | smc->fast_poll--; | 1804 | smc->fast_poll--; |
1817 | smc->media.expires = jiffies + HZ/100; | 1805 | smc->media.expires = jiffies + HZ/100; |
1818 | add_timer(&smc->media); | 1806 | add_timer(&smc->media); |
1819 | SMC_SELECT_BANK(saved_bank); | ||
1820 | spin_unlock_irqrestore(&smc->lock, flags); | ||
1821 | return; | 1807 | return; |
1822 | } | 1808 | } |
1823 | 1809 | ||
1810 | spin_lock_irqsave(&smc->lock, flags); | ||
1811 | |||
1812 | saved_bank = inw(ioaddr + BANK_SELECT); | ||
1813 | |||
1824 | if (smc->cfg & CFG_MII_SELECT) { | 1814 | if (smc->cfg & CFG_MII_SELECT) { |
1825 | if (smc->mii_if.phy_id < 0) | 1815 | if (smc->mii_if.phy_id < 0) |
1826 | goto reschedule; | 1816 | goto reschedule; |
@@ -1978,15 +1968,16 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1978 | unsigned int ioaddr = dev->base_addr; | 1968 | unsigned int ioaddr = dev->base_addr; |
1979 | u16 saved_bank = inw(ioaddr + BANK_SELECT); | 1969 | u16 saved_bank = inw(ioaddr + BANK_SELECT); |
1980 | int ret; | 1970 | int ret; |
1971 | unsigned long flags; | ||
1981 | 1972 | ||
1982 | spin_lock_irq(&smc->lock); | 1973 | spin_lock_irqsave(&smc->lock, flags); |
1983 | SMC_SELECT_BANK(3); | 1974 | SMC_SELECT_BANK(3); |
1984 | if (smc->cfg & CFG_MII_SELECT) | 1975 | if (smc->cfg & CFG_MII_SELECT) |
1985 | ret = mii_ethtool_gset(&smc->mii_if, ecmd); | 1976 | ret = mii_ethtool_gset(&smc->mii_if, ecmd); |
1986 | else | 1977 | else |
1987 | ret = smc_netdev_get_ecmd(dev, ecmd); | 1978 | ret = smc_netdev_get_ecmd(dev, ecmd); |
1988 | SMC_SELECT_BANK(saved_bank); | 1979 | SMC_SELECT_BANK(saved_bank); |
1989 | spin_unlock_irq(&smc->lock); | 1980 | spin_unlock_irqrestore(&smc->lock, flags); |
1990 | return ret; | 1981 | return ret; |
1991 | } | 1982 | } |
1992 | 1983 | ||
@@ -1996,15 +1987,16 @@ static int smc_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1996 | unsigned int ioaddr = dev->base_addr; | 1987 | unsigned int ioaddr = dev->base_addr; |
1997 | u16 saved_bank = inw(ioaddr + BANK_SELECT); | 1988 | u16 saved_bank = inw(ioaddr + BANK_SELECT); |
1998 | int ret; | 1989 | int ret; |
1990 | unsigned long flags; | ||
1999 | 1991 | ||
2000 | spin_lock_irq(&smc->lock); | 1992 | spin_lock_irqsave(&smc->lock, flags); |
2001 | SMC_SELECT_BANK(3); | 1993 | SMC_SELECT_BANK(3); |
2002 | if (smc->cfg & CFG_MII_SELECT) | 1994 | if (smc->cfg & CFG_MII_SELECT) |
2003 | ret = mii_ethtool_sset(&smc->mii_if, ecmd); | 1995 | ret = mii_ethtool_sset(&smc->mii_if, ecmd); |
2004 | else | 1996 | else |
2005 | ret = smc_netdev_set_ecmd(dev, ecmd); | 1997 | ret = smc_netdev_set_ecmd(dev, ecmd); |
2006 | SMC_SELECT_BANK(saved_bank); | 1998 | SMC_SELECT_BANK(saved_bank); |
2007 | spin_unlock_irq(&smc->lock); | 1999 | spin_unlock_irqrestore(&smc->lock, flags); |
2008 | return ret; | 2000 | return ret; |
2009 | } | 2001 | } |
2010 | 2002 | ||
@@ -2014,12 +2006,13 @@ static u32 smc_get_link(struct net_device *dev) | |||
2014 | unsigned int ioaddr = dev->base_addr; | 2006 | unsigned int ioaddr = dev->base_addr; |
2015 | u16 saved_bank = inw(ioaddr + BANK_SELECT); | 2007 | u16 saved_bank = inw(ioaddr + BANK_SELECT); |
2016 | u32 ret; | 2008 | u32 ret; |
2009 | unsigned long flags; | ||
2017 | 2010 | ||
2018 | spin_lock_irq(&smc->lock); | 2011 | spin_lock_irqsave(&smc->lock, flags); |
2019 | SMC_SELECT_BANK(3); | 2012 | SMC_SELECT_BANK(3); |
2020 | ret = smc_link_ok(dev); | 2013 | ret = smc_link_ok(dev); |
2021 | SMC_SELECT_BANK(saved_bank); | 2014 | SMC_SELECT_BANK(saved_bank); |
2022 | spin_unlock_irq(&smc->lock); | 2015 | spin_unlock_irqrestore(&smc->lock, flags); |
2023 | return ret; | 2016 | return ret; |
2024 | } | 2017 | } |
2025 | 2018 | ||
@@ -2056,16 +2049,17 @@ static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
2056 | int rc = 0; | 2049 | int rc = 0; |
2057 | u16 saved_bank; | 2050 | u16 saved_bank; |
2058 | unsigned int ioaddr = dev->base_addr; | 2051 | unsigned int ioaddr = dev->base_addr; |
2052 | unsigned long flags; | ||
2059 | 2053 | ||
2060 | if (!netif_running(dev)) | 2054 | if (!netif_running(dev)) |
2061 | return -EINVAL; | 2055 | return -EINVAL; |
2062 | 2056 | ||
2063 | spin_lock_irq(&smc->lock); | 2057 | spin_lock_irqsave(&smc->lock, flags); |
2064 | saved_bank = inw(ioaddr + BANK_SELECT); | 2058 | saved_bank = inw(ioaddr + BANK_SELECT); |
2065 | SMC_SELECT_BANK(3); | 2059 | SMC_SELECT_BANK(3); |
2066 | rc = generic_mii_ioctl(&smc->mii_if, mii, cmd, NULL); | 2060 | rc = generic_mii_ioctl(&smc->mii_if, mii, cmd, NULL); |
2067 | SMC_SELECT_BANK(saved_bank); | 2061 | SMC_SELECT_BANK(saved_bank); |
2068 | spin_unlock_irq(&smc->lock); | 2062 | spin_unlock_irqrestore(&smc->lock, flags); |
2069 | return rc; | 2063 | return rc; |
2070 | } | 2064 | } |
2071 | 2065 | ||