diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 7 | ||||
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/board_r.c | 9 | ||||
-rw-r--r-- | common/cli_readline.c | 4 | ||||
-rw-r--r-- | common/log_syslog.c | 1 | ||||
-rw-r--r-- | common/menu.c | 44 | ||||
-rw-r--r-- | common/spl/Kconfig | 9 | ||||
-rw-r--r-- | common/spl/spl.c | 16 | ||||
-rw-r--r-- | common/spl/spl_fat.c | 1 | ||||
-rw-r--r-- | common/usb.c | 1 |
10 files changed, 71 insertions, 23 deletions
diff --git a/common/Kconfig b/common/Kconfig index be517b80eb5..17539079f90 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -727,6 +727,13 @@ config BOARD_EARLY_INIT_R relocation. With this option, U-Boot calls board_early_init_r() in the post-relocation init sequence. +config BOARD_INIT + bool "Call board-specific init board_init() during init-calls" + default y if ARM || RISCV || SANDBOX + help + Some boards need an board_init() function called during the initcall + phase of startup. + config BOARD_POSTCLK_INIT bool "Call board_postclk_init" help diff --git a/common/Makefile b/common/Makefile index e589f307262..d62ea34599e 100644 --- a/common/Makefile +++ b/common/Makefile @@ -20,9 +20,11 @@ obj-y += version.o obj-y += board_f.o obj-y += board_r.o ifdef CONFIG_$(PHASE_)SYS_THUMB_BUILD +ifneq ($(CONFIG_SYS_ARM_ARCH),7) CFLAGS_REMOVE_board_f.o := $(LTO_CFLAGS) CFLAGS_REMOVE_board_r.o := $(LTO_CFLAGS) endif +endif obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o diff --git a/common/board_r.c b/common/board_r.c index 41c8dec8d49..143d51d0633 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -36,7 +36,6 @@ #include <env.h> #include <env_internal.h> #include <fdtdec.h> -#include <ide.h> #include <init.h> #include <initcall.h> #include <kgdb.h> @@ -145,7 +144,7 @@ static int initr_reloc_global_data(void) */ fixup_cpu(); #endif -#ifdef CONFIG_SYS_RELOC_GD_ENV_ADDR +#ifdef CONFIG_ENV_RELOC_GD_ENV_ADDR /* * Relocate the early env_addr pointer unless we know it is not inside * the binary. Some systems need this and for the rest, it doesn't hurt. @@ -443,9 +442,6 @@ static int should_load_env(void) if (IS_ENABLED(CONFIG_OF_CONTROL)) return ofnode_conf_read_int("load-environment", 1); - if (IS_ENABLED(CONFIG_DELAY_ENVIRONMENT)) - return 0; - return 1; } @@ -649,8 +645,7 @@ static void initcall_run_r(void) #if CONFIG_IS_ENABLED(ADDR_MAP) INITCALL(init_addr_map); #endif -#if CONFIG_IS_ENABLED(ARM) || CONFIG_IS_ENABLED(RISCV) || \ - CONFIG_IS_ENABLED(SANDBOX) +#if CONFIG_IS_ENABLED(BOARD_INIT) INITCALL(board_init); /* Setup chipselects */ #endif /* diff --git a/common/cli_readline.c b/common/cli_readline.c index 4e6797a1944..0cb43e62000 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -332,8 +332,8 @@ int cread_line_process_ch(struct cli_line_state *cls, char ichar) if (cls->num) { uint base, wlen; - for (base = cls->num - 1; - base >= 0 && buf[base] == ' ';) + for (base = cls->num; + base > 0 && buf[base - 1] == ' ';) base--; for (; base > 0 && buf[base - 1] != ' ';) base--; diff --git a/common/log_syslog.c b/common/log_syslog.c index 0dcb5f7cdea..73bd3aca07e 100644 --- a/common/log_syslog.c +++ b/common/log_syslog.c @@ -5,6 +5,7 @@ * Copyright (c) 2020, Heinrich Schuchardt <xypron.glpk@gmx.de> */ +#include <env.h> #include <log.h> #include <net.h> #include <asm/global_data.h> diff --git a/common/menu.c b/common/menu.c index 5a2126aa01a..ae5afa14766 100644 --- a/common/menu.c +++ b/common/menu.c @@ -8,6 +8,7 @@ #include <cli.h> #include <malloc.h> #include <errno.h> +#include <linux/ctype.h> #include <linux/delay.h> #include <linux/list.h> #include <watchdog.h> @@ -436,6 +437,29 @@ int menu_destroy(struct menu *m) return 1; } +static int bootmenu_conv_shortcut_key(struct bootmenu_data *menu, int ichar) +{ + int shortcut_key; + + ichar = tolower(ichar); + switch (ichar) { + /* a-z for bootmenu entry > 9 */ + case 'a' ... 'z': + shortcut_key = ichar - 'a' + 9; + break; + /* 1-9 for bootmenu entry <= 9 */ + case '1' ... '9': + shortcut_key = ichar - '1'; + break; + /* Reserve 0 for last option (aka Exit) */ + case '0': + default: + return -1; + } + + return shortcut_key; +} + enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, struct cli_ch_state *cch) { @@ -443,12 +467,12 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, int i, c; while (menu->delay > 0) { + int ichar; + if (ansi) printf(ANSI_CURSOR_POSITION, menu->count + 5, 3); printf("Hit any key to stop autoboot: %d ", menu->delay); for (i = 0; i < 100; ++i) { - int ichar; - if (!tstc()) { schedule(); mdelay(10); @@ -470,6 +494,11 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, case 0x3: /* ^C */ key = BKEY_QUIT; break; + case 'A' ... 'Z': + case 'a' ... 'z': + case '0' ... '9': + key = BKEY_SHORTCUT; + break; default: key = BKEY_NONE; break; @@ -477,6 +506,9 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, break; } + if (key == BKEY_SHORTCUT) + cch->shortcut_key = bootmenu_conv_shortcut_key(menu, ichar); + if (menu->delay < 0) break; @@ -524,6 +556,11 @@ enum bootmenu_key bootmenu_conv_key(int ichar) case ' ': key = BKEY_SPACE; break; + case 'A' ... 'Z': + case 'a' ... 'z': + case '0' ... '9': + key = BKEY_SHORTCUT; + break; default: key = BKEY_NONE; break; @@ -554,5 +591,8 @@ enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, key = bootmenu_conv_key(c); + if (key == BKEY_SHORTCUT) + cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c); + return key; } diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 77cf04d38ed..4e26b3940d8 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -80,7 +80,7 @@ config SPL_MAX_SIZE default 0x1b000 if AM33XX && !TI_SECURE_DEVICE default 0xec00 if OMAP34XX default 0x10000 if ARCH_MX6 && !MX6_OCRAM_256KB - default 0xbfa0 if MACH_SUN50I_H616 + default 0xbfa0 if MACH_SUN50I_H616 || MACH_SUN50I_A133 default 0x7000 if RCAR_GEN3 default 0x5fa0 if SUNXI_SRAM_ADDRESS = 0x0 default 0x7fa0 if ARCH_SUNXI @@ -423,7 +423,7 @@ config SPL_STACK default 0x91ffb8 if ARCH_MX6 && !MX6_OCRAM_256KB default 0x118000 if MACH_SUN50I_H6 default 0x52a00 if MACH_SUN50I_H616 - default 0x40000 if MACH_SUN8I_R528 + default 0x40000 if MACH_SUN8I_R528 || MACH_SUN50I_A133 default 0x54000 if MACH_SUN50I || MACH_SUN50I_H5 default 0x18000 if MACH_SUN9I default 0x8000 if ARCH_SUNXI @@ -488,7 +488,7 @@ config SPL_CUSTOM_SYS_MALLOC_ADDR config SPL_SYS_MALLOC_SIZE hex "Size of the SPL malloc pool" depends on SPL_SYS_MALLOC - default 0x180000 if BIOSEMU && RISCV + default 0x800000 if RISCV default 0x100000 config SPL_READ_ONLY @@ -1138,6 +1138,7 @@ config SPL_DM_SPI_FLASH config SPL_NET bool "Support networking" depends on !NET_LWIP + select SPL_USE_TINY_PRINTF_POINTER_SUPPORT if SPL_USE_TINY_PRINTF help Enable support for network devices (such as Ethernet) in SPL. This permits SPL to load U-Boot over a network link rather than @@ -1597,7 +1598,7 @@ config SPL_OPENSBI_SCRATCH_OPTIONS config SPL_TARGET string "Addtional build targets for 'make'" default "spl/u-boot-spl.srec" if RCAR_GEN2 - default "spl/u-boot-spl.scif" if RCAR_GEN3 + default "spl/u-boot-spl.scif" if RCAR_64 default "" help On some platforms we need to have 'make' run additional build target diff --git a/common/spl/spl.c b/common/spl/spl.c index 76fd56dfe4b..d8e26605d20 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -392,7 +392,7 @@ int spl_load(struct spl_image_info *spl_image, } #endif -__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) +__weak void __noreturn jump_to_image(struct spl_image_info *spl_image) { typedef void __noreturn (*image_entry_noargs_t)(void); @@ -689,7 +689,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) BOOT_DEVICE_NONE, BOOT_DEVICE_NONE, }; - spl_jump_to_image_t jump_to_image = &jump_to_image_no_args; + spl_jump_to_image_t jumper = &jump_to_image; struct spl_image_info spl_image; int ret, os; @@ -783,20 +783,20 @@ void board_init_r(gd_t *dummy1, ulong dummy2) } else if (CONFIG_IS_ENABLED(ATF) && os == IH_OS_ARM_TRUSTED_FIRMWARE) { debug("Jumping to U-Boot via ARM Trusted Firmware\n"); spl_fixup_fdt(spl_image_fdt_addr(&spl_image)); - jump_to_image = &spl_invoke_atf; + jumper = &spl_invoke_atf; } else if (CONFIG_IS_ENABLED(OPTEE_IMAGE) && os == IH_OS_TEE) { debug("Jumping to U-Boot via OP-TEE\n"); spl_board_prepare_for_optee(spl_image_fdt_addr(&spl_image)); - jump_to_image = &jump_to_image_optee; + jumper = &jump_to_image_optee; } else if (CONFIG_IS_ENABLED(OPENSBI) && os == IH_OS_OPENSBI) { debug("Jumping to U-Boot via RISC-V OpenSBI\n"); - jump_to_image = &spl_invoke_opensbi; + jumper = &spl_invoke_opensbi; } else if (CONFIG_IS_ENABLED(OS_BOOT) && os == IH_OS_LINUX) { debug("Jumping to Linux\n"); if (IS_ENABLED(CONFIG_SPL_OS_BOOT)) spl_fixup_fdt((void *)SPL_PAYLOAD_ARGS_ADDR); spl_board_prepare_for_linux(); - jump_to_image = &jump_to_image_linux; + jumper = &jump_to_image_linux; } else { debug("Unsupported OS image.. Jumping nevertheless..\n"); } @@ -848,7 +848,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) if (CONFIG_IS_ENABLED(RELOC_LOADER)) { int ret; - ret = spl_reloc_jump(&spl_image, jump_to_image); + ret = spl_reloc_jump(&spl_image, jumper); if (ret) { if (xpl_phase() == PHASE_VPL) printf("jump failed %d\n", ret); @@ -856,7 +856,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) } } - jump_to_image(&spl_image); + jumper(&spl_image); } /* diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index f426a068ff9..8b7cafa7291 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -16,6 +16,7 @@ #include <errno.h> #include <image.h> #include <linux/libfdt.h> +#include <asm/cache.h> static int fat_registered; diff --git a/common/usb.c b/common/usb.c index 7a8435296c6..6a4ad346f4b 100644 --- a/common/usb.c +++ b/common/usb.c @@ -28,6 +28,7 @@ #include <command.h> #include <dm.h> #include <dm/device_compat.h> +#include <env.h> #include <log.h> #include <malloc.h> #include <memalign.h> |