From 8438ea4b9bdebb4de34552d8baf79c32066a66b0 Mon Sep 17 00:00:00 2001 From: Nikhil Prakash V Date: Fri, 9 Nov 2018 14:13:58 +0530 Subject: [PATCH] ipq807x: Adding SOC version to default env. Adding soc_version_major and soc_version_minor to the default environment. Change-Id: I38ee6dd228382111beaa2bdacfade1e3d2c989de Signed-off-by: Nikhil Prakash V --- board/qca/arm/ipq807x/ipq807x.c | 16 ++++++++++++++++ common/env_common.c | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/board/qca/arm/ipq807x/ipq807x.c b/board/qca/arm/ipq807x/ipq807x.c index 7c94b777c0..2facf76677 100644 --- a/board/qca/arm/ipq807x/ipq807x.c +++ b/board/qca/arm/ipq807x/ipq807x.c @@ -1317,3 +1317,19 @@ void run_tzt(void *address) { execute_tzt(address); } + +void set_platform_specific_default_env(void) +{ + uint32_t soc_ver_major, soc_ver_minor, soc_version; + int ret; + + ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); + if (!ret) { + soc_ver_major = SOCINFO_VERSION_MAJOR(soc_version); + soc_ver_minor = SOCINFO_VERSION_MINOR(soc_version); + setenv_ulong("soc_version_major", (unsigned long)soc_ver_major); + setenv_ulong("soc_version_minor", (unsigned long)soc_ver_minor); + } + + return; +} diff --git a/common/env_common.c b/common/env_common.c index af59c72e1f..3ace236191 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -95,6 +95,11 @@ char *getenv_default(const char *name) return ret_val; } +__weak void set_platform_specific_default_env(void) +{ + return; +} + void set_default_env(const char *s) { int flags = 0; @@ -122,6 +127,8 @@ void set_default_env(const char *s) 0, NULL) == 0) error("Environment import failed: errno = %d\n", errno); + set_platform_specific_default_env(); + gd->flags |= GD_FLG_ENV_READY; }