From: Jon Medhurst (Tixy) <tixy@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH] vexpress: Check TC2 firmware support before defaulting to nonsec booting
Date: Thu, 23 Jun 2016 13:37:32 +0100 [thread overview]
Message-ID: <1466685452.3022.18.camel@linaro.org> (raw)
In-Reply-To: <a33a0962-5a5f-9013-c655-5de5ca3d84b2@arm.com>
The firmware on TC2 needs to be configured appropriately before booting
in nonsec mode will work as expected, so test for this and fall back to
sec mode if required.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
---
This is an implementation of Andre's suggestion in
http://lists.denx.de/pipermail/u-boot/2016-June/258873.html
Possibly the change to bootm.c should be in a separate patch?
arch/arm/lib/bootm.c | 15 ++++++++++-----
board/armltd/vexpress/Makefile | 1 +
board/armltd/vexpress/vexpress_tc2.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 5 deletions(-)
create mode 100644 board/armltd/vexpress/vexpress_tc2.c
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 0838d89..766a0c8 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -248,15 +248,20 @@ static void boot_prep_linux(bootm_headers_t *images)
}
}
-#ifdef CONFIG_ARMV7_NONSEC
-bool armv7_boot_nonsec(void)
+__weak bool armv7_boot_nonsec_default(void)
{
- char *s = getenv("bootm_boot_mode");
#ifdef CONFIG_ARMV7_BOOT_SEC_DEFAULT
- bool nonsec = false;
+ return false;
#else
- bool nonsec = true;
+ return true;
#endif
+}
+
+#ifdef CONFIG_ARMV7_NONSEC
+bool armv7_boot_nonsec(void)
+{
+ char *s = getenv("bootm_boot_mode");
+ bool nonsec = armv7_boot_nonsec_default();
if (s && !strcmp(s, "sec"))
nonsec = false;
diff --git a/board/armltd/vexpress/Makefile b/board/armltd/vexpress/Makefile
index 1dd6780..95f4ec0 100644
--- a/board/armltd/vexpress/Makefile
+++ b/board/armltd/vexpress/Makefile
@@ -6,3 +6,4 @@
#
obj-y := vexpress_common.o
+obj-$(CONFIG_TARGET_VEXPRESS_CA15_TC2) += vexpress_tc2.o
diff --git a/board/armltd/vexpress/vexpress_tc2.c b/board/armltd/vexpress/vexpress_tc2.c
new file mode 100644
index 0000000..f00a83c
--- /dev/null
+++ b/board/armltd/vexpress/vexpress_tc2.c
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2016 Linaro
+ * Jon Medhurst <tixy@linaro.org>
+ *
+ * TC2 specific code for Versatile Express.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <asm/io.h>
+
+#define SCC_BASE 0x7fff0000
+
+bool armv7_boot_nonsec_default(void)
+{
+#ifdef CONFIG_ARMV7_BOOT_SEC_DEFAULT
+ return false
+#else
+ /*
+ * The Serial Configuration Controller (SCC) register at address 0x700
+ * contains flags for configuring the behaviour of the Boot Monitor
+ * (which CPUs execute from reset). Two of these bits are of interest:
+ *
+ * bit 12 = Use per-cpu mailboxes for power management
+ * bit 13 = Power down the non-boot cluster
+ *
+ * It is only when both of these are false that U-Boot's current
+ * implementation of 'nonsec' mode can work as expected because we
+ * rely on getting all CPUs to execute _nonsec_init, so let's check that.
+ */
+ return (readl((u32 *)(SCC_BASE + 0x700)) & ((1 << 12) | (1 << 13))) == 0;
+#endif
+}
--
2.1.4
next prev parent reply other threads:[~2016-06-23 12:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 14:34 [U-Boot] [PATCH] ARM: vexpress: Remove virt and nonsec support for TC2 Jon Medhurst
2016-06-22 14:53 ` Andre Przywara
2016-06-22 16:40 ` Jon Medhurst
2016-06-23 12:37 ` Jon Medhurst [this message]
2016-06-28 16:25 ` [U-Boot] [RFC PATCH] vexpress: Check TC2 firmware support before defaulting to nonsec booting Ryan Harkin
2016-08-14 20:05 ` [U-Boot] [U-Boot, RFC] " Tom Rini
2016-08-15 8:37 ` Jon Medhurst
2016-08-16 1:10 ` Tom Rini
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=1466685452.3022.18.camel@linaro.org \
--to=tixy@linaro.org \
--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