Use the MII definitions which are available in include/linux/mii.h instead of the redundant ones which are brought by the r8169 driver.
While at it: - PHY_Cap_Null is not really useful; - PHY_Auto_Neco_Comp (i.e. BMSR_ANEGCOMPLETE) is not used at all (uh...); No functional change. Signed-off-by: Francois Romieu <[EMAIL PROTECTED]> diff -puN drivers/net/r8169.c~r8169-690 drivers/net/r8169.c --- a/drivers/net/r8169.c~r8169-690 2005-08-24 21:53:58.579855011 +0200 +++ b/drivers/net/r8169.c 2005-08-24 21:53:58.607850469 +0200 @@ -312,30 +312,6 @@ enum RTL8169_register_content { LinkStatus = 0x02, FullDup = 0x01, - /* GIGABIT_PHY_registers */ - PHY_CTRL_REG = 0, - PHY_STAT_REG = 1, - PHY_AUTO_NEGO_REG = 4, - PHY_1000_CTRL_REG = 9, - - /* GIGABIT_PHY_REG_BIT */ - PHY_Restart_Auto_Nego = 0x0200, - PHY_Enable_Auto_Nego = 0x1000, - - /* PHY_STAT_REG = 1 */ - PHY_Auto_Neco_Comp = 0x0020, - - /* PHY_AUTO_NEGO_REG = 4 */ - PHY_Cap_10_Half = 0x0020, - PHY_Cap_10_Full = 0x0040, - PHY_Cap_100_Half = 0x0080, - PHY_Cap_100_Full = 0x0100, - - /* PHY_1000_CTRL_REG = 9 */ - PHY_Cap_1000_Full = 0x0200, - - PHY_Cap_Null = 0x0, - /* _MediaType */ _10_Half = 0x01, _10_Full = 0x02, @@ -534,7 +510,7 @@ static unsigned int rtl8169_tbi_reset_pe static unsigned int rtl8169_xmii_reset_pending(void __iomem *ioaddr) { - return mdio_read(ioaddr, 0) & 0x8000; + return mdio_read(ioaddr, MII_BMCR) & BMCR_RESET; } static unsigned int rtl8169_tbi_link_ok(void __iomem *ioaddr) @@ -556,8 +532,8 @@ static void rtl8169_xmii_reset_enable(vo { unsigned int val; - val = (mdio_read(ioaddr, PHY_CTRL_REG) | 0x8000) & 0xffff; - mdio_write(ioaddr, PHY_CTRL_REG, val); + val = (mdio_read(ioaddr, MII_BMCR) | BMCR_RESET) & 0xffff; + mdio_write(ioaddr, MII_BMCR, val); } static void rtl8169_check_link_status(struct net_device *dev, @@ -658,35 +634,32 @@ static int rtl8169_set_speed_xmii(struct void __iomem *ioaddr = tp->mmio_addr; int auto_nego, giga_ctrl; - auto_nego = mdio_read(ioaddr, PHY_AUTO_NEGO_REG); - auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_10_Full | - PHY_Cap_100_Half | PHY_Cap_100_Full); - giga_ctrl = mdio_read(ioaddr, PHY_1000_CTRL_REG); - giga_ctrl &= ~(PHY_Cap_1000_Full | PHY_Cap_Null); + auto_nego = mdio_read(ioaddr, MII_ADVERTISE); + auto_nego &= ~ADVERTISE_ALL; + giga_ctrl = mdio_read(ioaddr, MII_CTRL1000); + giga_ctrl &= ~ADVERTISE_1000FULL; if (autoneg == AUTONEG_ENABLE) { - auto_nego |= (PHY_Cap_10_Half | PHY_Cap_10_Full | - PHY_Cap_100_Half | PHY_Cap_100_Full); - giga_ctrl |= PHY_Cap_1000_Full; + auto_nego |= ADVERTISE_ALL; + giga_ctrl |= ADVERTISE_1000FULL; } else { if (speed == SPEED_10) - auto_nego |= PHY_Cap_10_Half | PHY_Cap_10_Full; + auto_nego |= ADVERTISE_10HALF | ADVERTISE_10FULL; else if (speed == SPEED_100) - auto_nego |= PHY_Cap_100_Half | PHY_Cap_100_Full; + auto_nego |= ADVERTISE_100HALF | ADVERTISE_100FULL; else if (speed == SPEED_1000) - giga_ctrl |= PHY_Cap_1000_Full; + giga_ctrl |= ADVERTISE_1000FULL; if (duplex == DUPLEX_HALF) - auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full); + auto_nego &= ~(ADVERTISE_10FULL | ADVERTISE_100FULL); } tp->phy_auto_nego_reg = auto_nego; tp->phy_1000_ctrl_reg = giga_ctrl; - mdio_write(ioaddr, PHY_AUTO_NEGO_REG, auto_nego); - mdio_write(ioaddr, PHY_1000_CTRL_REG, giga_ctrl); - mdio_write(ioaddr, PHY_CTRL_REG, PHY_Enable_Auto_Nego | - PHY_Restart_Auto_Nego); + mdio_write(ioaddr, MII_ADVERTISE, auto_nego); + mdio_write(ioaddr, MII_CTRL1000, giga_ctrl); + mdio_write(ioaddr, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); return 0; } @@ -698,7 +671,7 @@ static int rtl8169_set_speed(struct net_ ret = tp->set_speed(dev, autoneg, speed, duplex); - if (netif_running(dev) && (tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full)) + if (netif_running(dev) && (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT); return ret; @@ -851,15 +824,15 @@ static void rtl8169_gset_xmii(struct net cmd->autoneg = 1; cmd->advertising = ADVERTISED_TP | ADVERTISED_Autoneg; - if (tp->phy_auto_nego_reg & PHY_Cap_10_Half) + if (tp->phy_auto_nego_reg & ADVERTISE_10HALF) cmd->advertising |= ADVERTISED_10baseT_Half; - if (tp->phy_auto_nego_reg & PHY_Cap_10_Full) + if (tp->phy_auto_nego_reg & ADVERTISE_10FULL) cmd->advertising |= ADVERTISED_10baseT_Full; - if (tp->phy_auto_nego_reg & PHY_Cap_100_Half) + if (tp->phy_auto_nego_reg & ADVERTISE_100HALF) cmd->advertising |= ADVERTISED_100baseT_Half; - if (tp->phy_auto_nego_reg & PHY_Cap_100_Full) + if (tp->phy_auto_nego_reg & ADVERTISE_100FULL) cmd->advertising |= ADVERTISED_100baseT_Full; - if (tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full) + if (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL) cmd->advertising |= ADVERTISED_1000baseT_Full; status = RTL_R8(PHYstatus); @@ -1216,7 +1189,7 @@ static void rtl8169_phy_timer(unsigned l assert(tp->mac_version > RTL_GIGA_MAC_VER_B); assert(tp->phy_version < RTL_GIGA_PHY_VER_H); - if (!(tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full)) + if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) return; spin_lock_irq(&tp->lock); @@ -1500,7 +1473,7 @@ rtl8169_init_one(struct pci_dev *pdev, c tp->phy_reset_pending = rtl8169_tbi_reset_pending; tp->link_ok = rtl8169_tbi_link_ok; - tp->phy_1000_ctrl_reg = PHY_Cap_1000_Full; /* Implied by TBI */ + tp->phy_1000_ctrl_reg = ADVERTISE_1000FULL; /* Implied by TBI */ } else { tp->set_speed = rtl8169_set_speed_xmii; tp->get_settings = rtl8169_gset_xmii; _ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html