summaryrefslogtreecommitdiff
path: root/board/phytec
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2019-02-13 22:46:56 +0100
committerStefano Babic <sbabic@denx.de>2019-04-13 20:30:08 +0200
commite5b345f30cc717706cd45cb18291cb607c3b1d4d (patch)
tree09f53a5c08fce50a5954615f26fd1f1600e30c6d /board/phytec
parentb3d28ace14ce2dcd09bfce99fdbabe2fe60ea334 (diff)
pcm052: bk4: sdcard: Add support for SD card booting/recovery
This code allows reusing the default u-boot as in the late board init, the default envs are restored and proper recovery scripts executed. Signed-off-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'board/phytec')
-rw-r--r--board/phytec/pcm052/pcm052.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c
index 4a18b0e0f4..d4f170a503 100644
--- a/board/phytec/pcm052/pcm052.c
+++ b/board/phytec/pcm052/pcm052.c
@@ -13,6 +13,7 @@
#include <asm/arch/ddrmc-vf610.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/clock.h>
+#include <environment.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -307,6 +308,37 @@ int board_init(void)
return 0;
}
+#ifdef CONFIG_TARGET_BK4R1
+int board_late_init(void)
+{
+ struct src *psrc = (struct src *)SRC_BASE_ADDR;
+ u32 reg;
+
+ /*
+ * BK4r1 handle emergency/service SD card boot
+ * Checking the SBMR1 register BOOTCFG1 byte:
+ * NAND:
+ * bit [2] - NAND data width - 16
+ * bit [5] - NAND fast boot
+ * bit [7] = 1 - NAND as a source of booting
+ * SD card (0x64):
+ * bit [4] = 0 - SD card source
+ * bit [6] = 1 - SD/MMC source
+ */
+
+ reg = readl(&psrc->sbmr1);
+ if ((reg & SRC_SBMR1_BOOTCFG1_SDMMC) &&
+ !(reg & SRC_SBMR1_BOOTCFG1_MMC)) {
+ printf("------ SD card boot -------\n");
+ set_default_env("!LVFBootloader", 0);
+ env_set("bootcmd",
+ "run prepare_install_bk4r1_envs; run install_bk4r1rs");
+ }
+
+ return 0;
+}
+#endif /* CONFIG_TARGET_BK4R1 */
+
int checkboard(void)
{
#ifdef CONFIG_TARGET_BK4R1