aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-k3/am625_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-k3/am625_init.c')
-rw-r--r--arch/arm/mach-k3/am625_init.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c
index 0e5d44269e..8fa36f7b91 100644
--- a/arch/arm/mach-k3/am625_init.c
+++ b/arch/arm/mach-k3/am625_init.c
@@ -80,8 +80,6 @@ static __maybe_unused void enable_mcu_esm_reset(void)
writel(stat, CTRLMMR_MCU_RST_CTRL);
}
-#if defined(CONFIG_CPU_V7R)
-
/*
* RTC Erratum i2327 Workaround for Silicon Revision 1
*
@@ -94,7 +92,7 @@ static __maybe_unused void enable_mcu_esm_reset(void)
*
* https://www.ti.com/lit/er/sprz487c/sprz487c.pdf
*/
-void rtc_erratumi2327_init(void)
+static __maybe_unused void rtc_erratumi2327_init(void)
{
u32 counter;
@@ -112,19 +110,17 @@ void rtc_erratumi2327_init(void)
*/
writel(K3RTC_KICK0_UNLOCK_VALUE, REG_K3RTC_KICK0);
writel(K3RTC_KICK1_UNLOCK_VALUE, REG_K3RTC_KICK1);
- return;
}
-#endif
void board_init_f(ulong dummy)
{
struct udevice *dev;
int ret;
-#if defined(CONFIG_CPU_V7R)
- setup_k3_mpu_regions();
- rtc_erratumi2327_init();
-#endif
+ if (IS_ENABLED(CONFIG_CPU_V7R)) {
+ setup_k3_mpu_regions();
+ rtc_erratumi2327_init();
+ }
/*
* Cannot delay this further as there is a chance that
@@ -156,29 +152,28 @@ void board_init_f(ulong dummy)
preloader_console_init();
-#ifdef CONFIG_K3_EARLY_CONS
/*
* Allow establishing an early console as required for example when
* doing a UART-based boot. Note that this console may not "survive"
* through a SYSFW PM-init step and will need a re-init in some way
* due to changing module clock frequencies.
*/
- early_console_init();
-#endif
+ if (IS_ENABLED(CONFIG_K3_EARLY_CONS))
+ early_console_init();
-#if defined(CONFIG_K3_LOAD_SYSFW)
/*
* Configure and start up system controller firmware. Provide
* the U-Boot console init function to the SYSFW post-PM configuration
* callback hook, effectively switching on (or over) the console
* output.
*/
- ret = is_rom_loaded_sysfw(&bootdata);
- if (!ret)
- panic("ROM has not loaded TIFS firmware\n");
+ if (IS_ENABLED(CONFIG_K3_LOAD_SYSFW)) {
+ ret = is_rom_loaded_sysfw(&bootdata);
+ if (!ret)
+ panic("ROM has not loaded TIFS firmware\n");
- k3_sysfw_loader(true, NULL, NULL);
-#endif
+ k3_sysfw_loader(true, NULL, NULL);
+ }
/*
* Force probe of clk_k3 driver here to ensure basic default clock
@@ -209,11 +204,11 @@ void board_init_f(ulong dummy)
enable_mcu_esm_reset();
}
-#if defined(CONFIG_K3_AM64_DDRSS)
- ret = uclass_get_device(UCLASS_RAM, 0, &dev);
- if (ret)
- panic("DRAM init failed: %d\n", ret);
-#endif
+ if (IS_ENABLED(CONFIG_K3_AM64_DDRSS)) {
+ ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+ if (ret)
+ panic("DRAM init failed: %d\n", ret);
+ }
spl_enable_dcache();
}
@@ -225,9 +220,15 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
u32 bootmode_cfg = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK) >>
MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT;
-
switch (bootmode) {
case BOOT_DEVICE_EMMC:
+ if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT)) {
+ if (spl_mmc_emmc_boot_partition(mmc))
+ return MMCSD_MODE_EMMCBOOT;
+ return MMCSD_MODE_FS;
+ }
+ if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
+ return MMCSD_MODE_FS;
return MMCSD_MODE_EMMCBOOT;
case BOOT_DEVICE_MMC:
if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)