]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - cpu/mpc5xxx/fec.c
Add support for canmb board
[karo-tx-uboot.git] / cpu / mpc5xxx / fec.c
index e3e806508358b874d45773ab8bc961f7cd3de6c0..064cee555c12eeadbc24c723741d8d4dc7987e6d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2003
+ * (C) Copyright 2003-2005
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * This file is based on mpc4200fec.c,
@@ -115,7 +115,7 @@ static void mpc5xxx_fec_tbd_init(mpc5xxx_fec_priv *fec)
 }
 
 /********************************************************************/
-static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd)
+static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, volatile FEC_RBD * pRbd)
 {
        /*
         * Reset buffer descriptor as empty
@@ -141,7 +141,7 @@ static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd)
 /********************************************************************/
 static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec)
 {
-       FEC_TBD *pUsedTbd;
+       volatile FEC_TBD *pUsedTbd;
 
 #if (DEBUG & 0x1)
        printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n",
@@ -354,10 +354,10 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
        /*
         * Initialize SmartDMA parameters stored in SRAM
         */
-       *(int *)FEC_TBD_BASE = (int)fec->tbdBase;
-       *(int *)FEC_RBD_BASE = (int)fec->rbdBase;
-       *(int *)FEC_TBD_NEXT = (int)fec->tbdBase;
-       *(int *)FEC_RBD_NEXT = (int)fec->rbdBase;
+       *(volatile int *)FEC_TBD_BASE = (int)fec->tbdBase;
+       *(volatile int *)FEC_RBD_BASE = (int)fec->rbdBase;
+       *(volatile int *)FEC_TBD_NEXT = (int)fec->tbdBase;
+       *(volatile int *)FEC_RBD_NEXT = (int)fec->rbdBase;
 
        /*
         * Enable FEC-Lite controller
@@ -397,7 +397,13 @@ static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
         */
        if (fec->xcv_type == SEVENWIRE) {
                /*  10MBit with 7-wire operation */
+#if defined(CONFIG_TOTAL5200)
+               /* 7-wire and USB2 on Ethernet */
+               *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00030000;
+#else  /* !CONFIG_TOTAL5200 */
+               /* 7-wire only */
                *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
+#endif /* CONFIG_TOTAL5200 */
        } else {
                /* 100MBit with MD operation */
                *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
@@ -682,7 +688,7 @@ static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data,
         * 6-byte Ethernet addresses.
         */
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
-       FEC_TBD *pTbd;
+       volatile FEC_TBD *pTbd;
 
 #if (DEBUG & 0x20)
        printf("tbd status: 0x%04x\n", fec->tbdBase[0].status);
@@ -773,7 +779,7 @@ static int mpc5xxx_fec_recv(struct eth_device *dev)
         * This command pulls one frame from the card
         */
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
-       FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
+       volatile FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
        unsigned long ievent;
        int frame_length, len = 0;
        NBUF *frame;
@@ -863,13 +869,16 @@ int mpc5xxx_fec_initialize(bd_t * bis)
        fec->eth = (ethernet_regs *)MPC5XXX_FEC;
        fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
        fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
-#if defined(CONFIG_ICECUBE) || defined(CONFIG_PM520)   || \
+#if defined(CONFIG_CANMB)   || defined(CONFIG_ICECUBE) || \
+    defined(CONFIG_INKA4X0) || defined(CONFIG_PM520)   || \
     defined(CONFIG_TOP5200) || defined(CONFIG_TQM5200)
 # ifndef CONFIG_FEC_10MBIT
        fec->xcv_type = MII100;
 # else
        fec->xcv_type = MII10;
 # endif
+#elif defined(CONFIG_TOTAL5200)
+       fec->xcv_type = SEVENWIRE;
 #else
 #error fec->xcv_type not initialized.
 #endif