summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2023-07-07gpio: Enable hogging support in SPLEddie James
Use the CONFIG macros to conditionally build the GPIO hogging support in either the SPL or U-Boot, or both, depending on the configuration. Also call the GPIO hog probe function in the common SPL board initialization as an equivalent to adding it to the U-Boot init sequence functions. Upstream-Status: Backport [1d99e673c752bc7d55aa25b02e050741496f7109] Signed-off-by: Eddie James <eajames@linux.ibm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-31common/memsize.c: Fix get_ram_size() when cache is enabledEmanuele Ghidoli
Ensure that every write is flushed to memory and afterward reads are from memory. Since the algorithm rely on the fact that accessing to not existent memory lead to write at addr / 2 without this modification accesses to aliased (not physically present) addresses are cached and wrong size is returned. This was discovered while working on a TI AM625 based board where cache is normally enabled, see commit c02712a74849 ("arm: mach-k3: Enable dcache in SPL"). Upstream-Status: Submitted [https://lore.kernel.org/all/20230530133327.178278-1-francesco@dolcini.it/] Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
2023-02-21common: avb_verify: Add CONFIG_AVB_PUBKEY_FILE to specify the root avb ↵Jiyong Park
public key The new config CONFIG_AVB_PUBKEY_FILE is used to specify the path to the public key file that u-boot uses as the root public key. Previously, the root public key was hard coded in avb_verify.c and therefore was non-trivial to replace it with a custom key. The public key that was hard-coded is extracted as default.avbpubkey and is used as the default. Bug: 181924266 Test: DIST_DIR=out/dist BUILD_CONFIG=u-boot/build.config.crosvm.aarch64 build/build.sh -j80 Change-Id: I7d0af97f158b87278a3c635df41e638c918cc96a (cherry picked from commit e609074ced3dd07ca2a13d4becbae997e3a48c9f) Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
2023-01-25spl: mtd: Remove MTD device after loading imagesApurva Nandan
Releasing the flash into proper state, after the loading completes, is important for the next stage bootloader/kernel to be able to use the MTD device. This would enable to reset the device for fresh use by next boot stage. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
2022-09-06spl: spl_spi: add spi_nor_remove() to soft reset flashVaishnav Achath
commit cd2f9031e492ca03d2baddce0f7506036e9f2124 upstream. On probe, the SPI NOR core will put a flash in 8D mode if it supports it. But Linux as of now expects to get the flash in 1S mode. Handing the flash to Linux in Octal DTR mode means the kernel will fail to detect the flash. This commit adds an option to soft reset the flash after spl_spi_load_image() so that the flash can be reset to 1S mode and subsequent spi-nor probe in Linux does not fail, since spl_spi_load_image() performs spi_flash_probe() the remove is added after completion loading images in spi_flash_probe() itself. Tested on J721E EVM with 5.10 Linux kernel. Linux spi-nor probe without the fix: root@j7-evm:~# dmesg | grep spi-nor [ 4.928023] spi-nor spi0.0: unrecognized JEDEC id bytes: ff ff ff ff ff ff [ 4.934938] spi-nor: probe of spi0.0 failed with error -2 Linux spi-nor probe with the fix: root@j7-evm:~# dmesg | grep spi-nor [ 4.904484] spi-nor spi0.0: mt35xu512aba (65536 Kbytes) Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com> Acked-by: Jagan Teki <jagan@amarulasolutions.com>
2022-08-30common: spl: mtd: Add support for loading images from MTDApurva Nandan
Introduce support for using MTD subsystem for loading images from memory flashes. This will provide the support of using mtd functions which are abstracted over the type of flash being used, to load the boot images from the flash. Currently, add support for only SPI NAND flashes. This can be extended to all other flash types, when required. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
2022-08-30mtd: nand: spi: Enable spinand build Kconfig option for splApurva Nandan
Only RAW NANDs are supported in the SPL, so create a new Kconfig config for building SPI NAND subsystem in the SPL build using SPL_NAND_SPI_SUPPORT Kconfig option. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
2022-08-11Revert "spl: Add support for enabling d-cache in board_init_r"Anand Gadiyar
This reverts commit fe0c9443216af5854477a17693cb74a3653a92df. Reverted due to a reported regression on non-K3 platforms. Reported-by: Andrew Davis <afd@ti.com> Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
2022-07-28spl: Add support for enabling d-cache in board_init_rMatt Ranostay
This patchset reimplements part of the dropped patchset bd236384ceef which enables d-cache during SPL execution. Having the d-cache disabled created a regression that added additional 250 milliseconds to A72 SPL boot time on the J721E platform. Signed-off-by: Matt Ranostay <mranostay@ti.com>
2022-06-13Revert "spl: Add support for enabling d-cache in board_init_r"Anand Gadiyar
This reverts commit ad3d63b199fd48ab2fb6ca8069a11b40faa378d5. Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
2022-06-12spl: Add support for enabling d-cache in board_init_rMatt Ranostay
This patchset reimplements part of the dropped patchset bd236384ceef which enables d-cache during SPL execution. Having the d-cache disabled created a regression that added additional 250 milliseconds to A72 SPL boot time on the J721E platform. Signed-off-by: Matt Ranostay <mranostay@ti.com>
2022-06-02common: spl: spl_spi: add support for dynamic override of sf busVaishnav Achath
Currently the SPI flash to load from is defined through the compile time config CONFIG_SF_DEFAULT_BUS and CONFIG_SF_DEFAULT_CS, this prevents the loading of binaries from different SPI flash using the same build.E.g. supporting QSPI flash boot and OSPI flash boot on J721E platform is not possible due to this limitation. This commit adds lookup functions spl_spi_boot_bus() and spl_spi_boot_cs for identifying the flash device based on the selected boot device, when not overridden the lookup functions are weakly defined in common/spl/spl_spi.c. Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2022-05-12common: android_ab: do not attempt to round-robin bootable slots.David Anderson
This feature does not quite fit within the A/B flow. The intent of A/B is to provide an automatic rollback option for broken OTAs. Once an OTA has been applied, the slot may not boot for a number of reasons (power loss, broken package, etc), and it is important to make consistent attempts to boot to the new slot rather than find *a* bootable slot (otherwise, the update may not take). Note that once a slot has been marked bootable, encryption keys are upgraded, and old slots will not work. Trying to rotate between slots is not likely to succeed. Note that Android ensures that the active slot always has the highest priority. In the current u-boot implementation, this affords no possibility of rollback. To match the expected A/B flow, this patch makes the following changes: - When initializing the BCB, set the "_a" slot to have the highest priority. - Pick the highest priority slot that has been marked successful OR has boot tries remaining. - If no such slot exists, the system is not bootable. Link: https://android-review.googlesource.com/c/platform/external/u-boot/+/1446442 Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
2022-05-12cmd: ab_select: Don't count boot-to-recovery as a boot attempt.David Anderson
The slot rollback system is intended for normal boot failures after an OTA, and therefore, we should not attempt to change slots based on a failure to boot to recovery (or any other non-normal boot sequence). Signed-off-by: Ram Muthiah <rammuthiah@google.com> Link: https://android-review.googlesource.com/c/platform/external/u-boot/+/1446441 Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
2022-01-04spl: fit: Skip attempting to load 0 length imageNishanth Menon
commit 6d99f866952bb5df7fe699b3db29a97d75e5c445 upstream. When, for various reasons, a bad FIT image is used where a loadable image is marked as 0 length, attempt is made for a 0 length allocation and read of 0 byte read operation. Instead provide warning in log and skip attempting to do such a load. Signed-off-by: Nishanth Menon <nm@ti.com> Reviewed-by: Aswath Govindraju <a-govindraju@ti.com> [praneeth@ti.com: forward port commit '6d99f866952b' from upstream u-boot/next] Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2021-07-21bootm: Store OS start and end info in images structureAndrew F. Davis
Store the start and end of the OS image that is loaded in images structure. This is similar to what we do in booti. Signed-off-by: Andrew F. Davis <afd@ti.com>
2021-06-29common: make: Support show_board_info() as part of SPL buildAmarnath MB
Enable support for show_board_info() in SPL build. Signed-off-by: Amarnath MB <amarnath.mb@ti.com> Signed-off-by: Sinthu Raja <sinthu.raja@ti.com> Reviewed-by: Lokesh Vutla <lokesjhvutla@ti.com>
2021-03-23common: fit: Update board_fit_image_post_process() to pass fit and node_offsetLokesh Vutla
board_fit_image_post_process() passes only start and size of the image, but type of the image is not passed. So pass fit and node_offset, to derive information about image to be processed. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2021-01-05image: support board_fit_config_name_matchSebastian Reichel
Support reusing board_fit_config_name_match() to automatically select a sensible default configuration for booting fitImages using 'bootm'. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-01-05image: cleanup pre-processor usageSebastian Reichel
Replace most #ifdef checks for USE_HOSTCC and CONFIG_* with normal if instructions. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-12-02common: update: fix an "unused" warning against update_flash()AKASHI Takahiro
Since update_flash() is used only in update_tftp(), it should be guarded with appropriate config options. After the commit 3149e524fc1e, common/update.c will be built under either CONFIG_UDATE_TFTP, CONFIG_DFU_TFTP or CONFIG_UPDATE_FIT. Since CONFIG_UPDATE_FIT, hence fit_update(), doesn't rely on update_flash(), the compiler may cause an "unused" warning if CONFIG_UPDATE_FIT=y and CONFIG_UPDATE_TFTP=n and CONFIG_DFU_TFTP=n. This is, for example, the case for sandbox defconfig where EFI_CAPSULE_FIRMWARE_FIT is enabled for test purpose. Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT image") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-11-19common: fit: add missing newlineMichael Walle
The debug statement doesn't end with a newline. Add it. Signed-off-by: Michael Walle <michael@walle.cc>
2020-11-06board: Rename uclass to sysinfoSimon Glass
This uclass is intended to provide a way to obtain information about a U-Boot board. But the concept of a U-Boot 'board' is the whole system, not just one circuit board, meaning that 'board' is something of a misnomer for this uclass. In addition, the name 'board' is a bit overused in U-Boot and we want to use the same uclass to provide SMBIOS information. The obvious name is 'system' but that is so vague as to be meaningless. Use 'sysinfo' instead, since this uclass is aimed at providing information on the system. Rename everything accordingly. Note: Due to the patch delta caused by the symbol renames, this patch shows some renamed files as being deleted in one place and created in another. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-11-06x86: zimage: Add a little more loggingSimon Glass
Add logging for each part of the boot process, using a new Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
2020-11-06x86: Use CONFIG_CHROMEOS_VBOOT for verified bootSimon Glass
At present CONFIG_CHROMEOS is used to determine whether verified boot is in use. The code to implement that is not in U-Boot mainline. However, it is useful to be able to boot a Chromebook in developer mode in U-Boot mainline without needing the verified boot code. To allow this, use CONFIG_CHROMEOS_VBOOT to indicate that verified boot should be used, and CONFIG_CHROMEOS to indicate that the board supports Chrome OS. That allows us to define CONFIG_CHROMEOS on coral. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-11-01Merge tag 'efi-2020-01-rc2-2' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2021-01-rc2 (2) The series contains the following enhancements * preparatory patches for UEFI capsule updates * initialization of the emulated RTC using an environment variable and a bug fix * If DisconnectController() is called for a child controller that is the only child of the driver, the driver must be disconnected.
2020-10-30Merge tag 'dm-pull-30oct20' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-dm of-platdata and dtoc improvements sandbox SPL tests binman support for compressed sections
2020-10-30log: Add filter flag to match greater than a log levelSean Anderson
This is the complement of the existing behavior to match only messages with a log level less than a threshold. This is primarily useful in conjunction with LOGFF_DENY. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30log: Add filter flag to deny on matchSean Anderson
Without this flag, log filters can only explicitly accept messages. Allowing denial makes it easier to filter certain subsystems. Unlike allow-ing filters, deny-ing filters are added to the beginning of the filter list. This should do the Right Thing most of the time, but it's less-universal than allowing filters to be inserted anywhere. If this becomes a problem, then perhaps log_filter_add* should take a filter number to insert before/after. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30log: Add function to create a filter with flagsSean Anderson
This function exposes a way to specify flags when creating a filter. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30log: Expose some helper functionsSean Anderson
These functions are required by "cmd: log: Add commands to manipulate filters" and "test: Add a test for log filter-*". Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30log: Add additional const qualifier to arraysSean Anderson
Both these arrays and their members are const. Fixes checkpatch complaint. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30log: Fix missing negation of ENOMEMSean Anderson
Errors returned should be negative. Fixes: 45fac9fc18 ("log: Correct missing free() on error in log_add_filter()") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-10-30efi_loader: add option to initialise EFI subsystem earlyAKASHI Takahiro
If this option, CONFIG_EFI_SETUP_EARLY, is enabled, the initialisation of UEFI subsystem will be done as part of U-Boot initialisation. Please note that this option won't be enabled explicitly by users, instead, should be enabled implicitly by other configuration options. Specifically, this feature will be utilised in implementing capsule-on-disk feature. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-10-30common: update: add a generic interface for FIT imageAKASHI Takahiro
The main purpose of this patch is to separate a generic interface for updating firmware using DFU drivers from "auto-update" via tftp. This function will also be used in implementing UEFI capsule update in a later commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2020-10-30dfu: modify an argument type for an addressAKASHI Takahiro
The range of an addressable pointer can go beyond 'integer'. So change the argument type to a void pointer. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2020-10-30dfu: rename dfu_tftp_write() to dfu_write_by_name()AKASHI Takahiro
This function is essentially independent from tftp, and will also be utilised in implementing UEFI capsule update in a later commit. So just give it a more generic name. In addition, a new configuration option, CONFIG_DFU_WRITE_ALT, was introduced so that the file will be compiled with different options, particularly one added in a later commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2020-10-29dm: Avoid using #ifdef for CONFIG_OF_LIVESimon Glass
At present this option results in a number of #ifdefs due to the presence or absence of the global_data of_root member. Add a few macros to global_data.h to work around this. Update the code accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29Merge tag 'xilinx-for-v2021.01-v2' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze Xilinx changes for v2021.01-v2 common: - Add support for 64bit loadables from SPL xilinx: - Update documentation and record ownership - Enable eeprom board detection based legacy and fru formats - Add support for FRU format microblaze: - Optimize low level ASM code - Enable SPI/I2C - Enable distro boot zynq: - Add support for Zturn V5 zynqmp: - Improve silicon detection code - Enable several kconfig options - Align DT with the latest state - Enabling security commands - Enable and support FPGA loading from SPL - Optimize xilinx_pm_request() calling versal: - Some DTs/Kconfig/defconfig alignments - Add binding header for clock and power zynq-sdhci: - Add support for tap delay programming zynq-spi/zynq-qspi: - Use clock framework for getting clocks xilinx-spi: - Fix some code issues (unused variables) serial: - Check return value from clock functions in pl01x
2020-10-28dm: board: complete the initialization of the muxes in initr_dm()Jean-Jacques Hiblot
This will probe the multiplexer devices that have a "u-boot,mux-autoprobe" property. As a consequence they will be put in their idle state. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
2020-10-27log: correct and check array size of log categoriesHeinrich Schuchardt
The log command has led to NULL dereferences if an unknown category name name was used due to missing entries in the list of category names. Add compile time checks for the array sizes of log_cat_name and log_lvl_name to avoid future mishaps. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27log: allow for message continuationHeinrich Schuchardt
Some drivers use macro pr_cont() for continuing a message sent via printk. Hence if we want to convert printk messaging to using the logging system, we must support continuation of log messages too. As pr_cont() does not provide a message level we need a means of remembering the last log level. With the patch a pseudo log level LOGL_CONT as well as a pseudo log category LOGC_CONT are introduced. Using these results in the application of the same log level and category as in the previous log message. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27log: move processing_msg to global dataHeinrich Schuchardt
Replace the static variable processing_msg by a field in the global data. Make the field bool at it can only be true or false. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27spl: fdt: Record load/entry fit-images entries in 64bit formatMichal Simek
The commit 9f45aeb93727 ("spl: fit: implement fdt_record_loadable") which introduced fdt_record_loadable() state there spl_fit.c is not 64bit safe. Based on my tests on Xilinx ZynqMP zcu102 platform there shouldn't be a problem to record these addresses in 64bit format. The patch adds support for systems which need to load images above 4GB. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27spl: Use standard FIT entriesMichal Simek
SPL is creating fit-images DT node when loadables are recorded in selected configuration. Entries which are created are using entry-point and load-addr property names. But there shouldn't be a need to use non standard properties because entry/load are standard FIT properties. But using standard FIT properties enables option to use generic FIT functions to descrease SPL size. Here is result for ZynqMP virt configuration: xilinx_zynqmp_virt: spl/u-boot-spl:all -82 spl/u-boot-spl:rodata -22 spl/u-boot-spl:text -60 The patch causes change in run time fit image record. Before: fit-images { uboot { os = "u-boot"; type = "firmware"; size = <0xfd520>; entry-point = <0x8000000>; load-addr = <0x8000000>; }; }; After: fit-images { uboot { os = "u-boot"; type = "firmware"; size = <0xfd520>; entry = <0x8000000>; load = <0x8000000>; }; }; Replacing calling fdt_getprop_u32() by fit_image_get_entry/load() also enables support for reading entry/load properties recorded in 64bit format. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-26eb_cpu5282: fix CONFIG_DM_VIDEO build warningsAnatolij Gustschin
Remove CONFIG_VIDEO dependency to fix board removal warnings. Signed-off-by: Anatolij Gustschin <agust@denx.de> Cc: Jens Scharsig <esw@bus-elektronik.de>
2020-10-23bootm: fix wrong conditions about images overlapJaehoon Chung
It doesn't need to consider start byte address. If ramdisk size is 0x800000 and start address is 0x2700000, then it's used until 0x02efffff, not 0x02f00000. But it's detected to overlapt RD image, when kernel start address is 0x02f00000. Because it's doing wrong calculation about rd_len. This patch fixed wrong calculation address position when check condition. In addition, it needs to check one more condition about overlapping entire area. Fixes: commit fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image") Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2020-10-22Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxiTom Rini
- sun8i emac changes (Andre) - SCP firmware (Samuel)
2020-10-22Remove default value of CONFIG_PREBOOT for CONFIG_USB_STORAGEPatrick Delaunay
Remove the default value "usb start" for CONFIG_USB_STORAGE as the USB storage boot initialization is correctly managed by distro boot command ('usb_boot' defined in include/config_distro_bootcmd.h already include the command 'usb start'). Fixes: 324d77998ed6 ("Define default CONFIG_PREBOOT with right config option") Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-22common: rename getc() to getchar()Heinrich Schuchardt
The sandbox is built with the SDL2 library with invokes the X11 library which in turn calls getc(). But getc() in glibc is defined as int getc(FILE *) This does not match our definition. int getc(void) The sandbox crashes when called with parameter -l. Rename our library symbol getc() to getchar(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>