]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/cpu/mpc8220/fec.c
doc/README.scrapyard: add missing commit IDs
[karo-tx-uboot.git] / arch / powerpc / cpu / mpc8220 / fec.c
index 992e0ffbc4666922e29ef795cf19b808bb674b24..43fa802ca96db0a5a4e6f0542fb5873877d3ecd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2003
+ * (C) Copyright 2003-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * This file is based on mpc4200fec.c,
@@ -15,8 +15,7 @@
 #include "fec.h"
 
 #undef  DEBUG
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
-    defined(CONFIG_MPC8220_FEC)
+#if defined(CONFIG_CMD_NET) && defined(CONFIG_MPC8220_FEC)
 
 #if !(defined(CONFIG_MII) || defined(CONFIG_CMD_MII))
 #error "CONFIG_MII has to be defined!"
@@ -27,10 +26,6 @@ static void tfifo_print (char *devname, mpc8220_fec_priv * fec);
 static void rfifo_print (char *devname, mpc8220_fec_priv * fec);
 #endif /* DEBUG */
 
-#ifdef DEBUG
-static u32 local_crc32 (char *string, unsigned int crc_value, int len);
-#endif
-
 typedef struct {
        u8 data[1500];          /* actual data */
        int length;             /* actual length */
@@ -38,8 +33,8 @@ typedef struct {
        u8 head[16];            /* MAC header(6 + 6 + 2) + 2(aligned) */
 } NBUF;
 
-int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal);
-int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data);
+int fec8220_miiphy_read (const char *devname, u8 phyAddr, u8 regAddr, u16 *retVal);
+int fec8220_miiphy_write (const char *devname, u8 phyAddr, u8 regAddr, u16 data);
 
 /********************************************************************/
 #ifdef DEBUG
@@ -293,9 +288,11 @@ static int mpc8220_fec_init (struct eth_device *dev, bd_t * bis)
                 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
                 * and do not drop the Preamble.
                 */
-               /* tbd - rtm */
-               /*fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); */
-               /* No MII for 7-wire mode */
+               /*
+                * tbd - rtm
+                * fec->eth->mii_speed = (((gd->arch.ipb_clk >> 20) / 5) << 1);
+                * No MII for 7-wire mode
+                */
                fec->eth->mii_speed = 0x00000030;
        }
 
@@ -629,7 +626,7 @@ static void rfifo_print (char *devname, mpc8220_fec_priv * fec)
 
 /********************************************************************/
 
-static int mpc8220_fec_send (struct eth_device *dev, volatile void *eth_data,
+static int mpc8220_fec_send(struct eth_device *dev, void *eth_data,
                             int data_length)
 {
        /*
@@ -777,8 +774,8 @@ static int mpc8220_fec_recv (struct eth_device *dev)
                        frame = (NBUF *) pRbd->dataPointer;
                        frame_length = pRbd->dataLength - 4;
 
-#if (0)
-                       {
+                       /* DEBUG code */
+                       if (_DEBUG) {
                                int i;
 
                                printf ("recv data hdr:");
@@ -786,14 +783,13 @@ static int mpc8220_fec_recv (struct eth_device *dev)
                                        printf ("%x ", *(frame->head + i));
                                printf ("\n");
                        }
-#endif
+
                        /*
                         *  Fill the buffer and pass it to upper layers
                         */
 /*                     memcpy(buff, frame->head, 14);
                        memcpy(buff + 14, frame->data, frame_length);*/
-                       NetReceive ((volatile uchar *) pRbd->dataPointer,
-                                   frame_length);
+                       NetReceive((uchar *)pRbd->dataPointer, frame_length);
                        len = frame_length;
                }
                /*
@@ -844,7 +840,7 @@ int mpc8220_fec_initialize (bd_t * bis)
        dev->send = mpc8220_fec_send;
        dev->recv = mpc8220_fec_recv;
 
-       sprintf (dev->name, "FEC ETHERNET");
+       sprintf (dev->name, "FEC");
        eth_register (dev);
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
@@ -885,7 +881,7 @@ int mpc8220_fec_initialize (bd_t * bis)
 
 /* MII-interface related functions */
 /********************************************************************/
-int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal)
+int fec8220_miiphy_read (const char *devname, u8 phyAddr, u8 regAddr, u16 *retVal)
 {
        ethernet_regs *eth = (ethernet_regs *) MMAP_FEC1;
        u32 reg;                /* convenient holder for the PHY register */
@@ -929,7 +925,7 @@ int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal)
 }
 
 /********************************************************************/
-int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data)
+int fec8220_miiphy_write(const char *devname, u8 phyAddr, u8 regAddr, u16 data)
 {
        ethernet_regs *eth = (ethernet_regs *) MMAP_FEC1;
        u32 reg;                /* convenient holder for the PHY register */
@@ -962,39 +958,4 @@ int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data)
        return 0;
 }
 
-#ifdef DEBUG
-static u32 local_crc32 (char *string, unsigned int crc_value, int len)
-{
-       int i;
-       char c;
-       unsigned int crc, count;
-
-       /*
-        * crc32 algorithm
-        */
-       /*
-        * crc = 0xffffffff; * The initialized value should be 0xffffffff
-        */
-       crc = crc_value;
-
-       for (i = len; --i >= 0;) {
-               c = *string++;
-               for (count = 0; count < 8; count++) {
-                       if ((c & 0x01) ^ (crc & 0x01)) {
-                               crc >>= 1;
-                               crc = crc ^ 0xedb88320;
-                       } else {
-                               crc >>= 1;
-                       }
-                       c >>= 1;
-               }
-       }
-
-       /*
-        * In big endian system, do byte swaping for crc value
-        */
-       return crc;
-}
-#endif /* DEBUG */
-
 #endif /* CONFIG_MPC8220_FEC */