]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: move bootfile init into eth_initialize
authorMike Frysinger <vapier@gentoo.org>
Wed, 4 Apr 2012 18:53:41 +0000 (18:53 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Tue, 15 May 2012 22:32:33 +0000 (17:32 -0500)
All arches init this the same way, so move the logic into the core
net code to avoid duplicating it everywhere else.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
14 files changed:
arch/arm/lib/board.c
arch/avr32/lib/board.c
arch/blackfin/lib/board.c
arch/m68k/lib/board.c
arch/microblaze/lib/board.c
arch/mips/lib/board.c
arch/nds32/lib/board.c
arch/powerpc/lib/board.c
arch/sh/lib/board.c
arch/sparc/lib/board.c
arch/x86/include/asm/init_helpers.h
arch/x86/lib/board.c
arch/x86/lib/init_helpers.c
net/eth.c

index 66dfb13fa8219ea3493979fcaa02d43a4da3de83..024646cae5a7e8f8d459c620fe595e19e7484a4d 100644 (file)
@@ -592,14 +592,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_CMD_NET)
-       {
-               char *s = getenv("bootfile");
-
-               if (s != NULL)
-                       copy_filename(BootFile, s, sizeof(BootFile));
-       }
-#endif
 
 #ifdef CONFIG_BOARD_LATE_INIT
        board_late_init();
index 3c2d0fb8b04dfd42dd479d0e27d5015f186123f4..b390a6c8f8bbaf08f187e3bd0fe9892ee6b4d683 100644 (file)
@@ -327,9 +327,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        bb_miiphy_init();
 #endif
 #if defined(CONFIG_CMD_NET)
-       s = getenv("bootfile");
-       if (s)
-               copy_filename(BootFile, s, sizeof(BootFile));
        puts("Net:   ");
        eth_initialize(gd->bd);
 #endif
index 373b9346c02b3eec6f99ced2ec5a6f2c74ca281b..c380d271e7c834c07bcd1060f5e2e1a75fb63fcc 100644 (file)
@@ -319,13 +319,8 @@ static void board_net_init_r(bd_t *bd)
        bb_miiphy_init();
 #endif
 #ifdef CONFIG_CMD_NET
-       char *s;
-
-       if ((s = getenv("bootfile")) != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
-
        printf("Net:   ");
-       eth_initialize(gd->bd);
+       eth_initialize(bd);
 #endif
 }
 
index ffd91a83fe6e4f71afe94d26bbcd910ea1a3d001..65a8595c2bd684eb0483e6740cf17807554122a6 100644 (file)
@@ -559,11 +559,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_CMD_NET)
-       if ((s = getenv ("bootfile")) != NULL) {
-               copy_filename (BootFile, s, sizeof (BootFile));
-       }
-#endif
 
        WATCHDOG_RESET ();
 
index beb406d6c8c39404448e4e4a47b1d6c94c89cfe1..f3679d536bc304d3efa8553c60007df508d56b0c 100644 (file)
@@ -182,10 +182,6 @@ void board_init (void)
        uchar enetaddr[6];
        eth_getenv_enetaddr("ethaddr", enetaddr);
        printf("MAC:   %pM\n", enetaddr);
-
-       s = getenv("bootfile");
-       if (s != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
 #endif
 
        /* main_loop */
index 84e55f2102849d06408e88fdd159b6671c903e6a..59a80011da1be8d1a632a0d019c3b074b9e91bf8 100644 (file)
@@ -339,14 +339,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_CMD_NET)
-       {
-               char *s = getenv("bootfile");
-
-               if (s != NULL)
-                       copy_filename(BootFile, s, sizeof(BootFile));
-       }
-#endif
 
 #ifdef CONFIG_CMD_SPI
        puts("SPI:   ");
index 50ea30d3b07dfb60bdfb3f832bc0f2515badb952..7121313a83af800f478584701ff7366b8f844185 100644 (file)
@@ -399,12 +399,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
-#if defined(CONFIG_CMD_NET)
-       s = getenv("bootfile");
-       if (s != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
-#endif
-
 #ifdef BOARD_LATE_INIT
        board_late_init();
 #endif
index 7daffcec3afc7c0a90a8fae10a92bdfd3b08ec87..fea310eedd1c5ce4cc4f82246d09661f6fe042f0 100644 (file)
@@ -932,14 +932,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_CMD_NET)
-       {
-               char *s = getenv("bootfile");
-
-               if (s != NULL)
-                       copy_filename(BootFile, s, sizeof(BootFile));
-       }
-#endif
 
        WATCHDOG_RESET();
 
index d71cca44656e3e8f87eb4a2bf49c257eca1e823a..34d7881f446728d1634cbf3e380c3bdf7c9918cf 100644 (file)
@@ -190,15 +190,8 @@ void sh_generic_init(void)
        bb_miiphy_init();
 #endif
 #if defined(CONFIG_CMD_NET)
-       {
-               char *s;
-               puts("Net:   ");
-               eth_initialize(gd->bd);
-
-               s = getenv("bootfile");
-               if (s != NULL)
-                       copy_filename(BootFile, s, sizeof(BootFile));
-       }
+       puts("Net:   ");
+       eth_initialize(gd->bd);
 #endif /* CONFIG_CMD_NET */
 
        while (1) {
index 9faf88bf22c2711d6632dc2ee1a4dbc3f7217187..7e48775dfe292049d8497566ea30aff2a7aa742c 100644 (file)
@@ -357,11 +357,6 @@ void board_init_f(ulong bootflag)
 
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_CMD_NET)
-       if ((s = getenv("bootfile")) != NULL) {
-               copy_filename(BootFile, s, sizeof(BootFile));
-       }
-#endif /* CONFIG_CMD_NET */
 
        WATCHDOG_RESET();
 
index 8d2e0bae2fbdb9edea932f63dbda9c1bfce7cae0..8afb4432906b6d9e3c9431178ddb5b64ced998b7 100644 (file)
@@ -37,7 +37,6 @@ int mem_malloc_init_r(void);
 int init_bd_struct_r(void);
 int flash_init_r(void);
 int status_led_set_r(void);
-int set_bootfile_r(void);
 int set_load_addr_r(void);
 
 #endif /* !_INIT_HELPERS_H_ */
index 15b4ae2e718c9a5da7849bdaadcfed3564d9bef1..90cf7fc8883c2ee02a0b22361b69a1905f214b4b 100644 (file)
@@ -177,9 +177,6 @@ init_fnc_t *init_sequence_r[] = {
        status_led_set_r,
 #endif
        set_load_addr_r,
-#if defined(CONFIG_CMD_NET)
-       set_bootfile_r,
-#endif
 #if defined(CONFIG_CMD_IDE)
        ide_init_r,
 #endif
index a8741d0e631180e5322932b5c65dfd4ec724116d..9ec34ff992baec321687243d25b9b11da4ee51c6 100644 (file)
@@ -188,18 +188,6 @@ int status_led_set_r(void)
 }
 #endif
 
-int set_bootfile_r(void)
-{
-       char *s;
-
-       s = getenv("bootfile");
-
-       if (s != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
-
-       return 0;
-}
-
 int set_load_addr_r(void)
 {
        /* Initialize from environment */
index 35e0de65b10ceb681e86cef9456cb23544a0e67e..d9a643073d8a0eecd305f07e3605d97a39e71c4b 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -245,6 +245,14 @@ int eth_unregister(struct eth_device *dev)
        return 0;
 }
 
+static void eth_env_init(bd_t *bis)
+{
+       const char *s;
+
+       if ((s = getenv("bootfile")) != NULL)
+               copy_filename(BootFile, s, sizeof(BootFile));
+}
+
 int eth_initialize(bd_t *bis)
 {
        int num_devices = 0;
@@ -260,6 +268,8 @@ int eth_initialize(bd_t *bis)
        phy_init();
 #endif
 
+       eth_env_init(bis);
+
        /*
         * If board-specific initialization exists, call it.
         * If not, call a CPU-specific one