public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eric Nelson <eric.nelson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] imx: Define common routines to set cpu and board environment variables
Date: Sun, 17 Nov 2013 10:17:44 -0700	[thread overview]
Message-ID: <1384708667-22489-3-git-send-email-eric.nelson@boundarydevices.com> (raw)
In-Reply-To: <1384708667-22489-1-git-send-email-eric.nelson@boundarydevices.com>

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 <eric.nelson@boundarydevices.com>
---
 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

  parent reply	other threads:[~2013-11-17 17:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17 17:17 [U-Boot] [PATCH V3 0/5] imx: Define common routines to set cpu and board environment variables Eric Nelson
2013-11-17 17:17 ` [U-Boot] [PATCH V3 1/5] i.MX5x: define cpu_type() to return processor portion of cpu rev Eric Nelson
2013-11-17 19:24   ` Marek Vasut
2013-11-18 10:42   ` Stefano Babic
2013-11-19  3:25     ` Eric Nelson
2013-11-19  9:12       ` Stefano Babic
2013-11-17 17:17 ` Eric Nelson [this message]
2013-11-17 17:17 ` [U-Boot] [PATCH 3/5] i.MX6: nitrogen6x/sabrelite: override set_board_name() Eric Nelson
2013-11-18 10:57   ` Stefano Babic
2013-11-19  3:40     ` Eric Nelson
2013-11-19  9:02       ` Stefano Babic
2013-11-17 17:17 ` [U-Boot] [PATCH 4/5] i.MX6: nitrogen6x/sabrelite: initialize imx_type and board_name values Eric Nelson
2013-11-17 17:17 ` [U-Boot] [PATCH 5/5] i.MX6: mx6*sabre*: " Eric Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384708667-22489-3-git-send-email-eric.nelson@boundarydevices.com \
    --to=eric.nelson@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox