Lines Matching +full:need +full:- +full:phy +full:- +full:for +full:- +full:wake
1 /* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
17 SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
21 Rev 1.08.09 Sep. 19 2005 Daniele Venzano add Wake on LAN support
22 Rev 1.08.08 Jan. 22 2005 Daniele Venzano use netif_msg for debugging messages
24 Rev 1.08.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeout & add SiS963 support
25 Rev 1.08.05 Jun. 6 2002 Mufasa Yang bug fix for read_eeprom & Tx descriptor over-boundary
28 Rev 1.08.02 Nov. 30 2001 Hui-Fen Hsu workaround for EDB & bug fix for dhcp problem
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
31 …Rev 1.07.11 Apr. 2 2001 Hui-Fen Hsu updates PCI drivers to use the new pci_set_dma_mask for kerne…
32 Rev 1.07.10 Mar. 1 2001 Hui-Fen Hsu <hfhsu@sis.com.tw> some bug fix & 635M/B 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 workaro…
38 Rev 1.07.04 Sep. 6 2000 Lei-Chun Chang added ICS1893 PHY support
39 …Rev 1.07.03 Aug. 24 2000 Lei-Chun Chang (lcchang@sis.com.tw) modified 630E equalizer workaround ru…
40 Rev 1.07.01 Aug. 08 2000 Ollie Lho minor update for SiS 630E and SiS 630E A1
42 Rev 1.06.04 Feb. 11 2000 Jeff Garzik <jgarzik@pobox.com> softnet and init for kernel 2.4
48 Chin-Shan Li (lcs@sis.com.tw) Added AMD Am79c901 HomePNA PHY support
72 #include <linux/dma-mapping.h>
74 #include <asm/processor.h> /* Processor type for cache alignment. */
90 static int sis900_debug = -1; /* Use SIS900_DEF_MSG as value */
131 { "SiS 900 Internal MII PHY", 0x001d, 0x8000, LAN },
134 { "Altimata AC101LF PHY", 0x0022, 0x5520, LAN },
135 { "ADM 7001 LAN PHY", 0x002e, 0xcc60, LAN },
136 { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN },
137 { "AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, HOME},
138 { "ICS LAN PHY", 0x0015, 0xF440, LAN },
139 { "ICS LAN PHY", 0x0143, 0xBC70, LAN },
140 { "NS 83851 PHY", 0x2000, 0x5C20, MIX },
141 { "NS 83847 PHY", 0x2000, 0x5C30, MIX },
142 { "Realtek RTL8201 PHY", 0x0000, 0x8200, LAN },
143 { "VIA 6103 PHY", 0x0101, 0x8f20, LAN },
175 u8 autong_complete; /* 1: auto-negotiate complete */
179 unsigned int cur_rx, dirty_rx; /* producer/consumer pointers for Tx/Rx ring */
182 /* The saved address of a sent/receive-in-place packet buffer */
241 static void sis900_set_capability( struct net_device *net_dev ,struct mii_phy *phy);
248 * sis900_get_mac_addr - Get MAC address for stand alone SiS900 model
250 * @net_dev: the net device to get address for
253 * MAC address is read from read_eeprom() into @net_dev->dev_addr.
260 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_get_mac_addr()
273 for (i = 0; i < 3; i++) in sis900_get_mac_addr()
274 ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr); in sis900_get_mac_addr()
280 * sis630e_get_mac_addr - Get MAC address for SiS630E model
282 * @net_dev: the net device to get address for
286 * MAC address is read into @net_dev->dev_addr.
307 for (i = 0; i < 6; i++) { in sis630e_get_mac_addr()
309 ((u8 *)(net_dev->dev_addr))[i] = inb(0x71); in sis630e_get_mac_addr()
320 * sis635_get_mac_addr - Get MAC address for SIS635 model
322 * @net_dev: the net device to get address for
326 * @net_dev->dev_addr.
333 void __iomem *ioaddr = sis_priv->ioaddr; in sis635_get_mac_addr()
346 for (i = 0 ; i < 3 ; i++) { in sis635_get_mac_addr()
348 *( ((u16 *)net_dev->dev_addr) + i) = sr16(rfdr); in sis635_get_mac_addr()
358 * sis96x_get_mac_addr - Get MAC address for SiS962 or SiS963 model
360 * @net_dev: the net device to get address for
365 * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be accessed
370 * MAC address is read into @net_dev->dev_addr.
377 void __iomem *ioaddr = sis_priv->ioaddr; in sis96x_get_mac_addr()
381 for (wait = 0; wait < 2000; wait++) { in sis96x_get_mac_addr()
383 u16 *mac = (u16 *)net_dev->dev_addr; in sis96x_get_mac_addr()
387 for (i = 0; i < 3; i++) in sis96x_get_mac_addr()
415 * sis900_probe - Probe for sis900 device
419 * Check and probe sis900 net device for @pci_dev.
421 * and assign SiS900-specific entries in the device structure.
435 const char *card_name = card_names[pci_id->driver_data]; in sis900_probe()
449 i = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); in sis900_probe()
460 return -ENOMEM; in sis900_probe()
461 SET_NETDEV_DEV(net_dev, &pci_dev->dev); in sis900_probe()
471 ret = -ENOMEM; in sis900_probe()
476 sis_priv->ioaddr = ioaddr; in sis900_probe()
477 sis_priv->pci_dev = pci_dev; in sis900_probe()
478 spin_lock_init(&sis_priv->lock); in sis900_probe()
480 sis_priv->eeprom_size = 24; in sis900_probe()
484 ring_space = dma_alloc_coherent(&pci_dev->dev, TX_TOTAL_SIZE, in sis900_probe()
487 ret = -ENOMEM; in sis900_probe()
490 sis_priv->tx_ring = ring_space; in sis900_probe()
491 sis_priv->tx_ring_dma = ring_dma; in sis900_probe()
493 ring_space = dma_alloc_coherent(&pci_dev->dev, RX_TOTAL_SIZE, in sis900_probe()
496 ret = -ENOMEM; in sis900_probe()
499 sis_priv->rx_ring = ring_space; in sis900_probe()
500 sis_priv->rx_ring_dma = ring_dma; in sis900_probe()
502 /* The SiS900-specific entries in the device structure. */ in sis900_probe()
503 net_dev->netdev_ops = &sis900_netdev_ops; in sis900_probe()
504 net_dev->watchdog_timeo = TX_TIMEOUT; in sis900_probe()
505 net_dev->ethtool_ops = &sis900_ethtool_ops; in sis900_probe()
508 sis_priv->msg_enable = sis900_debug; in sis900_probe()
510 sis_priv->msg_enable = SIS900_DEF_MSG; in sis900_probe()
512 sis_priv->mii_info.dev = net_dev; in sis900_probe()
513 sis_priv->mii_info.mdio_read = mdio_read; in sis900_probe()
514 sis_priv->mii_info.mdio_write = mdio_write; in sis900_probe()
515 sis_priv->mii_info.phy_id_mask = 0x1f; in sis900_probe()
516 sis_priv->mii_info.reg_num_mask = 0x1f; in sis900_probe()
519 sis_priv->chipset_rev = pci_dev->revision; in sis900_probe()
523 dev_name, sis_priv->chipset_rev); in sis900_probe()
526 if (sis_priv->chipset_rev == SIS630E_900_REV) in sis900_probe()
528 else if ((sis_priv->chipset_rev > 0x81) && (sis_priv->chipset_rev <= 0x90) ) in sis900_probe()
530 else if (sis_priv->chipset_rev == SIS96x_900_REV) in sis900_probe()
535 if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) { in sis900_probe()
541 /* 630ET : set the mii access mode as software-mode */ in sis900_probe()
542 if (sis_priv->chipset_rev == SIS630ET_900_REV) in sis900_probe()
545 /* probe for mii transceiver */ in sis900_probe()
549 ret = -ENODEV; in sis900_probe()
556 sis_priv->host_bridge_rev = dev->revision; in sis900_probe()
566 net_dev->name, card_name, ioaddr, pci_dev->irq, in sis900_probe()
567 net_dev->dev_addr); in sis900_probe()
569 /* Detect Wake on Lan support */ in sis900_probe()
572 printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name); in sis900_probe()
577 dma_free_coherent(&pci_dev->dev, RX_TOTAL_SIZE, sis_priv->rx_ring, in sis900_probe()
578 sis_priv->rx_ring_dma); in sis900_probe()
580 dma_free_coherent(&pci_dev->dev, TX_TOTAL_SIZE, sis_priv->tx_ring, in sis900_probe()
581 sis_priv->tx_ring_dma); in sis900_probe()
590 * sis900_mii_probe - Probe MII PHY for sis900
591 * @net_dev: the net device to probe for
593 * Search for total of 32 possible mii phy addresses.
594 * Identify and set current phy if found one,
601 const char *dev_name = pci_name(sis_priv->pci_dev); in sis900_mii_probe()
606 sis_priv->mii = NULL; in sis900_mii_probe()
608 /* search for total of 32 possible mii phy addresses */ in sis900_mii_probe()
609 for (phy_addr = 0; phy_addr < 32; phy_addr++) { in sis900_mii_probe()
615 for(i = 0; i < 2; i++) in sis900_mii_probe()
627 mii_phy = sis_priv->first_mii; in sis900_mii_probe()
629 struct mii_phy *phy; in sis900_mii_probe() local
630 phy = mii_phy; in sis900_mii_probe()
631 mii_phy = mii_phy->next; in sis900_mii_probe()
632 kfree(phy); in sis900_mii_probe()
637 mii_phy->phy_id0 = mdio_read(net_dev, phy_addr, MII_PHY_ID0); in sis900_mii_probe()
638 mii_phy->phy_id1 = mdio_read(net_dev, phy_addr, MII_PHY_ID1); in sis900_mii_probe()
639 mii_phy->phy_addr = phy_addr; in sis900_mii_probe()
640 mii_phy->status = mii_status; in sis900_mii_probe()
641 mii_phy->next = sis_priv->mii; in sis900_mii_probe()
642 sis_priv->mii = mii_phy; in sis900_mii_probe()
643 sis_priv->first_mii = mii_phy; in sis900_mii_probe()
645 for (i = 0; mii_chip_table[i].phy_id1; i++) in sis900_mii_probe()
646 if ((mii_phy->phy_id0 == mii_chip_table[i].phy_id0 ) && in sis900_mii_probe()
647 ((mii_phy->phy_id1 & 0xFFF0) == mii_chip_table[i].phy_id1)){ in sis900_mii_probe()
648 mii_phy->phy_types = mii_chip_table[i].phy_types; in sis900_mii_probe()
650 mii_phy->phy_types = in sis900_mii_probe()
661 printk(KERN_INFO "%s: Unknown PHY transceiver found at address %d.\n", in sis900_mii_probe()
663 mii_phy->phy_types = UNKNOWN; in sis900_mii_probe()
667 if (sis_priv->mii == NULL) { in sis900_mii_probe()
672 /* select default PHY for mac */ in sis900_mii_probe()
673 sis_priv->mii = NULL; in sis900_mii_probe()
676 /* Reset phy if default phy is internal sis900 */ in sis900_mii_probe()
677 if ((sis_priv->mii->phy_id0 == 0x001D) && in sis900_mii_probe()
678 ((sis_priv->mii->phy_id1&0xFFF0) == 0x8000)) in sis900_mii_probe()
679 status = sis900_reset_phy(net_dev, sis_priv->cur_phy); in sis900_mii_probe()
681 /* workaround for ICS1893 PHY */ in sis900_mii_probe()
682 if ((sis_priv->mii->phy_id0 == 0x0015) && in sis900_mii_probe()
683 ((sis_priv->mii->phy_id1&0xFFF0) == 0xF440)) in sis900_mii_probe()
684 mdio_write(net_dev, sis_priv->cur_phy, 0x0018, 0xD200); in sis900_mii_probe()
690 poll_bit ^= (mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS) & poll_bit); in sis900_mii_probe()
692 printk(KERN_WARNING "%s: reset phy and link down now\n", in sis900_mii_probe()
694 return -ETIME; in sis900_mii_probe()
699 if (sis_priv->chipset_rev == SIS630E_900_REV) { in sis900_mii_probe()
700 /* SiS 630E has some bugs on default value of PHY registers */ in sis900_mii_probe()
701 mdio_write(net_dev, sis_priv->cur_phy, MII_ANADV, 0x05e1); in sis900_mii_probe()
702 mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG1, 0x22); in sis900_mii_probe()
703 mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG2, 0xff00); in sis900_mii_probe()
704 mdio_write(net_dev, sis_priv->cur_phy, MII_MASK, 0xffc0); in sis900_mii_probe()
705 //mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, 0x1000); in sis900_mii_probe()
708 if (sis_priv->mii->status & MII_STAT_LINK) in sis900_mii_probe()
717 * sis900_default_phy - Select default PHY for sis900 mac.
718 * @net_dev: the net device to probe for
720 * Select first detected PHY with link as default.
721 * If no one is link on, select PHY whose types is HOME as default.
728 struct mii_phy *phy = NULL, *phy_home = NULL, in sis900_default_phy() local
732 for (phy=sis_priv->first_mii; phy; phy=phy->next) { in sis900_default_phy()
733 status = mdio_read(net_dev, phy->phy_addr, MII_STATUS); in sis900_default_phy()
734 status = mdio_read(net_dev, phy->phy_addr, MII_STATUS); in sis900_default_phy()
736 /* Link ON & Not select default PHY & not ghost PHY */ in sis900_default_phy()
738 (phy->phy_types != UNKNOWN)) { in sis900_default_phy()
739 default_phy = phy; in sis900_default_phy()
741 status = mdio_read(net_dev, phy->phy_addr, MII_CONTROL); in sis900_default_phy()
742 mdio_write(net_dev, phy->phy_addr, MII_CONTROL, in sis900_default_phy()
744 if (phy->phy_types == HOME) in sis900_default_phy()
745 phy_home = phy; in sis900_default_phy()
746 else if(phy->phy_types == LAN) in sis900_default_phy()
747 phy_lan = phy; in sis900_default_phy()
756 default_phy = sis_priv->first_mii; in sis900_default_phy()
758 if (sis_priv->mii != default_phy) { in sis900_default_phy()
759 sis_priv->mii = default_phy; in sis900_default_phy()
760 sis_priv->cur_phy = default_phy->phy_addr; in sis900_default_phy()
762 pci_name(sis_priv->pci_dev), sis_priv->cur_phy); in sis900_default_phy()
765 sis_priv->mii_info.phy_id = sis_priv->cur_phy; in sis900_default_phy()
767 status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL); in sis900_default_phy()
770 mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, status); in sis900_default_phy()
771 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); in sis900_default_phy()
772 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); in sis900_default_phy()
779 * sis900_set_capability - set the media capability of network adapter.
780 * @net_dev : the net device to probe for
781 * @phy : default PHY
784 * mii status register. It's necessary before auto-negotiate.
787 static void sis900_set_capability(struct net_device *net_dev, struct mii_phy *phy) in sis900_set_capability() argument
791 mdio_read(net_dev, phy->phy_addr, MII_STATUS); in sis900_set_capability()
792 mdio_read(net_dev, phy->phy_addr, MII_STATUS); in sis900_set_capability()
795 ((phy->status & MII_STAT_CAN_TX_FDX)? MII_NWAY_TX_FDX:0) | in sis900_set_capability()
796 ((phy->status & MII_STAT_CAN_TX) ? MII_NWAY_TX:0) | in sis900_set_capability()
797 ((phy->status & MII_STAT_CAN_T_FDX) ? MII_NWAY_T_FDX:0)| in sis900_set_capability()
798 ((phy->status & MII_STAT_CAN_T) ? MII_NWAY_T:0); in sis900_set_capability()
800 mdio_write(net_dev, phy->phy_addr, MII_ANADV, cap); in sis900_set_capability()
808 * read_eeprom - Read Serial EEPROM
828 for (i = 8; i >= 0; i--) { in read_eeprom()
839 /* read the 16-bits data in */ in read_eeprom()
840 for (i = 16; i > 0; i--) { in read_eeprom()
856 /* Read and write the MII management registers using software-generated
863 void __iomem *ioaddr = sp->ioaddr; in mdio_idle()
873 void __iomem *ioaddr = sp->ioaddr; in mdio_reset()
876 for (i = 31; i >= 0; i--) { in mdio_reset()
885 * mdio_read - read MII PHY register
887 * @phy_id: the phy address to read
888 * @location: the phy register id to read
899 void __iomem *ioaddr = sp->ioaddr; in mdio_read()
906 for (i = 15; i >= 0; i--) { in mdio_read()
916 for (i = 16; i > 0; i--) { in mdio_read()
929 * mdio_write - write MII PHY register
931 * @phy_id: the phy address to write
932 * @location: the phy register id to write
945 void __iomem *ioaddr = sp->ioaddr; in mdio_write()
952 for (i = 15; i >= 0; i--) { in mdio_write()
963 for (i = 15; i >= 0; i--) { in mdio_write()
974 for (i = 2; i > 0; i--) { in mdio_write()
985 * sis900_reset_phy - reset sis900 mii phy.
987 * @phy_addr: default phy address
989 * Some specific phy can't work properly without reset.
999 for (i = 0; i < 2; i++) in sis900_reset_phy()
1009 * Polling 'interrupt' - used by things like netconsole to send skbs
1010 * without having to re-enable interrupts. It's not called while
1016 const int irq = sp->pci_dev->irq; in sis900_poll()
1025 * sis900_open - open sis900 device
1036 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_open()
1043 sis630_set_eq(net_dev, sis_priv->chipset_rev); in sis900_open()
1045 ret = request_irq(sis_priv->pci_dev->irq, sis900_interrupt, IRQF_SHARED, in sis900_open()
1046 net_dev->name, net_dev); in sis900_open()
1059 /* Workaround for EDB */ in sis900_open()
1067 sis900_check_mode(net_dev, sis_priv->mii); in sis900_open()
1069 /* Set the timer to switch to check for link beat and perhaps switch in sis900_open()
1071 timer_setup(&sis_priv->timer, sis900_timer, 0); in sis900_open()
1072 sis_priv->timer.expires = jiffies + HZ; in sis900_open()
1073 add_timer(&sis_priv->timer); in sis900_open()
1079 * sis900_init_rxfilter - Initialize the Rx filter
1080 * @net_dev: the net device to initialize for
1090 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_init_rxfilter()
1100 for (i = 0 ; i < 3 ; i++) { in sis900_init_rxfilter()
1101 u32 w = (u32) *((u16 *)(net_dev->dev_addr)+i); in sis900_init_rxfilter()
1108 net_dev->name, i, sr32(rfdr)); in sis900_init_rxfilter()
1117 * sis900_init_tx_ring - Initialize the Tx descriptor ring
1118 * @net_dev: the net device to initialize for
1127 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_init_tx_ring()
1130 sis_priv->tx_full = 0; in sis900_init_tx_ring()
1131 sis_priv->dirty_tx = sis_priv->cur_tx = 0; in sis900_init_tx_ring()
1133 for (i = 0; i < NUM_TX_DESC; i++) { in sis900_init_tx_ring()
1134 sis_priv->tx_skbuff[i] = NULL; in sis900_init_tx_ring()
1136 sis_priv->tx_ring[i].link = sis_priv->tx_ring_dma + in sis900_init_tx_ring()
1138 sis_priv->tx_ring[i].cmdsts = 0; in sis900_init_tx_ring()
1139 sis_priv->tx_ring[i].bufptr = 0; in sis900_init_tx_ring()
1143 sw32(txdp, sis_priv->tx_ring_dma); in sis900_init_tx_ring()
1146 net_dev->name, sr32(txdp)); in sis900_init_tx_ring()
1150 * sis900_init_rx_ring - Initialize the Rx descriptor ring
1151 * @net_dev: the net device to initialize for
1154 * and pre-allocate receive buffers (socket buffer)
1161 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_init_rx_ring()
1164 sis_priv->cur_rx = 0; in sis900_init_rx_ring()
1165 sis_priv->dirty_rx = 0; in sis900_init_rx_ring()
1168 for (i = 0; i < NUM_RX_DESC; i++) { in sis900_init_rx_ring()
1169 sis_priv->rx_skbuff[i] = NULL; in sis900_init_rx_ring()
1171 sis_priv->rx_ring[i].link = sis_priv->rx_ring_dma + in sis900_init_rx_ring()
1173 sis_priv->rx_ring[i].cmdsts = 0; in sis900_init_rx_ring()
1174 sis_priv->rx_ring[i].bufptr = 0; in sis900_init_rx_ring()
1178 for (i = 0; i < NUM_RX_DESC; i++) { in sis900_init_rx_ring()
1182 /* not enough memory for skbuff, this makes a "hole" in sis900_init_rx_ring()
1188 sis_priv->rx_skbuff[i] = skb; in sis900_init_rx_ring()
1189 sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; in sis900_init_rx_ring()
1190 sis_priv->rx_ring[i].bufptr = dma_map_single(&sis_priv->pci_dev->dev, in sis900_init_rx_ring()
1191 skb->data, in sis900_init_rx_ring()
1194 if (unlikely(dma_mapping_error(&sis_priv->pci_dev->dev, in sis900_init_rx_ring()
1195 sis_priv->rx_ring[i].bufptr))) { in sis900_init_rx_ring()
1197 sis_priv->rx_skbuff[i] = NULL; in sis900_init_rx_ring()
1201 sis_priv->dirty_rx = (unsigned int) (i - NUM_RX_DESC); in sis900_init_rx_ring()
1204 sw32(rxdp, sis_priv->rx_ring_dma); in sis900_init_rx_ring()
1207 net_dev->name, sr32(rxdp)); in sis900_init_rx_ring()
1211 * sis630_set_eq - set phy equalizer value for 630 LAN
1216 * PHY register 14h(Test)
1217 * Bit 14: 0 -- Automatically detect (default)
1218 * 1 -- Manually set Equalizer filter
1219 * Bit 13: 0 -- (Default)
1220 * 1 -- Speed up convergence of equalizer setting
1221 * Bit 9 : 0 -- (Default)
1222 * 1 -- Disable Baseline Wander
1223 * Bit 3~7 -- Equalizer filter setting
1229 * When Link is ON and Bit 14 is 0, SIS900PHY will auto-detect proper equalizer value.
1232 * 0 <= max <= 4 --> set equalizer to max
1233 * 5 <= max <= 14 --> set equalizer to max+1 or set equalizer to max+2 if max == min
1234 * max >= 15 --> set equalizer to max+5 or set equalizer to max+6 if max == min
1248 reg14h = mdio_read(net_dev, sis_priv->cur_phy, MII_RESV); in sis630_set_eq()
1249 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, in sis630_set_eq()
1251 for (i=0; i < maxcount; i++) { in sis630_set_eq()
1253 sis_priv->cur_phy, MII_RESV)) >> 3; in sis630_set_eq()
1275 (sis_priv->host_bridge_rev == SIS630B0 || in sis630_set_eq()
1276 sis_priv->host_bridge_rev == SIS630B1)) { in sis630_set_eq()
1283 reg14h = mdio_read(net_dev, sis_priv->cur_phy, MII_RESV); in sis630_set_eq()
1286 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, reg14h); in sis630_set_eq()
1288 reg14h = mdio_read(net_dev, sis_priv->cur_phy, MII_RESV); in sis630_set_eq()
1290 (sis_priv->host_bridge_rev == SIS630B0 || in sis630_set_eq()
1291 sis_priv->host_bridge_rev == SIS630B1)) in sis630_set_eq()
1292 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, in sis630_set_eq()
1295 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, in sis630_set_eq()
1301 * sis900_timer - sis900 timer routine
1311 struct net_device *net_dev = sis_priv->mii_info.dev; in sis900_timer()
1312 struct mii_phy *mii_phy = sis_priv->mii; in sis900_timer()
1317 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); in sis900_timer()
1318 status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS); in sis900_timer()
1320 /* Link OFF -> ON */ in sis900_timer()
1323 /* Search for new PHY */ in sis900_timer()
1325 mii_phy = sis_priv->mii; in sis900_timer()
1333 sis630_set_eq(net_dev, sis_priv->chipset_rev); in sis900_timer()
1338 /* Link ON -> OFF */ in sis900_timer()
1342 printk(KERN_INFO "%s: Media Link Off\n", net_dev->name); in sis900_timer()
1345 if ((mii_phy->phy_id0 == 0x001D) && in sis900_timer()
1346 ((mii_phy->phy_id1 & 0xFFF0) == 0x8000)) in sis900_timer()
1347 sis900_reset_phy(net_dev, sis_priv->cur_phy); in sis900_timer()
1349 sis630_set_eq(net_dev, sis_priv->chipset_rev); in sis900_timer()
1355 sis_priv->timer.expires = jiffies + next_tick; in sis900_timer()
1356 add_timer(&sis_priv->timer); in sis900_timer()
1360 * sis900_check_mode - check the media mode for sis900
1362 * @mii_phy: the mii phy
1365 * register. Now we set our media capability and auto-negotiate
1367 * If the types of mii phy is HOME, it doesn't need to auto-negotiate
1374 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_check_mode()
1377 if (mii_phy->phy_types == LAN) { in sis900_check_mode()
1380 sis900_auto_negotiate(net_dev, sis_priv->cur_phy); in sis900_check_mode()
1386 sis_priv->autong_complete = 1; in sis900_check_mode()
1391 * sis900_set_mode - Set the media mode of mac register.
1397 * speed and duplex of phy. Bit EDB_MASTER_EN indicates the EDB
1399 * Max DMA Burst Size for TX/RX DMA should be no larger than 16
1405 void __iomem *ioaddr = sp->ioaddr; in sis900_set_mode()
1441 * sis900_auto_negotiate - Set the Auto-Negotiation Enable/Reset bit.
1442 * @net_dev: the net device to read mode for
1443 * @phy_addr: mii phy address
1445 * If the adapter is link-on, set the auto-negotiate enable/reset bit.
1446 * autong_complete should be set to 0 when starting auto-negotiation.
1447 * autong_complete should be set to 1 if we didn't start auto-negotiation.
1448 * sis900_timer will wait for link on again if autong_complete = 0.
1457 for (i = 0; i < 2; i++) in sis900_auto_negotiate()
1462 printk(KERN_INFO "%s: Media Link Off\n", net_dev->name); in sis900_auto_negotiate()
1463 sis_priv->autong_complete = 1; in sis900_auto_negotiate()
1471 sis_priv->autong_complete = 0; in sis900_auto_negotiate()
1476 * sis900_read_mode - read media mode for sis900 internal phy
1477 * @net_dev: the net device to read mode for
1482 * after auto-negotiation. Use AND operation to get the upper bound
1489 struct mii_phy *phy = sis_priv->mii; in sis900_read_mode() local
1490 int phy_addr = sis_priv->cur_phy; in sis900_read_mode()
1495 for (i = 0; i < 2; i++) in sis900_read_mode()
1514 sis_priv->autong_complete = 1; in sis900_read_mode()
1516 /* Workaround for Realtek RTL8201 PHY issue */ in sis900_read_mode()
1517 if ((phy->phy_id0 == 0x0000) && ((phy->phy_id1 & 0xFFF0) == 0x8200)) { in sis900_read_mode()
1525 printk(KERN_INFO "%s: Media Link On %s %s-duplex\n", in sis900_read_mode()
1526 net_dev->name, in sis900_read_mode()
1534 * sis900_tx_timeout - sis900 transmit timeout routine
1545 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_tx_timeout()
1551 net_dev->name, sr32(cr), sr32(isr)); in sis900_tx_timeout()
1558 spin_lock_irqsave(&sis_priv->lock, flags); in sis900_tx_timeout()
1561 sis_priv->dirty_tx = sis_priv->cur_tx = 0; in sis900_tx_timeout()
1562 for (i = 0; i < NUM_TX_DESC; i++) { in sis900_tx_timeout()
1563 struct sk_buff *skb = sis_priv->tx_skbuff[i]; in sis900_tx_timeout()
1566 dma_unmap_single(&sis_priv->pci_dev->dev, in sis900_tx_timeout()
1567 sis_priv->tx_ring[i].bufptr, in sis900_tx_timeout()
1568 skb->len, DMA_TO_DEVICE); in sis900_tx_timeout()
1570 sis_priv->tx_skbuff[i] = NULL; in sis900_tx_timeout()
1571 sis_priv->tx_ring[i].cmdsts = 0; in sis900_tx_timeout()
1572 sis_priv->tx_ring[i].bufptr = 0; in sis900_tx_timeout()
1573 net_dev->stats.tx_dropped++; in sis900_tx_timeout()
1576 sis_priv->tx_full = 0; in sis900_tx_timeout()
1579 spin_unlock_irqrestore(&sis_priv->lock, flags); in sis900_tx_timeout()
1584 sw32(txdp, sis_priv->tx_ring_dma); in sis900_tx_timeout()
1591 * sis900_start_xmit - sis900 start transmit routine
1604 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_start_xmit()
1610 spin_lock_irqsave(&sis_priv->lock, flags); in sis900_start_xmit()
1613 entry = sis_priv->cur_tx % NUM_TX_DESC; in sis900_start_xmit()
1614 sis_priv->tx_skbuff[entry] = skb; in sis900_start_xmit()
1617 sis_priv->tx_ring[entry].bufptr = dma_map_single(&sis_priv->pci_dev->dev, in sis900_start_xmit()
1618 skb->data, skb->len, in sis900_start_xmit()
1620 if (unlikely(dma_mapping_error(&sis_priv->pci_dev->dev, in sis900_start_xmit()
1621 sis_priv->tx_ring[entry].bufptr))) { in sis900_start_xmit()
1623 sis_priv->tx_skbuff[entry] = NULL; in sis900_start_xmit()
1624 net_dev->stats.tx_dropped++; in sis900_start_xmit()
1625 spin_unlock_irqrestore(&sis_priv->lock, flags); in sis900_start_xmit()
1628 sis_priv->tx_ring[entry].cmdsts = (OWN | INTR | skb->len); in sis900_start_xmit()
1631 sis_priv->cur_tx ++; in sis900_start_xmit()
1632 index_cur_tx = sis_priv->cur_tx; in sis900_start_xmit()
1633 index_dirty_tx = sis_priv->dirty_tx; in sis900_start_xmit()
1635 for (count_dirty_tx = 0; index_cur_tx != index_dirty_tx; index_dirty_tx++) in sis900_start_xmit()
1640 sis_priv->tx_full = 1; in sis900_start_xmit()
1647 sis_priv->tx_full = 1; in sis900_start_xmit()
1651 spin_unlock_irqrestore(&sis_priv->lock, flags); in sis900_start_xmit()
1656 net_dev->name, skb->data, (int)skb->len, entry); in sis900_start_xmit()
1662 * sis900_interrupt - sis900 interrupt handler
1675 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_interrupt()
1679 spin_lock (&sis_priv->lock); in sis900_interrupt()
1689 /* why dow't we break after Tx/Rx case ?? keyword: full-duplex */ in sis900_interrupt()
1702 "status %#8.8x.\n", net_dev->name, status); in sis900_interrupt()
1705 if (--boguscnt < 0) { in sis900_interrupt()
1709 net_dev->name, status); in sis900_interrupt()
1717 net_dev->name, sr32(isr)); in sis900_interrupt()
1719 spin_unlock (&sis_priv->lock); in sis900_interrupt()
1724 * sis900_rx - sis900 receive routine
1736 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_rx()
1737 unsigned int entry = sis_priv->cur_rx % NUM_RX_DESC; in sis900_rx()
1738 u32 rx_status = sis_priv->rx_ring[entry].cmdsts; in sis900_rx()
1744 sis_priv->cur_rx, sis_priv->dirty_rx, rx_status); in sis900_rx()
1745 rx_work_limit = sis_priv->dirty_rx + NUM_RX_DESC - sis_priv->cur_rx; in sis900_rx()
1751 if (--rx_work_limit < 0) in sis900_rx()
1755 rx_size = data_size - CRC_SIZE; in sis900_rx()
1768 net_dev->name, rx_status, data_size); in sis900_rx()
1769 net_dev->stats.rx_errors++; in sis900_rx()
1771 net_dev->stats.rx_over_errors++; in sis900_rx()
1773 net_dev->stats.rx_length_errors++; in sis900_rx()
1775 net_dev->stats.rx_frame_errors++; in sis900_rx()
1777 net_dev->stats.rx_crc_errors++; in sis900_rx()
1779 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; in sis900_rx()
1784 dma_unmap_single(&sis_priv->pci_dev->dev, in sis900_rx()
1785 sis_priv->rx_ring[entry].bufptr, in sis900_rx()
1789 * memory for new socket buffer ?? */ in sis900_rx()
1793 * so we need to recycle the old one so in sis900_rx()
1797 skb = sis_priv->rx_skbuff[entry]; in sis900_rx()
1798 net_dev->stats.rx_dropped++; in sis900_rx()
1804 we are working on NULL sk_buff :-( */ in sis900_rx()
1805 if (sis_priv->rx_skbuff[entry] == NULL) { in sis900_rx()
1810 net_dev->name, sis_priv->cur_rx, in sis900_rx()
1811 sis_priv->dirty_rx); in sis900_rx()
1817 rx_skb = sis_priv->rx_skbuff[entry]; in sis900_rx()
1819 rx_skb->protocol = eth_type_trans(rx_skb, net_dev); in sis900_rx()
1824 net_dev->stats.multicast++; in sis900_rx()
1825 net_dev->stats.rx_bytes += rx_size; in sis900_rx()
1826 net_dev->stats.rx_packets++; in sis900_rx()
1827 sis_priv->dirty_rx++; in sis900_rx()
1829 sis_priv->rx_skbuff[entry] = skb; in sis900_rx()
1830 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; in sis900_rx()
1831 sis_priv->rx_ring[entry].bufptr = in sis900_rx()
1832 dma_map_single(&sis_priv->pci_dev->dev, in sis900_rx()
1833 skb->data, RX_BUF_SIZE, in sis900_rx()
1835 if (unlikely(dma_mapping_error(&sis_priv->pci_dev->dev, in sis900_rx()
1836 sis_priv->rx_ring[entry].bufptr))) { in sis900_rx()
1838 sis_priv->rx_skbuff[entry] = NULL; in sis900_rx()
1842 sis_priv->cur_rx++; in sis900_rx()
1843 entry = sis_priv->cur_rx % NUM_RX_DESC; in sis900_rx()
1844 rx_status = sis_priv->rx_ring[entry].cmdsts; in sis900_rx()
1849 for (; sis_priv->cur_rx != sis_priv->dirty_rx; sis_priv->dirty_rx++) { in sis900_rx()
1852 entry = sis_priv->dirty_rx % NUM_RX_DESC; in sis900_rx()
1854 if (sis_priv->rx_skbuff[entry] == NULL) { in sis900_rx()
1857 /* not enough memory for skbuff, this makes a in sis900_rx()
1861 net_dev->stats.rx_dropped++; in sis900_rx()
1864 sis_priv->rx_skbuff[entry] = skb; in sis900_rx()
1865 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; in sis900_rx()
1866 sis_priv->rx_ring[entry].bufptr = in sis900_rx()
1867 dma_map_single(&sis_priv->pci_dev->dev, in sis900_rx()
1868 skb->data, RX_BUF_SIZE, in sis900_rx()
1870 if (unlikely(dma_mapping_error(&sis_priv->pci_dev->dev, in sis900_rx()
1871 sis_priv->rx_ring[entry].bufptr))) { in sis900_rx()
1873 sis_priv->rx_skbuff[entry] = NULL; in sis900_rx()
1878 /* re-enable the potentially idle receive state matchine */ in sis900_rx()
1885 * sis900_finish_xmit - finish up transmission of packets
1888 * Check for error condition and free socket buffer etc
1889 * schedule for more transmission as needed
1898 for (; sis_priv->dirty_tx != sis_priv->cur_tx; sis_priv->dirty_tx++) { in sis900_finish_xmit()
1903 entry = sis_priv->dirty_tx % NUM_TX_DESC; in sis900_finish_xmit()
1904 tx_status = sis_priv->tx_ring[entry].cmdsts; in sis900_finish_xmit()
1918 net_dev->name, tx_status); in sis900_finish_xmit()
1919 net_dev->stats.tx_errors++; in sis900_finish_xmit()
1921 net_dev->stats.tx_fifo_errors++; in sis900_finish_xmit()
1923 net_dev->stats.tx_aborted_errors++; in sis900_finish_xmit()
1925 net_dev->stats.tx_carrier_errors++; in sis900_finish_xmit()
1927 net_dev->stats.tx_window_errors++; in sis900_finish_xmit()
1930 net_dev->stats.collisions += (tx_status & COLCNT) >> 16; in sis900_finish_xmit()
1931 net_dev->stats.tx_bytes += tx_status & DSIZE; in sis900_finish_xmit()
1932 net_dev->stats.tx_packets++; in sis900_finish_xmit()
1935 skb = sis_priv->tx_skbuff[entry]; in sis900_finish_xmit()
1936 dma_unmap_single(&sis_priv->pci_dev->dev, in sis900_finish_xmit()
1937 sis_priv->tx_ring[entry].bufptr, skb->len, in sis900_finish_xmit()
1940 sis_priv->tx_skbuff[entry] = NULL; in sis900_finish_xmit()
1941 sis_priv->tx_ring[entry].bufptr = 0; in sis900_finish_xmit()
1942 sis_priv->tx_ring[entry].cmdsts = 0; in sis900_finish_xmit()
1945 if (sis_priv->tx_full && netif_queue_stopped(net_dev) && in sis900_finish_xmit()
1946 sis_priv->cur_tx - sis_priv->dirty_tx < NUM_TX_DESC - 4) { in sis900_finish_xmit()
1949 sis_priv->tx_full = 0; in sis900_finish_xmit()
1955 * sis900_close - close sis900 device
1965 struct pci_dev *pdev = sis_priv->pci_dev; in sis900_close()
1966 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_close()
1979 del_timer(&sis_priv->timer); in sis900_close()
1981 free_irq(pdev->irq, net_dev); in sis900_close()
1984 for (i = 0; i < NUM_RX_DESC; i++) { in sis900_close()
1985 skb = sis_priv->rx_skbuff[i]; in sis900_close()
1987 dma_unmap_single(&pdev->dev, in sis900_close()
1988 sis_priv->rx_ring[i].bufptr, in sis900_close()
1991 sis_priv->rx_skbuff[i] = NULL; in sis900_close()
1994 for (i = 0; i < NUM_TX_DESC; i++) { in sis900_close()
1995 skb = sis_priv->tx_skbuff[i]; in sis900_close()
1997 dma_unmap_single(&pdev->dev, in sis900_close()
1998 sis_priv->tx_ring[i].bufptr, in sis900_close()
1999 skb->len, DMA_TO_DEVICE); in sis900_close()
2001 sis_priv->tx_skbuff[i] = NULL; in sis900_close()
2005 /* Green! Put the chip in low-power mode. */ in sis900_close()
2011 * sis900_get_drvinfo - Return information about driver
2013 * @info: container for info returned
2015 * Process ethtool command such as "ehtool -i" to show information
2023 strlcpy(info->driver, SIS900_MODULE_NAME, sizeof(info->driver)); in sis900_get_drvinfo()
2024 strlcpy(info->version, SIS900_DRV_VERSION, sizeof(info->version)); in sis900_get_drvinfo()
2025 strlcpy(info->bus_info, pci_name(sis_priv->pci_dev), in sis900_get_drvinfo()
2026 sizeof(info->bus_info)); in sis900_get_drvinfo()
2032 return sis_priv->msg_enable; in sis900_get_msglevel()
2038 sis_priv->msg_enable = value; in sis900_set_msglevel()
2044 return mii_link_ok(&sis_priv->mii_info); in sis900_get_link()
2051 spin_lock_irq(&sis_priv->lock); in sis900_get_link_ksettings()
2052 mii_ethtool_get_link_ksettings(&sis_priv->mii_info, cmd); in sis900_get_link_ksettings()
2053 spin_unlock_irq(&sis_priv->lock); in sis900_get_link_ksettings()
2062 spin_lock_irq(&sis_priv->lock); in sis900_set_link_ksettings()
2063 rt = mii_ethtool_set_link_ksettings(&sis_priv->mii_info, cmd); in sis900_set_link_ksettings()
2064 spin_unlock_irq(&sis_priv->lock); in sis900_set_link_ksettings()
2071 return mii_nway_restart(&sis_priv->mii_info); in sis900_nway_reset()
2075 * sis900_set_wol - Set up Wake on Lan registers
2077 * @wol: container for info passed to the driver
2079 * Process ethtool command "wol" to setup wake on lan features.
2088 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_set_wol()
2091 if (wol->wolopts == 0) { in sis900_set_wol()
2092 pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr); in sis900_set_wol()
2094 pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr); in sis900_set_wol()
2097 printk(KERN_DEBUG "%s: Wake on LAN disabled\n", net_dev->name); in sis900_set_wol()
2101 if (wol->wolopts & (WAKE_MAGICSECURE | WAKE_UCAST | WAKE_MCAST in sis900_set_wol()
2103 return -EINVAL; in sis900_set_wol()
2105 if (wol->wolopts & WAKE_MAGIC) in sis900_set_wol()
2107 if (wol->wolopts & WAKE_PHY) in sis900_set_wol()
2112 pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr); in sis900_set_wol()
2114 pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr); in sis900_set_wol()
2116 printk(KERN_DEBUG "%s: Wake on LAN enabled\n", net_dev->name); in sis900_set_wol()
2124 void __iomem *ioaddr = sp->ioaddr; in sis900_get_wol()
2129 wol->wolopts |= WAKE_MAGIC; in sis900_get_wol()
2131 wol->wolopts |= WAKE_PHY; in sis900_get_wol()
2133 wol->supported = (WAKE_PHY | WAKE_MAGIC); in sis900_get_wol()
2140 return sis_priv->eeprom_size; in sis900_get_eeprom_len()
2146 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_read_eeprom()
2147 int wait, ret = -EAGAIN; in sis900_read_eeprom()
2152 if (sis_priv->chipset_rev == SIS96x_900_REV) { in sis900_read_eeprom()
2154 for (wait = 0; wait < 2000; wait++) { in sis900_read_eeprom()
2157 for (i = 0; i < sis_priv->eeprom_size / 2; i++) in sis900_read_eeprom()
2169 for (i = 0; i < sis_priv->eeprom_size / 2; i++) in sis900_read_eeprom()
2184 eebuf = kmalloc(sis_priv->eeprom_size, GFP_KERNEL); in sis900_get_eeprom()
2186 return -ENOMEM; in sis900_get_eeprom()
2188 eeprom->magic = SIS900_EEPROM_MAGIC; in sis900_get_eeprom()
2189 spin_lock_irq(&sis_priv->lock); in sis900_get_eeprom()
2191 spin_unlock_irq(&sis_priv->lock); in sis900_get_eeprom()
2193 memcpy(data, eebuf + eeprom->offset, eeprom->len); in sis900_get_eeprom()
2213 * mii_ioctl - process MII i/o control command
2214 * @net_dev: the net device to command for
2215 * @rq: parameter for command
2227 case SIOCGMIIPHY: /* Get address of MII PHY in use. */ in mii_ioctl()
2228 data->phy_id = sis_priv->mii->phy_addr; in mii_ioctl()
2231 case SIOCGMIIREG: /* Read MII PHY register. */ in mii_ioctl()
2232 data->val_out = mdio_read(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f); in mii_ioctl()
2235 case SIOCSMIIREG: /* Write MII PHY register. */ in mii_ioctl()
2236 mdio_write(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in); in mii_ioctl()
2239 return -EOPNOTSUPP; in mii_ioctl()
2244 * sis900_set_config - Set media type by net_device.set_config
2245 * @dev: the net device for media type change
2248 * Set media type to 10baseT, 100baseT or 0(for auto) by ifconfig
2256 struct mii_phy *mii_phy = sis_priv->mii; in sis900_set_config()
2260 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) { in sis900_set_config()
2261 /* we switch on the ifmap->port field. I couldn't find anything in sis900_set_config()
2262 * like a definition or standard for the values of that field. in sis900_set_config()
2267 switch(map->port){ in sis900_set_config()
2269 dev->if_port = map->port; in sis900_set_config()
2271 * will be temporary down and we need to reflect that in sis900_set_config()
2274 * all the rest for us */ in sis900_set_config()
2278 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL); in sis900_set_config()
2282 * reset really means, but it sounds for me right to in sis900_set_config()
2284 mdio_write(dev, mii_phy->phy_addr, in sis900_set_config()
2290 dev->if_port = map->port; in sis900_set_config()
2293 * will be temporary down and we need to reflect that in sis900_set_config()
2296 * all the rest for us */ in sis900_set_config()
2301 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL); in sis900_set_config()
2304 mdio_write(dev, mii_phy->phy_addr, in sis900_set_config()
2311 dev->if_port = map->port; in sis900_set_config()
2314 * will be temporary down and we need to reflect that in sis900_set_config()
2317 * all the rest for us */ in sis900_set_config()
2322 status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL); in sis900_set_config()
2323 mdio_write(dev, mii_phy->phy_addr, in sis900_set_config()
2333 return -EOPNOTSUPP; in sis900_set_config()
2336 return -EINVAL; in sis900_set_config()
2343 * sis900_mcast_bitnr - compute hashtable index
2366 * set_rx_mode - Set SiS900 receive mode
2369 * Set SiS900 receive mode for promiscuous, multicast, or broadcast mode.
2371 * Multicast hash table changes from 128 to 256 bits for 635M/B & 900B0.
2377 void __iomem *ioaddr = sis_priv->ioaddr; in set_rx_mode()
2383 if((sis_priv->chipset_rev >= SIS635A_900_REV) || in set_rx_mode()
2384 (sis_priv->chipset_rev == SIS900B_900_REV)) in set_rx_mode()
2389 if (net_dev->flags & IFF_PROMISC) { in set_rx_mode()
2392 for (i = 0; i < table_entries; i++) in set_rx_mode()
2395 (net_dev->flags & IFF_ALLMULTI)) { in set_rx_mode()
2398 for (i = 0; i < table_entries; i++) in set_rx_mode()
2410 bit_nr = sis900_mcast_bitnr(ha->addr, in set_rx_mode()
2411 sis_priv->chipset_rev); in set_rx_mode()
2417 for (i = 0; i < table_entries; i++) { in set_rx_mode()
2418 /* why plus 0x04 ??, That makes the correct value for hash table. */ in set_rx_mode()
2425 /* sis900 is capable of looping back packets at MAC level for in set_rx_mode()
2427 if (net_dev->flags & IFF_LOOPBACK) { in set_rx_mode()
2441 * sis900_reset - Reset sis900 MAC
2446 * change backoff algorithm for 900B0 & 635 M/B
2452 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_reset()
2463 for (i = 0; status && (i < 1000); i++) in sis900_reset()
2466 if (sis_priv->chipset_rev >= SIS635A_900_REV || in sis900_reset()
2467 sis_priv->chipset_rev == SIS900B_900_REV) in sis900_reset()
2474 * sis900_remove - Remove sis900 device
2487 while (sis_priv->first_mii) { in sis900_remove()
2488 struct mii_phy *phy = sis_priv->first_mii; in sis900_remove() local
2490 sis_priv->first_mii = phy->next; in sis900_remove()
2491 kfree(phy); in sis900_remove()
2494 dma_free_coherent(&pci_dev->dev, RX_TOTAL_SIZE, sis_priv->rx_ring, in sis900_remove()
2495 sis_priv->rx_ring_dma); in sis900_remove()
2496 dma_free_coherent(&pci_dev->dev, TX_TOTAL_SIZE, sis_priv->tx_ring, in sis900_remove()
2497 sis_priv->tx_ring_dma); in sis900_remove()
2498 pci_iounmap(pci_dev, sis_priv->ioaddr); in sis900_remove()
2506 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_suspend()
2524 void __iomem *ioaddr = sis_priv->ioaddr; in sis900_resume()
2539 /* Workaround for EDB */ in sis900_resume()
2547 sis900_check_mode(net_dev, sis_priv->mii); in sis900_resume()