@@ -20,6 +20,7 @@
#include <malloc.h>
#include <errno.h>
#include <netdev.h>
+#include <libfdt.h>
#include <asm/io.h>
#include <asm/arch/systimer.h>
#include <asm/arch/sysctrl.h>
@@ -60,6 +61,23 @@ int board_init(void)
return 0;
}
+int board_late_init(void)
+{
+ struct fdt_header *fdt = (void*)V2M_BASE;
+
+ if (fdt_magic(fdt) == FDT_MAGIC) {
+ setenv_addr("fdt_addr", (void*)(ulong)V2M_BASE);
+ printf("QEMU: fdt found at %s, using it.\n", getenv("fdt_addr"));
+ } else {
+ setenv_addr("fdt_addr_r", (void*)((ulong)V2M_BASE + 0x27f00000));
+ setenv("fdtfile", CONFIG_DEFAULT_FDT_FILE);
+ printf("QEMU: will try to load %s from disk.\n",
+ getenv("fdtfile"));
+ }
+
+ return 0;
+}
+
int board_eth_init(bd_t *bis)
{
int rc = 0;
@@ -184,8 +184,8 @@
/* Miscellaneous configurable options */
#undef CONFIG_SYS_CLKS_IN_HZ
-#define CONFIG_SYS_LOAD_ADDR (V2M_BASE + 0x8000)
-#define LINUX_BOOT_PARAM_ADDR (V2M_BASE + 0x2000)
+#define CONFIG_SYS_LOAD_ADDR (V2M_BASE + 0x100000)
+#define LINUX_BOOT_PARAM_ADDR (V2M_BASE + 0x200000)
/* Physical Memory Map */
#define CONFIG_NR_DRAM_BANKS 2
@@ -207,6 +207,8 @@
#include <config_distro_defaults.h>
#include <config_distro_bootcmd.h>
+#define CONFIG_BOARD_LATE_INIT
+
/* Basic environment settings */
#define CONFIG_BOOTCOMMAND "run bootflash;"
#ifdef CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
@@ -215,7 +217,6 @@
"kernel_addr_r=" "0x80008000\0" \
"scriptaddr=" "0x87d00000\0" \
"pxefile_addr_r=" "0x87e00000\0" \
- "fdt_addr_r=" "0x87f00000\0" \
"ramdisk_addr_r=" "0x88000000\0"
#elif defined(CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP)
#define CONFIG_PLATFORM_ENV_SETTINGS \
@@ -223,7 +224,6 @@
"kernel_addr_r=" "0xa0008000\0" \
"scriptaddr=" "0xa7d00000\0" \
"pxefile_addr_r=" "0xa7e00000\0" \
- "fdt_addr_r=" "0xa7f00000\0" \
"ramdisk_addr_r=" "0xa8000000\0"
#endif
@@ -235,7 +235,6 @@
#define CONFIG_EXTRA_ENV_SETTINGS \
CONFIG_PLATFORM_ENV_SETTINGS \
"console=ttyAMA0,115200n8\0" \
- "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
BOOTENV
/* FLASH and environment organization */