All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] macb: simplify gmac initialisation
Date: Thu, 18 Sep 2014 23:46:48 +0200	[thread overview]
Message-ID: <1411076809-10191-2-git-send-email-andreas.devel@googlemail.com> (raw)
In-Reply-To: <1411076809-10191-1-git-send-email-andreas.devel@googlemail.com>

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Bo Shen <voice.shen@atmel.com>
---

 drivers/net/macb.c |   25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 01a94a4..375c8a4 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -479,31 +479,22 @@ static int macb_phy_init(struct macb_device *macb)
 	/* First check for GMAC */
 	if (macb_is_gem(macb)) {
 		lpa = macb_mdio_read(macb, MII_STAT1000);
-		if (lpa & (1 << 11)) {
-			speed = 1000;
-			duplex = 1;
-		} else {
-		       if (lpa & (1 << 10)) {
-				speed = 1000;
-				duplex = 1;
-			} else {
-				speed = 0;
-			}
-		}
 
-		if (speed == 1000) {
-			printf("%s: link up, %dMbps %s-duplex (lpa: 0x%04x)\n",
+		if (lpa & (LPA_1000FULL | LPA_1000HALF)) {
+			duplex = ((lpa & LPA_1000FULL) ? 1 : 0);
+
+			printf("%s: link up, 1000Mbps %s-duplex (lpa: 0x%04x)\n",
 			       netdev->name,
-			       speed,
 			       duplex ? "full" : "half",
 			       lpa);
 
 			ncfgr = macb_readl(macb, NCFGR);
-			ncfgr &= ~(GEM_BIT(GBE) | MACB_BIT(SPD) | MACB_BIT(FD));
-			if (speed)
-				ncfgr |= GEM_BIT(GBE);
+			ncfgr &= ~(MACB_BIT(SPD) | MACB_BIT(FD));
+			ncfgr |= GEM_BIT(GBE);
+
 			if (duplex)
 				ncfgr |= MACB_BIT(FD);
+
 			macb_writel(macb, NCFGR, ncfgr);
 
 			return 1;
-- 
1.7.10.4

  reply	other threads:[~2014-09-18 21:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 21:46 [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Andreas Bießmann
2014-09-18 21:46 ` Andreas Bießmann [this message]
2014-10-10 19:57   ` [U-Boot] [U-Boot,1/2] macb: simplify gmac initialisation Andreas Bießmann
2014-09-18 21:46 ` [U-Boot] [PATCH 2/2] sama5d3xek: run PHY's config Andreas Bießmann
2014-10-10 19:57   ` [U-Boot] [U-Boot,2/2] " Andreas Bießmann
2014-09-19  2:56 ` [U-Boot] [PATCH 0/2] sama5d3xek: get GMAC working Bo Shen

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=1411076809-10191-2-git-send-email-andreas.devel@googlemail.com \
    --to=andreas.devel@googlemail.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.