Merge commit 'wd/master'
[oweals/u-boot.git] / drivers / net / mcffec.c
index 2e0ddeb7772a71f9688e8b057ac0332f7ea06d6f..58ed5e32c6b22a49f2252b04074e93475861ac6b 100644 (file)
 #include <asm/immap.h>
 
 #include <command.h>
-#include <config.h>
 #include <net.h>
 #include <miiphy.h>
 
-#ifdef CONFIG_MCFFEC
 #undef ET_DEBUG
 #undef MII_DEBUG
 
@@ -51,8 +49,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
-
 struct fec_info_s fec_info[] = {
 #ifdef CFG_FEC0_IOBASE
        {
@@ -125,11 +121,17 @@ void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd)
        }
 
        if ((dup_spd & 0xFFFF) == _100BASET) {
+#ifdef CONFIG_MCF5445x
+               fecp->rcr &= ~0x200;    /* disabled 10T base */
+#endif
 #ifdef MII_DEBUG
                printf("100Mbps\n");
 #endif
                bd->bi_ethspeed = 100;
        } else {
+#ifdef CONFIG_MCF5445x
+               fecp->rcr |= 0x200;     /* enabled 10T base */
+#endif
 #ifdef MII_DEBUG
                printf("10Mbps\n");
 #endif
@@ -166,6 +168,13 @@ int fec_send(struct eth_device *dev, volatile void *packet, int length)
        /* Activate transmit Buffer Descriptor polling */
        fecp->tdar = 0x01000000;        /* Descriptor polling active    */
 
+       /* FEC fix for MCF5275, FEC unable to initial transmit data packet.
+        * A nop will ensure the descriptor polling active completed.
+        */
+#ifdef CONFIG_M5275
+       __asm__ ("nop");
+#endif
+
 #ifdef CFG_UNIFY_CACHE
        icache_invalid();
 #endif
@@ -201,7 +210,7 @@ int fec_recv(struct eth_device *dev)
 
        for (;;) {
 #ifdef CFG_UNIFY_CACHE
-                       icache_invalid();
+               icache_invalid();
 #endif
                /* section 16.9.23.2 */
                if (info->rxbd[info->rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
@@ -592,6 +601,3 @@ int mcffec_initialize(bd_t * bis)
 
        return 1;
 }
-
-#endif                         /* CONFIG_CMD_NET, FEC_ENET & NET_MULTI */
-#endif                         /* CONFIG_MCFFEC */