blob: d174ad1c010ec15b639f5bc6254f23cfd1b1a6f8 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#include <common.h>
25
26/*
27 * Ethernet test
28 *
29 * The Serial Communication Controllers (SCC) listed in ctlr_list array below
30 * are tested in the loopback ethernet mode.
31 * The controllers are configured accordingly and several packets
32 * are transmitted. The configurable test parameters are:
33 * MIN_PACKET_LENGTH - minimum size of packet to transmit
34 * MAX_PACKET_LENGTH - maximum size of packet to transmit
35 * TEST_NUM - number of tests
36 */
37
38#ifdef CONFIG_POST
39
40#include <post.h>
41
42#if defined(CONFIG_8xx)
43#include <commproc.h>
44#elif defined(CONFIG_MPC8260)
45#include <asm/cpm_8260.h>
46#else
47#error "Apparently a bad configuration, please fix."
48#endif
49
50#include <command.h>
51#include <net.h>
52
53#if CONFIG_POST & CFG_POST_ETHER
54
55#define MIN_PACKET_LENGTH 64
56#define MAX_PACKET_LENGTH 256
57#define TEST_NUM 1
58
59#define CTLR_SCC 0
60
61extern void spi_init_f (void);
62extern void spi_init_r (void);
63
64/* The list of controllers to test */
65#if defined(CONFIG_MPC823)
66static int ctlr_list[][2] = { {CTLR_SCC, 1} };
67#else
68static int ctlr_list[][2] = { };
69#endif
70
71#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0]))
72
73static struct {
74 void (*init) (int index);
75 int (*send) (int index, volatile void *packet, int length);
76 int (*recv) (int index, void *packet, int length);
77} ctlr_proc[1];
78
79static char *ctlr_name[1] = { "SCC" };
80
81static int used_by_uart[1] = { -1 };
82static int used_by_ether[1] = { -1 };
83
84/* Ethernet Transmit and Receive Buffers */
85#define DBUF_LENGTH 1520
86
87#define TX_BUF_CNT 2
88
89#define TOUT_LOOP 100
90
91static char txbuf[DBUF_LENGTH];
92
93static uint rxIdx; /* index of the current RX buffer */
94static uint txIdx; /* index of the current TX buffer */
95
96/*
97 * SCC Ethernet Tx and Rx buffer descriptors allocated at the
98 * immr->udata_bd address on Dual-Port RAM
99 * Provide for Double Buffering
100 */
101
102typedef volatile struct CommonBufferDescriptor {
103 cbd_t rxbd[PKTBUFSRX]; /* Rx BD */
104 cbd_t txbd[TX_BUF_CNT]; /* Tx BD */
105} RTXBD;
106
107static RTXBD *rtx;
108
109 /*
110 * SCC callbacks
111 */
112
113static void scc_init (int scc_index)
114{
115 DECLARE_GLOBAL_DATA_PTR;
116 bd_t *bd = gd->bd;
117
118 static int proff[] =
119 { PROFF_SCC1, PROFF_SCC2, PROFF_SCC3, PROFF_SCC4 };
120 static unsigned int cpm_cr[] =
121 { CPM_CR_CH_SCC1, CPM_CR_CH_SCC2, CPM_CR_CH_SCC3,
122CPM_CR_CH_SCC4 };
123
124 int i;
125 scc_enet_t *pram_ptr;
126
127 volatile immap_t *immr = (immap_t *) CFG_IMMR;
128
129 immr->im_cpm.cp_scc[scc_index].scc_gsmrl &=
130 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
131
132#if defined(CONFIG_FADS)
wdenk2535d602003-07-17 23:16:40 +0000133#if defined(CONFIG_MPC860T) || defined(CONFIG_MPC86xADS)
134 /* The FADS860T and MPC86xADS don't use the MODEM_EN or DATA_VOICE signals. */
wdenkc6097192002-11-03 00:24:07 +0000135 *((uint *) BCSR4) &= ~BCSR4_ETHLOOP;
136 *((uint *) BCSR4) |= BCSR4_TFPLDL | BCSR4_TPSQEL;
137 *((uint *) BCSR1) &= ~BCSR1_ETHEN;
138#else
139 *((uint *) BCSR4) &= ~(BCSR4_ETHLOOP | BCSR4_MODEM_EN);
140 *((uint *) BCSR4) |= BCSR4_TFPLDL | BCSR4_TPSQEL | BCSR4_DATA_VOICE;
141 *((uint *) BCSR1) &= ~BCSR1_ETHEN;
142#endif
143#endif
144
145 pram_ptr = (scc_enet_t *) & (immr->im_cpm.cp_dparam[proff[scc_index]]);
146
147 rxIdx = 0;
148 txIdx = 0;
149
150#ifdef CFG_ALLOC_DPRAM
151 rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
152 dpram_alloc_align (sizeof (RTXBD), 8));
153#else
154 rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_SCC_BASE);
155#endif
156
157#if 0
158
159#if (defined(PA_ENET_RXD) && defined(PA_ENET_TXD))
160 /* Configure port A pins for Txd and Rxd.
161 */
162 immr->im_ioport.iop_papar |= (PA_ENET_RXD | PA_ENET_TXD);
163 immr->im_ioport.iop_padir &= ~(PA_ENET_RXD | PA_ENET_TXD);
164 immr->im_ioport.iop_paodr &= ~PA_ENET_TXD;
165#elif (defined(PB_ENET_RXD) && defined(PB_ENET_TXD))
166 /* Configure port B pins for Txd and Rxd.
167 */
168 immr->im_cpm.cp_pbpar |= (PB_ENET_RXD | PB_ENET_TXD);
169 immr->im_cpm.cp_pbdir &= ~(PB_ENET_RXD | PB_ENET_TXD);
170 immr->im_cpm.cp_pbodr &= ~PB_ENET_TXD;
171#else
172#error Configuration Error: exactly ONE of PA_ENET_[RT]XD, PB_ENET_[RT]XD must be defined
173#endif
174
175#if defined(PC_ENET_LBK)
176 /* Configure port C pins to disable External Loopback
177 */
178 immr->im_ioport.iop_pcpar &= ~PC_ENET_LBK;
179 immr->im_ioport.iop_pcdir |= PC_ENET_LBK;
180 immr->im_ioport.iop_pcso &= ~PC_ENET_LBK;
181 immr->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */
182#endif /* PC_ENET_LBK */
183
184 /* Configure port C pins to enable CLSN and RENA.
185 */
186 immr->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA);
187 immr->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA);
188 immr->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA);
189
190 /* Configure port A for TCLK and RCLK.
191 */
192 immr->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK);
193 immr->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK);
194
195 /*
196 * Configure Serial Interface clock routing -- see section 16.7.5.3
197 * First, clear all SCC bits to zero, then set the ones we want.
198 */
199
200 immr->im_cpm.cp_sicr &= ~SICR_ENET_MASK;
201 immr->im_cpm.cp_sicr |= SICR_ENET_CLKRT;
202#else
203 /*
204 * SCC2 receive clock is BRG2
205 * SCC2 transmit clock is BRG3
206 */
207 immr->im_cpm.cp_brgc2 = 0x0001000C;
208 immr->im_cpm.cp_brgc3 = 0x0001000C;
209
210 immr->im_cpm.cp_sicr &= ~0x00003F00;
211 immr->im_cpm.cp_sicr |= 0x00000a00;
212#endif /* 0 */
213
214
215 /*
216 * Initialize SDCR -- see section 16.9.23.7
217 * SDMA configuration register
218 */
219 immr->im_siu_conf.sc_sdcr = 0x01;
220
221
222 /*
223 * Setup SCC Ethernet Parameter RAM
224 */
225
226 pram_ptr->sen_genscc.scc_rfcr = 0x18; /* Normal Operation and Mot byte ordering */
227 pram_ptr->sen_genscc.scc_tfcr = 0x18; /* Mot byte ordering, Normal access */
228
229 pram_ptr->sen_genscc.scc_mrblr = DBUF_LENGTH; /* max. ET package len 1520 */
230
231 pram_ptr->sen_genscc.scc_rbase = (unsigned int) (&rtx->rxbd[0]); /* Set RXBD tbl start at Dual Port */
232 pram_ptr->sen_genscc.scc_tbase = (unsigned int) (&rtx->txbd[0]); /* Set TXBD tbl start at Dual Port */
233
234 /*
235 * Setup Receiver Buffer Descriptors (13.14.24.18)
236 * Settings:
237 * Empty, Wrap
238 */
239
240 for (i = 0; i < PKTBUFSRX; i++) {
241 rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
242 rtx->rxbd[i].cbd_datlen = 0; /* Reset */
243 rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
244 }
245
246 rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
247
248 /*
249 * Setup Ethernet Transmitter Buffer Descriptors (13.14.24.19)
250 * Settings:
251 * Add PADs to Short FRAMES, Wrap, Last, Tx CRC
252 */
253
254 for (i = 0; i < TX_BUF_CNT; i++) {
255 rtx->txbd[i].cbd_sc =
256 (BD_ENET_TX_PAD | BD_ENET_TX_LAST | BD_ENET_TX_TC);
257 rtx->txbd[i].cbd_datlen = 0; /* Reset */
258 rtx->txbd[i].cbd_bufaddr = (uint) (&txbuf[0]);
259 }
260
261 rtx->txbd[TX_BUF_CNT - 1].cbd_sc |= BD_ENET_TX_WRAP;
262
263 /*
264 * Enter Command: Initialize Rx Params for SCC
265 */
266
267 do { /* Spin until ready to issue command */
268 __asm__ ("eieio");
269 } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
270 /* Issue command */
271 immr->im_cpm.cp_cpcr =
272 ((CPM_CR_INIT_RX << 8) | (cpm_cr[scc_index] << 4) |
273 CPM_CR_FLG);
274 do { /* Spin until command processed */
275 __asm__ ("eieio");
276 } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
277
278 /*
279 * Ethernet Specific Parameter RAM
280 * see table 13-16, pg. 660,
281 * pg. 681 (example with suggested settings)
282 */
283
284 pram_ptr->sen_cpres = ~(0x0); /* Preset CRC */
285 pram_ptr->sen_cmask = 0xdebb20e3; /* Constant Mask for CRC */
286 pram_ptr->sen_crcec = 0x0; /* Error Counter CRC (unused) */
287 pram_ptr->sen_alec = 0x0; /* Alignment Error Counter (unused) */
288 pram_ptr->sen_disfc = 0x0; /* Discard Frame Counter (unused) */
289 pram_ptr->sen_pads = 0x8888; /* Short Frame PAD Characters */
290
291 pram_ptr->sen_retlim = 15; /* Retry Limit Threshold */
292 pram_ptr->sen_maxflr = 1518; /* MAX Frame Length Register */
293 pram_ptr->sen_minflr = 64; /* MIN Frame Length Register */
294
295 pram_ptr->sen_maxd1 = DBUF_LENGTH; /* MAX DMA1 Length Register */
296 pram_ptr->sen_maxd2 = DBUF_LENGTH; /* MAX DMA2 Length Register */
297
298 pram_ptr->sen_gaddr1 = 0x0; /* Group Address Filter 1 (unused) */
299 pram_ptr->sen_gaddr2 = 0x0; /* Group Address Filter 2 (unused) */
300 pram_ptr->sen_gaddr3 = 0x0; /* Group Address Filter 3 (unused) */
301 pram_ptr->sen_gaddr4 = 0x0; /* Group Address Filter 4 (unused) */
302
303#define ea bd->bi_enetaddr
304 pram_ptr->sen_paddrh = (ea[5] << 8) + ea[4];
305 pram_ptr->sen_paddrm = (ea[3] << 8) + ea[2];
306 pram_ptr->sen_paddrl = (ea[1] << 8) + ea[0];
307#undef ea
308
309 pram_ptr->sen_pper = 0x0; /* Persistence (unused) */
310 pram_ptr->sen_iaddr1 = 0x0; /* Individual Address Filter 1 (unused) */
311 pram_ptr->sen_iaddr2 = 0x0; /* Individual Address Filter 2 (unused) */
312 pram_ptr->sen_iaddr3 = 0x0; /* Individual Address Filter 3 (unused) */
313 pram_ptr->sen_iaddr4 = 0x0; /* Individual Address Filter 4 (unused) */
314 pram_ptr->sen_taddrh = 0x0; /* Tmp Address (MSB) (unused) */
315 pram_ptr->sen_taddrm = 0x0; /* Tmp Address (unused) */
316 pram_ptr->sen_taddrl = 0x0; /* Tmp Address (LSB) (unused) */
317
318 /*
319 * Enter Command: Initialize Tx Params for SCC
320 */
321
322 do { /* Spin until ready to issue command */
323 __asm__ ("eieio");
324 } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
325 /* Issue command */
326 immr->im_cpm.cp_cpcr =
327 ((CPM_CR_INIT_TX << 8) | (cpm_cr[scc_index] << 4) |
328 CPM_CR_FLG);
329 do { /* Spin until command processed */
330 __asm__ ("eieio");
331 } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
332
333 /*
334 * Mask all Events in SCCM - we use polling mode
335 */
336 immr->im_cpm.cp_scc[scc_index].scc_sccm = 0;
337
338 /*
339 * Clear Events in SCCE -- Clear bits by writing 1's
340 */
341
342 immr->im_cpm.cp_scc[scc_index].scc_scce = ~(0x0);
343
344
345 /*
346 * Initialize GSMR High 32-Bits
347 * Settings: Normal Mode
348 */
349
350 immr->im_cpm.cp_scc[scc_index].scc_gsmrh = 0;
351
352 /*
353 * Initialize GSMR Low 32-Bits, but do not Enable Transmit/Receive
354 * Settings:
355 * TCI = Invert
356 * TPL = 48 bits
357 * TPP = Repeating 10's
358 * LOOP = Loopback
359 * MODE = Ethernet
360 */
361
362 immr->im_cpm.cp_scc[scc_index].scc_gsmrl = (SCC_GSMRL_TCI |
363 SCC_GSMRL_TPL_48 |
364 SCC_GSMRL_TPP_10 |
365 SCC_GSMRL_DIAG_LOOP |
366 SCC_GSMRL_MODE_ENET);
367
368 /*
369 * Initialize the DSR -- see section 13.14.4 (pg. 513) v0.4
370 */
371
372 immr->im_cpm.cp_scc[scc_index].scc_dsr = 0xd555;
373
374 /*
375 * Initialize the PSMR
376 * Settings:
377 * CRC = 32-Bit CCITT
378 * NIB = Begin searching for SFD 22 bits after RENA
379 * LPB = Loopback Enable (Needed when FDE is set)
380 */
381 immr->im_cpm.cp_scc[scc_index].scc_psmr = SCC_PSMR_ENCRC |
382 SCC_PSMR_NIB22 | SCC_PSMR_LPB;
383
384#if 0
385 /*
386 * Configure Ethernet TENA Signal
387 */
388
389#if (defined(PC_ENET_TENA) && !defined(PB_ENET_TENA))
390 immr->im_ioport.iop_pcpar |= PC_ENET_TENA;
391 immr->im_ioport.iop_pcdir &= ~PC_ENET_TENA;
392#elif (defined(PB_ENET_TENA) && !defined(PC_ENET_TENA))
393 immr->im_cpm.cp_pbpar |= PB_ENET_TENA;
394 immr->im_cpm.cp_pbdir |= PB_ENET_TENA;
395#else
396#error Configuration Error: exactly ONE of PB_ENET_TENA, PC_ENET_TENA must be defined
397#endif
398
399#if defined(CONFIG_ADS) && defined(CONFIG_MPC860)
400 /*
401 * Port C is used to control the PHY,MC68160.
402 */
403 immr->im_ioport.iop_pcdir |=
404 (PC_ENET_ETHLOOP | PC_ENET_TPFLDL | PC_ENET_TPSQEL);
405
406 immr->im_ioport.iop_pcdat |= PC_ENET_TPFLDL;
407 immr->im_ioport.iop_pcdat &= ~(PC_ENET_ETHLOOP | PC_ENET_TPSQEL);
408 *((uint *) BCSR1) &= ~BCSR1_ETHEN;
409#endif /* MPC860ADS */
410
411#if defined(CONFIG_AMX860)
412 /*
413 * Port B is used to control the PHY,MC68160.
414 */
415 immr->im_cpm.cp_pbdir |=
416 (PB_ENET_ETHLOOP | PB_ENET_TPFLDL | PB_ENET_TPSQEL);
417
418 immr->im_cpm.cp_pbdat |= PB_ENET_TPFLDL;
419 immr->im_cpm.cp_pbdat &= ~(PB_ENET_ETHLOOP | PB_ENET_TPSQEL);
420
421 immr->im_ioport.iop_pddir |= PD_ENET_ETH_EN;
422 immr->im_ioport.iop_pddat &= ~PD_ENET_ETH_EN;
423#endif /* AMX860 */
424
425#endif /* 0 */
426
427#ifdef CONFIG_RPXCLASSIC
428 *((uchar *) BCSR0) &= ~BCSR0_ETHLPBK;
429 *((uchar *) BCSR0) |= (BCSR0_ETHEN | BCSR0_COLTEST | BCSR0_FULLDPLX);
430#endif
431
432#ifdef CONFIG_RPXLITE
433 *((uchar *) BCSR0) |= BCSR0_ETHEN;
434#endif
435
436#ifdef CONFIG_MBX
437 board_ether_init ();
438#endif
439
440 /*
441 * Set the ENT/ENR bits in the GSMR Low -- Enable Transmit/Receive
442 */
443
444 immr->im_cpm.cp_scc[scc_index].scc_gsmrl |=
445 (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
446
447 /*
448 * Work around transmit problem with first eth packet
449 */
450#if defined (CONFIG_FADS)
451 udelay (10000); /* wait 10 ms */
452#elif defined (CONFIG_AMX860) || defined(CONFIG_RPXCLASSIC)
453 udelay (100000); /* wait 100 ms */
454#endif
455}
456
457static int scc_send (int index, volatile void *packet, int length)
458{
459 int i, j = 0;
460
461 while ((rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) && (j < TOUT_LOOP)) {
462 udelay (1); /* will also trigger Wd if needed */
463 j++;
464 }
465 if (j >= TOUT_LOOP)
466 printf ("TX not ready\n");
467 rtx->txbd[txIdx].cbd_bufaddr = (uint) packet;
468 rtx->txbd[txIdx].cbd_datlen = length;
469 rtx->txbd[txIdx].cbd_sc |=
470 (BD_ENET_TX_READY | BD_ENET_TX_LAST | BD_ENET_TX_WRAP);
471 while ((rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) && (j < TOUT_LOOP)) {
472 udelay (1); /* will also trigger Wd if needed */
473 j++;
474 }
475 if (j >= TOUT_LOOP)
476 printf ("TX timeout\n");
477 i = (rtx->txbd[txIdx].
478 cbd_sc & BD_ENET_TX_STATS) /* return only status bits */ ;
479 return i;
480}
481
482static int scc_recv (int index, void *packet, int max_length)
483{
484 int length = -1;
485
486 if (rtx->rxbd[rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
487 goto Done; /* nothing received */
488 }
489
490 if (!(rtx->rxbd[rxIdx].cbd_sc & 0x003f)) {
491 length = rtx->rxbd[rxIdx].cbd_datlen - 4;
492 memcpy (packet,
493 (void *) (NetRxPackets[rxIdx]),
494 length < max_length ? length : max_length);
495 }
496
497 /* Give the buffer back to the SCC. */
498 rtx->rxbd[rxIdx].cbd_datlen = 0;
499
500 /* wrap around buffer index when necessary */
501 if ((rxIdx + 1) >= PKTBUFSRX) {
502 rtx->rxbd[PKTBUFSRX - 1].cbd_sc =
503 (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
504 rxIdx = 0;
505 } else {
506 rtx->rxbd[rxIdx].cbd_sc = BD_ENET_RX_EMPTY;
507 rxIdx++;
508 }
509
510 Done:
511 return length;
512}
513
514 /*
515 * Test routines
516 */
517
518static void packet_fill (char *packet, int length)
519{
520 char c = (char) length;
521 int i;
522
523 packet[0] = 0xFF;
524 packet[1] = 0xFF;
525 packet[2] = 0xFF;
526 packet[3] = 0xFF;
527 packet[4] = 0xFF;
528 packet[5] = 0xFF;
529
530 for (i = 6; i < length; i++) {
531 packet[i] = c++;
532 }
533}
534
535static int packet_check (char *packet, int length)
536{
537 char c = (char) length;
538 int i;
539
540 for (i = 6; i < length; i++) {
541 if (packet[i] != c++)
542 return -1;
543 }
544
545 return 0;
546}
547
548static int test_ctlr (int ctlr, int index)
549{
550 int res = -1;
551 char packet_send[MAX_PACKET_LENGTH];
552 char packet_recv[MAX_PACKET_LENGTH];
553 int length;
554 int i;
555 int l;
556
557 ctlr_proc[ctlr].init (index);
558
559 for (i = 0; i < TEST_NUM; i++) {
560 for (l = MIN_PACKET_LENGTH; l <= MAX_PACKET_LENGTH; l++) {
561 packet_fill (packet_send, l);
562
563 ctlr_proc[ctlr].send (index, packet_send, l);
564
565 length = ctlr_proc[ctlr].recv (index, packet_recv,
566 MAX_PACKET_LENGTH);
567
568 if (length != l || packet_check (packet_recv, length) < 0) {
569 goto Done;
570 }
571 }
572 }
573
574 res = 0;
575
576 Done:
577
578#if !defined(CONFIG_8xx_CONS_NONE)
579 if (used_by_uart[ctlr] == index) {
580 serial_init ();
581 }
582#endif
583
584#if defined(SCC_ENET)
585 if (used_by_ether[ctlr] == index) {
586 DECLARE_GLOBAL_DATA_PTR;
587
588 eth_init (gd->bd);
589 }
590#endif
591
592 /*
593 * SCC2 Ethernet parameter RAM space overlaps
594 * the SPI parameter RAM space. So we need to restore
595 * the SPI configuration after SCC2 ethernet test.
596 */
597#if defined(CONFIG_SPI)
598 if (ctlr == CTLR_SCC && index == 1) {
599 spi_init_f ();
600 spi_init_r ();
601 }
602#endif
603
604 if (res != 0) {
605 post_log ("ethernet %s%d test failed\n", ctlr_name[ctlr],
606 index + 1);
607 }
608
609 return res;
610}
611
612int ether_post_test (int flags)
613{
614 int res = 0;
615 int i;
616
617#if defined(CONFIG_8xx_CONS_SCC1)
618 used_by_uart[CTLR_SCC] = 0;
619#elif defined(CONFIG_8xx_CONS_SCC2)
620 used_by_uart[CTLR_SCC] = 1;
621#elif defined(CONFIG_8xx_CONS_SCC3)
622 used_by_uart[CTLR_SCC] = 2;
623#elif defined(CONFIG_8xx_CONS_SCC4)
624 used_by_uart[CTLR_SCC] = 3;
625#endif
626
627#if defined(SCC_ENET)
628 used_by_ether[CTLR_SCC] = SCC_ENET;
629#endif
630
631 ctlr_proc[CTLR_SCC].init = scc_init;
632 ctlr_proc[CTLR_SCC].send = scc_send;
633 ctlr_proc[CTLR_SCC].recv = scc_recv;
634
635 for (i = 0; i < CTRL_LIST_SIZE; i++) {
636 if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) {
637 res = -1;
638 }
639 }
640
641 return res;
642}
643
644#endif /* CONFIG_POST & CFG_POST_ETHER */
645
646#endif /* CONFIG_POST */