E1000: clean up CONFIG_E1000_FALLBACK_MAC handling

Avoid "integer constant is too large for 'long' type" warnings.
And simplify the code.

Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
Wolfgang Denk 2008-07-31 13:57:20 +02:00
parent f7c602ac8b
commit c4ec6db074
2 changed files with 8 additions and 7 deletions

View File

@ -513,9 +513,11 @@ e1000_read_mac_addr(struct eth_device *nic)
nic->enetaddr[5] += 1; nic->enetaddr[5] += 1;
} }
#ifdef CONFIG_E1000_FALLBACK_MAC #ifdef CONFIG_E1000_FALLBACK_MAC
if ( *(u32*)(nic->enetaddr) == 0 || *(u32*)(nic->enetaddr) == ~0 ) if ( *(u32*)(nic->enetaddr) == 0 || *(u32*)(nic->enetaddr) == ~0 ) {
for ( i=0; i < NODE_ADDRESS_SIZE; i++ ) unsigned char fb_mac[NODE_ADDRESS_SIZE] = CONFIG_E1000_FALLBACK_MAC;
nic->enetaddr[i] = (CONFIG_E1000_FALLBACK_MAC >> (8*(5-i))) & 0xff;
memcpy (nic->enetaddr, fb_mac, NODE_ADDRESS_SIZE);
}
#endif #endif
#else #else
/* /*
@ -533,8 +535,7 @@ e1000_read_mac_addr(struct eth_device *nic)
s = getenv ("ethaddr"); s = getenv ("ethaddr");
if (s == NULL) { if (s == NULL) {
return -E1000_ERR_EEPROM; return -E1000_ERR_EEPROM;
} } else {
else{
for(ii = 0; ii < 6; ii++) { for(ii = 0; ii < 6; ii++) {
nic->enetaddr[ii] = s ? simple_strtoul (s, &e, 16) : 0; nic->enetaddr[ii] = s ? simple_strtoul (s, &e, 16) : 0;
if (s){ if (s){

View File

@ -255,7 +255,7 @@
#define CONFIG_NET_RETRY_COUNT 5 #define CONFIG_NET_RETRY_COUNT 5
#define CONFIG_E1000 #define CONFIG_E1000
#define CONFIG_E1000_FALLBACK_MAC 0xb6b445ebfbc0 #define CONFIG_E1000_FALLBACK_MAC { 0xb6, 0xb4, 0x45, 0xeb, 0xfb, 0xc0 }
#undef CONFIG_MPC5xxx_FEC #undef CONFIG_MPC5xxx_FEC
#undef CONFIG_PHY_ADDR #undef CONFIG_PHY_ADDR
#define CONFIG_NETDEV eth0 #define CONFIG_NETDEV eth0