[U-Boot] [PATCH 3/5] miiphyutil: Add Micrel KSZ9021 support to miiphy_speed

Dirk Behme dirk.behme at de.bosch.com
Fri Jan 13 13:10:02 CET 2012


From: Troy Kisky <troy.kisky at boundarydevices.com>

Previously, only GIGE phy was supported in this function.

Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
CC: Troy Kisky <troy.kisky at boundarydevices.com>
CC: Stefano Babic <sbabic at denx.de>
CC: Marek Vasut <marek.vasut at gmail.com>
---
 common/miiphyutil.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 2cc23b4..8cb4748 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -471,7 +471,23 @@ int miiphy_speed(const char *devname, unsigned char addr)
 			(btsr & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)))
 		return _1000BASET;
 #endif /* CONFIG_PHY_GIGE */
-
+#ifdef CONFIG_PHY_MICREL_KSZ9021
+#define MII_PHY_CTL		0x1f
+#define MII_PHY_CTL_1000	(1 << 6)
+#define MII_PHY_CTL_100		(1 << 5)
+#define MII_PHY_CTL_10		(1 << 4)
+	u16 btsr;
+	if (miiphy_read(devname, addr, MII_PHY_CTL, &btsr)) {
+		printf("PHY 1000BT status");
+		goto miiphy_read_failed;
+	}
+	if (btsr & MII_PHY_CTL_1000)
+		return _1000BASET;
+	if (btsr & MII_PHY_CTL_100)
+		return _100BASET;
+	if (btsr & MII_PHY_CTL_10)
+		return _10BASET;
+#endif
 	/* Check Basic Management Control Register first. */
 	if (miiphy_read(devname, addr, MII_BMCR, &bmcr)) {
 		printf("PHY speed");
-- 
1.7.0.4



More information about the U-Boot mailing list