summaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-09-30 23:49:17 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-09-30 23:49:17 +0200
commit1c27059a2f7158a9c9a8778535b030935d75179d (patch)
treebf577d5c9f0da21c5d57feed1091214e54c39dec /net/net.c
parent8f0732ac3dc3bdbbcada313dc4b4b38d5d2c376a (diff)
parent4668a086bb0a769b741e3a4ffab85f1c41c7cdb8 (diff)
downloadu-boot-imx-1c27059a2f7158a9c9a8778535b030935d75179d.zip
u-boot-imx-1c27059a2f7158a9c9a8778535b030935d75179d.tar.gz
u-boot-imx-1c27059a2f7158a9c9a8778535b030935d75179d.tar.bz2
Merge remote-tracking branch 'u-boot/master'
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/net/net.c b/net/net.c
index e8ff066..809fb14 100644
--- a/net/net.c
+++ b/net/net.c
@@ -315,12 +315,15 @@ int NetLoop(enum proto_t protocol)
bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
net_init();
- eth_halt();
- eth_set_current();
- if (eth_init(bd) < 0) {
+ if (eth_is_on_demand_init() || protocol != NETCONS) {
eth_halt();
- return -1;
- }
+ eth_set_current();
+ if (eth_init(bd) < 0) {
+ eth_halt();
+ return -1;
+ }
+ } else
+ eth_init_state_only(bd);
restart:
net_set_state(NETLOOP_CONTINUE);
@@ -460,6 +463,9 @@ restart:
net_cleanup_loop();
eth_halt();
+ /* Invalidate the last protocol */
+ eth_set_last_protocol(BOOTP);
+
puts("\nAbort\n");
/* include a debug print as well incase the debug
messages are directed to stderr */
@@ -517,13 +523,21 @@ restart:
sprintf(buf, "%lX", (unsigned long)load_addr);
setenv("fileaddr", buf);
}
- eth_halt();
+ if (protocol != NETCONS)
+ eth_halt();
+ else
+ eth_halt_state_only();
+
+ eth_set_last_protocol(protocol);
+
ret = NetBootFileXferSize;
debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n");
goto done;
case NETLOOP_FAIL:
net_cleanup_loop();
+ /* Invalidate the last protocol */
+ eth_set_last_protocol(BOOTP);
debug_cond(DEBUG_INT_STATE, "--- NetLoop Fail!\n");
goto done;
@@ -652,7 +666,7 @@ NetSetTimeout(ulong iv, thand_f *f)
"--- NetLoop timeout handler set (%p)\n", f);
timeHandler = f;
timeStart = get_timer(0);
- timeDelta = iv;
+ timeDelta = iv * CONFIG_SYS_HZ / 1000;
}
}
@@ -1147,6 +1161,7 @@ NetReceive(uchar *inpkt, int len)
#ifdef CONFIG_NETCONSOLE
nc_input_packet((uchar *)ip + IP_UDP_HDR_SIZE,
+ ntohl(ip->ip_src),
ntohs(ip->udp_dst),
ntohs(ip->udp_src),
ntohs(ip->udp_len) - UDP_HDR_SIZE);