···15551555 tristate "SiS 900/7016 PCI Fast Ethernet Adapter support"15561556 depends on NET_PCI && PCI15571557 select CRC3215581558+ select MII15581559 ---help---15591560 This is a driver for the Fast Ethernet PCI network cards based on15601561 the SiS 900 and SiS 7016 chips. The SiS 900 core is also embedded in
+49-3
drivers/net/sis900.c
···162162 struct mii_phy * mii;163163 struct mii_phy * first_mii; /* record the first mii structure */164164 unsigned int cur_phy;165165+ struct mii_if_info mii_info;165166166167 struct timer_list timer; /* Link status detection timer. */167168 u8 autong_complete; /* 1: auto-negotiate complete */···204203static int sis900_mii_probe (struct net_device * net_dev);205204static void sis900_init_rxfilter (struct net_device * net_dev);206205static u16 read_eeprom(long ioaddr, int location);207207-static u16 mdio_read(struct net_device *net_dev, int phy_id, int location);206206+static int mdio_read(struct net_device *net_dev, int phy_id, int location);208207static void mdio_write(struct net_device *net_dev, int phy_id, int location, int val);209208static void sis900_timer(unsigned long data);210209static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_phy);···479478 sis_priv->msg_enable = sis900_debug;480479 else481480 sis_priv->msg_enable = SIS900_DEF_MSG;482482-481481+482482+ sis_priv->mii_info.dev = net_dev;483483+ sis_priv->mii_info.mdio_read = mdio_read;484484+ sis_priv->mii_info.mdio_write = mdio_write;485485+ sis_priv->mii_info.phy_id_mask = 0x1f;486486+ sis_priv->mii_info.reg_num_mask = 0x1f;487487+483488 /* Get Mac address according to the chip revision */484489 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));485490 if(netif_msg_probe(sis_priv))···732725 pci_name(sis_priv->pci_dev), sis_priv->cur_phy);733726 }734727728728+ sis_priv->mii_info.phy_id = sis_priv->cur_phy;729729+735730 status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL);736731 status &= (~MII_CNTL_ISOLATE);737732···861852 * Please see SiS7014 or ICS spec862853 */863854864864-static u16 mdio_read(struct net_device *net_dev, int phy_id, int location)855855+static int mdio_read(struct net_device *net_dev, int phy_id, int location)865856{866857 long mdio_addr = net_dev->base_addr + mear;867858 int mii_cmd = MIIread|(phy_id<<MIIpmdShift)|(location<<MIIregShift);···19751966 sis_priv->msg_enable = value;19761967}1977196819691969+static u32 sis900_get_link(struct net_device *net_dev)19701970+{19711971+ struct sis900_private *sis_priv = net_dev->priv;19721972+ return mii_link_ok(&sis_priv->mii_info);19731973+}19741974+19751975+static int sis900_get_settings(struct net_device *net_dev,19761976+ struct ethtool_cmd *cmd)19771977+{19781978+ struct sis900_private *sis_priv = net_dev->priv;19791979+ spin_lock_irq(&sis_priv->lock);19801980+ mii_ethtool_gset(&sis_priv->mii_info, cmd);19811981+ spin_unlock_irq(&sis_priv->lock);19821982+ return 0;19831983+}19841984+19851985+static int sis900_set_settings(struct net_device *net_dev,19861986+ struct ethtool_cmd *cmd)19871987+{19881988+ struct sis900_private *sis_priv = net_dev->priv;19891989+ int rt;19901990+ spin_lock_irq(&sis_priv->lock);19911991+ rt = mii_ethtool_sset(&sis_priv->mii_info, cmd);19921992+ spin_unlock_irq(&sis_priv->lock);19931993+ return rt;19941994+}19951995+19961996+static int sis900_nway_reset(struct net_device *net_dev)19971997+{19981998+ struct sis900_private *sis_priv = net_dev->priv;19991999+ return mii_nway_restart(&sis_priv->mii_info);20002000+}20012001+19782002static struct ethtool_ops sis900_ethtool_ops = {19792003 .get_drvinfo = sis900_get_drvinfo,19802004 .get_msglevel = sis900_get_msglevel,19812005 .set_msglevel = sis900_set_msglevel,20062006+ .get_link = sis900_get_link,20072007+ .get_settings = sis900_get_settings,20082008+ .set_settings = sis900_set_settings,20092009+ .nway_reset = sis900_nway_reset,19822010};1983201119842012/**