]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
17 months agoefi_loader: fix the return codes of UninstallProtocol
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:30 +0000 (09:19 +0300)]
efi_loader: fix the return codes of UninstallProtocol

Up to now we did not check the return value of DisconnectController.
A previous patch is fixing that taking into account what happened during
the controller disconnect.  But that check takes place before our code
is trying to figure out if the interface exists to begin with.  In case a
driver is not allowed to unbind -- e.g returning EFI_DEVICE_ERROR, we
will end up returning that error instead of EFI_NOT_FOUND.

Add an extra check on the top of the function to make sure the protocol
interface exists before trying to disconnect any drivers

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
17 months agoefi_loader: check the status of disconnected drivers
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:29 +0000 (09:19 +0300)]
efi_loader: check the status of disconnected drivers

efi_uninstall_protocol() calls efi_disconnect_all_drivers() but never
checks the return value.  Instead it tries to identify protocols that
are still open after closing the ones that were opened with
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL, EFI_OPEN_PROTOCOL_GET_PROTOCOL
and EFI_OPEN_PROTOCOL_TEST_PROTOCOL.

Instead of doing that,  check the return value early and exit if
disconnecting the drivers failed.  Also reconnect all the drivers of
a handle if protocols are still found on the handle after disconnecting
controllers and closing the remaining protocols.

While at it fix a memory leak and properly free the opened protocol
information when closing a protocol.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
17 months agoefi_loader: reconnect drivers on failure
Ilias Apalodimas [Tue, 20 Jun 2023 06:19:28 +0000 (09:19 +0300)]
efi_loader: reconnect drivers on failure

efi_disconnect_controller() doesn't reconnect drivers in case of
failure.  Reconnect the disconnected drivers properly

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
17 months agoLoad option with short device path for boot vars
Raymond Mao [Mon, 19 Jun 2023 21:23:01 +0000 (14:23 -0700)]
Load option with short device path for boot vars

The boot variables automatically generated for removable medias
should be with short form of device path without device nodes.
This is a requirement for the case that a removable media is
plugged into a different port but is still able to work with the
existing boot variables.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
17 months agoFix incorrect return code of boot option update
Raymond Mao [Mon, 19 Jun 2023 21:22:59 +0000 (14:22 -0700)]
Fix incorrect return code of boot option update

Correct the return code for out-of-memory and no boot option found

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
17 months agoMove bootorder and bootoption apis to lib
Raymond Mao [Mon, 19 Jun 2023 21:22:58 +0000 (14:22 -0700)]
Move bootorder and bootoption apis to lib

Rename and move bootorder and bootoption apis from cmd to lib
for re-use between eficonfig and bootmgr
Fix 'unexpected indentation' when 'make htmldocs' after functions
are moved

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
17 months agoMerge branch '2023-07-14-expo-initial-config-editor'
Tom Rini [Fri, 14 Jul 2023 17:26:42 +0000 (13:26 -0400)]
Merge branch '2023-07-14-expo-initial-config-editor'

To quote the author:
This series provides a means to edit board configuration in U-Boot in a
graphical manner. It supports multiple menu items and allows moving
between them and selecting items. The configuration is defined in a data
format so that code is not needed in most cases. This allows the board
configuration to be provided in the devicetree.

This is still at an early stage, since it only supports menus. Numeric
values are not supported. Most importantly it does not yet support
loading or saving the configuration selected by the user.

To try it out you can use something like:

    ./tools/expo.py -e test/boot/files/expo_layout.dts \
        -l test/boot/files/expo_layout.dts -o cedit.dtb
    ./u-boot -Tl -c "cedit load hostfs - cedit.dtb; cedit run"

Use the arrow keys to move between menus, enter to open a menu, escape
to exit.

Various minor fixes and improvements are provided in this series:
- Update STB TrueType library to latest
- Support clearing part of the video display
- Support multiple livetrees loaded at runtime
- Support loading and allocating a file
- Support proper measuring of text in expo
- Support simple themes for expo

17 months agovideo: Update stb_truetype
Simon Glass [Thu, 1 Jun 2023 16:23:04 +0000 (10:23 -0600)]
video: Update stb_truetype

This was brought in in 2016 and a number of changes have been made since
then. There does not seem to be much change in functionality, but it is
a good idea to update from time to time.

Bring in the latest version:

   5736b15 ("re-add perlin noise again")

Add a few necessary functions, with dummies in some cases. Update the tests
as there are subtle changes in rendering, perhaps not for the better.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Add tests for the configuration editor
Simon Glass [Thu, 1 Jun 2023 16:23:03 +0000 (10:23 -0600)]
expo: Add tests for the configuration editor

Add some simple tests and a helpful script to make the configuration
editor easier to set up.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Add a configuration editor
Simon Glass [Thu, 1 Jun 2023 16:23:02 +0000 (10:23 -0600)]
expo: Add a configuration editor

Add a new 'cedit' command which allows editing configuration using an
expo. The configuration items appear as menus on the display.

This is extremely basic, only supporting menus and not providing any way
to load or save the configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Support building an expo from a description file
Simon Glass [Thu, 1 Jun 2023 16:23:01 +0000 (10:23 -0600)]
expo: Support building an expo from a description file

The only way to create an expo at present is by calling the functions to
create each object. It is useful to have more data-driven approach, where
the objects can be specified in a suitable file format and created from
that. This makes testing easier as well.

Add support for describing an expo in a devicetree node. This allows more
complex tests to be set up, as well as providing an easier format for
users. It also provides a better basis for the upcoming configuration
editor.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Add spacing around menus and items
Simon Glass [Thu, 1 Jun 2023 16:23:00 +0000 (10:23 -0600)]
expo: Add spacing around menus and items

It looks better if menus have a bit of an inset, rather than be drawn hard
up against the background. Also, menu items look better if they have a bit
of spacing between them.

Add theme options for these and implement the required changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Implement the keypress logic for popup menus
Simon Glass [Thu, 1 Jun 2023 16:22:59 +0000 (10:22 -0600)]
expo: Implement the keypress logic for popup menus

In 'popup' mode, the expo allows moving around the objects in a scene.
When 'enter' is pressed on a menu, it opens and the user can move around
the items in the menu.

Implement this using keypress handles and actions.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Draw the current opened menu on top
Simon Glass [Thu, 1 Jun 2023 16:22:58 +0000 (10:22 -0600)]
expo: Draw the current opened menu on top

When a menu is opened, it must be displayed over all other objects in
the scene, so that all its items are visible.

Handle this by drawing the menu object a second time, after all other
objects have been drawn. Draw all of the objects which are dependent
on the menu object.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Draw popup menus in both opened and closed states
Simon Glass [Thu, 1 Jun 2023 16:22:57 +0000 (10:22 -0600)]
expo: Draw popup menus in both opened and closed states

When a popup menu is closed it shows only the selected item. When it is
open it shows a background and all items, with a highlight that can be
moved between the items.

Add the drawing logic for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEM
Simon Glass [Thu, 1 Jun 2023 16:22:56 +0000 (10:22 -0600)]
expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEM

At present we only support a single menu, so all that can be pointed to
is the current menu item. Rename this action so that we can also add
an action for pointing to an object. This will allow cycling through
the objects in a scene.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Support drawing of popup menus
Simon Glass [Thu, 1 Jun 2023 16:22:55 +0000 (10:22 -0600)]
expo: Support drawing of popup menus

At present only a single menu is supported. All items are shown and a
pointer object points to the current item.

Add support for multiple menus, one of which is highlighted, indicated
by the highlight_id property in the scene.

The highlighted menu item has a SCENEOF_POINT flag, indicating that it
is currently pointed to.

The popup menu is normally closed, in which case it shows only the
current menu item. When it is opened, it shows all items, allowing the
user to select one.

Rather than requiring the menu item to have a description, require it to
have a label. Use the label (only) for the popup menu.

With this, most of the drawing and layout logic is complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Move menu-item selection into a function
Simon Glass [Thu, 1 Jun 2023 16:22:54 +0000 (10:22 -0600)]
expo: Move menu-item selection into a function

The current implementation supports a 'pointer' object which points to
the currently highlighted menu item. We want to support highlighting the
label of the menu item instead, e.g. with inverse video. In this case we
will need to 'unhighlight' the old item and highlight the new one.

As a first step, move the pointer logic into a function. This fixes a
bug where the item is hidden when it should not be.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Support simple themes
Simon Glass [Thu, 1 Jun 2023 16:22:53 +0000 (10:22 -0600)]
expo: Support simple themes

It is a pain to manually set the fonts of all objects to be consistent.
Some spacing settings are also better set globally than by manually
positioning each object.

Add a 'theme' to the expo, to hold this information. For now it includes
only the font size.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Set up the width and height of objects
Simon Glass [Thu, 1 Jun 2023 16:22:52 +0000 (10:22 -0600)]
expo: Set up the width and height of objects

Provide a way to set the full dimensions of objects, i.e. including the
width and height.

For menus, calculate the bounding box of all objects in the menu. Set all
labels to be the same size, so that highlighting works correct, once
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Calculate text bounding-box correctly
Simon Glass [Thu, 1 Jun 2023 16:22:51 +0000 (10:22 -0600)]
expo: Calculate text bounding-box correctly

Rather than estimating, measure the text accurately, using the new
vidconsole feature. This allows accurate placement of objects.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Use flags for objects
Simon Glass [Thu, 1 Jun 2023 16:22:50 +0000 (10:22 -0600)]
expo: Use flags for objects

We currently have just a 'hide' property for each object. In preparation
for adding more properties, convert the struct to use a flags value,
instead of individual booleans. This is more extensible.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Add width and height to objects
Simon Glass [Thu, 1 Jun 2023 16:22:49 +0000 (10:22 -0600)]
expo: Add width and height to objects

At present objects only have a position so it is not possible to determine
the amount of space they take up on the display.

Add width and height properties, using a struct to keep all the dimensions
together.

For now this is not used. Future work will set up these new properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agovideo: Use enum with video_index_to_colour()
Simon Glass [Thu, 1 Jun 2023 16:22:48 +0000 (10:22 -0600)]
video: Use enum with video_index_to_colour()

Use the provided enum with this function, so it is clearer what should be
passed to it.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Allow setting the start of the dynamic-ID range
Simon Glass [Thu, 1 Jun 2023 16:22:47 +0000 (10:22 -0600)]
expo: Allow setting the start of the dynamic-ID range

Provide a way to set this value so that it is easy to separate the
statically allocated IDs (generated by the caller) from those
generated dynamically by expo itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoconsole: Allow measuring the bounding box of text
Simon Glass [Thu, 1 Jun 2023 16:22:46 +0000 (10:22 -0600)]
console: Allow measuring the bounding box of text

For laying out text accurately it is necessary to know the width and
height of the text. Add a measure() method to the console API, so this
can be supported.

Add an implementation for truetype and a base implementation for the
normal console.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agovideo: Allow temporary colour changes
Simon Glass [Thu, 1 Jun 2023 16:22:45 +0000 (10:22 -0600)]
video: Allow temporary colour changes

It is sometimes necessary to highlight some text in a different colour.
Add an easy way to do this and then restore the original console colours.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agovideo: Correct docs for video_index_to_colour()
Simon Glass [Thu, 1 Jun 2023 16:22:44 +0000 (10:22 -0600)]
video: Correct docs for video_index_to_colour()

This uses the private data of the video uclass, not the console uclass
(its child). Update the comment to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a032e4b55ea ("video: Move console colours to the video uclass")
17 months agobootstd: Add a separate log category for expo
Simon Glass [Thu, 1 Jun 2023 16:22:43 +0000 (10:22 -0600)]
bootstd: Add a separate log category for expo

This feature is different enough from bootstd that it probably deserves
its own log category. It cannot use a uclass since it is not a device.

Add a new category.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agofdt: Allow more general use of livetree
Simon Glass [Thu, 1 Jun 2023 16:22:42 +0000 (10:22 -0600)]
fdt: Allow more general use of livetree

At present livetree can only be used for the control FDT. It is useful
to be able to use the ofnode API for other FDTs, e.g. those used by
the upcoming configuration editor.

We already have most of the support present, and tests can be marked with
the UT_TESTF_OTHER_FDT flag to use another FDT as a special case. But
with this change, the functionality becomes more generally available.

Plumb in the require support.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agofdt: Clarify the fdt pre-relocation warning
Simon Glass [Thu, 1 Jun 2023 16:22:41 +0000 (10:22 -0600)]
fdt: Clarify the fdt pre-relocation warning

Reword this so it is easier to understand.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agofdt: Align the start of the livetree
Simon Glass [Thu, 1 Jun 2023 16:22:40 +0000 (10:22 -0600)]
fdt: Align the start of the livetree

Ensure that the block of memory used by live tree is aligned according to
the default for structures. This ensures that the root node appears at
the start of the block, so it can be used with free(), rather than being
4 bytes later in some cases.

This corrects a rather obscure bug in unflatten_device_tree().

Fixes: 8b50d526ea5 ("dm: Add a function to create a 'live' device tree")
Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agocat: Update command to use fs_load_alloc()
Simon Glass [Thu, 1 Jun 2023 16:22:39 +0000 (10:22 -0600)]
cat: Update command to use fs_load_alloc()

Use this new function since it implements the required functionality and
reduces duplicated code.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agofs: Create functions to load and allocate a file
Simon Glass [Thu, 1 Jun 2023 16:22:38 +0000 (10:22 -0600)]
fs: Create functions to load and allocate a file

This functionality current sits in bootstd, but it is more generally
useful. Add a function to load a file into memory, allocating it as
needed. Adjust bootstd to use this version.

Note: Tests are added in the subsequent patch which converts the 'cat'
command to use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Rename exp_set_text_mode()
Simon Glass [Thu, 1 Jun 2023 16:22:37 +0000 (10:22 -0600)]
expo: Rename exp_set_text_mode()

Rename this function to match its peers, using the full "expo' prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoconsole: Correct truetype spacing error
Simon Glass [Thu, 1 Jun 2023 16:22:36 +0000 (10:22 -0600)]
console: Correct truetype spacing error

The putc_xy() method is supposed to return the amount of space used. The
existing implementation erroneously adds the previous sub-pixel position
to the returned value. This spaces out the characters very slightly more
than it should. It is seldom noticeable but it does make accurate
measurement of the text impossible.

Fix this minor but long-standing bug.

Fixes: a29b012037c ("video: Add a console driver that uses TrueType fonts")
Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Avoid automatically arranging the scene
Simon Glass [Thu, 1 Jun 2023 16:22:35 +0000 (10:22 -0600)]
expo: Avoid automatically arranging the scene

This should ideally be done once after all scene changes have been made.
Require an explicit call when everything is ready.

Always arrange after a key it sent, just for convenience.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Store the console in the expo
Simon Glass [Thu, 1 Jun 2023 16:22:34 +0000 (10:22 -0600)]
expo: Store the console in the expo

Rather than finding this each time, keep a pointer to it. This simplifies
the code a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agovideo: Provide a way to clear part of the console
Simon Glass [Thu, 1 Jun 2023 16:22:33 +0000 (10:22 -0600)]
video: Provide a way to clear part of the console

This is useful when the background colour must be written before text
is updated, to avoid strange display artifacts.

Add a function for this, using the existing code from the truetype
console.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agovideo: Drop #ifdefs from console_truetype
Simon Glass [Thu, 1 Jun 2023 16:22:32 +0000 (10:22 -0600)]
video: Drop #ifdefs from console_truetype

Use if() instead to reduce the number of build paths.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agodm: core: Avoid registering an inaccessible tree
Simon Glass [Thu, 1 Jun 2023 16:22:31 +0000 (10:22 -0600)]
dm: core: Avoid registering an inaccessible tree

At present there are various restrictions on the use of livetree:

- It is only available once the tree is unflattened, i.e. after relocation
- It is designed to be used with the control FDT
- It can (in principle) be used with other FDTs, but only if they are
  unflattened first; this is not supported

Add a few checks to make sure that any tree that is created is actually
valid. Otherwise it can be confusing when nodes and properties cannot
actually be accessed.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agogpio: Avoid using an invalid ofnode
Simon Glass [Thu, 1 Jun 2023 16:22:30 +0000 (10:22 -0600)]
gpio: Avoid using an invalid ofnode

Devices do not necessarily have nodes attached to them, since they can be
created from platdata. In SPL a devicetree may in fact not exist at all.

Check the node before using it. This avoids failure when OF_CHECKS is
enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 5fc7cf8c8e2 ("gpio: add gpio-hog support")
Reviewed-by: Heiko Schocher <hs@denx.de>
17 months agotest: Restore test behaviour on failure
Simon Glass [Thu, 1 Jun 2023 16:22:29 +0000 (10:22 -0600)]
test: Restore test behaviour on failure

A recent change makes test continue to run after failure. This results in
a lot of useless output and may lead to a segfault. Fix this by adding
back the 'return' statement.

Fixes: fa847bb409d ("test: Wrap assert macros in ({ ... }) and fix")
Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agosandbox: Fix quiting when the LCD window is closed
Simon Glass [Thu, 1 Jun 2023 16:22:28 +0000 (10:22 -0600)]
sandbox: Fix quiting when the LCD window is closed

With recent changes to how sandbox handles reset, closing the window
currently just restarts sandbox.

Use the correct sysreset type to tell it to shut down.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Convert to using a string ID for the scene title
Simon Glass [Thu, 1 Jun 2023 16:22:27 +0000 (10:22 -0600)]
expo: Convert to using a string ID for the scene title

This is easier to deal with if it uses the existing string handling,
since we will be able to use translations, etc. in the future.

Update it to use an ID instead of a string.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoexpo: Correct some header-file comments
Simon Glass [Thu, 1 Jun 2023 16:22:26 +0000 (10:22 -0600)]
expo: Correct some header-file comments

The use of Returns instead of @return still confuses me. Fix some problems
that have crept in.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agobinman: Correct coverage gap in control
Simon Glass [Thu, 1 Jun 2023 16:22:25 +0000 (10:22 -0600)]
binman: Correct coverage gap in control

Add a pragma to deal with the code-coverage gap which drops binman down to
90% coverage.

Fixes: de65b122a25 (tools: Fall back to importlib_resources on Python 3.6)
Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agobdinfo: Correct use of assertions
Simon Glass [Wed, 12 Jul 2023 02:46:30 +0000 (20:46 -0600)]
bdinfo: Correct use of assertions

This test was written for the incorrect use of assertions. Update it to
build with the previous approach, where tests fail at the first
assertion.

All assertion functions return 0 on success and non-zero on failure.
They can be nested into functions simply by declaring a function that
returns an int and using ut_assertok() to call it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
17 months agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Fri, 14 Jul 2023 00:39:10 +0000 (20:39 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi

- Add xtxtech spi-nor chip parts (Bruce Suen)
- Add bcm63xx-hsspi driver fixes (William Zhang)

17 months agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 14 Jul 2023 00:38:50 +0000 (20:38 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: Thecus: Misc enhancement and cleanup (Tony)
- mvebu: Add AC5X Allied Telesis x240 board support incl NAND
  controller enhancements for this SoC (Chris)

17 months agoMerge tag 'u-boot-imx-20230713' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Fri, 14 Jul 2023 00:38:24 +0000 (20:38 -0400)]
Merge tag 'u-boot-imx-20230713' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20230713
-------------------

Merge for 2023.10.

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

17 months agoarm: mvebu: Remove unused alias from RC AC5X dts
Chris Packham [Sun, 9 Jul 2023 22:47:37 +0000 (10:47 +1200)]
arm: mvebu: Remove unused alias from RC AC5X dts

The sar-reg0 alias was left over from an earlier iteration of the
patches adding support for this board. Remove the unused alias.

Fixes: 6cc8b5db40 ("arm: mvebu: Add RD-AC5X board")
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
17 months agoarm: mvebu: Add Allied Telesis x240 board
Chris Packham [Sun, 9 Jul 2023 22:47:36 +0000 (10:47 +1200)]
arm: mvebu: Add Allied Telesis x240 board

The x240 and SE240 are a series of L2+ switches from Allied Telesis.
There are a number of them in the range but as far as U-Boot is
concerned all the CPU block components are the same so there's only one
board defined.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
17 months agomx7dsabresd: Retrieve the second MAC address from fuses
Fabio Estevam [Tue, 11 Jul 2023 21:57:57 +0000 (18:57 -0300)]
mx7dsabresd: Retrieve the second MAC address from fuses

Currently, a random MAC address is assigned to eth1 in Linux.

Fix this behavor by retrieving the second MAC address from the fuses.

Signed-off-by: Fabio Estevam <festevam@denx.de>
17 months agoarm64: imx: imx8mp-beacon: Enable LTO
Adam Ford [Mon, 29 May 2023 18:08:34 +0000 (13:08 -0500)]
arm64: imx: imx8mp-beacon: Enable LTO

With LTO enabled, SPL shrinks about 10K and U-Boot shrinks
about 30K.

Signed-off-by: Adam Ford <aford173@gmail.com>
17 months agoconfig: xea: Disable support for FAT file system
Lukasz Majewski [Wed, 12 Jul 2023 10:20:47 +0000 (12:20 +0200)]
config: xea: Disable support for FAT file system

On the XEA (imx287) system the FAT file system is not used neither in
SPL nor u-boot proper.

Hence, to save ~6KiB of u-boot.img size - it has been disabled.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
17 months agoconfig: xea: Disable support for boot methods EXTLINUX and VBE
Lukasz Majewski [Wed, 12 Jul 2023 10:20:46 +0000 (12:20 +0200)]
config: xea: Disable support for boot methods EXTLINUX and VBE

The XEA system (imx287 based) is not using support for EXTLINUX and VBE.
As those configuration options have been enabled by default with modern
Kconfig it is safe to explicitly disable them.

After that change the u-boot.img size has been reduced by ~16 KiB.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
17 months agomx23_olinuxino: Convert to CONFIG_DM_SERIAL
Fabio Estevam [Tue, 11 Jul 2023 21:09:03 +0000 (18:09 -0300)]
mx23_olinuxino: Convert to CONFIG_DM_SERIAL

The conversion to CONFIG_DM_SERIAL is mandatory, so select this option.

Signed-off-by: Fabio Estevam <festevam@denx.de>
17 months agomx23evk: Convert to CONFIG_DM_SERIAL
Fabio Estevam [Tue, 11 Jul 2023 21:09:02 +0000 (18:09 -0300)]
mx23evk: Convert to CONFIG_DM_SERIAL

The conversion to CONFIG_DM_SERIAL is mandatory, so select this option.

Signed-off-by: Fabio Estevam <festevam@denx.de>
17 months agomx28evk: Convert to CONFIG_DM_SERIAL
Fabio Estevam [Tue, 11 Jul 2023 21:09:01 +0000 (18:09 -0300)]
mx28evk: Convert to CONFIG_DM_SERIAL

The conversion to CONFIG_DM_SERIAL is mandatory, so select this option.

Signed-off-by: Fabio Estevam <festevam@denx.de>
17 months agoarm64: dts: verdin-imx8mp: add ctrl_sleep_moci# hog
Andrejs Cainikovs [Tue, 11 Jul 2023 09:09:18 +0000 (11:09 +0200)]
arm64: dts: verdin-imx8mp: add ctrl_sleep_moci# hog

Drive CTRL_SLEEP_MOCI# high at boot (SPL) using a GPIO hog, this signal
may be used to control some power-rails on the carrier board, therefore
it should be set to high when the module is booting.

To do this as early as possible is generally a good idea and the issue
was noticed on the Yavia carrier board where it is needed to power the
I2C EEPROM on the carrier board.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
17 months agoconfigs: verdin-imx8mp: enable spl_gpio_hog
Andrejs Cainikovs [Tue, 11 Jul 2023 09:09:17 +0000 (11:09 +0200)]
configs: verdin-imx8mp: enable spl_gpio_hog

Enable CONFIG_SPL_GPIO_HOG option to be able to control GPIO hogs from
SPL.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
17 months agoarm64: dts: verdin-imx8mm: add ctrl_sleep_moci# hog
Andrejs Cainikovs [Tue, 11 Jul 2023 09:09:16 +0000 (11:09 +0200)]
arm64: dts: verdin-imx8mm: add ctrl_sleep_moci# hog

Drive CTRL_SLEEP_MOCI# high at boot (SPL) using a GPIO hog, this signal
may be used to control some power-rails on the carrier board, therefore
it should be set to high when the module is booting.

To do this as early as possible is generally a good idea and the issue
was noticed on the Yavia carrier board where it is needed to power the
I2C EEPROM on the carrier board.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
17 months agoconfigs: verdin-imx8mm: enable spl_gpio_hog
Andrejs Cainikovs [Tue, 11 Jul 2023 09:09:15 +0000 (11:09 +0200)]
configs: verdin-imx8mm: enable spl_gpio_hog

Enable CONFIG_SPL_GPIO_HOG option to be able to control GPIO hogs from
SPL.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
17 months agoverdin-imx8mm/verdin-imx8mp: synchronise device trees with linux
Marcel Ziswiler [Tue, 11 Jul 2023 09:09:14 +0000 (11:09 +0200)]
verdin-imx8mm/verdin-imx8mp: synchronise device trees with linux

Synchronise device trees with linux v6.5-rc1.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
17 months agoarm: dts: imx8mp-beacon-kit: Enable USB Power domains
Adam Ford [Tue, 30 May 2023 22:49:34 +0000 (17:49 -0500)]
arm: dts: imx8mp-beacon-kit: Enable USB Power domains

The USB Power domains should not have been removed as it causes
the board to hang if the USB is started.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
17 months agoarm: dts: imx8mp: Sync the DT with kernel 6.4-rc4
Adam Ford [Tue, 30 May 2023 22:45:58 +0000 (17:45 -0500)]
arm: dts: imx8mp: Sync the DT with kernel 6.4-rc4

Several changes have been made to the device tree
in the kernel, so update that as well as the
corresponding imx8mp-u-boot.dtsi files to prevent
breaking the booting.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
17 months agoclk: imx8mp: Update clocks based on kernel 6.4-RC4
Adam Ford [Tue, 30 May 2023 22:45:57 +0000 (17:45 -0500)]
clk: imx8mp: Update clocks based on kernel 6.4-RC4

There are some newer clocks added to the kernel recently,
so to fix prepare for resycing the device trees, update
the clock list.  Since there are some minor changes to
the USB clocks, update which USB clocks are enabled
to match with the upstream kernel as well.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> #imx8mp-venice-gw74xx
17 months agoboard: colibri-imx8x: initialize snvs
Andrejs Cainikovs [Mon, 3 Apr 2023 11:14:26 +0000 (13:14 +0200)]
board: colibri-imx8x: initialize snvs

Initialize Secure Non-Volatile Storage, aka SNVS.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
17 months agoimx8mn-var-som: adjust PHY reset gpios according to hardware configuration
Hugo Villeneuve [Thu, 25 May 2023 21:02:29 +0000 (17:02 -0400)]
imx8mn-var-som: adjust PHY reset gpios according to hardware configuration

For SOM with the EC configuration, the ethernet PHY is located on the
SOM itself, and connected to the CPU ethernet controller. It has a
reset line controlled via GPIO1_IO9. In this configuration, the PHY
located on the carrier board is not connected to anything and is
therefore not used.

For SOM without EC configuration, the ethernet PHY on the carrier
board is connected to the CPU ethernet controller. It has a reset line
controlled via the GPIO expander PCA9534_IO5.

The hardware configuration (EC) is determined at runtime by
reading from the SOM EEPROM.

To support both hardware configurations (EC and non-EC), adjust/fix
the PHY reset gpios according to the hardware configuration
read at runtime from the SOM EEPROM. This adjustement is done in
U-Boot (OF_BOARD_FIXUP) and kernel (OF_BOARD_SETUP) device trees.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
17 months agoARM: dts: imx: Fix eMMC boot on Data Modul i.MX8M Plus eDM SBC
Marek Vasut [Wed, 5 Jul 2023 23:26:10 +0000 (01:26 +0200)]
ARM: dts: imx: Fix eMMC boot on Data Modul i.MX8M Plus eDM SBC

In case the i.MX8M Plus starts from eMMC BOOT1/BOOT2 HW partitions, the
flash.bin container is stored at offset 0 from the start, that means the
fitImage itb is at offset 0x2c0 instead of 0x300 sectors from the start.
Handle this difference in custom spl_mmc_get_uboot_raw_sector() .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
17 months agoimx93_evk: defconfig: add adc support
Luca Ellero [Wed, 5 Jul 2023 12:56:17 +0000 (14:56 +0200)]
imx93_evk: defconfig: add adc support

iMX93 ADC features:
    - 4 channels
    - 12 bit resolution

Signed-off-by: Luca Ellero <l.ellero@asem.it>
17 months agodm: adc: add iMX93 ADC support
Luca Ellero [Wed, 5 Jul 2023 12:56:16 +0000 (14:56 +0200)]
dm: adc: add iMX93 ADC support

This commit adds driver for iMX93 ADC.

The driver is implemented using driver model and provides
ADC uclass's methods for ADC single channel operations:
    - adc_start_channel()
    - adc_channel_data()
    - adc_stop()

ADC features:
    - channels: 4
    - resolution: 12-bit

Signed-off-by: Luca Ellero <l.ellero@asem.it>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
17 months agoARM: imx: romapi: Fix signed integer bitwise ops misuse
Marek Vasut [Sun, 2 Jul 2023 01:03:51 +0000 (03:03 +0200)]
ARM: imx: romapi: Fix signed integer bitwise ops misuse

Bitwise operations on signed integers are not defined,
replace them with per-call checks.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
17 months agoconfigs: imx8m: Prepare imx8m-venice boards for HAB support
Tim Harvey [Fri, 23 Jun 2023 16:44:59 +0000 (09:44 -0700)]
configs: imx8m: Prepare imx8m-venice boards for HAB support

In order to enable HAB, FSL_CAAM, ARCH_MISC_INIT and
SPL_CRYPTO should be enabled in Kconfig like other i.MX8M
boards.

This also needs to occur in the SPL so enable CONFIG_SPL_BOARD_INIT and
add a void spl_board_init function which calls arch_misc_init to probe
the CAAM driver.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
17 months agoboard: gateworks: venice: switch to 2-bank dram config
Tim Harvey [Fri, 23 Jun 2023 16:44:17 +0000 (09:44 -0700)]
board: gateworks: venice: switch to 2-bank dram config

Switch to a 2-bank dram config to properly support 4GiB.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
17 months agoboard: phytec: phycore_imx8mm: Update lpddr4_timing
Cem Tenruh [Fri, 16 Jun 2023 08:28:13 +0000 (10:28 +0200)]
board: phytec: phycore_imx8mm: Update lpddr4_timing

Update RAM Timings for 2GB RAM based on DDR Controller Configuration
Spreadsheet revision 22. Including the update of the refresh
rate to workaround errata ERR050805.

Signed-off-by: Cem Tenruh <c.tenruh@phytec.de>
17 months agomx8m: csf.sh: use vars for keys to avoid file edits when signing
Tim Harvey [Thu, 15 Jun 2023 15:21:08 +0000 (08:21 -0700)]
mx8m: csf.sh: use vars for keys to avoid file edits when signing

The csf_spl.txt and csf_fit.txt templates contain file paths which must
be edited for the location of your NXP CST generated key files.

Streamline the process of signing an image by assigning unique var names
to these which can be expended from env variables in the csf.sh script.

The following vars are used:
 SRK_TABLE - full path to SRK_1_2_3_4_table.bin
 CSF_KEY - full path to the CSF Key CSF1_1_sha256_4096_65537_v3_usr_crt.pem
 IMG_KEY - full path to the IMG Key IMG1_1_sha256_4096_65537_v3_usr_crt.pem

Additionally provide an example of running the csf.sh script.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: fsl_sec: preprocessor casting issue with addresses involving math
Utkarsh Gupta [Thu, 15 Jun 2023 10:09:27 +0000 (18:09 +0800)]
imx: fsl_sec: preprocessor casting issue with addresses involving math

The sec_in32 preprocessor is defined as follows in include/fsl_sec.h file:
When address "a" is calculated using math for ex: addition of base address and
an offset, then casting is applied only to the first address which in this
example is base address.

caam_ccbvid_reg = sec_in32(CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET)
resolves to:
caam_ccbvid_reg = in_le32((ulong *)(ulong)CONFIG_SYS_FSL_SEC_ADDR +
 CAAM_CCBVID_OFFSET)
instead it should resolve to:
caam_ccbvid_reg = in_le32((ulong *)(ulong)(CONFIG_SYS_FSL_SEC_ADDR +
 CAAM_CCBVID_OFFSET))

Thus add parenthesis around the address "a" so that however the address is
calculated, the casting is applied to the final calculated address.

Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: priblob: Update to use structure
Maximus Sun [Thu, 15 Jun 2023 10:09:26 +0000 (18:09 +0800)]
imx: priblob: Update to use structure

Use structure to avoid define CAAM_SCFGR for each platform

Signed-off-by: Maximus Sun <maximus.sun@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: imx8m: add CAAM_BASE_ADDR
Peng Fan [Thu, 15 Jun 2023 10:09:25 +0000 (18:09 +0800)]
imx: imx8m: add CAAM_BASE_ADDR

Add CAAM_BASE_ADDR which will be used by priblob.c

Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: imx8: ahab: sha256: enable image verification using ARMv8 crypto extension
Gaurav Jain [Thu, 15 Jun 2023 10:09:24 +0000 (18:09 +0800)]
imx: imx8: ahab: sha256: enable image verification using ARMv8 crypto extension

add support for SHA-256 secure hash algorithm using the ARM v8
SHA-256 instructions for verifying image hash.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: ahab: Update AHAB for iMX8 and iMX8ULP
Ye Li [Thu, 15 Jun 2023 10:09:23 +0000 (18:09 +0800)]
imx: ahab: Update AHAB for iMX8 and iMX8ULP

Abstract common interfaces for AHAB authentication operations.
Then share some common codes for AHAB and SPL container authentication

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: parse-container: Use malloc for container processing
Nitin Garg [Thu, 15 Jun 2023 10:09:22 +0000 (18:09 +0800)]
imx: parse-container: Use malloc for container processing

If the container has image which conflicts with
spl_get_load_buffer address, there are processing failures.
Use malloc instead of spl_get_load_buffer.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: imx8m: clock: not configure reserved SRC register
Peng Fan [Thu, 15 Jun 2023 10:09:21 +0000 (18:09 +0800)]
imx: imx8m: clock: not configure reserved SRC register

i.MX8M[M,N,P] SRC not has 0x1004 offset register, so drop it.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: imx8: bootaux: Add i.MX8 M4 boot support
Ye Li [Thu, 15 Jun 2023 10:09:20 +0000 (18:09 +0800)]
imx: imx8: bootaux: Add i.MX8 M4 boot support

1. Implement bootaux for the M4 boot on i.MX8QM and QXP. Users need to download
   M4 image to any DDR address first. Then use the
   "bootaux <M4 download DDR address> [M4 core id]" to boot CM4_0
   or CM4_1, the default core id is 0 for CM4_0.

   Since current M4 only supports running in TCM. The bootaux will copy
   the M4 image from DDR to its TCML.

2. Implment bootaux for HIFI on QXP
   command: bootaux 0x81000000 1

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: bootaux: Fix bootaux issue when running on ARM64
Ye Li [Thu, 15 Jun 2023 10:09:19 +0000 (18:09 +0800)]
imx: bootaux: Fix bootaux issue when running on ARM64

The bootaux uses ulong to read private data and write to M4 TCM,
this cause problem on ARM64 platform where the ulong is 8bytes.
Fix it by using u32 to replace ulong.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: bootaux: change names of MACROs used to boot MCU on iMX devices
Peng Fan [Thu, 15 Jun 2023 10:09:18 +0000 (18:09 +0800)]
imx: bootaux: change names of MACROs used to boot MCU on iMX devices

The current bootaux supports i.MX8M and i.MX93, but the name "_M4_"
implies that the SoCs have Cortex-M4. Actually i.MX8MM/Q use Cortex-M4,
i.MX8MN/P use Cortex-M7, i.MX93 use Cortex-M33, so use "_MCU_" in place
of "_M4_" to simplify the naming.

Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: iamge-container: support secondary container
Peng Fan [Thu, 15 Jun 2023 10:09:17 +0000 (18:09 +0800)]
imx: iamge-container: support secondary container

Add the support for loading image from secondary container set on
iMX8QM B0, iMX8QXP C0.

Using the SCFW API to get container set index, if it is the secondary
boot, get the offset from fuse and apply to offset of current container
set beginning for loading.

Also override the emmc boot partition to check secondary boot and switch
to the other boot part.

This patch is modified from NXP downstream:
imx8: Fix the fuse used by secondary container offset
imx: container: Skip container set check for ROM API
imx8: spl: Support booting from secondary container set

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: image-container: Fix container header checking
Ye Li [Thu, 15 Jun 2023 10:09:16 +0000 (18:09 +0800)]
imx: image-container: Fix container header checking

Checking container header tag and version is wrong, it causes to fail
to bypass invalid container

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: hab: Fix coverity issue in HAB event decoding
Ye Li [Thu, 15 Jun 2023 10:09:15 +0000 (18:09 +0800)]
imx: hab: Fix coverity issue in HAB event decoding

Fix below coverity issues caused by get_idx function where "-1" is
compared with uint8_t "element"
343336 Unsigned compared with neg
343337 Operands don't affect result

Additional, this function returns "-1" will cause overflow to
event string array.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: imx8ulp: start the ELE RNG at boot
Peng Fan [Thu, 15 Jun 2023 10:09:14 +0000 (18:09 +0800)]
imx: imx8ulp: start the ELE RNG at boot

On the imx8ulp A1 SoC, the ELE RNG needs to be manually started.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: misc: ele_mu: Update ELE MU driver
Ye Li [Thu, 15 Jun 2023 10:09:13 +0000 (18:09 +0800)]
imx: misc: ele_mu: Update ELE MU driver

Extend the RX timeout value to 10s, because when authentication is failed
the ELE needs long time (>2s for 28M image) to return the result. Print
rx wait info per 1s.

Also correct TX and RX status registers in debug.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: misc: ele_mu: Update MU TR registers count
Ye Li [Thu, 15 Jun 2023 10:09:12 +0000 (18:09 +0800)]
imx: misc: ele_mu: Update MU TR registers count

According to SRM, the Sentinel MU has 8 TR and 4 RR registers. All
of them are used for ELE message. So update TR count to 8 and fix a
typo in receive msg

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: cmd_dek: add ELE DEK Blob generation support
Clement Faure [Thu, 15 Jun 2023 10:09:11 +0000 (18:09 +0800)]
imx: cmd_dek: add ELE DEK Blob generation support

Add ELE DEK Blob generation for the cmd_dek command.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: cmd_dek: Fix Uninitialized pointer read
Ye Li [Thu, 15 Jun 2023 10:09:10 +0000 (18:09 +0800)]
imx: cmd_dek: Fix Uninitialized pointer read

Fix Coverity (CID 21143558).
When tee_shm_register returns failure, the shm_input pointer is
invalid, should not free it. Same issue also exists on registering
shm_output.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: ele_api: add DEK Blob generation
Peng Fan [Thu, 15 Jun 2023 10:09:09 +0000 (18:09 +0800)]
imx: ele_api: add DEK Blob generation

- Add crc computation.
- Add ele_generate_dek_blob API for encrypted boot support.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: ele_api: support program secure fuse and return lifecycle
Peng Fan [Thu, 15 Jun 2023 10:09:08 +0000 (18:09 +0800)]
imx: ele_api: support program secure fuse and return lifecycle

Add two ELE API: ele_return_lifecycle_update and ele_write_secure_fuse
Add two cmd: ahab_return_lifecycle and ahab_sec_fuse_prog

Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: ele_ahab: use hextoul
Peng Fan [Thu, 15 Jun 2023 10:09:07 +0000 (18:09 +0800)]
imx: ele_ahab: use hextoul

Use hextoul which looks a bit simpler.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
17 months agoimx: parse-container: fix build warning
Peng Fan [Thu, 15 Jun 2023 10:09:06 +0000 (18:09 +0800)]
imx: parse-container: fix build warning

Fix build warning:
warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3
has type ‘u64’ {aka ‘long long unsigned int’} [-Wformat=]
         printf("can't find memreg for image %d load address 0x%x, error %d\n",
warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but
argument 3 has type ‘sc_faddr_t’ {aka ‘long long unsigned int’} [-Wformat=]
          debug("memreg %u 0x%lx -- 0x%lx\n", mr, start, end);

Signed-off-by: Peng Fan <peng.fan@nxp.com>