Hi<br><br><div class="gmail_quote">On Mon, Jun 18, 2012 at 4:47 PM, Johannes Stezenbach <span dir="ltr"><<a href="mailto:js@sig21.net" target="_blank">js@sig21.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The auto negotiation result is the intersect<br>
of the advertised abilities and the link partner abilities.<br>
<br>
Signed-off-by: Johannes Stezenbach <<a href="mailto:js@sig21.net">js@sig21.net</a>><br>
---<br>
drivers/net/miidev.c | 16 ++++++++++------<br>
1 file changed, 10 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c<br>
index f47fc9e..272234e 100644<br>
--- a/drivers/net/miidev.c<br>
+++ b/drivers/net/miidev.c<br>
@@ -123,6 +123,7 @@ int miidev_wait_aneg(struct mii_device *mdev)<br>
<br>
int miidev_get_status(struct mii_device *mdev)<br>
{<br>
+ int ret, status, adv, lpa;<br>
int ret, status;<br>
<br>
ret = mii_read(mdev, mdev->address, MII_BMSR);<br>
@@ -136,13 +137,16 @@ int miidev_get_status(struct mii_device *mdev)<br>
goto err_out;<br>
<br>
if (ret & BMCR_ANENABLE) {<br>
- ret = mii_read(mdev, mdev->address, MII_LPA);<br>
- if (ret < 0)<br>
+ lpa = mii_read(mdev, mdev->address, MII_LPA);<br>
+ if (lpa < 0)<br>
goto err_out;<br>
-<br>
- status |= ret & LPA_DUPLEX ? MIIDEV_STATUS_IS_FULL_DUPLEX : 0;<br>
- status |= ret & LPA_100 ? MIIDEV_STATUS_IS_100MBIT :<br>
- MIIDEV_STATUS_IS_10MBIT;<br>
+ adv = mii_read(mdev, mdev->address, MII_ADVERTISE);<br>
+ if (adv < 0)<br>
+ goto err_out;<br>
+ lpa &= adv;<br>
</blockquote><div><br></div><div>Good catch and obviously correct. I reckon since nowadays most PHY's advertise ADVERTISE_FULL or ADVERTISE_ALL, this has never been an issue for anybody so far.</div><div><br></div><div>
Best regards</div><div>Roberto</div></div>