]> git.sur5r.net Git - u-boot/blobdiff - post/cpu/mpc8xx/ether.c
PPC: remove dead boards (AMX860, c2mon, ETX094, IAD210, LANTEC, SCM)
[u-boot] / post / cpu / mpc8xx / ether.c
index 2fa5cf4ac991cf7f456977261b0b859208ae03ad..728f7e0a44290ccde8611be7c132c72aa5919d32 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 #include <post.h>
-#if CONFIG_POST & CFG_POST_ETHER
+#if CONFIG_POST & CONFIG_SYS_POST_ETHER
 #if defined(CONFIG_8xx)
 #include <commproc.h>
 #elif defined(CONFIG_MPC8260)
@@ -67,8 +67,6 @@ static int ctlr_list[][2] = { {CTLR_SCC, 1} };
 static int ctlr_list[][2] = { };
 #endif
 
-#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0]))
-
 static struct {
        void (*init) (int index);
        void (*halt) (int index);
@@ -109,18 +107,25 @@ static RTXBD *rtx;
 
 static void scc_init (int scc_index)
 {
-       bd_t *bd = gd->bd;
-
-       static int proff[] =
-                       { PROFF_SCC1, PROFF_SCC2, PROFF_SCC3, PROFF_SCC4 };
-       static unsigned int cpm_cr[] =
-                       { CPM_CR_CH_SCC1, CPM_CR_CH_SCC2, CPM_CR_CH_SCC3,
-CPM_CR_CH_SCC4 };
+       uchar ea[6];
+
+       static int proff[] = {
+                               PROFF_SCC1,
+                               PROFF_SCC2,
+                               PROFF_SCC3,
+                               PROFF_SCC4,
+       };
+       static unsigned int cpm_cr[] = {
+                               CPM_CR_CH_SCC1,
+                               CPM_CR_CH_SCC2,
+                               CPM_CR_CH_SCC3,
+                               CPM_CR_CH_SCC4,
+       };
 
        int i;
        scc_enet_t *pram_ptr;
 
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 
        immr->im_cpm.cp_scc[scc_index].scc_gsmrl &=
                        ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
@@ -143,7 +148,7 @@ CPM_CR_CH_SCC4 };
        rxIdx = 0;
        txIdx = 0;
 
-#ifdef CFG_ALLOC_DPRAM
+#ifdef CONFIG_SYS_ALLOC_DPRAM
        rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
                                         dpram_alloc_align (sizeof (RTXBD), 8));
 #else
@@ -296,11 +301,10 @@ CPM_CR_CH_SCC4 };
        pram_ptr->sen_gaddr3 = 0x0;     /* Group Address Filter 3 (unused) */
        pram_ptr->sen_gaddr4 = 0x0;     /* Group Address Filter 4 (unused) */
 
-#define ea bd->bi_enetaddr
+       eth_getenv_enetaddr("ethaddr", ea);
        pram_ptr->sen_paddrh = (ea[5] << 8) + ea[4];
        pram_ptr->sen_paddrm = (ea[3] << 8) + ea[2];
        pram_ptr->sen_paddrl = (ea[1] << 8) + ea[0];
-#undef ea
 
        pram_ptr->sen_pper = 0x0;       /* Persistence (unused) */
        pram_ptr->sen_iaddr1 = 0x0;     /* Individual Address Filter 1 (unused) */
@@ -377,49 +381,6 @@ CPM_CR_CH_SCC4 };
        immr->im_cpm.cp_scc[scc_index].scc_psmr = SCC_PSMR_ENCRC |
                        SCC_PSMR_NIB22 | SCC_PSMR_LPB;
 
-#if 0
-       /*
-        * Configure Ethernet TENA Signal
-        */
-
-#if (defined(PC_ENET_TENA) && !defined(PB_ENET_TENA))
-       immr->im_ioport.iop_pcpar |= PC_ENET_TENA;
-       immr->im_ioport.iop_pcdir &= ~PC_ENET_TENA;
-#elif (defined(PB_ENET_TENA) && !defined(PC_ENET_TENA))
-       immr->im_cpm.cp_pbpar |= PB_ENET_TENA;
-       immr->im_cpm.cp_pbdir |= PB_ENET_TENA;
-#else
-#error Configuration Error: exactly ONE of PB_ENET_TENA, PC_ENET_TENA must be defined
-#endif
-
-#if defined(CONFIG_ADS) && defined(CONFIG_MPC860)
-       /*
-        * Port C is used to control the PHY,MC68160.
-        */
-       immr->im_ioport.iop_pcdir |=
-                       (PC_ENET_ETHLOOP | PC_ENET_TPFLDL | PC_ENET_TPSQEL);
-
-       immr->im_ioport.iop_pcdat |= PC_ENET_TPFLDL;
-       immr->im_ioport.iop_pcdat &= ~(PC_ENET_ETHLOOP | PC_ENET_TPSQEL);
-       *((uint *) BCSR1) &= ~BCSR1_ETHEN;
-#endif /* MPC860ADS */
-
-#if defined(CONFIG_AMX860)
-       /*
-        * Port B is used to control the PHY,MC68160.
-        */
-       immr->im_cpm.cp_pbdir |=
-                       (PB_ENET_ETHLOOP | PB_ENET_TPFLDL | PB_ENET_TPSQEL);
-
-       immr->im_cpm.cp_pbdat |= PB_ENET_TPFLDL;
-       immr->im_cpm.cp_pbdat &= ~(PB_ENET_ETHLOOP | PB_ENET_TPSQEL);
-
-       immr->im_ioport.iop_pddir |= PD_ENET_ETH_EN;
-       immr->im_ioport.iop_pddat &= ~PD_ENET_ETH_EN;
-#endif /* AMX860 */
-
-#endif /* 0 */
-
 #ifdef CONFIG_RPXCLASSIC
        *((uchar *) BCSR0) &= ~BCSR0_ETHLPBK;
        *((uchar *) BCSR0) |= (BCSR0_ETHEN | BCSR0_COLTEST | BCSR0_FULLDPLX);
@@ -445,14 +406,14 @@ CPM_CR_CH_SCC4 };
         */
 #if defined (CONFIG_FADS)
        udelay (10000);                         /* wait 10 ms */
-#elif defined (CONFIG_AMX860) || defined(CONFIG_RPXCLASSIC)
+#elif defined(CONFIG_RPXCLASSIC)
        udelay (100000);                        /* wait 100 ms */
 #endif
 }
 
 static void scc_halt (int scc_index)
 {
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 
        immr->im_cpm.cp_scc[scc_index].scc_gsmrl &=
                        ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
@@ -612,7 +573,7 @@ int ether_post_test (int flags)
        ctlr_proc[CTLR_SCC].send = scc_send;
        ctlr_proc[CTLR_SCC].recv = scc_recv;
 
-       for (i = 0; i < CTRL_LIST_SIZE; i++) {
+       for (i = 0; i < ARRAY_SIZE(ctlr_list); i++) {
                if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) {
                        res = -1;
                }
@@ -624,4 +585,4 @@ int ether_post_test (int flags)
        return res;
 }
 
-#endif /* CONFIG_POST & CFG_POST_ETHER */
+#endif /* CONFIG_POST & CONFIG_SYS_POST_ETHER */