aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-meson
diff options
context:
space:
mode:
authorNeil Armstrong <narmstrong@baylibre.com>2019-05-22 13:30:25 +0200
committerNeil Armstrong <narmstrong@baylibre.com>2019-08-12 10:05:10 +0200
commit9a34dedfae0ebb031a45324c2fed8c39b2c6fcf2 (patch)
tree9125df5aff4cb2cee03a40e81943d30b408455e7 /arch/arm/mach-meson
parent09983675156dfa310d07362934e97d7a6b4588f3 (diff)
downloadu-boot-9a34dedfae0ebb031a45324c2fed8c39b2c6fcf2.zip
u-boot-9a34dedfae0ebb031a45324c2fed8c39b2c6fcf2.tar.gz
u-boot-9a34dedfae0ebb031a45324c2fed8c39b2c6fcf2.tar.bz2
ARM: meson: Add support for fastboot_set_reboot_flag()
Add support for fastboot_set_reboot_flag() by storing the reboot flag in the common code to be used by the custom PSCI reboot handler. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Diffstat (limited to 'arch/arm/mach-meson')
-rw-r--r--arch/arm/mach-meson/board-common.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index 18383f7..9b3fb47 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -14,6 +14,11 @@
#include <asm/unaligned.h>
#include <efi_loader.h>
+#if CONFIG_IS_ENABLED(FASTBOOT)
+#include <asm/psci.h>
+#include <fastboot.h>
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
__weak int board_init(void)
@@ -142,7 +147,35 @@ int board_late_init(void)
return meson_board_late_init();
}
+#if CONFIG_IS_ENABLED(FASTBOOT)
+static unsigned int reboot_reason = REBOOT_REASON_NORMAL;
+
+int fastboot_set_reboot_flag()
+{
+ reboot_reason = REBOOT_REASON_BOOTLOADER;
+
+ printf("Using reboot reason: 0x%x\n", reboot_reason);
+
+ return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+ struct pt_regs regs;
+
+ regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
+ regs.regs[1] = reboot_reason;
+
+ printf("Rebooting with reason: 0x%lx\n", regs.regs[1]);
+
+ smc_call(&regs);
+
+ while (1)
+ ;
+}
+#else
void reset_cpu(ulong addr)
{
psci_system_reset();
}
+#endif