From bff78567da51eee433e0e76a87edc5f0a03a0d8d Mon Sep 17 00:00:00 2001 From: Guillaume GARDET Date: Tue, 25 Aug 2015 15:10:26 +0200 Subject: [PATCH] ARM: rpi: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support and enable it to set 'board_rev' and 'board_name' envs. 'board_rev' can be used in scripts to determine what board we are running on and 'board_name' for pretty printing. Signed-off-by: Guillaume GARDET Cc: Stephen Warren Acked-by: Stephen Warren --- board/raspberrypi/rpi/rpi.c | 13 +++++++++++++ include/configs/rpi-common.h | 1 + 2 files changed, 14 insertions(+) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 942badb087..6451d1d916 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -242,10 +242,23 @@ static void set_usbethaddr(void) return; } +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +static void set_board_info(void) +{ + char str_rev[11]; + sprintf(str_rev, "0x%X", rpi_board_rev); + setenv("board_rev", str_rev); + setenv("board_name", models[rpi_board_rev].name); +} +#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */ + int misc_init_r(void) { set_fdtfile(); set_usbethaddr(); +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + set_board_info(); +#endif return 0; } diff --git a/include/configs/rpi-common.h b/include/configs/rpi-common.h index 06836cd5d8..58fe1f7a43 100644 --- a/include/configs/rpi-common.h +++ b/include/configs/rpi-common.h @@ -133,6 +133,7 @@ #include /* Environment */ +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define ENV_DEVICE_SETTINGS \ "stdin=serial,lcd\0" \ "stdout=serial,lcd\0" \ -- 2.25.1