···1555 tristate "SiS 900/7016 PCI Fast Ethernet Adapter support"1556 depends on NET_PCI && PCI1557 select CRC3201558 ---help---1559 This is a driver for the Fast Ethernet PCI network cards based on1560 the SiS 900 and SiS 7016 chips. The SiS 900 core is also embedded in
···1555 tristate "SiS 900/7016 PCI Fast Ethernet Adapter support"1556 depends on NET_PCI && PCI1557 select CRC321558+ select MII1559 ---help---1560 This is a driver for the Fast Ethernet PCI network cards based on1561 the SiS 900 and SiS 7016 chips. The SiS 900 core is also embedded in
+49-3
drivers/net/sis900.c
···162 struct mii_phy * mii;163 struct mii_phy * first_mii; /* record the first mii structure */164 unsigned int cur_phy;0165166 struct timer_list timer; /* Link status detection timer. */167 u8 autong_complete; /* 1: auto-negotiate complete */···204static int sis900_mii_probe (struct net_device * net_dev);205static void sis900_init_rxfilter (struct net_device * net_dev);206static u16 read_eeprom(long ioaddr, int location);207-static u16 mdio_read(struct net_device *net_dev, int phy_id, int location);208static void mdio_write(struct net_device *net_dev, int phy_id, int location, int val);209static void sis900_timer(unsigned long data);210static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_phy);···479 sis_priv->msg_enable = sis900_debug;480 else481 sis_priv->msg_enable = SIS900_DEF_MSG;482-000000483 /* Get Mac address according to the chip revision */484 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));485 if(netif_msg_probe(sis_priv))···732 pci_name(sis_priv->pci_dev), sis_priv->cur_phy);733 }73400735 status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL);736 status &= (~MII_CNTL_ISOLATE);737···861 * Please see SiS7014 or ICS spec862 */863864-static u16 mdio_read(struct net_device *net_dev, int phy_id, int location)865{866 long mdio_addr = net_dev->base_addr + mear;867 int mii_cmd = MIIread|(phy_id<<MIIpmdShift)|(location<<MIIregShift);···1975 sis_priv->msg_enable = value;1976}19770000000000000000000000000000000001978static struct ethtool_ops sis900_ethtool_ops = {1979 .get_drvinfo = sis900_get_drvinfo,1980 .get_msglevel = sis900_get_msglevel,1981 .set_msglevel = sis900_set_msglevel,00001982};19831984/**
···162 struct mii_phy * mii;163 struct mii_phy * first_mii; /* record the first mii structure */164 unsigned int cur_phy;165+ struct mii_if_info mii_info;166167 struct timer_list timer; /* Link status detection timer. */168 u8 autong_complete; /* 1: auto-negotiate complete */···203static int sis900_mii_probe (struct net_device * net_dev);204static void sis900_init_rxfilter (struct net_device * net_dev);205static u16 read_eeprom(long ioaddr, int location);206+static int mdio_read(struct net_device *net_dev, int phy_id, int location);207static void mdio_write(struct net_device *net_dev, int phy_id, int location, int val);208static void sis900_timer(unsigned long data);209static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_phy);···478 sis_priv->msg_enable = sis900_debug;479 else480 sis_priv->msg_enable = SIS900_DEF_MSG;481+482+ sis_priv->mii_info.dev = net_dev;483+ sis_priv->mii_info.mdio_read = mdio_read;484+ sis_priv->mii_info.mdio_write = mdio_write;485+ sis_priv->mii_info.phy_id_mask = 0x1f;486+ sis_priv->mii_info.reg_num_mask = 0x1f;487+488 /* Get Mac address according to the chip revision */489 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));490 if(netif_msg_probe(sis_priv))···725 pci_name(sis_priv->pci_dev), sis_priv->cur_phy);726 }727728+ sis_priv->mii_info.phy_id = sis_priv->cur_phy;729+730 status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL);731 status &= (~MII_CNTL_ISOLATE);732···852 * Please see SiS7014 or ICS spec853 */854855+static int mdio_read(struct net_device *net_dev, int phy_id, int location)856{857 long mdio_addr = net_dev->base_addr + mear;858 int mii_cmd = MIIread|(phy_id<<MIIpmdShift)|(location<<MIIregShift);···1966 sis_priv->msg_enable = value;1967}19681969+static u32 sis900_get_link(struct net_device *net_dev)1970+{1971+ struct sis900_private *sis_priv = net_dev->priv;1972+ return mii_link_ok(&sis_priv->mii_info);1973+}1974+1975+static int sis900_get_settings(struct net_device *net_dev,1976+ struct ethtool_cmd *cmd)1977+{1978+ struct sis900_private *sis_priv = net_dev->priv;1979+ spin_lock_irq(&sis_priv->lock);1980+ mii_ethtool_gset(&sis_priv->mii_info, cmd);1981+ spin_unlock_irq(&sis_priv->lock);1982+ return 0;1983+}1984+1985+static int sis900_set_settings(struct net_device *net_dev,1986+ struct ethtool_cmd *cmd)1987+{1988+ struct sis900_private *sis_priv = net_dev->priv;1989+ int rt;1990+ spin_lock_irq(&sis_priv->lock);1991+ rt = mii_ethtool_sset(&sis_priv->mii_info, cmd);1992+ spin_unlock_irq(&sis_priv->lock);1993+ return rt;1994+}1995+1996+static int sis900_nway_reset(struct net_device *net_dev)1997+{1998+ struct sis900_private *sis_priv = net_dev->priv;1999+ return mii_nway_restart(&sis_priv->mii_info);2000+}2001+2002static struct ethtool_ops sis900_ethtool_ops = {2003 .get_drvinfo = sis900_get_drvinfo,2004 .get_msglevel = sis900_get_msglevel,2005 .set_msglevel = sis900_set_msglevel,2006+ .get_link = sis900_get_link,2007+ .get_settings = sis900_get_settings,2008+ .set_settings = sis900_set_settings,2009+ .nway_reset = sis900_nway_reset,2010};20112012/**