summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2012-10-24 07:28:17 +0000
committerTom Rini <trini@ti.com>2012-11-02 15:14:28 -0700
commit044fc14bcbcd2a344a2e63c083852fb4af82b96d (patch)
tree03a2d4df999bae993467c266c385322cd5305d1b
parent418b7f3aff3bf4c508b2a57ffc6dc7ca10f811aa (diff)
downloadu-boot-imx-044fc14bcbcd2a344a2e63c083852fb4af82b96d.zip
u-boot-imx-044fc14bcbcd2a344a2e63c083852fb4af82b96d.tar.gz
u-boot-imx-044fc14bcbcd2a344a2e63c083852fb4af82b96d.tar.bz2
am335x_evm: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support
We add CONFIG_ENV_VARS_UBOOT_CONFIG, CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG and CONFIG_BOARD_LATE_INIT to set the variables and then fdtfile and findfdt to make us of this. It is now possible to do 'run findfdt' to have fdtfile be set to the value of the dtb file to load for the board we are running on. Signed-off-by: Tom Rini <trini@ti.com>
-rw-r--r--board/ti/am335x/board.c20
-rw-r--r--include/configs/am335x_evm.h11
2 files changed, 31 insertions, 0 deletions
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 5d279ec..1f0b1a7 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -299,6 +299,26 @@ int board_init(void)
return 0;
}
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+ char safe_string[HDR_NAME_LEN + 1];
+
+ /* Now set variables based on the header. */
+ strncpy(safe_string, (char *)header.name, sizeof(header.name));
+ safe_string[sizeof(header.name)] = 0;
+ setenv("board_name", safe_string);
+
+ strncpy(safe_string, (char *)header.version, sizeof(header.version));
+ safe_string[sizeof(header.version)] = 0;
+ setenv("board_rev", safe_string);
+#endif
+
+ return 0;
+}
+#endif
+
#ifdef CONFIG_DRIVER_TI_CPSW
static void cpsw_control(int enabled)
{
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 58d62d0..6e9aada 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -29,6 +29,7 @@
#define CONFIG_SYS_LONGHELP /* undef to save memory */
#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
#define CONFIG_SYS_PROMPT "U-Boot# "
+#define CONFIG_BOARD_LATE_INIT
#define CONFIG_SYS_NO_FLASH
#define MACH_TYPE_TIAM335EVM 3589 /* Until the next sync */
#define CONFIG_MACH_TYPE MACH_TYPE_TIAM335EVM
@@ -46,11 +47,14 @@
/* set to negative value for no autoboot */
#define CONFIG_BOOTDELAY 1
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
#define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=0x80200000\0" \
"fdtaddr=0x80F80000\0" \
"rdaddr=0x81000000\0" \
"bootfile=/boot/uImage\0" \
+ "fdtfile=\0" \
"console=ttyO0,115200n8\0" \
"optargs=\0" \
"mmcdev=0\0" \
@@ -79,6 +83,13 @@
"ramboot=echo Booting from ramdisk ...; " \
"run ramargs; " \
"bootm ${loadaddr}\0" \
+ "findfdt="\
+ "if test $board_name = A335BONE; then " \
+ "setenv fdtfile am335x-bone.dtb; fi; " \
+ "if test $board_name = A33515BB; then " \
+ "setenv fdtfile am335x-evm.dtb; fi; " \
+ "if test $board_name = A335X_SK; then " \
+ "setenv fdtfile am335x-evmsk.dtb; fi\0" \
#define CONFIG_BOOTCOMMAND \
"mmc dev ${mmcdev}; if mmc rescan; then " \