From: "Eric Bénard" <eric@eukrea.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] miidev: fix 1G wrong detection
Date: Thu, 6 Sep 2012 21:39:31 +0200 [thread overview]
Message-ID: <1346960371-4129-3-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <1346960371-4129-1-git-send-email-eric@eukrea.com>
since 99e72c8bbdbdc690025a5868d831f1fe79ad56fc on an i.MX51 based board,
I get : "phy0: Link is up - 1000/Full". It seems miidev tries to probe
the PHY to early and gets 0x3ffff which leads to the wrong capabilities
setting.
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
drivers/net/miidev.c | 33 +++++++++------------------------
1 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
index 75b53e3..e0f9d67 100644
--- a/drivers/net/miidev.c
+++ b/drivers/net/miidev.c
@@ -131,6 +131,14 @@ int miidev_get_status(struct mii_device *mdev)
status = ret & BMSR_LSTATUS ? MIIDEV_STATUS_IS_UP : 0;
+ if (ret & BMSR_ESTATEN) {
+ ret = mii_read(mdev, mdev->address, MII_ESTATUS);
+ if (ret < 0)
+ goto err_out;
+ if (ret & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
+ mdev->capabilities = MIIDEV_CAPABLE_1000M;
+ }
+
ret = mii_read(mdev, mdev->address, MII_BMCR);
if (ret < 0)
goto err_out;
@@ -239,27 +247,8 @@ static struct file_operations miidev_ops = {
static int miidev_probe(struct device_d *dev)
{
struct mii_device *mdev = dev->priv;
- int val;
- int caps = 0;
- val = mii_read(mdev, mdev->address, MII_PHYSID1);
- if (val < 0 || val == 0xffff)
- goto err_out;
- val = mii_read(mdev, mdev->address, MII_PHYSID2);
- if (val < 0 || val == 0xffff)
- goto err_out;
- val = mii_read(mdev, mdev->address, MII_BMSR);
- if (val < 0)
- goto err_out;
- if (val & BMSR_ESTATEN) {
- val = mii_read(mdev, mdev->address, MII_ESTATUS);
- if (val < 0)
- goto err_out;
- if (val & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
- caps = MIIDEV_CAPABLE_1000M;
- }
-
- mdev->capabilities = caps;
+ mdev->capabilities = 0;
mdev->cdev.name = asprintf("phy%d", dev->id);
mdev->cdev.size = 64;
mdev->cdev.ops = &miidev_ops;
@@ -268,10 +257,6 @@ static int miidev_probe(struct device_d *dev)
devfs_create(&mdev->cdev);
list_add_tail(&mdev->list, &miidev_list);
return 0;
-
-err_out:
- dev_err(dev, "cannot read PHY registers (addr %d)\n", mdev->address);
- return -ENODEV;
}
static void miidev_remove(struct device_d *dev)
--
1.7.7.6
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-09-06 19:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 19:39 [PATCH 1/3] fec: restart autoneg at open instead of init Eric Bénard
2012-09-06 19:39 ` [PATCH 2/3] i.MX51: unbreak FEC iomux Eric Bénard
2012-09-07 8:30 ` Sascha Hauer
2012-09-06 19:39 ` Eric Bénard [this message]
2012-09-06 21:52 ` [PATCH 3/3] miidev: fix 1G wrong detection Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 6:44 ` Sascha Hauer
2012-09-07 7:28 ` Eric Bénard
2012-09-07 8:23 ` Sascha Hauer
2012-09-07 7:43 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-07 8:52 ` Johannes Stezenbach
2012-09-07 9:02 ` Eric Bénard
2012-09-07 9:28 ` Johannes Stezenbach
2012-09-07 9:32 ` Eric Bénard
2012-09-14 7:03 ` Sascha Hauer
2012-09-07 6:57 ` [PATCH 1/3] fec: restart autoneg at open instead of init Sascha Hauer
2012-09-07 7:30 ` Eric Bénard
2012-09-07 7:47 ` Sascha Hauer
2012-09-07 7:51 ` Eric Bénard
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=1346960371-4129-3-git-send-email-eric@eukrea.com \
--to=eric@eukrea.com \
--cc=barebox@lists.infradead.org \
/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