platform/kernel/u-boot.git
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 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

2 years agoAdd support for TP-Link UE200 dongle
Oleksii Titov [Wed, 20 Apr 2022 08:23:25 +0000 (11:23 +0300)]
Add support for TP-Link UE200 dongle

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Oleksii Titov <ootitov@gmail.com>
2 years agousb: dwc3: Add support for usb3-phy PHY configuration
Michal Simek [Wed, 9 Mar 2022 09:05:45 +0000 (10:05 +0100)]
usb: dwc3: Add support for usb3-phy PHY configuration

When usb3-phy label is found, PHY driver is called and serdes line is
initialized. This is preparation for serdes/psgtr driver to configure GT
lines based on description in DT.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agogeneric-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/
Michal Simek [Wed, 9 Mar 2022 09:05:44 +0000 (10:05 +0100)]
generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/

Allow to disable PHY driver in SPL because it checks the CONFIG_SPL_PHY
variable for SPL builds.

The same change was done for usb by commit fd09c205fc57 ("usb:
s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agousb: gadget: ci: Make various ops const
Adam Ford [Fri, 4 Mar 2022 22:59:02 +0000 (16:59 -0600)]
usb: gadget: ci: Make various ops const

ci_udc_ops and ci_ep_ops do not change their operations.
Mark them as const.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agowdt: nuvoton: Add support for Nuvoton
Jim Liu [Fri, 1 Apr 2022 09:59:39 +0000 (17:59 +0800)]
wdt: nuvoton: Add support for Nuvoton

Add watchdog controller driver for NPCM7xx/npcm8xx

the wdt design of npcm750 and npcm845 is the same.
so the driver can work on npcm750 and npcm845.
about npcm845 wdt dtsi i will followed kernel dts name
to use nuvoton,npcm750-wdt.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: device-tree-bindings: watchdog: document common properties
Philippe Reynes [Wed, 9 Mar 2022 13:56:19 +0000 (14:56 +0100)]
doc: device-tree-bindings: watchdog: document common properties

Adds simple documentation about common properties for watchdog
in the device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch '2022-04-21-further-cleanups'
Tom Rini [Thu, 21 Apr 2022 23:55:38 +0000 (19:55 -0400)]
Merge branch '2022-04-21-further-cleanups'

- Fix SPL_SYS_MALLOC_SIMPLE and non-SPL_FRAMEWORK boards (a large number
  of PowerPC platforms)
- Remove duplication of crc16 functionality
- Migrate COUNTER_FREQUENCY to CONFIG_COUNTER_FREQUENCY and have it in
  Kconfig

2 years agoARM: imx: imx8mn-evk: change environment address variables
Heiko Thiery [Thu, 24 Feb 2022 20:07:14 +0000 (21:07 +0100)]
ARM: imx: imx8mn-evk: change environment address variables

Currently the space between kernel_addr_r and the fdt_addr_r is only 32MB.
To have enough space to load kernel images bigger than 32MB change the
variables to a feasible value.

The new environment variables layout is based on the scheme from
"include/configs/ti_armv7_common.h".

The CONFIG_SYS_LOAD_ADDR value is set to 0x42000000. With that we have
the same value as for the kernel_addr_r.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: imx: drop IMX_FEC_BASE
Peng Fan [Fri, 15 Apr 2022 04:23:43 +0000 (12:23 +0800)]
configs: imx: drop IMX_FEC_BASE

IMX_FEC_BASE is not used in these boards, so drop it.

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8mm-cl-iot-gate: Remove redundant board_fix_fdt()
Ying-Chun Liu (PaulLiu) [Wed, 20 Apr 2022 15:37:07 +0000 (23:37 +0800)]
imx8mm-cl-iot-gate: Remove redundant board_fix_fdt()

In arch/arm/mach-imx/imx8m/soc.c there's an implementation of
board_fix_fdt() introduced by commit 35bb60787b88. Remove the
redundant one to avoid failed to build from source when enabling
CONFIG_OF_BOARD_FIXUP.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoarm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid
Peng Fan [Wed, 13 Apr 2022 09:47:22 +0000 (17:47 +0800)]
arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid

Since COUNTER_FREQUENCY is obselete, so set cntfrq_el0 if
CONFIG_COUNTER_FREQUENCY is valid

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
2 years agoinclude/configs: drop COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:21 +0000 (17:47 +0800)]
include/configs: drop COUNTER_FREQUENCY

Since we have CONFIG_COUNTER_FREQUENCY enabled, no need COUNTER_FREQUENCY

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: set CONFIG_COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:20 +0000 (17:47 +0800)]
configs: set CONFIG_COUNTER_FREQUENCY

Set CONFIG_COUNTER_FREQUENCY according to COUNTER_FREQUENCY in
config header file.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
[trini: Re-run migration]

2 years agoarch: arm: Kconfig: set default COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:19 +0000 (17:47 +0800)]
arch: arm: Kconfig: set default COUNTER_FREQUENCY

Set default COUNTER_FREQUENCY according to config header file
under include/configs/
i.MX6UL/ULL/7D/8QM/8QXP all has system counter frequency run at 8MHz,
so set default value for them.
SUNXI/EXYNOS/ROCKCHIP_RK3128/ROCKCHIP_RK3288/ROCKCHIP_RK322X/ROCKCHIP_RK3036
at 24MHz. ARCH_LX2160A at 25MHz
ARCH_ZYNQMP at 100MHz

2 years agoarch: arm: move COUNTER_FREQUENCY from versal to arm
Peng Fan [Wed, 13 Apr 2022 09:47:18 +0000 (17:47 +0800)]
arch: arm: move COUNTER_FREQUENCY from versal to arm

Make COUNTER_FREQUENCY usable to armv8 and armv7-a, not limited to
versal. And update help message.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoxilinx: versal: board: use CONFIG_COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:17 +0000 (17:47 +0800)]
xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
2 years agomisc: atsha204a: Remove duplicate CRC-16 implementation
Pali Rohár [Tue, 12 Apr 2022 09:20:44 +0000 (11:20 +0200)]
misc: atsha204a: Remove duplicate CRC-16 implementation

ATSHA204A uses bit-reversed checksum of standard CRC-16 with polynomial
x^16 + x^15 + x^2 + 1.

This ATSHA204A specific checksum can be calculated just by using common
U-Boot functions bitrev16() and crc16().

So replace custom driver CRC-16 implementation by common U-Boot functions.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agofs: ext4: Use CRC-16 implementation from linux/crc16.h
Pali Rohár [Tue, 12 Apr 2022 09:20:43 +0000 (11:20 +0200)]
fs: ext4: Use CRC-16 implementation from linux/crc16.h

Implementation in linux/crc16.h provides standard CRC-16 algorithm with
polynomial x^16 + x^15 + x^2 + 1. Use it and remove duplicate ext4 CRC-16
specific code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocrc16: Move standard CRC-16 implementation from ubifs to lib
Pali Rohár [Tue, 12 Apr 2022 09:20:42 +0000 (11:20 +0200)]
crc16: Move standard CRC-16 implementation from ubifs to lib

This implementation provides standard CRC-16 algorithm with polynomial
x^16 + x^15 + x^2 + 1.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocrc16: Rename fs/ubifs/crc16.h to include/linux/crc16.h
Pali Rohár [Tue, 12 Apr 2022 09:20:41 +0000 (11:20 +0200)]
crc16: Rename fs/ubifs/crc16.h to include/linux/crc16.h

File fs/ubifs/crc16.h is standard linux's crc16.h include file. So move it
from fs/ubifs to include/linux where are also other linux include files.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocrc16-ccitt: Rename file with CRC-16-CCITT implementation to crc16-ccitt.c
Pali Rohár [Tue, 12 Apr 2022 09:20:40 +0000 (11:20 +0200)]
crc16-ccitt: Rename file with CRC-16-CCITT implementation to crc16-ccitt.c

U-Boot CRC-16 implementation uses polynomial x^16 + x^12 + x^5 + 1 which is
not standard CRC-16 algorithm, but it is known as CRC-16-CCITT. Rename file
crc16.c to crc16-ccitt.c to reduce confusion.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoSPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default
Pali Rohár [Fri, 8 Apr 2022 08:28:05 +0000 (10:28 +0200)]
SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default

On P2020 board is SPL malloc simple always failing with error and loops:

  SD boot...
  alloc space exhausted
  Bad trap at PC: f8f8b5f0, SR: 21200, vector=d00
  NIP: 00000000 XER: 00000000 LR: 00000000 REGS: f8f8b5f0 TRAP: 20000000 DAR: 00000000
  MSR: 00021200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

  GPR00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR08: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR24: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  Call backtrace:
  Exception in kernel pc f8f8b5f0 signal 0

Inspection showed that gd->malloc_limit is zero. And it is because
generally SPL_FRAMEWORK initialize SPL's gd->malloc_limit. But when
SPL_FRAMEWORK is not enabled then in most cases nobody initialize
gd->malloc_limit and so SPL malloc simple does not work.

So disable SPL_SYS_MALLOC_SIMPLE by default when SPL_FRAMEWORK is not
enabled. SPL_SYS_MALLOC_SIMPLE can be disabled only by setting
SPL_SYS_MALLOC_F_LEN to zero. So do it.

This change fixes SPL error "alloc space exhausted" on P2020 board.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 21 Apr 2022 15:44:54 +0000 (11:44 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mrvl_uart.sh: Remove script (Pali)
- Fix Espressobin build for configs where ENV is not in SPI (Rogier)
- mvebu: a37xx: Add support for reading OTP (Pali)
- mvebu: uDPU: Ethernet fixes and misc DT and defconfig changes (Robert)
- mvebu: Add support for reading LD0 and LD1 eFuse (Pali)
- kwboot: Replace fstat()+st_size by lseek()+SEEK_END (Pali)
- mvebu: turris_omnia: Enable CONFIG_CMD_FUSE (Pali)
- arm: Add CONFIG_SPL_SYS_NO_VECTOR_TABLE used on 32bit MVEBU (Pali)
- mvebu: a37xx: Add support for writing Security OTP values (Pali)
- mvebu: turris: Misc enhancements and cleanups / fixes (Pali)
- Sheevaplug : Use Marvell uclass mvgbe and PHY driver for Ethernet (Tony)

2 years agoMerge branch '2022-04-21-assorted-improvements'
Tom Rini [Thu, 21 Apr 2022 14:56:58 +0000 (10:56 -0400)]
Merge branch '2022-04-21-assorted-improvements'

- For the environment, add a arch_env_get_location hook and make use of
  it on some NXP platforms (so that boards can override SoCs).
- Remove some unused squashfs code from SPL
- Resync am335x beaglebone related DTS files
- Enable SPL_SEPARATE_BSS if SPL_BSS_START_ADDR is used

2 years agoimx: Fix build error
Ye Li [Tue, 19 Apr 2022 09:13:25 +0000 (14:43 +0530)]
imx: Fix build error

Fix wrong environment.h and remove DECLARE_GLOBAL_DATA_PTR

Fixes: 30e39ac7c9 (imx: imx7 Support for Manufacturing Protection)
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
2 years agoimx: Update FSL_MFGPROT config for iMX8M
Ye Li [Tue, 19 Apr 2022 09:13:24 +0000 (14:43 +0530)]
imx: Update FSL_MFGPROT config for iMX8M

Update the Kconfig and Makefile to allow build for iMX8M and
restrict the build only in u-boot.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
2 years agocrypto/fsl: add invalidate_dcache_range for hash output buffer
Gaurav Jain [Tue, 19 Apr 2022 05:22:28 +0000 (10:52 +0530)]
crypto/fsl: add invalidate_dcache_range for hash output buffer

HW accelerated hash operations are giving incorrect hash output.
so invalidate cache lines to avoid cache overwriting in DDR memory region.

caam_hash()
 -moved address alignment check in the beginning of function.
 -added invalidate_dcache_range for pout buffer before running descriptor.

Fixes: d7af2baa49 (crypto/fsl: Fix HW accelerated hash commands)
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agodoc: imx8mn_evk: Do not export ATF_LOAD_ADDR
Fabio Estevam [Mon, 18 Apr 2022 17:15:08 +0000 (14:15 -0300)]
doc: imx8mn_evk: Do not export ATF_LOAD_ADDR

The imx8mn_evk target have been converted to use binman.

With the binman approach the ATF load address is described via
devicetree, so remove the now unneeded instruction of exporting
ATF_LOAD_ADDR.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoimx8mn_evk: Enable cache in SPL
Fabio Estevam [Mon, 18 Apr 2022 17:15:07 +0000 (14:15 -0300)]
imx8mn_evk: Enable cache in SPL

There is no reason for disabling I-cache and D-cache
in SPL.

Remove the unneeded CONFIG_SPL_SYS_ICACHE_OFF and
CONFIG_SPL_SYS_DCACHE_OFF options.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoboard: bsh: imx8mn_bsh_smm_s2/s2pro: enable DM_SERIAL
Michael Trimarchi [Mon, 18 Apr 2022 06:53:36 +0000 (08:53 +0200)]
board: bsh: imx8mn_bsh_smm_s2/s2pro: enable DM_SERIAL

Enable DM_SERIAL for both U_Boot and the SPL. The uart4 and its pinmux
are already marked with u-boot,dm-spl but we need to move the call to
preloader_console_init() after spl_init() to avoid a board hang
as dm can't be used until after spl_init().

Remove the manual config of the UART pinmux now that it is no longer
needed.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Tested-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
2 years agoarm: dts: imx8mp: add of-list support to common imx8mp-u-boot.dtsi
Tim Harvey [Fri, 15 Apr 2022 20:41:54 +0000 (13:41 -0700)]
arm: dts: imx8mp: add of-list support to common imx8mp-u-boot.dtsi

Add support for OF-LIST to common imx8mp-u-boot.dtsi so that it can
be used with boards that have multiple DTB's.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Teresa Remmet <t.remmet@phytec.de>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agocrypto/fsl: Clear the memory when blob decapsulation fails
Gaurav Jain [Fri, 15 Apr 2022 11:22:34 +0000 (16:52 +0530)]
crypto/fsl: Clear the memory when blob decapsulation fails

issue: blob decapsulation operation store the decrypted data
       in memory even if ICV check failed.

fix: clear the blob data output memory.

Fixes: c5de15cbc8 (crypto/fsl: Add command for encapsulating/decapsulating blobs)
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Tested-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoimx: imx8mq-evk: enable CONFIG_DM_SERIAL
Peng Fan [Fri, 15 Apr 2022 04:35:36 +0000 (12:35 +0800)]
imx: imx8mq-evk: enable CONFIG_DM_SERIAL

Marked related nodes as u-boot,dm-spl for serial driver model
Enable CONFIG_DM_SERIAL

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mn_evk: enable CONFIG_DM_SERIAL
Peng Fan [Fri, 15 Apr 2022 04:35:35 +0000 (12:35 +0800)]
imx: imx8mn_evk: enable CONFIG_DM_SERIAL

Enable CONFIG_DM_SERIAL. uart2 and its pinmux was already
marked with u-boot,dm-spl.

move the preloader_console_init() call after spl_init() to
avoid board hang

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mm_evk: enable CONFIG_DM_SERIAL
Peng Fan [Fri, 15 Apr 2022 04:35:34 +0000 (12:35 +0800)]
imx: imx8mm_evk: enable CONFIG_DM_SERIAL

Enable CONFIG_DM_SERIAL. uart2 and its pinmux was already
marked with u-boot,dm-spl.

move the preloader_console_init() call after spl_early_init() to
avoid board hang

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mp_evk: enable CONFIG_DM_SERIAL
Peng Fan [Fri, 15 Apr 2022 04:35:33 +0000 (12:35 +0800)]
imx: imx8mp_evk: enable CONFIG_DM_SERIAL

Enable CONFIG_DM_SERIAL. uart2 and its pinmux was already
marked with u-boot,dm-spl.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoscripts: config_whitelist: drop CONFIG_MMCROOT
Peng Fan [Fri, 15 Apr 2022 04:23:42 +0000 (12:23 +0800)]
scripts: config_whitelist: drop CONFIG_MMCROOT

Drop CONFIG_MMCROOT, no users now.

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: drop CONFIG_MMCROOT
Peng Fan [Fri, 15 Apr 2022 04:23:41 +0000 (12:23 +0800)]
configs: drop CONFIG_MMCROOT

CONFIG_MMCROOT is only used to set mmcroot, no need a dedicated macro.

Script as below
"
 for i in `ls include/configs/*.h`
 do
 mmcroot=`sed -n '/define.*MMCROOT/ p' $i  | awk -F\" '{ print $2;}'`

 if [ ! -n "$mmcroot" ]; then
  continue
 fi

 sed -i '/define.*MMCROOT/ d' $i
 sed -i 's,\" CONFIG_MMCROOT \",'$mmcroot',g' $i

 done
"

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agotreewide: Enable SPL_SEPARATE_BSS if SPL_BSS_START_ADDR is used
Sean Anderson [Tue, 12 Apr 2022 14:59:04 +0000 (10:59 -0400)]
treewide: Enable SPL_SEPARATE_BSS if SPL_BSS_START_ADDR is used

If .bss does not immediately follow the end of the image, then
CONFIG_SPL_SEPARATE_BSS must be selected. Typically, the location of bss
is specified by using CONFIG_SPL_BSS_START_ADDR in a linker script. On
these arches, CONFIG_SPL_SEPARATE_BSS should be enabled. If there is an
option to use an alternate boot script (e.g. CONFIG_SPL_LDSCRIPT is just
a default), just imply. If there is not, select.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agoboard: ti: am335x: Add support for BBE Extended WiFi
Paul Barker [Mon, 11 Apr 2022 15:42:01 +0000 (15:42 +0000)]
board: ti: am335x: Add support for BBE Extended WiFi

The Sancloud BeagleBone Enhanced Extended WiFi (BBE Extended WiFi) has
its own devicetree file and the board can be identified by the 2nd
letter of the config string within the common EEPROM.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2 years agoboard: ti: am335x: Add BBE Lite support
Paul Barker [Mon, 11 Apr 2022 15:42:00 +0000 (15:42 +0000)]
board: ti: am335x: Add BBE Lite support

The Sancloud BeagleBone Enhanced Lite (BBE Lite) has its own devicetree
file and the board can be identified by the 2nd letter of the config
string within the common EEPROM.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2 years agoarm: dts: Resync dts for BeagleBone and derivatives
Paul Barker [Mon, 11 Apr 2022 15:41:59 +0000 (15:41 +0000)]
arm: dts: Resync dts for BeagleBone and derivatives

Sync BeagleBone dts files & TPS dtsi files with Linux v5.17 and include
the SanCloud BBE Extended WiFi dts added in v5.18-rc1. Also pull in
changes to am33xx-l4.dtsi needed to support the BeagleBone Blue.

The change to use the cpsw switch driver (commit c477358e66a3 in Linux)
is excluded from the sync as u-boot does not recognise the new
compatible string.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2 years agofs: Allow to compile FS_SQUASHFS only for proper U-Boot
Pali Rohár [Wed, 6 Apr 2022 21:34:00 +0000 (23:34 +0200)]
fs: Allow to compile FS_SQUASHFS only for proper U-Boot

CONFIG_SPL_FS_SQUASHFS cannot be disabled when CONFIG_FS_SQUASHFS is
enabled. Fix it.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoARM: imx: imx8m: env: Switch to arch_env_get_location()
Marek Vasut [Wed, 6 Apr 2022 00:21:34 +0000 (02:21 +0200)]
ARM: imx: imx8m: env: Switch to arch_env_get_location()

Implement arch_env_get_location() instead of env_get_location(), so that
the env_get_location() can be implemented on board level and override the
arch_env_get_location() architecture defaults.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agoarmv8: layerscape: env: Switch to arch_env_get_location()
Marek Vasut [Wed, 6 Apr 2022 00:21:33 +0000 (02:21 +0200)]
armv8: layerscape: env: Switch to arch_env_get_location()

Implement arch_env_get_location() instead of env_get_location(), so that
the env_get_location() can be implemented on board level and override the
arch_env_get_location() architecture defaults.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agoenv: Implement lower priority arch_env_get_location()
Marek Vasut [Wed, 6 Apr 2022 00:21:32 +0000 (02:21 +0200)]
env: Implement lower priority arch_env_get_location()

Currently there is only one way to override desired environment location,
by implementing env_get_location(). This is increasingly being conflated
both on board level and architecture level, which leads to a problem on
boards where this function is already implemented on architecture level,
since those boards have no way to override this environment location on
board level anymore.

Implement arch_env_get_location() function which is architecture specific
and should only ever be implemented in architecture code. This function
has lower priority than env_get_location(), which should only ever be
implemented in board code, and which overrides the arch_env_get_location()
architecture environment selection.

This way, architecture can define its default environment chooser, while
board can now override it as needed at all times.

There is no functional change, since env_get_location() simply returns
arch_env_get_location(), and arch_env_get_location() implements the
current env_get_location() default content.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agoconfigs: phycore_imx8mm/p: drop unused SDHC macro
Peng Fan [Fri, 15 Apr 2022 04:23:40 +0000 (12:23 +0800)]
configs: phycore_imx8mm/p: drop unused SDHC macro

With SPL_DM_MMC and DM_MMC, the two macros not needed, drop it.
 CONFIG_SYS_FSL_USDHC_NUM
 CONFIG_SYS_FSL_ESDHC_ADDR

Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-By: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: imx8mm/n_venice: drop unused SDHC macro
Peng Fan [Fri, 15 Apr 2022 04:23:39 +0000 (12:23 +0800)]
configs: imx8mm/n_venice: drop unused SDHC macro

With SPL_DM_MMC and DM_MMC, the two macros not needed, drop it.
 CONFIG_SYS_FSL_USDHC_NUM
 CONFIG_SYS_FSL_ESDHC_ADDR

Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-By: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: verdin-imx8m: drop unused SDHC macro
Peng Fan [Fri, 15 Apr 2022 04:23:38 +0000 (12:23 +0800)]
configs: verdin-imx8m: drop unused SDHC macro

With SPL_DM_MMC and DM_MMC, the two macros not needed, drop it.
 CONFIG_SYS_FSL_USDHC_NUM
 CONFIG_SYS_FSL_ESDHC_ADDR

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: imx8qm/qxp_evk: drop unused SDHC macro
Peng Fan [Fri, 15 Apr 2022 04:23:37 +0000 (12:23 +0800)]
configs: imx8qm/qxp_evk: drop unused SDHC macro

With SPL_DM_MMC and DM_MMC, the two macros not needed, drop it.
 CONFIG_SYS_FSL_USDHC_NUM
 CONFIG_SYS_FSL_ESDHC_ADDR

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: mx7dsabresd: drop unused SDHC macro
Peng Fan [Fri, 15 Apr 2022 04:23:36 +0000 (12:23 +0800)]
configs: mx7dsabresd: drop unused SDHC macro

With SPL_DM_MMC and DM_MMC, the two macros not needed, drop it.
 CONFIG_SYS_FSL_USDHC_NUM
 CONFIG_SYS_FSL_ESDHC_ADDR

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>