mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 11:55:03 +00:00
ast2600: spl: Add boot mode detection
AST2600 supports boot from SPI(mmap), eMMC, and UART. This patch adds the boot mode detection and return the corresponding boot device type. Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
This commit is contained in:
parent
442a69c143
commit
12770d0df0
2 changed files with 33 additions and 0 deletions
|
@ -87,6 +87,9 @@
|
||||||
#define SCU_HWSTRAP1_CPU_FREQ_SHIFT 8
|
#define SCU_HWSTRAP1_CPU_FREQ_SHIFT 8
|
||||||
#define SCU_HWSTRAP1_MAC2_INTF BIT(7)
|
#define SCU_HWSTRAP1_MAC2_INTF BIT(7)
|
||||||
#define SCU_HWSTRAP1_MAC1_INTF BIT(6)
|
#define SCU_HWSTRAP1_MAC1_INTF BIT(6)
|
||||||
|
#define SCU_HWSTRAP1_BOOT_EMMC BIT(2)
|
||||||
|
|
||||||
|
#define SCU_HWSTRAP2_BOOT_UART BIT(8)
|
||||||
|
|
||||||
#define SCU_EFUSE_DIS_DP BIT(17)
|
#define SCU_EFUSE_DIS_DP BIT(17)
|
||||||
#define SCU_EFUSE_DIS_VGA BIT(14)
|
#define SCU_EFUSE_DIS_VGA BIT(14)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <spl.h>
|
#include <spl.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
|
#include <linux/err.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/arch/scu_ast2600.h>
|
#include <asm/arch/scu_ast2600.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
@ -21,8 +22,37 @@ void board_init_f(ulong dummy)
|
||||||
dram_init();
|
dram_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to detect the boot mode. Fallback to the default,
|
||||||
|
* memory mapped SPI XIP booting if detection failed.
|
||||||
|
*/
|
||||||
u32 spl_boot_device(void)
|
u32 spl_boot_device(void)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
struct udevice *scu_dev;
|
||||||
|
struct ast2600_scu *scu;
|
||||||
|
|
||||||
|
rc = uclass_get_device_by_driver(UCLASS_CLK,
|
||||||
|
DM_DRIVER_GET(aspeed_ast2600_scu), &scu_dev);
|
||||||
|
if (rc) {
|
||||||
|
debug("%s: failed to get SCU driver\n", __func__);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
scu = devfdt_get_addr_ptr(scu_dev);
|
||||||
|
if (IS_ERR_OR_NULL(scu)) {
|
||||||
|
debug("%s: failed to get SCU base\n", __func__);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* boot from UART has higher priority */
|
||||||
|
if (scu->hwstrap2 & SCU_HWSTRAP2_BOOT_UART)
|
||||||
|
return BOOT_DEVICE_UART;
|
||||||
|
|
||||||
|
if (scu->hwstrap1 & SCU_HWSTRAP1_BOOT_EMMC)
|
||||||
|
return BOOT_DEVICE_MMC1;
|
||||||
|
|
||||||
|
out:
|
||||||
return BOOT_DEVICE_RAM;
|
return BOOT_DEVICE_RAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue