imx: Define common routines to set cpu and board environment variables
Subsystems (2)
PATCH 1/1 imx: Define common routines to set cpu and board environment variables
These can be used in bootcmd to produce DTB file names.
set_board_env() allows over-ride for use when a developing custom DTB files. Both are declared __weak to allow complete override by a board.
---
I'm feeling like I missed something here. Routines in imx-common/cpu.c are shared between various i.MX processors, but there doesn't appear to be a common header file.
It seems that arch/arm/include/asm/imx-common.h should be present but isn't. Am I missing something?
I also think there should be a way we could pull this into multiple boards without adding a full-up board_late_init() function into each board file, but tracing the init sequence, I'm not seeing an architecture-specific spot after env_init.
arch/arm/imx-common/cpu.c | 15 +++++++++++++-- arch/arm/include/asm/arch-mx6/sys_proto.h | 9 +++++++++ 2 files changed, 22 insertions(+), 2 deletions(-)
arch/arm/imx-common/cpu.c +13 -2
@@ -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,19 @@ const char *get_imx_type(u32 imxtype) } } +void __weak set_cpu_env () +{ +setenv ("cpu" ,get_imx_type (cpu_type (get_cpu_rev ()))); +} + +void __weak set_board_env () +{ +char *old =getenv ("board" ); +if (!old) +setenv ("board" ,CONFIG_SYS_BOARD ); +} + +#if defined(CONFIG_DISPLAY_CPUINFO )int print_cpuinfo (void ) {u32 cpurev;
arch/arm/include/asm/arch-mx6/sys_proto.h +9 -0
@@ -27,8 +27,17 @@ u32 get_cpu_rev(void);#define is_cpu_type (cpu) (cpu_type(get_cpu_rev()) == cpu)const char *get_imx_type (u32 imxtype); +unsigned imx_ddr_size (void ); +/* Set standard board and cpu environment variables. +* for use in loading DTB files. +* +* Call these in board_late_init if needed +*/ +void set_cpu_env (); +void set_board_env (); +void set_vddsoc (u32 mv);/*
Signature · 1 line
1.8.1.2