From: Luis R. Rodriguez Date: Tue, 8 Apr 2014 02:01:42 +0000 (+0000) Subject: backports: complete backport of translation of MMD EEE registers X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3fec3a2ac0b0bbfc1fe7e0debb840ed5859eeb37;p=openwrt%2Fstaging%2Fblogic.git backports: complete backport of translation of MMD EEE registers Commit b32607dd was already partially backported, this complets that backport. mcgrof@ergon ~/linux-next (git::master)$ git describe --contains b32607dd v3.7-rc1~145^2~292 Signed-off-by: Luis R. Rodriguez --- diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h index 5b1c0c34613a..a1f3e95d735e 100644 --- a/backport/backport-include/linux/mdio.h +++ b/backport/backport-include/linux/mdio.h @@ -53,6 +53,35 @@ static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv) return adv; } + +#define ethtool_adv_to_mmd_eee_adv_t LINUX_BACKPORT(ethtool_adv_to_mmd_eee_adv_t) +/** + * ethtool_adv_to_mmd_eee_adv_t + * @adv: the ethtool advertisement settings + * + * A small helper function that translates ethtool advertisement settings + * to EEE advertisements for the MMD EEE Advertisement (7.60) and + * MMD EEE Link Partner Ability (7.61) registers. + */ +static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv) +{ + u16 reg = 0; + + if (adv & ADVERTISED_100baseT_Full) + reg |= MDIO_EEE_100TX; + if (adv & ADVERTISED_1000baseT_Full) + reg |= MDIO_EEE_1000T; + if (adv & ADVERTISED_10000baseT_Full) + reg |= MDIO_EEE_10GT; + if (adv & ADVERTISED_1000baseKX_Full) + reg |= MDIO_EEE_1000KX; + if (adv & ADVERTISED_10000baseKX4_Full) + reg |= MDIO_EEE_10GKX4; + if (adv & ADVERTISED_10000baseKR_Full) + reg |= MDIO_EEE_10GKR; + + return reg; +} #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ #endif /* __BACKPORT_LINUX_MDIO_H */