summaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/kup/common/kup.h2
-rw-r--r--board/kup/kup4k/kup4k.c1
-rw-r--r--board/kup/kup4x/kup4x.c2
-rw-r--r--board/m501sk/m501sk.c5
-rw-r--r--board/pcs440ep/pcs440ep.c31
-rw-r--r--board/tqc/tqm8xx/tqm8xx.c3
6 files changed, 21 insertions, 23 deletions
diff --git a/board/kup/common/kup.h b/board/kup/common/kup.h
index 70d7f01e68..b736283104 100644
--- a/board/kup/common/kup.h
+++ b/board/kup/common/kup.h
@@ -41,4 +41,6 @@
extern void poweron_key (void);
+extern void load_sernum_ethaddr(void);
+
#endif /* __KUP_H */
diff --git a/board/kup/kup4k/kup4k.c b/board/kup/kup4k/kup4k.c
index df3ffb4d71..98f5f5a30a 100644
--- a/board/kup/kup4k/kup4k.c
+++ b/board/kup/kup4k/kup4k.c
@@ -250,6 +250,7 @@ int misc_init_r (void)
immap->im_ioport.iop_papar &= ~0x80;
immap->im_ioport.iop_padat |= 0x80; /* turn it off */
#endif
+ load_sernum_ethaddr();
setenv("hw","4k");
poweron_key();
return (0);
diff --git a/board/kup/kup4x/kup4x.c b/board/kup/kup4x/kup4x.c
index c5b742dd72..65a222b5ef 100644
--- a/board/kup/kup4x/kup4x.c
+++ b/board/kup/kup4x/kup4x.c
@@ -295,7 +295,6 @@ static long int dram_size (long int mamr_value, long int *base,
int misc_init_r (void)
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-
#ifdef CONFIG_IDE_LED
/* Configure PA8 as output port */
immap->im_ioport.iop_padir |= 0x80;
@@ -306,6 +305,7 @@ int misc_init_r (void)
#ifdef KUP4X_USB
usb_init_kup4x ();
#endif
+ load_sernum_ethaddr();
setenv ("hw", "4x");
poweron_key ();
return (0);
diff --git a/board/m501sk/m501sk.c b/board/m501sk/m501sk.c
index 65a8b2989f..dc5b786c00 100644
--- a/board/m501sk/m501sk.c
+++ b/board/m501sk/m501sk.c
@@ -105,11 +105,6 @@ uchar m501sk_gpio_clear(M501SK_PIO io)
return status;
}
-void load_sernum_ethaddr(void)
-{
- return;
-}
-
/*
* Miscelaneous platform dependent initialisations
*/
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 5fd3291e4a..27272142c1 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -182,14 +182,21 @@ int board_early_init_f(void)
}
#define EEPROM_LEN 256
-void load_sernum_ethaddr (void)
+static void load_ethaddr(void)
{
+ int ok_ethaddr, ok_eth1addr;
int ret;
char buf[EEPROM_LEN];
char mac[32];
char *use_eeprom;
u16 checksumcrc16 = 0;
+ /* If the env is sane, then nothing for us to do */
+ ok_ethaddr = eth_getenv_enetaddr("ethaddr", buf);
+ ok_eth1addr = eth_getenv_enetaddr("eth1addr", buf);
+ if (ok_ethaddr && ok_eth1addr)
+ return;
+
/* read the MACs from EEprom */
status_led_set (0, STATUS_LED_ON);
status_led_set (1, STATUS_LED_ON);
@@ -207,22 +214,10 @@ void load_sernum_ethaddr (void)
printf("%s: EEPROM Checksum not OK\n", __FUNCTION__);
} else {
/* get the MACs */
- sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x",
- buf[3],
- buf[4],
- buf[5],
- buf[6],
- buf[7],
- buf[8]);
- setenv ("ethaddr", (char *) mac);
- sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x",
- buf[9],
- buf[10],
- buf[11],
- buf[12],
- buf[13],
- buf[14]);
- setenv ("eth1addr", (char *) mac);
+ if (!ok_ethaddr)
+ eth_setenv_enetaddr("ethaddr", &buf[3]);
+ if (!ok_eth1addr)
+ eth_setenv_enetaddr("eth1addr", &buf[9]);
return;
}
}
@@ -446,6 +441,8 @@ int misc_init_r (void)
uint pbcr;
int size_val = 0;
+ load_ethaddr();
+
/* Re-do sizing to get full correct info */
mtdcr(ebccfga, pb0cr);
pbcr = mfdcr(ebccfgd);
diff --git a/board/tqc/tqm8xx/tqm8xx.c b/board/tqc/tqm8xx/tqm8xx.c
index e065d69dd4..f92c598dd8 100644
--- a/board/tqc/tqm8xx/tqm8xx.c
+++ b/board/tqc/tqm8xx/tqm8xx.c
@@ -449,11 +449,14 @@ int board_early_init_r (void)
#ifdef CONFIG_MISC_INIT_R
+extern void load_sernum_ethaddr(void);
int misc_init_r (void)
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
volatile memctl8xx_t *memctl = &immap->im_memctl;
+ load_sernum_ethaddr();
+
#ifdef CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ
int scy, trlx, flash_or_timing, clk_diff;
OpenPOWER on IntegriCloud