ether_fcc.c 29 KB

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