@ -368,55 +368,41 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
return 0 ;
return 0 ;
}
}
# if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
void fdt_fixup_ethernet ( void * fdt )
defined ( CONFIG_HAS_ETH2 ) | | defined ( CONFIG_HAS_ETH3 )
void fdt_fixup_ethernet ( void * fdt , bd_t * bd )
{
{
int node ;
int node , i , j ;
char enet [ 16 ] , * tmp , * end ;
char mac [ 16 ] = " ethaddr " ;
const char * path ;
const char * path ;
unsigned char mac_addr [ 6 ] ;
node = fdt_path_offset ( fdt , " /aliases " ) ;
node = fdt_path_offset ( fdt , " /aliases " ) ;
if ( node > = 0 ) {
if ( node < 0 )
# if defined(CONFIG_HAS_ETH0)
return ;
path = fdt_getprop ( fdt , node , " ethernet0 " , NULL ) ;
if ( path ) {
i = 0 ;
do_fixup_by_path ( fdt , path , " mac-address " ,
while ( ( tmp = getenv ( mac ) ) ! = NULL ) {
bd - > bi_enetaddr , 6 , 0 ) ;
sprintf ( enet , " ethernet%d " , i ) ;
do_fixup_by_path ( fdt , path , " local-mac-address " ,
path = fdt_getprop ( fdt , node , enet , NULL ) ;
bd - > bi_enetaddr , 6 , 1 ) ;
if ( ! path ) {
}
debug ( " No alias for %s \n " , enet ) ;
# endif
sprintf ( mac , " eth%daddr " , + + i ) ;
# if defined(CONFIG_HAS_ETH1)
continue ;
path = fdt_getprop ( fdt , node , " ethernet1 " , NULL ) ;
if ( path ) {
do_fixup_by_path ( fdt , path , " mac-address " ,
bd - > bi_enet1addr , 6 , 0 ) ;
do_fixup_by_path ( fdt , path , " local-mac-address " ,
bd - > bi_enet1addr , 6 , 1 ) ;
}
}
# endif
# if defined(CONFIG_HAS_ETH2)
for ( j = 0 ; j < 6 ; j + + ) {
path = fdt_getprop ( fdt , node , " ethernet2 " , NULL ) ;
mac_addr [ j ] = tmp ? simple_strtoul ( tmp , & end , 16 ) : 0 ;
if ( path ) {
if ( tmp )
do_fixup_by_path ( fdt , path , " mac-address " ,
tmp = ( * end ) ? end + 1 : end ;
bd - > bi_enet2addr , 6 , 0 ) ;
do_fixup_by_path ( fdt , path , " local-mac-address " ,
bd - > bi_enet2addr , 6 , 1 ) ;
}
}
# endif
# if defined(CONFIG_HAS_ETH3)
do_fixup_by_path ( fdt , path , " mac-address " , & mac_addr , 6 , 0 ) ;
path = fdt_getprop ( fdt , node , " ethernet3 " , NULL ) ;
if ( path ) {
do_fixup_by_path ( fdt , path , " mac-address " ,
bd - > bi_enet3addr , 6 , 0 ) ;
do_fixup_by_path ( fdt , path , " local-mac-address " ,
do_fixup_by_path ( fdt , path , " local-mac-address " ,
bd - > bi_enet3 addr, 6 , 1 ) ;
& mac_addr , 6 , 1 ) ;
}
# endif
sprintf ( mac , " eth%daddr " , + + i ) ;
}
}
}
}
# endif
# ifdef CONFIG_HAS_FSL_DR_USB
# ifdef CONFIG_HAS_FSL_DR_USB
void fdt_fixup_dr_usb ( void * blob , bd_t * bd )
void fdt_fixup_dr_usb ( void * blob , bd_t * bd )