]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/net/tsec.c
tsec: Clean up Broadcom PHY status parsing
[karo-tx-uboot.git] / drivers / net / tsec.c
index d8b6619ae0d47bc9eab8dc0e07404a715eeb9546..76902bcd83505d2262d7f45737375d26156f2b1f 100644 (file)
@@ -277,12 +277,13 @@ uint tsec_local_mdio_read(volatile tsec_mdio_t *phyregs, uint phyid, uint regnum
                | TBIANA_FULL_DUPLEX \
                )
 
+/* Force the TBI PHY into 1000Mbps full duplex when in SGMII mode */
 #define TBICR_SETTINGS ( \
                TBICR_PHY_RESET \
-               | TBICR_ANEG_ENABLE \
                | TBICR_FULL_DUPLEX \
                | TBICR_SPEED1_SET \
                )
+
 /* Configure the TBI for SGMII operation */
 static void tsec_configure_serdes(struct tsec_private *priv)
 {
@@ -487,50 +488,41 @@ uint mii_BCM54xx_wirespeed(uint mii_reg, struct tsec_private *priv)
  */
 uint mii_parse_BCM54xx_sr(uint mii_reg, struct tsec_private *priv)
 {
+       /* If there is no link, speed and duplex don't matter */
+       if (!priv->link)
+               return 0;
 
-       switch((mii_reg & MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK) >> MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT){
-
-               case 1:
-                       printf("Enet starting in 10BT/HD\n");
-                       priv->duplexity = 0;
-                       priv->speed = 10;
-                       break;
-
-               case 2:
-                       printf("Enet starting in 10BT/FD\n");
-                       priv->duplexity = 1;
-                       priv->speed = 10;
-                       break;
-
-               case 3:
-                       printf("Enet starting in 100BT/HD\n");
-                       priv->duplexity = 0;
-                       priv->speed = 100;
-                       break;
-
-               case 5:
-                       printf("Enet starting in 100BT/FD\n");
-                       priv->duplexity = 1;
-                       priv->speed = 100;
-                       break;
-
-               case 6:
-                       printf("Enet starting in 1000BT/HD\n");
-                       priv->duplexity = 0;
-                       priv->speed = 1000;
-                       break;
-
-               case 7:
-                       printf("Enet starting in 1000BT/FD\n");
-                       priv->duplexity = 1;
-                       priv->speed = 1000;
-                       break;
-
-               default:
-                       printf("Auto-neg error, defaulting to 10BT/HD\n");
-                       priv->duplexity = 0;
-                       priv->speed = 10;
-                       break;
+       switch ((mii_reg & MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK) >>
+               MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT) {
+       case 1:
+               priv->duplexity = 0;
+               priv->speed = 10;
+               break;
+       case 2:
+               priv->duplexity = 1;
+               priv->speed = 10;
+               break;
+       case 3:
+               priv->duplexity = 0;
+               priv->speed = 100;
+               break;
+       case 5:
+               priv->duplexity = 1;
+               priv->speed = 100;
+               break;
+       case 6:
+               priv->duplexity = 0;
+               priv->speed = 1000;
+               break;
+       case 7:
+               priv->duplexity = 1;
+               priv->speed = 1000;
+               break;
+       default:
+               printf("Auto-neg error, defaulting to 10BT/HD\n");
+               priv->duplexity = 0;
+               priv->speed = 10;
+               break;
        }
 
        return 0;