All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 07/07] [REBASED] Coldfire: mcfmii: Allow non-autonegotiating PHYs to use mii command.
Date: Wed, 04 Feb 2009 10:44:07 -0500	[thread overview]
Message-ID: <4989B7C7.80101@RuggedCom.com> (raw)
In-Reply-To: <497A40D1.1010609@RuggedCom.com>

Modified mii_init to support boards with PHYs that are not set to
autonegotiate, but still want to use u-boot's mii commands to probe
the smi bus. Such PHYs will not set the Autonegotiate-done bit.


Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
---

Rebased on:

commit 9d8811c5bd2b7dd6307742cf22fbdb7953b6f816
Merge: 716ebf4... bd99ec1...
Author: Wolfgang Denk <wd@denx.de>
Date:   Tue Feb 3 23:16:15 2009 +0100

  drivers/net/mcfmii.c |   27 +++++++++++++++++++--------
  1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
index 2b733c6..4f1c0a0 100644
--- a/drivers/net/mcfmii.c
+++ b/drivers/net/mcfmii.c
@@ -226,7 +226,8 @@ void __mii_init(void)
  	volatile FEC_T *fecp;
  	struct eth_device *dev;
  	int miispd = 0, i = 0;
-	u16 autoneg = 0;
+	u16 status = 0;
+	u16 linkgood = 0;

  	/* retrieve from register structure */
  	dev = eth_get_dev();
@@ -250,22 +251,32 @@ void __mii_init(void)

  	info->phy_addr = mii_discover_phy(dev);

-#define AUTONEGLINK		(PHY_BMSR_AUTN_COMP | PHY_BMSR_LS)
  	while (i < MCFFEC_TOUT_LOOP) {
-		autoneg = 0;
-		miiphy_read(dev->name, info->phy_addr, PHY_BMSR, &autoneg);
+		status = 0;
  		i++;
-
-		if ((autoneg & AUTONEGLINK) == AUTONEGLINK)
+		/* Read PHY control register */
+		miiphy_read(dev->name, info->phy_addr, PHY_BMCR, &status);
+
+		/* If phy set to autonegotiate, wait for autonegotiation done,
+		 * if phy is not autonegotiating, just wait for link up.
+		 */
+		if ((status & PHY_BMCR_AUTON) == PHY_BMCR_AUTON) {
+			linkgood = (PHY_BMSR_AUTN_COMP | PHY_BMSR_LS);
+		} else {
+			linkgood = PHY_BMSR_LS;
+		}
+		/* Read PHY status register */
+		miiphy_read(dev->name, info->phy_addr, PHY_BMSR, &status);
+		if ((status & linkgood) == linkgood)
  			break;

  		udelay(500);
  	}
  	if (i >= MCFFEC_TOUT_LOOP) {
-		printf("Auto Negotiation not complete\n");
+		printf("Link UP timeout\n");
  	}

-	/* adapt to the half/full speed settings */
+	/* adapt to the duplex and speed settings of the phy */
  	info->dup_spd = miiphy_duplex(dev->name, info->phy_addr) << 16;
  	info->dup_spd |= miiphy_speed(dev->name, info->phy_addr);
  }
-- 
1.5.6.5

      reply	other threads:[~2009-02-04 15:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 22:12 [U-Boot] [PATCH 07/07] Coldfire: mcfmii: Allow non-autonegotiating PHYs to use mii command Richard Retanubun
2009-02-04 15:44 ` Richard Retanubun [this message]

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=4989B7C7.80101@RuggedCom.com \
    --to=richardretanubun@ruggedcom.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.