From: Roberto Nibali <rnibali@gmail.com>
To: Johannes Stezenbach <js@sig21.net>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/6] miidev: fix auto negotiation
Date: Mon, 18 Jun 2012 19:52:44 +0200 [thread overview]
Message-ID: <CAONxwYONy=A6pFp2hdupr6vsO4+Me4wuSe1i+YPKQsK6rkRs3Q@mail.gmail.com> (raw)
In-Reply-To: <1340030880-10062-2-git-send-email-js@sig21.net>
[-- Attachment #1.1: Type: text/plain, Size: 1689 bytes --]
Hi
On Mon, Jun 18, 2012 at 4:47 PM, Johannes Stezenbach <js@sig21.net> wrote:
> The auto negotiation result is the intersect
> of the advertised abilities and the link partner abilities.
>
> Signed-off-by: Johannes Stezenbach <js@sig21.net>
> ---
> drivers/net/miidev.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
> index f47fc9e..272234e 100644
> --- a/drivers/net/miidev.c
> +++ b/drivers/net/miidev.c
> @@ -123,6 +123,7 @@ int miidev_wait_aneg(struct mii_device *mdev)
>
> int miidev_get_status(struct mii_device *mdev)
> {
> + int ret, status, adv, lpa;
> int ret, status;
>
> ret = mii_read(mdev, mdev->address, MII_BMSR);
> @@ -136,13 +137,16 @@ int miidev_get_status(struct mii_device *mdev)
> goto err_out;
>
> if (ret & BMCR_ANENABLE) {
> - ret = mii_read(mdev, mdev->address, MII_LPA);
> - if (ret < 0)
> + lpa = mii_read(mdev, mdev->address, MII_LPA);
> + if (lpa < 0)
> goto err_out;
> -
> - status |= ret & LPA_DUPLEX ? MIIDEV_STATUS_IS_FULL_DUPLEX
> : 0;
> - status |= ret & LPA_100 ? MIIDEV_STATUS_IS_100MBIT :
> - MIIDEV_STATUS_IS_10MBIT;
> + adv = mii_read(mdev, mdev->address, MII_ADVERTISE);
> + if (adv < 0)
> + goto err_out;
> + lpa &= adv;
>
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.
Best regards
Roberto
[-- Attachment #1.2: Type: text/html, Size: 2188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-06-18 17:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 14:47 [PATCH 0/6] misc ethernet fixes and new driver Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 1/6] miidev: fix auto negotiation Johannes Stezenbach
2012-06-18 17:52 ` Roberto Nibali [this message]
2012-06-18 19:26 ` Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 2/6] miidev: actually probe the PHY Johannes Stezenbach
2012-06-18 18:27 ` Roberto Nibali
2012-06-18 19:39 ` Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 3/6] miidev: add support for 1000Mbit Johannes Stezenbach
2012-06-18 14:47 ` [PATCH 4/6] miidev: consistent md and mw on phy regs Johannes Stezenbach
2012-06-20 6:49 ` Sascha Hauer
2012-06-18 14:47 ` [PATCH 5/6] eth: eth MAC addresses are six bytes Johannes Stezenbach
2012-06-18 14:48 ` [PATCH 6/6] drivers/net: add designware driver Johannes Stezenbach
2012-06-20 7:13 ` Sascha Hauer
2012-06-20 8:11 ` Johannes Stezenbach
2012-06-20 8:41 ` Sascha Hauer
2012-06-20 7:15 ` [PATCH 0/6] misc ethernet fixes and new driver Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAONxwYONy=A6pFp2hdupr6vsO4+Me4wuSe1i+YPKQsK6rkRs3Q@mail.gmail.com' \
--to=rnibali@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=js@sig21.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox