]> git.sur5r.net Git - u-boot/blobdiff - cpu/mpc8260/ether_fcc.c
Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[u-boot] / cpu / mpc8260 / ether_fcc.c
index deb8924e5a815f976104e4955ce6d5deb1ecd67f..37bf4456ed1b032a892abced7dffb7c138943d39 100644 (file)
 #include <config.h>
 #include <net.h>
 
-#if defined(CONFIG_ETHER_ON_FCC) && (CONFIG_COMMANDS & CFG_CMD_NET) && \
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+#include <miiphy.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_ETHER_ON_FCC) && defined(CONFIG_CMD_NET) && \
        defined(CONFIG_NET_MULTI)
 
 static struct ether_fcc_info_s
@@ -149,7 +155,7 @@ static int fec_send(struct eth_device* dev, volatile void *packet, int length)
 
     for(i=0; rtx.txbd[txIdx].cbd_sc & BD_ENET_TX_READY; i++) {
        if (i >= TOUT_LOOP) {
-           printf("fec: tx buffer not ready\n");
+           puts ("fec: tx buffer not ready\n");
            goto out;
        }
     }
@@ -161,7 +167,7 @@ static int fec_send(struct eth_device* dev, volatile void *packet, int length)
 
     for(i=0; rtx.txbd[txIdx].cbd_sc & BD_ENET_TX_READY; i++) {
        if (i >= TOUT_LOOP) {
-           printf("fec: tx error\n");
+           puts ("fec: tx error\n");
            goto out;
        }
     }
@@ -386,6 +392,12 @@ int fec_initialize(bd_t *bis)
                dev->recv   = fec_recv;
 
                eth_register(dev);
+
+#if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) \
+               && defined(CONFIG_BITBANGMII)
+               miiphy_register(dev->name,
+                               bb_miiphy_read, bb_miiphy_write);
+#endif
        }
 
        return 1;
@@ -522,7 +534,7 @@ print_desc (elbt_prdesc descs[], int ndesc, uchar *bases[], int nbase)
        for (i = 0; i < nbase; i++)
                printf ("  Channel %d", i);
 
-       puts ("\n");
+       putc ('\n');
 
        while (dp < edp) {
 
@@ -534,7 +546,7 @@ print_desc (elbt_prdesc descs[], int ndesc, uchar *bases[], int nbase)
                        printf (" %10u", val);
                }
 
-               puts ("\n");
+               putc ('\n');
 
                dp++;
        }
@@ -628,11 +640,12 @@ swap16 (unsigned short x)
        return (((x & 0xff) << 8) | ((x & 0xff00) >> 8));
 }
 
+/* broadcast is not an error - we send them like that */
+#define BD_ENET_RX_ERRS        (BD_ENET_RX_STATS & ~BD_ENET_RX_BC)
+
 void
 eth_loopback_test (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        volatile immap_t *immr = (immap_t *)CFG_IMMR;
        volatile cpm8260_t *cp = &(immr->im_cpm);
        int c, nclosed;
@@ -1002,7 +1015,7 @@ eth_loopback_test (void)
                                                        ecp->rxeacc._f++;
                                        }
 
-                                       if (sc & BD_ENET_RX_STATS) {
+                                       if (sc & BD_ENET_RX_ERRS) {
                                                ulong n;
 
                                                /*
@@ -1033,7 +1046,7 @@ eth_loopback_test (void)
                                                        ecp->rxeacc.cl++;
 
                                                bdp->cbd_sc &= \
-                                                       ~BD_ENET_RX_STATS;
+                                                       ~BD_ENET_RX_ERRS;
                                        }
                                        else {
                                                ushort datlen = bdp->cbd_datlen;
@@ -1143,7 +1156,7 @@ eth_loopback_test (void)
                        printf ("\tFirst %d rx errs:", nerr);
                        for (i = 0; i < nerr; i++)
                                printf (" %04x", ecp->rxerrs[i]);
-                       puts ("\n");
+                       putc ('\n');
                }
 
                if ((nerr = ecp->ntxerr) > 0) {
@@ -1152,7 +1165,7 @@ eth_loopback_test (void)
                        printf ("\tFirst %d tx errs:", nerr);
                        for (i = 0; i < nerr; i++)
                                printf (" %04x", ecp->txerrs[i]);
-                       puts ("\n");
+                       putc ('\n');
                }
        }
 
@@ -1174,4 +1187,4 @@ eth_loopback_test (void)
 
 #endif /* CONFIG_ETHER_LOOPBACK_TEST */
 
-#endif /* CONFIG_ETHER_ON_FCC && CFG_CMD_NET && CONFIG_NET_MULTI */
+#endif