net: Adds Fast Ethernet Controller driver for Armada100
[oweals/u-boot.git] / drivers / net / 4xx_enet.c
index bc9211e90233eb4165549ff8e18869f7d31d65b6..07170f6831e32621d7b02f1c325bf02b4cba2e19 100644 (file)
@@ -1185,16 +1185,16 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
        }
 #endif /* defined(CONFIG_PHY_RESET) */
 
-       miiphy_read (dev->name, reg, PHY_BMSR, &reg_short);
+       miiphy_read (dev->name, reg, MII_BMSR, &reg_short);
 
        /*
         * Wait if PHY is capable of autonegotiation and autonegotiation is not complete
         */
-       if ((reg_short & PHY_BMSR_AUTN_ABLE)
-           && !(reg_short & PHY_BMSR_AUTN_COMP)) {
+       if ((reg_short & BMSR_ANEGCAPABLE)
+           && !(reg_short & BMSR_ANEGCOMPLETE)) {
                puts ("Waiting for PHY auto negotiation to complete");
                i = 0;
-               while (!(reg_short & PHY_BMSR_AUTN_COMP)) {
+               while (!(reg_short & BMSR_ANEGCOMPLETE)) {
                        /*
                         * Timeout reached ?
                         */
@@ -1207,7 +1207,7 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
                                putc ('.');
                        }
                        udelay (1000);  /* 1 ms */
-                       miiphy_read (dev->name, reg, PHY_BMSR, &reg_short);
+                       miiphy_read (dev->name, reg, MII_BMSR, &reg_short);
                }
                puts (" done\n");
                udelay (500000);        /* another 500 ms (results in faster booting) */
@@ -1494,8 +1494,7 @@ get_speed:
 
        /* set speed */
        if (speed == _1000BASET) {
-#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
-    defined(CONFIG_440SP) || defined(CONFIG_440SPE)
+#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
                unsigned long pfc1;
 
                mfsdr (SDR0_PFC1, pfc1);
@@ -1705,7 +1704,7 @@ int enetInt (struct eth_device *dev)
                        rc = 0;
                }
 
-               /* handle MAL RX EOB interupt from a receive */
+               /* handle MAL RX EOB interrupt from a receive */
                /* check for EOB on valid channels           */
                if (uic_mal & UIC_MAL_RXEOB) {
                        mal_eob = mfdcr(MAL0_RXEOBISR);
@@ -2036,6 +2035,13 @@ int ppc_4xx_eth_initialize (bd_t * bis)
                dev->send = ppc_4xx_eth_send;
                dev->recv = ppc_4xx_eth_rx;
 
+               eth_register(dev);
+
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+               miiphy_register(dev->name,
+                               emac4xx_miiphy_read, emac4xx_miiphy_write);
+#endif
+
                if (0 == virgin) {
                        /* set the MAL IER ??? names may change with new spec ??? */
 #if defined(CONFIG_440SPE) || \
@@ -2073,13 +2079,6 @@ int ppc_4xx_eth_initialize (bd_t * bis)
                                             dev);
                        virgin = 1;
                }
-
-               eth_register (dev);
-
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
-               miiphy_register (dev->name,
-                                emac4xx_miiphy_read, emac4xx_miiphy_write);
-#endif
        }                       /* end for each supported device */
 
        return 0;