mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 07:04:28 +00:00
event: Convert misc_init_f() to use events
This hook can be implmented using events, for the three boards that actually use it. Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we can just use CONFIG_EVENT to control this. Since sandbox always enables CONFIG_EVENT, we can drop the defconfig lines there too. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5b896ed585
commit
42fdcebf85
21 changed files with 32 additions and 22 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <command.h>
|
||||
#include <efi_loader.h>
|
||||
#include <errno.h>
|
||||
#include <event.h>
|
||||
#include <init.h>
|
||||
#include <log.h>
|
||||
#include <os.h>
|
||||
|
@ -119,10 +120,11 @@ int sandbox_early_getopt_check(void)
|
|||
os_exit(0);
|
||||
}
|
||||
|
||||
int misc_init_f(void)
|
||||
static int sandbox_misc_init_f(void *ctx, struct event *event)
|
||||
{
|
||||
return sandbox_early_getopt_check();
|
||||
}
|
||||
EVENT_SPY(EVT_MISC_INIT_F, sandbox_misc_init_f);
|
||||
|
||||
static int sandbox_cmdline_cb_help(struct sandbox_state *state, const char *arg)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <command.h>
|
||||
#include <cros_ec.h>
|
||||
#include <dm.h>
|
||||
#include <event.h>
|
||||
#include <init.h>
|
||||
#include <log.h>
|
||||
#include <sysinfo.h>
|
||||
|
@ -32,11 +33,12 @@ struct cros_gpio_info {
|
|||
int flags;
|
||||
};
|
||||
|
||||
int misc_init_f(void)
|
||||
static int coral_check_ll_boot(void *ctx, struct event *event)
|
||||
{
|
||||
if (!ll_boot_init()) {
|
||||
printf("Running as secondary loader");
|
||||
if (gd->arch.coreboot_table) {
|
||||
if (CONFIG_IS_ENABLED(COREBOOT_SYSINFO) &&
|
||||
gd->arch.coreboot_table) {
|
||||
int ret;
|
||||
|
||||
printf(" (found coreboot table at %lx)",
|
||||
|
@ -55,6 +57,7 @@ int misc_init_f(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
EVENT_SPY(EVT_MISC_INIT_F, coral_check_ll_boot);
|
||||
|
||||
int arch_misc_init(void)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright 2013 Freescale Semiconductor, Inc.
|
||||
*/
|
||||
|
||||
#include <event.h>
|
||||
#include <asm/cache.h>
|
||||
#include <asm/fsl_fdt.h>
|
||||
#include <asm/fsl_law.h>
|
||||
|
@ -181,7 +182,7 @@ unsigned long get_serial_clock(unsigned long dummy)
|
|||
return (gd->bus_clk / 2);
|
||||
}
|
||||
|
||||
int misc_init_f(void)
|
||||
static int kmcent2_misc_init_f(void *ctx, struct event *event)
|
||||
{
|
||||
/* configure QRIO pis for i2c deblocking */
|
||||
i2c_deblock_gpio_cfg();
|
||||
|
@ -209,6 +210,7 @@ int misc_init_f(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
EVENT_SPY(EVT_MISC_INIT_F, kmcent2_misc_init_f);
|
||||
|
||||
#define USED_SRDS_BANK 0
|
||||
#define EXPECTED_SRDS_RFCK SRDS_PLLCR0_RFCK_SEL_100
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <event.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/immap_ls102xa.h>
|
||||
|
@ -109,12 +110,14 @@ int board_early_init_f(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int misc_init_f(void)
|
||||
static int pg_wcom_misc_init_f(void *ctx, struct event *event)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED))
|
||||
check_for_uboot_update();
|
||||
|
||||
return 0;
|
||||
}
|
||||
EVENT_SPY(EVT_MISC_INIT_F, pg_wcom_misc_init_f);
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
|
|
|
@ -589,12 +589,6 @@ config LAST_STAGE_INIT
|
|||
U-Boot calls last_stage_init() before the command-line interpreter is
|
||||
started.
|
||||
|
||||
config MISC_INIT_F
|
||||
bool "Execute pre-relocation misc init"
|
||||
help
|
||||
Enabling this option calls the 'misc_init_f' function in the init
|
||||
sequence just before DRAM is inited.
|
||||
|
||||
config MISC_INIT_R
|
||||
bool "Execute Misc Init"
|
||||
default y if ARCH_KEYSTONE || ARCH_SUNXI || MPC85xx
|
||||
|
|
|
@ -818,6 +818,11 @@ __weak int clear_bss(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int misc_init_f(void)
|
||||
{
|
||||
return event_notify_null(EVT_MISC_INIT_F);
|
||||
}
|
||||
|
||||
static const init_fnc_t init_sequence_f[] = {
|
||||
setup_mon_len,
|
||||
#ifdef CONFIG_OF_CONTROL
|
||||
|
@ -877,9 +882,7 @@ static const init_fnc_t init_sequence_f[] = {
|
|||
show_board_info,
|
||||
#endif
|
||||
INIT_FUNC_WATCHDOG_INIT
|
||||
#if defined(CONFIG_MISC_INIT_F)
|
||||
misc_init_f,
|
||||
#endif
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
|
||||
init_func_i2c,
|
||||
|
|
|
@ -30,6 +30,9 @@ const char *const type_name[] = {
|
|||
"dm_post_probe",
|
||||
"dm_pre_remove",
|
||||
"dm_post_remove",
|
||||
|
||||
/* init hooks */
|
||||
"misc_init_f",
|
||||
};
|
||||
|
||||
_Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
|
||||
|
|
|
@ -35,6 +35,7 @@ CONFIG_USE_BOOTCOMMAND=y
|
|||
CONFIG_BOOTCOMMAND="tpm init; tpm startup TPM2_SU_CLEAR; read mmc 0:2 100000 0 80; setexpr loader *001004f0; setexpr size *00100518; setexpr blocks $size / 200; read mmc 0:2 100000 80 $blocks; setexpr setup $loader - 1000; setexpr cmdline_ptr $loader - 2000; setexpr.s cmdline *$cmdline_ptr; setexpr cmdline gsub %U \\\\${uuid}; if part uuid mmc 0:2 uuid; then zboot start 100000 0 0 0 $setup cmdline; zboot load; zboot setup; zboot dump; zboot go;fi"
|
||||
CONFIG_SYS_CONSOLE_INFO_QUIET=y
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_EVENT=y
|
||||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_BLOBLIST=y
|
||||
# CONFIG_TPL_BLOBLIST is not set
|
||||
|
|
|
@ -16,10 +16,10 @@ CONFIG_FIT=y
|
|||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_OF_BOARD_SETUP=y
|
||||
CONFIG_OF_STDOUT_VIA_ALIAS=y
|
||||
CONFIG_EVENT=y
|
||||
CONFIG_BOARD_EARLY_INIT_F=y
|
||||
CONFIG_BOARD_EARLY_INIT_R=y
|
||||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_MISC_INIT_F=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_CMD_DM=y
|
||||
CONFIG_CMD_I2C=y
|
||||
|
|
|
@ -35,6 +35,7 @@ CONFIG_AUTOBOOT_STOP_STR=" "
|
|||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0"
|
||||
CONFIG_SILENT_CONSOLE=y
|
||||
CONFIG_EVENT=y
|
||||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_MISC_INIT_R=y
|
||||
CONFIG_CMD_IMLS=y
|
||||
|
|
|
@ -33,6 +33,7 @@ CONFIG_AUTOBOOT_STOP_STR=" "
|
|||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0"
|
||||
CONFIG_SILENT_CONSOLE=y
|
||||
CONFIG_EVENT=y
|
||||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_MISC_INIT_R=y
|
||||
CONFIG_CMD_IMLS=y
|
||||
|
|
|
@ -35,6 +35,7 @@ CONFIG_AUTOBOOT_STOP_STR=" "
|
|||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0"
|
||||
CONFIG_SILENT_CONSOLE=y
|
||||
CONFIG_EVENT=y
|
||||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_MISC_INIT_R=y
|
||||
CONFIG_CMD_IMLS=y
|
||||
|
|
|
@ -33,6 +33,7 @@ CONFIG_AUTOBOOT_STOP_STR=" "
|
|||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0"
|
||||
CONFIG_SILENT_CONSOLE=y
|
||||
CONFIG_EVENT=y
|
||||
CONFIG_LAST_STAGE_INIT=y
|
||||
CONFIG_MISC_INIT_R=y
|
||||
CONFIG_CMD_IMLS=y
|
||||
|
|
|
@ -23,7 +23,6 @@ CONFIG_CONSOLE_RECORD=y
|
|||
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
|
||||
CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_MISC_INIT_F=y
|
||||
CONFIG_CMD_CPU=y
|
||||
CONFIG_CMD_LICENSE=y
|
||||
CONFIG_CMD_BOOTZ=y
|
||||
|
|
|
@ -32,7 +32,6 @@ CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
|
|||
CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_MISC_INIT_F=y
|
||||
CONFIG_STACKPROTECTOR=y
|
||||
CONFIG_ANDROID_AB=y
|
||||
CONFIG_CMD_CPU=y
|
||||
|
|
|
@ -20,7 +20,6 @@ CONFIG_BOOTSTAGE_STASH_SIZE=0x4096
|
|||
CONFIG_CONSOLE_RECORD=y
|
||||
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_MISC_INIT_F=y
|
||||
CONFIG_CMD_CPU=y
|
||||
CONFIG_CMD_LICENSE=y
|
||||
CONFIG_CMD_BOOTZ=y
|
||||
|
|
|
@ -30,7 +30,6 @@ CONFIG_BOOTSTAGE_STASH_SIZE=0x4096
|
|||
CONFIG_CONSOLE_RECORD=y
|
||||
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_MISC_INIT_F=y
|
||||
CONFIG_HANDOFF=y
|
||||
CONFIG_SPL_BOARD_INIT=y
|
||||
CONFIG_SPL_ENV_SUPPORT=y
|
||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_TIMESTAMP=y
|
|||
CONFIG_FIT_SIGNATURE=y
|
||||
CONFIG_USE_BOOTCOMMAND=y
|
||||
CONFIG_BOOTCOMMAND="run distro_bootcmd"
|
||||
CONFIG_MISC_INIT_F=y
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
# CONFIG_CMD_BOOTM is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
|
|
|
@ -272,6 +272,4 @@
|
|||
#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */
|
||||
#define CONFIG_SYS_BOOTMAPSZ (256 << 20) /* Increase map for Linux */
|
||||
|
||||
#define CONFIG_MISC_INIT_F
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,9 @@ enum event_t {
|
|||
EVT_DM_PRE_REMOVE,
|
||||
EVT_DM_POST_REMOVE,
|
||||
|
||||
/* Init hooks */
|
||||
EVT_MISC_INIT_F,
|
||||
|
||||
EVT_COUNT
|
||||
};
|
||||
|
||||
|
|
|
@ -217,7 +217,6 @@ int init_cache_f_r(void);
|
|||
int print_cpuinfo(void);
|
||||
#endif
|
||||
int timer_init(void);
|
||||
int misc_init_f(void);
|
||||
|
||||
#if defined(CONFIG_DTB_RESELECT)
|
||||
int embedded_dtb_select(void);
|
||||
|
|
Loading…
Reference in a new issue