mirror of
https://xff.cz/git/u-boot/
synced 2025-09-28 05:51:17 +02:00
sifive: fu540: Add runtime boot mode detection
Add support to detect boot mode at runtime for SiFive FU540 boards. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Bin Meng <bin.meng@windriver.com> Tested-by: Bin Meng <bin.meng@windriver.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
|
#include <linux/bitops.h>
|
||||||
#include <linux/bug.h>
|
#include <linux/bug.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
@@ -128,14 +129,26 @@ int board_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SPL
|
#ifdef CONFIG_SPL
|
||||||
|
#define MODE_SELECT_REG 0x1000
|
||||||
|
#define MODE_SELECT_QSPI 0x6
|
||||||
|
#define MODE_SELECT_SD 0xb
|
||||||
|
#define MODE_SELECT_MASK GENMASK(3, 0)
|
||||||
|
|
||||||
u32 spl_boot_device(void)
|
u32 spl_boot_device(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SPL_MMC_SUPPORT
|
u32 mode_select = readl((void *)MODE_SELECT_REG);
|
||||||
|
u32 boot_device = mode_select & MODE_SELECT_MASK;
|
||||||
|
|
||||||
|
switch (boot_device) {
|
||||||
|
case MODE_SELECT_QSPI:
|
||||||
|
return BOOT_DEVICE_SPI;
|
||||||
|
case MODE_SELECT_SD:
|
||||||
return BOOT_DEVICE_MMC1;
|
return BOOT_DEVICE_MMC1;
|
||||||
#else
|
default:
|
||||||
puts("Unknown boot device\n");
|
debug("Unsupported boot device 0x%x but trying MMC1\n",
|
||||||
hang();
|
boot_device);
|
||||||
#endif
|
return BOOT_DEVICE_MMC1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user