mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH] i.MX27: Export boot source to magic variables
Date: Sun, 25 Mar 2012 21:15:16 +0400	[thread overview]
Message-ID: <1332695716-6959-1-git-send-email-shc_work@mail.ru> (raw)


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/boot.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 8b82655..9f2def6 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -86,9 +86,34 @@ static int imx_25_35_boot_save_loc(void)
 
 	return 0;
 }
-
 coredevice_initcall(imx_25_35_boot_save_loc);
 
 BAREBOX_MAGICVAR(barebox_loc, "The source barebox has been booted from");
+#endif
+
+#if defined(CONFIG_ARCH_IMX27)
+static int imx_27_boot_save_loc(void)
+{
+	switch ((GPCR & GPCR_BOOT_MASK) >> GPCR_BOOT_SHIFT) {
+	case GPCR_BOOT_UART_USB:
+		setenv("barebox_loc", "serial");
+		break;
+	case GPCR_BOOT_8BIT_NAND_2k:
+	case GPCR_BOOT_16BIT_NAND_2k:
+	case GPCR_BOOT_16BIT_NAND_512:
+	case GPCR_BOOT_8BIT_NAND_512:
+		setenv("barebox_loc", "nand");
+		break;
+	default:
+		setenv("barebox_loc", "nor");
+		break;
+	}
 
+	export("barebox_loc");
+
+	return 0;
+}
+coredevice_initcall(imx_27_boot_save_loc);
+
+BAREBOX_MAGICVAR(barebox_loc, "The source barebox has been booted from");
 #endif
-- 
1.7.3.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2012-03-25 17:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25 17:15 Alexander Shiyan [this message]
2012-04-02  8:08 ` Sascha Hauer

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=1332695716-6959-1-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.org \
    /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