summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2016-01-10 16:58:12 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-11 11:48:40 +0100
commitdba6b4919e5b678b3b78b828b54504913577d337 (patch)
tree3c5be50e704e712c1b665aa653b0bb2830796525 /arch
parent5e246885da8ee4dd93e2aeb455d7b8c203f81f02 (diff)
downloadbarebox-dba6b4919e5b678b3b78b828b54504913577d337.tar.gz
barebox-dba6b4919e5b678b3b78b828b54504913577d337.tar.xz
ARM: Fix exception table setup in MMU-less mode
Add code necessary for correct initialization of exception vector table when MMU is disabled. Note: Only ARMv7 support is implemented Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/Makefile5
-rw-r--r--arch/arm/cpu/no-mmu.c61
2 files changed, 66 insertions, 0 deletions
diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index 418bcab759..854df60ebb 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -11,6 +11,11 @@ obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o
obj-$(CONFIG_OFDEVICE) += dtb.o
obj-$(CONFIG_MMU) += mmu.o cache.o mmu-early.o
pbl-$(CONFIG_MMU) += mmu-early.o
+
+ifeq ($(CONFIG_MMU),)
+obj-y += no-mmu.o
+endif
+
obj-$(CONFIG_CPU_32v4T) += cache-armv4.o
pbl-$(CONFIG_CPU_32v4T) += cache-armv4.o
obj-$(CONFIG_CPU_32v5) += cache-armv5.o
diff --git a/arch/arm/cpu/no-mmu.c b/arch/arm/cpu/no-mmu.c
new file mode 100644
index 0000000000..e227b457a1
--- /dev/null
+++ b/arch/arm/cpu/no-mmu.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015 Zodiac Inflight Innovation
+ * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#define pr_fmt(fmt) "nommu: " fmt
+
+#include <common.h>
+#include <dma-dir.h>
+#include <init.h>
+#include <mmu.h>
+#include <errno.h>
+#include <linux/sizes.h>
+#include <asm/memory.h>
+#include <asm/barebox-arm.h>
+#include <asm/system.h>
+#include <asm/cache.h>
+#include <memory.h>
+#include <asm/system_info.h>
+#include <debug_ll.h>
+
+
+#define __exceptions_size (__exceptions_stop - __exceptions_start)
+
+static int nommu_v7_vectors_init(void)
+{
+ void *vectors;
+ u32 cr;
+
+ if (cpu_architecture() < CPU_ARCH_ARMv7)
+ return 0;
+
+ /*
+ * High vectors cannot be re-mapped, so we have to use normal
+ * vectors
+ */
+ cr = get_cr();
+ cr &= ~CR_V;
+ set_cr(cr);
+
+ arm_fixup_vectors();
+
+ vectors = xmemalign(PAGE_SIZE, PAGE_SIZE);
+ memset(vectors, 0, PAGE_SIZE);
+ memcpy(vectors, __exceptions_start, __exceptions_size);
+
+ set_vbar((unsigned int)vectors);
+
+ return 0;
+}
+mmu_initcall(nommu_v7_vectors_init);