spl: Convert spl_spi_load_image() to use linker list
[oweals/u-boot.git] / common / spl / spl_net.c
1 /*
2  * (C) Copyright 2000-2004
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * (C) Copyright 2012
6  * Ilya Yanok <ilya.yanok@gmail.com>
7  *
8  * SPDX-License-Identifier:     GPL-2.0+
9  */
10 #include <common.h>
11 #include <errno.h>
12 #include <spl.h>
13 #include <net.h>
14
15 DECLARE_GLOBAL_DATA_PTR;
16
17 int spl_net_load_image(struct spl_boot_device *bootdev)
18 {
19         int rv;
20
21         env_init();
22         env_relocate();
23         setenv("autoload", "yes");
24         load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
25         rv = eth_initialize();
26         if (rv == 0) {
27                 printf("No Ethernet devices found\n");
28                 return -ENODEV;
29         }
30         if (bootdev->boot_device_name)
31                 setenv("ethact", bootdev->boot_device_name);
32         rv = net_loop(BOOTP);
33         if (rv < 0) {
34                 printf("Problem booting with BOOTP\n");
35                 return rv;
36         }
37         return spl_parse_image_header(&spl_image,
38                                       (struct image_header *)load_addr);
39 }