summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2019-12-10spl: opensbi: specify main hart as preferred boot hartLukas Auer
OpenSBI uses a relocation lottery to determine the hart to relocate OpenSBI to its link address. In the U-Boot SPL boot flow, the main hart schedules the secondary harts to enter OpenSBI before doing so itself. One of the secondary harts will therefore always be the winner of the relocation lottery. This is problematic if the link address ranges of OpenSBI and U-Boot SPL overlap. OpenSBI will be relocated and therefore overwrite U-Boot SPL while some harts may still run it, leading to code corruption. Avoid this problem by specifying the main hart as the preferred boot hart to perform the OpenSBI relocation. The main hart will be the last hart to enter OpenSBI, relocation can therefore occur safely. The boot hart field was added to version 2 of the OpenSBI FW_DYNAMIC info structure. The header file include/opensbi.h is synchronized with include/sbi/fw_dynamic.h from the OpenSBI project to update the info structure. The header file is recent as of commit 7a13beb21326 ("firmware: Add preferred boot HART field in struct fw_dynamic_info"). Reported-by: Rick Chen <rick@andestech.com> Suggested-by: Anup Patel <Anup.Patel@wdc.com> Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Rick Chen <rick@andestech.com> Tested-by: Rick Chen <rick@andestech.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
2019-12-10spl: cache: Allow cache drivers in SPLRick Chen
When ax25-ae350 try to enable v5l2 cache driver in SPL configuration, it need this option for cache support in SPL. Signed-off-by: Rick Chen <rick@andestech.com> Cc: KC Lin <kclin@andestech.com> Cc: Alan Kao <alankao@andestech.com>
2019-12-09Merge tag 'u-boot-imx-20191209' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx Fixes for 2020.01 ----------------- - imx8qxp_mek: increase buffer sizes and args number - Fixes for imx7ulp - imx8mm: Fix the first root clock in imx8mm_ahb_sels[] - colibri_imx7: reserve DDR memory for Cortex-M4 - vining2000: fixes and convert to ethernet DM - imx8m: fix rom version check to unbreak some B0 chips - tbs2910: Disable VxWorks image booting support
2019-12-06Revert "spl: fix entry_point equal to load_addr"Tom Rini
Due to the (seemingly bogus) assumption of a default CONFIG_SYS_UBOOT_START value we will revert this change for now and evaluate it again for the next release along with changes to CONFIG_SYS_UBOOT_START. This reverts commit d3e97b53c1f2464f4898226de7d89abf242e4aa8. Signed-off-by: Tom Rini <trini@konsulko.com>
2019-12-06common: fdt_support: add support for setting usable memoryIgor Opaniuk
Add support for setting linux,usable-memory property in the memory node of device tree for the kernel [1]. This property holds a base address and size, describing a limited region in which memory may be considered available for use by the kernel. Memory outside of this range is not available for use. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-12-05spl: fix entry_point equal to load_addrGiulio Benetti
At the moment entry_point is set to image_get_load(header) that sets it to "load address" instead of "entry point", assuming entry_point is equal to load_addr, but it's not true. Then load_addr is set to "entry_point - header_size", but this is wrong too since load_addr is not an entry point. So use image_get_ep() for entry_point assignment and image_get_load() for load_addr assignment. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2019-12-05spl: Introduce SPL_DM_GPIO Kconfig defineLukasz Majewski
This define indicates if DM_GPIO shall be supported in SPL. This allows proper operation of DM converted GPIO drivers in SPL, which use boards. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-12-03mtd: rename CONFIG_NAND -> CONFIG_MTD_RAW_NANDMiquel Raynal
Add more clarity by changing the Kconfig entry name. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> [trini: Re-run migration, update a few more cases] Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
2019-12-03spl: ymodem: Fix loading of fit imageLokesh Vutla
spl ymodem driver always assumes that 1 BUF_SIZE is read in one stream. This might not be true when image is not padded to BUF_SIZE and the last sector that gets loaded will be < BUF_SIZE. Drop this assumption and use the actual size that is loaded. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2019-12-03bootm: vxworks: Support Linux compatible standard DTB for ARM and PPCLihua Zhao
Enhance do_bootm_vxworks() to support Linux compatible standard DTB for ARM and PPC, when the least significant bit of flags in VxWorks bootargs is set. Otherwise it falls back to the existing bootm flow which is now legacy. Signed-off-by: Lihua Zhao <lihua.zhao@windriver.com> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-03cosmetic: Fix spelling and whitespace errorsThomas Hebb
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2019-12-02common: Move board_get_usable_ram_top() out of common.hSimon Glass
Move this function into init.h which seems to be designed for this sort of thing. Also update the header to declare struct global_data so that it can be included without global_data.h being needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move command functions out of common.hSimon Glass
Move these functions into the command.h header file which is a better fit. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move enable/disable_interrupts out of common.hSimon Glass
Move these two functions into the irq_funcs.h header file. Also move interrupt_handler_t as this is used by the irq_install_handler() function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move interrupt functions into a new headerSimon Glass
These functions do not use driver model but are fairly widely used in U-Boot. But it is not clear that they will use driver model anytime soon, so we don't want to label them as 'legacy'. Move them to a new irq_func.h header file. Avoid the name 'irq.h' since it is widely used in U-Boot already. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move ARM cache operations out of common.hSimon Glass
These functions are CPU-related and do not use driver model. Move them to cpu_func.h Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move some cache and MMU functions out of common.hSimon Glass
These functions belong in cpu_func.h. Another option would be cache.h but that code uses driver model and we have not moved these cache functions to use driver model. Since they are CPU-related it seems reasonable to put them here. Move them over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move checkcpu() out of common.hSimon Glass
This function belongs in cpu_func.h so move it over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move get_ticks() function out of common.hSimon Glass
This function belongs in time.h so move it over and add a comment. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Add a new lz4.h header fileSimon Glass
Add a header file to house the lz4 compression function. Add a comment while we are here, since it not even clear from the name what the function actuall does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move serial functions out of common.hSimon Glass
These functions belong in serial.h so move them over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move sorting functions to their own header fileSimon Glass
These don't need to be in common.h so move them out into a new header. Also add some missing comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02spl: bootcount: Move code out of header fileSimon Glass
It is not good practice to write code in a header file. If it is included multiple times then the code can cause duplicate functions. Move the bootcount_store() and bootcount_load() functions into SPL. Note: bootcount is a bit strange in that it uses driver model but does not define proper drivers. This should be fixed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02crc32: Use the crc.h header for crc functionsSimon Glass
Drop inclusion of crc.h in common.h and use the correct header directly instead. With this we can drop the conflicting definition in fw_env.h and rely on the crc.h header, which is already included. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Drop global inclusion of status_led.hSimon Glass
This is only used by a few files so it should not be in the common header. Move it out. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02Drop CONFIG_SHOW_ACTIVITYSimon Glass
This feature is not enabled by any board. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-25usb: kbd: move USB_KBD_BOOT_REPORT_SIZE to usb.hHeinrich Schuchardt
Move constant USB_KBD_BOOT_REPORT_SIZE. This allows us to reuse it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-25usb: kbd: implement special keysHeinrich Schuchardt
Provide support for F1-F12, Insert, Delete, Home, End, Page Up, Page Down. As this leads to a size increase provide a customizing setting CONFIG_USB_KEYBOARD_FN_KEYS. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-11-25usb: kbd: simplify coding for arrow keysHeinrich Schuchardt
Avoid duplicate translation of arrow key codes. Reduce code size by avoiding strings and eliminating usb_kbd_put_sequence(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-11-25usb: kbd: signature of usb_kbd_put_queue()Heinrich Schuchardt
usb_kbd_buffer is defined as u8[]. So let usb_kbd_put_queue() use u8 as type of the parameter for the new byte. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-11-25usb: kbd: fix typoHeinrich Schuchardt
%s/a interrupt/an interrupt/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-20env: Add CONFIG_SYS_RELOC_GD_ENV_ADDR symbolTom Rini
Today in initr_reloc_global_data() we use some non-obvious tests to determine if we need to relocate the env_addr within gd or not. In order to facilitate migration of other symbols to Kconfig we need to introduce a new symbol for this particular use case. Cc: Wolfgang Denk <wd@denx.de> Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2019-11-17Merge tag 'u-boot-rockchip-20191118' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip - Add support for rockchip SoC: PX30, RK3308 - Add and migrate to use common dram driver: PX30, RK3328, RK3399 - Add rk3399 board Tinker-s support - Board config update for Rock960, Rockpro64
2019-11-17spl: separate SPL_FRAMEWORK config for spl and tplHeiko Stuebner
Right now enabling SPL_FRAMEWORK will also enable it for the TPL in all cases, making the TPL bigger. There may be cases where the TPL is really size constrained due to its underlying ram size. Therefore introduce a new TPL_FRAMEWORK option and make the relevant conditionals check for both. The default is set to "y if SPL_FRAMEWORK" to mimic the previous behaviour where the TPL would always get the SPL framework if it was enabled in SPL. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-11-14image: fdt: copy possible optee nodes to a loaded devicetreeHeiko Stuebner
The loading convention for optee or any other tee on arm64 is as bl32 parameter to the trusted-firmware. So TF-A gets invoked with the TEE as bl32 and main u-boot as bl33. Once it has done its startup TF-A jumps into the bl32 for the TEE startup, returns to TF-A and then jumps to bl33. All of them get passed a devicetree as parameter and all components often get loaded from a FIT image. OP-TEE will create additional nodes in that devicetree namely a firmware node and possibly multiple reserved-memory nodes. While this devicetree is used in main u-boot, in most cases it won't be the one passed to the actual kernel. Instead most boot commands will load a new devicetree from somewhere like mass storage of the network, so if that happens u-boot should transfer the optee nodes to that new devicetree. To make that happen introduce optee_copy_fdt_nodes() called from the dt setup function in image-fdt which after checking for the optee presence in the u-boot dt will make sure a optee node is present in the kernel dt and transfer any reserved-memory regions it can find. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2019-11-11Merge tag 'u-boot-rockchip-20191110' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip - Add support for rockchip pmic rk805,rk809, rk816, rk817 - Add rk3399 board Leez support - Fix bug in rk3328 ram driver - Adapt SPL to support ATF bl31 with entry at 0x40000 - Fix the u8 type comparision with '-1'. - Fix checkpatch warning for multi blank line and review signature.
2019-11-10common: spl: atf: support booting bl32 imageJoseph Chen
Trusted-Firmware can also initialize a secure payload to use as a trusted execution environment. In general for the arm64 case this is provided as separate image and uboot is supposed to also place it in a predetermined location in memory and add the necessary parameters to the ATF boot params. So add the possibility to get this tee payload from the provided FIT image and setup things as necessary. Tested on a Rockchip PX30 with mainline TF-A, mainline OP-Tee (with pending PX30 support) and mainline 5.4-rc1 Linux kernel. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-11-07hush: re-sequence includesHeinrich Schuchardt
'make tests' on a 32bit ARM system leads to In file included from ../common/cli_hush.c:79: ../include/malloc.h:364:7: error: conflicting types for ‘memset’ void* memset(void*, int, size_t); ^~~~~~ In file included from ../include/compiler.h:126, from ../include/env.h:12, from ../common/cli_hush.c:78: ../include/linux/string.h:103:15: note: previous declaration of ‘memset’ was here extern void * memset(void *,int,__kernel_size_t); ^~~~~~ In file included from ../common/cli_hush.c:79: ../include/malloc.h:365:7: error: conflicting types for ‘memcpy’ void* memcpy(void*, const void*, size_t); ^~~~~~ In file included from ../include/compiler.h:126, from ../include/env.h:12, from ../common/cli_hush.c:78: ../include/linux/string.h:106:15: note: previous declaration of ‘memcpy’ was here extern void * memcpy(void *,const void *,__kernel_size_t); ^~~~~~ According to the U-Boot coding style guide common.h should be the first include. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-11-07dlmalloc: calloc: fix zeroing early allocationsSimon Goldschmidt
When full malloc is enabled and SYS_MALLOC_F is also enabled, the simple pre-reloc heap is used before relocation. In this case, calloc() uses the MALLOC_ZERO macro to zero out the allocated memory. However, since this macro is specially crafted for the dlmalloc implementation, it does not always work for simple malloc. For example, when allocating 16 bytes via simple malloc, only the first 12 bytes get zeroed out. The last 4 bytes will remain untouched. This is a problem for DM drivers that are allocated before relocation: memory allocated via 'platdata_auto_alloc_size' might not be set to zero, resulting in bogus behaviour. To fix this, use 'memset' instead of 'MALLOC_ZERO' to zero out memory that compes from simple malloc. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-07spl: fix SPI config dependenciesSimon Goldschmidt
As SPL_SPI_FLASH_SUPPORT cannot work without SPL_SPI_SUPPORT, fix dependencies to prevent enabling SPI flash support without basic SPI support. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-11-06common/console.c: Fix unused warning with console_doenv()Tom Rini
Newer versions of LLVM-7 will provide an unused function warning over console_doenv() in the case of SYS_CONSOLE_IS_IN_ENV not being enabled as can be the case in SPL. Add guards around this function. Signed-off-by: Tom Rini <trini@konsulko.com>
2019-11-06Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini
- DFU updates - USB Storage updates
2019-11-04Merge tag 'u-boot-imx-20191104' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20191104 ------------------- - i.MX NAND: nandbcb support for MX6UL / i.MX7 - i.MX8: support for HAB - Convert to DM (opos6ul, mccmon6) - Toradex i.MX6ull colibri - sync DTS with kernel Travis : https://travis-ci.org/sbabic/u-boot-imx/builds/606853416
2019-11-03spl: nor: Provide falcon boot support for NOR memoriesLukasz Majewski
This commit adds falcon boot support (by also copying args necessary for booting) to the SPL NOR memory driver. After this change it is possible to use the falcon boot in the same way as on NAND memories. The necessary configs (i.e. CONFIG_CMD_SPL_NOR_OFS) are now defined in Kconfig. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-03spl: Add a size check for TPLSimon Glass
We have the ability to enforce a maximum size for SPL but not yet for TPL. Add a new option for this. Document the size check macro while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-01Merge tag 'video-for-2020.01-rc1' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-video - fix splash build breakage with newer llvm-7
2019-11-01Merge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dmTom Rini
- Fix for patman with email addresses containing commas - Bootstage improvements for TPL, SPL - Various sandbox and dm improvements and fixes
2019-10-31common: Kconfig: Fix typo in TPL_LOG_CONSOLE descriptionSimon South
Signed-off-by: Simon South <simon@simonsouth.net>
2019-10-31usb: storage: Only clear READY flag on errorMarek Vasut
Clear the USB_READY flag in the storage driver only in case there is an error, otherwise usb_stor_BBB_transport() waits 5 mS before doing anything every single time. This is because the USB_READY flag is only ever set in usb_test_unit_ready(), which is called only upon storage device probe, not between each and every request. However, the device cannot move out of USB_READY state once it was initialized. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Simon Glass <sjg@chromium.org>
2019-10-31usb: storage: Limit transfer size to 120 kiBMarek Vasut
Due to constant influx of more and more weird and broken USB sticks, do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85 usb: storage: scsiglue: further describe our 240 sector limit Just so we have some sort of documentation as to why we limit our Mass Storage transfers to 240 sectors, let's update the comment to make clearer that devices were found that would choke with larger transfers. While at that, also make sure to clarify that other operating systems have similar, albeit different, limits on mass storage transfers. And reduce the maximum transfer length of USB storage to 120 kiB. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Simon Glass <sjg@chromium.org>