platform/kernel/u-boot.git
18 months agoMerge branch '2023-01-12-further-assorted-general-updates'
Tom Rini [Thu, 12 Jan 2023 22:05:41 +0000 (17:05 -0500)]
Merge branch '2023-01-12-further-assorted-general-updates'

- Bring in a number of assorted updates, some of which have been waiting
  around for a bit.  Make silent console really be silent, get rid of
  gpio_hog_probe_all, add RNG for imx6, make net/fm use fs_loader, get
  rid of a bad __weak usage and set distro_bootpart_uuid in another case.

18 months agogpio: Get rid of gpio_hog_probe_all()
Marek Vasut [Thu, 22 Sep 2022 15:53:26 +0000 (17:53 +0200)]
gpio: Get rid of gpio_hog_probe_all()

The gpio_hog_probe_all() functionality can be perfectly well replaced by
DM_FLAG_PROBE_AFTER_BIND DM flag, which would trigger .probe() callback
of each GPIO hog driver instance after .bind() and thus configure the
hogged GPIO accordingly.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
18 months agodm: fix probing of all devices that have u-boot, dm-pre-reloc in SPL/TPL
Quentin Schulz [Thu, 22 Sep 2022 15:53:25 +0000 (17:53 +0200)]
dm: fix probing of all devices that have u-boot, dm-pre-reloc in SPL/TPL

Currently, dm_probe_devices checks that the flags of the device contains
DM_FLAG_PRE_RELOC. However DM_FLAG_PRE_RELOC is a driver - and not a
device - flag. This means that the check in pre_reloc_only mode would
always fail.

Instead, what was aimed to be checked is that either the driver of the
device has the flag set, or that the device has the u-boot,dm-pre-reloc
Device Tree property set.

So let's fix the check to allow u-boot,dm-pre-reloc devices to be
probed.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
18 months agodistro_bootcmd: Set distro_bootpart_uuid for block devices
Marek Vasut [Thu, 5 Jan 2023 13:08:23 +0000 (14:08 +0100)]
distro_bootcmd: Set distro_bootpart_uuid for block devices

The assignment of block device nodes in Linux is not deterministic by
default, i.e. a newly added eMMC controller or other block device can
change the assignment of /dev/mmcblkN (or other block device node like
e.g. /dev/sdXy) and prevent the system from picking the correct block
device for root filesystem in case the root filesystem is specified on
kernel command line using 'root=/dev/mmcblkNpM' (or 'root=/dev/sdXy'
etc.).

One way out is to derive PARTUUID in U-Boot, which is unique identifier
of a partition, and pass that as root=PARTUUID=<partuuid> to Linux via
kernel command line. Linux would then find the partition using PARTUUID,
no matter on which block device the partition resides and which node was
assigned to that block device.

Derive the PARTUUID before scanning for extlinux presence and assign it
into distro_bootpart_uuid environment variable, which can then be used
in extlinux.conf kernel command line specifier.

Note that it is not possible to do this in scan_dev_for_extlinux script
because this script is called from scan_dev_for_boot script, which is
called for both block devices as well as UBI volumes, and we can not
derive PARTUUID for UBI volumes.

Signed-off-by: Marek Vasut <marex@denx.de>
18 months agoRevert "time: add weak annotation to timer_read_counter declaration"
Harald Seiler [Thu, 5 Jan 2023 00:08:47 +0000 (01:08 +0100)]
Revert "time: add weak annotation to timer_read_counter declaration"

This reverts commit 65ba7add0d609bbd035b8d42fafdaf428ac24751.

A weak extern is a nasty sight to behold: If the symbol is never
defined, on ARM, the linker will replace the function call with a NOP.
This behavior isn't well documented but there are at least some hints
to it [1].

When timer_read_counter() is not defined, this obviously does the wrong
thing here and it does so silently.  The consequence is that a board
without timer_read_counter() will sleep for random amounts and generally
have erratic get_ticks() values.

Drop the __weak annotation of the extern so a linker error is raised
when timer_read_counter() is not defined.  This is okay, the original
reason for the reverted change - breaking the sandbox build - no longer
applies.

Final sidenote:  This was the only weak extern in the entire tree at
this time as far as I can tell.  I guess we should avoid introduction of
them again as they are obviously a very big footgun.

[1]: https://stackoverflow.com/questions/31203402/gcc-behavior-for-unresolved-weak-functions

Fixes: 65ba7add0d60 ("time: add weak annotation to timer_read_counter declaration")
Reported-by: Serge Bazanski <q3k@q3k.org>
Signed-off-by: Harald Seiler <hws@denx.de>
18 months agonet: fm: Support loading firmware from a filesystem
Sean Anderson [Thu, 29 Dec 2022 16:53:01 +0000 (11:53 -0500)]
net: fm: Support loading firmware from a filesystem

This adds a new method to load Fman firmware from a filesystem. This
allows users to use regular files instead of hard-coded offsets for the
firmware.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
18 months agonet: fm: Add firmware name parameter
Sean Anderson [Thu, 29 Dec 2022 16:53:00 +0000 (11:53 -0500)]
net: fm: Add firmware name parameter

In order to read the firmware from the filesystem, we need a file name.
Read the firmware name from the device tree, using the firmware-name
property. This property is commonly used in Linux to determine the
correct name to use (and can be seen in several device trees in U-Boot).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
18 months agomisc: fs_loader: Add function to get the chosen loader
Sean Anderson [Thu, 29 Dec 2022 16:52:59 +0000 (11:52 -0500)]
misc: fs_loader: Add function to get the chosen loader

The fs_loader device is used to pull in settings via the chosen node.
However, there was no library function for this, so arria10 was doing it
explicitly. This function subsumes that, and uses ofnode_get_chosen_node
instead of navigating the device tree directly. Because fs_loader pulls
its config from the environment by default, it's fine to create a device
with nothing backing it at all. Doing this allows enabling
CONFIG_FS_LOADER without needing to modify the device tree.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
18 months agoAdded configs required for dcp_rng driver
Kshitiz Varshney [Thu, 22 Dec 2022 08:50:29 +0000 (09:50 +0100)]
Added configs required for dcp_rng driver

This commit adds configs required for using dcp_rng driver in imx6ull
defconfig files.

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
18 months agoAdded dcp_rng driver initialization code
Kshitiz Varshney [Thu, 22 Dec 2022 08:50:28 +0000 (09:50 +0100)]
Added dcp_rng driver initialization code

This commit initializes dcp_rng device driver inside
arch_misc_init() function.

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
18 months agoUboot RNG Driver using Data Co-processor
Kshitiz Varshney [Thu, 22 Dec 2022 08:50:27 +0000 (09:50 +0100)]
Uboot RNG Driver using Data Co-processor

This commit introduces Random number generator to uboot. It uses DCP
driver for number generation.
RNG driver can be invoked by using below command on uboot prompt:-
           rng <number of bytes>

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocommon: spl: ram: fix return code
Nikita Shubin [Mon, 12 Dec 2022 08:03:35 +0000 (11:03 +0300)]
common: spl: ram: fix return code

Instead of always retuning success, return actual result of
load_simple_fit_image or spl_parse_image_header, otherwise we
might end up jumping on uninitialized spl_image->entry_point.

Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
Reviewed-by: Stefan Roese <sr@denx.de>
18 months agocmd: spi: Judge the number of added parameters
chenzhipeng [Tue, 6 Dec 2022 09:24:38 +0000 (17:24 +0800)]
cmd: spi: Judge the number of added parameters

When only sspi is entered, help information can be printed.

Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoconsole: Add option to keep it silent until env is loaded
Harald Seiler [Wed, 6 Jul 2022 11:19:10 +0000 (13:19 +0200)]
console: Add option to keep it silent until env is loaded

Add a config-option which forces the console to stay silent until the
proper environment is loaded from flash.

This is important when the default environment does not silence the
console but no output must be printed when 'silent' is set in the flash
environment.

After the environment from flash is loaded, the console will be
silenced/unsilenced depending on it.  If PRE_CONSOLE_BUFFER is also
used, the buffer will now be flushed if the console should not be
silenced.

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoMerge branch '2023-01-11-assorted-general-updates'
Tom Rini [Thu, 12 Jan 2023 15:15:24 +0000 (10:15 -0500)]
Merge branch '2023-01-11-assorted-general-updates'

- Assorted Kconfig cleanups, code clean ups, env+ubi updates, correct
  return value propagation out of environment scripts, and update CI to
  latest "jammy" tag.

18 months agoCI/Docker: Update to jammy-20221130 tag
Tom Rini [Wed, 11 Jan 2023 17:24:57 +0000 (12:24 -0500)]
CI/Docker: Update to jammy-20221130 tag

Update to the latest "jammy" tag. This requires us to list libc6-i386 as
a required package to install (for nokia_rx51 tests) that was previously
implicit.

Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agoUse `grep -E` or plain `grep` instead of `egrep`
Ville Skyttä [Sun, 1 Jan 2023 16:41:42 +0000 (18:41 +0200)]
Use `grep -E` or plain `grep` instead of `egrep`

`egrep` has been deprecated in GNU grep since 2007,
and since 3.8 it emits obsolescence warnings:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
Acked-by: Dhruva Gole <d-gole@ti.com>
18 months agoKconfig: move NXP specific stuff into a sub-menu
Heinrich Schuchardt [Fri, 30 Dec 2022 23:08:47 +0000 (00:08 +0100)]
Kconfig: move NXP specific stuff into a sub-menu

Having NXP specific items in the main menu is confusing. Especially
the comment line

   *** Other functionality shared between NXP SoCs ***

is simply misleading.

Move all NXP stuff into a separate sub-menu.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agoKconfig: clean up skipping low-level initialization
Heinrich Schuchardt [Fri, 30 Dec 2022 18:41:28 +0000 (19:41 +0100)]
Kconfig: clean up skipping low-level initialization

Put all entries for skipping low-level initialization into a sub-menu.
Use different titles for main U-Boot, SPL, TPL.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agoDockerfile: add package texinfo
Heinrich Schuchardt [Fri, 30 Dec 2022 04:41:01 +0000 (05:41 +0100)]
Dockerfile: add package texinfo

In preparation of adding the infodocs target to our CI install the
prerequisite texinfo software package.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agofs/btrfs: handle data extents, which crosss stripe boundaries, correctly
Qu Wenruo [Fri, 30 Dec 2022 01:07:05 +0000 (09:07 +0800)]
fs/btrfs: handle data extents, which crosss stripe boundaries, correctly

[BUG]
Since btrfs supports single device RAID0 at mkfs time after btrfs-progs
v5.14, if we create a single device raid0 btrfs, and created a file
crossing stripe boundary:

  # mkfs.btrfs -m dup -d raid0 test.img
  # mount test.img mnt
  # xfs_io -f -c "pwrite 0 128K" mnt/file
  # umount mnt

Since btrfs is using 64K as stripe length, above 128K data write is
definitely going to cross at least one stripe boundary.

Then u-boot would fail to read above 128K file:

 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >     131072  Fri Dec 30 00:18:25 2022  file
 => load host 0 0 file
 BTRFS: An error occurred while reading file file
 Failed to load 'file'

[CAUSE]
Unlike tree blocks read, data extent reads doesn't consider cases in which
one data extent can cross stripe boundary.

In read_data_extent(), we just call btrfs_map_block() once and read the
first mapped range.

And if the first mapped range is smaller than the desired range, it
would return error.

But since even single device btrfs can utilize RAID0 profiles, the first
mapped range can only be at most 64K for RAID0 profiles, and cause false
error.

[FIX]
Just like read_whole_eb(), we should call btrfs_map_block() in a loop
until we read all data.

Since we're here, also add extra error messages for the following cases:

- btrfs_map_block() failure
  We already have the error message for it.

- Missing device
  This should not happen, as we only support single device for now.

- __btrfs_devread() failure

With this bug fixed, btrfs driver of u-boot can properly read the above
128K file, and have the correct content:

 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >     131072  Fri Dec 30 00:18:25 2022  file
 => load host 0 0 file
 131072 bytes read in 0 ms
 => md5sum 0 0x20000
 md5 for 00000000 ... 0001ffff ==> d48858312a922db7eb86377f638dbc9f
 ^^^ Above md5sum also matches.

Reported-by: Sam Winchenbach <swichenbach@tethers.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
18 months agoata: Fix dependency for CONFIG_SATA_SIL
Pali Rohár [Thu, 29 Dec 2022 17:15:35 +0000 (18:15 +0100)]
ata: Fix dependency for CONFIG_SATA_SIL

sata_sil.c is PCI driver and without CONFIG_PCI is building of U-Boot failing:

      LD      u-boot
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_exec_cmd':
    drivers/ata/sata_sil.c:148: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_pci_probe':
    drivers/ata/sata_sil.c:687: undefined reference to `dm_pci_get_bdf'
    ld.bfd: drivers/ata/sata_sil.c:691: undefined reference to `dm_pci_read_config16'
    ld.bfd: drivers/ata/sata_sil.c:701: undefined reference to `dm_pci_map_bar'
    ld.bfd: drivers/ata/sata_sil.c:704: undefined reference to `dm_pci_map_bar'
    ld.bfd: drivers/ata/sata_sil.c:713: undefined reference to `dm_pci_write_config16'
    ld.bfd: drivers/ata/sata_sil.c:717: undefined reference to `dm_pci_read_config16'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_cmd_identify_device':
    drivers/ata/sata_sil.c:256: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_sata_rw_cmd':
    drivers/ata/sata_sil.c:330: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_sata_rw_cmd_ext':
    drivers/ata/sata_sil.c:377: undefined reference to `dm_pci_phys_to_bus'
    make: *** [Makefile:1778: u-boot] Error 1

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
18 months agotest: compression: use ut_assert for errors
Brandon Maier [Wed, 28 Dec 2022 22:53:52 +0000 (16:53 -0600)]
test: compression: use ut_assert for errors

Use the ut_assert macros for more useful error messages.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agotest: compression: check with trailing garbage in input
Brandon Maier [Wed, 28 Dec 2022 22:53:51 +0000 (16:53 -0600)]
test: compression: check with trailing garbage in input

The Linux kernel appends 4 bytes to the end of compressed kernel Images
containing the uncompressed image size. They are used to make
self-decompressing Images easier. However for archs that don't support
self-decompression, like ARM64, U-Boot must be able to decompress the
image with the garbage data.

The existing decompressors already support this. This unit test was
added while working on zstd support as upstream zstd will error if there
is garbage data in the input buffer, and special care was needed to
support this.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agofs/squashfs: Only use export table if available
David Oberhollenzer [Sun, 25 Dec 2022 10:05:24 +0000 (11:05 +0100)]
fs/squashfs: Only use export table if available

For a squashfs filesystem, the fragment table is followed by
the following tables: NFS export table, ID table, xattr table.

The export and xattr tables are both completely optional, but
the ID table is mandatory. The Linux implementation refuses to
mount the image if the ID table is missing. Tables that are no
present have their location in the super block set
to 0xFFFFFFFFFFFFFFFF.

The u-boot implementation previously assumed that it can always
rely on the export table location as an upper bound for the fragment
table, trying (and failing) to read past filesystem bounds if it
is not present.

This patch changes the driver to use the ID table instead and only
use the export table location if it lies between the two.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
18 months agotest: cmd: exit: Add unit test for exit and partly run commands
Marek Vasut [Tue, 20 Dec 2022 06:26:00 +0000 (07:26 +0100)]
test: cmd: exit: Add unit test for exit and partly run commands

Add a test which validates that exit from environment script works as
expected, including return value propagation and clipping to positive
integers.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
18 months agocmd: exit: Fix return value propagation out of environment scripts
Marek Vasut [Tue, 20 Dec 2022 06:25:59 +0000 (07:25 +0100)]
cmd: exit: Fix return value propagation out of environment scripts

Make sure the 'exit' command as well as 'exit $val' command exits
from environment scripts immediately and propagates return value
out of those scripts fully. That means the following behavior is
expected:

"
=> setenv foo 'echo bar ; exit 1' ; run foo ; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2' ; run foo ; echo $?
bar
0
"

As well as the followin behavior:

"
=> setenv foo 'echo bar ; exit 3 ; echo fail'; run foo; echo $?
bar
3
=> setenv foo 'echo bar ; exit 1 ; echo fail'; run foo; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -1 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit ; echo fail'; run foo; echo $?
bar
0
"

Fixes: 8c4e3b79bd0 ("cmd: exit: Fix return value")
Reviewed-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Marek Vasut <marex@denx.de>
18 months agofastboot: Add OEM run command
Sean Anderson [Fri, 16 Dec 2022 18:20:16 +0000 (13:20 -0500)]
fastboot: Add OEM run command

This adds the UUU UCmd functionality as an OEM command. While the
fastboot tool allows sending arbitrary commands as long as they are
prefixed with "oem". This allows running generic U-Boot commands over
fastboot without UUU, which is especially useful when not using USB.
This is really the route we should have gone in the first place when
adding these commands.

While we're here, clean up the UUU Kconfig a bit.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
18 months agofastboot: remove #ifdef CONFIG when it is possible
Patrick Delaunay [Thu, 15 Dec 2022 09:15:50 +0000 (10:15 +0100)]
fastboot: remove #ifdef CONFIG when it is possible

Much of the fastboot code predates the introduction of Kconfig and
has quite a few #ifdefs in it which is unnecessary now that we can use
IS_ENABLED() et al.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
18 months agooptee: bind the TA drivers on OP-TEE node
Patrick Delaunay [Thu, 15 Dec 2022 08:54:52 +0000 (09:54 +0100)]
optee: bind the TA drivers on OP-TEE node

In U-Boot driver model the devices can be referenced by
phandle in the U-Boot configuration nodes.

Without a valid node provided during the bind, the driver
associated to OP-TEE TA can't be referenced.

For example to force the sequence number with alias
(.flags = DM_UC_FLAG_SEQ_ALIAS)

  aliases {
rng0 = &optee;
  };

or other configuration:

board-sysinfo {
   compatible = "vendor,sysinfo-board";
   ramdom = <&optee>;
}

With this patch all drivers bound from OP-TEE service
discovery are now associated are associated to OP-TEE
node, allowing to identify by phandle the driver
provided by the TA for one UCLASS without modifying
device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: add failing trace in env_erase
Patrick Delaunay [Wed, 14 Dec 2022 15:51:32 +0000 (16:51 +0100)]
env: add failing trace in env_erase

Add trace in env save to indicate any errors to end user and avoid
silent output when the command 'env erase' is not executed as it is
done in env_save with commit 8968288cb477 ("env: add failing trace in
env_save")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
18 months agoenv: ubi: add support of command env erase
Patrick Delaunay [Wed, 14 Dec 2022 15:51:31 +0000 (16:51 +0100)]
env: ubi: add support of command env erase

Add support of opts erase for ubi env backend, this opts is used by
command 'env erase'.

This command only zero-fill the env UBI volume CONFIG_ENV_UBI_VOLUME
and CONFIG_ENV_UBI_VOLUME_REDUND, so the saved environment becomes
invalid.

This patch introduces a local define ENV_UBI_VOLUME_REDUND
only to avoid #if in the code, as CONFIG_ENV_UBI_VOLUME_REDUND
is only defined when CONFIG_SYS_REDUNDAND_ENVIRONMENT is defined.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
18 months agotest: env: add test for u-boot-initial-env creation
Max Krummenacher [Fri, 9 Dec 2022 12:09:56 +0000 (13:09 +0100)]
test: env: add test for u-boot-initial-env creation

Checks that `make u-boot-initial-env` creates the text file
u-boot-initial-env and checks that it at least contains
`board=<something>`.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocmd: change the return value when argc error
Shenlin Liang [Fri, 9 Dec 2022 09:17:43 +0000 (17:17 +0800)]
cmd: change the return value when argc error

When the number of parameters is wrong, the return value should be processed in
the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT
Patrick Delaunay [Thu, 8 Dec 2022 08:10:13 +0000 (09:10 +0100)]
cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT

The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
allows the MTDIDS and MTDPARTS to be configured at runtime.

This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
is only used by two platforms (stm32mp and igep00x0) which don't define
CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.

This patch solves an UBI environment load issue for NAND boot for
stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
env_get_f() return a EMPTY string, define in default_environment[]
because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
but a NULL pointer is expected to allow call of board_mtdparts_default.
Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].

It is not a problem when env becomes ready, as these empty variables are
removed form U-Boot environment in env_import() / himport_r().

Fixes: a331017c237c ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agolib: rsa: cosmetic: fix building warning
Haijun Qin [Tue, 6 Dec 2022 07:41:37 +0000 (15:41 +0800)]
lib: rsa: cosmetic: fix building warning

add initialization of variable 'node',this can aviod the building
warning:

    'node' may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Haijun Qin <qinhaijun@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoreboot-mode: Add NVMEM reboot mode
Sean Anderson [Fri, 2 Dec 2022 16:03:53 +0000 (11:03 -0500)]
reboot-mode: Add NVMEM reboot mode

This adds an NVMEM reboot mode driver, similar to Linux's
implementation. This allows using the same device tree binding for Linux
and U-Boot in most cases.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agortc: abx8xx: Add support for reading RAM
Sean Anderson [Fri, 2 Dec 2022 15:35:19 +0000 (10:35 -0500)]
rtc: abx8xx: Add support for reading RAM

This adds support for reading the battery-backed memory present on these
RTCs. This modifies the read/write methods to access the RAM instead of
raw register offsets. No one was using these in-tree, so we should be
fine changing them.

We use the "standard" address space window to access the RAM. The
extension RAM address register has some reserved bits, but we write the
whole thing for simplicity (as these bits default to 0).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
18 months agocommon:autoboot:modify function parameters
Shenlin Liang [Fri, 2 Dec 2022 04:53:48 +0000 (12:53 +0800)]
common:autoboot:modify function parameters

the blob parameter of the function process_fdt_options has not been
invoked in the function body and should be changed to void type

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoMerge branch '2023-01-10-platform-updates'
Tom Rini [Wed, 11 Jan 2023 02:13:57 +0000 (21:13 -0500)]
Merge branch '2023-01-10-platform-updates'

- Platform updates for TI, nuvoton pinctrl, starqltechn/sdm845 fixes,
  and assorted platform CONFIG_BUILD_TARGET corrections

18 months agoARM: omap3: evm: Name this directory omap3evm
Andrew Davis [Fri, 6 Jan 2023 19:05:14 +0000 (13:05 -0600)]
ARM: omap3: evm: Name this directory omap3evm

Before this was named just evm, which doesn't match the naming
of the other TI board file directory and makes it look like a
common directory for evms. Name this omap3evm.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Derald Woods <woods.technical@gmail.com>
18 months agopowerpc/mpc85xx: Unset CONFIG_SPL_TARGET="u-boot-with-spl.bin"
Pali Rohár [Thu, 29 Dec 2022 01:39:21 +0000 (02:39 +0100)]
powerpc/mpc85xx: Unset CONFIG_SPL_TARGET="u-boot-with-spl.bin"

CONFIG_SPL_TARGET should specify additional SPL make target. But
u-boot-with-spl.bin is final U-Boot binary, not SPL binary in some custom
format. Moreover u-boot-with-spl.bin is already set in CONFIG_BUILD_TARGET,
so make will build it by default.

Signed-off-by: Pali Rohár <pali@kernel.org>
18 months agopowerpc/mpc85xx: Set default CONFIG_BUILD_TARGET
Pali Rohár [Thu, 29 Dec 2022 01:39:20 +0000 (02:39 +0100)]
powerpc/mpc85xx: Set default CONFIG_BUILD_TARGET

Final U-Boot binary for mpc85xx boards which use SPL and are not PBL-based
based is u-boot-with-spl.bin. PBL is not used only on boards with e500v1
and e500v2 cores. Apparently CONFIG_E500 is set not only for e500 cores,
but also for all other mpc85xx cores e500mc, e5500 and e5600. So do not use
CONFIG_E500 and instead filter new cores with PBL based bootrom.

Signed-off-by: Pali Rohár <pali@kernel.org>
18 months agoarm: mvebu: Fix default CONFIG_BUILD_TARGET
Pali Rohár [Thu, 29 Dec 2022 01:39:19 +0000 (02:39 +0100)]
arm: mvebu: Fix default CONFIG_BUILD_TARGET

u-boot-with-spl.kwb is built only for SPL enabled 32-bit armada boards.
u-boot.kwb is built for 32-bit armada and kirkwood boards but only for
non-SPL targets.

So replace CONFIG_ARCH_MVEBU by CONFIG_ARMADA_32BIT (it implies
CONFIG_ARCH_MVEBU) for u-boot-with-spl.kwb.

And add additional CONFIG_ARMADA_32BIT && !CONFIG_SPL for u-boot.kwb.

Signed-off-by: Pali Rohár <pali@kernel.org>
18 months agoSoC: sdm845: find and save KASLR to env variables
Dzmitry Sankouski [Tue, 27 Dec 2022 19:47:09 +0000 (22:47 +0300)]
SoC: sdm845: find and save KASLR to env variables

KASLR address is needed to boot fully functional Android.
KASLR is set by primary bootloader, and since u-boot is used
as a secondary bootloader(replacing kernel) on sdm845 platform,
KASLR may be found by comparing memory chunks at relocaddr over
supposed KASLR range.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
18 months agoboard: starqltechn: enable serial console
Dzmitry Sankouski [Tue, 27 Dec 2022 19:47:08 +0000 (22:47 +0300)]
board: starqltechn: enable serial console

It was temporary disabled due to problem with boot.
Issue was fixed in
commit f5ed6c9ccf3e ("uart: sdm845: Fix debug UART pinmux")

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
18 months agoconfigs: am62a: use kernel fitImage when using secure bootflow
Bryan Brattlof [Sat, 24 Dec 2022 01:15:25 +0000 (19:15 -0600)]
configs: am62a: use kernel fitImage when using secure bootflow

In order to maintain the chain of trust, each stage of the boot process
will first authenticate each binary it loads before continuing. To
extend this to the kernal and its dtbs we can package the kernal and
its dtbs into another fitImage for Uboot to authenticate and extend the
chain of trust all the way to the kernel.

When 'boot_fit' is set, indicating we're using the secure bootflow, look
for and authenticate the kernel's fitImage.

Signed-off-by: Judith Mendez <jm@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
18 months agoconfigs: am62a: convert bootcmd to distro_bootcmd
Bryan Brattlof [Sat, 24 Dec 2022 01:15:24 +0000 (19:15 -0600)]
configs: am62a: convert bootcmd to distro_bootcmd

We're currently using CONFIG_BOOTCOMMAND to run custom boot scripts to
jump into linux. While this works, let's begin the transition to more
distribution friendly jumps to linux by enabling distro_bootcmd.

Convert the custom bootcmd to a distro_bootcmd

Signed-off-by: Judith Mendez <jm@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
18 months agoarm: mach-k3: copy bootindex to OCRAM for main domain SPL
Bryan Brattlof [Sat, 24 Dec 2022 01:15:23 +0000 (19:15 -0600)]
arm: mach-k3: copy bootindex to OCRAM for main domain SPL

Texas Instruments has begun enabling security settings on the SoCs it
produces to instruct ROM and TIFS to begin protecting the Security
Management Subsystem (SMS) from other binaries we load into the chip by
default.

One way ROM and TIFS do this is by enabling firewalls to protect the
OCSRAM and HSM RAM regions they're using during bootup.

The HSM RAM the wakeup SPL is in is firewalled by TIFS to protect
itself from the main domain applications. This means the 'bootindex'
value in HSM RAM, left by ROM to indicate if we're using the primary
or secondary boot-method, must be moved to OCSRAM (that TIFS has open
for us) before we make the jump to the main domain so the main domain's
bootloaders can keep access to this information.

Signed-off-by: Bryan Brattlof <bb@ti.com>
18 months agoconfigs: am62a: move stack and heap to HSM RAM
Bryan Brattlof [Sat, 24 Dec 2022 01:15:22 +0000 (19:15 -0600)]
configs: am62a: move stack and heap to HSM RAM

Texas Instruments has begun enabling security setting on the SoCs they
produce to instruct ROM and TIFS to begin protecting the Security
Management Subsystem (SMS) from other binaries we load into the chip by
default.

One way ROM does this is by enabling firewalls to protect the OCSRAM
region it's using during bootup. Only after TIFS has started (and had
time to disable the OCSRAM firewall region) will we have write access to
the region.

This means we will need to move the stack & heap from OCSRAM to HSM RAM
and reduce the size of BSS and the SPL to allow it to fit properly.

Signed-off-by: Bryan Brattlof <bb@ti.com>
18 months agoconfigs: restrict am62ax wakup SPL size
Bryan Brattlof [Sat, 24 Dec 2022 01:15:21 +0000 (19:15 -0600)]
configs: restrict am62ax wakup SPL size

In its current form, the am62a's wakeup SPL is fairly small, however
this will not remain as more boot modes are eventually added. To protect
us from overflowing our ~256k of HSM SRAM, add limits and check during
the wakeup SPL build.

Signed-off-by: Bryan Brattlof <bb@ti.com>
18 months agoconfigs: Enable distroboot on am625
Martyn Welch [Tue, 20 Dec 2022 18:38:19 +0000 (18:38 +0000)]
configs: Enable distroboot on am625

TI boards use a custom (though faily common to TI boards) mechanism for
booting Linux. We would like to use the "distroboot" approach.

Enable distroboot as a further option to use for booting on am625 should
the existing options fail.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
18 months agoarm64:mach-k3 am625_init: Correct boot mode detection
Martyn Welch [Tue, 20 Dec 2022 18:38:18 +0000 (18:38 +0000)]
arm64:mach-k3 am625_init: Correct boot mode detection

The boot mode detection assumes that BOOT_DEVICE_MMC2 should always
result in MMCSD_MODE_FS, but MMCSD_MODE_RAW is also a valid option for
this port.

The current logic also avoids looking at the bootmode pin strapping,
which should be the primary means of determining whether a device is
being booted in MMCSD_MODE_EMMCBOOT mode.

Switch around the logic to check the boot mode to determine whether the
eMMC boot mode is expected or MMC/SD boot mode. From there we can look
at the boot mode config if in MMC/SD boot mode to determine whether to
attempt RAW or FS based booting.

This change allows U-Boot to also be successfully booted from RAW
offsets in addition to from a filesystem.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
18 months agoconfigs: am62x_evm_a53: Enable ethernet
Sjoerd Simons [Tue, 20 Dec 2022 15:21:46 +0000 (16:21 +0100)]
configs: am62x_evm_a53: Enable ethernet

Enable ethernet support for u-boot on am62x evm

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
18 months agoarm: dts: k3-am625-sk: Enable first ethernet port
Sjoerd Simons [Tue, 20 Dec 2022 15:21:45 +0000 (16:21 +0100)]
arm: dts: k3-am625-sk: Enable first ethernet port

The K3 am625 sk EVM has two ethernet ports; Enable the first one for
usage in u-boot.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
18 months agoconfigs: am62x_evm_*: Run savedefconfig
Sjoerd Simons [Tue, 20 Dec 2022 15:21:44 +0000 (16:21 +0100)]
configs: am62x_evm_*: Run savedefconfig

Clean configuration for am62x_evm using savedefconfig

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Tested-by: Dhruva Gole <d-gole@ti.com>
18 months agoconfigs: am62x_evm_*: Correct SPI configuration option
Sjoerd Simons [Tue, 20 Dec 2022 15:21:43 +0000 (16:21 +0100)]
configs: am62x_evm_*: Correct SPI configuration option

In f422c4bec the configuration option to support s28hs512t SPI flashes
was changed from CONFIG_SPI_FLASH_S28HS512T to CONFIG_SPI_FLASH_S28HX_T
to support the wider family. Follow this change in the AM62x EVM
configurations.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
18 months agopinctrl: nuvoton: add NPCM7xx/NPCM8xx reset type detect
Jim Liu [Tue, 20 Dec 2022 08:49:31 +0000 (16:49 +0800)]
pinctrl: nuvoton: add NPCM7xx/NPCM8xx reset type detect

add reset type detect and persist setting.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
18 months agoMerge branch '2023-01-10-env-mmc-improvements-and-corrections'
Tom Rini [Tue, 10 Jan 2023 19:49:32 +0000 (14:49 -0500)]
Merge branch '2023-01-10-env-mmc-improvements-and-corrections'

To quote the author:

Update in U-Boot env mmc backend with several cosmetic changes or
corrections and 2 new features:

1/ CONFIG_ENV_MMC_USE_DT = no more use CONFIG_ENV_OFFSET
   in the mmc ENV backend when this config is activated.

   Requested by the STM32MP STMicroelectronics boards which activate
   several ENV_IS_IN_XXX; the value of CONFIG_ENV_OFFSET is invalid for
   SD-Card / eMMC boot; this offset should only used in SPIFlash backend
   (sf.c) for SPI-NOR boot.

   If this offset is used on mmc backend, when partition name in GPT is
   not aligned with  U-Boot DT: "u-boot,mmc-env-partition", the behavior
   is difficult to debug: a partition is corrupted on 'env save' command.

2/ selects the GPT env partition by the "u-boot-env" type GUID introduced
   by the commit c0364ce1c695 ("doc/README.gpt: define partition
   type GUID for U-Boot environment")

   This feature can also avoid issue when 'u-boot-env' partition name
   change in GPT partitioning but not in the U-Boot DT with
   "u-boot,mmc-env-partition"

18 months agoenv: mmc: cosmetic: remove unused macro STR(X)
Patrick Delaunay [Thu, 10 Nov 2022 10:49:05 +0000 (11:49 +0100)]
env: mmc: cosmetic: remove unused macro STR(X)

Remove the unused macro STR(X) since the commit 2b2f727500dc ("env: mmc:
allow support of mmc_get_env_dev with OF_CONTROL")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: mmc: add debug message when mmc-env-partition is not found
Patrick Delaunay [Thu, 10 Nov 2022 10:49:04 +0000 (11:49 +0100)]
env: mmc: add debug message when mmc-env-partition is not found

Add a debug message to indicate a potential issue when
"u-boot,mmc-env-partition" is present in config node of device tree
but this partition name is not found in the mmc device.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: mmc: select GPT env partition by type guid
Patrick Delaunay [Thu, 10 Nov 2022 10:49:03 +0000 (11:49 +0100)]
env: mmc: select GPT env partition by type guid

Since commit c0364ce1c695 ("doc/README.gpt: define partition type GUID for
U-Boot environment"), a specific type GUID can be used to indicate
the U-Boot environment partition on the device with GPT partition table.

This patch uses this type GUID to found the env partition as fallback
when the partition name property "u-boot,mmc-env-partition" is not present
in config node or if the indicated partition name is not found.

The mmc_offset_try_partition() function is reused, it selects the first
partition with the correct type GUID when the parameter 'str' is NULL.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoconfigs: stm32mp: activate CONFIG_ENV_MMC_USE_DT
Patrick Delaunay [Thu, 10 Nov 2022 10:49:02 +0000 (11:49 +0100)]
configs: stm32mp: activate CONFIG_ENV_MMC_USE_DT

Activate by default CONFIG_ENV_MMC_USE_DT as "u-boot,mmc-env-partition"
should be always use in STMicroelectronics boards device tree to locate
the environment for mmc backend. The 2 defines:
  CONFIG_ENV_OFFSET=0x280000
  CONFIG_ENV_OFFSET_REDUND=0x2C0000
are only valid for spi-nor and not for SD-Card or eMMC.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: mmc: add CONFIG_ENV_MMC_USE_DT
Patrick Delaunay [Thu, 10 Nov 2022 10:49:01 +0000 (11:49 +0100)]
env: mmc: add CONFIG_ENV_MMC_USE_DT

Add a new config CONFIG_ENV_MMC_USE_DT to force configuration of the
U-Boot environment offset with device tree config node.

This patch avoids issues when several CONFIG_ENV_IS_IN_XXX are activated,
the defconfig file uses the same value for CONFIG_ENV_OFFSET or
CONFIG_ENV_OFFSET_REDUND for the several ENV backends (SPI_FLASH, EEPROM
NAND, SATA, MMC).

After this patch a bad offset value is not possible when the selected
partition in device tree is not found.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: mcc: fix compilation error with ENV_IS_EMBEDDED
Patrick Delaunay [Thu, 10 Nov 2022 10:49:00 +0000 (11:49 +0100)]
env: mcc: fix compilation error with ENV_IS_EMBEDDED

When ENV_IS_EMBEDDED is enabled, ret is not defined but is used as a
return value in env_mmc_load().
This patch correct this issue and simplify the existing code, test only
one time #if defined(ENV_IS_EMBEDDED) and not in the function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: mcc: Drop unnecessary #ifdefs
Patrick Delaunay [Thu, 10 Nov 2022 10:48:59 +0000 (11:48 +0100)]
env: mcc: Drop unnecessary #ifdefs

This file has a lot of conditional code and much of it is unnecessary.
Clean this up to reduce the number of build combinations.

This patch replaces the test on CONFIG_ENV_OFFSET_REDUND for the
more coherent CONFIG_SYS_REDUNDAND_ENVIRONMENT.

This patch also corrects a compilation issue in init_mmc_for_env()
when CONFIG_SYS_MMC_ENV_PART is not activated, env_mmc_orig_hwpart is
not defined.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoenv: mmc: introduced ENV_MMC_OFFSET
Patrick Delaunay [Thu, 10 Nov 2022 10:48:58 +0000 (11:48 +0100)]
env: mmc: introduced ENV_MMC_OFFSET

Introduce ENV_MMC_OFFSET defines.
It is a preliminary step to the next patches to simplify the code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agons16650: Correct CONFIG_SYS_NS16550_MEM32 platforms
Tom Rini [Fri, 6 Jan 2023 03:47:44 +0000 (22:47 -0500)]
ns16650: Correct CONFIG_SYS_NS16550_MEM32 platforms

There are currently no platform that are both CONFIG_SYS_NS16550_MEM32
and not (per how the logic was prior to being broken in 0478dac62a9a
("kbuild: Remove uncmd_spl logic")) enabled in CONFIG_DM_SERIAL. We drop
this line out now so that platforms which do use
CONFIG_SYS_NS16550_MEM32 and depending on stage may or may not have
DM_SERIAL set.

Fixes: 0478dac62a9a ("kbuild: Remove uncmd_spl logic")
Reported-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Tested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> #on Ringneck PX30, Puma RK3399
18 months agoMerge branch 'next'
Tom Rini [Mon, 9 Jan 2023 16:30:08 +0000 (11:30 -0500)]
Merge branch 'next'

Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agoPrepare v2023.01
Tom Rini [Mon, 9 Jan 2023 16:07:33 +0000 (11:07 -0500)]
Prepare v2023.01

Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agoboard: rockchip: Fix binman_init failure on EVB-RK3568
Jagan Teki [Sun, 8 Jan 2023 16:17:34 +0000 (21:47 +0530)]
board: rockchip: Fix binman_init failure on EVB-RK3568

For some newer SoCs like RK3568, the Rockchip has not released
any DDR drivers yet so idbloader needs to create manually using
DDR binaries offered by rkbin. This indeed no requirement to
enable TPL in the U-Boot source code.

If we mark TPL disabled and mark BINMAN enabled by default then
there would be an issue of binman_init failure during board
relocation. This is true as binman failed to find the top-level
node like u-boot-tpl here.

Here is the boot issue observed in Radxa-CM3 RK3566 board,

 U-Boot 2023.01-rc4-00057-gac2505d463-dirty (Jan 04 2023 - 23:44:18 +0530)

 Model: Radxa Compute Module 3(CM3) IO Board
 DRAM:  2 GiB
 binman_init failed:-2
 initcall sequence 000000007ffd2008 failed at call 0000000000a18cac (err=-2)
 ### ERROR ### Please RESET the board ###

This might be fixed via binman node in rockchip-u-boot.dtsi however
disable BINMAN_FDT for evb-rk3568 defconfig for now as we are at the
end of the release cycle.

Fixes: 05713d570762 ("rockchip: generate u-boot-rockchip.bin with binman
for ARM64 boards")
Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
18 months agoMerge tag 'u-boot-nand-20230108' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sun, 8 Jan 2023 18:12:42 +0000 (13:12 -0500)]
Merge tag 'u-boot-nand-20230108' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash into next

Pull request for u-boot-nand-20230108

- rawnand: omap_gpmc: driver model support

18 months agodistro_bootcmd: Fix copy-paste error
Marek Vasut [Thu, 5 Jan 2023 01:26:03 +0000 (02:26 +0100)]
distro_bootcmd: Fix copy-paste error

The "SCRIPT FAILED" string is copied from scan_dev_for_scripts script,
update it so it prints "EXTLINUX FAILED" instead in scan_dev_for_extlinux
script.

Signed-off-by: Marek Vasut <marex@denx.de>
18 months agomtd: rawnand: omap_elm: u-boot driver model support
Roger Quadros [Tue, 20 Dec 2022 10:22:03 +0000 (12:22 +0200)]
mtd: rawnand: omap_elm: u-boot driver model support

Support u-boot driver model. We still retain
support legacy way of doing things if ELM_BASE
is defined in <asm/arch/hardware.h>

We could completely get rid of that if all
platforms defining ELM_BASE get rid of that definition
and enable CONFIG_SYS_NAND_SELF_INIT and are verified
to work.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://lore.kernel.org/all/20221220102203.52398-9-rogerq@kernel.org
Link: https://lore.kernel.org/all/CABGWkvrvKiVA_yaDnHJcHEKwc+pEuLdz=i6HQEY0oJQvohCUsw@mail.gmail.com
18 months agodt-bindings: mtd: Add ti, elm DT binding documentation
Roger Quadros [Tue, 20 Dec 2022 10:22:02 +0000 (12:22 +0200)]
dt-bindings: mtd: Add ti, elm DT binding documentation

Adds DT binding documentation for the TI Error Location Module.
This is picked up from the Linux Kernel.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-8-rogerq@kernel.org
18 months agomtd: rawnand: omap_gpmc: Enable SYS_NAND_PAGE_COUNT for OMAP_GPMC
Roger Quadros [Tue, 20 Dec 2022 10:22:01 +0000 (12:22 +0200)]
mtd: rawnand: omap_gpmc: Enable SYS_NAND_PAGE_COUNT for OMAP_GPMC

The symbol is required for NAND support in SPL when using
OMAP_GPMC driver.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-7-rogerq@kernel.org
18 months agomtd: rawnand: omap_gpmc: Add SPL NAND support
Roger Quadros [Tue, 20 Dec 2022 10:22:00 +0000 (12:22 +0200)]
mtd: rawnand: omap_gpmc: Add SPL NAND support

Enables SPL NAND support for ARCH_K3 by enabling
SPL_NAND_INIT and SPL_SYS_NAND_SELF_INIT.

Legacy OMAP2plus platforms still rely on SPL_NAND_AM33XX_BCH
instead.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-6-rogerq@kernel.org
18 months agomtd: rawnand: omap_gpmc: support u-boot driver model
Roger Quadros [Tue, 20 Dec 2022 10:21:59 +0000 (12:21 +0200)]
mtd: rawnand: omap_gpmc: support u-boot driver model

Adds driver model support.

We need to be able to self initialize the NAND controller/chip
at probe and so enable CONFIG_SYS_NAND_SELF_INIT.

Doing so requires nand_register() API which is provided by nand.c
and needs to be enabled during SPL build via CONFIG_SPL_NAND_INIT.
But nand.c also provides nand_init() so we need to get rid of nand_init()
in omap_gpmc driver if CONFIG_SPL_NAND_INIT is set.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-5-rogerq@kernel.org
18 months agodt-bindings: mtd: Add ti, gpmc-nand DT binding documentation
Roger Quadros [Tue, 20 Dec 2022 10:21:58 +0000 (12:21 +0200)]
dt-bindings: mtd: Add ti, gpmc-nand DT binding documentation

Add DT binding documentation for the TI GPMC NAND controller.
This is picked up from the Linux Kernel.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-4-rogerq@kernel.org
18 months agomtd: rawnand: nand_base: Allow base driver to be used in SPL without nand_bbt
Roger Quadros [Tue, 20 Dec 2022 10:21:57 +0000 (12:21 +0200)]
mtd: rawnand: nand_base: Allow base driver to be used in SPL without nand_bbt

nand_bbt.c is not being built with the nand_base driver during SPL
build. This results in build failures if we try to access any nand_bbt
related functions.

Don't use any nand_bbt functions for SPL build.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-3-rogerq@kernel.org
18 months agomtd: rawnand: omap_gpmc: Fix BCH6/16 HW based correction
Roger Quadros [Tue, 20 Dec 2022 10:21:56 +0000 (12:21 +0200)]
mtd: rawnand: omap_gpmc: Fix BCH6/16 HW based correction

The BCH detection hardware can generate ECC bytes for multiple
sectors in one go. Use that feature.

correct() only corrects one sector at a time so we need to call it
repeatedly for each sector.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221220102203.52398-2-rogerq@kernel.org
18 months agopylibfdt: Allow version normalization to fail
Tom Rini [Sat, 7 Jan 2023 23:02:26 +0000 (18:02 -0500)]
pylibfdt: Allow version normalization to fail

In some cases, we might not have the sic portion of setuputils
available. Make our import and use of this be done in try/except blocks
as this is done to suppress a run-time warning that is otherwise
non-fatal.

Reported-by: Pali Rohár <pali@kernel.org>
Fixes: 141659187667 ("pylibfdt: Fix disable version normalization")
Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agocommon/memsize.c: Check for overflow in get_effective_memsize() only for mpc85xx
Pali Rohár [Sat, 7 Jan 2023 21:55:26 +0000 (22:55 +0100)]
common/memsize.c: Check for overflow in get_effective_memsize() only for mpc85xx

This reverts commit 777aaaa706bc ("common/memsize.c: Fix
get_effective_memsize() to check for overflow") for non-mpc85xx platforms.

The changes to this generic function, which is intended to help with
32bit platforms with large amounts of memory has unintended side effects
(which in turn lead to boot failures) on other platforms which were
previously functional.

For now do overflow check only for powerpc mpc85xx platform. It is needed
to prevent crashing of P1/P2 boards with 4GB DDR module in 32-bit mode.

Fixes: 777aaaa706bc ("common/memsize.c: Fix get_effective_memsize() to check for overflow")
Signed-off-by: Pali Rohár <pali@kernel.org>
18 months agoMerge tag 'efi-2023-01-rc5-4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 7 Jan 2023 17:32:42 +0000 (12:32 -0500)]
Merge tag 'efi-2023-01-rc5-4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-01-rc5-4

UEFI:

* correct the vexpress loaddr which collides with memory used by EFI
* consider the EFI memory map for LMB memory reservation
* avoid RWX section warnings for .data section of *_efi.so files

18 months agoefi_loader: make .data section of *_efi.so files RW
Heinrich Schuchardt [Wed, 4 Jan 2023 22:43:08 +0000 (23:43 +0100)]
efi_loader: make .data section of *_efi.so files RW

When building with binutils 2.39 warnings

    *_efi.so has a LOAD segment with RWX permissions

occur.

Use SHF_WRITE | SHF_ALLOC as section flags for the .data section.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agolmb: consider EFI memory map
Heinrich Schuchardt [Wed, 4 Jan 2023 00:36:14 +0000 (01:36 +0100)]
lmb: consider EFI memory map

Add reservations for all EFI memory areas that are not
EFI_CONVENTIONAL_MEMORY.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agoefi_loader: carve out efi_get_memory_map_alloc()
Heinrich Schuchardt [Thu, 5 Jan 2023 17:26:01 +0000 (18:26 +0100)]
efi_loader: carve out efi_get_memory_map_alloc()

Carve out code from efidebug command used to read the memory map.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agovexpress: adjust loadaddr
Heinrich Schuchardt [Wed, 4 Jan 2023 02:17:15 +0000 (03:17 +0100)]
vexpress: adjust loadaddr

On the vexpress_ca9x4 $loadaddr points to a memory area used by the EFI
sub-system. Use the same value as $kernel_addr_r which is safe.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agoMerge tag 'u-boot-at91-2023.04-a' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 6 Jan 2023 16:53:26 +0000 (11:53 -0500)]
Merge tag 'u-boot-at91-2023.04-a' of https://source.denx.de/u-boot/custodians/u-boot-at91 into next

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

This feature set includes the new DM-based NAND flash driver (old non-DM
driver is still kept for backwards compatibility), and the move to DM
NAND flash driver for sam9x60ek board. Feature set also includes
devicetree alignment for sama7g5 with Linux, devicetree alignment on USB
with Linux for all boards (sama5, sam9x60), chip id for sama7g5, minor
configs and tweaks.

18 months agoMerge tag 'u-boot-stm32-20230106' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 6 Jan 2023 13:16:15 +0000 (08:16 -0500)]
Merge tag 'u-boot-stm32-20230106' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- stm32mp: Fix board_get_usable_ram_top(): workaround to avoid issue after the
  commit 777aaaa706b ("common/memsize.c: Fix get_effective_memsize() to check
  for overflow") because the effective DDR effective size is reduce by 4KiB
  and sometime the board hang on boot

18 months agoMerge branch '2023-01-06-further-regression-fixes'
Tom Rini [Fri, 6 Jan 2023 13:14:28 +0000 (08:14 -0500)]
Merge branch '2023-01-06-further-regression-fixes'

- Bring in a number of important regression fixes for among others,
  uniphier, PXE booting, socrates, imx7d-pico, rockchip video and
  rzg2_beacon as well as making the python version warning fix more
  portable.

18 months agoarm: rmobile: rzg2_beacon: Enable alternative Ethernet PHY
Adam Ford [Wed, 4 Jan 2023 18:05:43 +0000 (12:05 -0600)]
arm: rmobile: rzg2_beacon: Enable alternative Ethernet PHY

Due to the part shortage, the AR8031 PHY was replaced with a
Micrel KSZ9131. Enabling both config options keeps backward
compatibility with either platform, and both appear to be
auto-detected.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@gmail.com>
18 months agoarm: dts: rz-g2-beacon-u-boot: Fix QSPI Regression
Adam Ford [Wed, 4 Jan 2023 15:53:09 +0000 (09:53 -0600)]
arm: dts: rz-g2-beacon-u-boot: Fix QSPI Regression

The QSPI is accessed via the RPC-IF, but the compatible flags
previously used a different name.  This compatibel name was changed
which broke the ability to access the QSPI.  Fix this by removing
the custom naming reference.

Fixes: 68083b897b57 ("renesas: Fix RPC-IF compatible values")
Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@gmail.com>
18 months agopylibfdt: Fix disable version normalization
Philippe Schenker [Wed, 4 Jan 2023 14:43:33 +0000 (15:43 +0100)]
pylibfdt: Fix disable version normalization

On Arch Linux based systems python setuptools does not contain
"setuptools.extern" hence it is failing with the following
error-message:
"
ModuleNotFoundError: No module named 'setuptools.extern'
"

According to a eschwartz `setuptools.extern` is not a public API and
shall not be assumed to be present in the setuptools package. He
mentions that the setuptools project anyway wants to drop this. [1]

Use the correct solution introduced by python setuptools developers to
disable normalization. [2]

[1] https://bbs.archlinux.org/viewtopic.php?id=259608
[2] https://github.com/pypa/setuptools/pull/2026
Fixes: 440098c42e73 ("pylibfdt: Fix version normalization warning")
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage
Marek Vasut [Wed, 14 Dec 2022 06:45:18 +0000 (07:45 +0100)]
cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage

Commit d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot")
forces '$fdtcontroladdr' DT address as a third parameter of bootm command
even if the PXE transfer pulls in a fitImage which contains configuration
node with its own DT that is preferrable to be passed to Linux. Limit the
$fdtcontroladdr fallback utilization to non-fitImages, since it is highly
likely a fitImage would come with its own DT, while single-file images do
need a separate DT.

Fixes: d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Tested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Peter Hoyes <peter.hoyes@arm.com>
Tested-by: Peter Hoyes <peter.hoyes@arm.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
18 months agoRevert "Revert "cmd: pxe_utils: Check fdtcontroladdr in label_boot""
Marek Vasut [Sat, 17 Dec 2022 17:41:13 +0000 (18:41 +0100)]
Revert "Revert "cmd: pxe_utils: Check fdtcontroladdr in label_boot""

This reverts commit ed6251187afabf811a5fd49a44ebd61c53c7b378.

Superseded by "cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage"
which is less heavy-handed approach and retains part of the original
behavior for non-fitImage.

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
18 months agorockchip: Fix the broken Video out for rk3288 boards
Jagan Teki [Mon, 2 Jan 2023 18:23:45 +0000 (23:53 +0530)]
rockchip: Fix the broken Video out for rk3288 boards

Video out on RK3288 boards has been broken since from few
releases due to the adding of reset support on vop but
missed enabling DM_RESET on associated boards.

This patch fixes those RK3288 boards.

Cc: Simon Glass <sjg@chromium.org>
Cc: Lin Huang <hl@rock-chips.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Fixes: <9749d2ea29e1> ("rockchip: video: vop: Add reset support")
Reported-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoi2c: uniphier-f: correct error recovery
Dai Okamura [Fri, 9 Dec 2022 11:38:27 +0000 (20:38 +0900)]
i2c: uniphier-f: correct error recovery

The uniphier i2c block can recognize some handshake errors.
But driver handles all error detections as no error if no timeout.
So this makes unrecoverable state.

This replaces the return values with the right ones to tell the i2c
framework the errors:
- EDEADLK for arbitration lost error
- ENODATA for no answer error

Signed-off-by: Dai Okamura <okamura.dai@socionext.com>
Acked-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
18 months agoimx7d-pico: Fix the name of the u-boot.dtsi file
Fabio Estevam [Sat, 31 Dec 2022 16:25:14 +0000 (13:25 -0300)]
imx7d-pico: Fix the name of the u-boot.dtsi file

Since commit 2f96d4dd95f8 ("imx7s/d: synchronise device trees with linux")
the imx7d-pico board no longer boots.

The reason is that prior to the above commit there was an explicit
inclusion of arch/arm/dts/imx7d-pico-u-boot.dtsi inside imx7d-pico.dtsi.

After the syncing with the Linux upstream dtsi, this u-boot.dtsi inclusion
is gone and the board fails to boot.

U-Boot uses the imx7d-pico-pi.dtb file, so rename the u-boot.dtsi to
imx7d-pico-pi-u-boot.dtsi which gets included automatically by U-Boot
standard make logic and makes the board boot again.

Signed-off-by: Fabio Estevam <festevam@denx.de>
18 months agopowerpc/mpc85xx: socrates: Re-enable building u-boot-socrates.bin
Pali Rohár [Wed, 28 Dec 2022 18:18:39 +0000 (19:18 +0100)]
powerpc/mpc85xx: socrates: Re-enable building u-boot-socrates.bin

U-Boot build system builds final U-Boot binary for socrates board in custom
file u-boot-socrates.bin (instead of standard u-boot.bin). Output target
file u-boot-socrates.bin is generated by binman as defined in board binman
config file arch/powerpc/dts/socrates-u-boot.dtsi.

But binman was disabled in commit 5af42eafd7e1 ("Makefile: Reduce usage of
custom mpc85xx u-boot.bin target") for all mpc85xx boards which do not use
standard powerpc binman config file arch/powerpc/dts/u-boot.dtsi and boards
which do not require binman at all.

The only such mpc85xx board is socrates. So since that commit, U-Boot does
not final binary for socrates board anymore.

Fix this issue by re-enabling binman for socrates board. And build process
starts again producing u-boot-socrates.bin binary.

Note that build process for this socrates board always produce u-boot.bin
binary which is broken and not usable for socrates board. Long term
solution should be to disable building broken binary u-boot.bin and then
renaming u-boot-socrates.bin to u-boot.bin, or switching to use common
powerpc binman config file arch/powerpc/dts/socrates-u-boot.dtsi (if it is
possible).

Fixes: 5af42eafd7e1 ("Makefile: Reduce usage of custom mpc85xx u-boot.bin target")
Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Heiko Schocher <hs@denx.de>