platform/kernel/u-boot.git
20 months agodm: fpga: Introduce new uclass
Alexander Dahl [Fri, 30 Sep 2022 12:04:30 +0000 (14:04 +0200)]
dm: fpga: Introduce new uclass

For future DM based FPGA drivers and for now to have a meaningful
logging class for old FPGA drivers.

Suggested-by: Michal Simek <michal.simek@amd.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Dahl <post@lespocky.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20220930120430.42307-2-post@lespocky.de
Signed-off-by: Michal Simek <michal.simek@amd.com>
20 months agoMerge branch 'next'
Tom Rini [Mon, 3 Oct 2022 19:39:46 +0000 (15:39 -0400)]
Merge branch 'next'

20 months agoPrepare v2022.10 v2022.10
Tom Rini [Mon, 3 Oct 2022 19:25:32 +0000 (15:25 -0400)]
Prepare v2022.10

Signed-off-by: Tom Rini <trini@konsulko.com>
20 months agoimx8mn-ddr4-evk-u-boot: Fix broken boot
Fabio Estevam [Mon, 3 Oct 2022 14:02:03 +0000 (11:02 -0300)]
imx8mn-ddr4-evk-u-boot: Fix broken boot

When the imx8mn.dtsi file was pulled in from Linux, the UARTs
were moved into an spba sub-node which wasn't being included
in the SPL device tree.  This meant the references to the UART
weren't being handled properly and when booting the system would
constantly reboot.  Fix this by adding the spba node to the spl
device tree to restore normal booting.

Based on the patch from Adam Ford for the imx8mn-beacon-kit-u-boot
board.

Fixes: 4e5114daf9eb ("imx8mn: synchronise device tree with linux")
Signed-off-by: Fabio Estevam <festevam@denx.de>
20 months agoimx8mn-venice-u-boot: Fix broken boot
Fabio Estevam [Mon, 3 Oct 2022 14:01:15 +0000 (11:01 -0300)]
imx8mn-venice-u-boot: Fix broken boot

When the imx8mn.dtsi file was pulled in from Linux, the UARTs
were moved into an spba sub-node which wasn't being included
in the SPL device tree.  This meant the references to the UART
weren't being handled properly and when booting the system would
constantly reboot.  Fix this by adding the spba node to the spl
device tree to restore normal booting.

Based on the patch from Adam Ford for the imx8mn-beacon-kit-u-boot
board.

Fixes: 4e5114daf9eb ("imx8mn: synchronise device tree with linux")
Signed-off-by: Fabio Estevam <festevam@denx.de>
20 months agoMerge branch '2022-09-29-dm-core-support-multiple-device-trees-in-ofnode' into next
Tom Rini [Fri, 30 Sep 2022 19:52:10 +0000 (15:52 -0400)]
Merge branch '2022-09-29-dm-core-support-multiple-device-trees-in-ofnode' into next

To quote the author:
At present the ofnode interface is somewhat limited, in that it cannot
access the device tree provided by the OS, only the one used by U-Boot
itself (assuming these are separate). This prevents using ofnode functions
to handle device tree fixups, i.e. ft_board_setup() and the like.

The ofnode interface was introduced to allow a consistent API to access
the device tree, whether a flat tree or a live tree (OF_LIVE) is in use.

With the flat tree, adding nodes and properties at the start of the tree
(as often happens when writing to the /chosen node) requires copying a
lot of data for each operation. With live tree, such operations are
quite a bit faster, since there is no memory copying required. This has to
be weighed against the required memory allocation with OF_LIVE, as well
as the cost of unflattening and flattening the device tree which U-Boot
is running.

This series enables support for access to multiple device trees with the
ofnode interface. This is already available to some extent with OF_LIVE,
but some of the ofnode functions need changes to allow the tree to be
specified.

The mechanism works by using the top 1-4 bits of the device tree offset.
The sign bit is not affected, since negative values must be supported.

With this implemented, it becomes possible to use the ofnode interface
to do device tree fixups. The only current user is the EVT_FT_FIXUP
event.

This has two main benefits:

- ofnode can now be used everywhere, in preference to the libfdt calls
- live tree can eventually be used everywhere, with potential speed
  improvements when larger number of fixups are used

This series is only a step along the way. Firstly, while it is possible
to access the 'fix-up' tree using OF_LIVE, most of the fixup functions use
flat tree directly, rather than the ofnode interface. These need to be
updated. Also the tree must be flattened again before it is passed to the
OS. This is not currently implemented.

With OFNODE_MULTI_TREE disabled this has almost no effect on code size:
around 4 bytes if EVENT is enabled, 0 if not. With the feature enabled,
the increase is around 700 bytes, e.g. on venice2:

$ buildman -b ofn2a venice2 -sS --step 0
Summary of 2 commits for 1 boards (1 thread, 64 jobs per thread)
01: image: Drop some other #ifdefs in image-board.c
       arm:  w+   venice2
48: wip
       arm: (for 1/1 boards) all +668.0 text +668.0

This size increase is not too bad, considering the extra functionality,
but is too large to enable everywhere. So for now this features needs to
be opt-in only, based on EVENT.

20 months agoMerge tag 'efi-2022-10-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 30 Sep 2022 12:30:38 +0000 (08:30 -0400)]
Merge tag 'efi-2022-10-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-10-rc6

Documentation:

* doc: improve description of autostart

UEFI:

* prefix test functions with efi_st_ in the LoadImage unit test
* avoid a warning message in efi_initrd_deregister()

20 months agodm: core: Support copying properties with ofnode
Simon Glass [Wed, 7 Sep 2022 02:27:33 +0000 (20:27 -0600)]
dm: core: Support copying properties with ofnode

Add a function to copy properties from one node to another.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Allow copying ofnode property data when writing
Simon Glass [Wed, 7 Sep 2022 02:27:32 +0000 (20:27 -0600)]
dm: core: Allow copying ofnode property data when writing

At present ofnode_write_prop() is inconsistent between livetree and
flattree, in that livetree requires the caller to ensure the property
value is stable (e.g. in rodata or allocated) but flattree does not, since
it makes a copy.

This makes the API call a bit painful to use, since the caller must do
different things depending on OF_LIVE.

Add a new 'copy' argument which tells the function to make a copy if
needed. Add some tests to cover this behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agovbe: Allow test to run with live/flat tree
Simon Glass [Wed, 7 Sep 2022 02:27:31 +0000 (20:27 -0600)]
vbe: Allow test to run with live/flat tree

This test can operate in all conditions now. Update the test and comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Expand ofnode tests
Simon Glass [Wed, 7 Sep 2022 02:27:30 +0000 (20:27 -0600)]
dm: core: Expand ofnode tests

The current tests do not cover all functions, nor do they cover the new
multi-tree functionality. Add and update the tests accordingly and update
the 'future work' notes in the documentation.

There is a still more testing needed for the failure cases, since at
present some ofnode functions return a libfdt error code instead of
converting it to an errno.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Create a function to get a live tree in a test
Simon Glass [Wed, 7 Sep 2022 02:27:29 +0000 (20:27 -0600)]
dm: core: Create a function to get a live tree in a test

Move this logic out of the test into separate functions, so we can use it
in other tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Update comments for default-FDT ofnode functions
Simon Glass [Wed, 7 Sep 2022 02:27:28 +0000 (20:27 -0600)]
dm: core: Update comments for default-FDT ofnode functions

Some ofnode functions can only operate on the default device tree, i.e.
U-Boot's control FDT. Add comments to that effect. Fix up the reference to
device tree bindings while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Complete phandle implementation using the other FDT
Simon Glass [Wed, 7 Sep 2022 02:27:27 +0000 (20:27 -0600)]
dm: core: Complete phandle implementation using the other FDT

We need to be able to look up phandles in any FDT, not just the control
FDT. Use the 'other' FDT to test this, with a helper function which gets
this as an oftree that can then we used as needed.

Add a few more tests and some comments at the top of the file, to explain
what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Add the ofnode multi-tree implementation
Simon Glass [Wed, 7 Sep 2022 02:27:26 +0000 (20:27 -0600)]
dm: core: Add the ofnode multi-tree implementation

Add the logic to redirect requests for the device tree through a function
which can look up the tree ID. This works by using the top bits of
ofnode.of_offset to encode a tree.

It is assumed that there will only be a few device trees used at runtime,
typically the control FDT (always tree ID 0) and possibly a separate FDT
to be passed the OS.

The maximum number of device trees supported at runtime is 8, with this
implementation. That would use bits 30:28 of the node-offset value,
meaning that the positive offset range is limited to bits 27:0, versus
30:1 with this feature disabled. That still allows a device tree of up
to 256MB, which should be enough for most FITs. Larger ones can be
supported by using external data with the FIT, or by enabling OF_LIVE.

Update the documentation a little and fix up the comment for
ofnode_valid().

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Add definitions for multiple ofnode trees
Simon Glass [Wed, 7 Sep 2022 02:27:25 +0000 (20:27 -0600)]
dm: core: Add definitions for multiple ofnode trees

At present, unless OF_LIVE is enabled, ofnode only supports access to one
device tree, the control FDT. This is because only the node offset is
encoded in ofnode, with the tree being implicit.

This makes ofnode (without OF_LIVE) unsuitable for device tree fixups, as
implemented by ft_board_setup() and other such functions.

To solve this, we can use the top bits of the node offset to hold a tree
ID.

Add the definitions for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Split ofnode_path_root() into two functions
Simon Glass [Wed, 7 Sep 2022 02:27:24 +0000 (20:27 -0600)]
dm: core: Split ofnode_path_root() into two functions

This function turns out to be a little confusing since it looks up a path
and also registers the tree. Split it into two, one that gets the root
node and one that looks up a path, so the purpose is clear.

Registering the tree will happen in a function to be added in a later
patch, called oftree_from_fdt().

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Allow obtaining a node offset in the same tree
Simon Glass [Wed, 7 Sep 2022 02:27:23 +0000 (20:27 -0600)]
dm: core: Allow obtaining a node offset in the same tree

In some cases we want to obtain an ofnode in the same tree as a different
ofnode, such as when looking up a subnode. At present this is trivial,
since there is only one tree. When there are multiple trees, this
implementation will change.

Also move the ofnode_to_offset() function up higher in the header file,
since we will need to provide a different implementation with multiple
trees.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Add a way to look up a phandle in an oftree
Simon Glass [Wed, 7 Sep 2022 02:27:22 +0000 (20:27 -0600)]
dm: core: Add a way to look up a phandle in an oftree

When we have multiple trees, the ofnode logic needs to be told which one
to use. Create a new function which takes an oftree argument, along with
a helper to obtain the FDT pointer from an oftree.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Add ofnode functions to obtain an oftree
Simon Glass [Wed, 7 Sep 2022 02:27:21 +0000 (20:27 -0600)]
dm: core: Add ofnode functions to obtain an oftree

At present dm_test_ofnode_root() does this manually. Add some inline
functions to handle it, so this code can be centralised.

Add oftree functions to produce a null tree and to check whether a tree
is valid or not.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Add an ofnode function to obtain the flat tree
Simon Glass [Wed, 7 Sep 2022 02:27:20 +0000 (20:27 -0600)]
dm: core: Add an ofnode function to obtain the flat tree

The flat device tree is assumed to be the control FDT but this is not
always the case. Update the ofnode implementation to obtain the node via
an function call so we can eventually add support for selecting different
trees.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Provide a way to reset the device tree
Simon Glass [Wed, 7 Sep 2022 02:27:19 +0000 (20:27 -0600)]
dm: core: Provide a way to reset the device tree

At present there is only one device tree used by the ofnode functions,
except for some esoteric use of live tree. In preparation for supporting
more than one, add a way to reset the list of device trees.

For now this does nothing.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Expand integer-reading tests
Simon Glass [Wed, 7 Sep 2022 02:27:18 +0000 (20:27 -0600)]
dm: core: Expand integer-reading tests

The current tests do not cover all the behaviour. Add some more.

Tidy up a few inconsistencies between livetree and flattree which come to
light with these tests. Also drop the -ENODATA error since it is never
actually returned.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoefi_loader: fix efi_initrd_deregister()
Heinrich Schuchardt [Thu, 29 Sep 2022 23:55:02 +0000 (01:55 +0200)]
efi_loader: fix efi_initrd_deregister()

Don't try to delete a non-existent handle.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
20 months agoefi_selftest: prefix test functions with efi_st_
Heinrich Schuchardt [Thu, 22 Sep 2022 13:16:30 +0000 (15:16 +0200)]
efi_selftest: prefix test functions with efi_st_

An upcoming patch set creates a global function flush(). To make debugging
easier we should not use the same name for a static function.

Rename static functions in the LoadImage() unit test adding an efi_st_
prefix.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agodoc: improve description of autostart
Heinrich Schuchardt [Sat, 10 Sep 2022 07:16:37 +0000 (09:16 +0200)]
doc: improve description of autostart

Complete the list of commands influenced by the autostart environment
variable.

Make it clearer what values qualifies at 'yes'.

Eventually the list of environment variables is to be alphabetically
sorted. Move autostart up.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Drop ofnode_is_available()
Simon Glass [Wed, 7 Sep 2022 02:27:17 +0000 (20:27 -0600)]
dm: core: Drop ofnode_is_available()

This function is also available as ofnode_is_enabled(), so use that
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Add a macro to iterate through properties
Simon Glass [Wed, 7 Sep 2022 02:27:16 +0000 (20:27 -0600)]
dm: core: Add a macro to iterate through properties

Add a 'for_each' macro like we have for nodes.

Fix the comment for struct ofprop while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Avoid creating a name property when unflattening
Simon Glass [Wed, 7 Sep 2022 02:27:15 +0000 (20:27 -0600)]
dm: core: Avoid creating a name property when unflattening

The current implementation creates a 'name' value for every node. This
is not needed for the latest device tree format, which includes a name in
the node header.

Adjust the code to point the name at the node header instead.

Also simplify ofnode_get_name(), now that we can rely on it to set the
name correctly. Update the comment to make it clear what name the root
node has.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Rename ofnode_get_property_by_prop()
Simon Glass [Wed, 7 Sep 2022 02:27:14 +0000 (20:27 -0600)]
dm: core: Rename ofnode_get_property_by_prop()

The current name is quite unwieldy. Change it to use an ofprop_ prefix
and shorten it. Fix the return-value comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Rename ofnode_get_first/next_property()
Simon Glass [Wed, 7 Sep 2022 02:27:13 +0000 (20:27 -0600)]
dm: core: Rename ofnode_get_first/next_property()

Drop the 'get' in these names since it does not fit with the rest of
the API.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Reduce code size with dev_of_offset()
Simon Glass [Wed, 7 Sep 2022 02:27:12 +0000 (20:27 -0600)]
dm: core: Reduce code size with dev_of_offset()

Update the function to mark it with the const attribute. Also avoid
calling it multiple times in the devfdt_get_addr_index() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: test: Provide an easy way to use the other FDT
Simon Glass [Wed, 7 Sep 2022 02:27:11 +0000 (20:27 -0600)]
sandbox: test: Provide an easy way to use the other FDT

Add a test flag which indicates that the 'other' FDT should be set up
ready for use. Handle this by copying in the FDT, unflattening it for
livetree tests. Free the structures when the tests have run.

We cannot use the other FDT unless we are using live tree or
OFNODE_MULTI_TREE is enabled, since only one tree is supported by the
ofnode interface in that case. Add this condition into
ut_run_test_live_flat() and update the comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: Support setting up the other FDT for testing
Simon Glass [Wed, 7 Sep 2022 02:27:10 +0000 (20:27 -0600)]
sandbox: Support setting up the other FDT for testing

Provide a way to copy over the 'other' FDT when running tests. This loads
it and allocates memory for the copy, if not done already, then does the
copy.

Avoid using U-Boot's malloc() pool for these copies, at least for now,
since they are part of the test system.

Tidy up the cpu.c header files while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: Support loading the other FDT
Simon Glass [Wed, 7 Sep 2022 02:27:09 +0000 (20:27 -0600)]
sandbox: Support loading the other FDT

We need an 'other' FDT which is different from the control FDT, so we can
check that the ofnode tests correctly handle them both.

Add this to the build along with a way to read it into the sandbox state.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: Add a function to load a relative file path
Simon Glass [Wed, 7 Sep 2022 02:27:08 +0000 (20:27 -0600)]
sandbox: Add a function to load a relative file path

At present this implementation is specific to loading the test FDT. We
plan to load others, so create a generic function to handle this.

The path is now limited to 256 characters, to simplify the code.

When there is an empty argv[0] (which should not happen), the function now
just uses the path as is, with no prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotest: Drop the UT_TESTF_LIVE_OR_FLAT flag
Simon Glass [Wed, 7 Sep 2022 02:27:07 +0000 (20:27 -0600)]
test: Drop the UT_TESTF_LIVE_OR_FLAT flag

This was a workaround for a rare situation. Now that it will be more
common and we have a proper fix, drop the flag. We can run both types of
tests in the same sandbox executable, even if the flat device tree is
modified.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotest: Detect a change in the device tree
Simon Glass [Wed, 7 Sep 2022 02:27:06 +0000 (20:27 -0600)]
test: Detect a change in the device tree

If the device tree changes during a test and we cannot restore it, mark
it as such so that future tests which need the live tree are skipped.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotest: Make a copy of the device tree before running a test
Simon Glass [Wed, 7 Sep 2022 02:27:05 +0000 (20:27 -0600)]
test: Make a copy of the device tree before running a test

When the flat device tree changes it can mess up the live tree since that
uses the flat tree for its strings. This affects only a few sandbox tests
which modify the device tree, but the number will grow as ofnode support
for writing improves.

While the control FDT is not intended to change while U-Boot is running,
some tests do so. For example, the ofnode interface only supports
modifying properties in the control FDT, so tests must use that.

To solve this problem, keep a copy of the FDT and restore it as needed
when the test is finished. The copy only happens on sandbox (except SPL
builds), to reduce memory usage and because these tests are not useful on
other boards. For other boards, a checksum is taken to ensure that nothing
changes.

It would be possible to always checksum the FDT on sandbox and only
restore it if needed, but this is slightly slower than restoring it every
time, at least with crc8.

Move the code which checks for success to the very end, for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Drop the const from ofnode
Simon Glass [Wed, 7 Sep 2022 02:27:04 +0000 (20:27 -0600)]
dm: core: Drop the const from ofnode

Now that we support writing to ofnodes, the const is not accurate. Drop
it to avoid undesirable casting.

Also drop the ofnode_to_npw() which is now the same as ofnode_to_np().

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Support writing a property to an empty node
Simon Glass [Wed, 7 Sep 2022 02:27:03 +0000 (20:27 -0600)]
dm: core: Support writing a property to an empty node

At present this does not work with livetree. Fix it and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Allow adding ofnode subnodes
Simon Glass [Wed, 7 Sep 2022 02:27:02 +0000 (20:27 -0600)]
dm: core: Allow adding ofnode subnodes

Add this feature to the ofnode interface, supporting both livetree and
flattree. If the node exists it is returned, along with a -EEXIST error.
Update the functions it calls to handle this too.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Document the livetree structures properly
Simon Glass [Wed, 7 Sep 2022 02:27:01 +0000 (20:27 -0600)]
dm: core: Document the livetree structures properly

Clarify the data structure so it is easier for people to understand,
particularly the corner cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotest: Support testing malloc() failures
Simon Glass [Wed, 7 Sep 2022 02:27:00 +0000 (20:27 -0600)]
test: Support testing malloc() failures

It is helpful to test that out-of-memory checks work correctly in code
that calls malloc().

Add a simple way to force failure after a given number of malloc() calls.

Fix a header guard to avoid a build error on sandbox_vpl.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
20 months agotest: Fix missing livetree test runs
Simon Glass [Wed, 7 Sep 2022 02:26:59 +0000 (20:26 -0600)]
test: Fix missing livetree test runs

At present the live tree tests are not run on sandbox. This bug is in two
parts, with a duplicate flag value and incorrect logic in the test runner.
This was not noticed because the bug was fixed in a later commit and does
not cause test failures.

Fix this.

Fixes: 7b1dfc9fd7e ("dm: core: Prepare for updating the device tree with ofnode")

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoevent: Pass the images to EVT_FT_FIXUP
Simon Glass [Wed, 7 Sep 2022 02:26:58 +0000 (20:26 -0600)]
event: Pass the images to EVT_FT_FIXUP

Pass the boot images along as well, in case the fixups need to look at
them.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Pass a root node to of_find_node_by_phandle()
Simon Glass [Wed, 7 Sep 2022 02:26:57 +0000 (20:26 -0600)]
dm: core: Pass a root node to of_find_node_by_phandle()

This function currently assumes that the control FDT is used. Update it
to allow a root node to be passed, so it can work with any tree.

Also add a comment to ofnode_get_by_phandle() so that its purpose is
clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoevent: Allow multiple spy declarations for each event
Simon Glass [Wed, 7 Sep 2022 02:26:56 +0000 (20:26 -0600)]
event: Allow multiple spy declarations for each event

At present only one spy is allowed per event. Update the naming to allow
more than one, since some need this flexibility, e.g. the EVT_FT_FIXUP
event.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoevent: Fix a typo in the EVENT help
Simon Glass [Wed, 7 Sep 2022 02:26:55 +0000 (20:26 -0600)]
event: Fix a typo in the EVENT help

Fix the help message.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: power: Update PMIC driver to use log
Simon Glass [Wed, 7 Sep 2022 02:26:54 +0000 (20:26 -0600)]
sandbox: power: Update PMIC driver to use log

Use the log functions instead of pr_...() so we can avoid using __func__.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
20 months agolog: update the comment for log_msg_ret()
Simon Glass [Wed, 7 Sep 2022 02:26:53 +0000 (20:26 -0600)]
log: update the comment for log_msg_ret()

Add some advice on string size here.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotreewide: Drop image_header_t typedef
Simon Glass [Wed, 7 Sep 2022 02:26:52 +0000 (20:26 -0600)]
treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotreewide: Drop image_info_t typedef
Simon Glass [Wed, 7 Sep 2022 02:26:51 +0000 (20:26 -0600)]
treewide: Drop image_info_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotreewide: Drop bootm_headers_t typedef
Simon Glass [Wed, 7 Sep 2022 02:26:50 +0000 (20:26 -0600)]
treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoimage: Fix BOOTM_STATE values
Simon Glass [Wed, 7 Sep 2022 02:26:49 +0000 (20:26 -0600)]
image: Fix BOOTM_STATE values

Tidy up the code style for these.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoMerge branch '2022-09-29-assorted-fixes'
Tom Rini [Thu, 29 Sep 2022 20:06:19 +0000 (16:06 -0400)]
Merge branch '2022-09-29-assorted-fixes'

- Assorted fixes we want to include before the release.

20 months agoboard_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only
Pierre-Clément Tosi [Fri, 9 Sep 2022 20:16:18 +0000 (21:16 +0100)]
board_r: Relocate OF_EMBED if NEEDS_MANUAL_RELOC only

When the embedded device tree is pointed to by the __dtb_dt_*begin
symbols, it seems to be covered by the early relocation code and doesn't
need to be manually patched.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
20 months agopci: Remove duplicate PCI_REGION_IO / "io" line
Pali Rohár [Thu, 15 Sep 2022 13:54:45 +0000 (15:54 +0200)]
pci: Remove duplicate PCI_REGION_IO / "io" line

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
20 months agotools: env: Fix missing closedir in ubi_get_volnum_by_name
Miaoqian Lin [Mon, 19 Sep 2022 04:28:09 +0000 (08:28 +0400)]
tools: env: Fix missing closedir in ubi_get_volnum_by_name

The function calls opendir() but missing the corresponding
closedir() before exit the function.
Add missing closedir() to fix it.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
20 months agoboard: ti: common: board_detect: Fix EEPROM read quirk for AM6 style data
Nishanth Menon [Wed, 21 Sep 2022 13:38:42 +0000 (08:38 -0500)]
board: ti: common: board_detect: Fix EEPROM read quirk for AM6 style data

The situation is similar to commit bf6376642fe8 ("board: ti: common:
board_detect: Fix EEPROM read quirk"). This is seen on a variant of
eeproms seen on some BeagleBone-AI64 which now has a mix of both 1 byte
addressing and 2 byte addressing eeproms.

Unlike the am335x (ti_i2c_eeprom_am_get) and dra7
(ti_i2c_eeprom_dra7_get) which use constant data structure which allows
us to do a complete read of the data, the
am6(ti_i2c_eeprom_am6_get) eeprom parse operation is dynamic.

This removes the option of being able to read the complete eeprom data
in one single shot.

Fortunately, on the I2C bus, we do see the following behavior: In 1
byte mode, if we attempt to read the first header data yet again, the
misbehaving 2 byte addressing device acts in constant addressing mode
which results in the header not matching up and follow on attempt at 2
byte addressing scheme grabs the correct data.

This costs us an extra ~3 milliseconds, which is a minor penalty
compared to the consistent image support we need to have.

Reported-by: Jason Kridner <jkridner@beagleboard.org>
Fixes: a58147c2dbbf ("board: ti: common: board_detect: Do 1byte address checks first.")
Signed-off-by: Nishanth Menon <nm@ti.com>
20 months agovexpress64: also consider DTB pointer in x1
Andre Przywara [Wed, 21 Sep 2022 17:09:46 +0000 (18:09 +0100)]
vexpress64: also consider DTB pointer in x1

Commit c0fce929564f("vexpress64: fvp: enable OF_CONTROL") added code to
consider a potential DTB address being passed in the x0 register, or
revert to the built-in DTB otherwise.
The former case was used when using the boot-wrapper, to which we sell
U-Boot as a Linux kernel. The latter was meant for TF-A, for which we
couldn't find an easy way to use the DTB it uses itself. We have some
quirk to filter for a valid DTB, as TF-A happens to pass a pointer to
some special devicetree blob in x0 as well.

Now the TF-A case is broken, when enabling proper emulation of secure
memory (-C bp.secure_memory=1). TF-A carves out some memory at the top
of the first DRAM bank for its own purposes, and configures the
TrustZone DRAM controller to make this region secure-only. U-Boot will
then hang when it tries to relocate itself exactly to the end of DRAM.
TF-A announces this by carving out that region of the /memory node, in
the DT it passes on to BL33 in x1, but we miss that so far.

Instead of repeating this carveout in our DT copy, let's try to look for
a DTB at the address x1 points to as well. This will let U-Boot pick up
the DTB provided by TF-A, which has the correct carveout in place,
avoiding the hang.
While we are at it, make the detection more robust: the length test (is
the DT larger than 256 bytes?) is too fragile, in fact the TF-A port for
a new FVP model already exceeds this. So we test x1 first, consider 0
an invalid address, and also require a /memory node to detect a valid DTB.

And for the records:
Some asking around revealed what is really going on with TF-A and that
ominous DTB pointer in x0: TF-A expects EDK-2 as its non-secure payload
(BL33), and there apparently was some long-standing ad-hoc boot protocol
defined just between the two: x0 would carry the MPIDR register value of
the boot CPU, and the hardware DTB address would be stored in x1.
Now the MPIDR of CPU 0 is typically 0, plus bit 31 set, which is defined
as RES1 in the ARMv7 and ARMv8 architectures. This gives 0x80000000,
which is the same value as the address of the beginning of DRAM (2GB).
And coincidentally TF-A put some DTB structure exactly there, for its
own purposes (passing it between stages). So U-Boot was trying to use
this DTB, which requires the quirk to check for its validity.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Peter Hoyes <peter.hoyes@arm.com>
20 months agofs: btrfs: remove the usage of undeclared fs_mutex variable
Pankaj Raghav [Wed, 28 Sep 2022 15:23:01 +0000 (17:23 +0200)]
fs: btrfs: remove the usage of undeclared fs_mutex variable

This line probably got in by mistake as there is no fs_mutex member in
the btrfs_fs_info struct.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
20 months agoconfigs: rockchip: Drop TPL_MAX_SIZE definition
Michael Trimarchi [Sat, 24 Sep 2022 13:36:24 +0000 (15:36 +0200)]
configs: rockchip: Drop TPL_MAX_SIZE definition

The max size is defined at architectural level. On the same commit
I have checked mostly all the other architecture and look like they are

Fixes: commit ca8a329a1b7f ("Convert CONFIG_SPL_PAD_TO et al to Kconfig")
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
20 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Tue, 27 Sep 2022 15:05:37 +0000 (11:05 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-watchdog

- autoboot: make sure watchdog device(s) are handled with keyed
  autoboot (Rasmus)
- gpio_wdt: use __udelay() to avoid recursion (Rasmus)
- watchdog: max6370: use __udelay() to avoid recursion (Pali)

20 months agoMerge tag 'u-boot-stm32-20220927' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 27 Sep 2022 12:53:51 +0000 (08:53 -0400)]
Merge tag 'u-boot-stm32-20220927' of https://source.denx.de/u-boot/custodians/u-boot-stm into next

- Increase SYS_MALLOC_F_LEN for STM32 MCU's board
- SPL fixes for STM32F7 MCUs
- Device tree alignement with kernelv6.0-rc4 for MCU's board
- Device tree alignement with kernelv6.0-rc3 for MPU's board
- Update DDR node for STM32MP15
- Cleanup config file for STM32MP1
- Update for cmd_stm32key command
- Fix compatible string to add partitions for STM32MP1
- Update for stm32programmer tool

20 months agoautoboot: make sure watchdog device(s) are handled with keyed autoboot
Rasmus Villemoes [Tue, 27 Sep 2022 09:54:02 +0000 (11:54 +0200)]
autoboot: make sure watchdog device(s) are handled with keyed autoboot

Currently, AUTOBOOT_KEYED and its variant AUTOBOOT_ENCRYPTION are
broken when one has an external always-running watchdog device with a
timeout shorter than the configured boot delay (in my case, I have a
gpio-wdt one with a timeout of 1 second), because we fail to call
WATCHDOG_RESET() in the loops where we wait for the bootdelay to
elapse.

This is done implicitly in the !AUTOBOOT_KEYED case,
i.e. abortboot_single_key(), because that loop contains a
udelay(10000), and udelay() does a WATCHDOG_RESET().

To fix this, simply add similar udelay() calls in the other loops.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
20 months agowatchdog: max6370: use __udelay() to avoid recursion
Pali Rohár [Tue, 27 Sep 2022 10:19:19 +0000 (12:19 +0200)]
watchdog: max6370: use __udelay() to avoid recursion

The udelay() function in lib/time.c contains a WATCHDOG_RESET()
call. So use __udelay() in max6370_wdt.c to prevent recursion.

Fixes: 0a095fc53b15 ("watchdog: Add MAX6370 watchdog timer driver")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
20 months agowatchdog: gpio_wdt: use __udelay() to avoid recursion
Rasmus Villemoes [Tue, 27 Sep 2022 07:45:44 +0000 (09:45 +0200)]
watchdog: gpio_wdt: use __udelay() to avoid recursion

The udelay() function in lib/time.c contains a WATCHDOG_RESET()
call. The only reason this doesn't lead to a catastrophic infinite
recursion is due to the rate-limiting in wdt-uclass.c:

if (time_after_eq(now, priv->next_reset)) {
priv->next_reset = now + priv->reset_period;
wdt_reset(dev);
}

But this would fall apart if ->next_reset was updated after calling the
device's reset method.

This is needlessly fragile, and it's easy enough to avoid that
recursion in the first place by just using __udelay() directly.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
20 months agoconfigs: increase SYS_MALLOC_F_LEN for STM32 MCU's board
Patrice Chotard [Mon, 26 Sep 2022 15:59:36 +0000 (17:59 +0200)]
configs: increase SYS_MALLOC_F_LEN for STM32 MCU's board

Some STM32 MCU's board need their SYS_MALLOC_F_LEN value enlarged
to avoid the "alloc space exhausted" error message during their boot
process.
Use the default SYS_MALLOC_F_LEN value which is set to 0x2000 in
Kconfig.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
20 months agoMerge tag 'xilinx-for-v2023.01-rc1-v2' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 26 Sep 2022 15:28:14 +0000 (11:28 -0400)]
Merge tag 'xilinx-for-v2023.01-rc1-v2' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2023.01-rc1 (round 2)

xilinx:
- Add support for new Versal NET SOC

zynqmp:
- Use mdio bus for ethernet phy description
- Wire ethernet phy reset via i2c-gpio

versal:
- Config cleanup

20 months agoMerge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Mon, 26 Sep 2022 15:27:30 +0000 (11:27 -0400)]
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into next

20 months agoconfigs: stm32f746-disco: Remove CONFIG_SYS_UBOOT_START flag
Patrice Chotard [Tue, 20 Sep 2022 16:04:36 +0000 (18:04 +0200)]
configs: stm32f746-disco: Remove CONFIG_SYS_UBOOT_START flag

By pressing "c" key during SPL execution, we force U-boot execution
instead of a kernel XIP image.

This fixes a hard fault when booting stm32f746-disco in SPL with "c"
key pressed during SPL execution.

U-Boot SPL 2022.10-rc5-00009-g40d02baa91 (Sep 20 2022 - 17:21:21 +0200)
Trying to boot from XIP
Hard fault
pc : 080083fc    lr : 08000d1b    xPSR : 21000000
r12 : 2004f108   r3 : 080083fd    r2 : 00000028
r1 : 2004f0c8    r0 : 2004f0e4
Resetting CPU ...

This is due to SYS_UBOOT_START flag set to 0x080083FD which is not correct.
If unset, SYS_UBOOT_START is set by default to CONFIG_SYS_TEXT_BASE
which match with our requirement.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoconfigs: stm32f769-disco: Fix internal flash size
Patrice Chotard [Tue, 20 Sep 2022 16:04:35 +0000 (18:04 +0200)]
configs: stm32f769-disco: Fix internal flash size

arch-stm32f7/stm32.h file is shared between STM32F746 and STM32F769
MCUs. But STM32F769 embeds 2MB of internal flash instead of 1MB for
STM32F746. The flash layout is quite similar between the 2 SoCs :

STM32F746  STM32F769
4 *  32KB sectors  4 *  32KB sectors
1 * 128KB sector  1 * 128KB sector
3 * 256KB sectors 7 * 256KB sectors

Update sect_sz_kb[] structure and SYS_MAX_FLASH_SECT accordingly.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoconfigs: stm32746g-eval: Fix CONFIG_SYS_SPL_ARGS_ADDR
Patrice Chotard [Tue, 20 Sep 2022 16:04:34 +0000 (18:04 +0200)]
configs: stm32746g-eval: Fix CONFIG_SYS_SPL_ARGS_ADDR

STM32F746 embeds 1 MB of internal flash [0x08000000-0x080fffff],
fix CONFIG_SYS_SPL_ARGS_ADDR accordingly
It solves hard fault when jumping from SPL to U-Boot.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoconfigs: stm32f746-disco: Fix CONFIG_SYS_SPL_ARGS_ADDR
Patrice Chotard [Tue, 20 Sep 2022 16:04:33 +0000 (18:04 +0200)]
configs: stm32f746-disco: Fix CONFIG_SYS_SPL_ARGS_ADDR

STM32F746 embeds 1 MB of internal flash [0x08000000-0x080fffff],
fix CONFIG_SYS_SPL_ARGS_ADDR accordingly
It solves hard fault when jumping from SPL to U-Boot.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoconfigs: stm32746g-eval: Fix SPL boot
Patrice Chotard [Tue, 20 Sep 2022 16:04:32 +0000 (18:04 +0200)]
configs: stm32746g-eval: Fix SPL boot

Commit 'b4b9a00ed593 ("Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig")'
replaces CONFIG_SYS_FDT_BASE by CONFIG_SYS_SPL_ARGS_ADDR.
As CONFIG_SYS_SPL_ARGS_ADDR enables additional code when enable, it
increases SPL size over the initial 0x8000 limit.
Increase the SPL size to 0x9000 to fix SPL boot.
Set SPL_SIZE_LIMIT to 0x9000 to avoid similar issue in the future.

Fixes 'b4b9a00ed593 ("Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig")'

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoconfigs: stm32f769-disco: Fix SPL boot
Patrice Chotard [Tue, 20 Sep 2022 16:04:31 +0000 (18:04 +0200)]
configs: stm32f769-disco: Fix SPL boot

Commit 'b4b9a00ed593 ("Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig")'
replaces CONFIG_SYS_FDT_BASE by CONFIG_SYS_SPL_ARGS_ADDR.
As CONFIG_SYS_SPL_ARGS_ADDR enables additional code when enable, it
increases SPL size over the initial 0x8000 limit.
Increase the SPL size to 0x9000 to fix SPL boot.
Set SPL_SIZE_LIMIT to 0x9000 to avoid similar issue in the future.

Fixes 'b4b9a00ed593 ("Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig")'

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoconfigs: stm32f746-disco: Fix SPL boot
Patrice Chotard [Tue, 20 Sep 2022 16:04:30 +0000 (18:04 +0200)]
configs: stm32f746-disco: Fix SPL boot

Commit 'b4b9a00ed593 ("Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig")'
replaces CONFIG_SYS_FDT_BASE by CONFIG_SYS_SPL_ARGS_ADDR.
As CONFIG_SYS_SPL_ARGS_ADDR enables additional code when enable, it
increases SPL size over the initial 0x8000 limit.
Increase the SPL size to 0x9000 to fix SPL boot.
Set SPL_SIZE_LIMIT to 0x9000 to avoid similar issue in the future.

Fixes 'b4b9a00ed593 ("Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig")'

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
20 months agoARM: dts: stm32: DT sync with kernel v6.0-rc4 for MCU's boards
Patrice Chotard [Fri, 23 Sep 2022 11:20:33 +0000 (13:20 +0200)]
ARM: dts: stm32: DT sync with kernel v6.0-rc4 for MCU's boards

Device tree alignment with kernel v6.0-rc4.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
20 months agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 26 Sep 2022 12:30:17 +0000 (08:30 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- gpio: turris_omnia_mcu: Fix registering gpios (Pali)

20 months agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Mon, 26 Sep 2022 12:29:42 +0000 (08:29 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- DWC2 gadget EP fix, nuvoton NPCM7xx ehci/ohci driver

20 months agoarm64: versal-net: Add support for mini configuration
Michal Simek [Mon, 19 Sep 2022 12:21:10 +0000 (14:21 +0200)]
arm64: versal-net: Add support for mini configuration

Versal NET mini configuration is designed for running memory test. Current
output is on DCC but changing serial0 alias to pl011 will move console to
serial port.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/aec3f41a4cc48c45b8f07dd6e423d5838dbcc9d7.1663589964.git.michal.simek@amd.com
20 months agoarm64: versal-net: Add defconfig for Versal NET
Michal Simek [Mon, 19 Sep 2022 12:21:09 +0000 (14:21 +0200)]
arm64: versal-net: Add defconfig for Versal NET

Use one defconfig for supporting multiple different platforms. DTB
reselection is enabled to choose DT based on SOC detection.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/82cc7c1ca8850270cc2ebc992d835a37aa3d236f.1663589964.git.michal.simek@amd.com
20 months agoreset: zynqmp: Enable reset driver for Versal NET
Jay Buddhabhatti [Mon, 19 Sep 2022 12:21:08 +0000 (14:21 +0200)]
reset: zynqmp: Enable reset driver for Versal NET

Enable zynqmp reset driver for Versal NET.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c8c26618f87d8451c6ffa9487809a24718bff6a7.1663589964.git.michal.simek@amd.com
20 months agomailbox: zynqmp: Enable ipi mailbox driver for Versal NET
Jay Buddhabhatti [Mon, 19 Sep 2022 12:21:07 +0000 (14:21 +0200)]
mailbox: zynqmp: Enable ipi mailbox driver for Versal NET

Enable mailbox configs for Versal NET.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/b3a9a6a58b74d17e2ec5f60617fa42062fbab951.1663589964.git.michal.simek@amd.com
20 months agofirmware: zynqmp: Add Versal NET compatible string
Jay Buddhabhatti [Mon, 19 Sep 2022 12:21:06 +0000 (14:21 +0200)]
firmware: zynqmp: Add Versal NET compatible string

Add compatible string for Versal NET.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ec73f786e1c89094752ff3693f6f0fb4536c85c5.1663589964.git.michal.simek@amd.com
20 months agoclk: versal: Enable clock driver for Versal NET
Jay Buddhabhatti [Mon, 19 Sep 2022 12:21:05 +0000 (14:21 +0200)]
clk: versal: Enable clock driver for Versal NET

Add support for Versal NET compatible string in clock driver.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20a35d0c1ffcc222fbe93dd406cdd0aff92f5223.1663589964.git.michal.simek@amd.com
20 months agospi: zynqmp_gqspi: Add support for Versal NET
Michal Simek [Mon, 19 Sep 2022 12:21:04 +0000 (14:21 +0200)]
spi: zynqmp_gqspi: Add support for Versal NET

Add support for Versal NET platform.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/f374e9a81f2d85de1240029f3ba5f6423cfa0680.1663589964.git.michal.simek@amd.com
20 months agospi: cadence_qspi: Add support for Versal NET platform
Michal Simek [Mon, 19 Sep 2022 12:21:03 +0000 (14:21 +0200)]
spi: cadence_qspi: Add support for Versal NET platform

Trivial changes to support cadence ospi driver for Versal NET platform.
Also avoid ospi flash reset for now.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/0789141f432189aab69bc496fe33e0218d1d7510.1663589964.git.michal.simek@amd.com
20 months agoarm64: versal-net: Add support for Versal NET platform
Michal Simek [Mon, 19 Sep 2022 12:21:02 +0000 (14:21 +0200)]
arm64: versal-net: Add support for Versal NET platform

Versal NET platform is based on Versal chip which is reusing a lot of IPs.
For more information about new IPs please take a look at DT which describe
currently supported devices.
The patch is adding architecture and board support with soc detection
algorithm. Generic setting should be very similar to Versal but it will
likely diverge in longer run.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/320206853dc370ce290a4e7b6d0bb26b05206021.1663589964.git.michal.simek@amd.com
20 months agogpio: turris_omnia_mcu: Fix registering gpios
Pali Rohár [Thu, 22 Sep 2022 11:25:13 +0000 (13:25 +0200)]
gpio: turris_omnia_mcu: Fix registering gpios

Currently all GPIOs supported by CMD_EXT_CONTROL/CMD_GET_EXT_CONTROL_STATUS
commands (last 16 GPIOs) are available only when FEAT_PERIPH_MCU feature
bit is set. So do not register these GPIOs by U-Boot driver when this
feature bit is not set, so U-Boot 'gpio' command would see only GPIOs which
really exists.

Fixes: 5e4d24ccc115 ("gpio: Add Turris Omnia MCU driver")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
20 months agoriscv: ae350: Disable AVAILABLE_HARTS
Rick Chen [Wed, 21 Sep 2022 06:34:55 +0000 (14:34 +0800)]
riscv: ae350: Disable AVAILABLE_HARTS

Disable AVAILABLE_HARTS mechanism to make sure that all harts
can boot to Kernel shell successfully.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
20 months agoriscv: Introduce AVAILABLE_HARTS
Rick Chen [Wed, 21 Sep 2022 06:34:54 +0000 (14:34 +0800)]
riscv: Introduce AVAILABLE_HARTS

In SMP all harts will register themself in available_hart
during start up. Then main hart will send IPI to other harts
according to this variables. But this mechanism may not
guarantee that all other harts can jump to next stage.

When main hart is sending IPI to other hart according to
available_harts, but other harts maybe still not finish the
registration. Then the SMP booting will miss some harts finally.
So let it become an option and it will be enabled by default.

Please refer to the discussion:
https://www.mail-archive.com/u-boot@lists.denx.de/msg449997.html

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
20 months agospl: introduce SPL_XIP to config
Nikita Shubin [Fri, 2 Sep 2022 08:47:39 +0000 (11:47 +0300)]
spl: introduce SPL_XIP to config

U-Boot and SPL don't necessary share the same location, so we might end
with U-Boot SPL in read-only memory (XIP) and U-Boot in read-write memory.

In case of non XIP boot mode, we rely on such variables as "hart_lottery"
and "available_harts_lock" which we use as atomics.

The problem is that CONFIG_XIP also propagate to main U-Boot, not only SPL,
so we need CONFIG_SPL_XIP to distinguish SPL XIP from other XIP modes.

This adds an option special for SPL to behave it in XIP manner and we don't
use hart_lottery and available_harts_lock, during start proccess.

Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
Reviewed-by: Rick Chen <rick@andestech.com>
20 months agoFix out of bound access of ep array.
Alison Huffman [Thu, 22 Sep 2022 04:01:32 +0000 (04:01 +0000)]
Fix out of bound access of ep array.

When processing USB_REQ_CLEAR_FEATURE, USB_REQ_SET_FEATURE, and
USB_REQ_GET_STATUS packets in dwc2_ep0_setup an out of bounds access
can occur. This is caused by the wIndex field of the usb control packet
being used as an index into an array whose size is DWC2_MAX_ENDPOINTS (4).

Signed-off-by: Alison Huffman <alisn@google.com>
20 months agousb: host: nuvoton: Add nuvoton NPCM7xx ehci/ohci driver
Jim Liu [Tue, 21 Jun 2022 09:09:02 +0000 (17:09 +0800)]
usb: host: nuvoton: Add nuvoton NPCM7xx ehci/ohci driver

Add nuvoton BMC NPCM750 ehci/ohci driver

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
20 months agoMerge tag 'dm-next-25sep22' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm...
Tom Rini [Sun, 25 Sep 2022 21:20:11 +0000 (17:20 -0400)]
Merge tag 'dm-next-25sep22' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm into next

sandbox SCSI conversion to driver model
final patch for blk improvements

20 months agosandbox: Add a test for SCSI
Simon Glass [Wed, 21 Sep 2022 14:21:47 +0000 (16:21 +0200)]
sandbox: Add a test for SCSI

Add a simple uclass test for SCSI. It reads the partition table from a
disk image and checks that it looks correct.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: Convert to use driver model for SCSI
Simon Glass [Wed, 21 Sep 2022 14:21:46 +0000 (16:21 +0200)]
sandbox: Convert to use driver model for SCSI

At present sandbox is producing a warning about SCSI migration. Drop the
legacy code and replace it with a new implementation.

Also drop the SATA command, which does not work with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: scsi: Move request-handling code to scsi_emul
Simon Glass [Wed, 21 Sep 2022 14:21:45 +0000 (16:21 +0200)]
sandbox: scsi: Move request-handling code to scsi_emul

Move this code into the emulator file so it can be used by multiple
drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>