platform/kernel/u-boot.git
2 years agospi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller
Tudor Ambarus [Fri, 8 Apr 2022 08:40:26 +0000 (11:40 +0300)]
spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller

Use the spi_mem_default_supports_op() core helper in order to take into
account the buswidth specified by the user in device tree.

Fixes: 24c8ff4684 ("spi: Add Atmel QuadSPI driver")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2 years agoinclude: configs: at91/sam: remove stray #ifdef/#else
Eugen Hristev [Thu, 7 Apr 2022 06:58:48 +0000 (09:58 +0300)]
include: configs: at91/sam: remove stray #ifdef/#else

With the commit that moves the BOOTCOMMAND to Kconfig:

970bf8603b ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig")

some stray ifdefs have been left in the header files which
are now useless.
Clean up the include files to remove these lines.

Fixes: 970bf8603b ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoARM: dts: sam9x60: Add pit64b node
Durai Manickam KR [Mon, 4 Apr 2022 10:30:00 +0000 (16:00 +0530)]
ARM: dts: sam9x60: Add pit64b node

Add DT node for pit64b support.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agotimers: atmel_pit: introduce CONFIG_SPL_ATMEL_PIT_TIMER
Eugen Hristev [Mon, 4 Apr 2022 08:35:51 +0000 (11:35 +0300)]
timers: atmel_pit: introduce CONFIG_SPL_ATMEL_PIT_TIMER

This commit allows the ATMEL_PIT_TIMER driver to be unselected in SPL and be
selected in u-boot proper. The SPL can use a different timer.
By having a separate Kconfig for ATMEL_TCB in SPL, the size of the SPL
decreases by 0.3 KBytes.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agotimers: atmel_tcb: introduce CONFIG_SPL_ATMEL_TCB
Eugen Hristev [Mon, 4 Apr 2022 08:35:50 +0000 (11:35 +0300)]
timers: atmel_tcb: introduce CONFIG_SPL_ATMEL_TCB

This commit allows the ATMEL_TCB driver to be unselected in SPL and be
selected in u-boot proper. The SPL can use a different timer.
By having a separate Kconfig for ATMEL_TCB in SPL, the size of the SPL
decreases by 1 KByte.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoARM: mach-at91: armv7: Remove default reset driver
Sergiu Moga [Fri, 1 Apr 2022 09:27:27 +0000 (12:27 +0300)]
ARM: mach-at91: armv7: Remove default reset driver

This commit removes the default reset driver for armv7, since
it is no longer needed due to the presence of the SYSRESET driver.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agoARM: mach-at91: arm926ejs: Add SYSRESET conditional
Sergiu Moga [Fri, 1 Apr 2022 09:27:26 +0000 (12:27 +0300)]
ARM: mach-at91: arm926ejs: Add SYSRESET conditional

This commit adds a condition to the Makefile so that whenever the SYSRESET
option is chosen in the configuration, the default reset driver is ignored.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agoconfigs: at91: Enable SYSRESET for Atmel/Microchip's platforms
Sergiu Moga [Fri, 1 Apr 2022 09:27:25 +0000 (12:27 +0300)]
configs: at91: Enable SYSRESET for Atmel/Microchip's platforms

This commit enables SYSRESET in the defconfigs for the
Atmel/Microchip platforms.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agosysreset: Add Atmel/Microchip sysreset driver
Sergiu Moga [Fri, 1 Apr 2022 09:27:24 +0000 (12:27 +0300)]
sysreset: Add Atmel/Microchip sysreset driver

This patch adds a sysreset driver for Atmel/Microchip platforms.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
2 years agoARM: dts: at91: Add RSTC node
Sergiu Moga [Fri, 1 Apr 2022 09:27:23 +0000 (12:27 +0300)]
ARM: dts: at91: Add RSTC node

Add node for RSTC.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agoconfigs: Add sam9x60_curiosity_mmc_defconfig
Durai Manickam KR [Mon, 4 Apr 2022 05:53:20 +0000 (11:23 +0530)]
configs: Add sam9x60_curiosity_mmc_defconfig

Add boot from SDMMC (sdcard) support for sam9x60_curiosity.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoARM: dts: Add device tree files for sam9x60_curiosity
Durai Manickam KR [Mon, 4 Apr 2022 05:53:19 +0000 (11:23 +0530)]
ARM: dts: Add device tree files for sam9x60_curiosity

Add dts and dtsi files.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoboard: Add sam9x60_curiosity support
Durai Manickam KR [Mon, 4 Apr 2022 05:53:18 +0000 (11:23 +0530)]
board: Add sam9x60_curiosity support

Add board files, Kconfig, Makefile and MAINTAINERS.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoPrepare v2022.07-rc1
Tom Rini [Mon, 25 Apr 2022 23:26:07 +0000 (19:26 -0400)]
Prepare v2022.07-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 25 Apr 2022 22:53:54 +0000 (18:53 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agonds32: Remove the architecture
Tom Rini [Wed, 6 Apr 2022 13:21:25 +0000 (09:21 -0400)]
nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agoMerge branch '2022-04-25-initial-implementation-of-stdboot'
Tom Rini [Mon, 25 Apr 2022 20:02:27 +0000 (16:02 -0400)]
Merge branch '2022-04-25-initial-implementation-of-stdboot'

To quote the author:
The bootflow feature provide a built-in way for U-Boot to automatically
boot an Operating System without custom scripting and other customisation.
This is called 'standard boot' since it provides a standard way for
U-Boot to boot a distro, without scripting.

It introduces the following concepts:

   - bootdev - a device which can hold a distro
   - bootmeth - a method to scan a bootdev to find bootflows (owned by
                U-Boot)
   - bootflow - a description of how to boot (owned by the distro)

This series provides an implementation of these, enabled to scan for
bootflows from MMC, USB and Ethernet. It supports the existing distro
boot as well as the EFI loader flow (bootefi/bootmgr). It works
similiarly to the existing script-based approach, but is native to
U-Boot.

With this we can boot on a Raspberry Pi 3 with just one command:

   bootflow scan -lb

which means to scan, listing (-l) each bootflow and trying to boot each
one (-b). The final patch shows this.

With a standard way to identify boot devices, booting become easier. It
also should be possible to support U-Boot scripts, for backwards
compatibility only.

...

The design is described in these two documents:

https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing

https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing

2 years agoMerge branch '2022-04-23-binman-updates'
Tom Rini [Mon, 25 Apr 2022 20:02:03 +0000 (16:02 -0400)]
Merge branch '2022-04-23-binman-updates'

- Assorted binman updates, and add Alper as a maintainer, after talking
  with Simon.

2 years agobinman: don't import deprecated distutils package
Heinrich Schuchardt [Sat, 9 Apr 2022 12:53:18 +0000 (14:53 +0200)]
binman: don't import deprecated distutils package

'make tests' fails on Ubuntu 22.04 with:

binman: ./tools/binman/binman:12: DeprecationWarning:
The distutils package is deprecated and slated for removal in Python 3.12.
Use setuptools or check PEP 632 for potential alternatives
  from distutils.sysconfig import get_python_lib
./tools/binman/binman:12: DeprecationWarning:
The distutils.sysconfig module is deprecated, use sysconfig instead
  from distutils.sysconfig import get_python_lib
<unittest.result.TestResult run=428 errors=0 failures=4>
AssertionError: 0 != 468

As we don't use Ubuntu 16.04 for our CI anymore drop the import.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agoMAINTAINERS: Add Alper as a binman maintainer
Alper Nebi Yasak [Fri, 22 Apr 2022 15:25:47 +0000 (18:25 +0300)]
MAINTAINERS: Add Alper as a binman maintainer

I ended up learning most of binman internals while trying to add a few
features to it, and I recently started reviewing binman series that
would not affect me personally. I'll keep working on it and try to do
more reviews.

Add myself as a maintainer for binman.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Acked-by: Tom Rini <trini@konsulko.com>
2 years agobinman: Refuse to replace sections for now
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:50 +0000 (18:31 +0300)]
binman: Refuse to replace sections for now

Binman interfaces allow attempts to replace any entry in the image with
arbitrary data. When trying to replace sections, the changes in the
section entry's data are not propagated to its child entries. This,
combined with how sections rebuild their contents from its children,
eventually causes the replaced contents to be silently overwritten by
rebuilt contents equivalent to the original data.

Add a simple test for replacing a section that is currently failing due
to this behaviour, and mark it as an expected failure. Also, raise an
error when replacing a section instead of silently pretending it was
replaced.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Test replacing non-section entries in FIT subsections
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:49 +0000 (18:31 +0300)]
binman: Test replacing non-section entries in FIT subsections

A previous patch fixes binman to correctly extract FIT subentries. This
makes it easier to test replacing these entries as we can write tests
using an existing helper function that relies on extracting the replaced
entry.

Add tests that replace leaf entries in FIT subsections with data of
various sizes. Replacing the subsections or the whole FIT section does
not work yet due to the section contents being re-built from unreplaced
subentries' data.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Create FIT subentries in the FIT section, not its parent
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:48 +0000 (18:31 +0300)]
binman: Create FIT subentries in the FIT section, not its parent

When reading images from a file, each entry's data is read from its
parent section as specified in the Entry.Create() call that created it.
The FIT entry type has been creating its subentries under its parent
(their grandparent), as creating them under the FIT entry resulted in an
error until FIT was converted into a proper section.

FIT subentries have their offsets relative to the FIT section, and
reading those offsets in the parent section results in wrong data. The
subentries rightfully belong under the FIT entries, so create them
there. Add tests checking that we can extract the correct data for a FIT
entry and its subentries.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Remove '/images/' fragment from FIT subentry paths
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:47 +0000 (18:31 +0300)]
binman: Remove '/images/' fragment from FIT subentry paths

Binman FIT entry nodes describe their subentries in an 'images' subnode,
same as how they would be written for the mkimage executable. The entry
type initially manually managed its subentries keyed by their node paths
relative to its base node. It was later converted to a proper section
while still keeping the same keys for subentries.

These subentry keys of sections are used as path fragments, so they must
not contain the path separator character '/'. Otherwise, they won't be
addressable by binman extract/replace commands. Change these keys from
the '/images/foo' forms to the subentry node names. Extend the simple
FIT tests to check for this.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Don't reset offset/size if image doesn't allow repacking
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:46 +0000 (18:31 +0300)]
binman: Don't reset offset/size if image doesn't allow repacking

When an image has the 'allow-repack' property, binman includes the
original offset and size properties from the image description in the
fdtmap. These are later used as the packing constraints when replacing
entries in an image, so other unconstrained entries can be freely
positioned.

Replacing an entry in an image without 'allow-repack' (and therefore the
original offsets) follows the same logic and results in entries being
merely concatenated. Instead, skip resetting the calculated offsets and
sizes to the missing originals for these images so that every entry is
constrained to its existing offset/size.

Add tests that replace an entry with smaller or equal-sized data, in an
image that doesn't allow repacking. Attempting to do so with bigger-size
data is already an error that is already being tested.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Collect bintools for images when replacing entries
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:45 +0000 (18:31 +0300)]
binman: Collect bintools for images when replacing entries

Binman entries can use other executables to compute their data, usually
in their ObtainContents() methods. Subclasses of Entry_section would use
bintools in their BuildSectionData() method instead, which is called
from several places including their Pack().

These binary tools are resolved correctly while building an image from a
device-tree description so that they can be used from these methods.
However, this is not being done when replacing entries in an image,
which can result in an error as the Pack() methods attempt to use them.

Collect and resolve entries' bintools also when replacing entries to fix
Pack() errors. Add a way to mock bintool usage in the testing entry type
and tests that check bintools are being resolved for such an entry.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Fix unique names having '/.' for images read from files
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:44 +0000 (18:31 +0300)]
binman: Fix unique names having '/.' for images read from files

Binman can embed a copy of the image description into the images it
builds as a fdtmap entry, but it omits the /binman/<image-name> prefix
from the node paths while doing so. When reading an already-built image
file, entries are reconstructed using this fdtmap and their associated
nodes still lack that prefix.

Some entries like fit and vblock create intermediate files whose names
are based on an entry unique name. This name is constructed from their
node's path by concatenating the parents with dots up to the binman
node, e.g. /binman/image/foo/bar becomes 'image.foo.bar'.

However, we don't have this /binman/image prefix when replacing entries
in such an image. The /foo/bar entry we read when doing so erroneously
has the unique name of '/.foo.bar', causing permission errors when the
entry attempts to create files based on that.

Fix the unique-name generation by stopping at the '/' node like how it
stops at the binman node. As the unique names are used as filenames, add
tests that check if they're safe to use as filenames.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: doc: Add documentation
Simon Glass [Mon, 25 Apr 2022 05:31:26 +0000 (23:31 -0600)]
bootstd: doc: Add documentation

Add documentation for this feature, including the commands and full
devicetree bindings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Provide a default command
Simon Glass [Mon, 25 Apr 2022 05:31:27 +0000 (23:31 -0600)]
bootstd: Provide a default command

We would like to use bootstd by default when EFI boot manager is not
enabled. But so far bootstd does not support all the of distro-boot
fetures. So for now, add an option to select this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add setup for the bootflow tests
Simon Glass [Mon, 25 Apr 2022 05:31:25 +0000 (23:31 -0600)]
bootstd: Add setup for the bootflow tests

We need to create a disk image with a partition table and a DOS-format
filesystem containing a few files. Provide a fallback binary for CI since
it does not seem able to detect the loopback partitions.

Add this to a dm_init test so that it happens when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add tests for bootstd including all uclasses
Simon Glass [Mon, 25 Apr 2022 05:31:24 +0000 (23:31 -0600)]
bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: usb: Add a bootdev driver
Simon Glass [Mon, 25 Apr 2022 05:31:23 +0000 (23:31 -0600)]
bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add an implementation of script boot
Simon Glass [Mon, 25 Apr 2022 05:31:22 +0000 (23:31 -0600)]
bootstd: Add an implementation of script boot

Add a bootmeth driver which handles distro boot from a disk via a U-Boot
script, so we can boot a bootflow using this commonly used mechanism. This
is required by Armbian, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: sandbox: Add a hostfs bootdev
Simon Glass [Mon, 25 Apr 2022 05:31:21 +0000 (23:31 -0600)]
bootstd: sandbox: Add a hostfs bootdev

It is helpful to be able to try out bootstd on sandbox, using host files.
This is easier than using a block device, which must have a filesystem,
partition table, etc.

Add a new driver which provides this feature. For now it is not used in
tests, but it is likely to be useful.

Add notes in the devicetree also, but don't disturb the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add a sandbox bootmeth driver
Simon Glass [Mon, 25 Apr 2022 05:31:20 +0000 (23:31 -0600)]
bootstd: Add a sandbox bootmeth driver

Add a bootmeth driver for sandbox, used for testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add an implementation of EFI bootmgr
Simon Glass [Mon, 25 Apr 2022 05:31:19 +0000 (23:31 -0600)]
bootstd: Add an implementation of EFI bootmgr

Add a bootmeth driver which handles EFI boot manager, using EFI_LOADER.

In effect, this provides the same functionality as the 'bootefi bootmgr'
command and shares the same code. But the interface into it is via a
bootmeth, so it does not require any special scripts, etc.

For now this requires the 'bootefi' command be enabled. Future work may
tidy this up so that it can be used without CONFIG_CMDLINE being enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add a system bootdev for strange boot methods
Simon Glass [Mon, 25 Apr 2022 05:31:18 +0000 (23:31 -0600)]
bootstd: Add a system bootdev for strange boot methods

Some boot methods don't act on a single bootdev but instead do their own
thing. An example is EFI bootmgr which scan various devices using its own
logic. Add a bootdev to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add an implementation of EFI boot
Simon Glass [Mon, 25 Apr 2022 05:31:17 +0000 (23:31 -0600)]
bootstd: Add an implementation of EFI boot

Add a bootmeth driver which handles EFI boot, using EFI_LOADER.

In effect, this provides the same functionality as the 'bootefi' command
and shares the same code. But the interface into it is via a bootmeth,
so it does not require any special scripts, etc.

For now this requires the 'bootefi' command be enabled. Future work may
tidy this up so that it can be used without CONFIG_CMDLINE being enabled.

There was much discussion about whether this is needed, but it seems
that it is, at least for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add an implementation of distro PXE boot
Simon Glass [Mon, 25 Apr 2022 05:31:16 +0000 (23:31 -0600)]
bootstd: Add an implementation of distro PXE boot

Add a bootmeth driver which handles distro boot from a network device, so
we can boot a bootflow using this commonly used mechanism.

In effect, this provides the same functionality as the 'pxe' command
and shares the same code. But the interface into it is via a bootmeth.

For now this requires the 'pxe' command be enabled. Future work may tidy
this up so that it can be used without CONFIG_CMDLINE being enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: ethernet: Add a bootdev driver
Simon Glass [Mon, 25 Apr 2022 05:31:15 +0000 (23:31 -0600)]
bootstd: ethernet: Add a bootdev driver

Add a bootdev driver for Ethernet. It can use the PXE boot mechanism to
locate a file, added later.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: mmc: Add a bootdev driver
Simon Glass [Mon, 25 Apr 2022 05:31:14 +0000 (23:31 -0600)]
bootstd: mmc: Add a bootdev driver

Add a bootdev driver for MMC. It mostly just calls the bootdev helper
function.

Add a function to obtain the block device for an MMC controller.

Fix up the comment for mmc_get_blk_desc() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add an implementation of distro boot
Simon Glass [Mon, 25 Apr 2022 05:31:13 +0000 (23:31 -0600)]
bootstd: Add an implementation of distro boot

Add a bootmeth driver which handles distro boot from a disk, so we can
boot a bootflow using this commonly used mechanism.

In effect, this provides the same functionality as the 'sysboot' command
and shares the same code. But the interface into it is via a bootmeth.

For now this requires the 'pxe' command be enabled. Future work may tidy
this up so that it can be used without CONFIG_CMDLINE being enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add a bootmeth command
Simon Glass [Mon, 25 Apr 2022 05:31:12 +0000 (23:31 -0600)]
bootstd: Add a bootmeth command

Add a 'bootmeth' command to handle listing and ordering of boot methods.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add a bootflow command
Simon Glass [Mon, 25 Apr 2022 05:31:11 +0000 (23:31 -0600)]
bootstd: Add a bootflow command

Add a 'bootflow' command to handle listing and selection of bootflow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add a bootdev command
Simon Glass [Mon, 25 Apr 2022 05:31:10 +0000 (23:31 -0600)]
bootstd: Add a bootdev command

Add a 'bootdev' command to handle listing and selection of bootdevs.

Disable standard boot for a few boards which otherwise run out of space.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add support for bootflows
Simon Glass [Mon, 25 Apr 2022 05:31:09 +0000 (23:31 -0600)]
bootstd: Add support for bootflows

Add support for bootflows, including maintaining a list of them and
iterating to find them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add the bootmeth uclass and helpers
Simon Glass [Mon, 25 Apr 2022 05:31:08 +0000 (23:31 -0600)]
bootstd: Add the bootmeth uclass and helpers

A bootmeth is a method of locating an operating system. For now, just
add the uclass itself. Drivers for particular bootmeths are added later.

If no bootmeths devices are included in the devicetree, create them
automatically. This avoids the need for boilerplate in the devicetree
files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add the bootdev uclass
Simon Glass [Mon, 25 Apr 2022 05:31:07 +0000 (23:31 -0600)]
bootstd: Add the bootdev uclass

A 'bootdev' is a device which can be used to boot an operating system.
It is a child of the media device (e.g. MMC) which handles reading files
from that device, such as a bootflow file.

Add a uclass for bootdev and the various helpers needed to make it
work. Also add a binding file, empty for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add the bootstd uclass and core implementation
Simon Glass [Mon, 25 Apr 2022 05:31:06 +0000 (23:31 -0600)]
bootstd: Add the bootstd uclass and core implementation

The 'bootstd' device provides the central information about U-Boot
standard boot.

Add a uclass for bootstd and the various helpers needed to make it
work. Also add a binding file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add the concept of a bootflow
Simon Glass [Mon, 25 Apr 2022 05:31:05 +0000 (23:31 -0600)]
bootstd: Add the concept of a bootflow

A bootflow encapsulates the process used to boot an operating system.
It typically has a control file (such as extlinux.conf) and information
about which 'bootdev' it came from.

Add the header file for this first, since it is needed by all other
files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofs: Add a function to set the filesystem type
Simon Glass [Mon, 25 Apr 2022 05:31:04 +0000 (23:31 -0600)]
fs: Add a function to set the filesystem type

When sandbox is used with hostfs we won't have a block device, but still
must set up the filesystem type before any filesystem operation, such as
loading a file. Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: blk: Add a function to return the device type
Simon Glass [Mon, 25 Apr 2022 05:31:03 +0000 (23:31 -0600)]
dm: blk: Add a function to return the device type

Use the uclass name to get the device type for a block device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: dm: Restart USB before assuming it is stopped
Simon Glass [Mon, 25 Apr 2022 05:31:02 +0000 (23:31 -0600)]
test: dm: Restart USB before assuming it is stopped

Update the blk test to stop USB first, in case another test has started
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: fastboot: Avoid using mmc1
Simon Glass [Mon, 25 Apr 2022 05:31:01 +0000 (23:31 -0600)]
test: fastboot: Avoid using mmc1

The bootflow tests need to use an MMC with an associated backing file
containing a filesystem. Update the fastboot tests to cope with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Allow finding a uclass device by partial name
Simon Glass [Mon, 25 Apr 2022 05:31:00 +0000 (23:31 -0600)]
dm: core: Allow finding a uclass device by partial name

In some cases two devices are related and the only way to tell is to
check that the names partially patch. Add a way to check this without
needing to create a new string for the comparison.

Fix the comment for device_find_child_by_namelen() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Rename and fix uclass_get_by_name_len()
Simon Glass [Mon, 25 Apr 2022 05:30:59 +0000 (23:30 -0600)]
dm: core: Rename and fix uclass_get_by_name_len()

It seems that namelen is more common in U-Boot. Rename this function to
fit in better. Also fix a bug where it breaks the operation of
uclass_get_by_name() and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reported-by: Tim Harvey <tharvey@gateworks.com>
2 years agolib: Add a way to find the postiion of a trailing number
Simon Glass [Mon, 25 Apr 2022 05:30:58 +0000 (23:30 -0600)]
lib: Add a way to find the postiion of a trailing number

At present it is not possible to find out which part of the string is the
number part and which is before it. Add a new variant which provides this
feature, so we can separate the two in the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agolib: Fix a few bugs in trailing_strtoln()
Simon Glass [Mon, 25 Apr 2022 05:30:57 +0000 (23:30 -0600)]
lib: Fix a few bugs in trailing_strtoln()

At present this has a minor bug in that it reads the byte before the
start of the string, if it is empty. Also it doesn't handle a
non-numeric prefix which is only one character long.

Fix these bugs with a reworked implementation. Add a test for the second
case. The first one is hard to test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agolib: Correct comment formatting to avoid sphinx problems
Simon Glass [Mon, 25 Apr 2022 05:30:56 +0000 (23:30 -0600)]
lib: Correct comment formatting to avoid sphinx problems

Tweak a few comments to kep sphinx happy, in case we want to include this
file one day.

Also fix the 'exxamine' typo.

Patch-notes:
This uses:

   sed -i 's/@param \(\S*\)\s*/@\1: /' include/vsprintf.h

to convert the @param to the new format.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Add tests for trailing_strtol()
Simon Glass [Mon, 25 Apr 2022 05:30:55 +0000 (23:30 -0600)]
test: Add tests for trailing_strtol()

This function currently has no tests. Add some.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agolib: Move string tests to the string module
Simon Glass [Mon, 25 Apr 2022 05:30:54 +0000 (23:30 -0600)]
lib: Move string tests to the string module

A few string tests were added to the print module by mistake. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocmd: part: add explicit dependency on PARTITIONS
AKASHI Takahiro [Fri, 22 Apr 2022 01:44:30 +0000 (10:44 +0900)]
cmd: part: add explicit dependency on PARTITIONS

This is a follow-up patch for my "disk: don't compile in partition
support for spl/tpl if not really necessary".

"part" command is useful only if, at least, one of partition table types
is selected. So it should have a dependency on PARTITIONS which is now
automatically selected if one of partition table types is enabled.

With this change, *_defconfig which explicitly selects CMD_PART but
has no partition table types enabled should also be fixed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'efi-2022-07-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 23 Apr 2022 22:42:00 +0000 (18:42 -0400)]
Merge tag 'efi-2022-07-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-07-rc1-3

Documentation:

* Document image size parameter of bootefi command

UEFI:

* avoid building partition support in SPL/TPL where not required
* improve integration of EFI subsystem and driver model
* restore ability to boot arbitrary blob

2 years agoefi_loader: disk: use udevice instead of blk_desc
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:17 +0000 (10:05 +0900)]
efi_loader: disk: use udevice instead of blk_desc

In most of all cases, we can avoid using blk_desc which is expected
to be private to udevice(UCLASS_BLK), that is, the data should not
be manipulated outside the device driver unless really needed.

Now efi_disk's internally use dev_read/write() interfaces
if CONFIG_PARTITIONS is enabled.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: disk: add read/write interfaces with udevice
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:16 +0000 (10:05 +0900)]
dm: disk: add read/write interfaces with udevice

In include/blk.h, Simon suggested:
===>
/*
 * These functions should take struct udevice instead of struct blk_desc,
 * but this is convenient for migration to driver model. Add a 'd' prefix
 * to the function operations, so that blk_read(), etc. can be reserved for
 * functions with the correct arguments.
 */
unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start,
                        lbaint_t blkcnt, void *buffer);
unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start,
                         lbaint_t blkcnt, const void *buffer);
unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start,
                         lbaint_t blkcnt);
<===

So new interfaces are provided with this patch.

They are expected to be used everywhere in U-Boot at the end.
The exceptions are block device drivers, partition drivers and efi_disk
which should know details of blk_desc structure.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agoefi_loader: disk: not delete BLK device for BLK(IF_TYPE_EFI_LOADER) devices
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:15 +0000 (10:05 +0900)]
efi_loader: disk: not delete BLK device for BLK(IF_TYPE_EFI_LOADER) devices

When we create an efi_disk device with an UEFI application using driver
binding protocol, the 'efi_driver' framework tries to create
a corresponding block device(UCLASS_BLK/IF_TYPE_EFI). This will lead to
calling a PROBE callback, efi_disk_probe().
In this case, however, we don't need to create another "efi_disk" device
as we already have this device instance.

So we should avoid recursively invoke further processing in the callback
function.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoefi_loader: disk: a helper function to delete efi_disk objects
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:14 +0000 (10:05 +0900)]
efi_loader: disk: a helper function to delete efi_disk objects

This function is expected to be called, in particular from dm's pre_remove
hook, when associated block devices no longer exist.

Add efi_disk_remove() function.
This function removes an efi_disk object for a raw disk device (UCLASS_BLK)
and related objects for its partitions (UCLASS_PARTITION).

So this function is expected to be called through driver model's "remove"
interface every time a raw disk device is to be disconnected.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoefi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:13 +0000 (10:05 +0900)]
efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices

When we create an efi_disk device with an UEFI application using driver
binding protocol, the 'efi_driver' framework tries to create
a corresponding block device(UCLASS_BLK/IF_TYPE_EFI). This will lead to
calling a PROBE callback, efi_disk_probe().
In this case, however, we don't need to create another "efi_disk" device
as we already have this device instance.

So we should avoid recursively invoke further processing in the callback
function.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoefi_loader: disk: a helper function to create efi_disk objects from udevice
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:12 +0000 (10:05 +0900)]
efi_loader: disk: a helper function to create efi_disk objects from udevice

Add efi_disk_probe() function.
This function creates an efi_disk object for a raw disk device (UCLASS_BLK)
and additional objects for related partitions (UCLASS_PARTITION).

So this function is expected to be called through driver model's "probe"
interface every time one raw disk device is detected and activated.
We assume that partition devices (UCLASS_PARTITION) have been created
when this function is invoked.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agoefi_loader: split efi_init_obj_list() into two stages
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:11 +0000 (10:05 +0900)]
efi_loader: split efi_init_obj_list() into two stages

In the next commit, CONFIG_EFI_SETUP_EARLY will become mandated
in order to support dynamic enumeration of efi_disk objects.

This can, however, be problematic particularly in case of file-based
variable storage (efi_variable.c, default).
Non-volatile variables are to be restored from EFI system partition
by efi_init_variables() in efi_init_obj_list(). When efi_init_obj_list()
is called in board_init_r(), we don't know yet what disk devices
we have since none of device probing commands (say, scsi rescan) has not
been executed at that stage.

So in this commit, a preparatory change is made; efi_init_obj_list() is
broken into the two functions;
   * efi_init_early(), and
   * new efi_init_obj_list()

Only efi_init_early() will be called in board_init_r(), which allows
us to execute any of device probing commands, either though "preboot"
variable or normal command line, before calling efi_init_obj_list() which
is to be invoked at the first execution of an efi-related command
(or at efi_launch_capsules()) as used to be.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agodm: blk: add a device-probe hook for scanning disk partitions
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:10 +0000 (10:05 +0900)]
dm: blk: add a device-probe hook for scanning disk partitions

Now that all the block device drivers have enable a probe hook, we will
call part_create_block_devices() to enumerate all the partitions and
create associated udevices when a block device is detected.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: disk: add UCLASS_PARTITION
AKASHI Takahiro [Tue, 19 Apr 2022 01:05:09 +0000 (10:05 +0900)]
dm: disk: add UCLASS_PARTITION

NOTE: probably we have to update config dependencies,
in particular, SPL/TPL_PRINTF?

With this new function, UCLASS_PARTITION devices will be created as
child nodes of UCLASS_BLK device.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agotest: dm: add tests for tag support
AKASHI Takahiro [Fri, 15 Apr 2022 07:15:37 +0000 (16:15 +0900)]
test: dm: add tests for tag support

The new test covers all tag-related interfaces.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: tag: add some document
AKASHI Takahiro [Fri, 15 Apr 2022 07:15:36 +0000 (16:15 +0900)]
dm: tag: add some document

Some basic stuff about tag support is explained under
doc/devlop/driver-model.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: tag: change ENOSPC to ENOMEM
AKASHI Takahiro [Fri, 15 Apr 2022 07:15:35 +0000 (16:15 +0900)]
dm: tag: change ENOSPC to ENOMEM

ENOMEM is a more common error code for memory starvation.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agobootmenu: fix menu API error handling
Masahisa Kojima [Thu, 24 Mar 2022 13:54:33 +0000 (22:54 +0900)]
bootmenu: fix menu API error handling

U-Boot menu framework(common/menu.c) returns 1 if it is successful,
returns negative value if it fails.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodisk: don't compile in partition support for spl/tpl if not really necessary
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:58 +0000 (10:01 +0900)]
disk: don't compile in partition support for spl/tpl if not really necessary

Under the current Kconfigs, disk/part.c will be compiled in even if none of
partition table types are enabled. This will lead to the size growth of SPL
/TPL code.

With this patch, CONFIG_PARTITIONS is selected only if, at least, one of
CONFIG_*_PARTITION is enabled.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agoefi_loader: disk: compile efi_disk when CONFIG_BLK
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:57 +0000 (10:01 +0900)]
efi_loader: disk: compile efi_disk when CONFIG_BLK

Now we can build efi_loader with block device support (CONFIG_BLK) and
without CONFIG_PARTITIONS.
So change Makefile.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agoefi_loader: PARTITION_UUIDS should be optional
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:56 +0000 (10:01 +0900)]
efi_loader: PARTITION_UUIDS should be optional

In the current implementation, partition table support (either GPT or DOS)
is not mandatory. So CONFIG_PARTITION_UUIDS should not be enabled
(selected) unconditionally.

Fixes: commit 17f8cda505e3 ("efi_loader: set partition GUID in device path for SIG_TYPE_GUID")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agosandbox: move a function prototype
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:55 +0000 (10:01 +0900)]
sandbox: move a function prototype

Since host_get_dev_errr() is defined in drivers/block/sandbox.c,
the associated function prototype should be in a more appropriate
header file.

Fixes: commit 4101f6879256 ("dm: Drop the block_dev_desc_t typedef")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agodisk: define nullified functions for !PARTITIONS
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:54 +0000 (10:01 +0900)]
disk: define nullified functions for !PARTITIONS

Some defconfig enables CMD_PART even if none of any partition table
types (CONFIG_*_PARTITION) are enabled.
This will lead to the size growth in SPL/TPL code since disk/part.c
will be compiled in any way.
We will change disk/Kconfig later so that CONFIG_PARTITIONS is only
enabled when, at least, one of CONFIG_*_PARTITION is enabled.

To make the build work (in particular, "part" command) correctly,
a few functions should be defined as void functions in case of
!CONFIG_PARTITIONS.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agodisk: enable function prototypes in part.h for SPL/TPL
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:53 +0000 (10:01 +0900)]
disk: enable function prototypes in part.h for SPL/TPL

Since CONFIG_[SPL|TPL]_PARTITIONS were introduced, part.h has not been
updated. Due to this, while the build won't fail, some functionality may
possibly break as some partition-related functions are nullified even
though some partition table types are enabled for SPL/TPL.

Fixes: commit 88ca8e26958b ("disk: Add an option for partitions in SPL")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agodisk: include errno.h explicitly in part.h
AKASHI Takahiro [Tue, 19 Apr 2022 01:01:52 +0000 (10:01 +0900)]
disk: include errno.h explicitly in part.h

Some errno numbers are used in defining inline functions.
So "errno.h" should be explicitly included to avoid possible build errors.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agodoc: update bootefi man-page
Heinrich Schuchardt [Mon, 11 Apr 2022 19:06:13 +0000 (21:06 +0200)]
doc: update bootefi man-page

A image_size parameter has been added to the bootefi parameter.
Describe all parameters.

Correct how the description of how the device-path in the loaded
image protocol is determined.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agocmd: bootefi: restore ability to boot arbitrary blob
Kyle Evans [Sun, 10 Apr 2022 21:05:55 +0000 (16:05 -0500)]
cmd: bootefi: restore ability to boot arbitrary blob

Up until commit 5f59518a7b1ae ("efi_loader: setting boot device"), we
could boot an arbitrary blob with bootefi. Indeed, efi_run_image() even
has a special case for missing device paths indicating a payload that
was directly loaded via JTAG, for example.

Restore the ability to inject a UEFI payload into memory and `bootefi`
it. If the address passed isn't the last PE-COFF loaded, then we'll
wipe out the pre-existing DP/Image information and let efi_run_image()
synthesize a memory device path.

An image size is required if we're booting an arbitrary payload, and
the FDT argument has been changed to accept `-`. The size could be
deduced from the image header, but it's required anyways as an explicit
acknowledgment that one's trying to boot an arbitrary payload rather
than accidentally using the wrong address in the single-addr form.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotools: kwboot: Fix spelling of "followed" in kwboot.1
Vagrant Cascadian [Wed, 20 Apr 2022 00:48:27 +0000 (17:48 -0700)]
tools: kwboot: Fix spelling of "followed" in kwboot.1

Fix spelling of "followed" in kwboot.1 manpage.

Series: 2
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
2 years agodoc: board: apple: Mention M1 Ultra support
Mark Kettenis [Fri, 15 Apr 2022 12:19:28 +0000 (14:19 +0200)]
doc: board: apple: Mention M1 Ultra support

U-Boot now supports the M1 Ultra SoC as found in the new Mac Studio.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoMerge branch '2022-04-22-assorted-updates'
Tom Rini [Sat, 23 Apr 2022 12:06:28 +0000 (08:06 -0400)]
Merge branch '2022-04-22-assorted-updates'

- Add "-q" to fdt addr and use it in distro_bootcmd to make the user
  experience less scary reading in normal try/fail cases.
- Let the adc update an environment variable like many other commands do
- Fix TPL SEPARATE_BSS check when locating DTB
- Allow ":" in PXE file names again
- Two Apple M1 fixes

2 years agoarm: apple: Point stdout-path to framebuffer when keyboard present
Mark Kettenis [Tue, 19 Apr 2022 19:20:31 +0000 (21:20 +0200)]
arm: apple: Point stdout-path to framebuffer when keyboard present

Unless you have a spare Apple Silicon machine, getting access to
the serial port on Apple Silicon machines requires special
hardware. Given that most machines come with a built-in screen
the framebuffer is likely to be the most convenient output device
for most users. While U-Boot will output to both serial and
framebuffer, OSes might not. Therefore set stdout-path to point
at /chosen/framebuffer when a keyboard is connected to the machine.

This behaviour can be overridden by setting the "stdout" variable
in the U-Boot environment. I addition to that keep the serial
console as the default when running under the m1n1 hypervisor.
The m1n1 hypervisor virtualizes the serial port such that it
can be easily accessed from any other machine with a USB port.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Janne Grunau <j@jannau.net>
Tested-by: Janne Grunau <j@jannau.net>
2 years agoarm: apple: Don't clear framebuffer
Mark Kettenis [Tue, 19 Apr 2022 19:10:29 +0000 (21:10 +0200)]
arm: apple: Don't clear framebuffer

Enable CONFIG_NO_FB_CLEAR to preserve the Asahi logo. Since that
logo is drawn on a black background also enable
CONFIG_SYS_WHITE_ON_BLACK such that text printed by U-Boot is still
visible.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoAllow colon in PXE bootfile URLs
Lyle Franklin [Sat, 16 Apr 2022 15:36:43 +0000 (11:36 -0400)]
Allow colon in PXE bootfile URLs

- U-boot's PXE flow supports prefixing your bootfile name with an
  IP address to fetch from a server other than the DHCP server,
  e.g. `hostIPaddr:bootfilename`:
  https://github.com/u-boot/u-boot/commit/a93907c43f847f076dd0e34ee3b69b5e8e6d0d29
- However, this breaks bootfile paths which contain a colon, e.g.
  `f0:ad:4e:10:1b:87/7/pxelinux.cfg/default`
- This patch checks whether the `hostIPaddr` prefix is a valid
  IP address before overriding the serverIP otherwise the whole
  bootfile path is preserved

Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com>
2 years agofdt: Add -q option to fdt addr for distro_bootcmd
Peter Hoyes [Thu, 31 Mar 2022 10:53:22 +0000 (11:53 +0100)]
fdt: Add -q option to fdt addr for distro_bootcmd

distro_bootcmd uses this construct a few times to test $fdt_addr_r,
and fall back on $fdtcontroladdr if not set/invalid:

    if fdt addr ${fdt_addr_r}; then
        ...
    else
        ...
    fi

If the `fdt addr` test fails, it prints the following  message on the
console, suggesting there is an error when there is not:

    libfdt fdt_check_header(): FDT_ERR_BADMAGIC

To remove this potentially confusing error message, this patch adds -q
as a 'quiet' option for fdt addr, and uses this flag in
config_distro_bootcmd.h

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
2 years agocmd: adc: Add support for storing ADC result in env variable
Marek Vasut [Thu, 14 Apr 2022 16:52:25 +0000 (18:52 +0200)]
cmd: adc: Add support for storing ADC result in env variable

Add the ability to save ADC conversion result in an environment
variable. This is useful for further arbitrary processing by the
U-Boot scripts.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agofdt: Fix TPL SEPARATE_BSS check when locating DTB
Andrew Abbott [Sat, 16 Apr 2022 00:12:31 +0000 (10:12 +1000)]
fdt: Fix TPL SEPARATE_BSS check when locating DTB

Commit 690af71850149bf242502f688eca80fb302d1f76 changed this condition
from an explicit

IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)

to

CONFIG_IS_ENABLED(SEPARATE_BSS)

The documentation for CONFIG_IS_ENABLED() in include/linux/kconfig.h
implies that we will get the correct behaviour, but the actual behaviour
differs such that this condition is now always false.

This stopped TPL being able to load the device tree blob at least on the
ROCKPro64 board (RK3399 SoC), since the wrong device tree location was
chosen.

The issues causing this behaviour with CONFIG_IS_ENABLED() are:

1. The documentation implies that CONFIG_SPL_BUILD =>
   CONFIG_SPL_<option> is considered before the TPL equivalent.

   Actually, the TPL options have higher priority - see definition of
   _CONFIG_PREFIX.

2. The documentation implies a fallthrough, eg. if CONFIG_SPL_BUILD is
   defined but the CONFIG_SPL_<option> is not, then it will proceed to
   check if CONFIG_TPL_BUILD

   Actually, if CONFIG_TPL_BUILD is defined, then it stops there
   and CONFIG_SPL_BUILD is not considered - see definition of
   _CONFIG_PREFIX.

   During TPL build, at least for the ROCKPro64, both CONFIG_TPL_BUILD
   and CONFIG_SPL_BUILD are defined, but because of the above, only TPL
   options are considered. Since there is no CONFIG_TPL_SEPARATE_BSS,
   this fails.

Fixes: 690af71850 ("fdt: Correct condition for SEPARATE_BSS")
Signed-off-by: Andrew Abbott <andrew@mirx.dev>
2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-pmic
Tom Rini [Fri, 22 Apr 2022 15:06:38 +0000 (11:06 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-pmic

2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Fri, 22 Apr 2022 15:06:31 +0000 (11:06 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

2 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 22 Apr 2022 14:17:35 +0000 (10:17 -0400)]
configs: Resync with savedefconfig

Resync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agopower-domain: Fix use of uninitialized value in dev_power_domain_ctrl
Sean Anderson [Wed, 23 Mar 2022 18:26:09 +0000 (14:26 -0400)]
power-domain: Fix use of uninitialized value in dev_power_domain_ctrl

If dev_count_phandle_with_args returns 0 or another error, then pd will never
have been initialized by power_domain_get_by_index. Avoid comparing against
pd.dev in this situation.

Fixes: 3e4fcfa4bc ("power-domain: fix hang in endless loop on i.MX8")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Fri, 22 Apr 2022 12:12:53 +0000 (08:12 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-watchdog

- device-tree-bindings: watchdog: document common properties (Philippe)
- nuvoton: Add support for Nuvoton (Jim)

2 years agoMerge tag 'u-boot-imx-20220422' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Fri, 22 Apr 2022 12:12:20 +0000 (08:12 -0400)]
Merge tag 'u-boot-imx-20220422' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20220422
-------------------

- Switch to DM_SERIAL
- Drop MMCROOT
- several cleanup

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/11815