summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2023-01-18configs: Increase malloc size after relocationNeha Malcom Francis
Current default size of 0x100000 is not capable of getting the FIT buffer during boot when transitioning to using binman generated boot images for certain K3 devices, so increase it to 0x400000. Since A72 SPL is coming after relocation to DDR this should not be an issue for any K3 device, so make it default for all. Signed-off-by: Neha Malcom Francis <n-francis@ti.com> Acked-by: Andrew Davis <afd@ti.com>
2023-01-18event: Correct dependencies on the EVENT frameworkTom Rini
The event framework is just that, a framework. Enabling it by itself does nothing, so we shouldn't ask the user about it. Reword (and correct typos) around this the option and help text. This also applies to DM_EVENT and EVENT_DYNAMIC. Only EVENT_DEBUG and CMD_EVENT should be visible to the user to select, when EVENT is selected. With this, it's time to address the larger problems. When functionality uses events, typically via EVENT_SPY, the appropriate framework then must be select'd and NOT imply'd. As the functionality will cease to work (and so, platforms will fail to boot) this is non-optional and where select is appropriate. Audit the current users of EVENT_SPY to have a more fine-grained approach to select'ing the framework where used. Also ensure the current users of event_register and also select EVENT_DYNAMIC. Cc: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reported-by: Oliver Graute <Oliver.Graute@kococonnector.com> Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com> Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") Fixes: 42fdcebf859f ("event: Convert misc_init_f() to use events") Fixes: c5ef2025579e ("dm: fix DM_EVENT dependencies") Signed-off-by: Tom Rini <trini@konsulko.com> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-01-17Merge branch '2022-01-16-bootstd-updates'Tom Rini
To quote the author: So far standard boot lacks a boot menu, although it is possible to create a rudimentary one using the existing 'bootmenu' command. Even then, this text-based menu offer only basic functionality and does not take full advantage of the displays which are common on many devices. This series provides a 'bootflow menu' command which allows the user to select from the available bootflows. An attempt is made to show the name of the available operating systems, by reading more information into the bootflow. A logo can be read also, where supported, so that this can be presented to the user when an option is highlighted. Full use is made of TrueType fonts, if enabled. For cases where only a serial console is available, it falls back to a simple text-based menu. All of this is implementing using a new 'expo' construct, a collection of scenes (like menu screens) which can be navigated by the user to view information and select options. This is fairly general and should be able to cope with a wider array of use cases, with less hacking of the menu code, such as is currently needed for CMD_BOOTEFI_BOOTMGR. Of course it would be possible to enhance the existing menu rather than creating a new setup. Instead it seems better to make the existing menu use expo, if code space permits. It avoids the event-loop problem and should be more extensible, given its loosely coupled components and use of IDs instead of pointers. Further motivation is provided in the documentation. For now the CLI keypress-decoding code is split out to be used by the new menu. The key codes defined by menu.h are reused also. This is of course just a starting point. Some ideas for future work are included in the documentation.
2023-01-16menu: Factor out menu-keypress decodingSimon Glass
Move this code into a separate function so that it can be used in the new VBE menu. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16image: Move common image code to image_board and commandSimon Glass
We should use the cmd/ directory for commands rather than for common code used elsewhere in U-Boot. Move the common 'source' code into image-board.c to achieve this. The image_source_script() function needs to call run_command_list() so seems to belong better in the command library. Move and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Make use of CLI character processingSimon Glass
Avoid duplicating some of the escape-sequence processing here and use the CLI function instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Use a switch statementSimon Glass
Convert the long line of if() statements to a switch() since this makes better use of the C language. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Update bootmenu_loop() to return the codeSimon Glass
Use the return value to save having to pass around a pointer. This also resolves any ambiguity about what *key contains when the function is called. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Update bootmenu_autoboot_loop() to return the codeSimon Glass
Use the return value to save having to pass around a pointer. This also resolves any ambiguity about what *key contains when the function is called. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Rename KEY_... to BKEY_...Simon Glass
This enum values conflict with linux/input.h so rename them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16cli: Move readline character-processing to a state machineSimon Glass
The current cread_line() function is very long. It handles the escape processing inline. The menu command does similar processing but at the character level, so there is some duplication. Split the character processing into a new function cli_ch_process() which processes individual characters and returns the resulting input character, taking account of escape sequences. It requires the caller to set up and maintain its state. Update cread_line() to use this new function. The only intended functional change is that an invalid escape sequence does not add invalid/control characters into the input buffer, but instead discards these. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16arm: rockchip: Add RV1126 arch core supportJagan Teki
Rockchip RV1126 is a high-performance vision processor SoC for IPC/CVR, especially for AI related application. Add arch core support for it. Signed-off-by: Jagan Teki <jagan@edgeble.ai> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Change-Id: I22fde40ec375e3c6aba39808abf252edc45d4b04
2023-01-14usb: hub: allow to increase HUB_DEBOUNCE_TIMEOUTPatrick Delaunay
Add a new CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to increase the HUB_DEBOUNCE_TIMEOUT value, for example to 2s because some usb device needs around 1.5s or more to make the hub port status to be connected steadily after being powered off and powered on. This 2s value is aligned with Linux driver and avoids to configure "usb_pgood_delay" as a workaround for connection timeout on some USB device; normally the env variable "usb_pgood_delay" is used to delay the first query after power ON and thus the device answer, but this variable not used to increase the connection timeout delay. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-13Merge tag 'u-boot-stm32-20230113' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-stm Add driver to manage onboard hub supplies Add calibration support for stm32-adc Linux kernel v6.1 DT synchronization for stm32mp151.dtsi stm32mp157a-dk1-scmi-u-boot.dtsi update Add support of OP-TEE and STM32MP13x in bsec driver ECDSA various fixes for stm32mp
2023-01-12gpio: Get rid of gpio_hog_probe_all()Marek Vasut
The gpio_hog_probe_all() functionality can be perfectly well replaced by DM_FLAG_PROBE_AFTER_BIND DM flag, which would trigger .probe() callback of each GPIO hog driver instance after .bind() and thus configure the hogged GPIO accordingly. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Samuel Holland <samuel@sholland.org>
2023-01-12common: spl: ram: fix return codeNikita Shubin
Instead of always retuning success, return actual result of load_simple_fit_image or spl_parse_image_header, otherwise we might end up jumping on uninitialized spl_image->entry_point. Signed-off-by: Nikita Shubin <n.shubin@yadro.com> Reviewed-by: Stefan Roese <sr@denx.de>
2023-01-12console: Add option to keep it silent until env is loadedHarald Seiler
Add a config-option which forces the console to stay silent until the proper environment is loaded from flash. This is important when the default environment does not silence the console but no output must be printed when 'silent' is set in the flash environment. After the environment from flash is loaded, the console will be silenced/unsilenced depending on it. If PRE_CONSOLE_BUFFER is also used, the buffer will now be flushed if the console should not be silenced. Signed-off-by: Harald Seiler <hws@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-12usb: onboard-hub: add driver to manage onboard hub suppliesFabrice Gasnier
The main issue the driver addresses is that a USB hub needs to be powered before it can be discovered. This is often solved by using "regulator-always-on". This driver is inspired by the Linux v6.1 driver. It only enables (or disables) the hub vdd (3v3) supply, so it can be enumerated. Scanning of the device tree is done in a similar manner to the sandbox, by the usb-uclass. DT part looks like: &usbh_ehci { ... #address-cells = <1>; #size-cells = <0>; hub@1 { compatible = "usb424,2514"; reg = <1>; vdd-supply = <&v3v3>; }; }; When the bus gets probed, the driver is automatically probed/removed from the bus tree, as an example on stm32: STM32MP> usb start starting USB... STM32MP> dm tree Class Index Probed Driver Name ----------------------------------------------------------- usb 0 [ + ] ehci_generic | |-- usb@5800d000 usb_hub 0 [ + ] usb_onboard_hub | | `-- hub@1 usb_hub 1 [ + ] usb_hub | | `-- usb_hub STM32MP> usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Hub (480 Mb/s, 2mA) Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-01-11cmd: exit: Fix return value propagation out of environment scriptsMarek Vasut
Make sure the 'exit' command as well as 'exit $val' command exits from environment scripts immediately and propagates return value out of those scripts fully. That means the following behavior is expected: " => setenv foo 'echo bar ; exit 1' ; run foo ; echo $? bar 1 => setenv foo 'echo bar ; exit 0' ; run foo ; echo $? bar 0 => setenv foo 'echo bar ; exit -2' ; run foo ; echo $? bar 0 " As well as the followin behavior: " => setenv foo 'echo bar ; exit 3 ; echo fail'; run foo; echo $? bar 3 => setenv foo 'echo bar ; exit 1 ; echo fail'; run foo; echo $? bar 1 => setenv foo 'echo bar ; exit 0 ; echo fail'; run foo; echo $? bar 0 => setenv foo 'echo bar ; exit -1 ; echo fail'; run foo; echo $? bar 0 => setenv foo 'echo bar ; exit -2 ; echo fail'; run foo; echo $? bar 0 => setenv foo 'echo bar ; exit ; echo fail'; run foo; echo $? bar 0 " Fixes: 8c4e3b79bd0 ("cmd: exit: Fix return value") Reviewed-by: Hector Palacios <hector.palacios@digi.com> Signed-off-by: Marek Vasut <marex@denx.de>
2023-01-11common:autoboot:modify function parametersShenlin Liang
the blob parameter of the function process_fdt_options has not been invoked in the function body and should be changed to void type Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-09Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-07common/memsize.c: Check for overflow in get_effective_memsize() only for mpc85xxPali Rohár
This reverts commit 777aaaa706bc ("common/memsize.c: Fix get_effective_memsize() to check for overflow") for non-mpc85xx platforms. The changes to this generic function, which is intended to help with 32bit platforms with large amounts of memory has unintended side effects (which in turn lead to boot failures) on other platforms which were previously functional. For now do overflow check only for powerpc mpc85xx platform. It is needed to prevent crashing of P1/P2 boards with 4GB DDR module in 32-bit mode. Fixes: 777aaaa706bc ("common/memsize.c: Fix get_effective_memsize() to check for overflow") Signed-off-by: Pali Rohár <pali@kernel.org>
2022-12-23common/spl/spl_ram: Remove unused defaultTom Rini
We ask for CONFIG_SPL_LOAD_FIT_ADDRESS in Kconfig, so we cannot define it in C as a fall-back. However, this option previously was buried under "if ... endif" Kconfig logic. Rework a number of config options to now have more robust dependency lines so that we can ask this address when needed. With that done, we can remove the fallback in spl_ram.c. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23global: Migrate CONFIG_PRAM to CFGTom Rini
Perform a simple rename of CONFIG_PRAM to CFG_PRAM Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23global: Migrate CONFIG_MAX_MEM_MAPPED to CFGTom Rini
Perform a simple rename of CONFIG_MAX_MEM_MAPPED to CFG_MAX_MEM_MAPPED Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23global: Migrate CONFIG_MALLOC_F_ADDR to CFGTom Rini
Perform a simple rename of CONFIG_MALLOC_F_ADDR to CFG_MALLOC_F_ADDR Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23global: Remove undef CONFIG_... for unused valuesTom Rini
We have a number of places that undef CONFIG_... while we never reference CONFIG_... in the first place. Remove these lines. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-22spl: Kconfig: Fix SPL_OPTEE_IMAGE dependencyJagan Teki
fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL. common/spl/spl.c: In function ‘jump_to_image_optee’: common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’ 220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr, Fix the dependency support. Signed-off-by: Jagan Teki <jagan@edgeble.ai>
2022-12-21usb: Update USB_STORAGE dependenciesTom Rini
As it's no longer possible to have !DM_USB set, we can remove these dependencies. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-21Merge tag 'v2023.01-rc4' into nextTom Rini
Prepare v2023.01-rc4 Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-10spl: spl_legacy: fix invalid offset in SPL_COPY_PAYLOAD_ONLYDai Okamura
This fixes the header offset calculation. This issue was found on uniphier v7 SoCs with SPL. Fixes: 06377c5a1f ("spl: spl_legacy: Fix NAND boot on OMAP3 BeagleBoard") Signed-off-by: Dai Okamura <okamura.dai@socionext.com> Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com> Acked-by: Michael Trimarchi <michael@amarulasolutions.com> Link: https://lore.kernel.org/all/20221209114021.3074978-1-okamura.dai@socionext.com Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2022-12-08common/spl/Kconfig: add dependency on SPL_SEMIHOSTING for SPL payloadKautuk Consul
When we enable CONFIG_SPL and CONFIG_SPL_SEMIHOSTING then the code in common/spl/spl_semihosting.c tries to use the CONFIG_SPL_FS_LOAD_PAYLOAD_NAME string which remains undeclared unless SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS are configured. Add a dependency of SPL_SEMIHOSTING in the depends for SPL_FS_LOAD_PAYLOAD_NAME so that the code compiles fine. Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2022-12-05sandbox: Move CONFIG_IO_TRACE to KconfigTom Rini
This is only used on sandbox, so select it there. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05Convert CONFIG_HWCONFIG to KconfigTom Rini
This converts the following to Kconfig: CONFIG_HWCONFIG Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-05global: Move remaining CONFIG_SYS_* to CFG_SYS_*Tom Rini
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*Tom Rini
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05spl: Migrate SYS_SATA_FAT_BOOT_PARTITION to KconfigTom Rini
This moves SYS_SATA_FAT_BOOT_PARTITION to Kconfig and enforces the current default via Kconfig rather than C code. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05global: Move remaining CONFIG_SYS_PCI* to CFG_SYS_PCI*Tom Rini
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_PCI and CONFIG_SYS_PCIE namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05global: Move remaining CONFIG_SYS_NAND_* to CFG_SYS_NAND_*Tom Rini
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_NAND namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-02console: file should always be non-negativeHeinrich Schuchardt
We use the parameter file in console functions to choose from an array after checking against MAX_FILES but we never check if the value of file is negative. Running ./u-boot -T -l and issuing the poweroff command has resulted in crashes because os_exit() results in std::ostream::flush() calling U-Boot's fflush with file being a pointer which when converted to int may be represented by a negative number. This shows that checking against MAX_FILES is not enough. We have to ensure that the file argument is always positive. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-21spl: Fix SPL_ATF and SPL_OPENSBI dependenciesSamuel Holland
The code for these two options depends on having the FIT loadables recorded in the FDT. Thus, these options require the full version of the SPL_LOAD_FIT code. Signed-off-by: Samuel Holland <samuel@sholland.org>
2022-11-21Revert "cli_readline: Only insert printable chars"Pali Rohár
This reverts commit d2e64d29c44dee6d455f7705dd1cf1af8674ad9a. This commit broke support for pound sign (£) and euro sign (€) keys on Nokia N900 keypad. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-10SYS_NONCACHED_MEMORY: Correct comment in common/board_f.cTom Rini
The comment block in reserve_noncached has a typo in one filename and an incorrect filename in another function reference. Correct both of these. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-10Convert CONFIG_SYS_MONITOR_LEN to KconfigTom Rini
This converts the following to Kconfig: CONFIG_SYS_MONITOR_LEN To do this, we set a default of 0 for everyone because there are a number of cases where we define CONFIG_SYS_MONITOR_LEN but the only impact is that we set TOTAL_MALLOC_LEN to be CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE, so we must continue to allow all boards to set this value. Update the SPL code to use 200 KB as the default raw U-Boot size directly, if we don't have a real CONFIG_SYS_MONITOR_LEN value. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-06Merge tag 'efi-2023-01-rc1-4' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2023-01-rc1-4 Documentation: * Provide a document about security issue handling. UEFI: * Let networking support depend on NETDEVICES. * Discover if no efi_system_partition is set. Other: * MAINTAINERS: add arch/arm/lib/*_efi.* to EFI_PAYLOAD.
2022-11-06efi_loader: remove CONFIG_EFI_SETUP_EARLYAKASHI Takahiro
Since the commit a9bf024b2933 ("efi_loader: disk: a helper function to create efi_disk objects from udevice"), CONFIG_EFI_SETUP_EARLY option is by default on and will never be turned off. So just remove this option. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-11-04Merge https://source.denx.de/u-boot/custodians/u-boot-usbTom Rini
- 3 important fixes
2022-11-04usb: storage: continue probe on "Invalid device"Janne Grunau
Fixes a crash during probing of sd card readers without medium present. Seen with the device below but reported for many other devices. idVendor 0x0bda Realtek Semiconductor Corp. idProduct 0x0326 Card reader bcdDevice 11.24 iManufacturer 1 Realtek iProduct 2 USB3.0 Card Reader iSerial 3 201404081410 Link: https://github.com/AsahiLinux/linux/issues/44 Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
2022-11-03usb: Add 1ms delay after first Get Descriptor requestMarek Vasut
Logitech Unifying Receiver 046d:c52b bcdDevice 12.10 seems sensitive about the first Get Descriptor request. If there are any other requests in the same microframe, the device reports bogus data, first of the descriptor parts is not sent to the host. Wait over one microframe duration before issuing subsequent requests to avoid probe failure with this device, since it can be used to connect USB keyboards. Signed-off-by: Marek Vasut <marex@denx.de> Tested-by: Janne Grunau <j@jannau.net>
2022-11-02mips: mtmips: spl/Kconfig: Set CONFIG_SPL_PAD_TO to 0x0 for ARCH_MTMIPSStefan Roese
It was noticed that while converting CONFIG_SPL_PAD_TO to Kconfig its value for the MIPS MT762x/8x targets got not ported correctly. Its default is not 0x10000 instead of 0x0. This patch fixes this issue. Fixes: ca8a329a1b7f ("Convert CONFIG_SPL_PAD_TO et al to Kconfig") Signed-off-by: Stefan Roese <sr@denx.de> Cc: Ruben Winters <Ruben.Winters@gooiland-elektro.nl> Cc: Weijie Gao <weijie.gao@mediatek.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Cc: Tom Rini <trini@konsulko.com>