Message ID | 1440508226-8455-1-git-send-email-guillaume.gardet@free.fr |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
On 08/25/2015 07:10 AM, Guillaume GARDET wrote: > 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. The patch itself looks clean enough now, although like I said in response to V1 I'm still a little worried about the intended use-case, and do think there are likely better ways of solving any issue. Still, I guess the board_rev values are driven by the RPi firmware itself, so they're OK as an ABI. Acked-by: Stephen Warren <swarren@wwwdotorg.org>
On Tue, Aug 25, 2015 at 03:10:26PM +0200, Guillaume GARDET wrote: > 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 <guillaume.gardet@free.fr> > > Cc: Stephen Warren <swarren@wwwdotorg.org> > Acked-by: Stephen Warren <swarren@wwwdotorg.org> Applied to u-boot/master, thanks!
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index d21750e..dc6f096 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -236,10 +236,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 8830a10..17237cf 100644 --- a/include/configs/rpi-common.h +++ b/include/configs/rpi-common.h @@ -133,6 +133,7 @@ #include <config_distro_defaults.h> /* Environment */ +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define ENV_DEVICE_SETTINGS \ "stdin=serial,lcd\0" \ "stdout=serial,lcd\0" \
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 <guillaume.gardet@free.fr> Cc: Stephen Warren <swarren@wwwdotorg.org> --- Changes in V2: * Move setenvs to set_board_info() function * Expand patch log board/raspberrypi/rpi/rpi.c | 13 +++++++++++++ include/configs/rpi-common.h | 1 + 2 files changed, 14 insertions(+)