From: James S. <jsi...@us...> - 2001-10-19 22:55:14
|
Update of /cvsroot/linux-mips/linux/drivers/net/tulip In directory usw-pr-cvs1:/tmp/cvs-serv7255 Added Files: Tag: current 21142.c 21142.o ChangeLog Makefile eeprom.o interrupt.o media.o pnic.c pnic.o timer.c timer.o tulip.o tulip_core.o Log Message: Backed it to a earlier version of the driver that worked. I will hunt down the bug and fix it. --- NEW FILE: 21142.c --- /* drivers/net/tulip/21142.c Maintained by Jeff Garzik <jg...@ma...> Copyright 2000,2001 The Linux Kernel Team Written/copyright 1994-2001 by Donald Becker. This software may be used and distributed according to the terms of the GNU General Public License, incorporated herein by reference. Please refer to Documentation/DocBook/tulip.{pdf,ps,html} for more information on this driver, or visit the project Web page at http://sourceforge.net/projects/tulip/ */ #include "tulip.h" #include <linux/pci.h> #include <linux/delay.h> static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, }; u16 t21142_csr14[] = { 0xFFFF, 0x0705, 0x0705, 0x0000, 0x7F3D, }; static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; /* Handle the 21143 uniquely: do autoselect with NWay, not the EEPROM list of available transceivers. */ void t21142_timer(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int csr12 = inl(ioaddr + CSR12); int next_tick = 60*HZ; int new_csr6 = 0; if (tulip_debug > 2) printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n", dev->name, csr12, medianame[dev->if_port]); if (tulip_media_cap[dev->if_port] & MediaIsMII) { tulip_check_duplex(dev); next_tick = 60*HZ; } else if (tp->nwayset) { /* Don't screw up a negotiated session! */ if (tulip_debug > 1) printk(KERN_INFO"%s: Using NWay-set %s media, csr12 %8.8x.\n", dev->name, medianame[dev->if_port], csr12); } else if (tp->medialock) { ; } else if (dev->if_port == 3) { if (csr12 & 2) { /* No 100mbps link beat, revert to 10mbps. */ if (tulip_debug > 1) printk(KERN_INFO"%s: No 21143 100baseTx link beat, %8.8x, " "trying NWay.\n", dev->name, csr12); t21142_start_nway(dev); next_tick = 3*HZ; } } else if ((csr12 & 0x7000) != 0x5000) { /* Negotiation failed. Search media types. */ if (tulip_debug > 1) printk(KERN_INFO"%s: 21143 negotiation failed, status %8.8x.\n", dev->name, csr12); if (!(csr12 & 4)) { /* 10mbps link beat good. */ new_csr6 = 0x82420000; dev->if_port = 0; outl(0, ioaddr + CSR13); outl(0x0003FFFF, ioaddr + CSR14); outw(t21142_csr15[dev->if_port], ioaddr + CSR15); outl(t21142_csr13[dev->if_port], ioaddr + CSR13); } else { /* Select 100mbps port to check for link beat. */ new_csr6 = 0x83860000; dev->if_port = 3; outl(0, ioaddr + CSR13); outl(0x0003FF7F, ioaddr + CSR14); outw(8, ioaddr + CSR15); outl(1, ioaddr + CSR13); } if (tulip_debug > 1) printk(KERN_INFO"%s: Testing new 21143 media %s.\n", dev->name, medianame[dev->if_port]); if (new_csr6 != (tp->csr6 & ~0x00D5)) { tp->csr6 &= 0x00D5; tp->csr6 |= new_csr6; outl(0x0301, ioaddr + CSR12); tulip_restart_rxtx(tp); } next_tick = 3*HZ; } /* mod_timer synchronizes us with potential add_timer calls * from interrupts. */ mod_timer(&tp->timer, RUN_AT(next_tick)); } void t21142_start_nway(struct net_device *dev) { struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int csr14 = ((tp->sym_advertise & 0x0780) << 9) | ((tp->sym_advertise & 0x0020) << 1) | 0xffbf; dev->if_port = 0; tp->nway = tp->mediasense = 1; tp->nwayset = tp->lpar = 0; if (tp->chip_id == PNIC2) { tp->csr6 = 0x01000000 | (tp->sym_advertise & 0x0040 ? FullDuplex : 0); return; } if (tulip_debug > 1) printk(KERN_DEBUG "%s: Restarting 21143 autonegotiation, csr14=%8.8x.\n", dev->name, csr14); outl(0x0001, ioaddr + CSR13); udelay(100); outl(csr14, ioaddr + CSR14); tp->csr6 = 0x82420000 | (tp->sym_advertise & 0x0040 ? FullDuplex : 0); outl(tp->csr6, ioaddr + CSR6); if (tp->mtable && tp->mtable->csr15dir) { outl(tp->mtable->csr15dir, ioaddr + CSR15); outl(tp->mtable->csr15val, ioaddr + CSR15); } else outw(0x0008, ioaddr + CSR15); outl(0x1301, ioaddr + CSR12); /* Trigger NWAY. */ } void pnic2_lnk_change(struct net_device *dev, int csr5) { struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int csr12 = inl(ioaddr + CSR12); if (tulip_debug > 1) printk(KERN_INFO"%s: PNIC-2 link status changed, CSR5/12/14 %8.8x" " %8.8x, %8.8x.\n", dev->name, csr12, csr5, (int)inl(ioaddr + CSR14)); dev->if_port = 5; tp->lpar = csr12 >> 16; tp->nwayset = 1; tp->csr6 = 0x01000000 | (tp->csr6 & 0xffff); outl(tp->csr6, ioaddr + CSR6); } void t21142_lnk_change(struct net_device *dev, int csr5) { struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int csr12 = inl(ioaddr + CSR12); if (tulip_debug > 1) printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, " "%8.8x.\n", dev->name, csr12, csr5, inl(ioaddr + CSR14)); /* If NWay finished and we have a negotiated partner capability. */ if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) { int setup_done = 0; int negotiated = tp->sym_advertise & (csr12 >> 16); tp->lpar = csr12 >> 16; tp->nwayset = 1; if (negotiated & 0x0100) dev->if_port = 5; else if (negotiated & 0x0080) dev->if_port = 3; else if (negotiated & 0x0040) dev->if_port = 4; else if (negotiated & 0x0020) dev->if_port = 0; else { tp->nwayset = 0; if ((csr12 & 2) == 0 && (tp->sym_advertise & 0x0180)) dev->if_port = 3; } tp->full_duplex = (tulip_media_cap[dev->if_port] & MediaAlwaysFD) ? 1:0; if (tulip_debug > 1) { if (tp->nwayset) printk(KERN_INFO "%s: Switching to %s based on link " "negotiation %4.4x & %4.4x = %4.4x.\n", dev->name, medianame[dev->if_port], tp->sym_advertise, tp->lpar, negotiated); else printk(KERN_INFO "%s: Autonegotiation failed, using %s," " link beat status %4.4x.\n", dev->name, medianame[dev->if_port], csr12); } if (tp->mtable) { int i; for (i = 0; i < tp->mtable->leafcount; i++) if (tp->mtable->mleaf[i].media == dev->if_port) { tp->cur_index = i; tulip_select_media(dev, 1); setup_done = 1; break; } } if ( ! setup_done) { tp->csr6 = (dev->if_port & 1 ? 0x838E0000 : 0x82420000) | (tp->csr6 & 0x20ff); if (tp->full_duplex) tp->csr6 |= 0x0200; outl(1, ioaddr + CSR13); } #if 0 /* Restart shouldn't be needed. */ outl(tp->csr6 | RxOn, ioaddr + CSR6); if (tulip_debug > 2) printk(KERN_DEBUG "%s: Restarting Tx and Rx, CSR5 is %8.8x.\n", dev->name, inl(ioaddr + CSR5)); #endif tulip_start_rxtx(tp); if (tulip_debug > 2) printk(KERN_DEBUG "%s: Setting CSR6 %8.8x/%x CSR12 %8.8x.\n", dev->name, tp->csr6, inl(ioaddr + CSR6), inl(ioaddr + CSR12)); } else if ((tp->nwayset && (csr5 & 0x08000000) && (dev->if_port == 3 || dev->if_port == 5) && (csr12 & 2) == 2) || (tp->nway && (csr5 & (TPLnkFail)))) { /* Link blew? Maybe restart NWay. */ del_timer_sync(&tp->timer); t21142_start_nway(dev); tp->timer.expires = RUN_AT(3*HZ); add_timer(&tp->timer); } else if (dev->if_port == 3 || dev->if_port == 5) { if (tulip_debug > 1) printk(KERN_INFO"%s: 21143 %s link beat %s.\n", dev->name, medianame[dev->if_port], (csr12 & 2) ? "failed" : "good"); if ((csr12 & 2) && ! tp->medialock) { del_timer_sync(&tp->timer); t21142_start_nway(dev); tp->timer.expires = RUN_AT(3*HZ); add_timer(&tp->timer); } else if (dev->if_port == 5) outl(inl(ioaddr + CSR14) & ~0x080, ioaddr + CSR14); } else if (dev->if_port == 0 || dev->if_port == 4) { if ((csr12 & 4) == 0) printk(KERN_INFO"%s: 21143 10baseT link beat good.\n", dev->name); } else if (!(csr12 & 4)) { /* 10mbps link beat good. */ if (tulip_debug) printk(KERN_INFO"%s: 21143 10mbps sensed media.\n", dev->name); dev->if_port = 0; } else if (tp->nwayset) { if (tulip_debug) printk(KERN_INFO"%s: 21143 using NWay-set %s, csr6 %8.8x.\n", dev->name, medianame[dev->if_port], tp->csr6); } else { /* 100mbps link beat good. */ if (tulip_debug) printk(KERN_INFO"%s: 21143 100baseTx sensed media.\n", dev->name); dev->if_port = 3; tp->csr6 = 0x838E0000 | (tp->csr6 & 0x20ff); outl(0x0003FF7F, ioaddr + CSR14); outl(0x0301, ioaddr + CSR12); tulip_restart_rxtx(tp); } } --- NEW FILE: 21142.o --- ELF --- NEW FILE: ChangeLog --- 2001-07-17 Erik A. Hendriks <hen...@la...> * 21142.c: Merge fix from tulip.c 0.92w which prevents the overwriting of csr6 bits we want to preserve. 2001-07-10 Jeff Golds <jg...@re...> * tulip_core.c: Fix two comments 2001-07-06 Stephen Degler <sd...@de...> * media.c: The media selection process at the end of NWAY is busted because for the case of MII/SYM it needs to be: csr13 <- 0 csr14 <- 0 csr6 <- the value calculated is okay. In the other media cases csr14 is computed by t21142_csr14val[dev->if_port], which seems ok. The value of zero as opposed to 3FFFFF comes straight from appendix D of the 21143 data book, and it makes logical sense because you're bypassing all the SIA interface when you usa MII or SYM (see figure 1-1 in the data book if your're visually oriented) 2001-07-03 Jeff Golds <jg...@re...> * tulip_core.c (tulip_clean_tx_ring): Clear status for in-progress Tx's, and count Tx errors for all packets being released. 2001-06-16 Jeff Garzik <jg...@ma...> * tulip.h, tulip_core.c: Integrate MMIO support from devel branch, but default it to off for stable kernel and driver series. 2001-06-16 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_init_one): Free descriptor rings on error. 2001-06-16 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_mwi_config, tulip_init_one): Large update to csr0 bus configuration code. This is not stable yet, so it is only conditionally enabled, via CONFIG_TULIP_MWI. 2001-06-16 Jeff Garzik <jg...@ma...> * tulip_core.c: Initialize timer in tulip_init_one and tulip_down, not in tulip_up. 2001-06-14 Jeff Garzik <jg...@ma...> * tulip_core.c: - Update tulip_suspend, tulip_resume for new PCI PM API. - Surround suspend/resume code with CONFIG_PM. 2001-06-12 Jeff Golds <jg...@re...> * tulip_core.c: - Reset sw ring ptrs in tulip_up. Fixes PM resume case. - Clean rx and tx rings on device down. 2001-06-05 David Miller <da...@re...> * tulip_core (set_rx_mode): Do not use set_bit on an integer variable. Also fix endianness issue. 2001-06-04 Jeff Garzik <jg...@ma...> * interrupt.c: Simplify rx processing when CONFIG_NET_HW_FLOWCONTROL is active, and in the process fix a bug where flow control and low load caused rx not to be acknowledged properly. 2001-06-01 Jeff Garzik <jg...@ma...> * tulip.h: - Remove tulip_outl_csr helper, redundant. - Add tulip_start_rxtx inline helper. - tulip_stop_rxtx helper: Add synchronization. Always use current csr6 value, instead of tp->csr6 value or value passed as arg. - tulip_restart_rxtx helper: Add synchronization. Always use tp->csr6 for desired mode, not value passed as arg. - New RxOn, TxOn, RxTx constants for csr6 modes. - Remove now-redundant constants csr6_st, csr6_sr. * 21142.c, interrupt.c, media.c, pnic.c, tulip_core.c: Update for above rxtx helper changes. * interrupt.c: - whitespace cleanup around #ifdef CONFIG_NET_HW_FLOWCONTROL, convert tabs to spaces. - Move tp->stats.rx_missed_errors update outside the ifdef. 2001-05-18 Jeff Garzik <jg...@ma...> * tulip_core.c: Added ethtool support. ETHTOOL_GDRVINFO ioctl only, for now. 2001-05-14 Robert Olsson <Rob...@da...> * Restored HW_FLOWCONTROL from Linux 2.1 series tulip (ANK) plus Jamal's NETIF_RX_* feedback control. 2001-05-14 Robert Olsson <Rob...@da...> * Added support for 21143's Interrupt Mitigation. Jamal original instigator. 2001-05-14 Robert Olsson <Rob...@da...> * tulip_refill_rx prototype added to tulip.h 2001-05-13 Jeff Garzik <jg...@ma...> * tulip_core.c: Remove HAS_PCI_MWI flag from Comet, untested. 2001-05-12 Jeff Garzik <jg...@ma...> * tulip_core.c, tulip.h: Remove Conexant PCI id, no chip docs are available to fix problems with support. 2001-05-12 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_init_one): Do not call unregister_netdev in error cleanup. Remnant of old usage of init_etherdev. 2001-05-12 Jeff Garzik <jg...@ma...> * media.c (tulip_find_mii): Simple write the updated BMCR twice, as it seems the best thing to do for both broken and sane chips. If the mii_advert value, as read from MII_ADVERTISE, is zero, then generate a value we should advertise from the capability bits in BMSR. Fill in tp->advertising for all cases. Just to be safe, clear all unwanted bits. 2001-05-12 Jeff Garzik <jg...@ma...> * tulip_core.c (private_ioctl): Fill in tp->advertising when advertising value is changed by the user. 2001-05-12 Jeff Garzik <jg...@ma...> * tulip_core.c: Mark Comet chips as needed the updated MWI csr0 configuration. 2001-05-12 Jeff Garzik <jg...@ma...> * media.c, tulip_core.c: Move MII scan into from inlined inside tulip_init_one to new function tulip_find_mii in media.c. 2001-05-12 Jeff Garzik <jg...@ma...> * media.c (tulip_check_duplex): Only restart Rx/Tx engines if they are active (and csr6 changes) 2001-05-12 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_mwi_config): Clamp values read from PCI cache line size register to values acceptable to tulip chip. Done for safety and -almost- certainly unneeded. 2001-05-11 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_init_one): Instead of unconditionally enabling autonegotiation, disable autonegotiation if not using the default port. Further, flip the nway bit immediately, and then update the speed/duplex in a separate MII transaction. We do this because some boards require that nway be disabled separately, before media selection is forced. TODO: Investigate if we can simply write the same value to BMCR twice, to avoid setting unnecessarily changing phy settings. 2001-05-11 Jeff Garzik <jg...@ma...> * tulip.h, tulip_core.c: If HAS_PCI_MWI is set for a given chip, adjust the csr0 values not according to provided values but according to system cache line size. Currently cache alignment is matched as closely to cache line size as possible. Currently programmable burst limit is set (ie. never unlimited), and always equal to cache alignment and system cache size. Currently MWI bit is set only if the MWI bit is present in the PCI command register. 2001-05-11 Jeff Garzik <jg...@ma...> * media.c (tulip_select_media): For media types 1 and 3, only use the provided eeprom advertising value if it is non-zero. (tulip_check_duplex): Do not exit ASAP if full_duplex_lock is set. This ensures that the csr6 value is written if an update is needed. 2001-05-10 Jeff Garzik <jg...@ma...> Merge PNIC-II-specific stuff from Becker's tulip.c: * tulip.h, 21142.c (pnic2_lnk_change): new function * tulip_core.c (tulip_init_one): use it * tulip_core.c (tulip_tx_timeout): Add specific debugging for PNIC2. 2001-05-10 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_init_one): Print out tulip%d instead of PCI device number, for consistency. 2001-05-10 Jeff Garzik <jg...@ma...> * Merge changes from Becker's tulip.c: Fix bugs in ioctl. Fix several bugs by distinguishing between MII and SYM advertising values. Set CSR14 autonegotiation bit for media types 2 and 4, where the SIA CSR setup values are not provided. 2001-05-10 Jeff Garzik <jg...@ma...> * media.c (tulip_select_media): Only update MII advertising value if startup arg < 2. * tulip.h: Do not enable CSR13/14/15 autoconfiguration for 21041. * tulip_core.c: 21041: add specific code for reset, and do not set CAC bit When resetting media, for media table type 11 media, pass value 2 as 'startup' arg to select_media, to avoid updating MII advertising value. 2001-05-10 Jeff Garzik <jg...@ma...> * pnic.c (pnic_check_duplex): remove pnic.c (pnic_lnk_change, pnic_timer): use tulip_check_duplex not pnic_check_duplex. * media.c (tulip_check_duplex): Clean up to use symbolic names instead of numeric constants. Set TxThreshold mode as necessary as well as clearing it. Update csr6 if csr6 changes, not simply if duplex changes. (found by Manfred Spraul) 2001-05-10 Jeff Garzik <jg...@ma...> * 21142.c, eeprom.c, tulip.h, tulip_core.c: Remove DPRINTK as another, better method of debug message printing is available. 2001-05-09 Jeff Garzik <jg...@ma...> * 21142.c (t21142_lnk_change): Pass arg startup==1 to tulip_select_media, in order to force csr13 to be zeroed out prior to going to full duplex mode. Fixes autonegotiation on a quad-port Znyx card. (from Stephen Dengler) 2001-05-09 Russell King <rm...@ar...> * interrupt.c: Better PCI bus error reporting. 2001-04-03 Jeff Garzik <jg...@ma...> * tulip_core.c: Now that dev->name is only available late in the probe, insert a hack to replace a not-evaluated "eth%d" string with an evaluated "tulip%d" string. Also, remove obvious comment and an indentation cleanup. 2001-04-03 Jeff Garzik <jg...@ma...> * tulip_core.c: If we are a module, always print out the version string. If we are built into the kernel, only print the version string if at least one tulip is detected. 2001-04-03 Jeff Garzik <jg...@ma...> Merged from Becker's tulip.c 0.92t: * tulip_core.c: Add support for Conexant LANfinity. 2001-04-03 Jeff Garzik <jg...@ma...> * tulip_core.c: Only suspend/resume if the interface is up and running. Use alloc_etherdev and pci_request_regions. Spelling fix. 2001-04-03 Jeff Garzik <jg...@ma...> * tulip_core.c: Remove code that existed when one or more of the following defines existed. These defines were never used by normal users in practice: TULIP_FULL_DUPLEX, TULIP_DEFAULT_MEDIA, and TULIP_NO_MEDIA_SWITCH. * tulip.h, eeprom.c: Move EE_* constants from tulip.h to eeprom.c. * tulip.h, media.c: Move MDIO_* constants from tulip.h to media.c. * media.c: Add barrier() to mdio_read/write's PNIC status check loops. 2001-04-03 Jeff Garzik <jg...@ma...> Merged from Becker's tulip.c 0.92t: * tulip.h: Add MEDIA_MASK constant for bounding medianame[] array lookups. * eeprom.c, media.c, timer.c, tulip_core.c: Use it. * media.c, tulip_core.c: mdio_{read,write} cleanup. Since this is called [pretty much] directly from ioctl, we mask read/write arguments to limit the values passed. Added mii_lock. Added comet_miireg2offset and better Comet-specific mdio_read/write code. Pay closer attention to the bits we set in ioctl. Remove spinlocks from ioctl, they are in mdio_read/write now. Use mask to limit phy number in tulip_init_one's MII scan. 2001-04-03 Jeff Garzik <jg...@ma...> Merged from Becker's tulip.c 0.92t: * 21142.c, tulip_core.c: PNIC2 MAC address and NWay fixes. * tulip.h: Add FullDuplex constant, used in above change. 2001-04-03 Jeff Garzik <jg...@ma...> * timer.c: Do not call netif_carrier_{on,off}, it is not used in the main tree. Leave code in, disabled, as markers for future carrier notification. 2001-04-03 Jeff Garzik <jg...@ma...> Merged from Becker's tulip.c 0.92t, except for the tulip.h whitespace cleanup: * interrupt.c: If Rx stops, make sure to update the multicast filter before restarting. * tulip.h: Add COMET_MAC_ADDR feature flag, clean up flags. Add Accept* Rx mode bit constants. Add mc_filter[] to driver private struct. * tulip_core.c: Add new Comet PCI id 0x1113:0x9511. Add COMET_MAC_ADDR feature flag to comet entry in board info array. Prefer to test COMET_MAC_ADDR flag to testing chip_id for COMET, when dealing with the Comet's MAC address. Enable Tx underrun recovery for Comet chips. Use new Accept* constants in set_rx_mode. Prefer COMET_MAC_ADDR flag test to chip_id test in set_rx_mode. Store built mc_filter for later use in intr handler by Comets. 2001-04-03 Jeff Garzik <jg...@ma...> * tulip_core.c: Use tp->cur_tx when building the setup frame, instead of assuming that the setup frame is always built in slot zero. This case is hit during PM resume. 2001-04-03 Jeff Garzik <jg...@ma...> * *.c: Update file headers (copyright, urls, etc.) * Makefile: re-order to that chip-specific modules on own line * eeprom.c: BSS/zero-init cleanup (Andrey Panin) * tulip_core.c: merge medianame[] update from tulip.c. Additional arch-specific rx_copybreak, csr0 values. (various) 2001-02-20 Jeff Garzik <jg...@ma...> * media.c (tulip_select_media): No need to initialize new_csr6, all cases initialize it properly. 2001-02-18 Manfred Spraul <ma...@co...> * interrupt.c (tulip_refill_rx): Make public. If PNIC chip stops due to lack of Rx buffers, restart it. (tulip_interrupt): PNIC doesn't have a h/w timer, emulate with software timers. * pnic.c (pnic_check_duplex): New function, PNIC-specific version of tulip_check_duplex. (pnic_lnk_change): Call pnic_check_duplex. If we use an external MII, then we mustn't use the internal negotiation. (pnic_timer): Support Rx refilling on work overflow in interrupt handler, as PNIC doesn't support a h/w timer. * tulip_core.c (tulip_tbl[]): Modify default csr6 2001-02-11 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_init_one): Call pci_enable_device to ensure wakeup/resource assignment before checking those values. (tulip_init_one): Replace PCI ids with constants from pci_id.h. (tulip_suspend, tulip_resume, tulip_remove_one): Call pci_power_on/off (commented out for now). 2001-02-10 Jeff Garzik <jg...@ma...> * tulip.h: Add CFDD_xxx bits for Tulip power management * tulip_core.c (tulip_set_power_state): New function, manipulating Tulip chip power state where supported. (tulip_up, tulip_down, tulip_init_one): Use it. 2001-02-10 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_tx_timeout): Call netif_wake_queue to ensure the next Tx is always sent to us. 2001-01-27 Jeff Garzik <jg...@ma...> * tulip_core.c (tulip_remove_one): Fix mem leak by freeing tp->media_tbl. Add check for !dev, reformat code appropriately. 2001-01-27 Jeff Garzik <jg...@ma...> * tulip_tbl[]: Comment all entries to make order and chip_id relationship more clear. * tulip_pci_tbl[]: Add new Accton PCI id (COMET chipset). 2001-01-16 Jeff Garzik <jg...@ma...> * tulip_core.c: static vars no longer explicitly initialized to zero. * eeprom.c (tulip_read_eeprom): Make sure to delay between EE_ENB and EE_ENB|EE_SHIFT_CLK. Merged from becker tulip.c. 2001-01-05 Peter De Schrijver <p2...@mi...> * eeprom.c (tulip_parse_eeprom): Interpret a bit more of 21142 extended format type 3 info blocks in a tulip SROM. 2001-01-03 Matti Aarnio <mat...@zm...> * media.c (tulip_select_media): Support media types 5 and 6 2001-??-?? ?? * tulip_core.c: Add comment about LanMedia needing a different driver. Enable workarounds for early PCI chipsets. Add IA64 csr0 support, update HPPA csr0 support. 2000-12-17 Alan Cox <al...@re...> * eeprom.c, timer.c, tulip.h, tulip_core.c: Merge support for the Davicom's quirks into the main tulip. Patch by Tobias Ringstrom 2000-11-08 Jim Studt <ji...@fe...> * eeprom.c (tulip_parse_eeprom): Check array bounds for medianame[] and block_name[] arrays to avoid oops due to bad values returned from hardware. 2000-11-02 Jeff Garzik <jg...@ma...> * tulip_core.c (set_rx_mode): This is synchronized via dev->xmit_lock, so only the queueing of the setup frame needs to be locked, against tulip_interrupt. 2000-11-02 Alexey Kuznetov <ku...@ms...> * timer.c (tulip_timer): Call netif_carrier_{on,off} to report link state to the rest of the kernel, and userspace. * interrupt.c (tulip_interrupt): Remove tx_full. * tulip.h: Likewise. * tulip_core.c (tulip_init_ring, tulip_start_xmit, set_rx_mode): Likewise. 2000-10-18 Jeff Garzik <jg...@ma...> * tulip_core.c: (tulip_init_one) Print out ethernet interface on error. Print out a message when pci_enable_device fails. Handle DMA alloc failure. 2000-10-18 Jeff Garzik <jg...@ma...> * Makefile: New file. * tulip_core.c (tulip_init_one): Correct error messages on PIO/MMIO region reserve failure. (tulip_init_one) Add new check to ensure that PIO region is sufficient for our needs. --- NEW FILE: Makefile --- # # Makefile for the Tulip ethernet driver # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # # Note 2! The CFLAGS definitions are now in the main makefile... O_TARGET := tulip.o obj-y := eeprom.o interrupt.o media.o \ timer.o tulip_core.o \ 21142.o pnic.o obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make --- NEW FILE: eeprom.o --- ELF --- NEW FILE: interrupt.o --- ELF --- NEW FILE: media.o --- ELF $À <! ! <! $ --- NEW FILE: pnic.c --- /* drivers/net/tulip/pnic.c Maintained by Jeff Garzik <jg...@ma...> Copyright 2000,2001 The Linux Kernel Team Written/copyright 1994-2001 by Donald Becker. This software may be used and distributed according to the terms of the GNU General Public License, incorporated herein by reference. Please refer to Documentation/DocBook/tulip.{pdf,ps,html} for more information on this driver, or visit the project Web page at http://sourceforge.net/projects/tulip/ */ #include <linux/kernel.h> #include "tulip.h" void pnic_do_nway(struct net_device *dev) { struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; u32 phy_reg = inl(ioaddr + 0xB8); u32 new_csr6 = tp->csr6 & ~0x40C40200; if (phy_reg & 0x78000000) { /* Ignore baseT4 */ if (phy_reg & 0x20000000) dev->if_port = 5; else if (phy_reg & 0x40000000) dev->if_port = 3; else if (phy_reg & 0x10000000) dev->if_port = 4; else if (phy_reg & 0x08000000) dev->if_port = 0; tp->nwayset = 1; new_csr6 = (dev->if_port & 1) ? 0x01860000 : 0x00420000; outl(0x32 | (dev->if_port & 1), ioaddr + CSR12); if (dev->if_port & 1) outl(0x1F868, ioaddr + 0xB8); if (phy_reg & 0x30000000) { tp->full_duplex = 1; new_csr6 |= 0x00000200; } if (tulip_debug > 1) printk(KERN_DEBUG "%s: PNIC autonegotiated status %8.8x, %s.\n", dev->name, phy_reg, medianame[dev->if_port]); if (tp->csr6 != new_csr6) { tp->csr6 = new_csr6; /* Restart Tx */ tulip_restart_rxtx(tp); dev->trans_start = jiffies; } } } void pnic_lnk_change(struct net_device *dev, int csr5) { struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int phy_reg = inl(ioaddr + 0xB8); if (tulip_debug > 1) printk(KERN_DEBUG "%s: PNIC link changed state %8.8x, CSR5 %8.8x.\n", dev->name, phy_reg, csr5); if (inl(ioaddr + CSR5) & TPLnkFail) { outl((inl(ioaddr + CSR7) & ~TPLnkFail) | TPLnkPass, ioaddr + CSR7); /* If we use an external MII, then we mustn't use the * internal negotiation. */ if (tulip_media_cap[dev->if_port] & MediaIsMII) return; if (! tp->nwayset || jiffies - dev->trans_start > 1*HZ) { tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff); outl(tp->csr6, ioaddr + CSR6); outl(0x30, ioaddr + CSR12); outl(0x0201F078, ioaddr + 0xB8); /* Turn on autonegotiation. */ dev->trans_start = jiffies; } } else if (inl(ioaddr + CSR5) & TPLnkPass) { if (tulip_media_cap[dev->if_port] & MediaIsMII) { spin_lock(&tp->lock); tulip_check_duplex(dev); spin_unlock(&tp->lock); } else { pnic_do_nway(dev); } outl((inl(ioaddr + CSR7) & ~TPLnkPass) | TPLnkFail, ioaddr + CSR7); } } void pnic_timer(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int next_tick = 60*HZ; if(!inl(ioaddr + CSR7)) { /* the timer was called due to a work overflow * in the interrupt handler. Skip the connection * checks, the nic is definitively speaking with * his link partner. */ goto too_good_connection; } if (tulip_media_cap[dev->if_port] & MediaIsMII) { spin_lock_irq(&tp->lock); if (tulip_check_duplex(dev) > 0) next_tick = 3*HZ; spin_unlock_irq(&tp->lock); } else { int csr12 = inl(ioaddr + CSR12); int new_csr6 = tp->csr6 & ~0x40C40200; int phy_reg = inl(ioaddr + 0xB8); int csr5 = inl(ioaddr + CSR5); if (tulip_debug > 1) printk(KERN_DEBUG "%s: PNIC timer PHY status %8.8x, %s " "CSR5 %8.8x.\n", dev->name, phy_reg, medianame[dev->if_port], csr5); if (phy_reg & 0x04000000) { /* Remote link fault */ outl(0x0201F078, ioaddr + 0xB8); next_tick = 1*HZ; tp->nwayset = 0; } else if (phy_reg & 0x78000000) { /* Ignore baseT4 */ pnic_do_nway(dev); next_tick = 60*HZ; } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */ if (tulip_debug > 1) printk(KERN_DEBUG "%s: %s link beat failed, CSR12 %4.4x, " "CSR5 %8.8x, PHY %3.3x.\n", dev->name, medianame[dev->if_port], csr12, inl(ioaddr + CSR5), inl(ioaddr + 0xB8)); next_tick = 3*HZ; if (tp->medialock) { } else if (tp->nwayset && (dev->if_port & 1)) { next_tick = 1*HZ; } else if (dev->if_port == 0) { dev->if_port = 3; outl(0x33, ioaddr + CSR12); new_csr6 = 0x01860000; outl(0x1F868, ioaddr + 0xB8); } else { dev->if_port = 0; outl(0x32, ioaddr + CSR12); new_csr6 = 0x00420000; outl(0x1F078, ioaddr + 0xB8); } if (tp->csr6 != new_csr6) { tp->csr6 = new_csr6; /* Restart Tx */ tulip_restart_rxtx(tp); dev->trans_start = jiffies; if (tulip_debug > 1) printk(KERN_INFO "%s: Changing PNIC configuration to %s " "%s-duplex, CSR6 %8.8x.\n", dev->name, medianame[dev->if_port], tp->full_duplex ? "full" : "half", new_csr6); } } } too_good_connection: mod_timer(&tp->timer, RUN_AT(next_tick)); if(!inl(ioaddr + CSR7)) { if (tulip_debug > 1) printk(KERN_INFO "%s: sw timer wakeup.\n", dev->name); disable_irq(dev->irq); tulip_refill_rx(dev); enable_irq(dev->irq); outl(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7); } } --- NEW FILE: pnic.o --- ELF --- NEW FILE: timer.c --- /* drivers/net/tulip/timer.c Maintained by Jeff Garzik <jg...@ma...> Copyright 2000,2001 The Linux Kernel Team Written/copyright 1994-2001 by Donald Becker. This software may be used and distributed according to the terms of the GNU General Public License, incorporated herein by reference. Please refer to Documentation/DocBook/tulip.{pdf,ps,html} for more information on this driver, or visit the project Web page at http://sourceforge.net/projects/tulip/ */ #include "tulip.h" void tulip_timer(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; u32 csr12 = inl(ioaddr + CSR12); int next_tick = 2*HZ; if (tulip_debug > 2) { printk(KERN_DEBUG "%s: Media selection tick, %s, status %8.8x mode" " %8.8x SIA %8.8x %8.8x %8.8x %8.8x.\n", dev->name, medianame[dev->if_port], inl(ioaddr + CSR5), inl(ioaddr + CSR6), csr12, inl(ioaddr + CSR13), inl(ioaddr + CSR14), inl(ioaddr + CSR15)); } switch (tp->chip_id) { case DC21040: if (!tp->medialock && csr12 & 0x0002) { /* Network error */ printk(KERN_INFO "%s: No link beat found.\n", dev->name); dev->if_port = (dev->if_port == 2 ? 0 : 2); tulip_select_media(dev, 0); dev->trans_start = jiffies; } break; case DC21041: if (tulip_debug > 2) printk(KERN_DEBUG "%s: 21041 media tick CSR12 %8.8x.\n", dev->name, csr12); if (tp->medialock) break; switch (dev->if_port) { case 0: case 3: case 4: if (csr12 & 0x0004) { /*LnkFail */ /* 10baseT is dead. Check for activity on alternate port. */ tp->mediasense = 1; if (csr12 & 0x0200) dev->if_port = 2; else dev->if_port = 1; printk(KERN_INFO "%s: No 21041 10baseT link beat, Media switched to %s.\n", dev->name, medianame[dev->if_port]); outl(0, ioaddr + CSR13); /* Reset */ outl(t21041_csr14[dev->if_port], ioaddr + CSR14); outl(t21041_csr15[dev->if_port], ioaddr + CSR15); outl(t21041_csr13[dev->if_port], ioaddr + CSR13); next_tick = 10*HZ; /* 2.4 sec. */ } else next_tick = 30*HZ; break; case 1: /* 10base2 */ case 2: /* AUI */ if (csr12 & 0x0100) { next_tick = (30*HZ); /* 30 sec. */ tp->mediasense = 0; } else if ((csr12 & 0x0004) == 0) { printk(KERN_INFO "%s: 21041 media switched to 10baseT.\n", dev->name); dev->if_port = 0; tulip_select_media(dev, 0); next_tick = (24*HZ)/10; /* 2.4 sec. */ } else if (tp->mediasense || (csr12 & 0x0002)) { dev->if_port = 3 - dev->if_port; /* Swap ports. */ tulip_select_media(dev, 0); next_tick = 20*HZ; } else { next_tick = 20*HZ; } break; } break; case DC21140: case DC21142: case MX98713: case COMPEX9881: case DM910X: default: { struct medialeaf *mleaf; unsigned char *p; if (tp->mtable == NULL) { /* No EEPROM info, use generic code. */ /* Not much that can be done. Assume this a generic MII or SYM transceiver. */ next_tick = 60*HZ; if (tulip_debug > 2) printk(KERN_DEBUG "%s: network media monitor CSR6 %8.8x " "CSR12 0x%2.2x.\n", dev->name, inl(ioaddr + CSR6), csr12 & 0xff); break; } mleaf = &tp->mtable->mleaf[tp->cur_index]; p = mleaf->leafdata; switch (mleaf->type) { case 0: case 4: { /* Type 0 serial or 4 SYM transceiver. Check the link beat bit. */ int offset = mleaf->type == 4 ? 5 : 2; s8 bitnum = p[offset]; if (p[offset+1] & 0x80) { if (tulip_debug > 1) printk(KERN_DEBUG"%s: Transceiver monitor tick " "CSR12=%#2.2x, no media sense.\n", dev->name, csr12); if (mleaf->type == 4) { if (mleaf->media == 3 && (csr12 & 0x02)) goto select_next_media; } break; } if (tulip_debug > 2) printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#2.2x" " bit %d is %d, expecting %d.\n", dev->name, csr12, (bitnum >> 1) & 7, (csr12 & (1 << ((bitnum >> 1) & 7))) != 0, (bitnum >= 0)); /* Check that the specified bit has the proper value. */ if ((bitnum < 0) != ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) { if (tulip_debug > 2) printk(KERN_DEBUG "%s: Link beat detected for %s.\n", dev->name, medianame[mleaf->media & MEDIA_MASK]); if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */ goto actually_mii; /* netif_carrier_on(dev); */ break; } /* netif_carrier_off(dev); */ if (tp->medialock) break; select_next_media: if (--tp->cur_index < 0) { /* We start again, but should instead look for default. */ tp->cur_index = tp->mtable->leafcount - 1; } dev->if_port = tp->mtable->mleaf[tp->cur_index].media; if (tulip_media_cap[dev->if_port] & MediaIsFD) goto select_next_media; /* Skip FD entries. */ if (tulip_debug > 1) printk(KERN_DEBUG "%s: No link beat on media %s," " trying transceiver type %s.\n", dev->name, medianame[mleaf->media & MEDIA_MASK], medianame[tp->mtable->mleaf[tp->cur_index].media]); tulip_select_media(dev, 0); /* Restart the transmit process. */ tulip_restart_rxtx(tp); next_tick = (24*HZ)/10; break; } case 1: case 3: /* 21140, 21142 MII */ actually_mii: if (tulip_check_duplex(dev) < 0) { /* netif_carrier_off(dev); */ } else { /* netif_carrier_on(dev); */ } next_tick = 60*HZ; break; case 2: /* 21142 serial block has no link beat. */ default: break; } } break; } /* mod_timer synchronizes us with potential add_timer calls * from interrupts. */ mod_timer(&tp->timer, RUN_AT(next_tick)); } void mxic_timer(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int next_tick = 60*HZ; if (tulip_debug > 3) { printk(KERN_INFO"%s: MXIC negotiation status %8.8x.\n", dev->name, inl(ioaddr + CSR12)); } if (next_tick) { mod_timer(&tp->timer, RUN_AT(next_tick)); } } void comet_timer(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct tulip_private *tp = (struct tulip_private *)dev->priv; long ioaddr = dev->base_addr; int next_tick = 60*HZ; if (tulip_debug > 1) printk(KERN_DEBUG "%s: Comet link status %4.4x partner capability " "%4.4x.\n", dev->name, inl(ioaddr + 0xB8), inl(ioaddr + 0xC8)); /* mod_timer synchronizes us with potential add_timer calls * from interrupts. */ mod_timer(&tp->timer, RUN_AT(next_tick)); } --- NEW FILE: timer.o --- ELF --- NEW FILE: tulip.o --- ELF $À <! ! <! $ $( $ $ $!¦ $ $ $( <·J5 _ --- NEW FILE: tulip_core.o --- ELF <·J5 ç$ 1& ¥$ $¸ $ $À $¸ 1& $ B |