aboutsummaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2019-08-30board_f: fix noncached reservation calculationStephen Warren2-3/+16
The current code in reserve_noncached() has two issues: 1) The first update of gd->start_addr_sp always rounds down to a section start. However, the equivalent calculation in cache.c:noncached_init() always first rounds up to a section start, then subtracts a section size. These two calculations differ if the initial value is already rounded to section alignment. 2) The second update of gd->start_addr_sp subtracts exactly CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in cache.c:noncached_init() rounds the noncached size up to section alignment before subtracting it. The two calculations differ if the noncached region size is not a multiple of the MMU section size. In practice, one/both of those issues causes a practical problem on Jetson TX1; U-Boot triggers a synchronous abort during initialization, likely due to overlapping use of some memory region. This change fixes both these issues by duplicating the exact calculations from noncached_init() into reserve_noncached(). However, this fix assumes that gd->start_addr_sp on entry to reserve_noncached() exactly matches mem_malloc_start on entry to noncached_init(). I haven't traced the code to see whether it absolutely guarantees this in all (or indeed any!) cases. Consequently, I added some comments in the hope that this condition will continue to be true. Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area") Cc: Vikas Manocha <vikas.manocha@st.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
2019-08-27image: add new "copro" image typePatrick Delaunay1-0/+1
Define new image type for coprocessor images. It is used in FIT to identify the files loaded with remoteproc command (elf or bin). Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-08-26Merge branch '2019-08-26-master-imports'Tom Rini2-0/+18
- Assorted minor bugfixes
2019-08-26Kconfig: Varios: Fix more SPL, TPL dependenciesAdam Ford1-0/+1
Several options are presenting themselves on a various boards where the options are clearly not used. (ie, SPL/TPL options when SPL or TPL are not defined) This patch is not attempting to be a complete list of items, but more like low hanging fruit. In some instances, I wasn't sure of DM was required, so I simply made them SPL or TPL. This patch attempts to reduce some of the menuconfig noise by defining dependencies so they don't appear when not used. Signed-off-by: Adam Ford <aford173@gmail.com>
2019-08-26board_f: reserve noncached space below malloc areaVikas Manocha1-0/+17
Noncached area at present is being initialized to random space after malloc area. It works in most the cases as it goes to stack area & stack is not overwriting it being far from it. Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
2019-08-26Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscvTom Rini6-14/+135
- Support SPL and OpenSBI (FW_DYNAMIC firmware) boot. - Fix qemu kconfig build warning.
2019-08-26riscv: support SPL stack and global data relocationLukas Auer1-1/+1
To support relocation of the stack and global data on RISC-V, the secondary harts must be notified of the change using IPIs. We can reuse the hart relocation code for this purpose. It uses global data to store the new stack pointer and global data pointer for the secondary harts. This means that we cannot update the global data pointer of the main hart in spl_relocate_stack_gd(), because the secondary harts have not yet been relocated at this point. It is updated after the secondary harts have been notified. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
2019-08-26spl: support booting via RISC-V OpenSBILukas Auer5-0/+110
RISC-V OpenSBI is an open-source implementation of the RISC-V Supervisor Binary Interface (SBI) specification. It is required by Linux and U-Boot running in supervisor mode. This patch adds support for booting via the OpenSBI FW_DYNAMIC firmware. It supports OpenSBI version 0.4 and higher. In this configuration, U-Boot SPL starts in machine mode. After loading OpenSBI and U-Boot proper, it will start OpenSBI. All necessary parameters are generated by U-Boot SPL and are passed to OpenSBI. U-Boot proper is started in supervisor mode by OpenSBI. Support for OpenSBI is enabled with CONFIG_SPL_OPENSBI. An additional configuration entry, CONFIG_SPL_OPENSBI_LOAD_ADDR, is used to specify the load address of the OpenSBI firmware binary. It is not used directly in U-Boot and instead is intended to make the value available to scripts such as FIT configuration generators. The header file include/opensbi.h is based on header files from the OpenSBI project. They are recent, as of commit bae54f764570 ("firmware: Add fw_dynamic firmware"). Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
2019-08-26spl: fit: use U-Boot device tree when FIT image has no device treeLukas Auer1-13/+24
As part of the SPL FIT boot flow, the device tree is appended to U-Boot proper. The device tree is used to record information on the loadables to make them available to the SPL framework and U-Boot proper. Depending on the U-Boot device tree provider, the FIT image might not include a device tree. Information on the loadables is missing in this case. When booting via firmware bundled with the FIT image, U-Boot SPL loads the firmware binary and U-Boot proper before starting the firmware. The firmware, in turn, is responsible for starting U-Boot proper. Information on the memory location of the U-Boot proper loadable must be available to the SPL framework so that it can be passed to the firmware binary. To support this use case when no device tree is found in the FIT image, fall back to the U-Boot device tree in this situation. At the same time, update the comment to remove the note that the destination address must be aligned to ARCH_DMA_MINALIGN. Alignment is only required as an intermediate step when reading external data. This is automatically handled by spl_fit_append_fdt(). After reading the external data, it is copied to the specified address, which does not have to be aligned to ARCH_DMA_MINALIGN. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
2019-08-25Convert CONFIG_SYS_SPI_U_BOOT_OFFS to KconfigHannes Schmelzer1-0/+8
This converts the following to Kconfig: CONFIG_SYS_SPI_U_BOOT_OFFS Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> [trini: Expose this for SPL_SPI_SUNXI for now] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-08-23Kconfigs: Various: Fix some SPL, TPL and ARM64 dependenciesAdam Ford1-0/+2
Several options are presenting themselves on a various boards where the options are clearly not used. (ie, arm64 options on arm9, or SPL/TPL options when SPL or TPL are not defined) This patch is not attempting to be a complete list of items, but more like low hanging fruit. This patch attempts to reduce some of the menuconfig noise by defining dependencies so they don't appear when not used. Signed-off-by: Adam Ford <aford173@gmail.com>
2019-08-11Drop PCMCIASimon Glass1-12/+0
This is no-longer used in U-Boot and has not been converted to driver model. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Rename environment.h to env_internal.hSimon Glass3-3/+3
This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-08-11env: Drop environment.h header file where not neededSimon Glass2-2/+0
This header file is now only used by files that access internal environment features. Drop it from various places where it is not needed. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move get/set_default_env() to env.hSimon Glass2-2/+2
Move these functions to the new header file and rename set_default_env() to env_set_default() so that it has a consistent env_ prefix. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move env_get() to env.hSimon Glass11-0/+11
Move env_get() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move env_set() to env.hSimon Glass8-0/+8
Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move env_get_hex() to env.hSimon Glass1-0/+1
Move env_get_hex() over to the new header file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-08-11env: Move env_set_hex() to env.hSimon Glass3-0/+3
Move env_set_hex() over to the new header file along with env_set_addr() which uses it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-08-11env: Move env_relocate() to env.hSimon Glass1-0/+1
Move env_relocate() over to the new header file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-08-11env: Move env_init() to env.hSimon Glass2-0/+2
Move env_init() over to the new header file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-08-11env: Create a new file for environment functionsSimon Glass1-0/+1
At present we have environment.h but this file includes all the environment-related header files as well as internals such as default_environment. It seems desirable to have a new header to hold the commonly used environment functions, so that most files can avoid including all of this unnecessary stuff. Create a new env.h header and move one function over to it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-11common: Remove video_setmem()Simon Glass1-7/+0
This function is no-longer defined in U-Boot. Drop the declaration from common.h Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11common: Move lcd_setmem() to lcd.hSimon Glass1-0/+1
This function relates to lcd.h and is about to become obsolete with the driver-model conversion. Move it out of common.h Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11common: Move gzip functions into a new gzip headerSimon Glass3-0/+3
As part of the effort to remove things from common.h, create a new header for the gzip functions. Move the function declarations to it and add missing documentation. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-11spl: implement stack usage checkSimon Goldschmidt3-0/+64
This implements a stack usage check in SPL. Many boards start up SPL to run code + data from one common, rather small SRAM. To implement a sophisticated SPL binary size limit on such boards, the stack size (as well as malloc size and global data size) must be subtracted from this SRAM size. However, to do that properly, the stack size first needs to be known. This patch adds a new Kconfig option: - SPL_SYS_REPORT_STACK_F_USAGE: memset(0xaa) the whole area of the stack very early and check stack usage based on this constant later before the stack is switched to DRAM Initializing the stack and checking it is implemented in weak functions, in case a board does not use the stack as saved in gd->start_addr_sp. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-07common: image-android-dt: Fix logic in print fdt info routineSam Protsenko1-5/+6
Do not attempt to print fdt info if root node wasn't found. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2019-08-07fit: Do not automatically decompress ramdisk imagesJulius Werner1-4/+9
The Linux ramdisk should always be decompressed by the kernel itself, not by U-Boot. Therefore, the 'compression' node in the FIT image should always be set to "none" for ramdisk images, since the only point of using that node is if you want U-Boot to do the decompression itself. Yet some systems populate the node to the compression algorithm used by the kernel instead. This used to be ignored, but now that we support decompression of all image types it becomes a problem. Since ramdisks should never be decompressed by U-Boot anyway, this patch adds a special exception for them to avoid these issues. Still, setting the 'compression' node like that is wrong in the first place, so we still want to print out a warning so that third-party distributions doing this can notice and fix it. Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-07console: execute flush on uart when silent is removedPatrick Delaunay1-9/+36
Avoid to flush buffer when silent console is activated as the console can be reactivate later, after relocation, when the env will be updated with the saved one. Solve issue (missing beginning of U-Boot trace) when: - CONFIG_SILENT_CONSOLE is activated - silent=1 is defined in default environment (CONFIG_EXTRA_ENV_SETTINGS) - silent is removed in saved environment with: > env delete silent; env save Only functional when PRE_CONSOLE_BUFFER is activated. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-08-07console: update silent tag after env loadPatrick Delaunay1-0/+4
Update the "silent" property with the variable "silent" get from saved environment, it solves the issue when: - CONFIG_SILENT_CONSOLE and CONFIG_SYS_CONSOLE_IS_IN_ENV are activated - silent is not defined in default environment - silent is requested in saved environment with: > env set silent 1; env save On next reboot the console is not disabled as expected after relocation and the environment load from flash (the callback is not called when the INSERT is requested in the created hash table) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2019-08-07avb: Fix build when CONFIG_OPTEE_TA_AVB is disabledSam Protsenko1-0/+3
When having only these AVB related configs enabled: CONFIG_AVB_VERIFY=y CONFIG_CMD_AVB=y CONFIG_LIBAVB=y build fails with next errors: common/avb_verify.c: In function 'read_persistent_value': common/avb_verify.c:867:6: warning: implicit declaration of function 'get_open_session' common/avb_verify.c:870:45: error: 'struct AvbOpsData' has no member named 'tee' common/avb_verify.c:894:7: warning: implicit declaration of function 'invoke_func' common/avb_verify.c: In function 'write_persistent_value': common/avb_verify.c:931:45: error: 'struct AvbOpsData' has no member named 'tee' Guard read_persistent_value() and write_persistent_value() functions by checking if CONFIG_OPTEE_TA_AVB is enabled (as those are only used in that case) to fix the build with mentioned configuration. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
2019-08-07autoboot: fix bug using with CAAM and AUTOBOOT_ENCRYPTIONHeiko Schocher1-3/+12
if CONFIG_AUTOBOOT_KEYED, CONFIG_AUTOBOOT_ENCRYPTION and CONFIG_AUTOBOOT_STOP_STR_SHA256 are enabled in conjunction with CONFIG_SHA_HW_ACCEL and CONFIG_FSL_CAAM, we get the Error when pressing a key while waiting for bootdelay: Error: Address arguments are not aligned CAAM was not setup properly or it is faulty Reason is, that used variables are not cache aligned, so malloc this variables cache aligned. Probably this is also a bugfix for other hw accelerators than CAAM. Signed-off-by: Heiko Schocher <hs@denx.de>
2019-08-02autoboot: Adjust the implementation in autoboot_command()Simon Glass1-6/+9
Avoid use of #ifdef and keep the common condion in a variable. This makes the code easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Move a few more options from #ifdef to if()Simon Glass1-10/+9
Adjust some of the code which can be trivially moved to use IS_ENABLED() instead of #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Rename CONFIG_MENU_SHOW to include AUTOBOOTSimon Glass1-1/+1
Rename this option to CONFIG_AUTOBOOT_MENU_SHOW this it relates to the autoboot functionality. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Tidy up use of menukeySimon Glass1-12/+14
Move the variable to the top of the file and adjust the code which uses it to use if() rather than #ifdef, to make it easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Rename CONFIG_MENUKEY to CONFIG_AUTOBOOT_MENUKEYSimon Glass1-5/+5
Since this is part of the autoboot functionality, it makes sense to name it with an AUTOBOOT prefix. No mainline boards use it so this should be safe, and downstream boards will need to adjust. Since this option is just an integer value, it really needs another option to control whether the feature is enabled or not. Add a new CONFIG_USE_AUTOBOOT_MENUKEY for that. This fits better with how things are done with Kconfig, avoiding the need to use a specific value to disable the feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Drop unused CONFIG_MENUPROMPTSimon Glass1-4/+0
This is not defined by any board. We could use CONFIG_AUTOBOOT_PROMPT instead perhaps, but this depends on CONFIG_AUTOBOOT_KEYED which is not used for the single-key case. So let's just remove CONFIG_MENUPROMPT. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Drop #ifdef CONFIG_AUTOBOOT_KEYEDSimon Glass1-9/+8
At present we have two functions named __autoboot() which do different things. This is confusing. Fix it by using if() instead of #ifdef for selecting the functions, and renaming them to meaningful names. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Use if() for CONFIG_SILENT_CONSOLESimon Glass1-3/+1
Avoid an #ifdef in this function, to improve readability. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Improve docs for CONFIG_AUTOBOOT_ENCRYPTIONSimon Glass1-0/+16
This option is not documented properly at present. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Drop #ifdef for CONFIG_AUTOBOOT_ENCRYPTIONSimon Glass1-6/+8
Use if() instead for this option, renaming the two different passwd_abort() functions to indicate their purpose. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02autoboot: Use CONFIG_AUTOBOOT_STOP_STR_SHA256 indirectlySimon Glass1-1/+7
This CONFIG option is only present if CONFIG_AUTOBOOT_ENCRYPTION is enabled so it cannot be used in code without that #ifdef. But we want to reduce the use of #ifdef in this file and in particular to avoid having two different functions both named passwd_abort() but which do different things. In preparation for this, create an intermediate value which is set to an empty string if there is no value for CONFIG_AUTOBOOT_STOP_STR_SHA256. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02Convert CONFIG_SHOW_BOOT_PROGRESS to KconfigSimon Glass1-0/+162
This converts the following to Kconfig: CONFIG_SHOW_BOOT_PROGRESS Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-02main: Use conditional run_preboot_environment_command()Simon Glass1-3/+2
The function name indicates that it does something, but its entire operation is actually condition on a CONFIG. Move the condition outside the function so this is clearer, and use if() instead of #ifdef, like the reset of the file. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-30Merge tag 'video-for-2019.10-rc1' of ↵Tom Rini1-1/+3
https://gitlab.denx.de/u-boot/custodians/u-boot-video - fix EDID mode filtering - extend mxc_ipuv3_fb to enable backlight/display - include fb_base in global_data for DM_VIDEO - show frame buffer address via board info as used to be with legacy VIDEO support
2019-07-29edid: fix edid_get_timing_validate() mode_valid lookupNeil Armstrong1-1/+3
Add a condition to the break in the modes lookup, without this when the first mode is not valid, then edid_get_timing_validate() return an error instead of checking the next modes. Fixes: 1c1ed441b0d1 ("edid: add edid_get_timing_validate() variant to filter out edid modes") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2019-07-29Merge branch '2019-07-29-master-imports'Tom Rini4-187/+221
- Assorted bug fixes
2019-07-29gpio: fixes for gpio-hog supportHeiko Schocher1-2/+2
recently added gpio hog patch was "in discussion" state with Simon Glass. This patch now adds most of comments from Simon Glass. Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-29fit: Support compat string property in configuration nodeJulius Werner1-28/+39
This patch adds support for an optional optimization to compatible string matching where the compatible string property from the root node of the kernel FDT can be copied into the configuration node of the FIT image. This is most useful when using compressed FDTs or when using FDT overlays, where the traditional extraction of the compatible string from the kernel FDT itself is not easily possible. Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>