diff options
author | Marian Balakowicz <m8@semihalf.com> | 2005-11-30 18:06:04 +0100 |
---|---|---|
committer | Marian Balakowicz <m8@semihalf.com> | 2005-11-30 18:06:04 +0100 |
commit | d9785c14bf489908b8e39b1e20f0c14cb8fcda76 (patch) | |
tree | c5105eb907ce0cb7b353619007f34b4c86879f30 | |
parent | 0a69b26ed6fe3184cab86872589c27b076e6cb8e (diff) |
Fix miiphy global data initialization (problem on 4xx boards when no
ethaddr is assigned). Initialization moved from miiphy_register() to
eth_initialize().
Based on initial patch for 4xx platform by Matthias Fuchs.
-rw-r--r-- | CHANGELOG | 6 | ||||
-rw-r--r-- | common/miiphyutil.c | 17 | ||||
-rw-r--r-- | include/miiphy.h | 2 | ||||
-rw-r--r-- | net/eth.c | 9 |
4 files changed, 27 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG index 2f5fe91bb0c..826f8633a0a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,12 @@ Changes for U-Boot 1.1.4: ====================================================================== +* Fix miiphy global data initialization (problem on 4xx boards when no + ethaddr is assigned). Initialization moved from miiphy_register() to + eth_initialize(). + + Based on initial patch for 4xx platform by Matthias Fuchs. + * Remove unnnecessary #include <linux/types.h> from include/asm-*/u-boot.h * Allow use of include/image.h and include/asm-*/u-boot.h in proprietary code. diff --git a/common/miiphyutil.c b/common/miiphyutil.c index d67c8b5371f..e411e573c7b 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -60,6 +60,16 @@ static struct mii_dev *current_mii; /***************************************************************************** * + * Initialize global data. Need to be called before any other miiphy routine. + */ +void miiphy_init() +{ + INIT_LIST_HEAD(&mii_devs); + current_mii = NULL; +} + +/***************************************************************************** + * * Register read and write MII access routines for the device <name>. */ void miiphy_register(char *name, @@ -71,15 +81,8 @@ void miiphy_register(char *name, struct list_head *entry; struct mii_dev *new_dev; struct mii_dev *miidev; - static int head_initialized = 0; unsigned int name_len; - if (head_initialized == 0) { - INIT_LIST_HEAD(&mii_devs); - current_mii = NULL; - head_initialized = 1; - } - /* check if we have unique name */ list_for_each(entry, &mii_devs) { miidev = list_entry(entry, struct mii_dev, link); diff --git a/include/miiphy.h b/include/miiphy.h index 3c6ee770775..71716b04d40 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -53,6 +53,8 @@ int miiphy_duplex(char *devname, unsigned char addr); int miiphy_link(char *devname, unsigned char addr); #endif +void miiphy_init(void); + void miiphy_register(char *devname, int (* read)(char *devname, unsigned char addr, unsigned char reg, unsigned short *value), diff --git a/net/eth.c b/net/eth.c index b4ff5eff630..1646111d134 100644 --- a/net/eth.c +++ b/net/eth.c @@ -24,6 +24,7 @@ #include <common.h> #include <command.h> #include <net.h> +#include <miiphy.h> #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) @@ -136,6 +137,10 @@ int eth_initialize(bd_t *bis) 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 @@ -442,6 +447,10 @@ 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 |