]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/mcffec.c
net: Move enetaddr env access code to env config instead of net config
[u-boot] / drivers / net / mcffec.c
index fd7309937104407935fada5839769bbcb7eb8381..505a2d1bee8e4cc5be80f9f9181283e2eccb83cc 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 
 #include <command.h>
@@ -428,25 +429,25 @@ int fec_init(struct eth_device *dev, bd_t * bd)
        if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
 #ifdef CONFIG_SYS_FEC1_IOBASE
                volatile fec_t *fecp1 = (fec_t *) (CONFIG_SYS_FEC1_IOBASE);
-               eth_getenv_enetaddr("eth1addr", ea);
+               eth_env_get_enetaddr("eth1addr", ea);
                fecp1->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp1->paur = (ea[4] << 24) | (ea[5] << 16);
 #endif
-               eth_getenv_enetaddr("ethaddr", ea);
+               eth_env_get_enetaddr("ethaddr", ea);
                fecp->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp->paur = (ea[4] << 24) | (ea[5] << 16);
        } else {
 #ifdef CONFIG_SYS_FEC0_IOBASE
                volatile fec_t *fecp0 = (fec_t *) (CONFIG_SYS_FEC0_IOBASE);
-               eth_getenv_enetaddr("ethaddr", ea);
+               eth_env_get_enetaddr("ethaddr", ea);
                fecp0->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp0->paur = (ea[4] << 24) | (ea[5] << 16);
 #endif
 #ifdef CONFIG_SYS_FEC1_IOBASE
-               eth_getenv_enetaddr("eth1addr", ea);
+               eth_env_get_enetaddr("eth1addr", ea);
                fecp->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp->paur = (ea[4] << 24) | (ea[5] << 16);
@@ -465,7 +466,7 @@ int fec_init(struct eth_device *dev, bd_t * bd)
        fecp->emrbr = PKT_MAXBLR_SIZE;
 
        /*
-        * Setup Buffers and Buffer Desriptors
+        * Setup Buffers and Buffer Descriptors
         */
        info->rxIdx = 0;
        info->txIdx = 0;
@@ -595,8 +596,17 @@ int mcffec_initialize(bd_t * bis)
                eth_register(dev);
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
-               miiphy_register(dev->name,
-                               mcffec_miiphy_read, mcffec_miiphy_write);
+               int retval;
+               struct mii_dev *mdiodev = mdio_alloc();
+               if (!mdiodev)
+                       return -ENOMEM;
+               strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
+               mdiodev->read = mcffec_miiphy_read;
+               mdiodev->write = mcffec_miiphy_write;
+
+               retval = mdio_register(mdiodev);
+               if (retval < 0)
+                       return retval;
 #endif
                if (i > 0)
                        fec_info[i - 1].next = &fec_info[i];