platform/kernel/u-boot.git
3 years agoclk: Rename clk_get_by_driver_info()
Simon Glass [Sat, 7 Aug 2021 13:24:09 +0000 (07:24 -0600)]
clk: Rename clk_get_by_driver_info()

This is actually a misnomer now, since the phandle info may contain
a driver_info index or a udevice index. Rename it to use the word
'phandle', which seems more accurate. Add a comment while we are here.

Also add a test for this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Add comments to dt-structs contents
Simon Glass [Sat, 7 Aug 2021 13:24:08 +0000 (07:24 -0600)]
dm: Add comments to dt-structs contents

These structs do not have comments at present. Add them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdt: Update Makefile rules with the new OF_REAL Kconfig
Simon Glass [Sat, 7 Aug 2021 13:24:07 +0000 (07:24 -0600)]
fdt: Update Makefile rules with the new OF_REAL Kconfig

Simplify some of the Makefile rules using this Kconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotreewide: Try to avoid the preprocessor with OF_REAL
Simon Glass [Sat, 7 Aug 2021 13:24:06 +0000 (07:24 -0600)]
treewide: Try to avoid the preprocessor with OF_REAL

Convert some of these occurences to C code, where it is easy to do. This
should help encourage this approach to be used in new code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agommc: nds32: ftsdc010: Convert to livetree
Simon Glass [Sat, 7 Aug 2021 13:24:05 +0000 (07:24 -0600)]
mmc: nds32: ftsdc010: Convert to livetree

Use the livetree API for this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotreewide: Use OF_REAL instead of !OF_PLATDATA
Simon Glass [Sat, 7 Aug 2021 13:24:04 +0000 (07:24 -0600)]
treewide: Use OF_REAL instead of !OF_PLATDATA

Now that we have a 'positive' Kconfig option, use this instead of the
negative one, which is harder to understand.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotreewide: Simply conditions with the new OF_REAL
Simon Glass [Sat, 7 Aug 2021 13:24:03 +0000 (07:24 -0600)]
treewide: Simply conditions with the new OF_REAL

Use this new Kconfig to simplify the compilation conditions where
appropriate.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdt: Create a new OF_REAL Kconfig
Simon Glass [Sat, 7 Aug 2021 13:24:02 +0000 (07:24 -0600)]
fdt: Create a new OF_REAL Kconfig

The condition to indicate whether there is a runtime devicetree available
is OF_CONTROL && !OF_PLATDATA. This is a bit unweidly and is repeated in
a lot of places.

Add a new OF_REAL Kconfig which provides this information directly.

Note: This is similar in effect to LIBFDT. We might consider dropping
LIBFDT and using this instead, but this is left for now as we also have
OF_LIBFDT_OVERLAY which it would not make sense to change.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotreewide: fdt: Move fdt_get_config_... to ofnode_conf_read...
Simon Glass [Sat, 7 Aug 2021 13:24:01 +0000 (07:24 -0600)]
treewide: fdt: Move fdt_get_config_... to ofnode_conf_read...

The current API is outdated as it requires a devicetree pointer.

Move these functions to use the ofnode API and update this globally. Add
some tests while we are here.

Correct the call in exynos_dsim_config_parse_dt() which is obviously
wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agovexpress_ca9x4: Add missing SYS_LOAD_ADDR
Tom Rini [Sat, 25 Sep 2021 02:12:35 +0000 (22:12 -0400)]
vexpress_ca9x4: Add missing SYS_LOAD_ADDR

- Add missing CONFIG_SYS_LOAD_ADDR based on other platforms
- Resync

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-09-24-assorted-updates' into next
Tom Rini [Sat, 25 Sep 2021 00:35:50 +0000 (20:35 -0400)]
Merge branch '2021-09-24-assorted-updates' into next

- A few minor updates

3 years agodrivers: tpm2: update reset gpio semantics
Jorge Ramirez-Ortiz [Thu, 3 Jun 2021 10:40:26 +0000 (12:40 +0200)]
drivers: tpm2: update reset gpio semantics

Use the more generic reset-gpios property name.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoAvoid polluting CONFIG_ namespace with board specific define.
Kristian Amlie [Fri, 10 Sep 2021 06:19:19 +0000 (08:19 +0200)]
Avoid polluting CONFIG_ namespace with board specific define.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agotools: Handle PAGER containing arguments
Paul Barker [Wed, 8 Sep 2021 11:38:02 +0000 (12:38 +0100)]
tools: Handle PAGER containing arguments

When printing full help output from a tool, we should be able to handle
a PAGER variable which includes arguments, e.g. PAGER='less -F'.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
3 years agotools: Refactor full help printing
Paul Barker [Wed, 8 Sep 2021 11:38:01 +0000 (12:38 +0100)]
tools: Refactor full help printing

Collect the code for printing the full help message of patman, buildman
and binman into a single function in patman.tools.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
3 years agoARM: vexpress_ca9x4: Reintroduce board in order to use with QEMU.
Kristian Amlie [Tue, 7 Sep 2021 06:37:51 +0000 (08:37 +0200)]
ARM: vexpress_ca9x4: Reintroduce board in order to use with QEMU.

vexpress_ca9x4 is seemingly the only board except for qemu_arm which
is able to run U-Boot correctly, using the `-M vexpress-a9` option to
QEMU. Building for qemu_arm and running qemu-system-arm with the `-M
virt` argument has a number of downsides, most importantly that it
only supports virtio storage drivers. This significantly reduces its
usefulness in testing memory card and Flash solutions, especially when
the tested images are from a third party source.

So therefore we reintroduce the vexpress_ca9x4 board in this commit,
with the explicit goal of using it with QEMU.

A number of differences to note from the original:

* Since the board was apparently unmaintained, I have now set myself
  as the maintainer.

* The board has been converted to use the driver model, which was the
  reason it was removed in the first place.

* The vexpress_ca15_tc2 and vexpress_ca5x2 boards, which were removed
  in the same commit, are not necessary for the QEMU use case, and
  have been omitted.

* An `mmc0` alias was introduced in the dts file. The mmc is not
  detected correctly without this, now that it's based on the device
  tree instead of the board's init function.

* A couple of other nodes were removed because they were problematic
  when trying to run the UEFI bootmgr. Once again, the primary use
  case here is QEMU, and these nodes are not needed for that to work.

* Unnecessary board init code has been removed, thanks to driver model
  and device tree.

* `CONFIG_OF_EMBED` has been enabled. I know this goes against
  recommended practice, but there doesn't seem to be any other way to
  pass the dtb to U-Boot in the QEMU scenario. Using the -dtb argument
  does not work, I suppose because U-Boot doesn't use the same
  mechanics as the kernel when it's booting.

* Load addresses have been changed to fit QEMU use case.

People wanting to get a more detailed, yet somewhat isolated, diff
between this and the original, can run this command:

  git diff c6c26a05b89f25a06e7562f8c2071b60fd0c9eac~1 -- \
      $( git diff-tree --diff-filter=A -r --name-only HEAD~1 HEAD)

(Make sure to either check out this commit first, or replace HEAD with
the commit ID of this commit)

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
3 years agoarm: use CONFIG_SUPPORT_PASSING_ATAGS
Patrick Delaunay [Fri, 3 Sep 2021 08:24:39 +0000 (10:24 +0200)]
arm: use CONFIG_SUPPORT_PASSING_ATAGS

Simplify the bootm and the spl code by using the new config
CONFIG_SUPPORT_PASSING_ATAGS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-09-24-arm64-optimized-str-funcs' into next
Tom Rini [Fri, 24 Sep 2021 14:13:44 +0000 (10:13 -0400)]
Merge branch '2021-09-24-arm64-optimized-str-funcs' into next

- Bring in, but disable by default, asm optimized string functions for
  arm64.

3 years agoarm64: Kconfig: Enable usage of optimized memset/memcpy/memmove
Stefan Roese [Thu, 2 Sep 2021 15:00:19 +0000 (17:00 +0200)]
arm64: Kconfig: Enable usage of optimized memset/memcpy/memmove

This patch enables the use of the optimized memset(), memmove() &
memcpy() versions recently added on ARM64.

Please note that these optimized functions are now only enabled for
recent GCC versions (>= 9.4), as earlier GCC versions throw these
errors:

aarch64-linux-ar: warning: arch/arm/lib/memset-arm64.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
...

Signed-off-by: Stefan Roese <sr@denx.de>
[trini: Make this default to off as it causes problems on some platforms still]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoarm64: memset-arm64: Use simple memset when cache is disabled
Stefan Roese [Thu, 2 Sep 2021 15:00:18 +0000 (17:00 +0200)]
arm64: memset-arm64: Use simple memset when cache is disabled

The optimized memset uses the dc opcode, which causes problems when the
cache is disabled. This patch adds a check if the cache is disabled and
uses a very simple memset implementation in this case. Otherwise the
optimized version is used.

Signed-off-by: Stefan Roese <sr@denx.de>
3 years agoarm64: arch/arm/lib: Add optimized memset/memcpy/memmove functions
Stefan Roese [Thu, 2 Sep 2021 15:00:17 +0000 (17:00 +0200)]
arm64: arch/arm/lib: Add optimized memset/memcpy/memmove functions

Ported from https://github.com/ARM-software/optimized-routines

These files are included from this repository, including the latest
git commit ID:
string/aarch64/memcpy.S: afd6244a1f8d
string/aarch64/memset.S: e823e3abf5f8
string/asmdefs.h: e823e3abf5f8

Note that memmove is also handled by the memcpy function.

Please note that when adding these optimized functions as default memset
memcpy functions in U-Boot, U-Boot fails to boot on the LX2160ARDB.
After the initial ATF output, no U-Boot output is shown on the serial
console. Some exception is triggered here in the very early boot process
as some of the assembler opcodes need the caches to be enabled.

Because of this, a follow-up patch will add a check to use a simple
non-optimized memset for the "cache disabled" case.

Note:
I also integrated and tested with the Linux versions of these optimized
functions. They are similar to the ones now integrated but these ARM
versions are still a small bit faster.

Signed-off-by: Stefan Roese <sr@denx.de>
3 years agoRevert "env: Make _init() expect _INVALID when _IS_NOWHERE"
Tom Rini [Fri, 24 Sep 2021 11:40:07 +0000 (07:40 -0400)]
Revert "env: Make _init() expect _INVALID when _IS_NOWHERE"

Upon further discussion, this is not required now.

This reverts commit f6bc5d17afa9fe12418edaf1fc9f82beeda06132.

Link: https://lore.kernel.org/r/ebd92337-669a-9a0a-0af3-d06b957f3b40@denx.de/
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-09-23-assorted-updates' into next
Tom Rini [Fri, 24 Sep 2021 02:38:21 +0000 (22:38 -0400)]
Merge branch '2021-09-23-assorted-updates' into next

- Rework lmb reservation so we have common code for all arches to use
- armv8 cache.S cleanups, crc32 speedup
- ENV_IS_NOWHWERE, pci io/memory base configuration fixes

3 years agopci: Fix configuring io/memory base and limit registers of PCI bridges
Pali Rohár [Fri, 10 Sep 2021 11:33:35 +0000 (13:33 +0200)]
pci: Fix configuring io/memory base and limit registers of PCI bridges

Lower 4 bits of PCI_MEMORY_BASE and PCI_MEMORY_LIMIT registers are reserved
and should be zero. So do not set them to non-zero value.

Lower 4 bits of PCI_PREF_MEMORY_BASE and PCI_PREF_MEMORY_LIMIT registers
contain information if 64-bit memory addressing is supported. So preserve
this information when overwriting these registers.

Lower 4 bits of PCI_IO_BASE and PCI_IO_LIMIT register contain information
if 32-bit io addressing is supported. So preserve this information and do
not try to configure 32-bit io addressing (via PCI_IO_BASE_UPPER16 and
PCI_IO_LIMIT_UPPER16 registers) when it is unsupported.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mediatek: merge board Kconfigs into mach-mediatek
Guillaume La Roque [Fri, 10 Sep 2021 08:21:06 +0000 (10:21 +0200)]
arm: mediatek: merge board Kconfigs into mach-mediatek

On MediaTek boards we cannot override the SYS_BOARD / SYS_CONFIG_NAME
variables from defconfig.
This is because in board/mediatek/mtXXXX/Kconfig this value was override
by default due to the if CONFIG_TARGET_MTXXXX condition.

Merge all the Kconfigs to the mach-medatek/Kconfig.

This way:
- we only define SYS_{SOC,VENDOR} once
- all board definitions are in a single place, simplifying the build logic.

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
3 years agolmb: x86: Add arch_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:18 +0000 (22:47 +0200)]
lmb: x86: Add arch_lmb_reserve()

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: xtensa: Add arch_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:17 +0000 (22:47 +0200)]
lmb: xtensa: Add arch_lmb_reserve()

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: sh: Add arch_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:16 +0000 (22:47 +0200)]
lmb: sh: Add arch_lmb_reserve()

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
This architecture also needs to cover U-Boot with LMB before booting
Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: riscv: Add arch_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:15 +0000 (22:47 +0200)]
lmb: riscv: Add arch_lmb_reserve()

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Reviewed-by: Rick Chen <rick@andestech.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Atish Patra <atish.patra@wdc.com>
Cc: Leo <ycliang@andestech.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: nds32: Add arch_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:14 +0000 (22:47 +0200)]
lmb: nds32: Add arch_lmb_reserve()

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Reviewed-by: Rick Chen <rick@andestech.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: nios2: Add arch_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:13 +0000 (22:47 +0200)]
lmb: nios2: Add arch_lmb_reserve()

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: Remove imx board_lmb_reserve()
Marek Vasut [Fri, 10 Sep 2021 20:47:12 +0000 (22:47 +0200)]
lmb: Remove imx board_lmb_reserve()

This function is clearly architecture specific code, not board specific
code. The only difference from the previous arm arch_lmb_reserve() is the
extra reservation of 16k of memory below the stack bottom, rather than
the 4k. The common code now also uses 16k alignment. Remove this custom
implementation, as it now behaves exactly as the common code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Ye Li <ye.li@nxp.com>
3 years agolmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic()
Marek Vasut [Fri, 10 Sep 2021 20:47:11 +0000 (22:47 +0200)]
lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic()

According to input NXP, the 4k alignment is not always sufficient.
Currently iMX works around this problem by implementing board specific
LMB reservation, however it is likely this could also occur on other
systems. Increase the LMB reservation alignment to 16k by default.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agolmb: Switch to generic arch_lmb_reserve_generic()
Marek Vasut [Fri, 10 Sep 2021 20:47:10 +0000 (22:47 +0200)]
lmb: Switch to generic arch_lmb_reserve_generic()

Switch arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() to
arch_lmb_reserve_generic().

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
3 years agolmb: Add generic arch_lmb_reserve_generic()
Marek Vasut [Fri, 10 Sep 2021 20:47:09 +0000 (22:47 +0200)]
lmb: Add generic arch_lmb_reserve_generic()

The arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() implementations
are all mostly the same, except for a couple of details. Implement a
generic arch_lmb_reserve_generic() function which can be parametrized
enough to cater for those differences between architectures. This can
also be parametrized enough so it can handle cases where U-Boot is not
relocated to the end of DRAM e.g. because there is some other reserved
memory past U-Boot (e.g. unmovable firmware for coprocessor), it is not
relocated at all, and other such use cases.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agolmb: Always compile arch_lmb_reserve() into U-Boot on arc
Marek Vasut [Fri, 10 Sep 2021 20:47:08 +0000 (22:47 +0200)]
lmb: Always compile arch_lmb_reserve() into U-Boot on arc

The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
if CMD_BOOTM is not enabled. However, the arc variant of arch_lmb_reserve()
is only compiled in if CMD_BOOTM is enabled.

This currently does not trigger build error, because there is an empty
weak implementation of arch_lmb_reserve(), however that is not the
function that should be used on arc.

Fix this by moving the arch_lmb_reserve() implementation into common
code and always compile it in.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agolmb: Always compile arch_lmb_reserve() into U-Boot on arm
Marek Vasut [Fri, 10 Sep 2021 20:47:07 +0000 (22:47 +0200)]
lmb: Always compile arch_lmb_reserve() into U-Boot on arm

The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
if CMD_BOOT{I,M,Z} is not enabled. However, the arm32/arm64 variant of
arch_lmb_reserve() is only compiled in if CMD_BOOT{I,M,Z} is enabled.

This currently does not trigger build error, because there is an empty
weak implementation of arch_lmb_reserve(), however that is not the
function that should be used on arm32/arm64.

Fix this by moving the arch_lmb_reserve() implementation into common
code and always compile it in.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agoimage: add lz4 zstd compression magic map
Artem Lapkin [Tue, 31 Aug 2021 10:22:18 +0000 (18:22 +0800)]
image: add lz4 zstd compression magic map

Add lz4 and zstd compression magic map. Already can decompress images
with lz4 and zstd compression type.

Signed-off-by: Artem Lapkin <art@khadas.com>
3 years agocrc32: Add crc32 implementation using __builtin_aarch64_crc32b
Marek Vasut [Mon, 30 Aug 2021 13:05:23 +0000 (15:05 +0200)]
crc32: Add crc32 implementation using __builtin_aarch64_crc32b

ARMv8.0 has optional crc32 instruction for crc32 calculation. The
instruction is mandatory since ARMv8.1. The crc32 calculation is
faster using the dedicated instruction, e.g. 1.4 GHz iMX8MN gives:

  => time crc32 0x50000000 0x2000000
  time: 0.126 seconds # crc32 instruction
  time: 0.213 seconds # software crc32

Add implementation using the compiler builtin wrapper for the crc32
instruction and enable it by default, since we don't support any
platforms which do not implement this instruction.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
[trini: Make crc32_table guarded by CONFIG_ARM64_CRC32]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoarmv8/cache.S: Triple with single instruction
Pierre-Clément Tosi [Fri, 27 Aug 2021 16:04:10 +0000 (18:04 +0200)]
armv8/cache.S: Triple with single instruction

Replace the current 2-instruction 2-step tripling code by a
corresponding single instruction leveraging ARMv8-A's "flexible second
operand as a register with optional shift". This has the added benefit
(albeit arguably negligible) of reducing the final code size.

Fix the comment as the tripled cache level is placed in x12, not x0.

Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
3 years agoarmv8/cache.S: Read sysreg fields through ubfx
Pierre-Clément Tosi [Fri, 27 Aug 2021 16:03:45 +0000 (18:03 +0200)]
armv8/cache.S: Read sysreg fields through ubfx

Improve the file's readability and conciseness by using the appropriate
Aarch64 instruction: ubfx (unsigned bitfield extract). This makes the
code easier to follow as it directly manipulates the offsets and widths
of the fields read from system registers, as they are expressed in the
Standard (ARM ARM). This has the added benefit (albeit arguably
negligible) of reducing the final code size.

Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
3 years agoenv: Make _init() expect _INVALID when _IS_NOWHERE
Pierre-Clément Tosi [Thu, 12 Aug 2021 15:28:31 +0000 (15:28 +0000)]
env: Make _init() expect _INVALID when _IS_NOWHERE

Avoid applying the "fix" introduced by commit 5557eec01cbf ("env: Fix
invalid env handling in env_init()") to the environment "nowhere".

This is necessary as that commit, by setting the return value of
env_init() to -ENOENT if gd->env_valid is ENV_INVALID, forces that
function to reset gd->env_valid to ENV_VALID. By doing so, it breaks the
assumption (required by ENV_IS_NOWHERE) that gd->env_valid must be
ENV_INVALID.

This, in turn, results in env_relocate() calling env_load() (it should
not), which itself, calls U_BOOT_ENV_LOCATION(nowhere).load() i.e.
env_nowhere_load(). That function, being implemented under the
assumption mentioned above, calls env_set_default(), which in turn,
seeing that gd->env_valid is ENV_VALID (it should not), tries to
dereference whatever lies in gd->env_addr (most likely garbage), leading
to a faulty memory access.

Note that other env_locations might be concerned by this bug but that
this commit only intends to fix it for when ENV_IS_NOWHERE.

Fixes: 5557eec01cbf ("env: Fix invalid env handling in env_init()")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
3 years agoMerge tag 'u-boot-at91-2022.01-a' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 22 Sep 2021 18:55:16 +0000 (14:55 -0400)]
Merge tag 'u-boot-at91-2022.01-a' of https://source.denx.de/u-boot/custodians/u-boot-at91 into next

First set of u-boot-at91 features for the 2022.01 cycle:

This feature set includes : the support for CPU driver for arm926
(sam9x60 device); changes required for OP-TEE boot for sama5d2_xplained
and sama5d27_som1_ek boards; QSPI boot configuration for sama5d2_icp;
starting to remove old Kconfig unused symbols from config_whitelist.txt
(work will take more time); also small fixes and updates in mach, DT,
configs, etc.

3 years agoMerge branch '2021-09-22-general-updates' into next
Tom Rini [Wed, 22 Sep 2021 18:54:21 +0000 (14:54 -0400)]
Merge branch '2021-09-22-general-updates' into next

- Some sandbox improvements
- Make cleanups related to the overusage of the exact build time
  variable.

3 years agoARM: dts: at91: update flexcom defines using include file
Eugen Hristev [Fri, 27 Aug 2021 10:44:12 +0000 (13:44 +0300)]
ARM: dts: at91: update flexcom defines using include file

Replace the number in the flexcom-mode property with the define from the
include file.
This corresponds to the approach in Linux kernel.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoinclude: dt-bindings: mfd: add atmel flexcom include file
Eugen Hristev [Fri, 27 Aug 2021 10:44:11 +0000 (13:44 +0300)]
include: dt-bindings: mfd: add atmel flexcom include file

Add dt-bindings include file for Atmel Flexcom hardware block.
This file is copied from Linux kernel.
It is used in devicetrees from Linux.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agonet: remove unused CONFIG_DRIVER_AT91EMAC_*
Eugen Hristev [Wed, 25 Aug 2021 10:28:28 +0000 (13:28 +0300)]
net: remove unused CONFIG_DRIVER_AT91EMAC_*

AT91EMAC driver is unused, thus removing.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agoARM: at91: remove references to RM9200DK
Eugen Hristev [Wed, 25 Aug 2021 10:27:03 +0000 (13:27 +0300)]
ARM: at91: remove references to RM9200DK

The AT91 RM9200DK board was removed long time ago.
Remove existing references that were not cleaned up.

Fixes: 1c85752258 ("ARM: remove broken "at91rm9200dk" board")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoboard: pm926x: remove unused CONFIG_SYS_AT91_CPU_NAME
Eugen Hristev [Tue, 24 Aug 2021 13:02:33 +0000 (16:02 +0300)]
board: pm926x: remove unused CONFIG_SYS_AT91_CPU_NAME

CONFIG_SYS_AT91_CPU_NAME looks to be unused.
Remove it and remove it from config_whitelist.txt

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoboard: atmel: sama7g5ek: avoid rewriting of configured CONFIG_BOOTCOMMAND
Eugen Hristev [Thu, 19 Aug 2021 11:09:41 +0000 (14:09 +0300)]
board: atmel: sama7g5ek: avoid rewriting of configured CONFIG_BOOTCOMMAND

Rewrite the CONFIG_BOOTCOMMAND only if it's not previously configured from
defconfig file.
This allows the user to select from defconfig/menuconfig the desired
boot command.
Adjust the current board defconfigs to reflect the default booting command
for the specific ENV configuration.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoconfigs: sama5d2: add qspi config for QSPI1
Mihai Sain [Tue, 17 Aug 2021 10:29:25 +0000 (13:29 +0300)]
configs: sama5d2: add qspi config for QSPI1

Add new config for storing environment from QSPI1.

Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
[eugen.hristev@microchip.com: cleanup and add MAINTAINERS entry]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: sama5d2: fix dtc warning for ohci and ehci
Eugen Hristev [Tue, 17 Aug 2021 10:29:24 +0000 (13:29 +0300)]
ARM: dts: at91: sama5d2: fix dtc warning for ohci and ehci

Fixed the following DTC build warning (reproducible with W=1)

arch/arm/dts/at91-sama5d2_icp.dtb: Warning (unit_address_format): /ahb/ohci@00400000: unit name should not have leading 0s
arch/arm/dts/at91-sama5d2_icp.dtb: Warning (unit_address_format): /ahb/ehci@00500000: unit name should not have leading 0s

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Alexander Dahl <ada@thorsis.com>
3 years agoARM: dts: at91: sama5d2_icp: cosmetic arrangement of the nodes
Eugen Hristev [Tue, 17 Aug 2021 10:29:23 +0000 (13:29 +0300)]
ARM: dts: at91: sama5d2_icp: cosmetic arrangement of the nodes

Reorder the nodes following the kernel rules: nodes in a range are sorted
by ascending bus address, and when referenced by phandle, are ordered
alphabetically.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: sama5d2_icp: add QSPI1 device
Mihai Sain [Tue, 17 Aug 2021 10:29:22 +0000 (13:29 +0300)]
ARM: dts: at91: sama5d2_icp: add QSPI1 device

Add support for sst26vf064b 64Mbit qspi-flash that is
present on sama5d2_icp board.

Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
[eugen.hristev@microchip.com: move u-boot properties to sama5d2_icp-u-boot.dtsi]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoboard: sama5d2_xplained: Modify load addresses
Clément Léger [Mon, 16 Aug 2021 12:25:43 +0000 (14:25 +0200)]
board: sama5d2_xplained: Modify load addresses

When using OP-TEE, address range [0x20000000 - 0x22000000] is reserved.
This modification allows to have a system which always work even when
OP-TEE is present.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
3 years agoboard: sama5d2_xplained: Get dram size and base from device tree
Clément Léger [Mon, 16 Aug 2021 12:25:42 +0000 (14:25 +0200)]
board: sama5d2_xplained: Get dram size and base from device tree

In order to make it more flexible and allow modifying the base address
of DRAM without recompiling U-Boot, use memory node from device tree
with fdtdec functions.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
3 years agoARM: dts: at91: sama5d2_xplained: Add memory node in devicetree
Clément Léger [Mon, 16 Aug 2021 12:25:41 +0000 (14:25 +0200)]
ARM: dts: at91: sama5d2_xplained: Add memory node in devicetree

sama5d2_xplained DRAM detection code will be modified to use device tree
instead of hardcoded addresses. In order to prepare that, add the memory
node to at91-sama5d2_xplained.dts.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
3 years agoboard: sama5d27_som1_ek: Modify load addresses
Clément Léger [Mon, 16 Aug 2021 12:25:40 +0000 (14:25 +0200)]
board: sama5d27_som1_ek: Modify load addresses

When using OP-TEE, address range [0x20000000 - 0x22000000] is reserved.
This modification allows to have a system which always work even when
OP-TEE is present.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
3 years agoboard: sama5d27_som1_ek: Get dram size and base from device tree
Clément Léger [Mon, 16 Aug 2021 12:25:39 +0000 (14:25 +0200)]
board: sama5d27_som1_ek: Get dram size and base from device tree

In order to make it more flexible and allow modifying the base address
of DRAM without recompiling U-Boot, use memory node from device tree
with fdtdec functions.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
3 years agoARM: mach-at91: armv7: fix multiple cpu_reset definition when enabling SYSRESET
Clément Léger [Wed, 4 Aug 2021 14:55:44 +0000 (16:55 +0200)]
ARM: mach-at91: armv7: fix multiple cpu_reset definition when enabling SYSRESET

When SYSRESET is enabled, cpu_reset function is also defined in
sysreset-uclass.c which lead to multiple definitions of this function
since reset.c is build unconditionally. Add a check in Makefile to build
this file only if SYSRESET isn't enabled.
SYSRESET can be enabled when building SYSRESET_PSCI for instance on this
platform.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
3 years agoconfigs: gardena-smart-gateway-at91sam: Adjust to production values
Reto Schneider [Thu, 17 Jun 2021 16:57:37 +0000 (18:57 +0200)]
configs: gardena-smart-gateway-at91sam: Adjust to production values

This commit updates the default config with the values that will be used
soon on the Atmel / Microchip AT91SAM9G25 based GARDENA smart gateway.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoconfigs: sam9x60ek: enable CONFIG_CPU
Claudiu Beznea [Fri, 16 Jul 2021 05:43:51 +0000 (08:43 +0300)]
configs: sam9x60ek: enable CONFIG_CPU

Enable CONFIG_CPU for SAM9X60EK configs.

Reported-by: Eugen Hristev <eugen.hristev@microchip.com>
Fixes: a64862284f65 ("clk: at91: sam9x60: add support compatible with
CCF")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agoARM: dts: at91: sam9x60: add bindings for CPU
Claudiu Beznea [Fri, 16 Jul 2021 05:43:50 +0000 (08:43 +0300)]
ARM: dts: at91: sam9x60: add bindings for CPU

Add bindings for CPU. This will allow displaying correctly the crystal,
CPU and master clock.

Reported-by: Eugen Hristev <eugen.hristev@microchip.com>
Fixes: a64862284f65 ("clk: at91: sam9x60: add support compatible with
CCF")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agocpu: at91: add compatible for ARM9260EJ-S
Claudiu Beznea [Fri, 16 Jul 2021 05:43:49 +0000 (08:43 +0300)]
cpu: at91: add compatible for ARM9260EJ-S

The crystal, CPU and master clock were not displayed correctly on SAM9X60
after adding CCF clock support. Add compatible for ARM926EJ-S to fix
this.

Reported-by: Eugen Hristev <eugen.hristev@microchip.com>
Fixes: a64862284f65 ("clk: at91: sam9x60: add support compatible with CCF")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agoclk: at91: clk-master: split master clock in pres and divider
Claudiu Beznea [Fri, 16 Jul 2021 05:43:48 +0000 (08:43 +0300)]
clk: at91: clk-master: split master clock in pres and divider

Split master clock in 2 controlling block: one for prescaler one for
divider. This will allow referencing correctly the CPU clock and
master clock in device trees.

Reported-by: Eugen Hristev <eugen.hristev@microchip.com>
Fixes: a64862284f65 ("clk: at91: sam9x60: add support compatible with
CCF")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agoARM: at91: Add chip ID of SAMA5D29
Hari Prasath [Wed, 14 Jul 2021 13:43:41 +0000 (19:13 +0530)]
ARM: at91: Add chip ID of SAMA5D29

Add SAMA5D29 SoC for identification during the boot up.

Signed-off-by: Hari Prasath <Hari.PrasathGE@microchip.com>
3 years agoRemove including timestamp.h in version.h
Pali Rohár [Mon, 2 Aug 2021 13:18:38 +0000 (15:18 +0200)]
Remove including timestamp.h in version.h

Header file version.h does not use anything from timestamp.h. Including of
timestamp.h has side effect which cause recompiling object file at every
make run because timestamp.h changes at every run.

So remove timestamp.h from version.h and include timestamp.h in files
which needs it.

This change reduce recompilation time of final U-Boot binary when U-Boot
source files were not changed as less source files needs to be recompiled.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Add in lib/acpi/acpi_table.c and test/dm/acpi.c, rework a few others]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoversion: Remove global macro U_BOOT_VERSION_STRING from version.h
Pali Rohár [Mon, 2 Aug 2021 13:18:37 +0000 (15:18 +0200)]
version: Remove global macro U_BOOT_VERSION_STRING from version.h

Version string is available in global variable char version_string[].
Macro U_BOOT_VERSION_STRING is not used by any other file, so remove it
completely from version.h. Other files were already converted to use
variable version_string[].

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agox86: quark: MRC: Remove U_BOOT_DATE and U_BOOT_TIME from debug log
Pali Rohár [Mon, 2 Aug 2021 13:18:36 +0000 (15:18 +0200)]
x86: quark: MRC: Remove U_BOOT_DATE and U_BOOT_TIME from debug log

U_BOOT_DATE and U_BOOT_TIME are updated on every run of make command.
Therefore mrc.c file is recompiled every time when running make which means
that whole U-Boot binary is recompiled on every run of make command.

Simplify it and do not recompile U-Boot binary on every run of make command
by not depending on macros U_BOOT_DATE and U_BOOT_TIME.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoversion: Do not make version_string[] variable as a weak
Pali Rohár [Mon, 2 Aug 2021 13:18:35 +0000 (15:18 +0200)]
version: Do not make version_string[] variable as a weak

There is no platform which needs to overload version_string[] variable, so
remove weak symbol mark.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agopowerpc: Drop version_string placement optimization
Tom Rini [Thu, 16 Sep 2021 19:30:08 +0000 (15:30 -0400)]
powerpc: Drop version_string placement optimization

As explained by Wolfgang, historically PowerPC would do a number of
things to hand-optimize placement of the binary on NOR flash in order to
maximize utilization of very scarce resources.  These days, we simply
aren't optimizing our binary layout for NOR flash placement and it's
quite likely this wasn't working as intended.  Furthermore, this level
of optimization makes it difficult to have version_string be a global,
instead of a weak and overridden value, and so make more progress on
reproducible builds, which is a current concern.

Move to having PowerPC no longer store version_string in the early part
of text so that it might be part of the first page of NOR and instead
use the same declaration everyone else does.

Link: https://lore.kernel.org/r/96716.1629798400@gemini.denx.de/
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agom68k: mcf: Remove overloading version_string
Pali Rohár [Mon, 2 Aug 2021 13:18:32 +0000 (15:18 +0200)]
m68k: mcf: Remove overloading version_string

There is no need to overload version_string at the end of start.S files.
Common implementation of version_string should be fine.

Signed-off-by: Pali Rohár <pali@kernel.org>
[trini: Keep the align, it's important for the rest of linkage]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoversion: Move version_string[] from version.h to version_string.h
Pali Rohár [Mon, 2 Aug 2021 13:18:31 +0000 (15:18 +0200)]
version: Move version_string[] from version.h to version_string.h

More C files do not use compile time timestamp macros and do not have to be
recompiled every time when SOURCE_DATE_EPOCH changes.

This patch moves version_string[] from version.h to version_string.h and
updates other C files which only needs version_string[] string to include
version_string.h instead of version.h. After applying this patch these
files are not recompiled every time when SOURCE_DATE_EPOCH changes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoefi_loader: Use directly version_string variable
Pali Rohár [Mon, 2 Aug 2021 13:18:30 +0000 (15:18 +0200)]
efi_loader: Use directly version_string variable

Macro U_BOOT_VERSION_STRING is already stored in variable version_string.
So use directly this variable instead of storing U_BOOT_VERSION_STRING into
temporary variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
[trini: This area was reworked since posted, what is here is now really
        inspired by the previous version, so drop Ilias' Acked-by]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoRemove #include <version.h> from files which do not need it
Pali Rohár [Mon, 2 Aug 2021 13:18:29 +0000 (15:18 +0200)]
Remove #include <version.h> from files which do not need it

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoRemove #include <timestamp.h> from files which do not need it
Pali Rohár [Mon, 2 Aug 2021 13:18:28 +0000 (15:18 +0200)]
Remove #include <timestamp.h> from files which do not need it

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agom68k: Add missing ENTRY entry in linker script
Tom Rini [Fri, 17 Sep 2021 16:05:20 +0000 (12:05 -0400)]
m68k: Add missing ENTRY entry in linker script

Currently, there is no ENTRY() entry in the m68k linker script.
However, since they currently contain a version_string symbol, which
then overrides the default weak version_string symbol, the linker
decides we must keep start.o in the resulting link.  Add an ENTRY() line
so that the linker will know to keep this, even when version_string is
no longer provided in start.S

Cc: Huan Wang <alison.wang@nxp.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agotest: Add a way to skip console checking until a string matches
Simon Glass [Thu, 19 Aug 2021 03:40:33 +0000 (21:40 -0600)]
test: Add a way to skip console checking until a string matches

Some tests produce a lot of output that does not need to be individually
checked by an assertion. Add a macro to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Add a way to map a file into memory
Simon Glass [Thu, 19 Aug 2021 03:40:31 +0000 (21:40 -0600)]
sandbox: Add a way to map a file into memory

It is useful to map a file into memory so that it can be accessed using
simple pointers. Add a function to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Add a way to find the size of a file
Simon Glass [Thu, 19 Aug 2021 03:40:30 +0000 (21:40 -0600)]
sandbox: Add a way to find the size of a file

Add a function to return the size of a file. This is useful in situations
where we need to allocate memory for it before reading it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
3 years agodm: core: Fix a few incorrect comments on first/next functions
Simon Glass [Thu, 19 Aug 2021 03:40:29 +0000 (21:40 -0600)]
dm: core: Fix a few incorrect comments on first/next functions

Tighten up these comments to make the behaviour clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Tidy a comment in the bloblist test
Simon Glass [Thu, 19 Aug 2021 03:40:28 +0000 (21:40 -0600)]
test: Tidy a comment in the bloblist test

Fix up a copy error.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosqfs: Suppress the message about missing filesystem
Simon Glass [Thu, 19 Aug 2021 03:40:27 +0000 (21:40 -0600)]
sqfs: Suppress the message about missing filesystem

This message comes up a lot when scanning filesystems. It suggests to the
user that there is some sort of error, but in fact there is no reason to
expect that a particular partition has a sqfs filesystem. Other
filesystems don't print this error.

Turn it into a debug message.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
3 years agobtrfs: Suppress the message about missing filesystem
Simon Glass [Thu, 19 Aug 2021 03:40:26 +0000 (21:40 -0600)]
btrfs: Suppress the message about missing filesystem

This message comes up a lot when scanning filesystems. It suggests to the
user that there is some sort of error, but in fact there is no reason to
expect that a particular partition has a btrfs filesystem. Other
filesystems don't print this error.

Turn it into a debug message.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Qu Wenruo <wqu@suse.com>
3 years agosandbox: Add license headers to the dts files
Simon Glass [Thu, 19 Aug 2021 03:40:25 +0000 (21:40 -0600)]
sandbox: Add license headers to the dts files

Many of these files are missing a header. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Correct handling of --rm_memory
Simon Glass [Thu, 19 Aug 2021 03:40:24 +0000 (21:40 -0600)]
sandbox: Correct handling of --rm_memory

This option has no argument so we should not trip to skip one.

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Further improve documentation about warnings
Simon Glass [Thu, 19 Aug 2021 03:40:23 +0000 (21:40 -0600)]
dtoc: Further improve documentation about warnings

Split this information into subsections and expand it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoscripts/config_whitelist.txt: Fix after merging
Tom Rini [Thu, 16 Sep 2021 17:18:21 +0000 (13:18 -0400)]
scripts/config_whitelist.txt: Fix after merging

CONFIG_SPIFLASH is manually re-added as it is not a new symbol, but now
only exists in CONFIG_SYS_EXTRA_OPTIONS.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agopci: Fix mismerge with v2021.10-rc4
Tom Rini [Thu, 16 Sep 2021 15:45:03 +0000 (11:45 -0400)]
pci: Fix mismerge with v2021.10-rc4

With legacy PCI code removed and thus DM_PCI also removed, a few places
did not get correctly updated with the merge to next and thus broke.
Remove now extraneous dependencies on DM_PCI.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'v2021.10-rc4' into next
Tom Rini [Thu, 16 Sep 2021 14:29:40 +0000 (10:29 -0400)]
Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg:                using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt

3 years agoPrepare v2021.10-rc4
Tom Rini [Tue, 14 Sep 2021 22:58:10 +0000 (18:58 -0400)]
Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Tue, 14 Sep 2021 22:48:05 +0000 (18:48 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoimage: Avoid erroneous double byte-swap in CRC value
Alexandru Gagniuc [Tue, 14 Sep 2021 20:53:33 +0000 (15:53 -0500)]
image: Avoid erroneous double byte-swap in CRC value

The hash algorithm selection was streamlined in commit 92055e138f28
("image: Drop if/elseif hash selection in calculate_hash()"). Said
commit kept the call to cpu_to_uimage() to convert the CRC to big
endian format.

This would have been correct when calling crc32_wd(). However, the
->hash_func_ws member of crc32 points to crc32_wd_buf(), which already
converts the CRC to big endian. On a little endian host, doing both
conversions results in a little-endian CRC. This is incorrect.

To remedy this, simply drop the call to cpu_to_uimage(), thus only
doing the byte-order conversion once.

Fixes: 92055e138f28 ("image: Drop if/elseif hash selection in
       calculate_hash()")
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agoMerge branch '2021-09-14-assorted-fixes'
Tom Rini [Tue, 14 Sep 2021 19:47:07 +0000 (15:47 -0400)]
Merge branch '2021-09-14-assorted-fixes'

- Assorted bugfixes

3 years agoimage: rsa: Move padding_algos to linker lists
Alexandru Gagniuc [Wed, 18 Aug 2021 22:49:02 +0000 (17:49 -0500)]
image: rsa: Move padding_algos to linker lists

We are not guaranteed to have the padding_pkcs_15_verify symbol since
commit 92c960bc1d ("lib: rsa: Remove #ifdefs from rsa.h"), and
commit 61416fe9df ("Kconfig: FIT_SIGNATURE should not select RSA_VERIFY")

The padding_algos only make sense with RSA verification, which can now
be disabled in lieu of ECDSA. In fact this will lead to build failures
because of the missing symbol mentioned earlier.

To resolve this, move the padding_algos to a linker list, with
declarations moved to rsa_verify.c. This is consistent with commit
6909edb4ce ("image: rsa: Move verification algorithm to a linker list")

One could argue that the added #ifdef USE_HOSTCC is ugly, and should
be hidden within the U_BOOT_PADDING_ALGO() macro. However, this would
be inconsistent with the "cryptos" list. This logic for was not
previously explored:

Without knowledge of the U_BOOT_PADDING_ALGO() macro, its use is
similar to something being declared. However, should #ifndef
USE_HOSTCC be part of the macro, it would not be obvious that it
behaves differently on host code and target code. Having the #ifndef
outside the macro makes this obvious.

Also, the #ifdef is not always necessary. For example ecda-verify
makes use of U_BOOT_CRYPTO_ALGO() without any accompanying #ifdefs.
The fundamental issue is a lack of separation of host and target code
in rsa_verify. Therefore, the declaration of a padding algo with the
external #ifdef is more readable and consistent.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agopinctrl: fix typo
Yuan Fang [Wed, 8 Sep 2021 11:06:48 +0000 (19:06 +0800)]
pinctrl: fix typo

fix typo in pinctrl Kconfig file to avoid git commit failure on
some commit hooks check.

Signed-off-by: Yuan Fang <fangyuanseu@gmail.com>
3 years agolib: fix typos in Kconfig
Oleksandr Suvorov [Wed, 1 Sep 2021 13:05:08 +0000 (16:05 +0300)]
lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agolib/rsa: don't use NULL as key_id
Heinrich Schuchardt [Sat, 28 Aug 2021 10:13:05 +0000 (12:13 +0200)]
lib/rsa: don't use NULL as key_id

If keydir is not provided but name is we want to use name as key_id.

But with the current coding name is only used on its own if it is NULL
and keydir is provided which never occurs.

Fixes: 824ee745fbca ("lib/rsa: Use the 'keyfile' argument from mkimage")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Tue, 14 Sep 2021 01:03:36 +0000 (21:03 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

- a fix for U-Boot 2021.10 to bring back MMC boot on older boards.

3 years agosunxi: mmc: A20: Fix MMC optimisation
Andre Przywara [Fri, 3 Sep 2021 15:49:16 +0000 (16:49 +0100)]
sunxi: mmc: A20: Fix MMC optimisation

Some SoCs (as seen on A20) seem to misreport the MMC FIFO level if the
FIFO is completely full: the level size reads as zero, but the FIFO_FULL
bit is set. We won't do a single iteration of the read loop in this
case, so will be stuck forever.

Check for this situation and use a safe minimal FIFO size instead when
we hit this case.

This fixes MMC boot on A20 devices after the MMC FIFO optimisation
(9faae5457f52).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>