]> git.sur5r.net Git - u-boot/commitdiff
macb: simplify gmac initialisation
authorAndreas Bießmann <andreas.devel@googlemail.com>
Thu, 18 Sep 2014 21:46:48 +0000 (23:46 +0200)
committerAndreas Bießmann <andreas.devel@googlemail.com>
Fri, 10 Oct 2014 19:51:15 +0000 (21:51 +0200)
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

index 01a94a4c4d117795fc6b2f42b8da701974b7e184..375c8a4454a77c3af61321a55a2fa1f2098a9cbb 100644 (file)
@@ -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;