aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-07-22 05:40:12 +0200
committerMarek Vasut <marex@denx.de>2015-08-08 14:14:08 +0200
commit9ec7414e29a1ae9c89bd9ab1c3dd12d0f53f6f4c (patch)
treefcafa62b01297e2d70af88c0cb985e7791511100
parentd85e311e7f1aa11ae168754c253b25e5d64ed123 (diff)
downloadu-boot-9ec7414e29a1ae9c89bd9ab1c3dd12d0f53f6f4c.zip
u-boot-9ec7414e29a1ae9c89bd9ab1c3dd12d0f53f6f4c.tar.gz
u-boot-9ec7414e29a1ae9c89bd9ab1c3dd12d0f53f6f4c.tar.bz2
arm: socfpga: misc: Export bootmode into environment variable
setenv an environment variable called "bootmode" , which contains the board boot mode. This can be in turn used in scripts to determine from where to load kernel and such. Signed-off-by: Marek Vasut <marex@denx.de>
-rw-r--r--arch/arm/mach-socfpga/misc.c34
-rw-r--r--include/configs/socfpga_common.h1
2 files changed, 24 insertions, 11 deletions
diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c
index d653bf6..27193e0 100644
--- a/arch/arm/mach-socfpga/misc.c
+++ b/arch/arm/mach-socfpga/misc.c
@@ -100,26 +100,38 @@ int cpu_mmc_init(bd_t *bis)
}
#endif
-#if defined(CONFIG_DISPLAY_CPUINFO)
-const char * const bsel_str[] = {
- "Reserved",
- "FPGA (HPS2FPGA Bridge)",
- "NAND Flash (1.8V)",
- "NAND Flash (3.0V)",
- "SD/MMC External Transceiver (1.8V)",
- "SD/MMC Internal Transceiver (3.0V)",
- "QSPI Flash (1.8V)",
- "QSPI Flash (3.0V)",
+struct {
+ const char *mode;
+ const char *name;
+} bsel_str[] = {
+ { "rsvd", "Reserved", },
+ { "fpga", "FPGA (HPS2FPGA Bridge)", },
+ { "nand", "NAND Flash (1.8V)", },
+ { "nand", "NAND Flash (3.0V)", },
+ { "sd", "SD/MMC External Transceiver (1.8V)", },
+ { "sd", "SD/MMC Internal Transceiver (3.0V)", },
+ { "qspi", "QSPI Flash (1.8V)", },
+ { "qspi", "QSPI Flash (3.0V)", },
};
/*
* Print CPU information
*/
+#if defined(CONFIG_DISPLAY_CPUINFO)
int print_cpuinfo(void)
{
const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
puts("CPU: Altera SoCFPGA Platform\n");
- printf("BOOT: %s\n", bsel_str[bsel]);
+ printf("BOOT: %s\n", bsel_str[bsel].name);
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_ARCH_MISC_INIT
+int arch_misc_init(void)
+{
+ const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
+ setenv("bootmode", bsel_str[bsel].mode);
return 0;
}
#endif
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index c62c78a..bed8600 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -18,6 +18,7 @@
*/
#define CONFIG_DISPLAY_CPUINFO
#define CONFIG_DISPLAY_BOARDINFO_LATE
+#define CONFIG_ARCH_MISC_INIT
#define CONFIG_ARCH_EARLY_INIT_R
#define CONFIG_SYS_NO_FLASH
#define CONFIG_CLOCKS