aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/Kconfig1
-rw-r--r--arch/mips/mach-mtmips/cpu.c6
-rw-r--r--arch/mips/mach-pic32/cpu.c4
-rw-r--r--arch/x86/cpu/coreboot/coreboot.c7
-rw-r--r--arch/x86/cpu/cpu.c10
-rw-r--r--arch/x86/cpu/efi/payload.c4
-rw-r--r--arch/x86/cpu/quark/quark.c4
-rw-r--r--board/CZ.NIC/turris_mox/turris_mox.c4
-rw-r--r--board/Marvell/mvebu_armada-37xx/board.c5
-rw-r--r--board/Marvell/octeon_nic23/board.c4
-rw-r--r--board/Marvell/octeontx2/board.c4
-rw-r--r--board/cortina/presidio-asic/presidio.c4
-rw-r--r--board/emulation/qemu-ppce500/qemu-ppce500.c4
-rw-r--r--board/gdsys/a38x/controlcenterdc.c31
-rw-r--r--board/gdsys/mpc8308/gazerbeam.c4
-rw-r--r--board/ge/bx50v3/bx50v3.c4
-rw-r--r--board/keymile/km83xx/km83xx.c4
-rw-r--r--board/keymile/kmcent2/kmcent2.c3
-rw-r--r--board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c6
-rw-r--r--board/phytium/durian/durian.c4
-rw-r--r--board/phytium/pomelo/pomelo.c4
-rw-r--r--common/Kconfig1
-rw-r--r--common/board_r.c9
-rw-r--r--common/event.c1
-rw-r--r--configs/bayleybay_defconfig1
-rw-r--r--configs/cherryhill_defconfig1
-rw-r--r--configs/chromebook_coral_defconfig1
-rw-r--r--configs/chromebook_link64_defconfig1
-rw-r--r--configs/chromebook_link_defconfig1
-rw-r--r--configs/chromebook_samus_defconfig1
-rw-r--r--configs/chromebook_samus_tpl_defconfig1
-rw-r--r--configs/chromebox_panther_defconfig1
-rw-r--r--configs/conga-qeval20-qa3-e3845-internal-uart_defconfig1
-rw-r--r--configs/conga-qeval20-qa3-e3845_defconfig1
-rw-r--r--configs/coreboot64_defconfig1
-rw-r--r--configs/coreboot_defconfig1
-rw-r--r--configs/cougarcanyon2_defconfig1
-rw-r--r--configs/crownbay_defconfig1
-rw-r--r--configs/dfi-bt700-q7x-151_defconfig1
-rw-r--r--configs/edison_defconfig1
-rw-r--r--configs/efi-x86_app32_defconfig1
-rw-r--r--configs/efi-x86_app64_defconfig1
-rw-r--r--configs/efi-x86_payload32_defconfig1
-rw-r--r--configs/efi-x86_payload64_defconfig1
-rw-r--r--configs/galileo_defconfig1
-rw-r--r--configs/minnowmax_defconfig1
-rw-r--r--configs/qemu-x86_64_defconfig3
-rw-r--r--configs/qemu-x86_defconfig1
-rw-r--r--configs/som-db5800-som-6867_defconfig1
-rw-r--r--configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig1
-rw-r--r--configs/theadorable-x86-conga-qa3-e3845_defconfig1
-rw-r--r--configs/theadorable-x86-dfi-bt700_defconfig1
-rw-r--r--include/event.h12
-rw-r--r--include/init.h1
54 files changed, 95 insertions, 80 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index c9a33592252..90345cbee0d 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -252,6 +252,7 @@ config X86
imply DM_SPI
imply DM_SPI_FLASH
imply DM_USB
+ imply LAST_STAGE_INIT
imply VIDEO
imply SYSRESET
imply SPL_SYSRESET
diff --git a/arch/mips/mach-mtmips/cpu.c b/arch/mips/mach-mtmips/cpu.c
index f1e90227386..e88dab10c76 100644
--- a/arch/mips/mach-mtmips/cpu.c
+++ b/arch/mips/mach-mtmips/cpu.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <event.h>
#include <init.h>
#include <malloc.h>
#include <asm/addrspace.h>
@@ -21,7 +22,8 @@ int dram_init(void)
return 0;
}
-int last_stage_init(void)
+#ifndef CONFIG_SPL_BUILD
+static int last_stage_init(void)
{
void *src, *dst;
@@ -46,3 +48,5 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+#endif
diff --git a/arch/mips/mach-pic32/cpu.c b/arch/mips/mach-pic32/cpu.c
index 785a87b618b..7ed306e045e 100644
--- a/arch/mips/mach-pic32/cpu.c
+++ b/arch/mips/mach-pic32/cpu.c
@@ -57,7 +57,7 @@ static ulong clk_get_cpu_rate(void)
}
/* initialize prefetch module related to cpu_clk */
-static void prefetch_init(void)
+static int prefetch_init(void)
{
struct pic32_reg_atomic *regs;
const void __iomem *base;
@@ -93,6 +93,8 @@ static void prefetch_init(void)
/* Enable prefetch for all */
writel(0x30, &regs->set);
iounmap(regs);
+
+ return 0;
}
/* arch-specific CPU init after DM: flash prefetch */
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index d7eedbd7436..835b2c77746 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <cpu_func.h>
+#include <event.h>
#include <fdtdec.h>
#include <init.h>
#include <usb.h>
@@ -74,8 +75,11 @@ static void board_final_init(void)
}
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
+ if (IS_ENABLED(CONFIG_SPL_BUILD))
+ return 0;
+
/* start usb so that usb keyboard can be used as input device */
if (IS_ENABLED(CONFIG_USB_KEYBOARD))
usb_init();
@@ -84,3 +88,4 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index dddd281e966..ce55efc454b 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -26,6 +26,7 @@
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <event.h>
#include <init.h>
#include <irq.h>
#include <log.h>
@@ -185,7 +186,8 @@ void show_boot_progress(int val)
}
#endif
-#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB)
+#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB) && \
+ !defined(CONFIG_SPL_BUILD)
/*
* Implement a weak default function for boards that need to do some final init
* before the system is ready.
@@ -202,7 +204,7 @@ __weak void board_final_cleanup(void)
{
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
struct acpi_fadt __maybe_unused *fadt;
int ret;
@@ -245,7 +247,9 @@ int last_stage_init(void)
return 0;
}
-#endif
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+
+#endif /* !SYS_COREBOOT && !EFI_STUB && !SPL_BUILD */
static int x86_init_cpus(void)
{
diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c
index d8920effd39..708bfbe7ee4 100644
--- a/arch/x86/cpu/efi/payload.c
+++ b/arch/x86/cpu/efi/payload.c
@@ -9,6 +9,7 @@
#include <efi.h>
#include <efi_api.h>
#include <errno.h>
+#include <event.h>
#include <init.h>
#include <log.h>
#include <usb.h>
@@ -168,7 +169,7 @@ int reserve_arch(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
/* start usb so that usb keyboard can be used as input device */
if (IS_ENABLED(CONFIG_USB_KEYBOARD))
@@ -176,6 +177,7 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
unsigned int install_e820_map(unsigned int max_entries,
struct e820_entry *entries)
diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c
index 86d90d84ddb..62b83c228cf 100644
--- a/arch/x86/cpu/quark/quark.c
+++ b/arch/x86/cpu/quark/quark.c
@@ -107,7 +107,7 @@ static void quark_setup_bars(void)
CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN);
}
-static void quark_pcie_early_init(void)
+static int quark_pcie_early_init(void)
{
/*
* Step1: Assert PCIe signal PERST#
@@ -146,6 +146,8 @@ static void quark_pcie_early_init(void)
/* Mixer Load Lane 1 */
msg_port_io_clrbits(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L1,
(1 << 6) | (1 << 7));
+
+ return 0;
}
static void quark_usb_early_init(void)
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index a52a032e4d5..370c2668b08 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -15,6 +15,7 @@
#include <dm.h>
#include <dm/of_extra.h>
#include <env.h>
+#include <event.h>
#include <fdt_support.h>
#include <init.h>
#include <led.h>
@@ -667,7 +668,7 @@ err:
return NULL;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
struct gpio_desc reset_gpio = {};
@@ -712,6 +713,7 @@ handle_reset_btn:
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
#if defined(CONFIG_OF_BOARD_SETUP)
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index 3ab6e8873d8..3fe5319437e 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -8,6 +8,7 @@
#include <dm/device-internal.h>
#include <env.h>
#include <env_internal.h>
+#include <event.h>
#include <i2c.h>
#include <init.h>
#include <mmc.h>
@@ -301,7 +302,7 @@ static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr,
}
/* Bring-up board-specific network stuff */
-int last_stage_init(void)
+static int last_stage_init(void)
{
struct udevice *bus;
ofnode node;
@@ -356,6 +357,8 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+
#endif
#ifdef CONFIG_OF_BOARD_SETUP
diff --git a/board/Marvell/octeon_nic23/board.c b/board/Marvell/octeon_nic23/board.c
index 08b1aa4b6ef..bc9332cb74a 100644
--- a/board/Marvell/octeon_nic23/board.c
+++ b/board/Marvell/octeon_nic23/board.c
@@ -5,6 +5,7 @@
#include <cyclic.h>
#include <dm.h>
+#include <event.h>
#include <ram.h>
#include <time.h>
#include <asm/gpio.h>
@@ -364,7 +365,7 @@ int board_late_init(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
struct gpio_desc gpio = {};
ofnode node;
@@ -386,3 +387,4 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
diff --git a/board/Marvell/octeontx2/board.c b/board/Marvell/octeontx2/board.c
index e7899f49f0c..974e9eb8200 100644
--- a/board/Marvell/octeontx2/board.c
+++ b/board/Marvell/octeontx2/board.c
@@ -12,6 +12,7 @@
#include <asm/global_data.h>
#include <dm/uclass-internal.h>
#include <env.h>
+#include <event.h>
#include <init.h>
#include <malloc.h>
#include <net.h>
@@ -213,11 +214,12 @@ void board_acquire_flash_arb(bool acquire)
}
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
(void)smc_flsf_fw_booted();
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
diff --git a/board/cortina/presidio-asic/presidio.c b/board/cortina/presidio-asic/presidio.c
index aae0a5dac06..fdfa3affc3b 100644
--- a/board/cortina/presidio-asic/presidio.c
+++ b/board/cortina/presidio-asic/presidio.c
@@ -4,6 +4,7 @@
*
*/
#include <common.h>
+#include <event.h>
#include <init.h>
#include <malloc.h>
#include <errno.h>
@@ -121,7 +122,7 @@ void reset_cpu(void)
}
#ifdef CONFIG_LAST_STAGE_INIT
-int last_stage_init(void)
+static int last_stage_init(void)
{
u32 val;
@@ -134,4 +135,5 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
#endif
diff --git a/board/emulation/qemu-ppce500/qemu-ppce500.c b/board/emulation/qemu-ppce500/qemu-ppce500.c
index a39bcb4fa0c..7ca8773b17e 100644
--- a/board/emulation/qemu-ppce500/qemu-ppce500.c
+++ b/board/emulation/qemu-ppce500/qemu-ppce500.c
@@ -9,6 +9,7 @@
#include <cpu_func.h>
#include <dm.h>
#include <env.h>
+#include <event.h>
#include <init.h>
#include <log.h>
#include <net.h>
@@ -184,7 +185,7 @@ int misc_init_r(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
void *fdt = get_fdt_virt();
int len = 0;
@@ -204,6 +205,7 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
static uint64_t get_linear_ram_size(void)
{
diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c
index ccebba72721..0f620c2d917 100644
--- a/board/gdsys/a38x/controlcenterdc.c
+++ b/board/gdsys/a38x/controlcenterdc.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <event.h>
#include <init.h>
#include <miiphy.h>
#include <net.h>
@@ -35,19 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define DB_GP_88F68XX_GPP_POL_LOW 0x0
#define DB_GP_88F68XX_GPP_POL_MID 0x0
-static int get_tpm(struct udevice **devp)
-{
- int rc;
-
- rc = uclass_first_device_err(UCLASS_TPM, devp);
- if (rc) {
- printf("Could not find TPM (ret=%d)\n", rc);
- return CMD_RET_FAILURE;
- }
-
- return 0;
-}
-
/*
* Define the DDR layout / topology here in the board file. This will
* be used by the DDR3 init code in the SPL U-Boot version to configure
@@ -284,15 +272,22 @@ int board_fix_fdt(void *rw_fdt_blob)
return 0;
}
-int last_stage_init(void)
+#ifndef CONFIG_SPL_BUILD
+static int last_stage_init(void)
{
struct udevice *tpm;
int ret;
-#ifndef CONFIG_SPL_BUILD
+ if (IS_ENABLED(CONFIG_SPL_BUILD))
+ return 0;
ccdc_eth_init();
-#endif
- ret = get_tpm(&tpm);
+
+ ret = uclass_first_device_err(UCLASS_TPM, &tpm);
+ if (ret) {
+ printf("Could not find TPM (ret=%d)\n", ret);
+ return ret;
+ }
+
if (ret || tpm_init(tpm) || tpm1_startup(tpm, TPM_ST_CLEAR) ||
tpm1_continue_self_test(tpm)) {
return 1;
@@ -305,3 +300,5 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+#endif
diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c
index ba88401f13d..cc608c4ac43 100644
--- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c
@@ -9,6 +9,7 @@
#include <command.h>
#include <dm.h>
#include <env.h>
+#include <event.h>
#include <fdt_support.h>
#include <fsl_esdhc.h>
#include <init.h>
@@ -124,7 +125,7 @@ static void display_osd_info(struct udevice *osd,
osd_info->width, osd_info->height);
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
int fpga_hw_rev = 0;
int i;
@@ -179,6 +180,7 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
#if defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, struct bd_info *bd)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 4e9d841fe29..2d8951964a8 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -5,6 +5,7 @@
* Copyright 2012 Freescale Semiconductor, Inc.
*/
+#include <event.h>
#include <image.h>
#include <init.h>
#include <asm/arch/clock.h>
@@ -531,7 +532,7 @@ static void remove_ethaddr_env_var(int index)
env_set(env_var_name, NULL);
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
int i;
@@ -544,6 +545,7 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
int checkboard(void)
{
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 8f2d873bc68..acd13105dd5 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -15,6 +15,7 @@
#include <common.h>
#include <env.h>
+#include <event.h>
#include <fdt_support.h>
#include <init.h>
#include <ioports.h>
@@ -184,7 +185,7 @@ int misc_init_r(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
#if defined(CONFIG_TARGET_KMCOGE5NE)
/*
@@ -202,6 +203,7 @@ int last_stage_init(void)
set_km_env();
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
static int fixed_sdram(void)
{
diff --git a/board/keymile/kmcent2/kmcent2.c b/board/keymile/kmcent2/kmcent2.c
index 7e655175c57..572cc7bbdc6 100644
--- a/board/keymile/kmcent2/kmcent2.c
+++ b/board/keymile/kmcent2/kmcent2.c
@@ -261,7 +261,7 @@ int hush_init_var(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
const char *kmem;
/* DIP switch support on BFTIC */
@@ -287,6 +287,7 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
void fdt_fixup_fman_mac_addresses(void *blob)
{
diff --git a/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c b/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c
index d7f47959ebd..21c21aac221 100644
--- a/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c
+++ b/board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c
@@ -215,8 +215,4 @@ int hush_init_var(void)
return 0;
}
-int last_stage_init(void)
-{
- set_km_env();
- return 0;
-}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, set_km_env);
diff --git a/board/phytium/durian/durian.c b/board/phytium/durian/durian.c
index ee484749bcf..0a4048d4982 100644
--- a/board/phytium/durian/durian.c
+++ b/board/phytium/durian/durian.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
#include <cpu_func.h>
+#include <event.h>
#include <init.h>
#include <log.h>
#include <asm/armv8/mmu.h>
@@ -99,7 +100,7 @@ int __asm_flush_l3_dcache(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
int ret;
@@ -113,3 +114,4 @@ int last_stage_init(void)
}
return ret;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
diff --git a/board/phytium/pomelo/pomelo.c b/board/phytium/pomelo/pomelo.c
index 75d2636bf45..960e491c768 100644
--- a/board/phytium/pomelo/pomelo.c
+++ b/board/phytium/pomelo/pomelo.c
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <command.h>
+#include <event.h>
#include <init.h>
#include <asm/armv8/mmu.h>
#include <asm/io.h>
@@ -102,7 +103,7 @@ int __asm_flush_l3_dcache(void)
return 0;
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
int ret;
@@ -116,3 +117,4 @@ int last_stage_init(void)
}
return ret;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
diff --git a/common/Kconfig b/common/Kconfig
index 0b09bd68bd1..d916194b942 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -720,6 +720,7 @@ config SYS_FSL_CLK
config LAST_STAGE_INIT
bool "Call board-specific as last setup step"
+ select EVENT
help
Some boards need to perform initialisation immediately before control
is passed to the command-line interpreter (e.g. for initializations
diff --git a/common/board_r.c b/common/board_r.c
index 7c1fbc69ed6..ad9a3cf6336 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -773,15 +773,8 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_POST
initr_post,
#endif
-#ifdef CONFIG_LAST_STAGE_INIT
INIT_FUNC_WATCHDOG_RESET
- /*
- * Some parts can be only initialized if all others (like
- * Interrupts) are up and running (i.e. the PC-style ISA
- * keyboard).
- */
- last_stage_init,
-#endif
+ INITCALL_EVENT(EVT_LAST_STAGE_INIT),
#if defined(CFG_PRAM)
initr_mem,
#endif
diff --git a/common/event.c b/common/event.c
index 8a619088884..4845104b17d 100644
--- a/common/event.c
+++ b/common/event.c
@@ -36,6 +36,7 @@ const char *const type_name[] = {
/* init hooks */
"misc_init_f",
"fsp_init_r",
+ "last_stage_init",
/* Fpga load hook */
"fpga_load",
diff --git a/configs/bayleybay_defconfig b/configs/bayleybay_defconfig
index a44c9b714be..573f1b48645 100644
--- a/configs/bayleybay_defconfig
+++ b/configs/bayleybay_defconfig
@@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/cherryhill_defconfig b/configs/cherryhill_defconfig
index 00799715e8f..59c3986a2e7 100644
--- a/configs/cherryhill_defconfig
+++ b/configs/cherryhill_defconfig
@@ -18,7 +18,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig
index 152f297c350..5394396f8fc 100644
--- a/configs/chromebook_coral_defconfig
+++ b/configs/chromebook_coral_defconfig
@@ -40,7 +40,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_LOG=y
CONFIG_LOGF_FUNC=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_BLOBLIST=y
# CONFIG_TPL_BLOBLIST is not set
CONFIG_BLOBLIST_ADDR=0x100000
diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig
index 558609e13d6..eb8923ceeff 100644
--- a/configs/chromebook_link64_defconfig
+++ b/configs/chromebook_link64_defconfig
@@ -29,7 +29,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_SPL_NO_BSS_LIMIT=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
diff --git a/configs/chromebook_link_defconfig b/configs/chromebook_link_defconfig
index 96c26f1c377..4347cad33db 100644
--- a/configs/chromebook_link_defconfig
+++ b/configs/chromebook_link_defconfig
@@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
diff --git a/configs/chromebook_samus_defconfig b/configs/chromebook_samus_defconfig
index 4019c169a4c..3b6a1732c11 100644
--- a/configs/chromebook_samus_defconfig
+++ b/configs/chromebook_samus_defconfig
@@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig
index 4cfaf4bc5c7..33ada9fe4f9 100644
--- a/configs/chromebook_samus_tpl_defconfig
+++ b/configs/chromebook_samus_tpl_defconfig
@@ -30,7 +30,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_BLOBLIST=y
CONFIG_BLOBLIST_ADDR=0xff7c0000
diff --git a/configs/chromebox_panther_defconfig b/configs/chromebox_panther_defconfig
index f050d066be4..4351a811528 100644
--- a/configs/chromebox_panther_defconfig
+++ b/configs/chromebox_panther_defconfig
@@ -21,7 +21,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
diff --git a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
index 656d575998c..1515246086e 100644
--- a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
+++ b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
@@ -31,7 +31,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;l
CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/conga-qeval20-qa3-e3845_defconfig b/configs/conga-qeval20-qa3-e3845_defconfig
index 54dc59e8a13..d62fb997c99 100644
--- a/configs/conga-qeval20-qa3-e3845_defconfig
+++ b/configs/conga-qeval20-qa3-e3845_defconfig
@@ -27,7 +27,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;l
CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig
index 8aadaa68c27..2793e2c0b9d 100644
--- a/configs/coreboot64_defconfig
+++ b/configs/coreboot64_defconfig
@@ -19,7 +19,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_SPL_NO_BSS_LIMIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig
index 8e11de66381..f196ed776d0 100644
--- a/configs/coreboot_defconfig
+++ b/configs/coreboot_defconfig
@@ -20,7 +20,6 @@ CONFIG_LOG=y
CONFIG_LOGF_LINE=y
CONFIG_LOGF_FUNC=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_PCI_INIT_R=y
CONFIG_CMD_MMC=y
CONFIG_CMD_PART=y
diff --git a/configs/cougarcanyon2_defconfig b/configs/cougarcanyon2_defconfig
index da5ff5573d0..71c79f5fb8d 100644
--- a/configs/cougarcanyon2_defconfig
+++ b/configs/cougarcanyon2_defconfig
@@ -20,7 +20,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/crownbay_defconfig b/configs/crownbay_defconfig
index 70e1a50a244..e734c758dac 100644
--- a/configs/crownbay_defconfig
+++ b/configs/crownbay_defconfig
@@ -21,7 +21,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/dfi-bt700-q7x-151_defconfig b/configs/dfi-bt700-q7x-151_defconfig
index 9313e7fbd12..79f5d74ec59 100644
--- a/configs/dfi-bt700-q7x-151_defconfig
+++ b/configs/dfi-bt700-q7x-151_defconfig
@@ -26,7 +26,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:1 03000000 /boot/vmlinuz-${kernel-ver}-generic;l
CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/edison_defconfig b/configs/edison_defconfig
index 8692a8a9995..f134680e412 100644
--- a/configs/edison_defconfig
+++ b/configs/edison_defconfig
@@ -13,7 +13,6 @@ CONFIG_TARGET_EDISON=y
CONFIG_SMP=y
CONFIG_SYS_MONITOR_BASE=0x01101000
CONFIG_BOARD_EARLY_INIT_R=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_MAXARGS=128
CONFIG_SYS_CBSIZE=2048
diff --git a/configs/efi-x86_app32_defconfig b/configs/efi-x86_app32_defconfig
index 1bfc01f060d..dfc315774a5 100644
--- a/configs/efi-x86_app32_defconfig
+++ b/configs/efi-x86_app32_defconfig
@@ -16,7 +16,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_BOOTZ=y
diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig
index 46a1900c704..e0cfe3ee243 100644
--- a/configs/efi-x86_app64_defconfig
+++ b/configs/efi-x86_app64_defconfig
@@ -17,7 +17,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_BOOTZ=y
diff --git a/configs/efi-x86_payload32_defconfig b/configs/efi-x86_payload32_defconfig
index 4149eea6cf6..15323678e31 100644
--- a/configs/efi-x86_payload32_defconfig
+++ b/configs/efi-x86_payload32_defconfig
@@ -15,7 +15,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_IDE=y
diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig
index d41f73cccfc..80460d336fb 100644
--- a/configs/efi-x86_payload64_defconfig
+++ b/configs/efi-x86_payload64_defconfig
@@ -15,7 +15,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_IDE=y
diff --git a/configs/galileo_defconfig b/configs/galileo_defconfig
index c6d989ea6ef..c226ae11a81 100644
--- a/configs/galileo_defconfig
+++ b/configs/galileo_defconfig
@@ -17,7 +17,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig
index 8347a9dcecf..80e6a4c12b9 100644
--- a/configs/minnowmax_defconfig
+++ b/configs/minnowmax_defconfig
@@ -30,7 +30,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_MISC_INIT_R=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index c6f30674a8f..165f0b512c8 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -33,7 +33,6 @@ CONFIG_LOG=y
CONFIG_LOGF_FUNC=y
CONFIG_SPL_LOG=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_PCI_INIT_R=y
CONFIG_BLOBLIST=y
CONFIG_BLOBLIST_ADDR=0x10000
@@ -84,11 +83,11 @@ CONFIG_SPL_DM_RTC=y
CONFIG_SYS_NS16550_PORT_MAPPED=y
CONFIG_SPI=y
CONFIG_USB_KEYBOARD=y
-CONFIG_SPL_VIDEO=y
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
CONFIG_FRAMEBUFFER_VESA_MODE=0x144
CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_SPL_VIDEO=y
# CONFIG_SPL_USE_TINY_PRINTF is not set
CONFIG_GENERATE_ACPI_TABLE=y
# CONFIG_GZIP is not set
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 24682a5387d..4b2787d4aae 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -23,7 +23,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_LOG=y
CONFIG_LOGF_FUNC=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_PCI_INIT_R=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/som-db5800-som-6867_defconfig b/configs/som-db5800-som-6867_defconfig
index 4a149133db6..44db48204bd 100644
--- a/configs/som-db5800-som-6867_defconfig
+++ b/configs/som-db5800-som-6867_defconfig
@@ -27,7 +27,6 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig b/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig
index 69499e17f4c..c5bd0d96736 100644
--- a/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig
+++ b/configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig
@@ -26,7 +26,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/theadorable-x86-conga-qa3-e3845_defconfig b/configs/theadorable-x86-conga-qa3-e3845_defconfig
index e2e64b74349..b3afaf34a02 100644
--- a/configs/theadorable-x86-conga-qa3-e3845_defconfig
+++ b/configs/theadorable-x86-conga-qa3-e3845_defconfig
@@ -25,7 +25,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/configs/theadorable-x86-dfi-bt700_defconfig b/configs/theadorable-x86-dfi-bt700_defconfig
index 751ae3497ec..8222697f747 100644
--- a/configs/theadorable-x86-dfi-bt700_defconfig
+++ b/configs/theadorable-x86-dfi-bt700_defconfig
@@ -24,7 +24,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_CPU=y
diff --git a/include/event.h b/include/event.h
index 85269aa317a..747a9f6c654 100644
--- a/include/event.h
+++ b/include/event.h
@@ -41,6 +41,18 @@ enum event_t {
*/
EVT_FSP_INIT_F,
+ /*
+ * Emitted just before jumping to the main loop
+ *
+ * Some boards need to perform initialisation immediately before control
+ * is passed to the command-line interpreter (e.g. for init that depend
+ * on later phases in the init sequence).
+ *
+ * Some parts can be only initialized if all others (like Interrupts)
+ * are up and running (e.g. the PC-style ISA keyboard).
+ */
+ EVT_LAST_STAGE_INIT,
+
/* Fpga load hook */
EVT_FPGA_LOAD,
diff --git a/include/init.h b/include/init.h
index 13579db7590..4e7fe26c200 100644
--- a/include/init.h
+++ b/include/init.h
@@ -270,7 +270,6 @@ void board_init_r(struct global_data *id, ulong dest_addr)
__attribute__ ((noreturn));
int cpu_init_r(void);
-int last_stage_init(void);
int mac_read_from_eeprom(void);
int set_cpu_clk_info(void);
int update_flash_size(int flash_size);