]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
cmc_pu2: get mac address from environment
authorMike Frysinger <vapier@gentoo.org>
Thu, 12 Feb 2009 00:55:01 +0000 (19:55 -0500)
committerWolfgang Denk <wd@denx.de>
Fri, 20 Mar 2009 21:39:12 +0000 (22:39 +0100)
The environment is the canonical storage location of the mac address, so
we're killing off the global data location and moving everything to
querying the env directly.

Also rename load_sernum_ethaddr() to misc_init_r() so we don't need to
handle this board specially in common ARM code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Ben Warren <biggerbadderben@gmail.com>
board/cmc_pu2/load_sernum_ethaddr.c
include/configs/cmc_pu2.h
lib_arm/board.c

index 354566c05df7339b35adb28d7d7e744ea861ae22..5ef9f20c06374bb2d79a408695a14a2eb599b2ec 100644 (file)
@@ -66,14 +66,13 @@ int i2c_read (unsigned char chip, unsigned int addr, int alen,
  * Internal structure: see struct definition
  */
 
-void load_sernum_ethaddr (void)
+void misc_init_r(void)
 {
        struct manufacturer_data data;
-       char  ethaddr[18];
        char  serial [9];
        unsigned short chksum;
        unsigned char *p;
-       unsigned short i, is, id;
+       unsigned short i;
 
 #if !defined(CONFIG_HARD_I2C) && !defined(CONFIG_SOFT_I2C)
 #error you must define some I2C support (CONFIG_HARD_I2C or CONFIG_SOFT_I2C)
@@ -97,17 +96,6 @@ void load_sernum_ethaddr (void)
                return;
        }
 
-       /* copy MAC address */
-       is = 0;
-       id = 0;
-       for (i = 0; i < 6; i++) {
-               sprintf (&ethaddr[id], "%02x", data.macadr[is++]);
-               id += 2;
-               if (is < 6)
-                       ethaddr[id++] = ':';
-       }
-       ethaddr[id] = '\0';     /* just to be sure */
-
        /* copy serial number */
        sprintf (serial, "%d", data.serial_number);
 
@@ -117,6 +105,6 @@ void load_sernum_ethaddr (void)
        }
 
        if (getenv("ethaddr") == NULL) {
-               setenv ("ethaddr", ethaddr);
+               eth_setenv_enetaddr("ethaddr", data.macadr);
        }
 }
index d9acb470fedbab874d328b48f4f6a040b1e313ef..e5c74e136fab504b3e9dc71cd31a32bd35bc3dcb 100644 (file)
 #endif
 
 
+#define CONFIG_MISC_INIT_R
 #define CONFIG_SYS_LONGHELP
 
 #define AT91_SMART_MEDIA_ALE   (1 << 22)       /* our ALE is AD22 */
index 11a6eb6199fa42641372f8c9ebbc9cdd4afec0e9..3dfaec01b4fd2c5c649b86fbe6d349a025847a2f 100644 (file)
@@ -381,10 +381,6 @@ void start_armboot (void)
 
        devices_init ();        /* get the devices list going. */
 
-#ifdef CONFIG_CMC_PU2
-       load_sernum_ethaddr ();
-#endif /* CONFIG_CMC_PU2 */
-
        jumptable_init ();
 
 #if defined(CONFIG_API)