ether_fcc.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. /*
  2. * MPC8260 FCC Fast Ethernet
  3. *
  4. * Copyright (c) 2000 MontaVista Software, Inc. Dan Malek (dmalek@jlc.net)
  5. *
  6. * (C) Copyright 2000 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  7. * Marius Groeger <mgroeger@sysgo.de>
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. /*
  28. * MPC8260 FCC Fast Ethernet
  29. * Basic ET HW initialization and packet RX/TX routines
  30. *
  31. * This code will not perform the IO port configuration. This should be
  32. * done in the iop_conf_t structure specific for the board.
  33. *
  34. * TODO:
  35. * add a PHY driver to do the negotiation
  36. * reflect negotiation results in FPSMR
  37. * look for ways to configure the board specific stuff elsewhere, eg.
  38. * config_xxx.h or the board directory
  39. */
  40. #include <common.h>
  41. #include <malloc.h>
  42. #include <asm/cpm_8260.h>
  43. #include <mpc8260.h>
  44. #include <command.h>
  45. #include <config.h>
  46. #include <net.h>
  47. #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
  48. #include <miiphy.h>
  49. #endif
  50. DECLARE_GLOBAL_DATA_PTR;
  51. #if defined(CONFIG_ETHER_ON_FCC) && defined(CONFIG_CMD_NET)
  52. static struct ether_fcc_info_s
  53. {
  54. int ether_index;
  55. int proff_enet;
  56. ulong cpm_cr_enet_sblock;
  57. ulong cpm_cr_enet_page;
  58. ulong cmxfcr_mask;
  59. ulong cmxfcr_value;
  60. }
  61. ether_fcc_info[] =
  62. {
  63. #ifdef CONFIG_ETHER_ON_FCC1
  64. {
  65. 0,
  66. PROFF_FCC1,
  67. CPM_CR_FCC1_SBLOCK,
  68. CPM_CR_FCC1_PAGE,
  69. CONFIG_SYS_CMXFCR_MASK1,
  70. CONFIG_SYS_CMXFCR_VALUE1
  71. },
  72. #endif
  73. #ifdef CONFIG_ETHER_ON_FCC2
  74. {
  75. 1,
  76. PROFF_FCC2,
  77. CPM_CR_FCC2_SBLOCK,
  78. CPM_CR_FCC2_PAGE,
  79. CONFIG_SYS_CMXFCR_MASK2,
  80. CONFIG_SYS_CMXFCR_VALUE2
  81. },
  82. #endif
  83. #ifdef CONFIG_ETHER_ON_FCC3
  84. {
  85. 2,
  86. PROFF_FCC3,
  87. CPM_CR_FCC3_SBLOCK,
  88. CPM_CR_FCC3_PAGE,
  89. CONFIG_SYS_CMXFCR_MASK3,
  90. CONFIG_SYS_CMXFCR_VALUE3
  91. },
  92. #endif
  93. };
  94. /*---------------------------------------------------------------------*/
  95. /* Maximum input DMA size. Must be a should(?) be a multiple of 4. */
  96. #define PKT_MAXDMA_SIZE 1520
  97. /* The FCC stores dest/src/type, data, and checksum for receive packets. */
  98. #define PKT_MAXBUF_SIZE 1518
  99. #define PKT_MINBUF_SIZE 64
  100. /* Maximum input buffer size. Must be a multiple of 32. */
  101. #define PKT_MAXBLR_SIZE 1536
  102. #define TOUT_LOOP 1000000
  103. #define TX_BUF_CNT 2
  104. #ifdef __GNUC__
  105. static char txbuf[TX_BUF_CNT][PKT_MAXBLR_SIZE] __attribute__ ((aligned(8)));
  106. #else
  107. #error "txbuf must be 64-bit aligned"
  108. #endif
  109. static uint rxIdx; /* index of the current RX buffer */
  110. static uint txIdx; /* index of the current TX buffer */
  111. /*
  112. * FCC Ethernet Tx and Rx buffer descriptors.
  113. * Provide for Double Buffering
  114. * Note: PKTBUFSRX is defined in net.h
  115. */
  116. typedef volatile struct rtxbd {
  117. cbd_t rxbd[PKTBUFSRX];
  118. cbd_t txbd[TX_BUF_CNT];
  119. } RTXBD;
  120. /* Good news: the FCC supports external BDs! */
  121. #ifdef __GNUC__
  122. static RTXBD rtx __attribute__ ((aligned(8)));
  123. #else
  124. #error "rtx must be 64-bit aligned"
  125. #endif
  126. static int fec_send(struct eth_device* dev, volatile void *packet, int length)
  127. {
  128. int i;
  129. int result = 0;
  130. if (length <= 0) {
  131. printf("fec: bad packet size: %d\n", length);
  132. goto out;
  133. }
  134. for(i=0; rtx.txbd[txIdx].cbd_sc & BD_ENET_TX_READY; i++) {
  135. if (i >= TOUT_LOOP) {
  136. puts ("fec: tx buffer not ready\n");
  137. goto out;
  138. }
  139. }
  140. rtx.txbd[txIdx].cbd_bufaddr = (uint)packet;
  141. rtx.txbd[txIdx].cbd_datlen = length;
  142. rtx.txbd[txIdx].cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_LAST |
  143. BD_ENET_TX_WRAP);
  144. for(i=0; rtx.txbd[txIdx].cbd_sc & BD_ENET_TX_READY; i++) {
  145. if (i >= TOUT_LOOP) {
  146. puts ("fec: tx error\n");
  147. goto out;
  148. }
  149. }
  150. #ifdef ET_DEBUG
  151. printf("cycles: %d status: %04x\n", i, rtx.txbd[txIdx].cbd_sc);
  152. #endif
  153. /* return only status bits */
  154. result = rtx.txbd[txIdx].cbd_sc & BD_ENET_TX_STATS;
  155. out:
  156. return result;
  157. }
  158. static int fec_recv(struct eth_device* dev)
  159. {
  160. int length;
  161. for (;;)
  162. {
  163. if (rtx.rxbd[rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
  164. length = -1;
  165. break; /* nothing received - leave for() loop */
  166. }
  167. length = rtx.rxbd[rxIdx].cbd_datlen;
  168. if (rtx.rxbd[rxIdx].cbd_sc & 0x003f) {
  169. printf("fec: rx error %04x\n", rtx.rxbd[rxIdx].cbd_sc);
  170. }
  171. else {
  172. /* Pass the packet up to the protocol layers. */
  173. NetReceive(NetRxPackets[rxIdx], length - 4);
  174. }
  175. /* Give the buffer back to the FCC. */
  176. rtx.rxbd[rxIdx].cbd_datlen = 0;
  177. /* wrap around buffer index when necessary */
  178. if ((rxIdx + 1) >= PKTBUFSRX) {
  179. rtx.rxbd[PKTBUFSRX - 1].cbd_sc = (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
  180. rxIdx = 0;
  181. }
  182. else {
  183. rtx.rxbd[rxIdx].cbd_sc = BD_ENET_RX_EMPTY;
  184. rxIdx++;
  185. }
  186. }
  187. return length;
  188. }
  189. static int fec_init(struct eth_device* dev, bd_t *bis)
  190. {
  191. struct ether_fcc_info_s * info = dev->priv;
  192. int i;
  193. volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
  194. volatile cpm8260_t *cp = &(immr->im_cpm);
  195. fcc_enet_t *pram_ptr;
  196. unsigned long mem_addr;
  197. #if 0
  198. mii_discover_phy();
  199. #endif
  200. /* 28.9 - (1-2): ioports have been set up already */
  201. /* 28.9 - (3): connect FCC's tx and rx clocks */
  202. immr->im_cpmux.cmx_uar = 0;
  203. immr->im_cpmux.cmx_fcr = (immr->im_cpmux.cmx_fcr & ~info->cmxfcr_mask) |
  204. info->cmxfcr_value;
  205. /* 28.9 - (4): GFMR: disable tx/rx, CCITT CRC, Mode Ethernet */
  206. immr->im_fcc[info->ether_index].fcc_gfmr =
  207. FCC_GFMR_MODE_ENET | FCC_GFMR_TCRC_32;
  208. /* 28.9 - (5): FPSMR: enable full duplex, select CCITT CRC for Ethernet */
  209. immr->im_fcc[info->ether_index].fcc_fpsmr = CONFIG_SYS_FCC_PSMR | FCC_PSMR_ENCRC;
  210. /* 28.9 - (6): FDSR: Ethernet Syn */
  211. immr->im_fcc[info->ether_index].fcc_fdsr = 0xD555;
  212. /* reset indeces to current rx/tx bd (see eth_send()/eth_rx()) */
  213. rxIdx = 0;
  214. txIdx = 0;
  215. /* Setup Receiver Buffer Descriptors */
  216. for (i = 0; i < PKTBUFSRX; i++)
  217. {
  218. rtx.rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
  219. rtx.rxbd[i].cbd_datlen = 0;
  220. rtx.rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
  221. }
  222. rtx.rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
  223. /* Setup Ethernet Transmitter Buffer Descriptors */
  224. for (i = 0; i < TX_BUF_CNT; i++)
  225. {
  226. rtx.txbd[i].cbd_sc = (BD_ENET_TX_PAD | BD_ENET_TX_LAST | BD_ENET_TX_TC);
  227. rtx.txbd[i].cbd_datlen = 0;
  228. rtx.txbd[i].cbd_bufaddr = (uint)&txbuf[i][0];
  229. }
  230. rtx.txbd[TX_BUF_CNT - 1].cbd_sc |= BD_ENET_TX_WRAP;
  231. /* 28.9 - (7): initialise parameter ram */
  232. pram_ptr = (fcc_enet_t *)&(immr->im_dprambase[info->proff_enet]);
  233. /* clear whole structure to make sure all reserved fields are zero */
  234. memset((void*)pram_ptr, 0, sizeof(fcc_enet_t));
  235. /*
  236. * common Parameter RAM area
  237. *
  238. * Allocate space in the reserved FCC area of DPRAM for the
  239. * internal buffers. No one uses this space (yet), so we
  240. * can do this. Later, we will add resource management for
  241. * this area.
  242. */
  243. mem_addr = CPM_FCC_SPECIAL_BASE + ((info->ether_index) * 64);
  244. pram_ptr->fen_genfcc.fcc_riptr = mem_addr;
  245. pram_ptr->fen_genfcc.fcc_tiptr = mem_addr+32;
  246. /*
  247. * Set maximum bytes per receive buffer.
  248. * It must be a multiple of 32.
  249. */
  250. pram_ptr->fen_genfcc.fcc_mrblr = PKT_MAXBLR_SIZE;
  251. pram_ptr->fen_genfcc.fcc_rstate = (CPMFCR_GBL | CPMFCR_EB |
  252. CONFIG_SYS_CPMFCR_RAMTYPE) << 24;
  253. pram_ptr->fen_genfcc.fcc_rbase = (unsigned int)(&rtx.rxbd[rxIdx]);
  254. pram_ptr->fen_genfcc.fcc_tstate = (CPMFCR_GBL | CPMFCR_EB |
  255. CONFIG_SYS_CPMFCR_RAMTYPE) << 24;
  256. pram_ptr->fen_genfcc.fcc_tbase = (unsigned int)(&rtx.txbd[txIdx]);
  257. /* protocol-specific area */
  258. pram_ptr->fen_cmask = 0xdebb20e3; /* CRC mask */
  259. pram_ptr->fen_cpres = 0xffffffff; /* CRC preset */
  260. pram_ptr->fen_retlim = 15; /* Retry limit threshold */
  261. pram_ptr->fen_mflr = PKT_MAXBUF_SIZE; /* maximum frame length register */
  262. /*
  263. * Set Ethernet station address.
  264. *
  265. * This is supplied in the board information structure, so we
  266. * copy that into the controller.
  267. * So, far we have only been given one Ethernet address. We make
  268. * it unique by setting a few bits in the upper byte of the
  269. * non-static part of the address.
  270. */
  271. #define ea eth_get_dev()->enetaddr
  272. pram_ptr->fen_paddrh = (ea[5] << 8) + ea[4];
  273. pram_ptr->fen_paddrm = (ea[3] << 8) + ea[2];
  274. pram_ptr->fen_paddrl = (ea[1] << 8) + ea[0];
  275. #undef ea
  276. pram_ptr->fen_minflr = PKT_MINBUF_SIZE; /* minimum frame length register */
  277. /* pad pointer. use tiptr since we don't need a specific padding char */
  278. pram_ptr->fen_padptr = pram_ptr->fen_genfcc.fcc_tiptr;
  279. pram_ptr->fen_maxd1 = PKT_MAXDMA_SIZE; /* maximum DMA1 length */
  280. pram_ptr->fen_maxd2 = PKT_MAXDMA_SIZE; /* maximum DMA2 length */
  281. pram_ptr->fen_rfthr = 1;
  282. pram_ptr->fen_rfcnt = 1;
  283. #if 0
  284. printf("pram_ptr->fen_genfcc.fcc_rbase %08lx\n",
  285. pram_ptr->fen_genfcc.fcc_rbase);
  286. printf("pram_ptr->fen_genfcc.fcc_tbase %08lx\n",
  287. pram_ptr->fen_genfcc.fcc_tbase);
  288. #endif
  289. /* 28.9 - (8): clear out events in FCCE */
  290. immr->im_fcc[info->ether_index].fcc_fcce = ~0x0;
  291. /* 28.9 - (9): FCCM: mask all events */
  292. immr->im_fcc[info->ether_index].fcc_fccm = 0;
  293. /* 28.9 - (10-12): we don't use ethernet interrupts */
  294. /* 28.9 - (13)
  295. *
  296. * Let's re-initialize the channel now. We have to do it later
  297. * than the manual describes because we have just now finished
  298. * the BD initialization.
  299. */
  300. cp->cp_cpcr = mk_cr_cmd(info->cpm_cr_enet_page,
  301. info->cpm_cr_enet_sblock,
  302. 0x0c,
  303. CPM_CR_INIT_TRX) | CPM_CR_FLG;
  304. do {
  305. __asm__ __volatile__ ("eieio");
  306. } while (cp->cp_cpcr & CPM_CR_FLG);
  307. /* 28.9 - (14): enable tx/rx in gfmr */
  308. immr->im_fcc[info->ether_index].fcc_gfmr |= FCC_GFMR_ENT | FCC_GFMR_ENR;
  309. return 1;
  310. }
  311. static void fec_halt(struct eth_device* dev)
  312. {
  313. struct ether_fcc_info_s * info = dev->priv;
  314. volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
  315. /* write GFMR: disable tx/rx */
  316. immr->im_fcc[info->ether_index].fcc_gfmr &=
  317. ~(FCC_GFMR_ENT | FCC_GFMR_ENR);
  318. }
  319. int fec_initialize(bd_t *bis)
  320. {
  321. struct eth_device* dev;
  322. int i;
  323. for (i = 0; i < sizeof(ether_fcc_info) / sizeof(ether_fcc_info[0]); i++)
  324. {
  325. dev = (struct eth_device*) malloc(sizeof *dev);
  326. memset(dev, 0, sizeof *dev);
  327. sprintf(dev->name, "FCC%d",
  328. ether_fcc_info[i].ether_index + 1);
  329. dev->priv = &ether_fcc_info[i];
  330. dev->init = fec_init;
  331. dev->halt = fec_halt;
  332. dev->send = fec_send;
  333. dev->recv = fec_recv;
  334. eth_register(dev);
  335. #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) \
  336. && defined(CONFIG_BITBANGMII)
  337. miiphy_register(dev->name,
  338. bb_miiphy_read, bb_miiphy_write);
  339. #endif
  340. }
  341. return 1;
  342. }
  343. #ifdef CONFIG_ETHER_LOOPBACK_TEST
  344. #define ELBT_BUFSZ 1024 /* must be multiple of 32 */
  345. #define ELBT_CRCSZ 4
  346. #define ELBT_NRXBD 4 /* must be at least 2 */
  347. #define ELBT_NTXBD 4
  348. #define ELBT_MAXRXERR 32
  349. #define ELBT_MAXTXERR 32
  350. #define ELBT_CLSWAIT 1000 /* msec to wait for further input frames */
  351. typedef
  352. struct {
  353. uint off;
  354. char *lab;
  355. }
  356. elbt_prdesc;
  357. typedef
  358. struct {
  359. uint _l, _f, m, bc, mc, lg, no, sh, cr, ov, cl;
  360. uint badsrc, badtyp, badlen, badbit;
  361. }
  362. elbt_rxeacc;
  363. static elbt_prdesc rxeacc_descs[] = {
  364. { offsetof(elbt_rxeacc, _l), "Not Last in Frame" },
  365. { offsetof(elbt_rxeacc, _f), "Not First in Frame" },
  366. { offsetof(elbt_rxeacc, m), "Address Miss" },
  367. { offsetof(elbt_rxeacc, bc), "Broadcast Address" },
  368. { offsetof(elbt_rxeacc, mc), "Multicast Address" },
  369. { offsetof(elbt_rxeacc, lg), "Frame Length Violation"},
  370. { offsetof(elbt_rxeacc, no), "Non-Octet Alignment" },
  371. { offsetof(elbt_rxeacc, sh), "Short Frame" },
  372. { offsetof(elbt_rxeacc, cr), "CRC Error" },
  373. { offsetof(elbt_rxeacc, ov), "Overrun" },
  374. { offsetof(elbt_rxeacc, cl), "Collision" },
  375. { offsetof(elbt_rxeacc, badsrc), "Bad Src Address" },
  376. { offsetof(elbt_rxeacc, badtyp), "Bad Frame Type" },
  377. { offsetof(elbt_rxeacc, badlen), "Bad Frame Length" },
  378. { offsetof(elbt_rxeacc, badbit), "Data Compare Errors" },
  379. };
  380. static int rxeacc_ndesc = sizeof (rxeacc_descs) / sizeof (rxeacc_descs[0]);
  381. typedef
  382. struct {
  383. uint def, hb, lc, rl, rc, un, csl;
  384. }
  385. elbt_txeacc;
  386. static elbt_prdesc txeacc_descs[] = {
  387. { offsetof(elbt_txeacc, def), "Defer Indication" },
  388. { offsetof(elbt_txeacc, hb), "Heartbeat" },
  389. { offsetof(elbt_txeacc, lc), "Late Collision" },
  390. { offsetof(elbt_txeacc, rl), "Retransmission Limit" },
  391. { offsetof(elbt_txeacc, rc), "Retry Count" },
  392. { offsetof(elbt_txeacc, un), "Underrun" },
  393. { offsetof(elbt_txeacc, csl), "Carrier Sense Lost" },
  394. };
  395. static int txeacc_ndesc = sizeof (txeacc_descs) / sizeof (txeacc_descs[0]);
  396. typedef
  397. struct {
  398. uchar rxbufs[ELBT_NRXBD][ELBT_BUFSZ];
  399. uchar txbufs[ELBT_NTXBD][ELBT_BUFSZ];
  400. cbd_t rxbd[ELBT_NRXBD];
  401. cbd_t txbd[ELBT_NTXBD];
  402. enum { Idle, Running, Closing, Closed } state;
  403. int proff, page, sblock;
  404. uint clstime, nsent, ntxerr, nrcvd, nrxerr;
  405. ushort rxerrs[ELBT_MAXRXERR], txerrs[ELBT_MAXTXERR];
  406. elbt_rxeacc rxeacc;
  407. elbt_txeacc txeacc;
  408. } __attribute__ ((aligned(8)))
  409. elbt_chan;
  410. static uchar patbytes[ELBT_NTXBD] = {
  411. 0xff, 0xaa, 0x55, 0x00
  412. };
  413. static uint patwords[ELBT_NTXBD] = {
  414. 0xffffffff, 0xaaaaaaaa, 0x55555555, 0x00000000
  415. };
  416. #ifdef __GNUC__
  417. static elbt_chan elbt_chans[3] __attribute__ ((aligned(8)));
  418. #else
  419. #error "elbt_chans must be 64-bit aligned"
  420. #endif
  421. #define CPM_CR_GRACEFUL_STOP_TX ((ushort)0x0005)
  422. static elbt_prdesc epram_descs[] = {
  423. { offsetof(fcc_enet_t, fen_crcec), "CRC Errors" },
  424. { offsetof(fcc_enet_t, fen_alec), "Alignment Errors" },
  425. { offsetof(fcc_enet_t, fen_disfc), "Discarded Frames" },
  426. { offsetof(fcc_enet_t, fen_octc), "Octets" },
  427. { offsetof(fcc_enet_t, fen_colc), "Collisions" },
  428. { offsetof(fcc_enet_t, fen_broc), "Broadcast Frames" },
  429. { offsetof(fcc_enet_t, fen_mulc), "Multicast Frames" },
  430. { offsetof(fcc_enet_t, fen_uspc), "Undersize Frames" },
  431. { offsetof(fcc_enet_t, fen_frgc), "Fragments" },
  432. { offsetof(fcc_enet_t, fen_ospc), "Oversize Frames" },
  433. { offsetof(fcc_enet_t, fen_jbrc), "Jabbers" },
  434. { offsetof(fcc_enet_t, fen_p64c), "64 Octet Frames" },
  435. { offsetof(fcc_enet_t, fen_p65c), "65-127 Octet Frames" },
  436. { offsetof(fcc_enet_t, fen_p128c), "128-255 Octet Frames" },
  437. { offsetof(fcc_enet_t, fen_p256c), "256-511 Octet Frames" },
  438. { offsetof(fcc_enet_t, fen_p512c), "512-1023 Octet Frames" },
  439. { offsetof(fcc_enet_t, fen_p1024c), "1024-1518 Octet Frames"},
  440. };
  441. static int epram_ndesc = sizeof (epram_descs) / sizeof (epram_descs[0]);
  442. /*
  443. * given an elbt_prdesc array and an array of base addresses, print
  444. * each prdesc down the screen with the values fetched from each
  445. * base address across the screen
  446. */
  447. static void
  448. print_desc (elbt_prdesc descs[], int ndesc, uchar *bases[], int nbase)
  449. {
  450. elbt_prdesc *dp = descs, *edp = dp + ndesc;
  451. int i;
  452. printf ("%32s", "");
  453. for (i = 0; i < nbase; i++)
  454. printf (" Channel %d", i);
  455. putc ('\n');
  456. while (dp < edp) {
  457. printf ("%-32s", dp->lab);
  458. for (i = 0; i < nbase; i++) {
  459. uint val = *(uint *)(bases[i] + dp->off);
  460. printf (" %10u", val);
  461. }
  462. putc ('\n');
  463. dp++;
  464. }
  465. }
  466. /*
  467. * return number of bits that are set in a value; value contains
  468. * nbits (right-justified) bits.
  469. */
  470. static uint __inline__
  471. nbs (uint value, uint nbits)
  472. {
  473. uint cnt = 0;
  474. #if 1
  475. uint pos = sizeof (uint) * 8;
  476. __asm__ __volatile__ ("\
  477. mtctr %2\n\
  478. 1: rlwnm. %2,%1,%4,31,31\n\
  479. beq 2f\n\
  480. addi %0,%0,1\n\
  481. 2: subi %4,%4,1\n\
  482. bdnz 1b"
  483. : "=r"(cnt)
  484. : "r"(value), "r"(nbits), "r"(cnt), "r"(pos)
  485. : "ctr", "cc" );
  486. #else
  487. uint mask = 1;
  488. do {
  489. if (value & mask)
  490. cnt++;
  491. mask <<= 1;
  492. } while (--nbits);
  493. #endif
  494. return (cnt);
  495. }
  496. static ulong
  497. badbits (uchar *bp, int n, ulong pat)
  498. {
  499. ulong *lp, cnt = 0;
  500. int nl;
  501. while (n > 0 && ((ulong)bp & (sizeof (ulong) - 1)) != 0) {
  502. uchar diff;
  503. diff = *bp++ ^ (uchar)pat;
  504. if (diff)
  505. cnt += nbs ((ulong)diff, 8);
  506. n--;
  507. }
  508. lp = (ulong *)bp;
  509. nl = n / sizeof (ulong);
  510. n -= nl * sizeof (ulong);
  511. while (nl > 0) {
  512. ulong diff;
  513. diff = *lp++ ^ pat;
  514. if (diff)
  515. cnt += nbs (diff, 32);
  516. nl--;
  517. }
  518. bp = (uchar *)lp;
  519. while (n > 0) {
  520. uchar diff;
  521. diff = *bp++ ^ (uchar)pat;
  522. if (diff)
  523. cnt += nbs ((ulong)diff, 8);
  524. n--;
  525. }
  526. return (cnt);
  527. }
  528. static inline unsigned short
  529. swap16 (unsigned short x)
  530. {
  531. return (((x & 0xff) << 8) | ((x & 0xff00) >> 8));
  532. }
  533. /* broadcast is not an error - we send them like that */
  534. #define BD_ENET_RX_ERRS (BD_ENET_RX_STATS & ~BD_ENET_RX_BC)
  535. void
  536. eth_loopback_test (void)
  537. {
  538. volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
  539. volatile cpm8260_t *cp = &(immr->im_cpm);
  540. int c, nclosed;
  541. ulong runtime, nmsec;
  542. uchar *bases[3];
  543. puts ("FCC Ethernet External loopback test\n");
  544. eth_getenv_enetaddr("ethaddr", NetOurEther);
  545. /*
  546. * global initialisations for all FCC channels
  547. */
  548. /* 28.9 - (1-2): ioports have been set up already */
  549. #if defined(CONFIG_HYMOD)
  550. /*
  551. * Attention: this is board-specific
  552. * 0, FCC1
  553. * 1, FCC2
  554. * 2, FCC3
  555. */
  556. # define FCC_START_LOOP 0
  557. # define FCC_END_LOOP 2
  558. /*
  559. * Attention: this is board-specific
  560. * - FCC1 Rx-CLK is CLK10
  561. * - FCC1 Tx-CLK is CLK11
  562. * - FCC2 Rx-CLK is CLK13
  563. * - FCC2 Tx-CLK is CLK14
  564. * - FCC3 Rx-CLK is CLK15
  565. * - FCC3 Tx-CLK is CLK16
  566. */
  567. /* 28.9 - (3): connect FCC's tx and rx clocks */
  568. immr->im_cpmux.cmx_uar = 0;
  569. immr->im_cpmux.cmx_fcr = CMXFCR_RF1CS_CLK10|CMXFCR_TF1CS_CLK11|\
  570. CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14|\
  571. CMXFCR_RF3CS_CLK15|CMXFCR_TF3CS_CLK16;
  572. #elif defined(CONFIG_SACSng)
  573. /*
  574. * Attention: this is board-specific
  575. * 1, FCC2
  576. */
  577. # define FCC_START_LOOP 1
  578. # define FCC_END_LOOP 1
  579. /*
  580. * Attention: this is board-specific
  581. * - FCC2 Rx-CLK is CLK13
  582. * - FCC2 Tx-CLK is CLK14
  583. */
  584. /* 28.9 - (3): connect FCC's tx and rx clocks */
  585. immr->im_cpmux.cmx_uar = 0;
  586. immr->im_cpmux.cmx_fcr = CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14;
  587. #else
  588. #error "eth_loopback_test not supported on your board"
  589. #endif
  590. puts ("Initialise FCC channels:");
  591. for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++) {
  592. elbt_chan *ecp = &elbt_chans[c];
  593. volatile fcc_t *fcp = &immr->im_fcc[c];
  594. volatile fcc_enet_t *fpp;
  595. int i;
  596. ulong addr;
  597. /*
  598. * initialise channel data
  599. */
  600. printf (" %d", c);
  601. memset ((void *)ecp, 0, sizeof (*ecp));
  602. ecp->state = Idle;
  603. switch (c) {
  604. case 0: /* FCC1 */
  605. ecp->proff = PROFF_FCC1;
  606. ecp->page = CPM_CR_FCC1_PAGE;
  607. ecp->sblock = CPM_CR_FCC1_SBLOCK;
  608. break;
  609. case 1: /* FCC2 */
  610. ecp->proff = PROFF_FCC2;
  611. ecp->page = CPM_CR_FCC2_PAGE;
  612. ecp->sblock = CPM_CR_FCC2_SBLOCK;
  613. break;
  614. case 2: /* FCC3 */
  615. ecp->proff = PROFF_FCC3;
  616. ecp->page = CPM_CR_FCC3_PAGE;
  617. ecp->sblock = CPM_CR_FCC3_SBLOCK;
  618. break;
  619. }
  620. /*
  621. * set up tx buffers and bds
  622. */
  623. for (i = 0; i < ELBT_NTXBD; i++) {
  624. cbd_t *bdp = &ecp->txbd[i];
  625. uchar *bp = &ecp->txbufs[i][0];
  626. bdp->cbd_bufaddr = (uint)bp;
  627. /* room for crc */
  628. bdp->cbd_datlen = ELBT_BUFSZ - ELBT_CRCSZ;
  629. bdp->cbd_sc = BD_ENET_TX_READY | BD_ENET_TX_PAD | \
  630. BD_ENET_TX_LAST | BD_ENET_TX_TC;
  631. memset ((void *)bp, patbytes[i], ELBT_BUFSZ);
  632. NetSetEther (bp, NetBcastAddr, 0x8000);
  633. }
  634. ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP;
  635. /*
  636. * set up rx buffers and bds
  637. */
  638. for (i = 0; i < ELBT_NRXBD; i++) {
  639. cbd_t *bdp = &ecp->rxbd[i];
  640. uchar *bp = &ecp->rxbufs[i][0];
  641. bdp->cbd_bufaddr = (uint)bp;
  642. bdp->cbd_datlen = 0;
  643. bdp->cbd_sc = BD_ENET_RX_EMPTY;
  644. memset ((void *)bp, 0, ELBT_BUFSZ);
  645. }
  646. ecp->rxbd[ELBT_NRXBD - 1].cbd_sc |= BD_ENET_RX_WRAP;
  647. /*
  648. * set up the FCC channel hardware
  649. */
  650. /* 28.9 - (4): GFMR: disable tx/rx, CCITT CRC, Mode Ethernet */
  651. fcp->fcc_gfmr = FCC_GFMR_MODE_ENET | FCC_GFMR_TCRC_32;
  652. /* 28.9 - (5): FPSMR: fd, enet CRC, Promis, RMON, Rx SHort */
  653. fcp->fcc_fpsmr = FCC_PSMR_FDE | FCC_PSMR_LPB | \
  654. FCC_PSMR_ENCRC | FCC_PSMR_PRO | \
  655. FCC_PSMR_MON | FCC_PSMR_RSH;
  656. /* 28.9 - (6): FDSR: Ethernet Syn */
  657. fcp->fcc_fdsr = 0xD555;
  658. /* 29.9 - (7): initialise parameter ram */
  659. fpp = (fcc_enet_t *)&(immr->im_dprambase[ecp->proff]);
  660. /* clear whole struct to make sure all resv fields are zero */
  661. memset ((void *)fpp, 0, sizeof (fcc_enet_t));
  662. /*
  663. * common Parameter RAM area
  664. *
  665. * Allocate space in the reserved FCC area of DPRAM for the
  666. * internal buffers. No one uses this space (yet), so we
  667. * can do this. Later, we will add resource management for
  668. * this area.
  669. */
  670. addr = CPM_FCC_SPECIAL_BASE + (c * 64);
  671. fpp->fen_genfcc.fcc_riptr = addr;
  672. fpp->fen_genfcc.fcc_tiptr = addr + 32;
  673. /*
  674. * Set maximum bytes per receive buffer.
  675. * It must be a multiple of 32.
  676. * buffers are in 60x bus memory.
  677. */
  678. fpp->fen_genfcc.fcc_mrblr = PKT_MAXBLR_SIZE;
  679. fpp->fen_genfcc.fcc_rstate = (CPMFCR_GBL | CPMFCR_EB) << 24;
  680. fpp->fen_genfcc.fcc_rbase = (unsigned int)(&ecp->rxbd[0]);
  681. fpp->fen_genfcc.fcc_tstate = (CPMFCR_GBL | CPMFCR_EB) << 24;
  682. fpp->fen_genfcc.fcc_tbase = (unsigned int)(&ecp->txbd[0]);
  683. /* protocol-specific area */
  684. fpp->fen_cmask = 0xdebb20e3; /* CRC mask */
  685. fpp->fen_cpres = 0xffffffff; /* CRC preset */
  686. fpp->fen_retlim = 15; /* Retry limit threshold */
  687. fpp->fen_mflr = PKT_MAXBUF_SIZE;/* max frame length register */
  688. /*
  689. * Set Ethernet station address.
  690. *
  691. * This is supplied in the board information structure, so we
  692. * copy that into the controller.
  693. * So, far we have only been given one Ethernet address. We use
  694. * the same address for all channels
  695. */
  696. #define ea NetOurEther
  697. fpp->fen_paddrh = (ea[5] << 8) + ea[4];
  698. fpp->fen_paddrm = (ea[3] << 8) + ea[2];
  699. fpp->fen_paddrl = (ea[1] << 8) + ea[0];
  700. #undef ea
  701. fpp->fen_minflr = PKT_MINBUF_SIZE; /* min frame len register */
  702. /*
  703. * pad pointer. use tiptr since we don't need
  704. * a specific padding char
  705. */
  706. fpp->fen_padptr = fpp->fen_genfcc.fcc_tiptr;
  707. fpp->fen_maxd1 = PKT_MAXDMA_SIZE; /* max DMA1 length */
  708. fpp->fen_maxd2 = PKT_MAXDMA_SIZE; /* max DMA2 length */
  709. fpp->fen_rfthr = 1;
  710. fpp->fen_rfcnt = 1;
  711. /* 28.9 - (8): clear out events in FCCE */
  712. fcp->fcc_fcce = ~0x0;
  713. /* 28.9 - (9): FCCM: mask all events */
  714. fcp->fcc_fccm = 0;
  715. /* 28.9 - (10-12): we don't use ethernet interrupts */
  716. /* 28.9 - (13)
  717. *
  718. * Let's re-initialize the channel now. We have to do it later
  719. * than the manual describes because we have just now finished
  720. * the BD initialization.
  721. */
  722. cp->cp_cpcr = mk_cr_cmd (ecp->page, ecp->sblock, \
  723. 0x0c, CPM_CR_INIT_TRX) | CPM_CR_FLG;
  724. do {
  725. __asm__ __volatile__ ("eieio");
  726. } while (cp->cp_cpcr & CPM_CR_FLG);
  727. }
  728. puts (" done\nStarting test... (Ctrl-C to Finish)\n");
  729. /*
  730. * Note: don't want serial output from here until the end of the
  731. * test - the delays would probably stuff things up.
  732. */
  733. clear_ctrlc ();
  734. runtime = get_timer (0);
  735. do {
  736. nclosed = 0;
  737. for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++) {
  738. volatile fcc_t *fcp = &immr->im_fcc[c];
  739. elbt_chan *ecp = &elbt_chans[c];
  740. int i;
  741. switch (ecp->state) {
  742. case Idle:
  743. /*
  744. * set the channel Running ...
  745. */
  746. /* 28.9 - (14): enable tx/rx in gfmr */
  747. fcp->fcc_gfmr |= FCC_GFMR_ENT | FCC_GFMR_ENR;
  748. ecp->state = Running;
  749. break;
  750. case Running:
  751. /*
  752. * (while Running only) check for
  753. * termination of the test
  754. */
  755. (void)ctrlc ();
  756. if (had_ctrlc ()) {
  757. /*
  758. * initiate a "graceful stop transmit"
  759. * on the channel
  760. */
  761. cp->cp_cpcr = mk_cr_cmd (ecp->page, \
  762. ecp->sblock, 0x0c, \
  763. CPM_CR_GRACEFUL_STOP_TX) | \
  764. CPM_CR_FLG;
  765. do {
  766. __asm__ __volatile__ ("eieio");
  767. } while (cp->cp_cpcr & CPM_CR_FLG);
  768. ecp->clstime = get_timer (0);
  769. ecp->state = Closing;
  770. }
  771. /* fall through ... */
  772. case Closing:
  773. /*
  774. * (while Running or Closing) poll the channel:
  775. * - check for any non-READY tx buffers and
  776. * make them ready
  777. * - check for any non-EMPTY rx buffers and
  778. * check that they were received correctly,
  779. * adjust counters etc, then make empty
  780. */
  781. for (i = 0; i < ELBT_NTXBD; i++) {
  782. cbd_t *bdp = &ecp->txbd[i];
  783. ushort sc = bdp->cbd_sc;
  784. if ((sc & BD_ENET_TX_READY) != 0)
  785. continue;
  786. /*
  787. * this frame has finished
  788. * transmitting
  789. */
  790. ecp->nsent++;
  791. if (sc & BD_ENET_TX_STATS) {
  792. ulong n;
  793. /*
  794. * we had an error on
  795. * the transmission
  796. */
  797. n = ecp->ntxerr++;
  798. if (n < ELBT_MAXTXERR)
  799. ecp->txerrs[n] = sc;
  800. if (sc & BD_ENET_TX_DEF)
  801. ecp->txeacc.def++;
  802. if (sc & BD_ENET_TX_HB)
  803. ecp->txeacc.hb++;
  804. if (sc & BD_ENET_TX_LC)
  805. ecp->txeacc.lc++;
  806. if (sc & BD_ENET_TX_RL)
  807. ecp->txeacc.rl++;
  808. if (sc & BD_ENET_TX_RCMASK)
  809. ecp->txeacc.rc++;
  810. if (sc & BD_ENET_TX_UN)
  811. ecp->txeacc.un++;
  812. if (sc & BD_ENET_TX_CSL)
  813. ecp->txeacc.csl++;
  814. bdp->cbd_sc &= \
  815. ~BD_ENET_TX_STATS;
  816. }
  817. if (ecp->state == Closing)
  818. ecp->clstime = get_timer (0);
  819. /* make it ready again */
  820. bdp->cbd_sc |= BD_ENET_TX_READY;
  821. }
  822. for (i = 0; i < ELBT_NRXBD; i++) {
  823. cbd_t *bdp = &ecp->rxbd[i];
  824. ushort sc = bdp->cbd_sc, mask;
  825. if ((sc & BD_ENET_RX_EMPTY) != 0)
  826. continue;
  827. /* we have a new frame in this buffer */
  828. ecp->nrcvd++;
  829. mask = BD_ENET_RX_LAST|BD_ENET_RX_FIRST;
  830. if ((sc & mask) != mask) {
  831. /* somethings wrong here ... */
  832. if (!(sc & BD_ENET_RX_LAST))
  833. ecp->rxeacc._l++;
  834. if (!(sc & BD_ENET_RX_FIRST))
  835. ecp->rxeacc._f++;
  836. }
  837. if (sc & BD_ENET_RX_ERRS) {
  838. ulong n;
  839. /*
  840. * we had some sort of error
  841. * on the frame
  842. */
  843. n = ecp->nrxerr++;
  844. if (n < ELBT_MAXRXERR)
  845. ecp->rxerrs[n] = sc;
  846. if (sc & BD_ENET_RX_MISS)
  847. ecp->rxeacc.m++;
  848. if (sc & BD_ENET_RX_BC)
  849. ecp->rxeacc.bc++;
  850. if (sc & BD_ENET_RX_MC)
  851. ecp->rxeacc.mc++;
  852. if (sc & BD_ENET_RX_LG)
  853. ecp->rxeacc.lg++;
  854. if (sc & BD_ENET_RX_NO)
  855. ecp->rxeacc.no++;
  856. if (sc & BD_ENET_RX_SH)
  857. ecp->rxeacc.sh++;
  858. if (sc & BD_ENET_RX_CR)
  859. ecp->rxeacc.cr++;
  860. if (sc & BD_ENET_RX_OV)
  861. ecp->rxeacc.ov++;
  862. if (sc & BD_ENET_RX_CL)
  863. ecp->rxeacc.cl++;
  864. bdp->cbd_sc &= \
  865. ~BD_ENET_RX_ERRS;
  866. }
  867. else {
  868. ushort datlen = bdp->cbd_datlen;
  869. Ethernet_t *ehp;
  870. ushort prot;
  871. int ours, tb, n, nbytes;
  872. ehp = (Ethernet_t *) \
  873. &ecp->rxbufs[i][0];
  874. ours = memcmp (ehp->et_src, \
  875. NetOurEther, 6);
  876. prot = swap16 (ehp->et_protlen);
  877. tb = prot & 0x8000;
  878. n = prot & 0x7fff;
  879. nbytes = ELBT_BUFSZ - \
  880. offsetof (Ethernet_t, \
  881. et_dsap) - \
  882. ELBT_CRCSZ;
  883. /* check the frame is correct */
  884. if (datlen != ELBT_BUFSZ)
  885. ecp->rxeacc.badlen++;
  886. else if (!ours)
  887. ecp->rxeacc.badsrc++;
  888. else if (!tb || n >= ELBT_NTXBD)
  889. ecp->rxeacc.badtyp++;
  890. else {
  891. ulong patword = \
  892. patwords[n];
  893. uint nbb;
  894. nbb = badbits ( \
  895. &ehp->et_dsap, \
  896. nbytes, \
  897. patword);
  898. ecp->rxeacc.badbit += \
  899. nbb;
  900. }
  901. }
  902. if (ecp->state == Closing)
  903. ecp->clstime = get_timer (0);
  904. /* make it empty again */
  905. bdp->cbd_sc |= BD_ENET_RX_EMPTY;
  906. }
  907. if (ecp->state != Closing)
  908. break;
  909. /*
  910. * (while Closing) check to see if
  911. * waited long enough
  912. */
  913. if (get_timer (ecp->clstime) >= ELBT_CLSWAIT) {
  914. /* write GFMR: disable tx/rx */
  915. fcp->fcc_gfmr &= \
  916. ~(FCC_GFMR_ENT | FCC_GFMR_ENR);
  917. ecp->state = Closed;
  918. }
  919. break;
  920. case Closed:
  921. nclosed++;
  922. break;
  923. }
  924. }
  925. } while (nclosed < (FCC_END_LOOP - FCC_START_LOOP + 1));
  926. runtime = get_timer (runtime);
  927. if (runtime <= ELBT_CLSWAIT) {
  928. printf ("Whoops! somehow elapsed time (%ld) is wrong (<= %d)\n",
  929. runtime, ELBT_CLSWAIT);
  930. return;
  931. }
  932. nmsec = runtime - ELBT_CLSWAIT;
  933. printf ("Test Finished in %ldms (plus %dms close wait period)!\n\n",
  934. nmsec, ELBT_CLSWAIT);
  935. /*
  936. * now print stats
  937. */
  938. for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++) {
  939. elbt_chan *ecp = &elbt_chans[c];
  940. uint rxpps, txpps, nerr;
  941. rxpps = (ecp->nrcvd * 1000) / nmsec;
  942. txpps = (ecp->nsent * 1000) / nmsec;
  943. printf ("Channel %d: %d rcvd (%d pps, %d rxerrs), "
  944. "%d sent (%d pps, %d txerrs)\n\n", c,
  945. ecp->nrcvd, rxpps, ecp->nrxerr,
  946. ecp->nsent, txpps, ecp->ntxerr);
  947. if ((nerr = ecp->nrxerr) > 0) {
  948. ulong i;
  949. printf ("\tFirst %d rx errs:", nerr);
  950. for (i = 0; i < nerr; i++)
  951. printf (" %04x", ecp->rxerrs[i]);
  952. putc ('\n');
  953. }
  954. if ((nerr = ecp->ntxerr) > 0) {
  955. ulong i;
  956. printf ("\tFirst %d tx errs:", nerr);
  957. for (i = 0; i < nerr; i++)
  958. printf (" %04x", ecp->txerrs[i]);
  959. putc ('\n');
  960. }
  961. }
  962. puts ("Receive Error Counts:\n");
  963. for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++)
  964. bases[c] = (uchar *)&elbt_chans[c].rxeacc;
  965. print_desc (rxeacc_descs, rxeacc_ndesc, bases, 3);
  966. puts ("\nTransmit Error Counts:\n");
  967. for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++)
  968. bases[c] = (uchar *)&elbt_chans[c].txeacc;
  969. print_desc (txeacc_descs, txeacc_ndesc, bases, 3);
  970. puts ("\nRMON(-like) Counters:\n");
  971. for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++)
  972. bases[c] = (uchar *)&immr->im_dprambase[elbt_chans[c].proff];
  973. print_desc (epram_descs, epram_ndesc, bases, 3);
  974. }
  975. #endif /* CONFIG_ETHER_LOOPBACK_TEST */
  976. #endif