xref: /openbmc/u-boot/common/spl/spl_net.c (revision 8f3ff11c)
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  * See file CREDITS for list of people who contributed to this
9  * project.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc.
24  */
25 #include <common.h>
26 #include <spl.h>
27 #include <net.h>
28 
29 DECLARE_GLOBAL_DATA_PTR;
30 
31 void spl_net_load_image(const char *device)
32 {
33 	int rv;
34 
35 	env_init();
36 	env_relocate();
37 	setenv("autoload", "yes");
38 	load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
39 	rv = eth_initialize(gd->bd);
40 	if (rv == 0) {
41 		printf("No Ethernet devices found\n");
42 		hang();
43 	}
44 	if (device)
45 		setenv("ethact", device);
46 	rv = NetLoop(BOOTP);
47 	if (rv < 0) {
48 		printf("Problem booting with BOOTP\n");
49 		hang();
50 	}
51 	spl_parse_image_header((struct image_header *)load_addr);
52 }
53