From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 06/14] ARM: Layerscape: ls1046a: Add automatic bootsource detection xload function
Date: Fri, 10 May 2019 08:21:27 +0200 [thread overview]
Message-ID: <20190510062135.11534-7-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190510062135.11534-1-s.hauer@pengutronix.de>
Add a helper function which continues booting from the detected
boot source.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-layerscape/Makefile | 2 +-
arch/arm/mach-layerscape/include/mach/xload.h | 2 ++
arch/arm/mach-layerscape/xload.c | 24 +++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/mach-layerscape/xload.c
diff --git a/arch/arm/mach-layerscape/Makefile b/arch/arm/mach-layerscape/Makefile
index 4705154fb1..73cd61a7cf 100644
--- a/arch/arm/mach-layerscape/Makefile
+++ b/arch/arm/mach-layerscape/Makefile
@@ -3,4 +3,4 @@ lwl-y += lowlevel.o errata.o
lwl-$(CONFIG_ARCH_LS1046) += lowlevel-ls1046a.o
obj-y += icid.o
obj-pbl-y += boot.o
-pbl-y += xload-qspi.o
+pbl-y += xload-qspi.o xload.o
diff --git a/arch/arm/mach-layerscape/include/mach/xload.h b/arch/arm/mach-layerscape/include/mach/xload.h
index 94756ed13d..eb2d998865 100644
--- a/arch/arm/mach-layerscape/include/mach/xload.h
+++ b/arch/arm/mach-layerscape/include/mach/xload.h
@@ -4,5 +4,7 @@
int ls1046a_esdhc_start_image(unsigned long r0, unsigned long r1, unsigned long r2);
int ls1046a_qspi_start_image(unsigned long r0, unsigned long r1,
unsigned long r2);
+int ls1046a_xload_start_image(unsigned long r0, unsigned long r1,
+ unsigned long r2);
#endif /* __MACH_XLOAD_H */
diff --git a/arch/arm/mach-layerscape/xload.c b/arch/arm/mach-layerscape/xload.c
new file mode 100644
index 0000000000..54495d7f97
--- /dev/null
+++ b/arch/arm/mach-layerscape/xload.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <common.h>
+#include <bootsource.h>
+#include <mach/layerscape.h>
+#include <mach/xload.h>
+
+int ls1046a_xload_start_image(unsigned long r0, unsigned long r1,
+ unsigned long r2)
+{
+ enum bootsource src;
+
+ src = ls1046_bootsource_get();
+
+ switch (src) {
+ case BOOTSOURCE_SPI_NOR:
+ return ls1046a_qspi_start_image(r0, r1, r2);
+ case BOOTSOURCE_MMC:
+ return ls1046a_esdhc_start_image(r0, r1, r2);
+ default:
+ pr_err("Unknown bootsource\n");
+ return -EINVAL;
+ }
+}
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-05-10 6:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 6:21 [PATCH 00/14] More Layerscape patches Sascha Hauer
2019-05-10 6:21 ` [PATCH 01/14] bbu: In bbu_register_std_file_update detect device before accessing it Sascha Hauer
2019-05-10 6:21 ` [PATCH 02/14] esdhc-xload: invalidate icache before jumping to image Sascha Hauer
2019-05-10 6:21 ` [PATCH 03/14] ARM: Layerscape: ls1046a: Add bootsource detection support Sascha Hauer
2019-05-10 6:21 ` [PATCH 04/14] ARM: Layerscape: pblimage: Drop pbl end command Sascha Hauer
2019-05-10 6:21 ` [PATCH 05/14] ARM: Layerscape: Add QSPI boot support Sascha Hauer
2019-05-10 6:21 ` Sascha Hauer [this message]
2019-05-10 6:21 ` [PATCH 07/14] ARM: Layerscape: ls1046a: Add bbu handlers Sascha Hauer
2019-05-10 6:21 ` [PATCH 08/14] ARM: Layerscape: TQMLS1046a: configure qspi divider Sascha Hauer
2019-05-10 6:21 ` [PATCH 09/14] ARM: Layerscape: TQMLS1046a: Sync qspi RCW from TQ U-Boot Sascha Hauer
2019-05-10 6:21 ` [PATCH 10/14] ARM: Layerscape: TQMLS1046a: print life signs when debugging Sascha Hauer
2019-05-10 6:21 ` [PATCH 11/14] ARM: Layerscape: TQMLS1046a: unify pbi files Sascha Hauer
2019-05-10 6:21 ` [PATCH 12/14] ARM: Layerscape: TQMLS1046a: Support booting from QSPI Sascha Hauer
2019-05-10 6:21 ` [PATCH 13/14] ARM: Layerscape: TQMLS1046a: Add environment and update handlers Sascha Hauer
2019-05-10 6:21 ` [PATCH 14/14] ARM: Layerscape: Add device tree compatible to image metadata Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190510062135.11534-7-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox