]> git.sur5r.net Git - u-boot/blobdiff - common/miiphyutil.c
ColdFire 54455: Fix correct boot location for atmel and intel
[u-boot] / common / miiphyutil.c
index d67c8b5371ff2a66a5b4b145066002a218bcde21..c69501fedfb9a77150a4a9b7265d85d8465f24a5 100644 (file)
@@ -29,7 +29,7 @@
 #include <common.h>
 #include <miiphy.h>
 
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 #include <asm/types.h>
 #include <linux/list.h>
 #include <malloc.h>
@@ -58,6 +58,16 @@ struct mii_dev {
 static struct list_head mii_devs;
 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>.
@@ -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);
@@ -467,4 +470,4 @@ int miiphy_link (char *devname, unsigned char addr)
 }
 #endif
 
-#endif /* CONFIG_MII || (CONFIG_COMMANDS & CFG_CMD_MII) */
+#endif /* CONFIG_MII */