summaryrefslogtreecommitdiff
path: root/common/miiphyutil.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-08-23 07:20:36 -0400
committerTom Rini <trini@konsulko.com>2016-08-23 07:20:36 -0400
commit46fe9eb08812cc27a0d5cd97d97373c14d578fe9 (patch)
treefb75dbb6bdde90d7aa8e7429e5c722f3665590d9 /common/miiphyutil.c
parent1d3bcb66ee90ff3ceff9da9b6501d08a915ea671 (diff)
parent8c83c0303c0eaa5f5323d08ffe1f786759e509be (diff)
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'common/miiphyutil.c')
-rw-r--r--common/miiphyutil.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 08aa854efe..d8ebb384db 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -380,7 +380,7 @@ int miiphy_reset(const char *devname, unsigned char addr)
*/
int miiphy_speed(const char *devname, unsigned char addr)
{
- u16 bmcr, anlpar;
+ u16 bmcr, anlpar, adv;
#if defined(CONFIG_PHY_GIGE)
u16 btsr;
@@ -417,7 +417,12 @@ int miiphy_speed(const char *devname, unsigned char addr)
printf("PHY AN speed");
goto miiphy_read_failed;
}
- return (anlpar & LPA_100) ? _100BASET : _10BASET;
+
+ if (miiphy_read(devname, addr, MII_ADVERTISE, &adv)) {
+ puts("PHY AN adv speed");
+ goto miiphy_read_failed;
+ }
+ return ((anlpar & adv) & LPA_100) ? _100BASET : _10BASET;
}
/* Get speed from basic control settings. */
return (bmcr & BMCR_SPEED100) ? _100BASET : _10BASET;
@@ -433,7 +438,7 @@ miiphy_read_failed:
*/
int miiphy_duplex(const char *devname, unsigned char addr)
{
- u16 bmcr, anlpar;
+ u16 bmcr, anlpar, adv;
#if defined(CONFIG_PHY_GIGE)
u16 btsr;
@@ -475,7 +480,12 @@ int miiphy_duplex(const char *devname, unsigned char addr)
puts("PHY AN duplex");
goto miiphy_read_failed;
}
- return (anlpar & (LPA_10FULL | LPA_100FULL)) ?
+
+ if (miiphy_read(devname, addr, MII_ADVERTISE, &adv)) {
+ puts("PHY AN adv duplex");
+ goto miiphy_read_failed;
+ }
+ return ((anlpar & adv) & (LPA_10FULL | LPA_100FULL)) ?
FULL : HALF;
}
/* Get speed from basic control settings. */