summaryrefslogtreecommitdiff
path: root/arch/arm/mach-meson
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-meson')
-rw-r--r--arch/arm/mach-meson/Kconfig1
-rw-r--r--arch/arm/mach-meson/board-axg.c6
-rw-r--r--arch/arm/mach-meson/board-common.c45
-rw-r--r--arch/arm/mach-meson/board-gx.c6
4 files changed, 58 insertions, 0 deletions
diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
index deddcc5ab0..11077bc6cc 100644
--- a/arch/arm/mach-meson/Kconfig
+++ b/arch/arm/mach-meson/Kconfig
@@ -8,6 +8,7 @@ config MESON64_COMMON
select DM_SERIAL
select SYSCON
select REGMAP
+ select BOARD_LATE_INIT
imply CMD_DM
config MESON_GX
diff --git a/arch/arm/mach-meson/board-axg.c b/arch/arm/mach-meson/board-axg.c
index 014b25d61a..173905e762 100644
--- a/arch/arm/mach-meson/board-axg.c
+++ b/arch/arm/mach-meson/board-axg.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <asm/arch/boot.h>
#include <asm/arch/eth.h>
#include <asm/arch/axg.h>
#include <asm/arch/mem.h>
@@ -15,6 +16,11 @@
DECLARE_GLOBAL_DATA_PTR;
+int meson_get_boot_device(void)
+{
+ return readl(AXG_AO_SEC_GP_CFG0) & AXG_AO_BOOT_DEVICE;
+}
+
/* Configure the reserved memory zones exported by the secure registers
* into EFI and DTB reserved memory entries.
*/
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index 8c4f3074fb..8c41301674 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <asm/arch/boot.h>
#include <linux/libfdt.h>
#include <linux/err.h>
#include <asm/arch/mem.h>
@@ -66,6 +67,50 @@ void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size)
}
}
+static void meson_set_boot_source(void)
+{
+ const char *source;
+
+ switch (meson_get_boot_device()) {
+ case BOOT_DEVICE_EMMC:
+ source = "emmc";
+ break;
+
+ case BOOT_DEVICE_NAND:
+ source = "nand";
+ break;
+
+ case BOOT_DEVICE_SPI:
+ source = "spi";
+ break;
+
+ case BOOT_DEVICE_SD:
+ source = "sd";
+ break;
+
+ case BOOT_DEVICE_USB:
+ source = "usb";
+ break;
+
+ default:
+ source = "unknown";
+ }
+
+ env_set("boot_source", source);
+}
+
+__weak int meson_board_late_init(void)
+{
+ return 0;
+}
+
+int board_late_init(void)
+{
+ meson_set_boot_source();
+
+ return meson_board_late_init();
+}
+
void reset_cpu(ulong addr)
{
psci_system_reset();
diff --git a/arch/arm/mach-meson/board-gx.c b/arch/arm/mach-meson/board-gx.c
index f1397f87c5..e41552db52 100644
--- a/arch/arm/mach-meson/board-gx.c
+++ b/arch/arm/mach-meson/board-gx.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <asm/arch/boot.h>
#include <asm/arch/eth.h>
#include <asm/arch/gx.h>
#include <asm/arch/mem.h>
@@ -15,6 +16,11 @@
DECLARE_GLOBAL_DATA_PTR;
+int meson_get_boot_device(void)
+{
+ return readl(GX_AO_SEC_GP_CFG0) & GX_AO_BOOT_DEVICE;
+}
+
/* Configure the reserved memory zones exported by the secure registers
* into EFI and DTB reserved memory entries.
*/