summaryrefslogtreecommitdiffstats
path: root/target/u-boot/2009.01-rc1/u-boot-2009.01-rc1-012-ethinit.patch
blob: c2f709c7096c6ceedce628670cfea4e0e0e405ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff -urN u-boot-2009.01-0rig//common/cmd_ethinit.c u-boot-2009.01/common/cmd_ethinit.c
--- u-boot-2009.01-0rig//common/cmd_ethinit.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-2009.01/common/cmd_ethinit.c	2009-01-04 00:28:39.000000000 +0100
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Boot support
+ */
+#include <common.h>
+#include <command.h>
+#include <net.h>
+#ifdef CONFIG_CMD_ETHINIT
+extern int eth_init (bd_t * bd);
+
+static void	delay(void)
+{
+}
+/* 
+ * This command allows you to delay booting until you have a 
+ * valid Ethernet connection.
+ * Neccessary if you want to NFS mount a rootfs etc.
+ * When both this target and the NFS server 
+ * are powered on at the same time, then the NFS
+ * server can take a long time to boot.
+ */
+int do_ethinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	int	i;
+	DECLARE_GLOBAL_DATA_PTR;
+	while(eth_init (gd->bd) == 0) {
+		for(i = 0; i < 10000000; i ++) {
+			delay();
+		}
+	}
+	return 0;
+}
+
+U_BOOT_CMD(
+	ethinit,	1,	1,	do_ethinit,
+	"ethinit\t- Initialize Ethernet controller\n",
+	"\n"
+);
+
+#endif	/* CONFIG_CMD_ETHINIT */
diff -urN u-boot-2009.01-0rig//common/Makefile u-boot-2009.01/common/Makefile
--- u-boot-2009.01-0rig//common/Makefile	2009-01-04 00:22:06.000000000 +0100
+++ u-boot-2009.01/common/Makefile	2009-01-04 00:29:46.000000000 +0100
@@ -83,6 +83,7 @@
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o
 COBJS-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o
 COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o
+COBJS-$(CONFIG_CMD_ETHINIT) += cmd_ethinit.o
 COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o
 COBJS-$(CONFIG_CMD_FACTORY) += cmd_factory.o
 COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o