summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-zynq/zynq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-zynq/zynq.c')
-rw-r--r--arch/arm/mach-zynq/zynq.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/arch/arm/mach-zynq/zynq.c b/arch/arm/mach-zynq/zynq.c
index f6112fd249..79a6b908e0 100644
--- a/arch/arm/mach-zynq/zynq.c
+++ b/arch/arm/mach-zynq/zynq.c
@@ -14,11 +14,12 @@
*/
#include <asm/system.h>
-#include <io.h>
+#include <bootsource.h>
#include <common.h>
#include <init.h>
-#include <restart.h>
+#include <io.h>
#include <mach/zynq7000-regs.h>
+#include <restart.h>
static void __noreturn zynq_restart_soc(struct restart_handler *rst)
{
@@ -30,6 +31,26 @@ static void __noreturn zynq_restart_soc(struct restart_handler *rst)
hang();
}
+static enum bootsource zynq_bootsource_get(void)
+{
+ u32 boot_mode = readl(ZYNQ_SLCR_BOOT_MODE);
+
+ switch (boot_mode & 0x7) {
+ case 0x0:
+ return BOOTSOURCE_JTAG;
+ case 0x1:
+ return BOOTSOURCE_SPI;
+ case 0x2:
+ return BOOTSOURCE_NOR;
+ case 0x4:
+ return BOOTSOURCE_NAND;
+ case 0x5:
+ return BOOTSOURCE_MMC;
+ default:
+ return BOOTSOURCE_UNKNOWN;
+ }
+}
+
static int zynq_init(void)
{
u32 val;
@@ -48,11 +69,10 @@ static int zynq_init(void)
writel(val, 0xf8f00000);
dmb();
- add_generic_device("zynq-clock", 0, NULL, ZYNQ_SLCR_BASE, 0x4000, IORESOURCE_MEM, NULL);
- add_generic_device("smp_twd", 0, NULL, CORTEXA9_SCU_TIMER_BASE_ADDR,
- 0x4000, IORESOURCE_MEM, NULL);
restart_handler_register_fn(zynq_restart_soc);
+ bootsource_set(zynq_bootsource_get());
+
return 0;
}
postcore_initcall(zynq_init);