X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=net%2Feth.c;h=e8ac251a4fee0c6945fe40e36ba135511d6249d8;hb=3a25220822c41e7a8f4f50832a0ef91510490513;hp=61862aaba9e2047c59374d7a5280ad42a9cc59e1;hpb=f046ccd15c8bc9613bfd72916b761a127d36e5c6;p=oweals%2Fu-boot.git diff --git a/net/eth.c b/net/eth.c index 61862aaba9..e8ac251a4f 100644 --- a/net/eth.c +++ b/net/eth.c @@ -24,6 +24,7 @@ #include #include #include +#include #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) @@ -47,12 +48,12 @@ extern int ns8382x_initialize(bd_t*); extern int pcnet_initialize(bd_t*); extern int plb2800_eth_initialize(bd_t*); extern int ppc_4xx_eth_initialize(bd_t *); -extern int ppc_440x_eth_initialize(bd_t *); extern int rtl8139_initialize(bd_t*); extern int rtl8169_initialize(bd_t*); extern int scc_initialize(bd_t*); extern int skge_initialize(bd_t*); extern int tsec_initialize(bd_t*, int, char *); +extern int npe_initialize(bd_t *); static struct eth_device *eth_devices, *eth_current; @@ -61,6 +62,26 @@ struct eth_device *eth_get_dev(void) return eth_current; } +struct eth_device *eth_get_dev_by_name(char *devname) +{ + struct eth_device *dev, *target_dev; + + if (!eth_devices) + return NULL; + + dev = eth_devices; + target_dev = NULL; + do { + if (strcmp(devname, dev->name) == 0) { + target_dev = dev; + break; + } + dev = dev->next; + } while (dev != eth_devices); + + return target_dev; +} + int eth_get_dev_index (void) { struct eth_device *dev; @@ -110,13 +131,17 @@ int eth_register(struct eth_device* dev) int eth_initialize(bd_t *bis) { - unsigned char enetvar[32], env_enetaddr[6]; + char enetvar[32], env_enetaddr[6]; int i, eth_number = 0; char *tmp, *end; eth_devices = NULL; eth_current = NULL; +#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) + miiphy_init(); +#endif + #ifdef CONFIG_DB64360 mv6436x_eth_initialize(bis); #endif @@ -126,13 +151,9 @@ int eth_initialize(bd_t *bis) #ifdef CONFIG_DB64460 mv6446x_eth_initialize(bis); #endif -#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \ - ( defined(CONFIG_440) && !defined(CONFIG_NET_MULTI) ) +#if defined(CONFIG_4xx) && !defined(CONFIG_IOP480) && !defined(CONFIG_AP1000) ppc_4xx_eth_initialize(bis); #endif -#if defined(CONFIG_440) && defined(CONFIG_NET_MULTI) - ppc_440x_eth_initialize(bis); -#endif #ifdef CONFIG_INCA_IP_SWITCH inca_switch_initialize(bis); #endif @@ -142,9 +163,6 @@ int eth_initialize(bd_t *bis) #ifdef SCC_ENET scc_initialize(bis); #endif -#if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC) - fec_initialize(bis); -#endif #if defined(CONFIG_MPC5xxx_FEC) mpc5xxx_fec_initialize(bis); #endif @@ -178,9 +196,31 @@ int eth_initialize(bd_t *bis) tsec_initialize(bis, 3, CONFIG_MPC83XX_TSEC4_NAME); # endif #endif +#if defined(CONFIG_MPC86XX_TSEC1) + tsec_initialize(bis, 0, CONFIG_MPC86XX_TSEC1_NAME); +#endif + +#if defined(CONFIG_MPC86XX_TSEC2) + tsec_initialize(bis, 1, CONFIG_MPC86XX_TSEC2_NAME); +#endif + +#if defined(CONFIG_MPC86XX_TSEC3) + tsec_initialize(bis, 2, CONFIG_MPC86XX_TSEC3_NAME); +#endif + +#if defined(CONFIG_MPC86XX_TSEC4) + tsec_initialize(bis, 3, CONFIG_MPC86XX_TSEC4_NAME); +#endif + +#if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC) + fec_initialize(bis); +#endif #if defined(CONFIG_AU1X00) au1x00_enet_initialize(bis); #endif +#if defined(CONFIG_IXP4XX_NPE) + npe_initialize(bis); +#endif #ifdef CONFIG_E1000 e1000_initialize(bis); #endif @@ -307,9 +347,9 @@ void eth_set_enetaddr(int num, char *addr) { debug ( "Setting new HW address on %s\n" "New Address is %02X:%02X:%02X:%02X:%02X:%02X\n", dev->name, - dev->enetaddr[0], dev->enetaddr[1], - dev->enetaddr[2], dev->enetaddr[3], - dev->enetaddr[4], dev->enetaddr[5]); + enetaddr[0], enetaddr[1], + enetaddr[2], enetaddr[3], + enetaddr[4], enetaddr[5]); memcpy(dev->enetaddr, enetaddr, 6); } @@ -418,4 +458,32 @@ char *eth_get_name (void) { return (eth_current ? eth_current->name : "unknown"); } +#elif (CONFIG_COMMANDS & CFG_CMD_NET) && !defined(CONFIG_NET_MULTI) + +extern int at91rm9200_miiphy_initialize(bd_t *bis); +extern int emac4xx_miiphy_initialize(bd_t *bis); +extern int mcf52x2_miiphy_initialize(bd_t *bis); +extern int ns7520_miiphy_initialize(bd_t *bis); + +int eth_initialize(bd_t *bis) +{ +#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) + miiphy_init(); +#endif + +#if defined(CONFIG_AT91RM9200) + at91rm9200_miiphy_initialize(bis); +#endif +#if defined(CONFIG_4xx) && !defined(CONFIG_IOP480) \ + && !defined(CONFIG_AP1000) && !defined(CONFIG_405) + emac4xx_miiphy_initialize(bis); +#endif +#if defined(CONFIG_MCF52x2) + mcf52x2_miiphy_initialize(bis); +#endif +#if defined(CONFIG_NETARM) + ns7520_miiphy_initialize(bis); +#endif + return 0; +} #endif