blob: b846cad4ffa32d8eec3185167ef2af3eb9bce0ef [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
wdenk1ebf41e2004-01-02 14:00:00 +00002 * (C) Copyright 2001-2004
wdenkc6097192002-11-03 00:24:07 +00003 * 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#include <command.h>
26#include <net.h>
Marian Balakowiczcbdd1c82005-11-30 18:06:04 +010027#include <miiphy.h>
wdenkc6097192002-11-03 00:24:07 +000028
Jon Loeliger54f35c22007-07-09 17:45:14 -050029#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
wdenkc6097192002-11-03 00:24:07 +000030
Ben Warrend448a492008-06-23 22:57:27 -070031/*
32 * CPU and board-specific Ethernet initializations. Aliased function
33 * signals caller to move on
34 */
35static int __def_eth_init(bd_t *bis)
36{
37 return -1;
38}
39int cpu_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init")));
40int board_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init")));
41
wdenkc6097192002-11-03 00:24:07 +000042#ifdef CFG_GT_6426x
43extern int gt6426x_eth_initialize(bd_t *bis);
44#endif
45
wdenk5da7f2f2004-01-03 00:43:19 +000046extern int au1x00_enet_initialize(bd_t*);
47extern int dc21x4x_initialize(bd_t*);
wdenk4e112c12003-06-03 23:54:09 +000048extern int e1000_initialize(bd_t*);
wdenkc6097192002-11-03 00:24:07 +000049extern int eepro100_initialize(bd_t*);
wdenk452cfd62002-11-19 11:04:11 +000050extern int eth_3com_initialize(bd_t*);
wdenkc6097192002-11-03 00:24:07 +000051extern int fec_initialize(bd_t*);
wdenk4fc95692003-02-28 00:49:47 +000052extern int inca_switch_initialize(bd_t*);
wdenk21136db2003-07-16 21:53:01 +000053extern int mpc5xxx_fec_initialize(bd_t*);
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020054extern int mpc512x_fec_initialize(bd_t*);
wdenk337f5652004-10-28 00:09:35 +000055extern int mpc8220_fec_initialize(bd_t*);
wdenk5da7f2f2004-01-03 00:43:19 +000056extern int mv6436x_eth_initialize(bd_t *);
57extern int mv6446x_eth_initialize(bd_t *);
58extern int natsemi_initialize(bd_t*);
wdenk5da7f2f2004-01-03 00:43:19 +000059extern int pcnet_initialize(bd_t*);
60extern int plb2800_eth_initialize(bd_t*);
61extern int ppc_4xx_eth_initialize(bd_t *);
wdenk5da7f2f2004-01-03 00:43:19 +000062extern int scc_initialize(bd_t*);
Wolfgang Denk4646d2a2006-05-30 15:56:48 +020063extern int npe_initialize(bd_t *);
Dave Liue732e9c2006-11-03 12:11:15 -060064extern int uec_initialize(int);
wdenkc6097192002-11-03 00:24:07 +000065
Rafal Jaworowski1f2c9a42007-12-27 18:19:02 +010066#ifdef CONFIG_API
67extern void (*push_packet)(volatile void *, int);
68
69static struct {
70 uchar data[PKTSIZE];
71 int length;
72} eth_rcv_bufs[PKTBUFSRX];
73
74static unsigned int eth_rcv_current = 0, eth_rcv_last = 0;
75#endif
76
wdenkc6097192002-11-03 00:24:07 +000077static struct eth_device *eth_devices, *eth_current;
78
79struct eth_device *eth_get_dev(void)
80{
81 return eth_current;
82}
83
Marian Balakowiczaab8c492005-10-28 22:30:33 +020084struct eth_device *eth_get_dev_by_name(char *devname)
85{
86 struct eth_device *dev, *target_dev;
87
88 if (!eth_devices)
89 return NULL;
90
91 dev = eth_devices;
92 target_dev = NULL;
93 do {
94 if (strcmp(devname, dev->name) == 0) {
95 target_dev = dev;
96 break;
97 }
98 dev = dev->next;
99 } while (dev != eth_devices);
100
101 return target_dev;
102}
103
wdenkc6097192002-11-03 00:24:07 +0000104int eth_get_dev_index (void)
105{
106 struct eth_device *dev;
107 int num = 0;
108
109 if (!eth_devices) {
110 return (-1);
111 }
112
113 for (dev = eth_devices; dev; dev = dev->next) {
114 if (dev == eth_current)
115 break;
116 ++num;
117 }
118
119 if (dev) {
120 return (num);
121 }
122
123 return (0);
124}
125
126int eth_register(struct eth_device* dev)
127{
128 struct eth_device *d;
129
130 if (!eth_devices) {
131 eth_current = eth_devices = dev;
wdenk145d2c12004-04-15 21:48:45 +0000132#ifdef CONFIG_NET_MULTI
133 /* update current ethernet name */
134 {
135 char *act = getenv("ethact");
136 if (act == NULL || strcmp(act, eth_current->name) != 0)
137 setenv("ethact", eth_current->name);
138 }
139#endif
wdenkc6097192002-11-03 00:24:07 +0000140 } else {
141 for (d=eth_devices; d->next!=eth_devices; d=d->next);
142 d->next = dev;
143 }
144
145 dev->state = ETH_STATE_INIT;
146 dev->next = eth_devices;
147
148 return 0;
149}
150
151int eth_initialize(bd_t *bis)
152{
Shinya Kuribayashidb7101e2007-11-19 20:27:04 +0900153 char enetvar[32];
154 unsigned char env_enetaddr[6];
wdenkc6097192002-11-03 00:24:07 +0000155 int i, eth_number = 0;
156 char *tmp, *end;
157
158 eth_devices = NULL;
159 eth_current = NULL;
160
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200161 show_boot_progress (64);
Jon Loeliger54f35c22007-07-09 17:45:14 -0500162#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
Marian Balakowiczcbdd1c82005-11-30 18:06:04 +0100163 miiphy_init();
164#endif
Ben Warrend448a492008-06-23 22:57:27 -0700165 /* Try board-specific initialization first. If it fails or isn't
166 * present, try the cpu-specific initialization */
167 if (board_eth_init(bis) < 0)
168 cpu_eth_init(bis);
Marian Balakowiczcbdd1c82005-11-30 18:06:04 +0100169
Stefan Roese45993ea2006-11-29 15:42:37 +0100170#if defined(CONFIG_DB64360) || defined(CONFIG_CPCI750)
wdenk5da7f2f2004-01-03 00:43:19 +0000171 mv6436x_eth_initialize(bis);
172#endif
Stefan Roese45993ea2006-11-29 15:42:37 +0100173#if defined(CONFIG_DB64460) || defined(CONFIG_P3Mx)
wdenk5da7f2f2004-01-03 00:43:19 +0000174 mv6446x_eth_initialize(bis);
175#endif
Wolfgang Denk56811f62005-10-09 01:04:33 +0200176#if defined(CONFIG_4xx) && !defined(CONFIG_IOP480) && !defined(CONFIG_AP1000)
wdenk57b2d802003-06-27 21:31:46 +0000177 ppc_4xx_eth_initialize(bis);
wdenk77934442003-06-05 19:37:36 +0000178#endif
wdenk4fc95692003-02-28 00:49:47 +0000179#ifdef CONFIG_INCA_IP_SWITCH
180 inca_switch_initialize(bis);
181#endif
wdenkb02744a2003-04-05 00:53:31 +0000182#ifdef CONFIG_PLB2800_ETHER
183 plb2800_eth_initialize(bis);
184#endif
wdenk63a10be2004-05-08 20:33:20 +0000185#ifdef SCC_ENET
186 scc_initialize(bis);
187#endif
wdenk63a10be2004-05-08 20:33:20 +0000188#if defined(CONFIG_MPC5xxx_FEC)
189 mpc5xxx_fec_initialize(bis);
190#endif
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200191#if defined(CONFIG_MPC512x_FEC)
192 mpc512x_fec_initialize (bis);
193#endif
wdenk5c71a7a2005-05-16 15:23:22 +0000194#if defined(CONFIG_MPC8220_FEC)
wdenk337f5652004-10-28 00:09:35 +0000195 mpc8220_fec_initialize(bis);
196#endif
Dave Liue732e9c2006-11-03 12:11:15 -0600197#if defined(CONFIG_UEC_ETH1)
198 uec_initialize(0);
199#endif
200#if defined(CONFIG_UEC_ETH2)
201 uec_initialize(1);
202#endif
Joakim Tjernlund4e483202007-12-06 16:43:40 +0100203#if defined(CONFIG_UEC_ETH3)
204 uec_initialize(2);
205#endif
David Saadaf3978832008-01-15 10:40:24 +0200206#if defined(CONFIG_UEC_ETH4)
207 uec_initialize(3);
208#endif
Jon Loeliger5c8aa972006-04-26 17:58:56 -0500209
Stefan Roese09554022005-11-30 13:06:40 +0100210#if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
211 fec_initialize(bis);
212#endif
wdenk63a10be2004-05-08 20:33:20 +0000213#if defined(CONFIG_AU1X00)
214 au1x00_enet_initialize(bis);
215#endif
Wolfgang Denk4646d2a2006-05-30 15:56:48 +0200216#if defined(CONFIG_IXP4XX_NPE)
217 npe_initialize(bis);
218#endif
wdenk4e112c12003-06-03 23:54:09 +0000219#ifdef CONFIG_E1000
220 e1000_initialize(bis);
221#endif
wdenkc6097192002-11-03 00:24:07 +0000222#ifdef CONFIG_EEPRO100
223 eepro100_initialize(bis);
224#endif
225#ifdef CONFIG_TULIP
226 dc21x4x_initialize(bis);
227#endif
wdenk452cfd62002-11-19 11:04:11 +0000228#ifdef CONFIG_3COM
229 eth_3com_initialize(bis);
230#endif
wdenkc6097192002-11-03 00:24:07 +0000231#ifdef CONFIG_PCNET
232 pcnet_initialize(bis);
233#endif
234#ifdef CFG_GT_6426x
235 gt6426x_eth_initialize(bis);
236#endif
237#ifdef CONFIG_NATSEMI
238 natsemi_initialize(bis);
239#endif
wdenkc6097192002-11-03 00:24:07 +0000240 if (!eth_devices) {
241 puts ("No ethernet found.\n");
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200242 show_boot_progress (-64);
wdenkc6097192002-11-03 00:24:07 +0000243 } else {
244 struct eth_device *dev = eth_devices;
245 char *ethprime = getenv ("ethprime");
246
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200247 show_boot_progress (65);
wdenkc6097192002-11-03 00:24:07 +0000248 do {
249 if (eth_number)
250 puts (", ");
251
252 printf("%s", dev->name);
253
254 if (ethprime && strcmp (dev->name, ethprime) == 0) {
255 eth_current = dev;
256 puts (" [PRIME]");
257 }
258
259 sprintf(enetvar, eth_number ? "eth%daddr" : "ethaddr", eth_number);
260 tmp = getenv (enetvar);
261
262 for (i=0; i<6; i++) {
263 env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
264 if (tmp)
265 tmp = (*end) ? end+1 : end;
266 }
267
268 if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
269 if (memcmp(dev->enetaddr, "\0\0\0\0\0\0", 6) &&
270 memcmp(dev->enetaddr, env_enetaddr, 6))
271 {
wdenk63a10be2004-05-08 20:33:20 +0000272 printf ("\nWarning: %s MAC addresses don't match:\n",
273 dev->name);
274 printf ("Address in SROM is "
wdenkc6097192002-11-03 00:24:07 +0000275 "%02X:%02X:%02X:%02X:%02X:%02X\n",
276 dev->enetaddr[0], dev->enetaddr[1],
277 dev->enetaddr[2], dev->enetaddr[3],
278 dev->enetaddr[4], dev->enetaddr[5]);
wdenk63a10be2004-05-08 20:33:20 +0000279 printf ("Address in environment is "
wdenkc6097192002-11-03 00:24:07 +0000280 "%02X:%02X:%02X:%02X:%02X:%02X\n",
281 env_enetaddr[0], env_enetaddr[1],
282 env_enetaddr[2], env_enetaddr[3],
283 env_enetaddr[4], env_enetaddr[5]);
284 }
285
286 memcpy(dev->enetaddr, env_enetaddr, 6);
287 }
288
289 eth_number++;
290 dev = dev->next;
291 } while(dev != eth_devices);
292
wdenk145d2c12004-04-15 21:48:45 +0000293#ifdef CONFIG_NET_MULTI
294 /* update current ethernet name */
295 if (eth_current) {
296 char *act = getenv("ethact");
297 if (act == NULL || strcmp(act, eth_current->name) != 0)
298 setenv("ethact", eth_current->name);
299 } else
300 setenv("ethact", NULL);
301#endif
302
wdenkc6097192002-11-03 00:24:07 +0000303 putc ('\n');
304 }
305
306 return eth_number;
307}
308
309void eth_set_enetaddr(int num, char *addr) {
310 struct eth_device *dev;
311 unsigned char enetaddr[6];
312 char *end;
313 int i;
314
wdenk1ebf41e2004-01-02 14:00:00 +0000315 debug ("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
316
wdenkc6097192002-11-03 00:24:07 +0000317 if (!eth_devices)
318 return;
319
320 for (i=0; i<6; i++) {
321 enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
322 if (addr)
323 addr = (*end) ? end+1 : end;
324 }
325
326 dev = eth_devices;
327 while(num-- > 0) {
328 dev = dev->next;
329
330 if (dev == eth_devices)
331 return;
332 }
333
wdenk1ebf41e2004-01-02 14:00:00 +0000334 debug ( "Setting new HW address on %s\n"
335 "New Address is %02X:%02X:%02X:%02X:%02X:%02X\n",
336 dev->name,
Wolfgang Denkb6ea6302005-09-25 17:05:57 +0200337 enetaddr[0], enetaddr[1],
338 enetaddr[2], enetaddr[3],
339 enetaddr[4], enetaddr[5]);
wdenkc6097192002-11-03 00:24:07 +0000340
341 memcpy(dev->enetaddr, enetaddr, 6);
342}
David Updegraff7280da72007-06-11 10:41:07 -0500343#ifdef CONFIG_MCAST_TFTP
344/* Multicast.
345 * mcast_addr: multicast ipaddr from which multicast Mac is made
Wolfgang Denk627f5c32007-08-14 09:47:27 +0200346 * join: 1=join, 0=leave.
David Updegraff7280da72007-06-11 10:41:07 -0500347 */
348int eth_mcast_join( IPaddr_t mcast_ip, u8 join)
349{
350 u8 mcast_mac[6];
Wolfgang Denk627f5c32007-08-14 09:47:27 +0200351 if (!eth_current || !eth_current->mcast)
David Updegraff7280da72007-06-11 10:41:07 -0500352 return -1;
353 mcast_mac[5] = htonl(mcast_ip) & 0xff;
354 mcast_mac[4] = (htonl(mcast_ip)>>8) & 0xff;
355 mcast_mac[3] = (htonl(mcast_ip)>>16) & 0x7f;
356 mcast_mac[2] = 0x5e;
357 mcast_mac[1] = 0x0;
358 mcast_mac[0] = 0x1;
359 return eth_current->mcast(eth_current, mcast_mac, join);
360}
361
Wolfgang Denk627f5c32007-08-14 09:47:27 +0200362/* the 'way' for ethernet-CRC-32. Spliced in from Linux lib/crc32.c
363 * and this is the ethernet-crc method needed for TSEC -- and perhaps
David Updegraff7280da72007-06-11 10:41:07 -0500364 * some other adapter -- hash tables
365 */
366#define CRCPOLY_LE 0xedb88320
367u32 ether_crc (size_t len, unsigned char const *p)
368{
369 int i;
370 u32 crc;
371 crc = ~0;
372 while (len--) {
373 crc ^= *p++;
374 for (i = 0; i < 8; i++)
375 crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
376 }
377 /* an reverse the bits, cuz of way they arrive -- last-first */
378 crc = (crc >> 16) | (crc << 16);
379 crc = (crc >> 8 & 0x00ff00ff) | (crc << 8 & 0xff00ff00);
380 crc = (crc >> 4 & 0x0f0f0f0f) | (crc << 4 & 0xf0f0f0f0);
381 crc = (crc >> 2 & 0x33333333) | (crc << 2 & 0xcccccccc);
382 crc = (crc >> 1 & 0x55555555) | (crc << 1 & 0xaaaaaaaa);
383 return crc;
384}
wdenkc6097192002-11-03 00:24:07 +0000385
David Updegraff7280da72007-06-11 10:41:07 -0500386#endif
387
wdenkc6097192002-11-03 00:24:07 +0000388
389int eth_init(bd_t *bis)
390{
391 struct eth_device* old_current;
392
Stefan Roese11da2be2008-03-04 17:40:41 +0100393 if (!eth_current) {
394 puts ("No ethernet found.\n");
Upakul Barkakatyaed33582007-11-29 12:16:13 +0530395 return -1;
Stefan Roese11da2be2008-03-04 17:40:41 +0100396 }
wdenkc6097192002-11-03 00:24:07 +0000397
398 old_current = eth_current;
399 do {
wdenk1ebf41e2004-01-02 14:00:00 +0000400 debug ("Trying %s\n", eth_current->name);
wdenkc6097192002-11-03 00:24:07 +0000401
Ben Warrende9fcb52008-01-09 18:15:53 -0500402 if (eth_current->init(eth_current,bis) >= 0) {
wdenkc6097192002-11-03 00:24:07 +0000403 eth_current->state = ETH_STATE_ACTIVE;
404
Upakul Barkakatyaed33582007-11-29 12:16:13 +0530405 return 0;
wdenkc6097192002-11-03 00:24:07 +0000406 }
wdenk1ebf41e2004-01-02 14:00:00 +0000407 debug ("FAIL\n");
wdenkc6097192002-11-03 00:24:07 +0000408
409 eth_try_another(0);
410 } while (old_current != eth_current);
411
Upakul Barkakatyaed33582007-11-29 12:16:13 +0530412 return -1;
wdenkc6097192002-11-03 00:24:07 +0000413}
414
415void eth_halt(void)
416{
417 if (!eth_current)
418 return;
419
420 eth_current->halt(eth_current);
421
422 eth_current->state = ETH_STATE_PASSIVE;
423}
424
425int eth_send(volatile void *packet, int length)
426{
427 if (!eth_current)
428 return -1;
429
430 return eth_current->send(eth_current, packet, length);
431}
432
433int eth_rx(void)
434{
435 if (!eth_current)
436 return -1;
437
438 return eth_current->recv(eth_current);
439}
Rafal Jaworowski1f2c9a42007-12-27 18:19:02 +0100440
441#ifdef CONFIG_API
442static void eth_save_packet(volatile void *packet, int length)
443{
444 volatile char *p = packet;
445 int i;
446
447 if ((eth_rcv_last+1) % PKTBUFSRX == eth_rcv_current)
448 return;
449
450 if (PKTSIZE < length)
451 return;
452
453 for (i = 0; i < length; i++)
454 eth_rcv_bufs[eth_rcv_last].data[i] = p[i];
455
456 eth_rcv_bufs[eth_rcv_last].length = length;
457 eth_rcv_last = (eth_rcv_last + 1) % PKTBUFSRX;
458}
459
460int eth_receive(volatile void *packet, int length)
461{
462 volatile char *p = packet;
463 void *pp = push_packet;
464 int i;
465
466 if (eth_rcv_current == eth_rcv_last) {
467 push_packet = eth_save_packet;
468 eth_rx();
469 push_packet = pp;
470
471 if (eth_rcv_current == eth_rcv_last)
472 return -1;
473 }
474
475 if (length < eth_rcv_bufs[eth_rcv_current].length)
476 return -1;
477
478 length = eth_rcv_bufs[eth_rcv_current].length;
479
480 for (i = 0; i < length; i++)
481 p[i] = eth_rcv_bufs[eth_rcv_current].data[i];
482
483 eth_rcv_current = (eth_rcv_current + 1) % PKTBUFSRX;
484 return length;
485}
486#endif /* CONFIG_API */
wdenkc6097192002-11-03 00:24:07 +0000487
488void eth_try_another(int first_restart)
489{
490 static struct eth_device *first_failed = NULL;
Matthias Fuchs204f0ec2008-01-17 07:45:05 +0100491 char *ethrotate;
492
493 /*
494 * Do not rotate between network interfaces when
495 * 'ethrotate' variable is set to 'no'.
496 */
497 if (((ethrotate = getenv ("ethrotate")) != NULL) &&
498 (strcmp(ethrotate, "no") == 0))
499 return;
wdenkc6097192002-11-03 00:24:07 +0000500
501 if (!eth_current)
502 return;
503
wdenk63a10be2004-05-08 20:33:20 +0000504 if (first_restart) {
wdenkc6097192002-11-03 00:24:07 +0000505 first_failed = eth_current;
506 }
507
508 eth_current = eth_current->next;
509
wdenk145d2c12004-04-15 21:48:45 +0000510#ifdef CONFIG_NET_MULTI
511 /* update current ethernet name */
512 {
513 char *act = getenv("ethact");
514 if (act == NULL || strcmp(act, eth_current->name) != 0)
515 setenv("ethact", eth_current->name);
516 }
517#endif
518
wdenk63a10be2004-05-08 20:33:20 +0000519 if (first_failed == eth_current) {
wdenkc6097192002-11-03 00:24:07 +0000520 NetRestartWrap = 1;
521 }
522}
523
wdenk145d2c12004-04-15 21:48:45 +0000524#ifdef CONFIG_NET_MULTI
525void eth_set_current(void)
526{
527 char *act;
528 struct eth_device* old_current;
529
530 if (!eth_current) /* XXX no current */
531 return;
532
533 act = getenv("ethact");
534 if (act != NULL) {
535 old_current = eth_current;
536 do {
537 if (strcmp(eth_current->name, act) == 0)
538 return;
539 eth_current = eth_current->next;
540 } while (old_current != eth_current);
541 }
542
543 setenv("ethact", eth_current->name);
544}
545#endif
546
wdenkc6abb7e2003-11-17 21:14:37 +0000547char *eth_get_name (void)
548{
549 return (eth_current ? eth_current->name : "unknown");
550}
Jon Loeliger54f35c22007-07-09 17:45:14 -0500551#elif defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_MULTI)
Marian Balakowiczaab8c492005-10-28 22:30:33 +0200552
553extern int at91rm9200_miiphy_initialize(bd_t *bis);
554extern int emac4xx_miiphy_initialize(bd_t *bis);
555extern int mcf52x2_miiphy_initialize(bd_t *bis);
556extern int ns7520_miiphy_initialize(bd_t *bis);
Jean-Christophe PLAGNIOL-VILLARDbcf268b2008-08-31 04:45:42 +0200557extern int davinci_eth_miiphy_initialize(bd_t *bis);
Sergey Kubushyne8f39122007-08-10 20:26:18 +0200558
Marian Balakowiczaab8c492005-10-28 22:30:33 +0200559
560int eth_initialize(bd_t *bis)
561{
Jon Loeliger54f35c22007-07-09 17:45:14 -0500562#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
Marian Balakowiczcbdd1c82005-11-30 18:06:04 +0100563 miiphy_init();
564#endif
565
Marian Balakowiczaab8c492005-10-28 22:30:33 +0200566#if defined(CONFIG_AT91RM9200)
567 at91rm9200_miiphy_initialize(bis);
568#endif
569#if defined(CONFIG_4xx) && !defined(CONFIG_IOP480) \
570 && !defined(CONFIG_AP1000) && !defined(CONFIG_405)
571 emac4xx_miiphy_initialize(bis);
572#endif
573#if defined(CONFIG_MCF52x2)
574 mcf52x2_miiphy_initialize(bis);
575#endif
Wolfgang Denk81490f42008-07-13 23:07:35 +0200576#if defined(CONFIG_DRIVER_NS7520_ETHERNET)
Marian Balakowiczaab8c492005-10-28 22:30:33 +0200577 ns7520_miiphy_initialize(bis);
578#endif
Sergey Kubushyne8f39122007-08-10 20:26:18 +0200579#if defined(CONFIG_DRIVER_TI_EMAC)
Sandeep Paulraj4b26f052008-08-31 00:39:46 +0200580 davinci_eth_miiphy_initialize(bis);
Sergey Kubushyne8f39122007-08-10 20:26:18 +0200581#endif
Marian Balakowiczaab8c492005-10-28 22:30:33 +0200582 return 0;
583}
wdenkc6097192002-11-03 00:24:07 +0000584#endif