summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-zynq
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2019-12-10 23:03:22 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-11 09:51:23 +0100
commit825708c9e80fa8be3d029703fdccee714cdd9169 (patch)
treed906041aeba081d4ddc42c252a38f68b753ef7d2 /arch/arm/mach-zynq
parent583055c883ede073200dd2b8f5078793d5fe0313 (diff)
downloadbarebox-825708c9e80fa8be3d029703fdccee714cdd9169.tar.gz
barebox-825708c9e80fa8be3d029703fdccee714cdd9169.tar.xz
ARM: zynq: add Zynq image bootm handler
This adds a bootm handler for the Zynq image, to allow second stage booting of a unchanged Zynq boot image. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-zynq')
-rw-r--r--arch/arm/mach-zynq/Makefile2
-rw-r--r--arch/arm/mach-zynq/bootm-zynqimg.c49
2 files changed, 50 insertions, 1 deletions
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
index 3252247d17..c88ab4666f 100644
--- a/arch/arm/mach-zynq/Makefile
+++ b/arch/arm/mach-zynq/Makefile
@@ -1 +1 @@
-obj-y += zynq.o
+obj-y += zynq.o bootm-zynqimg.o
diff --git a/arch/arm/mach-zynq/bootm-zynqimg.c b/arch/arm/mach-zynq/bootm-zynqimg.c
new file mode 100644
index 0000000000..e903ab6679
--- /dev/null
+++ b/arch/arm/mach-zynq/bootm-zynqimg.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <bootm.h>
+#include <common.h>
+#include <init.h>
+#include <memory.h>
+
+static int do_bootm_zynqimage(struct image_data *data)
+{
+ resource_size_t start, end;
+ void (*barebox)(void);
+ u32 *header;
+ int ret;
+
+ ret = memory_bank_first_find_space(&start, &end);
+ if (ret)
+ return ret;
+
+ ret = bootm_load_os(data, start);
+ if (ret)
+ return ret;
+
+ header = (u32*)start;
+ barebox = (void*)start + header[12];
+
+ if (data->verbose)
+ printf("Loaded barebox image to 0x%08lx\n",
+ (unsigned long)barebox);
+
+ shutdown_barebox();
+
+ barebox();
+
+ return -EIO;
+}
+
+static struct image_handler zynq_image_handler = {
+ .name = "Zynq image",
+ .bootm = do_bootm_zynqimage,
+ .filetype = filetype_zynq_image,
+};
+
+static int zynq_register_image_handler(void)
+{
+ register_image_handler(&zynq_image_handler);
+
+ return 0;
+}
+late_initcall(zynq_register_image_handler);