new file mode 100644
@@ -0,0 +1,11 @@
+#ifndef __ASMARM_MMU_H_
+#define __ASMARM_MMU_H_
+/*
+ * Copyright (C) 2014, Red Hat Inc, Andrew Jones <drjones@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.
+ */
+
+#define mmu_enabled() (0)
+
+#endif /* __ASMARM_MMU_H_ */
@@ -1,12 +1,19 @@
#include "libcflat.h"
#include "asm/spinlock.h"
#include "asm/barrier.h"
+#include "asm/mmu.h"
void spin_lock(struct spinlock *lock)
{
u32 val, fail;
dmb();
+
+ if (!mmu_enabled()) {
+ lock->v = 1;
+ return;
+ }
+
do {
asm volatile(
"1: ldrex %0, [%2]\n"
Cubietruck seems to be more sensitive than my Midway when attempting to use [ldr|str]ex instructions without caches enabled (mmu disabled). Fix this by making the spinlock implementation (currently the only user of *ex instructions) conditional on the mmu being enabled. Signed-off-by: Andrew Jones <drjones@redhat.com> --- lib/arm/asm/mmu.h | 11 +++++++++++ lib/arm/spinlock.c | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 lib/arm/asm/mmu.h