summaryrefslogtreecommitdiff
path: root/include/mach/rockchip/bootrom.h
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2022-12-25 22:20:04 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-04-05 08:49:07 +0200
commit4a6f536e4248e2bdc853250e7b9cbd1badb7cfe6 (patch)
treea3313dc689fe0a727612e60c5714b8956060911b /include/mach/rockchip/bootrom.h
parent4a26017f6dd70c6b0c0fd11d527291058c85cea5 (diff)
downloadbarebox-4a6f536e4248e2bdc853250e7b9cbd1badb7cfe6.tar.gz
ARM: Rockchip: make bootsource logic generic to all SoCs
Decoding of the bootsource from the register value can be shared across multiple Rockchip SoCs. Move the code to a common place to allow for that. At least with some TF-A versions the IRAM where the bootsource is stored cannot not be accessed in normal mode, so read it out before we start the TF-A. For this the scratch space is used. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/mach/rockchip/bootrom.h')
-rw-r--r--include/mach/rockchip/bootrom.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/mach/rockchip/bootrom.h b/include/mach/rockchip/bootrom.h
new file mode 100644
index 0000000000..96eb147ae4
--- /dev/null
+++ b/include/mach/rockchip/bootrom.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __MACH_ROCKCHIP_BOOTROM_H
+#define __MACH_ROCKCHIP_BOOTROM_H
+
+#include <linux/compiler.h>
+#include <linux/string.h>
+#include <asm/barebox-arm.h>
+
+struct rockchip_scratch_space {
+ u32 irom[16];
+};
+
+static inline void rockchip_store_bootrom_iram(ulong membase,
+ ulong memsize,
+ const void *iram)
+{
+ void *dst = (void *)__arm_mem_scratch(membase + memsize);
+ memcpy(dst, iram, sizeof(struct rockchip_scratch_space));
+}
+
+static inline const struct rockchip_scratch_space *rockchip_scratch_space(void)
+{
+ return arm_mem_scratch_get();
+}
+
+void rockchip_parse_bootrom_iram(const void *iram);
+
+int rockchip_bootsource_get_active_slot(void);
+
+
+#endif