summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2021-01-16common: Makefile: drop duplicated linePeng Fan
obj-$(CONFIG_$(SPL_TPL_)YMODEM_SUPPORT) += xyzModem.o is there, no need obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-16console: cosmetics: remove #if 0Patrick Delaunay
Remove the #if 0 present since the first version of console.c Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-16common: always compile fixup_cmdtable()Heinrich Schuchardt
With our optimization settings the linker eliminates unused functions. But for debugging it is better to compile with -Og or -O0. With -O0 compiling the sandbox fails due to the missing function fixup_cmdtable() called by dm_reloc() and others. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-16common: spl: spl_fit.c: report an error on hash check failPhilippe Reynes
When the hash check fails on a loadable image, the SPL/TPL simply jump to the next one. This commit changes this behaviour, when the hash check fails on a loadable image, the function spl_load_simple_fit stops and report an error. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-16cli_readline: Only insert printable charsSteve Bennett
There should be no need to insert non-printable characters and this prevents line editing getting confused. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-16Add optional salt to AUTOBOOT_STOP_STR_SHA256Joel Peshkin
Adds an optional SALT value to AUTOBOOT_STOP_STR_SHA256. If a string followed by a ":" is prepended to the sha256, the portion to the left of the colon will be used as a salt and the password will be appended to the salt before the sha256 is computed and compared. Signed-off-by: Joel Peshkin <joel.peshkin@broadcom.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Patrick Delaunay <patrick.delaunay@st.com> Cc: Heiko Schocher <hs@denx.de> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Joel Peshkin <joel.peshkin@broadcom.com> To: u-boot@lists.denx.de Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2021-01-15IOMUX: Stop dropped consolesAndy Shevchenko
When at some point environment shrinks we need to stop dropped devices. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15IOMUX: Drop indentation level by removing redundant 'else'Andy Shevchenko
Obviously the following has unnecessary indentation level in 'else' branch. if (foo) { ... return; } else { ... } Drop indentation level by removing redundant 'else'. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15IOMUX: Refactor iomux_doenv() in order to increase readabilityAndy Shevchenko
Refactor iomux_doenv() a bit in order to increase readability. There is no change in code generation on x86. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15IOMUX: Preserve console list if realloc() failsAndy Shevchenko
It's realloc() 101 to avoid `foo = realloc(foo, ...);` call due to getting a memory leak. Actually it's not clear why realloc() has been used here. If we shrink the array, the memcpy() overwrites it anyway with the contents of a new array. If it becomes bigger, same story. Drop useless realloc() for good and thus preserve console list in case of failed allocation. Fixes: 16a28ef219c2 ("IOMUX: Add console multiplexing support.") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: rename search_device() to console_search_dev()Andy Shevchenko
Rename search_device() to console_search_dev() since it's in console.h. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: Keep ->start() and ->stop() balancedAndy Shevchenko
There is no need to call ->start() for already started device. All the same, there is no need to call ->stop() for devices still in use. For now enforce this only for IOMUX case. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: Introduce console_start() and console_stop()Andy Shevchenko
In the future we would like to stop unused consoles and also add a reference counting to avoid imbalanced calls to ->start() and ->stop() in some cases. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: add console_has_tstc helper function for CONSOLE_MUXPatrick Delaunay
Add the helper function console_has_tstc() and replace the test #if CONFIG_IS_ENABLED(CONSOLE_MUX) to a simple 'if' test to respect the U-Boot coding rule. No functional change. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: remove #ifdef CONFIG_CONSOLE_RECORDPatrick Delaunay
Add helper functions to access to gd->console_out and gd->console_in with membuff API and replace the #ifdef CONFIG_CONSOLE_RECORD test by if (IS_ENABLED(CONFIG_CONSOLE_RECORD)) to respect the U-Boot coding rule. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: add function console_devices_setPatrick Delaunay
Add a new function to access to console_devices only defined if CONFIG_IS_ENABLED(CONSOLE_MUX). This path allows to remove #if CONFIG_IS_ENABLED(CONSOLE_MUX) in console_getc function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-01-15console: remove #ifdef CONFIG when it is possiblePatrick Delaunay
Remove #ifdef or #ifndef for CONFIG when it is possible to simplify the console.c code and respect the U-Boot coding rules. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15spl: Kconfig: Add SPL dependency to CONFIG_HANDOFFOvidiu Panait
CONFIG_HANDOFF is used in u-boot proper to locate handoff info from SPL during pre-relocation init (in setup_spl_handoff). Add explicit dependency on CONFIG_SPL, to fix the following build error when CONFIG_HANDOFF && !CONFIG_SPL: common/board_f.c: In function ‘setup_spl_handoff’: common/board_f.c:283:4: error: ‘gd_t {aka struct global_data}’ has no member named ‘spl_handoff’ gd->spl_handoff = bloblist_find(BLOBLISTT_SPL_HANDOFF, ^~ Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop arch-specific ifdefs around initr_trapOvidiu Panait
In order to remove the arch-specific ifdefs around initr_trap, introduce arch_initr_trap weak initcall. Implementations for ppc/m68k/mips have been moved to arch/<arch>/lib/traps.c Default implementation is a nop stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2021-01-15common: board_r: Drop initr_bbmii wrapperOvidiu Panait
Add a return value to bb_miiphy_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_api wrapperOvidiu Panait
Add a return value to api_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_jumptable wrapperOvidiu Panait
Add a return value to jumptable_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_xen wrapperOvidiu Panait
Add a return value to xen_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_noncached wrapperOvidiu Panait
Add a return value to noncached_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_pci wrapperOvidiu Panait
Add a return value to pci_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_pci_ep wrapperOvidiu Panait
Add a return value to pci_ep_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_post_backlog wrapperOvidiu Panait
Add a return value to post_output_backlog and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_secondary_cpu wrapperOvidiu Panait
Add a return value to cpu_secondary_init_r and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_r: Drop initr_console_record wrapperOvidiu Panait
Drop initr_console_record wrapper and call console_record_init directly. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdtOvidiu Panait
Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt, reloc_fdt functions. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_f: Move setup_machine code to setup_bdinfoOvidiu Panait
setup_bdinfo is used to populate various bdinfo fields, so move setup_machine code there, as all it does is setting gd->bd->bi_arch_number. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dmOvidiu Panait
Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also, move timer code to the main ifdef, so that ret is defined. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: board_f: Drop initf_console_record wrapperOvidiu Panait
Drop initf_console_record wrapper and call console_record_init directly. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_FOvidiu Panait
Currently, the following #ifdef construct is used to check whether to run console_record_init() during pre-relocation init: defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN) Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the complex ifdef check. Also, use IS_ENABLED() instead of #ifdef. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15log: call vsnprintf only when it is needed to emit tracePatrick Delaunay
Reduce the log overhead when the traces are filtered, by moving the vsnprintf call from _log() to log_dispatch(). This patch avoids the printf treatment when LOG features is activated, but trace is filtered, for example when MAX_LOG_LEVEL=8 and LOG_DEFAULT_LEVEL=6. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2021-01-15console: allow to record console output before readyPatrick Delaunay
Allow to record the console output before before U-Boot has a console ready. This patch allows to test the console output in sandbox test based on console record. It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY are 2 independent flags. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15console: remove duplicated test on gd valuePatrick Delaunay
Reorder test on gd value and remove the duplicated test (!gd) in putc and puts function. This patch is a preliminary step for rework of this function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-15log: use console puts to output trace before LOG initPatrick Delaunay
Use the console puts functions to output the traces before the log initialization (when CONFIG_LOG is not activated). This patch allows to display the first U-Boot traces (with macro debug) when CONFIG_DEBUG_UART is activated and not only drop them. For example for traces in board_f.c requested by the macro debug, when LOG_DEBUG is defined and CONFIG_LOG is activated. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2021-01-15log: don't build the trace buffer when log is not readyPatrick Delaunay
Update _log function to drop any traces when log is yet initialized: vsnprintf is no more executed in this case. This patch allows to reduce the cost for the dropped early debug trace. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2021-01-13image-fit: fit_check_format check for valid FDTHeinrich Schuchardt
fit_check_format() must check that the buffer contains a flattened device tree before calling any device tree library functions. Failure to do may cause segmentation faults. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-01-12Merge tag 'ti-v2021.04-rc1' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-ti - DM support for OMAP PWM backlight - USB host mode support for AM654 - Minor SPI fixes - Add support k2g ice board with 1GHz silicon - Fix GTC programming for K3 devices
2021-01-12fdt: translate address if #size-cells = <0>Dario Binacchi
The __of_translate_address routine translates an address from the device tree into a CPU physical address. A note in the description of the routine explains that the crossing of any level with since inherited from IBM. This does not happen for Texas Instruments, or at least for the beaglebone device tree. Without this patch, in fact, the translation into physical addresses of the registers contained in the am33xx-clocks.dtsi nodes would not be possible. They all have a parent with #size-cells = <0>. The CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS symbol makes translation possible even in the case of crossing levels with #size-cells = <0>. The patch acts conservatively on address translation, except for removing a check within the of_translate_one function in the drivers/core/of_addr.c file: + ranges = of_get_property(parent, rprop, &rlen); - if (ranges == NULL && !of_empty_ranges_quirk(parent)) { - debug("no ranges; cannot translate\n"); - return 1; - } if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); debug("empty ranges; 1:1 translation\n"); There are two reasons: 1 The function of_empty_ranges_quirk always returns false, invalidating the following if statement in case of null ranges. Therefore one of the two checks is useless. 2 The implementation of the of_translate_one function found in the common/fdt_support.c file has removed this check while keeping the one about the 1:1 translation. The patch adds a test and modifies a check for the correctness of an address in the case of enabling translation also for zero size cells. The added test checks translations of addresses generated by nodes of a device tree similar to those you can find in the files am33xx.dtsi and am33xx-clocks.dtsi for which the patch was created. The patch was also tested on a beaglebone black board. The addresses generated for the registers of the loaded drivers are those specified by the AM335x reference manual. Signed-off-by: Dario Binacchi <dariobin@libero.it> Tested-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-11tools: mkimage: Add Allwinner eGON supportAndre Przywara
So far we used the separate mksunxiboot tool for generating a bootable image for Allwinner SPLs, probably just for historical reasons. Use the mkimage framework to generate a so called eGON image the Allwinner BROM expects. The new image type is called "sunxi_egon", to differentiate it from the (still to be implemented) secure boot TOC0 image. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net> Reviewed-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-11Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-01-06Merge tag 'xilinx-for-v2021.04' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2021.04 arm64: - DT updates microblaze: - Add support for NOR device support spi: - Fix unaligned data write issue nand: - Minor code change xilinx: - Fru fix in limit calculation - Fill git repo link for all Xilinx boards video: - Add support for seps525 spi display tools: - Minor Vitis file support cmd/common - Minor code indentation fixes serial: - Uartlite debug uart initialization fix
2021-01-05spl: Drop bd_info in the data sectionSimon Glass
This uses up space in the SPL binary but it always starts as zero. Also some boards cannot support data in TPL (e.g. Intel Apollo Lake). Use malloc() to allocate this structure instead, by moving the init a little later, after malloc() is inited. Make this function optional since it pulls in malloc(). This reduces the TPL binary size on coral by about 64 bytes Signed-off-by: Simon Glass <sjg@chromium.org>
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>
2021-01-04common: usb_storage: Fix code indentationMichal Simek
Reported by smatch like: common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2020-12-22Common:fdt: Check for error return valueHongwei Zhang
Check for negative return value of fdt_noffset from calling boot_get_fdt_fit(). Signed-off-by: Hongwei Zhang <hongweiz@ami.com> Reviewed-by: Simon Glass <sjg@chromium.org>