aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tlan.c')
-rw-r--r--drivers/net/tlan.c309
1 files changed, 77 insertions, 232 deletions
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index e48a80885343..ace6404e2fac 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -25,153 +25,10 @@
25 * Microchip Technology, 24C01A/02A/04A Data Sheet 25 * Microchip Technology, 24C01A/02A/04A Data Sheet
26 * available in PDF format from www.microchip.com 26 * available in PDF format from www.microchip.com
27 * 27 *
28 * Change History
29 *
30 * Tigran Aivazian <tigran@sco.com>: TLan_PciProbe() now uses
31 * new PCI BIOS interface.
32 * Alan Cox <alan@lxorguk.ukuu.org.uk>:
33 * Fixed the out of memory
34 * handling.
35 *
36 * Torben Mathiasen <torben.mathiasen@compaq.com> New Maintainer!
37 *
38 * v1.1 Dec 20, 1999 - Removed linux version checking
39 * Patch from Tigran Aivazian.
40 * - v1.1 includes Alan's SMP updates.
41 * - We still have problems on SMP though,
42 * but I'm looking into that.
43 *
44 * v1.2 Jan 02, 2000 - Hopefully fixed the SMP deadlock.
45 * - Removed dependency of HZ being 100.
46 * - We now allow higher priority timers to
47 * overwrite timers like TLAN_TIMER_ACTIVITY
48 * Patch from John Cagle <john.cagle@compaq.com>.
49 * - Fixed a few compiler warnings.
50 *
51 * v1.3 Feb 04, 2000 - Fixed the remaining HZ issues.
52 * - Removed call to pci_present().
53 * - Removed SA_INTERRUPT flag from irq handler.
54 * - Added __init and __initdata to reduce resisdent
55 * code size.
56 * - Driver now uses module_init/module_exit.
57 * - Rewrote init_module and tlan_probe to
58 * share a lot more code. We now use tlan_probe
59 * with builtin and module driver.
60 * - Driver ported to new net API.
61 * - tlan.txt has been reworked to reflect current
62 * driver (almost)
63 * - Other minor stuff
64 *
65 * v1.4 Feb 10, 2000 - Updated with more changes required after Dave's
66 * network cleanup in 2.3.43pre7 (Tigran & myself)
67 * - Minor stuff.
68 *
69 * v1.5 March 22, 2000 - Fixed another timer bug that would hang the
70 * driver if no cable/link were present.
71 * - Cosmetic changes.
72 * - TODO: Port completely to new PCI/DMA API
73 * Auto-Neg fallback.
74 *
75 * v1.6 April 04, 2000 - Fixed driver support for kernel-parameters.
76 * Haven't tested it though, as the kernel support
77 * is currently broken (2.3.99p4p3).
78 * - Updated tlan.txt accordingly.
79 * - Adjusted minimum/maximum frame length.
80 * - There is now a TLAN website up at
81 * http://hp.sourceforge.net/
82 *
83 * v1.7 April 07, 2000 - Started to implement custom ioctls. Driver now
84 * reports PHY information when used with Donald
85 * Beckers userspace MII diagnostics utility.
86 *
87 * v1.8 April 23, 2000 - Fixed support for forced speed/duplex settings.
88 * - Added link information to Auto-Neg and forced
89 * modes. When NIC operates with auto-neg the driver
90 * will report Link speed & duplex modes as well as
91 * link partner abilities. When forced link is used,
92 * the driver will report status of the established
93 * link.
94 * Please read tlan.txt for additional information.
95 * - Removed call to check_region(), and used
96 * return value of request_region() instead.
97 *
98 * v1.8a May 28, 2000 - Minor updates.
99 *
100 * v1.9 July 25, 2000 - Fixed a few remaining Full-Duplex issues.
101 * - Updated with timer fixes from Andrew Morton.
102 * - Fixed module race in TLan_Open.
103 * - Added routine to monitor PHY status.
104 * - Added activity led support for Proliant devices.
105 *
106 * v1.10 Aug 30, 2000 - Added support for EISA based tlan controllers
107 * like the Compaq NetFlex3/E.
108 * - Rewrote tlan_probe to better handle multiple
109 * bus probes. Probing and device setup is now
110 * done through TLan_Probe and TLan_init_one. Actual
111 * hardware probe is done with kernel API and
112 * TLan_EisaProbe.
113 * - Adjusted debug information for probing.
114 * - Fixed bug that would cause general debug
115 * information to be printed after driver removal.
116 * - Added transmit timeout handling.
117 * - Fixed OOM return values in tlan_probe.
118 * - Fixed possible mem leak in tlan_exit
119 * (now tlan_remove_one).
120 * - Fixed timer bug in TLan_phyMonitor.
121 * - This driver version is alpha quality, please
122 * send me any bug issues you may encounter.
123 *
124 * v1.11 Aug 31, 2000 - Do not try to register irq 0 if no irq line was
125 * set for EISA cards.
126 * - Added support for NetFlex3/E with nibble-rate
127 * 10Base-T PHY. This is untestet as I haven't got
128 * one of these cards.
129 * - Fixed timer being added twice.
130 * - Disabled PhyMonitoring by default as this is
131 * work in progress. Define MONITOR to enable it.
132 * - Now we don't display link info with PHYs that
133 * doesn't support it (level1).
134 * - Incresed tx_timeout beacuse of auto-neg.
135 * - Adjusted timers for forced speeds.
136 *
137 * v1.12 Oct 12, 2000 - Minor fixes (memleak, init, etc.)
138 *
139 * v1.13 Nov 28, 2000 - Stop flooding console with auto-neg issues
140 * when link can't be established.
141 * - Added the bbuf option as a kernel parameter.
142 * - Fixed ioaddr probe bug.
143 * - Fixed stupid deadlock with MII interrupts.
144 * - Added support for speed/duplex selection with
145 * multiple nics.
146 * - Added partly fix for TX Channel lockup with
147 * TLAN v1.0 silicon. This needs to be investigated
148 * further.
149 *
150 * v1.14 Dec 16, 2000 - Added support for servicing multiple frames per.
151 * interrupt. Thanks goes to
152 * Adam Keys <adam@ti.com>
153 * Denis Beaudoin <dbeaudoin@ti.com>
154 * for providing the patch.
155 * - Fixed auto-neg output when using multiple
156 * adapters.
157 * - Converted to use new taskq interface.
158 *
159 * v1.14a Jan 6, 2001 - Minor adjustments (spinlocks, etc.)
160 *
161 * Samuel Chessman <chessman@tux.org> New Maintainer!
162 *
163 * v1.15 Apr 4, 2002 - Correct operation when aui=1 to be
164 * 10T half duplex no loopback
165 * Thanks to Gunnar Eikman
166 *
167 * Sakari Ailus <sakari.ailus@iki.fi>:
168 *
169 * v1.15a Dec 15 2008 - Remove bbuf support, it doesn't work anyway.
170 * v1.16 Jan 6 2011 - Make checkpatch.pl happy.
171 * v1.17 Jan 6 2011 - Add suspend/resume support.
172 *
173 ******************************************************************************/ 28 ******************************************************************************/
174 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
175#include <linux/module.h> 32#include <linux/module.h>
176#include <linux/init.h> 33#include <linux/init.h>
177#include <linux/ioport.h> 34#include <linux/ioport.h>
@@ -204,7 +61,7 @@ module_param_array(speed, int, NULL, 0);
204MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)"); 61MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)");
205MODULE_PARM_DESC(duplex, 62MODULE_PARM_DESC(duplex,
206 "ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)"); 63 "ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)");
207MODULE_PARM_DESC(speed, "ThunderLAN port speen setting(s) (0,10,100)"); 64MODULE_PARM_DESC(speed, "ThunderLAN port speed setting(s) (0,10,100)");
208 65
209MODULE_AUTHOR("Maintainer: Samuel Chessman <chessman@tux.org>"); 66MODULE_AUTHOR("Maintainer: Samuel Chessman <chessman@tux.org>");
210MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters"); 67MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters");
@@ -542,7 +399,7 @@ static int __init tlan_probe(void)
542{ 399{
543 int rc = -ENODEV; 400 int rc = -ENODEV;
544 401
545 printk(KERN_INFO "%s", tlan_banner); 402 pr_info("%s", tlan_banner);
546 403
547 TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n"); 404 TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n");
548 405
@@ -551,16 +408,16 @@ static int __init tlan_probe(void)
551 rc = pci_register_driver(&tlan_driver); 408 rc = pci_register_driver(&tlan_driver);
552 409
553 if (rc != 0) { 410 if (rc != 0) {
554 printk(KERN_ERR "TLAN: Could not register pci driver.\n"); 411 pr_err("Could not register pci driver\n");
555 goto err_out_pci_free; 412 goto err_out_pci_free;
556 } 413 }
557 414
558 TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n"); 415 TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n");
559 tlan_eisa_probe(); 416 tlan_eisa_probe();
560 417
561 printk(KERN_INFO "TLAN: %d device%s installed, PCI: %d EISA: %d\n", 418 pr_info("%d device%s installed, PCI: %d EISA: %d\n",
562 tlan_devices_installed, tlan_devices_installed == 1 ? "" : "s", 419 tlan_devices_installed, tlan_devices_installed == 1 ? "" : "s",
563 tlan_have_pci, tlan_have_eisa); 420 tlan_have_pci, tlan_have_eisa);
564 421
565 if (tlan_devices_installed == 0) { 422 if (tlan_devices_installed == 0) {
566 rc = -ENODEV; 423 rc = -ENODEV;
@@ -619,7 +476,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
619 476
620 rc = pci_request_regions(pdev, tlan_signature); 477 rc = pci_request_regions(pdev, tlan_signature);
621 if (rc) { 478 if (rc) {
622 printk(KERN_ERR "TLAN: Could not reserve IO regions\n"); 479 pr_err("Could not reserve IO regions\n");
623 goto err_out; 480 goto err_out;
624 } 481 }
625 } 482 }
@@ -627,7 +484,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
627 484
628 dev = alloc_etherdev(sizeof(struct tlan_priv)); 485 dev = alloc_etherdev(sizeof(struct tlan_priv));
629 if (dev == NULL) { 486 if (dev == NULL) {
630 printk(KERN_ERR "TLAN: Could not allocate memory for device.\n"); 487 pr_err("Could not allocate memory for device\n");
631 rc = -ENOMEM; 488 rc = -ENOMEM;
632 goto err_out_regions; 489 goto err_out_regions;
633 } 490 }
@@ -646,8 +503,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
646 503
647 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 504 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
648 if (rc) { 505 if (rc) {
649 printk(KERN_ERR 506 pr_err("No suitable PCI mapping available\n");
650 "TLAN: No suitable PCI mapping available.\n");
651 goto err_out_free_dev; 507 goto err_out_free_dev;
652 } 508 }
653 509
@@ -661,7 +517,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
661 } 517 }
662 } 518 }
663 if (!pci_io_base) { 519 if (!pci_io_base) {
664 printk(KERN_ERR "TLAN: No IO mappings available\n"); 520 pr_err("No IO mappings available\n");
665 rc = -EIO; 521 rc = -EIO;
666 goto err_out_free_dev; 522 goto err_out_free_dev;
667 } 523 }
@@ -717,13 +573,13 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
717 573
718 rc = tlan_init(dev); 574 rc = tlan_init(dev);
719 if (rc) { 575 if (rc) {
720 printk(KERN_ERR "TLAN: Could not set up device.\n"); 576 pr_err("Could not set up device\n");
721 goto err_out_free_dev; 577 goto err_out_free_dev;
722 } 578 }
723 579
724 rc = register_netdev(dev); 580 rc = register_netdev(dev);
725 if (rc) { 581 if (rc) {
726 printk(KERN_ERR "TLAN: Could not register device.\n"); 582 pr_err("Could not register device\n");
727 goto err_out_uninit; 583 goto err_out_uninit;
728 } 584 }
729 585
@@ -740,12 +596,11 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
740 tlan_have_eisa++; 596 tlan_have_eisa++;
741 } 597 }
742 598
743 printk(KERN_INFO "TLAN: %s irq=%2d, io=%04x, %s, Rev. %d\n", 599 netdev_info(dev, "irq=%2d, io=%04x, %s, Rev. %d\n",
744 dev->name, 600 (int)dev->irq,
745 (int) dev->irq, 601 (int)dev->base_addr,
746 (int) dev->base_addr, 602 priv->adapter->device_label,
747 priv->adapter->device_label, 603 priv->adapter_rev);
748 priv->adapter_rev);
749 return 0; 604 return 0;
750 605
751err_out_uninit: 606err_out_uninit:
@@ -861,7 +716,7 @@ static void __init tlan_eisa_probe(void)
861 } 716 }
862 717
863 if (debug == 0x10) 718 if (debug == 0x10)
864 printk(KERN_INFO "Found one\n"); 719 pr_info("Found one\n");
865 720
866 721
867 /* Get irq from board */ 722 /* Get irq from board */
@@ -890,12 +745,12 @@ static void __init tlan_eisa_probe(void)
890 745
891out: 746out:
892 if (debug == 0x10) 747 if (debug == 0x10)
893 printk(KERN_INFO "None found\n"); 748 pr_info("None found\n");
894 continue; 749 continue;
895 750
896out2: 751out2:
897 if (debug == 0x10) 752 if (debug == 0x10)
898 printk(KERN_INFO "Card found but it is not enabled, skipping\n"); 753 pr_info("Card found but it is not enabled, skipping\n");
899 continue; 754 continue;
900 755
901 } 756 }
@@ -963,8 +818,7 @@ static int tlan_init(struct net_device *dev)
963 priv->dma_size = dma_size; 818 priv->dma_size = dma_size;
964 819
965 if (priv->dma_storage == NULL) { 820 if (priv->dma_storage == NULL) {
966 printk(KERN_ERR 821 pr_err("Could not allocate lists and buffers for %s\n",
967 "TLAN: Could not allocate lists and buffers for %s.\n",
968 dev->name); 822 dev->name);
969 return -ENOMEM; 823 return -ENOMEM;
970 } 824 }
@@ -982,9 +836,8 @@ static int tlan_init(struct net_device *dev)
982 (u8) priv->adapter->addr_ofs + i, 836 (u8) priv->adapter->addr_ofs + i,
983 (u8 *) &dev->dev_addr[i]); 837 (u8 *) &dev->dev_addr[i]);
984 if (err) { 838 if (err) {
985 printk(KERN_ERR "TLAN: %s: Error reading MAC from eeprom: %d\n", 839 pr_err("%s: Error reading MAC from eeprom: %d\n",
986 dev->name, 840 dev->name, err);
987 err);
988 } 841 }
989 dev->addr_len = 6; 842 dev->addr_len = 6;
990 843
@@ -1028,8 +881,8 @@ static int tlan_open(struct net_device *dev)
1028 dev->name, dev); 881 dev->name, dev);
1029 882
1030 if (err) { 883 if (err) {
1031 pr_err("TLAN: Cannot open %s because IRQ %d is already in use.\n", 884 netdev_err(dev, "Cannot open because IRQ %d is already in use\n",
1032 dev->name, dev->irq); 885 dev->irq);
1033 return err; 886 return err;
1034 } 887 }
1035 888
@@ -1512,8 +1365,8 @@ static u32 tlan_handle_tx_eof(struct net_device *dev, u16 host_int)
1512 } 1365 }
1513 1366
1514 if (!ack) 1367 if (!ack)
1515 printk(KERN_INFO 1368 netdev_info(dev,
1516 "TLAN: Received interrupt for uncompleted TX frame.\n"); 1369 "Received interrupt for uncompleted TX frame\n");
1517 1370
1518 if (eoc) { 1371 if (eoc) {
1519 TLAN_DBG(TLAN_DEBUG_TX, 1372 TLAN_DBG(TLAN_DEBUG_TX,
@@ -1667,8 +1520,8 @@ drop_and_reuse:
1667 } 1520 }
1668 1521
1669 if (!ack) 1522 if (!ack)
1670 printk(KERN_INFO 1523 netdev_info(dev,
1671 "TLAN: Received interrupt for uncompleted RX frame.\n"); 1524 "Received interrupt for uncompleted RX frame\n");
1672 1525
1673 1526
1674 if (eoc) { 1527 if (eoc) {
@@ -1724,7 +1577,7 @@ drop_and_reuse:
1724 1577
1725static u32 tlan_handle_dummy(struct net_device *dev, u16 host_int) 1578static u32 tlan_handle_dummy(struct net_device *dev, u16 host_int)
1726{ 1579{
1727 pr_info("TLAN: Test interrupt on %s.\n", dev->name); 1580 netdev_info(dev, "Test interrupt\n");
1728 return 1; 1581 return 1;
1729 1582
1730} 1583}
@@ -1818,7 +1671,7 @@ static u32 tlan_handle_status_check(struct net_device *dev, u16 host_int)
1818 if (host_int & TLAN_HI_IV_MASK) { 1671 if (host_int & TLAN_HI_IV_MASK) {
1819 netif_stop_queue(dev); 1672 netif_stop_queue(dev);
1820 error = inl(dev->base_addr + TLAN_CH_PARM); 1673 error = inl(dev->base_addr + TLAN_CH_PARM);
1821 pr_info("TLAN: %s: Adaptor Error = 0x%x\n", dev->name, error); 1674 netdev_info(dev, "Adaptor Error = 0x%x\n", error);
1822 tlan_read_and_clear_stats(dev, TLAN_RECORD); 1675 tlan_read_and_clear_stats(dev, TLAN_RECORD);
1823 outl(TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD); 1676 outl(TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD);
1824 1677
@@ -2059,7 +1912,7 @@ static void tlan_reset_lists(struct net_device *dev)
2059 list->buffer[0].count = TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER; 1912 list->buffer[0].count = TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER;
2060 skb = netdev_alloc_skb_ip_align(dev, TLAN_MAX_FRAME_SIZE + 5); 1913 skb = netdev_alloc_skb_ip_align(dev, TLAN_MAX_FRAME_SIZE + 5);
2061 if (!skb) { 1914 if (!skb) {
2062 pr_err("TLAN: out of memory for received data.\n"); 1915 netdev_err(dev, "Out of memory for received data\n");
2063 break; 1916 break;
2064 } 1917 }
2065 1918
@@ -2143,13 +1996,13 @@ static void tlan_print_dio(u16 io_base)
2143 u32 data0, data1; 1996 u32 data0, data1;
2144 int i; 1997 int i;
2145 1998
2146 pr_info("TLAN: Contents of internal registers for io base 0x%04hx.\n", 1999 pr_info("Contents of internal registers for io base 0x%04hx\n",
2147 io_base); 2000 io_base);
2148 pr_info("TLAN: Off. +0 +4\n"); 2001 pr_info("Off. +0 +4\n");
2149 for (i = 0; i < 0x4C; i += 8) { 2002 for (i = 0; i < 0x4C; i += 8) {
2150 data0 = tlan_dio_read32(io_base, i); 2003 data0 = tlan_dio_read32(io_base, i);
2151 data1 = tlan_dio_read32(io_base, i + 0x4); 2004 data1 = tlan_dio_read32(io_base, i + 0x4);
2152 pr_info("TLAN: 0x%02x 0x%08x 0x%08x\n", i, data0, data1); 2005 pr_info("0x%02x 0x%08x 0x%08x\n", i, data0, data1);
2153 } 2006 }
2154 2007
2155} 2008}
@@ -2178,14 +2031,14 @@ static void tlan_print_list(struct tlan_list *list, char *type, int num)
2178{ 2031{
2179 int i; 2032 int i;
2180 2033
2181 pr_info("TLAN: %s List %d at %p\n", type, num, list); 2034 pr_info("%s List %d at %p\n", type, num, list);
2182 pr_info("TLAN: Forward = 0x%08x\n", list->forward); 2035 pr_info(" Forward = 0x%08x\n", list->forward);
2183 pr_info("TLAN: CSTAT = 0x%04hx\n", list->c_stat); 2036 pr_info(" CSTAT = 0x%04hx\n", list->c_stat);
2184 pr_info("TLAN: Frame Size = 0x%04hx\n", list->frame_size); 2037 pr_info(" Frame Size = 0x%04hx\n", list->frame_size);
2185 /* for (i = 0; i < 10; i++) { */ 2038 /* for (i = 0; i < 10; i++) { */
2186 for (i = 0; i < 2; i++) { 2039 for (i = 0; i < 2; i++) {
2187 pr_info("TLAN: Buffer[%d].count, addr = 0x%08x, 0x%08x\n", 2040 pr_info(" Buffer[%d].count, addr = 0x%08x, 0x%08x\n",
2188 i, list->buffer[i].count, list->buffer[i].address); 2041 i, list->buffer[i].count, list->buffer[i].address);
2189 } 2042 }
2190 2043
2191} 2044}
@@ -2400,7 +2253,7 @@ tlan_finish_reset(struct net_device *dev)
2400 if ((priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) || 2253 if ((priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) ||
2401 (priv->aui)) { 2254 (priv->aui)) {
2402 status = MII_GS_LINK; 2255 status = MII_GS_LINK;
2403 pr_info("TLAN: %s: Link forced.\n", dev->name); 2256 netdev_info(dev, "Link forced\n");
2404 } else { 2257 } else {
2405 tlan_mii_read_reg(dev, phy, MII_GEN_STS, &status); 2258 tlan_mii_read_reg(dev, phy, MII_GEN_STS, &status);
2406 udelay(1000); 2259 udelay(1000);
@@ -2412,24 +2265,21 @@ tlan_finish_reset(struct net_device *dev)
2412 tlan_mii_read_reg(dev, phy, MII_AN_LPA, &partner); 2265 tlan_mii_read_reg(dev, phy, MII_AN_LPA, &partner);
2413 tlan_mii_read_reg(dev, phy, TLAN_TLPHY_PAR, &tlphy_par); 2266 tlan_mii_read_reg(dev, phy, TLAN_TLPHY_PAR, &tlphy_par);
2414 2267
2415 pr_info("TLAN: %s: Link active with ", dev->name); 2268 netdev_info(dev,
2416 if (!(tlphy_par & TLAN_PHY_AN_EN_STAT)) { 2269 "Link active with %s %uMbps %s-Duplex\n",
2417 pr_info("forced 10%sMbps %s-Duplex\n", 2270 !(tlphy_par & TLAN_PHY_AN_EN_STAT)
2418 tlphy_par & TLAN_PHY_SPEED_100 2271 ? "forced" : "Autonegotiation enabled,",
2419 ? "" : "0", 2272 tlphy_par & TLAN_PHY_SPEED_100
2420 tlphy_par & TLAN_PHY_DUPLEX_FULL 2273 ? 100 : 10,
2421 ? "Full" : "Half"); 2274 tlphy_par & TLAN_PHY_DUPLEX_FULL
2422 } else { 2275 ? "Full" : "Half");
2423 pr_info("Autonegotiation enabled, at 10%sMbps %s-Duplex\n", 2276
2424 tlphy_par & TLAN_PHY_SPEED_100 2277 if (tlphy_par & TLAN_PHY_AN_EN_STAT) {
2425 ? "" : "0", 2278 netdev_info(dev, "Partner capability:");
2426 tlphy_par & TLAN_PHY_DUPLEX_FULL 2279 for (i = 5; i < 10; i++)
2427 ? "Full" : "half"); 2280 if (partner & (1 << i))
2428 pr_info("TLAN: Partner capability: "); 2281 pr_cont(" %s", media[i-5]);
2429 for (i = 5; i <= 10; i++) 2282 pr_cont("\n");
2430 if (partner & (1<<i))
2431 printk("%s", media[i-5]);
2432 printk("\n");
2433 } 2283 }
2434 2284
2435 tlan_dio_write8(dev->base_addr, TLAN_LED_REG, 2285 tlan_dio_write8(dev->base_addr, TLAN_LED_REG,
@@ -2441,7 +2291,7 @@ tlan_finish_reset(struct net_device *dev)
2441 tlan_set_timer(dev, (10*HZ), TLAN_TIMER_LINK_BEAT); 2291 tlan_set_timer(dev, (10*HZ), TLAN_TIMER_LINK_BEAT);
2442#endif 2292#endif
2443 } else if (status & MII_GS_LINK) { 2293 } else if (status & MII_GS_LINK) {
2444 pr_info("TLAN: %s: Link active\n", dev->name); 2294 netdev_info(dev, "Link active\n");
2445 tlan_dio_write8(dev->base_addr, TLAN_LED_REG, 2295 tlan_dio_write8(dev->base_addr, TLAN_LED_REG,
2446 TLAN_LED_LINK); 2296 TLAN_LED_LINK);
2447 } 2297 }
@@ -2467,8 +2317,7 @@ tlan_finish_reset(struct net_device *dev)
2467 outl(TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD); 2317 outl(TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD);
2468 netif_carrier_on(dev); 2318 netif_carrier_on(dev);
2469 } else { 2319 } else {
2470 pr_info("TLAN: %s: Link inactive, will retry in 10 secs...\n", 2320 netdev_info(dev, "Link inactive, will retry in 10 secs...\n");
2471 dev->name);
2472 tlan_set_timer(dev, (10*HZ), TLAN_TIMER_FINISH_RESET); 2321 tlan_set_timer(dev, (10*HZ), TLAN_TIMER_FINISH_RESET);
2473 return; 2322 return;
2474 } 2323 }
@@ -2552,23 +2401,20 @@ static void tlan_phy_print(struct net_device *dev)
2552 phy = priv->phy[priv->phy_num]; 2401 phy = priv->phy[priv->phy_num];
2553 2402
2554 if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) { 2403 if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) {
2555 pr_info("TLAN: Device %s, Unmanaged PHY.\n", dev->name); 2404 netdev_info(dev, "Unmanaged PHY\n");
2556 } else if (phy <= TLAN_PHY_MAX_ADDR) { 2405 } else if (phy <= TLAN_PHY_MAX_ADDR) {
2557 pr_info("TLAN: Device %s, PHY 0x%02x.\n", dev->name, phy); 2406 netdev_info(dev, "PHY 0x%02x\n", phy);
2558 pr_info("TLAN: Off. +0 +1 +2 +3\n"); 2407 pr_info(" Off. +0 +1 +2 +3\n");
2559 for (i = 0; i < 0x20; i += 4) { 2408 for (i = 0; i < 0x20; i += 4) {
2560 pr_info("TLAN: 0x%02x", i);
2561 tlan_mii_read_reg(dev, phy, i, &data0); 2409 tlan_mii_read_reg(dev, phy, i, &data0);
2562 printk(" 0x%04hx", data0);
2563 tlan_mii_read_reg(dev, phy, i + 1, &data1); 2410 tlan_mii_read_reg(dev, phy, i + 1, &data1);
2564 printk(" 0x%04hx", data1);
2565 tlan_mii_read_reg(dev, phy, i + 2, &data2); 2411 tlan_mii_read_reg(dev, phy, i + 2, &data2);
2566 printk(" 0x%04hx", data2);
2567 tlan_mii_read_reg(dev, phy, i + 3, &data3); 2412 tlan_mii_read_reg(dev, phy, i + 3, &data3);
2568 printk(" 0x%04hx\n", data3); 2413 pr_info(" 0x%02x 0x%04hx 0x%04hx 0x%04hx 0x%04hx\n",
2414 i, data0, data1, data2, data3);
2569 } 2415 }
2570 } else { 2416 } else {
2571 pr_info("TLAN: Device %s, Invalid PHY.\n", dev->name); 2417 netdev_info(dev, "Invalid PHY\n");
2572 } 2418 }
2573 2419
2574} 2420}
@@ -2635,7 +2481,7 @@ static void tlan_phy_detect(struct net_device *dev)
2635 else if (priv->phy[0] != TLAN_PHY_NONE) 2481 else if (priv->phy[0] != TLAN_PHY_NONE)
2636 priv->phy_num = 0; 2482 priv->phy_num = 0;
2637 else 2483 else
2638 pr_info("TLAN: Cannot initialize device, no PHY was found!\n"); 2484 netdev_info(dev, "Cannot initialize device, no PHY was found!\n");
2639 2485
2640} 2486}
2641 2487
@@ -2763,8 +2609,7 @@ static void tlan_phy_start_link(struct net_device *dev)
2763 * but the card need additional time to start AN. 2609 * but the card need additional time to start AN.
2764 * .5 sec should be plenty extra. 2610 * .5 sec should be plenty extra.
2765 */ 2611 */
2766 pr_info("TLAN: %s: Starting autonegotiation.\n", 2612 netdev_info(dev, "Starting autonegotiation\n");
2767 dev->name);
2768 tlan_set_timer(dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN); 2613 tlan_set_timer(dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN);
2769 return; 2614 return;
2770 } 2615 }
@@ -2827,16 +2672,16 @@ static void tlan_phy_finish_auto_neg(struct net_device *dev)
2827 * more time. Perhaps we should fail after a while. 2672 * more time. Perhaps we should fail after a while.
2828 */ 2673 */
2829 if (!priv->neg_be_verbose++) { 2674 if (!priv->neg_be_verbose++) {
2830 pr_info("TLAN: Giving autonegotiation more time.\n"); 2675 pr_info("Giving autonegotiation more time.\n");
2831 pr_info("TLAN: Please check that your adapter has\n"); 2676 pr_info("Please check that your adapter has\n");
2832 pr_info("TLAN: been properly connected to a HUB or Switch.\n"); 2677 pr_info("been properly connected to a HUB or Switch.\n");
2833 pr_info("TLAN: Trying to establish link in the background...\n"); 2678 pr_info("Trying to establish link in the background...\n");
2834 } 2679 }
2835 tlan_set_timer(dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN); 2680 tlan_set_timer(dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN);
2836 return; 2681 return;
2837 } 2682 }
2838 2683
2839 pr_info("TLAN: %s: Autonegotiation complete.\n", dev->name); 2684 netdev_info(dev, "Autonegotiation complete\n");
2840 tlan_mii_read_reg(dev, phy, MII_AN_ADV, &an_adv); 2685 tlan_mii_read_reg(dev, phy, MII_AN_ADV, &an_adv);
2841 tlan_mii_read_reg(dev, phy, MII_AN_LPA, &an_lpa); 2686 tlan_mii_read_reg(dev, phy, MII_AN_LPA, &an_lpa);
2842 mode = an_adv & an_lpa & 0x03E0; 2687 mode = an_adv & an_lpa & 0x03E0;
@@ -2861,11 +2706,11 @@ static void tlan_phy_finish_auto_neg(struct net_device *dev)
2861 (an_adv & an_lpa & 0x0040)) { 2706 (an_adv & an_lpa & 0x0040)) {
2862 tlan_mii_write_reg(dev, phy, MII_GEN_CTL, 2707 tlan_mii_write_reg(dev, phy, MII_GEN_CTL,
2863 MII_GC_AUTOENB | MII_GC_DUPLEX); 2708 MII_GC_AUTOENB | MII_GC_DUPLEX);
2864 pr_info("TLAN: Starting internal PHY with FULL-DUPLEX\n"); 2709 netdev_info(dev, "Starting internal PHY with FULL-DUPLEX\n");
2865 } else { 2710 } else {
2866 tlan_mii_write_reg(dev, phy, MII_GEN_CTL, 2711 tlan_mii_write_reg(dev, phy, MII_GEN_CTL,
2867 MII_GC_AUTOENB); 2712 MII_GC_AUTOENB);
2868 pr_info("TLAN: Starting internal PHY with HALF-DUPLEX\n"); 2713 netdev_info(dev, "Starting internal PHY with HALF-DUPLEX\n");
2869 } 2714 }
2870 } 2715 }
2871 2716