aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mii.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-11-17 09:30:55 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-21 15:27:19 -0500
commit37f07023d30708b5da091fe6d6be9b60783c6d82 (patch)
treee4f576abd841cdeddc6cbdc9da6b083277784295 /drivers/net/mii.c
parentb8ffdbd05f8692cdadccd04464271e48b1e8d439 (diff)
net: Change mii to ethtool advertisement function names
This patch implements advice by Ben Hutchings to change the mii side of the function names to look more like the register whose values they convert. New LPA translation functions have been added as well. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mii.c')
-rw-r--r--drivers/net/mii.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index d0a296272713..c70c2332d15e 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -35,14 +35,11 @@
35 35
36static u32 mii_get_an(struct mii_if_info *mii, u16 addr) 36static u32 mii_get_an(struct mii_if_info *mii, u16 addr)
37{ 37{
38 u32 result = 0;
39 int advert; 38 int advert;
40 39
41 advert = mii->mdio_read(mii->dev, mii->phy_id, addr); 40 advert = mii->mdio_read(mii->dev, mii->phy_id, addr);
42 if (advert & LPA_LPACK)
43 result |= ADVERTISED_Autoneg;
44 41
45 return result | mii_adv_to_ethtool_100bt(advert); 42 return mii_lpa_to_ethtool_lpa_t(advert);
46} 43}
47 44
48/** 45/**
@@ -93,12 +90,13 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
93 90
94 ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE); 91 ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE);
95 if (mii->supports_gmii) 92 if (mii->supports_gmii)
96 ecmd->advertising |= mii_adv_to_ethtool_1000T(ctrl1000); 93 ecmd->advertising |=
94 mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
97 95
98 if (bmsr & BMSR_ANEGCOMPLETE) { 96 if (bmsr & BMSR_ANEGCOMPLETE) {
99 ecmd->lp_advertising = mii_get_an(mii, MII_LPA); 97 ecmd->lp_advertising = mii_get_an(mii, MII_LPA);
100 ecmd->lp_advertising |= 98 ecmd->lp_advertising |=
101 mii_lpa_to_ethtool_1000T(stat1000); 99 mii_stat1000_to_ethtool_lpa_t(stat1000);
102 } else { 100 } else {
103 ecmd->lp_advertising = 0; 101 ecmd->lp_advertising = 0;
104 } 102 }
@@ -186,10 +184,11 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
186 advert2 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000); 184 advert2 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000);
187 tmp2 = advert2 & ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); 185 tmp2 = advert2 & ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL);
188 } 186 }
189 tmp |= ethtool_adv_to_mii_100bt(ecmd->advertising); 187 tmp |= ethtool_adv_to_mii_adv_t(ecmd->advertising);
190 188
191 if (mii->supports_gmii) 189 if (mii->supports_gmii)
192 tmp2 |= ethtool_adv_to_mii_1000T(ecmd->advertising); 190 tmp2 |=
191 ethtool_adv_to_mii_ctrl1000_t(ecmd->advertising);
193 if (advert != tmp) { 192 if (advert != tmp) {
194 mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp); 193 mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp);
195 mii->advertising = tmp; 194 mii->advertising = tmp;