summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* common: Makefile: drop duplicated linePeng Fan2021-01-161-1/+0
| | | | | | | | 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>
* console: cosmetics: remove #if 0Patrick Delaunay2021-01-161-10/+0
| | | | | | | 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>
* common: always compile fixup_cmdtable()Heinrich Schuchardt2021-01-161-4/+2
| | | | | | | | | | | 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>
* common: spl: spl_fit.c: report an error on hash check failPhilippe Reynes2021-01-161-2/+5
| | | | | | | | | | 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>
* cli_readline: Only insert printable charsSteve Bennett2021-01-161-2/+4
| | | | | | | 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>
* Add optional salt to AUTOBOOT_STOP_STR_SHA256Joel Peshkin2021-01-162-3/+14
| | | | | | | | | | | | | | | | | | 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>
* IOMUX: Stop dropped consolesAndy Shevchenko2021-01-151-3/+16
| | | | | | | 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>
* IOMUX: Drop indentation level by removing redundant 'else'Andy Shevchenko2021-01-151-5/+5
| | | | | | | | | | | | | | | | 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>
* IOMUX: Refactor iomux_doenv() in order to increase readabilityAndy Shevchenko2021-01-151-7/+6
| | | | | | | | 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>
* IOMUX: Preserve console list if realloc() failsAndy Shevchenko2021-01-151-11/+2
| | | | | | | | | | | | | | | | | 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>
* console: rename search_device() to console_search_dev()Andy Shevchenko2021-01-153-13/+13
| | | | | | | | 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>
* console: Keep ->start() and ->stop() balancedAndy Shevchenko2021-01-151-0/+37
| | | | | | | | | | | 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>
* console: Introduce console_start() and console_stop()Andy Shevchenko2021-01-151-7/+23
| | | | | | | | | 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>
* console: add console_has_tstc helper function for CONSOLE_MUXPatrick Delaunay2021-01-151-12/+25
| | | | | | | | | | | | 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>
* console: remove #ifdef CONFIG_CONSOLE_RECORDPatrick Delaunay2021-01-151-22/+73
| | | | | | | | | | | 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>
* console: add function console_devices_setPatrick Delaunay2021-01-151-7/+13
| | | | | | | | | | | | 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>
* console: remove #ifdef CONFIG when it is possiblePatrick Delaunay2021-01-151-94/+64
| | | | | | | | | 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>
* spl: Kconfig: Add SPL dependency to CONFIG_HANDOFFOvidiu Panait2021-01-151-1/+1
| | | | | | | | | | | | | | | | 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>
* common: board_r: Drop arch-specific ifdefs around initr_trapOvidiu Panait2021-01-151-14/+2
| | | | | | | | | | | | 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>
* common: board_r: Drop initr_bbmii wrapperOvidiu Panait2021-01-151-9/+1
| | | | | | | | 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>
* common: board_r: Drop initr_api wrapperOvidiu Panait2021-01-151-10/+1
| | | | | | | | 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>
* common: board_r: Drop initr_jumptable wrapperOvidiu Panait2021-01-152-8/+4
| | | | | | | | 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>
* common: board_r: Drop initr_xen wrapperOvidiu Panait2021-01-151-9/+1
| | | | | | | | 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>
* common: board_r: Drop initr_noncached wrapperOvidiu Panait2021-01-151-9/+1
| | | | | | | | 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>
* common: board_r: Drop initr_pci wrapperOvidiu Panait2021-01-151-14/+4
| | | | | | | | 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>
* common: board_r: Drop initr_pci_ep wrapperOvidiu Panait2021-01-151-10/+1
| | | | | | | | 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>
* common: board_r: Drop initr_post_backlog wrapperOvidiu Panait2021-01-151-9/+1
| | | | | | | | 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>
* common: board_r: Drop initr_secondary_cpu wrapperOvidiu Panait2021-01-151-15/+2
| | | | | | | | 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>
* common: board_r: Drop initr_console_record wrapperOvidiu Panait2021-01-151-10/+3
| | | | | | | 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>
* common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdtOvidiu Panait2021-01-151-20/+21
| | | | | | | | 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>
* common: board_f: Move setup_machine code to setup_bdinfoOvidiu Panait2021-01-151-9/+4
| | | | | | | | | 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>
* common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dmOvidiu Panait2021-01-151-5/+6
| | | | | | | | 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>
* common: board_f: Drop initf_console_record wrapperOvidiu Panait2021-01-151-9/+3
| | | | | | | 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>
* common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_FOvidiu Panait2021-01-152-4/+11
| | | | | | | | | | | | 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>
* log: call vsnprintf only when it is needed to emit tracePatrick Delaunay2021-01-151-7/+13
| | | | | | | | | | | | 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>
* console: allow to record console output before readyPatrick Delaunay2021-01-151-8/+8
| | | | | | | | | | | | | | 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>
* console: remove duplicated test on gd valuePatrick Delaunay2021-01-151-8/+8
| | | | | | | | | | | 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>
* log: use console puts to output trace before LOG initPatrick Delaunay2021-01-151-0/+9
| | | | | | | | | | | | | | 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>
* log: don't build the trace buffer when log is not readyPatrick Delaunay2021-01-151-5/+8
| | | | | | | | | | 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>
* image-fit: fit_check_format check for valid FDTHeinrich Schuchardt2021-01-131-0/+6
| | | | | | | | | 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>
* Merge tag 'ti-v2021.04-rc1' of ↵Tom Rini2021-01-121-2/+4
|\ | | | | | | | | | | | | | | | | | | 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
| * fdt: translate address if #size-cells = <0>Dario Binacchi2021-01-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | tools: mkimage: Add Allwinner eGON supportAndre Przywara2021-01-111-0/+1
|/ | | | | | | | | | | | | | | 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>
* Merge branch 'next'Tom Rini2021-01-1114-88/+374
|\ | | | | | | Signed-off-by: Tom Rini <trini@konsulko.com>
| * Merge tag 'xilinx-for-v2021.04' of ↵WIP/06Jan2021-nextTom Rini2021-01-061-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * common: usb_storage: Fix code indentationMichal Simek2021-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | Reported by smatch like: common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting Signed-off-by: Michal Simek <michal.simek@xilinx.com>
| * | spl: Drop bd_info in the data sectionSimon Glass2021-01-052-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Common:fdt: Check for error return valueHongwei Zhang2020-12-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass2020-12-132-2/+2
| | | | | | | | | | | | | | | | | | | | | Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass2020-12-131-1/+1
| | | | | | | | | | | | | | | | | | Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>