summaryrefslogtreecommitdiffstats
path: root/arch/openrisc/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/openrisc/lib')
-rw-r--r--arch/openrisc/lib/Makefile3
-rw-r--r--arch/openrisc/lib/ashldi3.S2
-rw-r--r--arch/openrisc/lib/asm-offsets.c2
-rw-r--r--arch/openrisc/lib/board.c6
-rw-r--r--arch/openrisc/lib/clock.c4
-rw-r--r--arch/openrisc/lib/cpuinfo.c5
-rw-r--r--arch/openrisc/lib/dtb.c13
-rw-r--r--arch/openrisc/lib/lshrdi3.S2
-rw-r--r--arch/openrisc/lib/muldi3.S2
-rw-r--r--arch/openrisc/lib/setjmp.S56
10 files changed, 73 insertions, 22 deletions
diff --git a/arch/openrisc/lib/Makefile b/arch/openrisc/lib/Makefile
index 62082feed0..a55a9049e6 100644
--- a/arch/openrisc/lib/Makefile
+++ b/arch/openrisc/lib/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
obj-y += clock.o
obj-y += board.o
obj-y += cpuinfo.o
@@ -5,4 +7,5 @@ obj-y += muldi3.o
obj-y += lshrdi3.o
obj-y += ashldi3.o
obj-y += ashrdi3.o
+obj-y += setjmp.o
obj-$(CONFIG_BUILTIN_DTB) += dtb.o
diff --git a/arch/openrisc/lib/ashldi3.S b/arch/openrisc/lib/ashldi3.S
index 3e422fadc4..f6b976bff2 100644
--- a/arch/openrisc/lib/ashldi3.S
+++ b/arch/openrisc/lib/ashldi3.S
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
/*
* (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
*
diff --git a/arch/openrisc/lib/asm-offsets.c b/arch/openrisc/lib/asm-offsets.c
index 8cee8e00c6..e9d631a35c 100644
--- a/arch/openrisc/lib/asm-offsets.c
+++ b/arch/openrisc/lib/asm-offsets.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
/*
* OpenRISC asm-offsets.c
*
diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
index 25bcc0517b..9591120fee 100644
--- a/arch/openrisc/lib/board.c
+++ b/arch/openrisc/lib/board.c
@@ -1,9 +1,6 @@
/*
* (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
*
- * See file CREDITS for list of people who contributed to this
- * project.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@@ -22,6 +19,9 @@
#include <memory.h>
#include <asm-generic/memory_layout.h>
+/* Called from assembly */
+void openrisc_start_barebox(void);
+
void __noreturn openrisc_start_barebox(void)
{
mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE),
diff --git a/arch/openrisc/lib/clock.c b/arch/openrisc/lib/clock.c
index a171214a53..651b163f13 100644
--- a/arch/openrisc/lib/clock.c
+++ b/arch/openrisc/lib/clock.c
@@ -1,9 +1,6 @@
/*
* (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
*
- * See file CREDITS for list of people who contributed to this
- * project.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@@ -31,6 +28,7 @@ static struct clocksource cs = {
.read = openrisc_clocksource_read,
.mask = 0xffffffff,
.shift = 12,
+ .priority = 80,
};
static int clocksource_init(void)
diff --git a/arch/openrisc/lib/cpuinfo.c b/arch/openrisc/lib/cpuinfo.c
index 175adc582c..d94178ea59 100644
--- a/arch/openrisc/lib/cpuinfo.c
+++ b/arch/openrisc/lib/cpuinfo.c
@@ -2,9 +2,6 @@
* (C) Copyright 2011, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
* (C) Copyright 2011, Julius Baxter <julius@opencores.org>
*
- * See file CREDITS for list of people who contributed to this
- * project.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@@ -98,7 +95,7 @@ static void cpu_implementation(ulong vr2, char *string)
}
}
-int checkcpu(void)
+static int checkcpu(void)
{
ulong upr = mfspr(SPR_UPR);
ulong vr = mfspr(SPR_VR);
diff --git a/arch/openrisc/lib/dtb.c b/arch/openrisc/lib/dtb.c
index 04bb6d25cc..0507eed1d7 100644
--- a/arch/openrisc/lib/dtb.c
+++ b/arch/openrisc/lib/dtb.c
@@ -4,9 +4,6 @@
* Based on arch/arm/cpu/dtb.c:
* Copyright (C) 2013 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
- * See file CREDITS for list of people who contributed to this
- * project.
- *
* 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.
@@ -31,14 +28,6 @@ static int of_openrisc_init(void)
if (root)
return 0;
- root = of_unflatten_dtb(__dtb_start);
- if (!IS_ERR(root)) {
- pr_debug("using internal DTB\n");
- of_set_root_node(root);
- if (IS_ENABLED(CONFIG_OFDEVICE))
- of_probe();
- }
-
- return 0;
+ return barebox_register_fdt(__dtb_start);
}
core_initcall(of_openrisc_init);
diff --git a/arch/openrisc/lib/lshrdi3.S b/arch/openrisc/lib/lshrdi3.S
index de30445f4e..99aa73ef51 100644
--- a/arch/openrisc/lib/lshrdi3.S
+++ b/arch/openrisc/lib/lshrdi3.S
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
/*
* (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
*
diff --git a/arch/openrisc/lib/muldi3.S b/arch/openrisc/lib/muldi3.S
index 902338a242..70d0eacf1e 100644
--- a/arch/openrisc/lib/muldi3.S
+++ b/arch/openrisc/lib/muldi3.S
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
/*
* (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
*
diff --git a/arch/openrisc/lib/setjmp.S b/arch/openrisc/lib/setjmp.S
new file mode 100644
index 0000000000..7da3477808
--- /dev/null
+++ b/arch/openrisc/lib/setjmp.S
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <linux/linkage.h>
+
+/* int setjmp (jmp_buf); */
+ENTRY(setjmp)
+ l.sw 0(r3), r1
+ l.sw 4(r3), r2
+ l.sw 8(r3), r9
+ l.sw 12(r3), r10
+ l.sw 16(r3), r14
+ l.sw 20(r3), r16
+ l.sw 24(r3), r18
+ l.sw 28(r3), r20
+ l.sw 32(r3), r22
+ l.sw 36(r3), r24
+ l.sw 40(r3), r26
+ l.sw 44(r3), r28
+ l.sw 48(r3), r30
+ l.jr r9
+ l.movhi r11, 0x0
+END(setjmp)
+
+/* volatile void longjmp (jmp_buf, int); */
+ENTRY(longjmp)
+ l.lwz r1, 0(r3)
+ l.lwz r2, 4(r3)
+
+ /* if r4 is 0, something wrong, so set it to 1 */
+ l.sfeqi r4, 0x0
+ l.bnf 1f /* r4 != 0, longjmp value sensible */
+ l.nop
+ l.ori r4, r0, 0x1 /* make nonzero */
+1:
+ l.lwz r9, 8(r3)
+ l.lwz r10, 12(r3)
+ l.lwz r14, 16(r3)
+ l.lwz r16, 20(r3)
+ l.lwz r18, 24(r3)
+ l.lwz r20, 28(r3)
+ l.lwz r22, 32(r3)
+ l.lwz r24, 36(r3)
+ l.lwz r26, 40(r3)
+ l.lwz r28, 44(r3)
+ l.lwz r30, 48(r3)
+ l.jr r9
+ l.addi r11, r4, 0x0
+END(longjmp)
+
+/* int initjmp(jmp_buf jmp, void __noreturn (*func)(void), void *stack_top); */
+ENTRY(initjmp)
+ l.sw 8(r3), r4
+ l.sw 0(r3), r5
+ l.jr r9
+ l.movhi r11, 0x0
+END(initjmp)