summaryrefslogtreecommitdiff
path: root/common/miiphyutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/miiphyutil.c')
-rw-r--r--common/miiphyutil.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 6b2425f..75c2df5 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -169,4 +169,27 @@ int miiphy_duplex (unsigned char addr)
}
}
+#ifdef CFG_FAULT_ECHO_LINK_DOWN
+/*****************************************************************************
+ *
+ * Determine link status
+ */
+int miiphy_link (unsigned char addr)
+{
+ unsigned short reg;
+
+ if (miiphy_read (addr, PHY_BMSR, &reg)) {
+ printf ("PHY_BMSR read failed, assuming no link\n");
+ return (0);
+ }
+
+ /* Determine if a link is active */
+ if ((reg & PHY_BMSR_LS) != 0) {
+ return (1);
+ } else {
+ return (0);
+ }
+}
+#endif
+
#endif /* CONFIG_MII || (CONFIG_COMMANDS & CFG_CMD_MII) */