aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sis900.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sis900.c')
-rw-r--r--drivers/net/sis900.c220
1 files changed, 110 insertions, 110 deletions
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 6af50286349d..430500da6a9d 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -1,14 +1,14 @@
1/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux. 1/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
2 Copyright 1999 Silicon Integrated System Corporation 2 Copyright 1999 Silicon Integrated System Corporation
3 Revision: 1.08.10 Apr. 2 2006 3 Revision: 1.08.10 Apr. 2 2006
4 4
5 Modified from the driver which is originally written by Donald Becker. 5 Modified from the driver which is originally written by Donald Becker.
6 6
7 This software may be used and distributed according to the terms 7 This software may be used and distributed according to the terms
8 of the GNU General Public License (GPL), incorporated herein by reference. 8 of the GNU General Public License (GPL), incorporated herein by reference.
9 Drivers based on this skeleton fall under the GPL and must retain 9 Drivers based on this skeleton fall under the GPL and must retain
10 the authorship (implicit copyright) notice. 10 the authorship (implicit copyright) notice.
11 11
12 References: 12 References:
13 SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support, 13 SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support,
14 preliminary Rev. 1.0 Jan. 14, 1998 14 preliminary Rev. 1.0 Jan. 14, 1998
@@ -29,7 +29,7 @@
29 Rev 1.08.01 Aug. 25 2001 Hui-Fen Hsu update for 630ET & workaround for ICS1893 PHY 29 Rev 1.08.01 Aug. 25 2001 Hui-Fen Hsu update for 630ET & workaround for ICS1893 PHY
30 Rev 1.08.00 Jun. 11 2001 Hui-Fen Hsu workaround for RTL8201 PHY and some bug fix 30 Rev 1.08.00 Jun. 11 2001 Hui-Fen Hsu workaround for RTL8201 PHY and some bug fix
31 Rev 1.07.11 Apr. 2 2001 Hui-Fen Hsu updates PCI drivers to use the new pci_set_dma_mask for kernel 2.4.3 31 Rev 1.07.11 Apr. 2 2001 Hui-Fen Hsu updates PCI drivers to use the new pci_set_dma_mask for kernel 2.4.3
32 Rev 1.07.10 Mar. 1 2001 Hui-Fen Hsu <hfhsu@sis.com.tw> some bug fix & 635M/B support 32 Rev 1.07.10 Mar. 1 2001 Hui-Fen Hsu <hfhsu@sis.com.tw> some bug fix & 635M/B support
33 Rev 1.07.09 Feb. 9 2001 Dave Jones <davej@suse.de> PCI enable cleanup 33 Rev 1.07.09 Feb. 9 2001 Dave Jones <davej@suse.de> PCI enable cleanup
34 Rev 1.07.08 Jan. 8 2001 Lei-Chun Chang added RTL8201 PHY support 34 Rev 1.07.08 Jan. 8 2001 Lei-Chun Chang added RTL8201 PHY support
35 Rev 1.07.07 Nov. 29 2000 Lei-Chun Chang added kernel-doc extractable documentation and 630 workaround fix 35 Rev 1.07.07 Nov. 29 2000 Lei-Chun Chang added kernel-doc extractable documentation and 630 workaround fix
@@ -237,7 +237,7 @@ static struct ethtool_ops sis900_ethtool_ops;
237/** 237/**
238 * sis900_get_mac_addr - Get MAC address for stand alone SiS900 model 238 * sis900_get_mac_addr - Get MAC address for stand alone SiS900 model
239 * @pci_dev: the sis900 pci device 239 * @pci_dev: the sis900 pci device
240 * @net_dev: the net device to get address for 240 * @net_dev: the net device to get address for
241 * 241 *
242 * Older SiS900 and friends, use EEPROM to store MAC address. 242 * Older SiS900 and friends, use EEPROM to store MAC address.
243 * MAC address is read from read_eeprom() into @net_dev->dev_addr. 243 * MAC address is read from read_eeprom() into @net_dev->dev_addr.
@@ -250,9 +250,9 @@ static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_de
250 int i; 250 int i;
251 251
252 /* check to see if we have sane EEPROM */ 252 /* check to see if we have sane EEPROM */
253 signature = (u16) read_eeprom(ioaddr, EEPROMSignature); 253 signature = (u16) read_eeprom(ioaddr, EEPROMSignature);
254 if (signature == 0xffff || signature == 0x0000) { 254 if (signature == 0xffff || signature == 0x0000) {
255 printk (KERN_WARNING "%s: Error EERPOM read %x\n", 255 printk (KERN_WARNING "%s: Error EERPOM read %x\n",
256 pci_name(pci_dev), signature); 256 pci_name(pci_dev), signature);
257 return 0; 257 return 0;
258 } 258 }
@@ -267,7 +267,7 @@ static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_de
267/** 267/**
268 * sis630e_get_mac_addr - Get MAC address for SiS630E model 268 * sis630e_get_mac_addr - Get MAC address for SiS630E model
269 * @pci_dev: the sis900 pci device 269 * @pci_dev: the sis900 pci device
270 * @net_dev: the net device to get address for 270 * @net_dev: the net device to get address for
271 * 271 *
272 * SiS630E model, use APC CMOS RAM to store MAC address. 272 * SiS630E model, use APC CMOS RAM to store MAC address.
273 * APC CMOS RAM is accessed through ISA bridge. 273 * APC CMOS RAM is accessed through ISA bridge.
@@ -294,7 +294,7 @@ static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev,
294 294
295 for (i = 0; i < 6; i++) { 295 for (i = 0; i < 6; i++) {
296 outb(0x09 + i, 0x70); 296 outb(0x09 + i, 0x70);
297 ((u8 *)(net_dev->dev_addr))[i] = inb(0x71); 297 ((u8 *)(net_dev->dev_addr))[i] = inb(0x71);
298 } 298 }
299 pci_write_config_byte(isa_bridge, 0x48, reg & ~0x40); 299 pci_write_config_byte(isa_bridge, 0x48, reg & ~0x40);
300 pci_dev_put(isa_bridge); 300 pci_dev_put(isa_bridge);
@@ -306,10 +306,10 @@ static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev,
306/** 306/**
307 * sis635_get_mac_addr - Get MAC address for SIS635 model 307 * sis635_get_mac_addr - Get MAC address for SIS635 model
308 * @pci_dev: the sis900 pci device 308 * @pci_dev: the sis900 pci device
309 * @net_dev: the net device to get address for 309 * @net_dev: the net device to get address for
310 * 310 *
311 * SiS635 model, set MAC Reload Bit to load Mac address from APC 311 * SiS635 model, set MAC Reload Bit to load Mac address from APC
312 * to rfdr. rfdr is accessed through rfcr. MAC address is read into 312 * to rfdr. rfdr is accessed through rfcr. MAC address is read into
313 * @net_dev->dev_addr. 313 * @net_dev->dev_addr.
314 */ 314 */
315 315
@@ -343,16 +343,16 @@ static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev,
343/** 343/**
344 * sis96x_get_mac_addr - Get MAC address for SiS962 or SiS963 model 344 * sis96x_get_mac_addr - Get MAC address for SiS962 or SiS963 model
345 * @pci_dev: the sis900 pci device 345 * @pci_dev: the sis900 pci device
346 * @net_dev: the net device to get address for 346 * @net_dev: the net device to get address for
347 * 347 *
348 * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM 348 * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM
349 * is shared by 349 * is shared by
350 * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first 350 * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first
351 * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access 351 * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access
352 * by LAN, otherwise is not. After MAC address is read from EEPROM, send 352 * by LAN, otherwise is not. After MAC address is read from EEPROM, send
353 * EEDONE signal to refuse EEPROM access by LAN. 353 * EEDONE signal to refuse EEPROM access by LAN.
354 * The EEPROM map of SiS962 or SiS963 is different to SiS900. 354 * The EEPROM map of SiS962 or SiS963 is different to SiS900.
355 * The signature field in SiS962 or SiS963 spec is meaningless. 355 * The signature field in SiS962 or SiS963 spec is meaningless.
356 * MAC address is read into @net_dev->dev_addr. 356 * MAC address is read into @net_dev->dev_addr.
357 */ 357 */
358 358
@@ -363,7 +363,7 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
363 long ee_addr = ioaddr + mear; 363 long ee_addr = ioaddr + mear;
364 u32 waittime = 0; 364 u32 waittime = 0;
365 int i; 365 int i;
366 366
367 outl(EEREQ, ee_addr); 367 outl(EEREQ, ee_addr);
368 while(waittime < 2000) { 368 while(waittime < 2000) {
369 if(inl(ee_addr) & EEGNT) { 369 if(inl(ee_addr) & EEGNT) {
@@ -375,7 +375,7 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
375 outl(EEDONE, ee_addr); 375 outl(EEDONE, ee_addr);
376 return 1; 376 return 1;
377 } else { 377 } else {
378 udelay(1); 378 udelay(1);
379 waittime ++; 379 waittime ++;
380 } 380 }
381 } 381 }
@@ -389,7 +389,7 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
389 * @pci_id: the pci device ID 389 * @pci_id: the pci device ID
390 * 390 *
391 * Check and probe sis900 net device for @pci_dev. 391 * Check and probe sis900 net device for @pci_dev.
392 * Get mac address according to the chip revision, 392 * Get mac address according to the chip revision,
393 * and assign SiS900-specific entries in the device structure. 393 * and assign SiS900-specific entries in the device structure.
394 * ie: sis900_open(), sis900_start_xmit(), sis900_close(), etc. 394 * ie: sis900_open(), sis900_start_xmit(), sis900_close(), etc.
395 */ 395 */
@@ -417,16 +417,16 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
417 /* setup various bits in PCI command register */ 417 /* setup various bits in PCI command register */
418 ret = pci_enable_device(pci_dev); 418 ret = pci_enable_device(pci_dev);
419 if(ret) return ret; 419 if(ret) return ret;
420 420
421 i = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK); 421 i = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK);
422 if(i){ 422 if(i){
423 printk(KERN_ERR "sis900.c: architecture does not support" 423 printk(KERN_ERR "sis900.c: architecture does not support"
424 "32bit PCI busmaster DMA\n"); 424 "32bit PCI busmaster DMA\n");
425 return i; 425 return i;
426 } 426 }
427 427
428 pci_set_master(pci_dev); 428 pci_set_master(pci_dev);
429 429
430 net_dev = alloc_etherdev(sizeof(struct sis900_private)); 430 net_dev = alloc_etherdev(sizeof(struct sis900_private));
431 if (!net_dev) 431 if (!net_dev)
432 return -ENOMEM; 432 return -ENOMEM;
@@ -434,7 +434,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
434 SET_NETDEV_DEV(net_dev, &pci_dev->dev); 434 SET_NETDEV_DEV(net_dev, &pci_dev->dev);
435 435
436 /* We do a request_region() to register /proc/ioports info. */ 436 /* We do a request_region() to register /proc/ioports info. */
437 ioaddr = pci_resource_start(pci_dev, 0); 437 ioaddr = pci_resource_start(pci_dev, 0);
438 ret = pci_request_regions(pci_dev, "sis900"); 438 ret = pci_request_regions(pci_dev, "sis900");
439 if (ret) 439 if (ret)
440 goto err_out; 440 goto err_out;
@@ -462,7 +462,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
462 } 462 }
463 sis_priv->rx_ring = (BufferDesc *)ring_space; 463 sis_priv->rx_ring = (BufferDesc *)ring_space;
464 sis_priv->rx_ring_dma = ring_dma; 464 sis_priv->rx_ring_dma = ring_dma;
465 465
466 /* The SiS900-specific entries in the device structure. */ 466 /* The SiS900-specific entries in the device structure. */
467 net_dev->open = &sis900_open; 467 net_dev->open = &sis900_open;
468 net_dev->hard_start_xmit = &sis900_start_xmit; 468 net_dev->hard_start_xmit = &sis900_start_xmit;
@@ -496,7 +496,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
496 printk(KERN_DEBUG "%s: detected revision %2.2x, " 496 printk(KERN_DEBUG "%s: detected revision %2.2x, "
497 "trying to get MAC address...\n", 497 "trying to get MAC address...\n",
498 dev_name, sis_priv->chipset_rev); 498 dev_name, sis_priv->chipset_rev);
499 499
500 ret = 0; 500 ret = 0;
501 if (sis_priv->chipset_rev == SIS630E_900_REV) 501 if (sis_priv->chipset_rev == SIS630E_900_REV)
502 ret = sis630e_get_mac_addr(pci_dev, net_dev); 502 ret = sis630e_get_mac_addr(pci_dev, net_dev);
@@ -512,7 +512,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
512 ret = -ENODEV; 512 ret = -ENODEV;
513 goto err_unmap_rx; 513 goto err_unmap_rx;
514 } 514 }
515 515
516 /* 630ET : set the mii access mode as software-mode */ 516 /* 630ET : set the mii access mode as software-mode */
517 if (sis_priv->chipset_rev == SIS630ET_900_REV) 517 if (sis_priv->chipset_rev == SIS630ET_900_REV)
518 outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr); 518 outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
@@ -567,7 +567,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
567/** 567/**
568 * sis900_mii_probe - Probe MII PHY for sis900 568 * sis900_mii_probe - Probe MII PHY for sis900
569 * @net_dev: the net device to probe for 569 * @net_dev: the net device to probe for
570 * 570 *
571 * Search for total of 32 possible mii phy addresses. 571 * Search for total of 32 possible mii phy addresses.
572 * Identify and set current phy if found one, 572 * Identify and set current phy if found one,
573 * return error if it failed to found. 573 * return error if it failed to found.
@@ -584,7 +584,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
584 sis_priv->mii = NULL; 584 sis_priv->mii = NULL;
585 585
586 /* search for total of 32 possible mii phy addresses */ 586 /* search for total of 32 possible mii phy addresses */
587 for (phy_addr = 0; phy_addr < 32; phy_addr++) { 587 for (phy_addr = 0; phy_addr < 32; phy_addr++) {
588 struct mii_phy * mii_phy = NULL; 588 struct mii_phy * mii_phy = NULL;
589 u16 mii_status; 589 u16 mii_status;
590 int i; 590 int i;
@@ -600,7 +600,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
600 dev_name, phy_addr); 600 dev_name, phy_addr);
601 continue; 601 continue;
602 } 602 }
603 603
604 if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) { 604 if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) {
605 printk(KERN_WARNING "Cannot allocate mem for struct mii_phy\n"); 605 printk(KERN_WARNING "Cannot allocate mem for struct mii_phy\n");
606 mii_phy = sis_priv->first_mii; 606 mii_phy = sis_priv->first_mii;
@@ -612,9 +612,9 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
612 } 612 }
613 return 0; 613 return 0;
614 } 614 }
615 615
616 mii_phy->phy_id0 = mdio_read(net_dev, phy_addr, MII_PHY_ID0); 616 mii_phy->phy_id0 = mdio_read(net_dev, phy_addr, MII_PHY_ID0);
617 mii_phy->phy_id1 = mdio_read(net_dev, phy_addr, MII_PHY_ID1); 617 mii_phy->phy_id1 = mdio_read(net_dev, phy_addr, MII_PHY_ID1);
618 mii_phy->phy_addr = phy_addr; 618 mii_phy->phy_addr = phy_addr;
619 mii_phy->status = mii_status; 619 mii_phy->status = mii_status;
620 mii_phy->next = sis_priv->mii; 620 mii_phy->next = sis_priv->mii;
@@ -635,14 +635,14 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
635 phy_addr); 635 phy_addr);
636 break; 636 break;
637 } 637 }
638 638
639 if( !mii_chip_table[i].phy_id1 ) { 639 if( !mii_chip_table[i].phy_id1 ) {
640 printk(KERN_INFO "%s: Unknown PHY transceiver found at address %d.\n", 640 printk(KERN_INFO "%s: Unknown PHY transceiver found at address %d.\n",
641 dev_name, phy_addr); 641 dev_name, phy_addr);
642 mii_phy->phy_types = UNKNOWN; 642 mii_phy->phy_types = UNKNOWN;
643 } 643 }
644 } 644 }
645 645
646 if (sis_priv->mii == NULL) { 646 if (sis_priv->mii == NULL) {
647 printk(KERN_INFO "%s: No MII transceivers found!\n", dev_name); 647 printk(KERN_INFO "%s: No MII transceivers found!\n", dev_name);
648 return 0; 648 return 0;
@@ -656,7 +656,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
656 if ((sis_priv->mii->phy_id0 == 0x001D) && 656 if ((sis_priv->mii->phy_id0 == 0x001D) &&
657 ((sis_priv->mii->phy_id1&0xFFF0) == 0x8000)) 657 ((sis_priv->mii->phy_id1&0xFFF0) == 0x8000))
658 status = sis900_reset_phy(net_dev, sis_priv->cur_phy); 658 status = sis900_reset_phy(net_dev, sis_priv->cur_phy);
659 659
660 /* workaround for ICS1893 PHY */ 660 /* workaround for ICS1893 PHY */
661 if ((sis_priv->mii->phy_id0 == 0x0015) && 661 if ((sis_priv->mii->phy_id0 == 0x0015) &&
662 ((sis_priv->mii->phy_id1&0xFFF0) == 0xF440)) 662 ((sis_priv->mii->phy_id1&0xFFF0) == 0xF440))
@@ -681,7 +681,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
681 mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG1, 0x22); 681 mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG1, 0x22);
682 mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG2, 0xff00); 682 mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG2, 0xff00);
683 mdio_write(net_dev, sis_priv->cur_phy, MII_MASK, 0xffc0); 683 mdio_write(net_dev, sis_priv->cur_phy, MII_MASK, 0xffc0);
684 //mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, 0x1000); 684 //mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, 0x1000);
685 } 685 }
686 686
687 if (sis_priv->mii->status & MII_STAT_LINK) 687 if (sis_priv->mii->status & MII_STAT_LINK)
@@ -704,7 +704,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
704static u16 sis900_default_phy(struct net_device * net_dev) 704static u16 sis900_default_phy(struct net_device * net_dev)
705{ 705{
706 struct sis900_private * sis_priv = net_dev->priv; 706 struct sis900_private * sis_priv = net_dev->priv;
707 struct mii_phy *phy = NULL, *phy_home = NULL, 707 struct mii_phy *phy = NULL, *phy_home = NULL,
708 *default_phy = NULL, *phy_lan = NULL; 708 *default_phy = NULL, *phy_lan = NULL;
709 u16 status; 709 u16 status;
710 710
@@ -740,17 +740,17 @@ static u16 sis900_default_phy(struct net_device * net_dev)
740 printk(KERN_INFO "%s: Using transceiver found at address %d as default\n", 740 printk(KERN_INFO "%s: Using transceiver found at address %d as default\n",
741 pci_name(sis_priv->pci_dev), sis_priv->cur_phy); 741 pci_name(sis_priv->pci_dev), sis_priv->cur_phy);
742 } 742 }
743 743
744 sis_priv->mii_info.phy_id = sis_priv->cur_phy; 744 sis_priv->mii_info.phy_id = sis_priv->cur_phy;
745 745
746 status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL); 746 status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL);
747 status &= (~MII_CNTL_ISOLATE); 747 status &= (~MII_CNTL_ISOLATE);
748 748
749 mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, status); 749 mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, status);
750 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); 750 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS);
751 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); 751 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS);
752 752
753 return status; 753 return status;
754} 754}
755 755
756 756
@@ -762,15 +762,15 @@ static u16 sis900_default_phy(struct net_device * net_dev)
762 * Set the media capability of network adapter according to 762 * Set the media capability of network adapter according to
763 * mii status register. It's necessary before auto-negotiate. 763 * mii status register. It's necessary before auto-negotiate.
764 */ 764 */
765 765
766static void sis900_set_capability(struct net_device *net_dev, struct mii_phy *phy) 766static void sis900_set_capability(struct net_device *net_dev, struct mii_phy *phy)
767{ 767{
768 u16 cap; 768 u16 cap;
769 u16 status; 769 u16 status;
770 770
771 status = mdio_read(net_dev, phy->phy_addr, MII_STATUS); 771 status = mdio_read(net_dev, phy->phy_addr, MII_STATUS);
772 status = mdio_read(net_dev, phy->phy_addr, MII_STATUS); 772 status = mdio_read(net_dev, phy->phy_addr, MII_STATUS);
773 773
774 cap = MII_NWAY_CSMA_CD | 774 cap = MII_NWAY_CSMA_CD |
775 ((phy->status & MII_STAT_CAN_TX_FDX)? MII_NWAY_TX_FDX:0) | 775 ((phy->status & MII_STAT_CAN_TX_FDX)? MII_NWAY_TX_FDX:0) |
776 ((phy->status & MII_STAT_CAN_TX) ? MII_NWAY_TX:0) | 776 ((phy->status & MII_STAT_CAN_TX) ? MII_NWAY_TX:0) |
@@ -975,7 +975,7 @@ static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr)
975 status = mdio_read(net_dev, phy_addr, MII_STATUS); 975 status = mdio_read(net_dev, phy_addr, MII_STATUS);
976 976
977 mdio_write( net_dev, phy_addr, MII_CONTROL, MII_CNTL_RESET ); 977 mdio_write( net_dev, phy_addr, MII_CONTROL, MII_CNTL_RESET );
978 978
979 return status; 979 return status;
980} 980}
981 981
@@ -1092,7 +1092,7 @@ sis900_init_rxfilter (struct net_device * net_dev)
1092 * sis900_init_tx_ring - Initialize the Tx descriptor ring 1092 * sis900_init_tx_ring - Initialize the Tx descriptor ring
1093 * @net_dev: the net device to initialize for 1093 * @net_dev: the net device to initialize for
1094 * 1094 *
1095 * Initialize the Tx descriptor ring, 1095 * Initialize the Tx descriptor ring,
1096 */ 1096 */
1097 1097
1098static void 1098static void
@@ -1125,11 +1125,11 @@ sis900_init_tx_ring(struct net_device *net_dev)
1125 * sis900_init_rx_ring - Initialize the Rx descriptor ring 1125 * sis900_init_rx_ring - Initialize the Rx descriptor ring
1126 * @net_dev: the net device to initialize for 1126 * @net_dev: the net device to initialize for
1127 * 1127 *
1128 * Initialize the Rx descriptor ring, 1128 * Initialize the Rx descriptor ring,
1129 * and pre-allocate recevie buffers (socket buffer) 1129 * and pre-allocate recevie buffers (socket buffer)
1130 */ 1130 */
1131 1131
1132static void 1132static void
1133sis900_init_rx_ring(struct net_device *net_dev) 1133sis900_init_rx_ring(struct net_device *net_dev)
1134{ 1134{
1135 struct sis900_private *sis_priv = net_dev->priv; 1135 struct sis900_private *sis_priv = net_dev->priv;
@@ -1239,8 +1239,8 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
1239 max_value+6 : max_value+5; 1239 max_value+6 : max_value+5;
1240 } 1240 }
1241 /* 630B0&B1 rule to determine the equalizer value */ 1241 /* 630B0&B1 rule to determine the equalizer value */
1242 if (revision == SIS630A_900_REV && 1242 if (revision == SIS630A_900_REV &&
1243 (sis_priv->host_bridge_rev == SIS630B0 || 1243 (sis_priv->host_bridge_rev == SIS630B0 ||
1244 sis_priv->host_bridge_rev == SIS630B1)) { 1244 sis_priv->host_bridge_rev == SIS630B1)) {
1245 if (max_value == 0) 1245 if (max_value == 0)
1246 eq_value = 3; 1246 eq_value = 3;
@@ -1254,9 +1254,9 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
1254 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, reg14h); 1254 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, reg14h);
1255 } else { 1255 } else {
1256 reg14h = mdio_read(net_dev, sis_priv->cur_phy, MII_RESV); 1256 reg14h = mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
1257 if (revision == SIS630A_900_REV && 1257 if (revision == SIS630A_900_REV &&
1258 (sis_priv->host_bridge_rev == SIS630B0 || 1258 (sis_priv->host_bridge_rev == SIS630B0 ||
1259 sis_priv->host_bridge_rev == SIS630B1)) 1259 sis_priv->host_bridge_rev == SIS630B1))
1260 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, 1260 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV,
1261 (reg14h | 0x2200) & 0xBFFF); 1261 (reg14h | 0x2200) & 0xBFFF);
1262 else 1262 else
@@ -1270,7 +1270,7 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
1270 * sis900_timer - sis900 timer routine 1270 * sis900_timer - sis900 timer routine
1271 * @data: pointer to sis900 net device 1271 * @data: pointer to sis900 net device
1272 * 1272 *
1273 * On each timer ticks we check two things, 1273 * On each timer ticks we check two things,
1274 * link status (ON/OFF) and link mode (10/100/Full/Half) 1274 * link status (ON/OFF) and link mode (10/100/Full/Half)
1275 */ 1275 */
1276 1276
@@ -1319,12 +1319,12 @@ static void sis900_timer(unsigned long data)
1319 printk(KERN_INFO "%s: Media Link Off\n", net_dev->name); 1319 printk(KERN_INFO "%s: Media Link Off\n", net_dev->name);
1320 1320
1321 /* Change mode issue */ 1321 /* Change mode issue */
1322 if ((mii_phy->phy_id0 == 0x001D) && 1322 if ((mii_phy->phy_id0 == 0x001D) &&
1323 ((mii_phy->phy_id1 & 0xFFF0) == 0x8000)) 1323 ((mii_phy->phy_id1 & 0xFFF0) == 0x8000))
1324 sis900_reset_phy(net_dev, sis_priv->cur_phy); 1324 sis900_reset_phy(net_dev, sis_priv->cur_phy);
1325 1325
1326 sis630_set_eq(net_dev, sis_priv->chipset_rev); 1326 sis630_set_eq(net_dev, sis_priv->chipset_rev);
1327 1327
1328 goto LookForLink; 1328 goto LookForLink;
1329 } 1329 }
1330 } 1330 }
@@ -1429,7 +1429,7 @@ static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr)
1429 struct sis900_private *sis_priv = net_dev->priv; 1429 struct sis900_private *sis_priv = net_dev->priv;
1430 int i = 0; 1430 int i = 0;
1431 u32 status; 1431 u32 status;
1432 1432
1433 while (i++ < 2) 1433 while (i++ < 2)
1434 status = mdio_read(net_dev, phy_addr, MII_STATUS); 1434 status = mdio_read(net_dev, phy_addr, MII_STATUS);
1435 1435
@@ -1478,7 +1478,7 @@ static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex
1478 autoadv = mdio_read(net_dev, phy_addr, MII_ANADV); 1478 autoadv = mdio_read(net_dev, phy_addr, MII_ANADV);
1479 autorec = mdio_read(net_dev, phy_addr, MII_ANLPAR); 1479 autorec = mdio_read(net_dev, phy_addr, MII_ANLPAR);
1480 status = autoadv & autorec; 1480 status = autoadv & autorec;
1481 1481
1482 *speed = HW_SPEED_10_MBPS; 1482 *speed = HW_SPEED_10_MBPS;
1483 *duplex = FDX_CAPABLE_HALF_SELECTED; 1483 *duplex = FDX_CAPABLE_HALF_SELECTED;
1484 1484
@@ -1486,7 +1486,7 @@ static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex
1486 *speed = HW_SPEED_100_MBPS; 1486 *speed = HW_SPEED_100_MBPS;
1487 if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX)) 1487 if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX))
1488 *duplex = FDX_CAPABLE_FULL_SELECTED; 1488 *duplex = FDX_CAPABLE_FULL_SELECTED;
1489 1489
1490 sis_priv->autong_complete = 1; 1490 sis_priv->autong_complete = 1;
1491 1491
1492 /* Workaround for Realtek RTL8201 PHY issue */ 1492 /* Workaround for Realtek RTL8201 PHY issue */
@@ -1537,7 +1537,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
1537 struct sk_buff *skb = sis_priv->tx_skbuff[i]; 1537 struct sk_buff *skb = sis_priv->tx_skbuff[i];
1538 1538
1539 if (skb) { 1539 if (skb) {
1540 pci_unmap_single(sis_priv->pci_dev, 1540 pci_unmap_single(sis_priv->pci_dev,
1541 sis_priv->tx_ring[i].bufptr, skb->len, 1541 sis_priv->tx_ring[i].bufptr, skb->len,
1542 PCI_DMA_TODEVICE); 1542 PCI_DMA_TODEVICE);
1543 dev_kfree_skb_irq(skb); 1543 dev_kfree_skb_irq(skb);
@@ -1567,7 +1567,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
1567 * @skb: socket buffer pointer to put the data being transmitted 1567 * @skb: socket buffer pointer to put the data being transmitted
1568 * @net_dev: the net device to transmit with 1568 * @net_dev: the net device to transmit with
1569 * 1569 *
1570 * Set the transmit buffer descriptor, 1570 * Set the transmit buffer descriptor,
1571 * and write TxENA to enable transmit state machine. 1571 * and write TxENA to enable transmit state machine.
1572 * tell upper layer if the buffer is full 1572 * tell upper layer if the buffer is full
1573 */ 1573 */
@@ -1611,7 +1611,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1611 /* dirty_tx is met in the cycle of cur_tx, buffer full */ 1611 /* dirty_tx is met in the cycle of cur_tx, buffer full */
1612 sis_priv->tx_full = 1; 1612 sis_priv->tx_full = 1;
1613 netif_stop_queue(net_dev); 1613 netif_stop_queue(net_dev);
1614 } else if (count_dirty_tx < NUM_TX_DESC) { 1614 } else if (count_dirty_tx < NUM_TX_DESC) {
1615 /* Typical path, tell upper layer that more transmission is possible */ 1615 /* Typical path, tell upper layer that more transmission is possible */
1616 netif_start_queue(net_dev); 1616 netif_start_queue(net_dev);
1617 } else { 1617 } else {
@@ -1638,7 +1638,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1638 * @dev_instance: the client data object 1638 * @dev_instance: the client data object
1639 * @regs: snapshot of processor context 1639 * @regs: snapshot of processor context
1640 * 1640 *
1641 * The interrupt handler does all of the Rx thread work, 1641 * The interrupt handler does all of the Rx thread work,
1642 * and cleans up after the Tx thread 1642 * and cleans up after the Tx thread
1643 */ 1643 */
1644 1644
@@ -1690,7 +1690,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs
1690 printk(KERN_DEBUG "%s: exiting interrupt, " 1690 printk(KERN_DEBUG "%s: exiting interrupt, "
1691 "interrupt status = 0x%#8.8x.\n", 1691 "interrupt status = 0x%#8.8x.\n",
1692 net_dev->name, inl(ioaddr + isr)); 1692 net_dev->name, inl(ioaddr + isr));
1693 1693
1694 spin_unlock (&sis_priv->lock); 1694 spin_unlock (&sis_priv->lock);
1695 return IRQ_RETVAL(handled); 1695 return IRQ_RETVAL(handled);
1696} 1696}
@@ -1699,7 +1699,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs
1699 * sis900_rx - sis900 receive routine 1699 * sis900_rx - sis900 receive routine
1700 * @net_dev: the net device which receives data 1700 * @net_dev: the net device which receives data
1701 * 1701 *
1702 * Process receive interrupt events, 1702 * Process receive interrupt events,
1703 * put buffer to higher layer and refill buffer pool 1703 * put buffer to higher layer and refill buffer pool
1704 * Note: This function is called by interrupt handler, 1704 * Note: This function is called by interrupt handler,
1705 * don't do "too much" work here 1705 * don't do "too much" work here
@@ -1748,7 +1748,7 @@ static int sis900_rx(struct net_device *net_dev)
1748 sis_priv->stats.rx_length_errors++; 1748 sis_priv->stats.rx_length_errors++;
1749 if (rx_status & (RXISERR | FAERR)) 1749 if (rx_status & (RXISERR | FAERR))
1750 sis_priv->stats.rx_frame_errors++; 1750 sis_priv->stats.rx_frame_errors++;
1751 if (rx_status & CRCERR) 1751 if (rx_status & CRCERR)
1752 sis_priv->stats.rx_crc_errors++; 1752 sis_priv->stats.rx_crc_errors++;
1753 /* reset buffer descriptor state */ 1753 /* reset buffer descriptor state */
1754 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; 1754 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
@@ -1760,7 +1760,7 @@ static int sis900_rx(struct net_device *net_dev)
1760 we are working on NULL sk_buff :-( */ 1760 we are working on NULL sk_buff :-( */
1761 if (sis_priv->rx_skbuff[entry] == NULL) { 1761 if (sis_priv->rx_skbuff[entry] == NULL) {
1762 if (netif_msg_rx_err(sis_priv)) 1762 if (netif_msg_rx_err(sis_priv))
1763 printk(KERN_WARNING "%s: NULL pointer " 1763 printk(KERN_WARNING "%s: NULL pointer "
1764 "encountered in Rx ring\n" 1764 "encountered in Rx ring\n"
1765 "cur_rx:%4.4d, dirty_rx:%4.4d\n", 1765 "cur_rx:%4.4d, dirty_rx:%4.4d\n",
1766 net_dev->name, sis_priv->cur_rx, 1766 net_dev->name, sis_priv->cur_rx,
@@ -1768,8 +1768,8 @@ static int sis900_rx(struct net_device *net_dev)
1768 break; 1768 break;
1769 } 1769 }
1770 1770
1771 pci_unmap_single(sis_priv->pci_dev, 1771 pci_unmap_single(sis_priv->pci_dev,
1772 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, 1772 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
1773 PCI_DMA_FROMDEVICE); 1773 PCI_DMA_FROMDEVICE);
1774 /* give the socket buffer to upper layers */ 1774 /* give the socket buffer to upper layers */
1775 skb = sis_priv->rx_skbuff[entry]; 1775 skb = sis_priv->rx_skbuff[entry];
@@ -1806,8 +1806,8 @@ static int sis900_rx(struct net_device *net_dev)
1806 skb->dev = net_dev; 1806 skb->dev = net_dev;
1807 sis_priv->rx_skbuff[entry] = skb; 1807 sis_priv->rx_skbuff[entry] = skb;
1808 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; 1808 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
1809 sis_priv->rx_ring[entry].bufptr = 1809 sis_priv->rx_ring[entry].bufptr =
1810 pci_map_single(sis_priv->pci_dev, skb->data, 1810 pci_map_single(sis_priv->pci_dev, skb->data,
1811 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1811 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
1812 sis_priv->dirty_rx++; 1812 sis_priv->dirty_rx++;
1813 } 1813 }
@@ -1854,7 +1854,7 @@ static int sis900_rx(struct net_device *net_dev)
1854 * sis900_finish_xmit - finish up transmission of packets 1854 * sis900_finish_xmit - finish up transmission of packets
1855 * @net_dev: the net device to be transmitted on 1855 * @net_dev: the net device to be transmitted on
1856 * 1856 *
1857 * Check for error condition and free socket buffer etc 1857 * Check for error condition and free socket buffer etc
1858 * schedule for more transmission as needed 1858 * schedule for more transmission as needed
1859 * Note: This function is called by interrupt handler, 1859 * Note: This function is called by interrupt handler,
1860 * don't do "too much" work here 1860 * don't do "too much" work here
@@ -1902,7 +1902,7 @@ static void sis900_finish_xmit (struct net_device *net_dev)
1902 } 1902 }
1903 /* Free the original skb. */ 1903 /* Free the original skb. */
1904 skb = sis_priv->tx_skbuff[entry]; 1904 skb = sis_priv->tx_skbuff[entry];
1905 pci_unmap_single(sis_priv->pci_dev, 1905 pci_unmap_single(sis_priv->pci_dev,
1906 sis_priv->tx_ring[entry].bufptr, skb->len, 1906 sis_priv->tx_ring[entry].bufptr, skb->len,
1907 PCI_DMA_TODEVICE); 1907 PCI_DMA_TODEVICE);
1908 dev_kfree_skb_irq(skb); 1908 dev_kfree_skb_irq(skb);
@@ -1921,10 +1921,10 @@ static void sis900_finish_xmit (struct net_device *net_dev)
1921} 1921}
1922 1922
1923/** 1923/**
1924 * sis900_close - close sis900 device 1924 * sis900_close - close sis900 device
1925 * @net_dev: the net device to be closed 1925 * @net_dev: the net device to be closed
1926 * 1926 *
1927 * Disable interrupts, stop the Tx and Rx Status Machine 1927 * Disable interrupts, stop the Tx and Rx Status Machine
1928 * free Tx and RX socket buffer 1928 * free Tx and RX socket buffer
1929 */ 1929 */
1930 1930
@@ -1952,7 +1952,7 @@ static int sis900_close(struct net_device *net_dev)
1952 for (i = 0; i < NUM_RX_DESC; i++) { 1952 for (i = 0; i < NUM_RX_DESC; i++) {
1953 skb = sis_priv->rx_skbuff[i]; 1953 skb = sis_priv->rx_skbuff[i];
1954 if (skb) { 1954 if (skb) {
1955 pci_unmap_single(sis_priv->pci_dev, 1955 pci_unmap_single(sis_priv->pci_dev,
1956 sis_priv->rx_ring[i].bufptr, 1956 sis_priv->rx_ring[i].bufptr,
1957 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1957 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
1958 dev_kfree_skb(skb); 1958 dev_kfree_skb(skb);
@@ -1962,7 +1962,7 @@ static int sis900_close(struct net_device *net_dev)
1962 for (i = 0; i < NUM_TX_DESC; i++) { 1962 for (i = 0; i < NUM_TX_DESC; i++) {
1963 skb = sis_priv->tx_skbuff[i]; 1963 skb = sis_priv->tx_skbuff[i];
1964 if (skb) { 1964 if (skb) {
1965 pci_unmap_single(sis_priv->pci_dev, 1965 pci_unmap_single(sis_priv->pci_dev,
1966 sis_priv->tx_ring[i].bufptr, skb->len, 1966 sis_priv->tx_ring[i].bufptr, skb->len,
1967 PCI_DMA_TODEVICE); 1967 PCI_DMA_TODEVICE);
1968 dev_kfree_skb(skb); 1968 dev_kfree_skb(skb);
@@ -1982,7 +1982,7 @@ static int sis900_close(struct net_device *net_dev)
1982 * 1982 *
1983 * Process ethtool command such as "ehtool -i" to show information 1983 * Process ethtool command such as "ehtool -i" to show information
1984 */ 1984 */
1985 1985
1986static void sis900_get_drvinfo(struct net_device *net_dev, 1986static void sis900_get_drvinfo(struct net_device *net_dev,
1987 struct ethtool_drvinfo *info) 1987 struct ethtool_drvinfo *info)
1988{ 1988{
@@ -1998,7 +1998,7 @@ static u32 sis900_get_msglevel(struct net_device *net_dev)
1998 struct sis900_private *sis_priv = net_dev->priv; 1998 struct sis900_private *sis_priv = net_dev->priv;
1999 return sis_priv->msg_enable; 1999 return sis_priv->msg_enable;
2000} 2000}
2001 2001
2002static void sis900_set_msglevel(struct net_device *net_dev, u32 value) 2002static void sis900_set_msglevel(struct net_device *net_dev, u32 value)
2003{ 2003{
2004 struct sis900_private *sis_priv = net_dev->priv; 2004 struct sis900_private *sis_priv = net_dev->priv;
@@ -2048,7 +2048,7 @@ static int sis900_nway_reset(struct net_device *net_dev)
2048 * but there is no simple way to filter them to only a subset (broadcast, 2048 * but there is no simple way to filter them to only a subset (broadcast,
2049 * multicast, unicast or arp). 2049 * multicast, unicast or arp).
2050 */ 2050 */
2051 2051
2052static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol) 2052static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol)
2053{ 2053{
2054 struct sis900_private *sis_priv = net_dev->priv; 2054 struct sis900_private *sis_priv = net_dev->priv;
@@ -2073,7 +2073,7 @@ static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wo
2073 pmctrl_bits |= MAGICPKT; 2073 pmctrl_bits |= MAGICPKT;
2074 if (wol->wolopts & WAKE_PHY) 2074 if (wol->wolopts & WAKE_PHY)
2075 pmctrl_bits |= LINKON; 2075 pmctrl_bits |= LINKON;
2076 2076
2077 outl(pmctrl_bits, pmctrl_addr); 2077 outl(pmctrl_bits, pmctrl_addr);
2078 2078
2079 pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr); 2079 pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr);
@@ -2112,7 +2112,7 @@ static struct ethtool_ops sis900_ethtool_ops = {
2112}; 2112};
2113 2113
2114/** 2114/**
2115 * mii_ioctl - process MII i/o control command 2115 * mii_ioctl - process MII i/o control command
2116 * @net_dev: the net device to command for 2116 * @net_dev: the net device to command for
2117 * @rq: parameter for command 2117 * @rq: parameter for command
2118 * @cmd: the i/o command 2118 * @cmd: the i/o command
@@ -2145,7 +2145,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
2145} 2145}
2146 2146
2147/** 2147/**
2148 * sis900_get_stats - Get sis900 read/write statistics 2148 * sis900_get_stats - Get sis900 read/write statistics
2149 * @net_dev: the net device to get statistics for 2149 * @net_dev: the net device to get statistics for
2150 * 2150 *
2151 * get tx/rx statistics for sis900 2151 * get tx/rx statistics for sis900
@@ -2160,7 +2160,7 @@ sis900_get_stats(struct net_device *net_dev)
2160} 2160}
2161 2161
2162/** 2162/**
2163 * sis900_set_config - Set media type by net_device.set_config 2163 * sis900_set_config - Set media type by net_device.set_config
2164 * @dev: the net device for media type change 2164 * @dev: the net device for media type change
2165 * @map: ifmap passed by ifconfig 2165 * @map: ifmap passed by ifconfig
2166 * 2166 *
@@ -2170,10 +2170,10 @@ sis900_get_stats(struct net_device *net_dev)
2170 */ 2170 */
2171 2171
2172static int sis900_set_config(struct net_device *dev, struct ifmap *map) 2172static int sis900_set_config(struct net_device *dev, struct ifmap *map)
2173{ 2173{
2174 struct sis900_private *sis_priv = dev->priv; 2174 struct sis900_private *sis_priv = dev->priv;
2175 struct mii_phy *mii_phy = sis_priv->mii; 2175 struct mii_phy *mii_phy = sis_priv->mii;
2176 2176
2177 u16 status; 2177 u16 status;
2178 2178
2179 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) { 2179 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
@@ -2181,10 +2181,10 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
2181 * like a definition or standard for the values of that field. 2181 * like a definition or standard for the values of that field.
2182 * I think the meaning of those values is device specific. But 2182 * I think the meaning of those values is device specific. But
2183 * since I would like to change the media type via the ifconfig 2183 * since I would like to change the media type via the ifconfig
2184 * command I use the definition from linux/netdevice.h 2184 * command I use the definition from linux/netdevice.h
2185 * (which seems to be different from the ifport(pcmcia) definition) */ 2185 * (which seems to be different from the ifport(pcmcia) definition) */
2186 switch(map->port){ 2186 switch(map->port){
2187 case IF_PORT_UNKNOWN: /* use auto here */ 2187 case IF_PORT_UNKNOWN: /* use auto here */
2188 dev->if_port = map->port; 2188 dev->if_port = map->port;
2189 /* we are going to change the media type, so the Link 2189 /* we are going to change the media type, so the Link
2190 * will be temporary down and we need to reflect that 2190 * will be temporary down and we need to reflect that
@@ -2192,10 +2192,10 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
2192 * sensed by the sis_timer procedure, which also does 2192 * sensed by the sis_timer procedure, which also does
2193 * all the rest for us */ 2193 * all the rest for us */
2194 netif_carrier_off(dev); 2194 netif_carrier_off(dev);
2195 2195
2196 /* read current state */ 2196 /* read current state */
2197 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL); 2197 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL);
2198 2198
2199 /* enable auto negotiation and reset the negotioation 2199 /* enable auto negotiation and reset the negotioation
2200 * (I don't really know what the auto negatiotiation 2200 * (I don't really know what the auto negatiotiation
2201 * reset really means, but it sounds for me right to 2201 * reset really means, but it sounds for me right to
@@ -2204,54 +2204,54 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
2204 MII_CONTROL, status | MII_CNTL_AUTO | MII_CNTL_RST_AUTO); 2204 MII_CONTROL, status | MII_CNTL_AUTO | MII_CNTL_RST_AUTO);
2205 2205
2206 break; 2206 break;
2207 2207
2208 case IF_PORT_10BASET: /* 10BaseT */ 2208 case IF_PORT_10BASET: /* 10BaseT */
2209 dev->if_port = map->port; 2209 dev->if_port = map->port;
2210 2210
2211 /* we are going to change the media type, so the Link 2211 /* we are going to change the media type, so the Link
2212 * will be temporary down and we need to reflect that 2212 * will be temporary down and we need to reflect that
2213 * here. When the Link comes up again, it will be 2213 * here. When the Link comes up again, it will be
2214 * sensed by the sis_timer procedure, which also does 2214 * sensed by the sis_timer procedure, which also does
2215 * all the rest for us */ 2215 * all the rest for us */
2216 netif_carrier_off(dev); 2216 netif_carrier_off(dev);
2217 2217
2218 /* set Speed to 10Mbps */ 2218 /* set Speed to 10Mbps */
2219 /* read current state */ 2219 /* read current state */
2220 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL); 2220 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL);
2221 2221
2222 /* disable auto negotiation and force 10MBit mode*/ 2222 /* disable auto negotiation and force 10MBit mode*/
2223 mdio_write(dev, mii_phy->phy_addr, 2223 mdio_write(dev, mii_phy->phy_addr,
2224 MII_CONTROL, status & ~(MII_CNTL_SPEED | 2224 MII_CONTROL, status & ~(MII_CNTL_SPEED |
2225 MII_CNTL_AUTO)); 2225 MII_CNTL_AUTO));
2226 break; 2226 break;
2227 2227
2228 case IF_PORT_100BASET: /* 100BaseT */ 2228 case IF_PORT_100BASET: /* 100BaseT */
2229 case IF_PORT_100BASETX: /* 100BaseTx */ 2229 case IF_PORT_100BASETX: /* 100BaseTx */
2230 dev->if_port = map->port; 2230 dev->if_port = map->port;
2231 2231
2232 /* we are going to change the media type, so the Link 2232 /* we are going to change the media type, so the Link
2233 * will be temporary down and we need to reflect that 2233 * will be temporary down and we need to reflect that
2234 * here. When the Link comes up again, it will be 2234 * here. When the Link comes up again, it will be
2235 * sensed by the sis_timer procedure, which also does 2235 * sensed by the sis_timer procedure, which also does
2236 * all the rest for us */ 2236 * all the rest for us */
2237 netif_carrier_off(dev); 2237 netif_carrier_off(dev);
2238 2238
2239 /* set Speed to 100Mbps */ 2239 /* set Speed to 100Mbps */
2240 /* disable auto negotiation and enable 100MBit Mode */ 2240 /* disable auto negotiation and enable 100MBit Mode */
2241 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL); 2241 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL);
2242 mdio_write(dev, mii_phy->phy_addr, 2242 mdio_write(dev, mii_phy->phy_addr,
2243 MII_CONTROL, (status & ~MII_CNTL_SPEED) | 2243 MII_CONTROL, (status & ~MII_CNTL_SPEED) |
2244 MII_CNTL_SPEED); 2244 MII_CNTL_SPEED);
2245 2245
2246 break; 2246 break;
2247 2247
2248 case IF_PORT_10BASE2: /* 10Base2 */ 2248 case IF_PORT_10BASE2: /* 10Base2 */
2249 case IF_PORT_AUI: /* AUI */ 2249 case IF_PORT_AUI: /* AUI */
2250 case IF_PORT_100BASEFX: /* 100BaseFx */ 2250 case IF_PORT_100BASEFX: /* 100BaseFx */
2251 /* These Modes are not supported (are they?)*/ 2251 /* These Modes are not supported (are they?)*/
2252 return -EOPNOTSUPP; 2252 return -EOPNOTSUPP;
2253 break; 2253 break;
2254 2254
2255 default: 2255 default:
2256 return -EINVAL; 2256 return -EINVAL;
2257 } 2257 }
@@ -2260,14 +2260,14 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
2260} 2260}
2261 2261
2262/** 2262/**
2263 * sis900_mcast_bitnr - compute hashtable index 2263 * sis900_mcast_bitnr - compute hashtable index
2264 * @addr: multicast address 2264 * @addr: multicast address
2265 * @revision: revision id of chip 2265 * @revision: revision id of chip
2266 * 2266 *
2267 * SiS 900 uses the most sigificant 7 bits to index a 128 bits multicast 2267 * SiS 900 uses the most sigificant 7 bits to index a 128 bits multicast
2268 * hash table, which makes this function a little bit different from other drivers 2268 * hash table, which makes this function a little bit different from other drivers
2269 * SiS 900 B0 & 635 M/B uses the most significat 8 bits to index 256 bits 2269 * SiS 900 B0 & 635 M/B uses the most significat 8 bits to index 256 bits
2270 * multicast hash table. 2270 * multicast hash table.
2271 */ 2271 */
2272 2272
2273static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision) 2273static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision)
@@ -2283,7 +2283,7 @@ static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision)
2283} 2283}
2284 2284
2285/** 2285/**
2286 * set_rx_mode - Set SiS900 receive mode 2286 * set_rx_mode - Set SiS900 receive mode
2287 * @net_dev: the net device to be set 2287 * @net_dev: the net device to be set
2288 * 2288 *
2289 * Set SiS900 receive mode for promiscuous, multicast, or broadcast mode. 2289 * Set SiS900 receive mode for promiscuous, multicast, or broadcast mode.
@@ -2359,7 +2359,7 @@ static void set_rx_mode(struct net_device *net_dev)
2359} 2359}
2360 2360
2361/** 2361/**
2362 * sis900_reset - Reset sis900 MAC 2362 * sis900_reset - Reset sis900 MAC
2363 * @net_dev: the net device to reset 2363 * @net_dev: the net device to reset
2364 * 2364 *
2365 * reset sis900 MAC and wait until finished 2365 * reset sis900 MAC and wait until finished
@@ -2379,7 +2379,7 @@ static void sis900_reset(struct net_device *net_dev)
2379 outl(0, ioaddr + rfcr); 2379 outl(0, ioaddr + rfcr);
2380 2380
2381 outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr); 2381 outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr);
2382 2382
2383 /* Check that the chip has finished the reset. */ 2383 /* Check that the chip has finished the reset. */
2384 while (status && (i++ < 1000)) { 2384 while (status && (i++ < 1000)) {
2385 status ^= (inl(isr + ioaddr) & status); 2385 status ^= (inl(isr + ioaddr) & status);
@@ -2393,7 +2393,7 @@ static void sis900_reset(struct net_device *net_dev)
2393} 2393}
2394 2394
2395/** 2395/**
2396 * sis900_remove - Remove sis900 device 2396 * sis900_remove - Remove sis900 device
2397 * @pci_dev: the pci device to be removed 2397 * @pci_dev: the pci device to be removed
2398 * 2398 *
2399 * remove and release SiS900 net device 2399 * remove and release SiS900 net device