aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcnet32.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcnet32.c')
-rw-r--r--drivers/net/pcnet32.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 955a87ac9afa..6859442f1862 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -485,7 +485,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev,
485 &new_ring_dma_addr); 485 &new_ring_dma_addr);
486 if (new_tx_ring == NULL) { 486 if (new_tx_ring == NULL) {
487 if (netif_msg_drv(lp)) 487 if (netif_msg_drv(lp))
488 printk("\n" KERN_ERR 488 printk(KERN_ERR
489 "%s: Consistent memory allocation failed.\n", 489 "%s: Consistent memory allocation failed.\n",
490 dev->name); 490 dev->name);
491 return; 491 return;
@@ -496,7 +496,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev,
496 GFP_ATOMIC); 496 GFP_ATOMIC);
497 if (!new_dma_addr_list) { 497 if (!new_dma_addr_list) {
498 if (netif_msg_drv(lp)) 498 if (netif_msg_drv(lp))
499 printk("\n" KERN_ERR 499 printk(KERN_ERR
500 "%s: Memory allocation failed.\n", dev->name); 500 "%s: Memory allocation failed.\n", dev->name);
501 goto free_new_tx_ring; 501 goto free_new_tx_ring;
502 } 502 }
@@ -505,7 +505,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev,
505 GFP_ATOMIC); 505 GFP_ATOMIC);
506 if (!new_skb_list) { 506 if (!new_skb_list) {
507 if (netif_msg_drv(lp)) 507 if (netif_msg_drv(lp))
508 printk("\n" KERN_ERR 508 printk(KERN_ERR
509 "%s: Memory allocation failed.\n", dev->name); 509 "%s: Memory allocation failed.\n", dev->name);
510 goto free_new_lists; 510 goto free_new_lists;
511 } 511 }
@@ -563,7 +563,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev,
563 &new_ring_dma_addr); 563 &new_ring_dma_addr);
564 if (new_rx_ring == NULL) { 564 if (new_rx_ring == NULL) {
565 if (netif_msg_drv(lp)) 565 if (netif_msg_drv(lp))
566 printk("\n" KERN_ERR 566 printk(KERN_ERR
567 "%s: Consistent memory allocation failed.\n", 567 "%s: Consistent memory allocation failed.\n",
568 dev->name); 568 dev->name);
569 return; 569 return;
@@ -574,7 +574,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev,
574 GFP_ATOMIC); 574 GFP_ATOMIC);
575 if (!new_dma_addr_list) { 575 if (!new_dma_addr_list) {
576 if (netif_msg_drv(lp)) 576 if (netif_msg_drv(lp))
577 printk("\n" KERN_ERR 577 printk(KERN_ERR
578 "%s: Memory allocation failed.\n", dev->name); 578 "%s: Memory allocation failed.\n", dev->name);
579 goto free_new_rx_ring; 579 goto free_new_rx_ring;
580 } 580 }
@@ -583,7 +583,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev,
583 GFP_ATOMIC); 583 GFP_ATOMIC);
584 if (!new_skb_list) { 584 if (!new_skb_list) {
585 if (netif_msg_drv(lp)) 585 if (netif_msg_drv(lp))
586 printk("\n" KERN_ERR 586 printk(KERN_ERR
587 "%s: Memory allocation failed.\n", dev->name); 587 "%s: Memory allocation failed.\n", dev->name);
588 goto free_new_lists; 588 goto free_new_lists;
589 } 589 }
@@ -1611,8 +1611,11 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1611 if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 1611 if (pcnet32_dwio_read_csr(ioaddr, 0) == 4
1612 && pcnet32_dwio_check(ioaddr)) { 1612 && pcnet32_dwio_check(ioaddr)) {
1613 a = &pcnet32_dwio; 1613 a = &pcnet32_dwio;
1614 } else 1614 } else {
1615 if (pcnet32_debug & NETIF_MSG_PROBE)
1616 printk(KERN_ERR PFX "No access methods\n");
1615 goto err_release_region; 1617 goto err_release_region;
1618 }
1616 } 1619 }
1617 1620
1618 chip_version = 1621 chip_version =
@@ -1719,7 +1722,9 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1719 ret = -ENOMEM; 1722 ret = -ENOMEM;
1720 goto err_release_region; 1723 goto err_release_region;
1721 } 1724 }
1722 SET_NETDEV_DEV(dev, &pdev->dev); 1725
1726 if (pdev)
1727 SET_NETDEV_DEV(dev, &pdev->dev);
1723 1728
1724 if (pcnet32_debug & NETIF_MSG_PROBE) 1729 if (pcnet32_debug & NETIF_MSG_PROBE)
1725 printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); 1730 printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr);
@@ -1766,38 +1771,38 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1766 /* Version 0x2623 and 0x2624 */ 1771 /* Version 0x2623 and 0x2624 */
1767 if (((chip_version + 1) & 0xfffe) == 0x2624) { 1772 if (((chip_version + 1) & 0xfffe) == 0x2624) {
1768 i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ 1773 i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */
1769 printk("\n" KERN_INFO " tx_start_pt(0x%04x):", i); 1774 printk(KERN_INFO " tx_start_pt(0x%04x):", i);
1770 switch (i >> 10) { 1775 switch (i >> 10) {
1771 case 0: 1776 case 0:
1772 printk(" 20 bytes,"); 1777 printk(KERN_CONT " 20 bytes,");
1773 break; 1778 break;
1774 case 1: 1779 case 1:
1775 printk(" 64 bytes,"); 1780 printk(KERN_CONT " 64 bytes,");
1776 break; 1781 break;
1777 case 2: 1782 case 2:
1778 printk(" 128 bytes,"); 1783 printk(KERN_CONT " 128 bytes,");
1779 break; 1784 break;
1780 case 3: 1785 case 3:
1781 printk("~220 bytes,"); 1786 printk(KERN_CONT "~220 bytes,");
1782 break; 1787 break;
1783 } 1788 }
1784 i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ 1789 i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */
1785 printk(" BCR18(%x):", i & 0xffff); 1790 printk(KERN_CONT " BCR18(%x):", i & 0xffff);
1786 if (i & (1 << 5)) 1791 if (i & (1 << 5))
1787 printk("BurstWrEn "); 1792 printk(KERN_CONT "BurstWrEn ");
1788 if (i & (1 << 6)) 1793 if (i & (1 << 6))
1789 printk("BurstRdEn "); 1794 printk(KERN_CONT "BurstRdEn ");
1790 if (i & (1 << 7)) 1795 if (i & (1 << 7))
1791 printk("DWordIO "); 1796 printk(KERN_CONT "DWordIO ");
1792 if (i & (1 << 11)) 1797 if (i & (1 << 11))
1793 printk("NoUFlow "); 1798 printk(KERN_CONT "NoUFlow ");
1794 i = a->read_bcr(ioaddr, 25); 1799 i = a->read_bcr(ioaddr, 25);
1795 printk("\n" KERN_INFO " SRAMSIZE=0x%04x,", i << 8); 1800 printk(KERN_INFO " SRAMSIZE=0x%04x,", i << 8);
1796 i = a->read_bcr(ioaddr, 26); 1801 i = a->read_bcr(ioaddr, 26);
1797 printk(" SRAM_BND=0x%04x,", i << 8); 1802 printk(KERN_CONT " SRAM_BND=0x%04x,", i << 8);
1798 i = a->read_bcr(ioaddr, 27); 1803 i = a->read_bcr(ioaddr, 27);
1799 if (i & (1 << 14)) 1804 if (i & (1 << 14))
1800 printk("LowLatRx"); 1805 printk(KERN_CONT "LowLatRx");
1801 } 1806 }
1802 } 1807 }
1803 1808
@@ -1818,7 +1823,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1818 1823
1819 spin_lock_init(&lp->lock); 1824 spin_lock_init(&lp->lock);
1820 1825
1821 SET_NETDEV_DEV(dev, &pdev->dev);
1822 lp->name = chipname; 1826 lp->name = chipname;
1823 lp->shared_irq = shared; 1827 lp->shared_irq = shared;
1824 lp->tx_ring_size = TX_RING_SIZE; /* default tx ring size */ 1828 lp->tx_ring_size = TX_RING_SIZE; /* default tx ring size */
@@ -1835,7 +1839,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1835 lp->chip_version = chip_version; 1839 lp->chip_version = chip_version;
1836 lp->msg_enable = pcnet32_debug; 1840 lp->msg_enable = pcnet32_debug;
1837 if ((cards_found >= MAX_UNITS) 1841 if ((cards_found >= MAX_UNITS)
1838 || (options[cards_found] > sizeof(options_mapping))) 1842 || (options[cards_found] >= sizeof(options_mapping)))
1839 lp->options = PCNET32_PORT_ASEL; 1843 lp->options = PCNET32_PORT_ASEL;
1840 else 1844 else
1841 lp->options = options_mapping[options[cards_found]]; 1845 lp->options = options_mapping[options[cards_found]];
@@ -1852,12 +1856,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1852 ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) 1856 ((cards_found >= MAX_UNITS) || full_duplex[cards_found]))
1853 lp->options |= PCNET32_PORT_FD; 1857 lp->options |= PCNET32_PORT_FD;
1854 1858
1855 if (!a) {
1856 if (pcnet32_debug & NETIF_MSG_PROBE)
1857 printk(KERN_ERR PFX "No access methods\n");
1858 ret = -ENODEV;
1859 goto err_free_consistent;
1860 }
1861 lp->a = *a; 1859 lp->a = *a;
1862 1860
1863 /* prior to register_netdev, dev->name is not yet correct */ 1861 /* prior to register_netdev, dev->name is not yet correct */
@@ -1973,14 +1971,13 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1973 1971
1974 return 0; 1972 return 0;
1975 1973
1976 err_free_ring: 1974err_free_ring:
1977 pcnet32_free_ring(dev); 1975 pcnet32_free_ring(dev);
1978 err_free_consistent:
1979 pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block), 1976 pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block),
1980 lp->init_block, lp->init_dma_addr); 1977 lp->init_block, lp->init_dma_addr);
1981 err_free_netdev: 1978err_free_netdev:
1982 free_netdev(dev); 1979 free_netdev(dev);
1983 err_release_region: 1980err_release_region:
1984 release_region(ioaddr, PCNET32_TOTAL_SIZE); 1981 release_region(ioaddr, PCNET32_TOTAL_SIZE);
1985 return ret; 1982 return ret;
1986} 1983}
@@ -1996,7 +1993,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
1996 &lp->tx_ring_dma_addr); 1993 &lp->tx_ring_dma_addr);
1997 if (lp->tx_ring == NULL) { 1994 if (lp->tx_ring == NULL) {
1998 if (netif_msg_drv(lp)) 1995 if (netif_msg_drv(lp))
1999 printk("\n" KERN_ERR PFX 1996 printk(KERN_ERR PFX
2000 "%s: Consistent memory allocation failed.\n", 1997 "%s: Consistent memory allocation failed.\n",
2001 name); 1998 name);
2002 return -ENOMEM; 1999 return -ENOMEM;
@@ -2008,7 +2005,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
2008 &lp->rx_ring_dma_addr); 2005 &lp->rx_ring_dma_addr);
2009 if (lp->rx_ring == NULL) { 2006 if (lp->rx_ring == NULL) {
2010 if (netif_msg_drv(lp)) 2007 if (netif_msg_drv(lp))
2011 printk("\n" KERN_ERR PFX 2008 printk(KERN_ERR PFX
2012 "%s: Consistent memory allocation failed.\n", 2009 "%s: Consistent memory allocation failed.\n",
2013 name); 2010 name);
2014 return -ENOMEM; 2011 return -ENOMEM;
@@ -2018,7 +2015,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
2018 GFP_ATOMIC); 2015 GFP_ATOMIC);
2019 if (!lp->tx_dma_addr) { 2016 if (!lp->tx_dma_addr) {
2020 if (netif_msg_drv(lp)) 2017 if (netif_msg_drv(lp))
2021 printk("\n" KERN_ERR PFX 2018 printk(KERN_ERR PFX
2022 "%s: Memory allocation failed.\n", name); 2019 "%s: Memory allocation failed.\n", name);
2023 return -ENOMEM; 2020 return -ENOMEM;
2024 } 2021 }
@@ -2027,7 +2024,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
2027 GFP_ATOMIC); 2024 GFP_ATOMIC);
2028 if (!lp->rx_dma_addr) { 2025 if (!lp->rx_dma_addr) {
2029 if (netif_msg_drv(lp)) 2026 if (netif_msg_drv(lp))
2030 printk("\n" KERN_ERR PFX 2027 printk(KERN_ERR PFX
2031 "%s: Memory allocation failed.\n", name); 2028 "%s: Memory allocation failed.\n", name);
2032 return -ENOMEM; 2029 return -ENOMEM;
2033 } 2030 }
@@ -2036,7 +2033,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
2036 GFP_ATOMIC); 2033 GFP_ATOMIC);
2037 if (!lp->tx_skbuff) { 2034 if (!lp->tx_skbuff) {
2038 if (netif_msg_drv(lp)) 2035 if (netif_msg_drv(lp))
2039 printk("\n" KERN_ERR PFX 2036 printk(KERN_ERR PFX
2040 "%s: Memory allocation failed.\n", name); 2037 "%s: Memory allocation failed.\n", name);
2041 return -ENOMEM; 2038 return -ENOMEM;
2042 } 2039 }
@@ -2045,7 +2042,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
2045 GFP_ATOMIC); 2042 GFP_ATOMIC);
2046 if (!lp->rx_skbuff) { 2043 if (!lp->rx_skbuff) {
2047 if (netif_msg_drv(lp)) 2044 if (netif_msg_drv(lp))
2048 printk("\n" KERN_ERR PFX 2045 printk(KERN_ERR PFX
2049 "%s: Memory allocation failed.\n", name); 2046 "%s: Memory allocation failed.\n", name);
2050 return -ENOMEM; 2047 return -ENOMEM;
2051 } 2048 }
@@ -2089,6 +2086,7 @@ static void pcnet32_free_ring(struct net_device *dev)
2089static int pcnet32_open(struct net_device *dev) 2086static int pcnet32_open(struct net_device *dev)
2090{ 2087{
2091 struct pcnet32_private *lp = netdev_priv(dev); 2088 struct pcnet32_private *lp = netdev_priv(dev);
2089 struct pci_dev *pdev = lp->pci_dev;
2092 unsigned long ioaddr = dev->base_addr; 2090 unsigned long ioaddr = dev->base_addr;
2093 u16 val; 2091 u16 val;
2094 int i; 2092 int i;
@@ -2149,9 +2147,9 @@ static int pcnet32_open(struct net_device *dev)
2149 lp->a.write_csr(ioaddr, 124, val); 2147 lp->a.write_csr(ioaddr, 124, val);
2150 2148
2151 /* Allied Telesyn AT 2700/2701 FX are 100Mbit only and do not negotiate */ 2149 /* Allied Telesyn AT 2700/2701 FX are 100Mbit only and do not negotiate */
2152 if (lp->pci_dev->subsystem_vendor == PCI_VENDOR_ID_AT && 2150 if (pdev && pdev->subsystem_vendor == PCI_VENDOR_ID_AT &&
2153 (lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2700FX || 2151 (pdev->subsystem_device == PCI_SUBDEVICE_ID_AT_2700FX ||
2154 lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2701FX)) { 2152 pdev->subsystem_device == PCI_SUBDEVICE_ID_AT_2701FX)) {
2155 if (lp->options & PCNET32_PORT_ASEL) { 2153 if (lp->options & PCNET32_PORT_ASEL) {
2156 lp->options = PCNET32_PORT_FD | PCNET32_PORT_100; 2154 lp->options = PCNET32_PORT_FD | PCNET32_PORT_100;
2157 if (netif_msg_link(lp)) 2155 if (netif_msg_link(lp))