aboutsummaryrefslogtreecommitdiff
path: root/cpu/mpc5xxx
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-09-02 22:48:03 +0000
committerwdenk <wdenk>2003-09-02 22:48:03 +0000
commit12f34241cb9679c27a1ab3561766562f5a515eff (patch)
treee6408a1701c7dabf3e2ceb1326ce2f5cc8657c96 /cpu/mpc5xxx
parent326428cc8bbdddb30920a96b672abd0d59833ce4 (diff)
* Add support for PPChameleon Eval Board
* Add support for P3G4 board * Fix problem with MGT5100 FEC driver: add "early" MAC address initialization
Diffstat (limited to 'cpu/mpc5xxx')
-rw-r--r--cpu/mpc5xxx/fec.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/cpu/mpc5xxx/fec.c b/cpu/mpc5xxx/fec.c
index b01e44c18..557355f9d 100644
--- a/cpu/mpc5xxx/fec.c
+++ b/cpu/mpc5xxx/fec.c
@@ -809,9 +809,13 @@ int mpc5xxx_fec_initialize(bd_t * bis)
{
mpc5xxx_fec_priv *fec;
struct eth_device *dev;
+ char *tmp, *end;
+ char env_enetaddr[6];
+ int i;
fec = (mpc5xxx_fec_priv *)malloc(sizeof(*fec));
dev = (struct eth_device *)malloc(sizeof(*dev));
+ memset(dev, 0, sizeof *dev);
fec->eth = (ethernet_regs *)MPC5XXX_FEC;
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
@@ -830,6 +834,21 @@ int mpc5xxx_fec_initialize(bd_t * bis)
sprintf(dev->name, "FEC ETHERNET");
eth_register(dev);
+ /*
+ * Try to set the mac address now. The fec mac address is
+ * a garbage after reset. When not using fec for booting
+ * the Linux fec driver will try to work with this garbage.
+ */
+ tmp = getenv("ethaddr");
+ if (tmp) {
+ for (i=0; i<6; i++) {
+ env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
+ if (tmp)
+ tmp = (*end) ? end+1 : end;
+ }
+ mpc5xxx_fec_set_hwaddr(fec, env_enetaddr);
+ }
+
return 1;
}