summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2012-10-04 10:00:42 -0700
committerTom Rini <trini@ti.com>2012-10-04 10:00:42 -0700
commit198166877768cf4d0197289a524df8a6ca0e2f19 (patch)
treed8fb2afc6d5b09ceeb4e3e62dc20b64d167ab346 /common
parent73c15c634dda388e21eaf0ebc85e324872df0d25 (diff)
parent777544085d2b417a36df50eb564bf037a044e60e (diff)
downloadu-boot-imx-198166877768cf4d0197289a524df8a6ca0e2f19.zip
u-boot-imx-198166877768cf4d0197289a524df8a6ca0e2f19.tar.gz
u-boot-imx-198166877768cf4d0197289a524df8a6ca0e2f19.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'common')
-rw-r--r--common/Makefile4
-rw-r--r--common/cmd_nvedit.c8
-rw-r--r--common/env_common.c7
-rw-r--r--common/serial.c8
-rw-r--r--common/spl/Makefile1
-rw-r--r--common/spl/spl.c11
-rw-r--r--common/spl/spl_net.c52
7 files changed, 89 insertions, 2 deletions
diff --git a/common/Makefile b/common/Makefile
index 92e06de..973f05a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -199,6 +199,10 @@ endif
ifdef CONFIG_SPL_BUILD
COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
+COBJS-$(CONFIG_SPL_NET_SUPPORT) += cmd_nvedit.o
+COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_common.o
+COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_nowhere.o
+COBJS-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
endif
COBJS-y += console.o
COBJS-y += dlmalloc.o
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3474bc6..8ecc498 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -103,6 +103,7 @@ int get_env_id(void)
return env_id;
}
+#ifndef CONFIG_SPL_BUILD
/*
* Command interface: print one or all environment variables
*
@@ -196,6 +197,7 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
return rcode;
}
#endif
+#endif /* CONFIG_SPL_BUILD */
/*
* Perform consistency checking before setting, replacing, or deleting an
@@ -437,6 +439,7 @@ int setenv_addr(const char *varname, const void *addr)
return setenv(varname, str);
}
+#ifndef CONFIG_SPL_BUILD
int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
if (argc < 2)
@@ -536,6 +539,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return setenv(argv[1], buffer);
}
#endif /* CONFIG_CMD_EDITENV */
+#endif /* CONFIG_SPL_BUILD */
/*
* Look up variable from environment,
@@ -621,6 +625,7 @@ ulong getenv_ulong(const char *name, int base, ulong default_val)
return str ? simple_strtoul(str, NULL, base) : default_val;
}
+#ifndef CONFIG_SPL_BUILD
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
@@ -635,6 +640,7 @@ U_BOOT_CMD(
""
);
#endif
+#endif /* CONFIG_SPL_BUILD */
/*
@@ -656,6 +662,7 @@ int envmatch(uchar *s1, int i2)
return -1;
}
+#ifndef CONFIG_SPL_BUILD
static int do_env_default(cmd_tbl_t *cmdtp, int __flag,
int argc, char * const argv[])
{
@@ -1114,3 +1121,4 @@ U_BOOT_CMD_COMPLETE(
var_complete
);
#endif
+#endif /* CONFIG_SPL_BUILD */
diff --git a/common/env_common.c b/common/env_common.c
index 3e46c26..57221ef 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -231,6 +231,7 @@ int set_default_vars(int nvars, char * const vars[])
nvars, vars, 1 /* do_apply */);
}
+#ifndef CONFIG_SPL_BUILD
/*
* Check if CRC is valid and (if yes) import the environment.
* Note that "buf" may or may not be aligned.
@@ -262,6 +263,7 @@ int env_import(const char *buf, int check)
return 0;
}
+#endif
void env_relocate(void)
{
@@ -269,7 +271,8 @@ void env_relocate(void)
env_reloc();
#endif
if (gd->env_valid == 0) {
-#if defined(CONFIG_ENV_IS_NOWHERE) /* Environment not changable */
+#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
+ /* Environment not changable */
set_default_env(NULL);
#else
bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
@@ -280,7 +283,7 @@ void env_relocate(void)
}
}
-#ifdef CONFIG_AUTO_COMPLETE
+#if defined(CONFIG_AUTO_COMPLETE) && !defined(CONFIG_SPL_BUILD)
int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf)
{
ENTRY *match;
diff --git a/common/serial.c b/common/serial.c
index 75cc1bb..4f2bc7f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -122,6 +122,14 @@ void serial_initialize(void)
serial_register(&uartlite_serial3_device);
# endif /* XILINX_UARTLITE_BASEADDR3 */
#endif /* CONFIG_XILINX_UARTLITE */
+#if defined(CONFIG_ZYNQ_SERIAL)
+# ifdef CONFIG_ZYNQ_SERIAL_BASEADDR0
+ serial_register(&uart_zynq_serial0_device);
+# endif
+# ifdef CONFIG_ZYNQ_SERIAL_BASEADDR1
+ serial_register(&uart_zynq_serial1_device);
+# endif
+#endif
serial_assign(default_serial_console()->name);
}
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 7cf01ad..5698a23 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -18,6 +18,7 @@ COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
COBJS-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
+COBJS-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
endif
COBJS := $(sort $(COBJS-y))
diff --git a/common/spl/spl.c b/common/spl/spl.c
index c640f87..40a7aca 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -155,6 +155,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
CONFIG_SYS_SPL_MALLOC_SIZE);
#endif
+ timer_init();
+
#ifdef CONFIG_SPL_BOARD_INIT
spl_board_init();
#endif
@@ -194,6 +196,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_spi_load_image();
break;
#endif
+#ifdef CONFIG_SPL_ETH_SUPPORT
+ case BOOT_DEVICE_CPGMAC:
+#ifdef CONFIG_SPL_ETH_DEVICE
+ spl_net_load_image(CONFIG_SPL_ETH_DEVICE);
+#else
+ spl_net_load_image(NULL);
+#endif
+ break;
+#endif
default:
debug("SPL: Un-supported Boot Device\n");
hang();
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
new file mode 100644
index 0000000..e1596fe
--- /dev/null
+++ b/common/spl/spl_net.c
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2000-2004
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * (C) Copyright 2012
+ * Ilya Yanok <ilya.yanok@gmail.com>
+ *
+ * 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.
+ */
+#include <common.h>
+#include <spl.h>
+#include <net.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void spl_net_load_image(const char *device)
+{
+ int rv;
+
+ env_init();
+ env_relocate();
+ setenv("autoload", "yes");
+ load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
+ rv = eth_initialize(gd->bd);
+ if (rv == 0) {
+ printf("No Ethernet devices found\n");
+ hang();
+ }
+ if (device)
+ setenv("ethact", device);
+ rv = NetLoop(BOOTP);
+ if (rv < 0) {
+ printf("Problem booting with BOOTP\n");
+ hang();
+ }
+ spl_parse_image_header((struct image_header *)load_addr);
+}