summaryrefslogtreecommitdiff
path: root/backport/backport-include
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 02:01:42 +0000
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 18:16:22 -0700
commit3fec3a2ac0b0bbfc1fe7e0debb840ed5859eeb37 (patch)
tree690c594230375d452d3cc41028990eeca37391a6 /backport/backport-include
parent1f20d47753e5f18d8953b4405e2ffc06e05c0890 (diff)
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 <mcgrof@do-not-panic.com>
Diffstat (limited to 'backport/backport-include')
-rw-r--r--backport/backport-include/linux/mdio.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h
index 5b1c0c34..a1f3e95d 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 */