]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/tsec.c
SPEAr : Network driver support added
[u-boot] / drivers / net / tsec.c
index 7600e40de906d20d5885744878296d265f1333fc..bc2707f17a7d15a2c4d5277660a72f3c1dc08be9 100644 (file)
@@ -281,12 +281,16 @@ static uint tsec_local_mdio_read(volatile tsec_mdio_t *phyregs,
                | TBIANA_FULL_DUPLEX \
                )
 
-/* Force the TBI PHY into 1000Mbps full duplex when in SGMII mode */
+/* By default force the TBI PHY into 1000Mbps full duplex when in SGMII mode */
+#ifndef CONFIG_TSEC_TBICR_SETTINGS
 #define TBICR_SETTINGS ( \
                TBICR_PHY_RESET \
                | TBICR_FULL_DUPLEX \
                | TBICR_SPEED1_SET \
                )
+#else
+#define TBICR_SETTINGS CONFIG_TSEC_TBICR_SETTINGS
+#endif /* CONFIG_TSEC_TBICR_SETTINGS */
 
 /* Configure the TBI for SGMII operation */
 static void tsec_configure_serdes(struct tsec_private *priv)
@@ -617,6 +621,7 @@ static uint mii_parse_BCM5482_sr(uint mii_reg, struct tsec_private *priv)
 {
        if (BCM8482_is_serdes(priv)) {
                mii_parse_BCM5482_serdes_sr(priv);
+               priv->flags |= TSEC_FIBER;
        } else {
                /* Wait for auto-negotiation to complete or fail */
                mii_parse_sr(mii_reg, priv);
@@ -940,8 +945,9 @@ static void adjust_link(struct eth_device *dev)
                        break;
                }
 
-               printf("Speed: %d, %s duplex\n", priv->speed,
-                      (priv->duplexity) ? "full" : "half");
+               printf("Speed: %d, %s duplex%s\n", priv->speed,
+                      (priv->duplexity) ? "full" : "half",
+                      (priv->flags & TSEC_FIBER) ? ", fiber mode" : "");
 
        } else {
                printf("%s: No link.\n", dev->name);
@@ -1080,7 +1086,8 @@ static void tsec_halt(struct eth_device *dev)
        regs->dmactrl &= ~(DMACTRL_GRS | DMACTRL_GTS);
        regs->dmactrl |= (DMACTRL_GRS | DMACTRL_GTS);
 
-       while (!(regs->ievent & (IEVENT_GRSC | IEVENT_GTSC))) ;
+       while ((regs->ievent & (IEVENT_GRSC | IEVENT_GTSC))
+               != (IEVENT_GRSC | IEVENT_GTSC)) ;
 
        regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
 
@@ -1624,6 +1631,27 @@ static struct phy_info phy_info_dm9161 = {
        },
 };
 
+/* micrel KSZ804  */
+static struct phy_info phy_info_ksz804 =  {
+       0x0022151,
+       "Micrel KSZ804 PHY",
+       4,
+       (struct phy_cmd[]) { /* config */
+               {PHY_BMCR, PHY_BMCR_RESET, NULL},
+               {PHY_BMCR, PHY_BMCR_AUTON|PHY_BMCR_RST_NEG, NULL},
+               {miim_end,}
+       },
+       (struct phy_cmd[]) { /* startup */
+               {PHY_BMSR, miim_read, NULL},
+               {PHY_BMSR, miim_read, &mii_parse_sr},
+               {PHY_BMSR, miim_read, &mii_parse_link},
+               {miim_end,}
+       },
+       (struct phy_cmd[]) { /* shutdown */
+               {miim_end,}
+       }
+};
+
 /* a generic flavor.  */
 static struct phy_info phy_info_generic =  {
        0,
@@ -1787,6 +1815,7 @@ static struct phy_info *phy_info[] = {
        &phy_info_M88E1145,
        &phy_info_M88E1149S,
        &phy_info_dm9161,
+       &phy_info_ksz804,
        &phy_info_lxt971,
        &phy_info_VSC8211,
        &phy_info_VSC8244,