From: Eric Nelson Date: Sun, 17 Nov 2013 10:17:44 -0700 Subject: [U-Boot] [PATCH 2/5] imx: Define common routines to set cpu and board environment variables In-Reply-To: <1384708667-22489-1-git-send-email-eric.nelson@boundarydevices.com> References: <1384708667-22489-1-git-send-email-eric.nelson@boundarydevices.com> Message-ID: <1384708667-22489-3-git-send-email-eric.nelson@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Defines two environment variables for use in producing DTB file names, among other uses: imx_type: defines the CPU variant through the get_imx_type() routine board_name: environment variable equivalent of CONFIG_SYS_BOARD_NAME Both can be over-ridden by a user. This is expected to be most useful when transitioning to a custom board. Signed-off-by: Eric Nelson --- arch/arm/imx-common/cpu.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c index 0cd2538..7c434c7 100644 --- a/arch/arm/imx-common/cpu.c +++ b/arch/arm/imx-common/cpu.c @@ -99,8 +99,6 @@ unsigned imx_ddr_size(void) } #endif -#if defined(CONFIG_DISPLAY_CPUINFO) - const char *get_imx_type(u32 imxtype) { switch (imxtype) { @@ -121,6 +119,28 @@ const char *get_imx_type(u32 imxtype) } } +#ifdef CONFIG_ARCH_MISC_INIT +void __weak set_imx_type(void) +{ + setenv("imx_type", get_imx_type(cpu_type(get_cpu_rev()))); +} + +void __weak set_board_name(void) +{ + char *old = getenv("board_name"); + if (!old) + setenv("board_name", CONFIG_SYS_BOARD); +} + +int arch_misc_init(void) +{ + set_imx_type(); + set_board_name(); + return 0; +} +#endif + +#if defined(CONFIG_DISPLAY_CPUINFO) int print_cpuinfo(void) { u32 cpurev; -- 1.8.1.2