platform/kernel/u-boot.git
2 years agoenv: Make return value of env_get_f() behave like sprintf() on success
Marek Behún [Sun, 17 Oct 2021 15:36:35 +0000 (17:36 +0200)]
env: Make return value of env_get_f() behave like sprintf() on success

Currently the env_get_f() function's return value behaves weirdly: it
returns the number of bytes written into `buf`, but whether this is
excluding the terminating NULL-byte or including it depends on whether
there was enough space in `buf`.

Change the function to always return the actual length of the value of
the environment variable (excluding the terminating NULL-byte) on
success. This makes it behave like sprintf().

All users of this function in U-Boot are compatible with this change.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Early return from env_get_f() on NULL name
Marek Behún [Sun, 17 Oct 2021 15:36:34 +0000 (17:36 +0200)]
env: Early return from env_get_f() on NULL name

Test non-NULL name immediately, not in env_match().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Don't match empty variable name in env_match()
Marek Behún [Sun, 17 Oct 2021 15:36:33 +0000 (17:36 +0200)]
env: Don't match empty variable name in env_match()

Do we really allow zero-length variable name? I guess not.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Use better name for variable in env_get_f()
Marek Behún [Sun, 17 Oct 2021 15:36:32 +0000 (17:36 +0200)]
env: Use better name for variable in env_get_f()

The `nxt` variable actually points to the terminating null-byte of the
current env var, and the next env var is at `nxt + 1`, not `nxt`. So a
better name for this variable is `end`.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Use string pointer instead of indexes in env_get_f()
Marek Behún [Sun, 17 Oct 2021 15:36:31 +0000 (17:36 +0200)]
env: Use string pointer instead of indexes in env_get_f()

Since we no longer use env_get_char() to access n-th character of
linearized environment data, but rather access the arrays themselves, we
can convert the iteration to use string pointers instead of position
indexes.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Inline env_get_char() into its only user
Marek Behún [Sun, 17 Oct 2021 15:36:30 +0000 (17:36 +0200)]
env: Inline env_get_char() into its only user

This function is a relic from the past when environment was read from
underlying device one character at a time.

It is used only in the case when getting an environemnt variable prior
relocation, and the function is simple enough to be inlined there.

Since env_get_char() is being changed to simple access to an array, we
can drop the failing cases and simplify the code (this could have been
done before, since env_get_char() did not fail even before).

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Change env_match() to static and remove from header
Marek Behún [Sun, 17 Oct 2021 15:36:29 +0000 (17:36 +0200)]
env: Change env_match() to static and remove from header

This function was used by other parts of U-Boot in the past when
environment was read from underlying device one character at a time.

This is not the case anymore.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoexamples: api: glue: Remove comment that does not apply anymore
Marek Behún [Sun, 17 Oct 2021 15:36:28 +0000 (17:36 +0200)]
examples: api: glue: Remove comment that does not apply anymore

This comment is not true since commit 6215bd4c1fd6 ("api: Use hashtable
function for API_env_enum").

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Drop env_get_char_spec() and old, unused .get_char() implementations
Marek Behún [Sun, 17 Oct 2021 15:36:27 +0000 (17:36 +0200)]
env: Drop env_get_char_spec() and old, unused .get_char() implementations

Commit b2cdef4861be ("env: restore old env_get_char() behaviour")
dropped the .get_char() method from struct env_driver, but left the two
existing implementations (eeprom and nvram) in case someone would use
them by overwriting weak function env_get_char_spec().

Since this was never done in the 3.5 years, let's drop these methods and
simplify the code.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoenv: Fix documentation for env_get_f()
Marek Behún [Sun, 17 Oct 2021 15:36:26 +0000 (17:36 +0200)]
env: Fix documentation for env_get_f()

This function actually returns:
- the number of bytes written into @buf excluding the terminating
  NULL-byte, if there was enough space in @buf
- the number of bytes written into @buf including the terminating
  NULL-byte, if there wasn't enough space in @buf
- -1 if the variable is not found

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: Fix util.h's broken include guard
Pierre-Clément Tosi [Thu, 30 Sep 2021 15:52:45 +0000 (17:52 +0200)]
dm: Fix util.h's broken include guard

Fix up the header's include guard to contain the definition of
dm_priv_to_rw(), which was erroneously added outside of it, by moving
its #endif to the end of the file (i.e. where it belongs). This removes
the risk of compilation errors resulting from the redefinition of that
function where the header might have been (indirectly) included more
than once.

Fixes: cfb9c9b77c2 ("dm: core: Use separate priv/plat data region")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Cc: Simon Glass <sjg@chromium.org>
2 years agosandbox: provide /chosen/boot-hartid property
Heinrich Schuchardt [Sat, 28 Aug 2021 09:42:09 +0000 (11:42 +0200)]
sandbox: provide /chosen/boot-hartid property

On RISC-V the sandbox must provide the /chosen/boot-hartid in the
devicetree.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agobuildman: Add gcc-11.1.0 to the directory list
Tom Rini [Tue, 5 Oct 2021 16:20:36 +0000 (12:20 -0400)]
buildman: Add gcc-11.1.0 to the directory list

While CI has been using gcc-11.1.0 for a long time, we have not updated
buildman to match.  Correct this omission.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoCI: Switch running the nokia_rx51 test with in-container toolchain
Tom Rini [Fri, 15 Oct 2021 02:21:29 +0000 (22:21 -0400)]
CI: Switch running the nokia_rx51 test with in-container toolchain

Instead of fetching an arm toolchain to use, run the test with the one
that's already in the container image.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agotools: imx8m_image: Support ddr3 firmware
Ariel D'Alessandro [Thu, 30 Sep 2021 13:31:17 +0000 (10:31 -0300)]
tools: imx8m_image: Support ddr3 firmware

Some boards use ddr3, not ddr4, so we need to check ddr3 firmware.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
2 years agomx7ulp: add getting a board serial number
Ricardo Salveti [Tue, 31 Aug 2021 11:53:42 +0000 (14:53 +0300)]
mx7ulp: add getting a board serial number

Get Unique ID of SoC iMX7ULP, using the logic described in Fusemap
(IMX7ULPRMB2_Rev0_Fusemap) attached in the i.MX 7ULP APRM [1].

[1]
https://www.nxp.com/docs/en/reference-manual/IMX7ULPRMB2.pdf

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoboard: ea: mx7ulp_com: allocate specific region of memory to OP-TEE
Ricardo Salveti [Wed, 25 Aug 2021 15:47:18 +0000 (18:47 +0300)]
board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE

On the iMX7ULP uCOM board, OP-TEE uses the memory region defined by the
maximum DRAM address minus CONFIG_OPTEE_TZDRAM_SIZE, so subtract
CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size to avoid
conflicts.

Note the OPTEE boot process itself subtracts the DRAM region it
lives in from the memory map passed to Linux.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm: dts: imx8mp: Delete default clocks for clock controller node
Ye Li [Tue, 17 Aug 2021 06:32:04 +0000 (14:32 +0800)]
arm: dts: imx8mp: Delete default clocks for clock controller node

Since SPL has initialized clocks for bus and core. We don't need to
set the default clocks for clock controller node.

Signed-off-by: Ye Li <ye.li@nxp.com>
Tested-by: Teresa Remmet <t.remmet@phytec.de>
Tested-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8mp_evk: Enable the DWC EQoS iMX driver
Ye Li [Mon, 16 Aug 2021 10:44:32 +0000 (18:44 +0800)]
imx8mp_evk: Enable the DWC EQoS iMX driver

Enable the EQoS i.MX driver in defconfig, also enable the PHYLIB
to facilitate the case that only has FEC enabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
2 years agoimx8mp_evk: Delete noncached memory config
Ye Li [Mon, 16 Aug 2021 10:44:31 +0000 (18:44 +0800)]
imx8mp_evk: Delete noncached memory config

DWC EQOS driver has removed to use noncached memory, so delete
the configuration from iMX8MP EVK head file.

Signed-off-by: Ye Li <ye.li@nxp.com>
2 years agoimx8mp_evk: Remove EQoS PHY reset codes
Ye Li [Mon, 16 Aug 2021 10:44:30 +0000 (18:44 +0800)]
imx8mp_evk: Remove EQoS PHY reset codes

Since we uses the DTS and PHY reset gpio in EQoS driver to do the
reset, remove the duplicated codes from board file.

Signed-off-by: Ye Li <ye.li@nxp.com>
2 years agoimx8mp_evk: Fix incorrect cascade for FEC and EQOS setup
Ye Li [Mon, 16 Aug 2021 10:44:29 +0000 (18:44 +0800)]
imx8mp_evk: Fix incorrect cascade for FEC and EQOS setup

The setup functions should be independent for two ethernet controllers

Signed-off-by: Ye Li <ye.li@nxp.com>
2 years agoarm: dts: imx8mp-evk: Enable the EQoS ethernet port
Ye Li [Mon, 16 Aug 2021 10:44:28 +0000 (18:44 +0800)]
arm: dts: imx8mp-evk: Enable the EQoS ethernet port

i.MX8MP EVK has two ethernet ports. Add relevant nodes and properties
for EQoS port to the EVK DTS file.
In -u-boot.dtsi, change the u-boot eqos compatible string, add PHY
reset gpio and remove assigned clocks as not supported in CCF.

Signed-off-by: Ye Li <ye.li@nxp.com>
2 years agoarm: mach-imx: Allow to build mac.c for EQoS driver
Ye Li [Mon, 16 Aug 2021 10:44:27 +0000 (18:44 +0800)]
arm: mach-imx: Allow to build mac.c for EQoS driver

i.MX8MP has one DWC EQoS controller, so allow to build mac.c when
only this driver is enabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
2 years agoarm: mach-imx: Update MAC fuse for i.MX8MP
Ye Li [Mon, 16 Aug 2021 10:44:26 +0000 (18:44 +0800)]
arm: mach-imx: Update MAC fuse for i.MX8MP

i.MX8MP has two ENET controllers, have to update the function to
enable loading two MAC addresses.

Signed-off-by: Ye Li <ye.li@nxp.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoMerge branch 'master' of git://git.denx.de/u-boot
Stefano Babic [Thu, 21 Oct 2021 11:57:38 +0000 (13:57 +0200)]
Merge branch 'master' of git://git.denx.de/u-boot

Signed-off-by: Stefano Babic <sbabic@denx.de>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 21 Oct 2021 11:52:15 +0000 (07:52 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Turris MOX and Omnia changes, mostly moving to Kconfig (Marek)
- a37xx: pci: Misc smaller fixes (Pali)
- cmd: tlv_eeprom: Fix building with DEBUG enabled (Sven)
- termios_linux.h: Fix tcsendbreak() implementation (Pali)
- mvebu: Add missing "if SPL" (Tom)

2 years agoarm: a37xx: pci: Fix condition for CRS response
Pali Rohár [Tue, 19 Oct 2021 09:05:01 +0000 (11:05 +0200)]
arm: a37xx: pci: Fix condition for CRS response

As stated in comment above the code, CRS response can be returned to OS
only for 4-byte PCI_VENDOR_ID config read request. So fix the code.

Fixes: 1d7ad68559e2 ("arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Add missing "if SPL"
Tom Rini [Fri, 15 Oct 2021 14:54:41 +0000 (10:54 -0400)]
arm: mvebu: Add missing "if SPL"

We can only select SPL_SKIP_LOWLEVEL_INIT if SPL is enabled, otherwise
we get a warning about unmet dependencies on platforms that don't use
SPL.

Fixes: cf47a8cf8f7e ("arm: mvebu: Select SPL_SKIP_LOWLEVEL_INIT on ARMADA_32BIT")
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Do not allow setting bars on PCI Bridge
Pali Rohár [Tue, 12 Oct 2021 11:19:19 +0000 (13:19 +0200)]
arm: a37xx: pci: Do not allow setting bars on PCI Bridge

PCI Bridge which represents Aardvark PCIe Root Port does not have
configurable bars.

So ensure that write operation to bars registers on PCI Bridge is noop and
bars registers always contain zero address which indicates that bars are
unsupported.

After this change U-Boot 'pci bar 0.0.0' command does not show any
allocated bars for PCI Bridge device.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: cb056005dc67 ("arm: a37xx: pci: Add support for accessing PCI Bridge on root bus")
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Move CONFIG_SPL_DRIVERS_MISC to Kconfig
Marek Behún [Sat, 9 Oct 2021 17:33:46 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Move CONFIG_SPL_DRIVERS_MISC to Kconfig

Instead of declaring CONFIG_SPL_DRIVERS_MISC in board config header,
select it in Kconfig.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Move SPL's SYS_MALLOC_SIMPLE to Kconfig
Marek Behún [Sat, 9 Oct 2021 17:33:45 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Move SPL's SYS_MALLOC_SIMPLE to Kconfig

Instead of declaring CONFIG_SYS_MALLOC_SIMPLE dependant on
CONFIG_SPL_BUILD in board config header, select
CONFIG_SPL_SYS_MALLOC_SIMPLE in Kconfig.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Use show_board_info()
Marek Behún [Sat, 9 Oct 2021 17:33:44 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Use show_board_info()

We are printing board information in checkboard() function, which is
called from the default weak implementation of show_board_info().

Rename checkboard() to show_board_info(). This throws away the weak
implementation of show_board_info().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Overwrite ethaddr only if invalid
Marek Behún [Sat, 9 Oct 2021 17:33:43 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Overwrite ethaddr only if invalid

Currently we always overwrite ethaddrs with those from EEPROM.

In order to allow user to use a cloned MAC address in U-Boot, change the
code so that it sets ethaddr variables only if they aren't set or are
invalid.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Better check for valid ethernet addresses in env
Marek Behún [Sat, 9 Oct 2021 17:33:42 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Better check for valid ethernet addresses in env

Currently we overwrite ethaddr and eth1addr only if these variables
don't exist.

Better overwrite them even if the env variable exists, but is invalid -
eth_env_get_enetaddr_by_index() checks for validity.

Refactor the code to use a for cycle.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Always handle reset button
Marek Behún [Sat, 9 Oct 2021 17:33:41 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Always handle reset button

Handle reset button even if we can't configure modules.

This happens if we fail retrieving reset GPIO with which we can reset
the modules.

(Note that this GPIO is different from reset button GPIO.)

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Use show_board_info()
Marek Behún [Sat, 9 Oct 2021 17:33:40 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Use show_board_info()

We are printing board information in last_stage_init(), but U-Boot has
dedicated function, show_board_info(), for this.

Move code which prints board information (board version, serial number,
module topology, ...) to show_board_info().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Cosmetic update for board config header
Marek Behún [Sat, 9 Oct 2021 17:33:39 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Cosmetic update for board config header

Reorder the definitions in Turris MOX' board config header, drop the
comment relics from when this file was copied, fix indentation.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood, mvebu: Remove CONFIG_SYS_RESET_ADDRESS option
Marek Behún [Sat, 9 Oct 2021 17:33:38 +0000 (19:33 +0200)]
arm: kirkwood, mvebu: Remove CONFIG_SYS_RESET_ADDRESS option

This option is not used anywhere.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a3720: Create Kconfig option for I2C_MV
Marek Behún [Sat, 9 Oct 2021 17:33:37 +0000 (19:33 +0200)]
arm: mvebu: a3720: Create Kconfig option for I2C_MV

Move the config option CONFIG_I2C_MV to a Kconfig option
CONFIG_SYS_I2C_MV and move the default definition from config header
files into defconfigs.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Move options to defconfig
Marek Behún [Sat, 9 Oct 2021 17:33:36 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Move options to defconfig

Move config options CONFIG_LAST_STAGE_INIT and
CONFIG_DISPLAY_BOARDINFO_LATE to turris_mox_defconfig.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: termios_linux.h: Fix tcsendbreak() implementation
Pali Rohár [Wed, 6 Oct 2021 12:30:25 +0000 (14:30 +0200)]
tools: termios_linux.h: Fix tcsendbreak() implementation

There are two Linux ioctls which implements tcsendbreak() functionality:
TCSBRK and TCSBRKP

TCSBRK with non-zero parameter implements tcdrain() and with zero parameter
implements tcsendbreak() for duration of 0.25s.

TCSBRKP with zero parameter is same as TCSBRK and with non-zero parameter
implements tcsendbreak() for duration in deciseconds specified by
parameter. TCSBRKP does not have to be provided by older toolchain
versions.

So tcsendbreak() has to either use TCSBRK with zero parameter or TCSBRKP
with any parameter.

Fix code to use TCSBRKP and fallback to TCSBRK with 0.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocmd: tlv_eeprom
Sven Auhagen [Sun, 12 Sep 2021 07:25:44 +0000 (09:25 +0200)]
cmd: tlv_eeprom

The function show_eeprom is missing int i if debug is enabled.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoefi_loader: Fix link of EFI apps with ld.lld
Alistair Delva [Wed, 20 Oct 2021 21:31:31 +0000 (21:31 +0000)]
efi_loader: Fix link of EFI apps with ld.lld

When compiling U-Boot with ld.lld as the linker, the helloworld EFI app
example fails to link:

LD      lib/efi_loader/helloworld_efi.so
ld.lld: error: section: .dynamic is not contiguous with other relro
                        sections

LLD will always create RELRO program header regardless of target
emulation, whereas BFD may automatically disable it for unsupported
targets. Add -znorelro to disable it explicitly in all cases.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_loader: efi_dp_from_lo() should skip VenMedia node
Heinrich Schuchardt [Fri, 15 Oct 2021 00:59:15 +0000 (02:59 +0200)]
efi_loader: efi_dp_from_lo() should skip VenMedia node

The 'efidebug boot dump' command should not display the VenMedia() device
path node preceding the device path of the initial ram disk.

By letting efi_dp_from_lo() skip the VenMedia() device path node we can
simplify the coding.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: avoid multiple local copies of lf2_initrd_guid
Heinrich Schuchardt [Fri, 15 Oct 2021 00:33:33 +0000 (02:33 +0200)]
efi_loader: avoid multiple local copies of lf2_initrd_guid

Create the GUID as a global variable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: efi_dp_from_lo() unused parameter size
Heinrich Schuchardt [Fri, 15 Oct 2021 00:03:55 +0000 (02:03 +0200)]
efi_loader: efi_dp_from_lo() unused parameter size

Parameter size is never used in function efi_dp_from_lo(). Remove it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: simplify show_efi_boot_opt_data()
Heinrich Schuchardt [Thu, 14 Oct 2021 23:47:40 +0000 (01:47 +0200)]
efi_loader: simplify show_efi_boot_opt_data()

Use printf code %pD for printing device paths.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_loader: efi_dp_from_lo() don't copy GUID
Heinrich Schuchardt [Thu, 14 Oct 2021 23:31:02 +0000 (01:31 +0200)]
efi_loader: efi_dp_from_lo() don't copy GUID

Instead of copying a GUID and then using a pointer to the copy for calling
guidcmp(), just pass the pointer to the orginal GUID.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_loader: Fix loaded image alignment
Ilias Apalodimas [Mon, 11 Oct 2021 12:10:23 +0000 (15:10 +0300)]
efi_loader: Fix loaded image alignment

We are ignoring the alignment communicated via the PE/COFF header.
Starting 5.10 the Linux kernel will loudly complain about it. For more
details look at [1] (in linux kernel).

So add a function that can allocate aligned EFI memory and use it for our
relocated loaded image.

[1] c32ac11da3f83 ("efi/libstub: arm64: Double check image alignment at entry")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Vincent Stehlé <vincent.stehle@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_loader: don't load Shim's MOK database from file
Heinrich Schuchardt [Wed, 6 Oct 2021 12:10:14 +0000 (14:10 +0200)]
efi_loader: don't load Shim's MOK database from file

When using a file to store UEFI variables we must make sure that secure
boot related variables are not loaded from this file. With commit
9ef82e29478c ("efi_loader: don't load signature database from file")
this has already been implemented for variables defined in the UEFI
specification. As most Linux distributions use Shim we should do the same
for Shim's MOK database.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agox86: Show some EFI info with the bdinfo command
Simon Glass [Sat, 25 Sep 2021 00:30:21 +0000 (18:30 -0600)]
x86: Show some EFI info with the bdinfo command

It is useful to see some basic EFI info with the command as it forms part
of the information about a board.

Add a hook for this and show the table address as a start.

While here, fix an invalid cast in setup_efi_info(). Note that this
function is using a data structure defined by Linux so we cannot change
it. Also note that ulong is used since this is the standard in U-Boot
(>6k uses), despite there being quite a bit of the more verbose uintptr_t
(930 uses).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agox86: Create a new header for EFI
Simon Glass [Sat, 25 Sep 2021 00:30:20 +0000 (18:30 -0600)]
x86: Create a new header for EFI

The setup routines are called from zimage but don't really belong in the
zimage header. Add a new EFI header to house these. Add comments so it is
clear what the functions do.

Note that these functions are x86-specific. The zimage business is not
used on other architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agox86: Keep symbol information in u-boot ELF file
Simon Glass [Sat, 25 Sep 2021 00:30:19 +0000 (18:30 -0600)]
x86: Keep symbol information in u-boot ELF file

At present this information is stripped when linking. It is useful to keep
it around. Strip it from the .efi files instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi: Add a separate maintainer entry for the app
Simon Glass [Sat, 25 Sep 2021 00:30:18 +0000 (18:30 -0600)]
efi: Add a separate maintainer entry for the app

Separate this out slightly from the payload, with a new entry.

We might consider renaming EFI PAYLOAD to EFI LOADER, but that would
require quite a lot of file changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_loader: Drop code that doesn't work with driver model
Simon Glass [Sat, 25 Sep 2021 00:30:17 +0000 (18:30 -0600)]
efi_loader: Drop code that doesn't work with driver model

This code should never have been added as it builds a new feature on top
of legacy code. This has already been improved with the dependency on BLK.

Add a dependency on DM_ETH also, to avoid needing to deal with this old
code.

Boards which want EFI_LOADER should migrate to driver model first.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_selftest: Receive the packets until the receive buffer is empty
Masami Hiramatsu [Thu, 16 Sep 2021 08:53:44 +0000 (17:53 +0900)]
efi_selftest: Receive the packets until the receive buffer is empty

Repeatedly receive the packets until the receive buffer is empty.
If the buffer is empty, EFI_SIMPLE_NETWORK_PROTOCOL::Receive()
returns EFI_NOT_READY. We don't need to use the wait_for_event()
every time.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
Masami Hiramatsu [Thu, 16 Sep 2021 08:53:36 +0000 (17:53 +0900)]
efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT

Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT in packet
receiving loop. This depends on the implementation and not
related to whether the packet can be received or not.

Whether the received packets are available or not is ensured
by wait_for_packet, and that is already done in the loop.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check
Masami Hiramatsu [Thu, 16 Sep 2021 08:53:27 +0000 (17:53 +0900)]
efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check

According to the UEF specification v2.9, the main purpose of the
EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() is for checking the link
status via EFI_SIMPLE_NETWORK_MODE::MediaPresent.
So this uses net->get_status() for checking the link status before
running network test.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoconfigs: add mkeficapsule to tools-only_defconfig
Heinrich Schuchardt [Thu, 9 Sep 2021 05:27:10 +0000 (07:27 +0200)]
configs: add mkeficapsule to tools-only_defconfig

mkeficapsule is used to create capsules for UEFI firmware update.
To ease inclusion into U-Boot tools packages of Linux distributions we
should add it to the tools-only_defconfig.

Provide dummy values for CONFIG_AVB_BUF_ADDR, CONFIG_AVB_BUF_SIZE to
satisfy Kconfig.

Suggested-by: Vagrant Cascadian <vagrant@debian.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: Remove obsolete README.440-DDR-performance file
Thomas Huth [Tue, 19 Oct 2021 07:25:52 +0000 (09:25 +0200)]
doc: Remove obsolete README.440-DDR-performance file

The PPC 440 support has been removed in commit 98f705c9cefd
("powerpc: remove 4xx support") already, so this file is
certainly not required anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agodoc: add python3-pkg-resources to build dependencies
Heinrich Schuchardt [Mon, 11 Oct 2021 12:59:48 +0000 (14:59 +0200)]
doc: add python3-pkg-resources to build dependencies

tools/binman/control.py imports Python package pkg_resources.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: add system reset to API documentation
Heinrich Schuchardt [Thu, 23 Sep 2021 09:06:16 +0000 (11:06 +0200)]
doc: add system reset to API documentation

Complete the Sphinx documentation in include/sysreset.h
Add the include to the generated HTML documentation of the U-Boot API.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: require Sphinx 3.4.3
Heinrich Schuchardt [Thu, 21 Oct 2021 01:17:51 +0000 (03:17 +0200)]
doc: require Sphinx 3.4.3

For enums documented according to the requirements in chapter
"Structure, union, and enumeration documentation" of
https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html
errors occur with Sphinx 2.4.4 which disappear with Sphinx 3.4.3,
e.g.
/builds/u-boot/custodians/u-boot-efi/doc/api/sysreset:6:
./include/sysreset.h:60:Unknown interpreted text role "enum".

Sphinx 3.4.3 is the version used by Debian in the current release.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoMerge tag 'u-boot-imx-20211020' of https://source.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Wed, 20 Oct 2021 18:24:09 +0000 (14:24 -0400)]
Merge tag 'u-boot-imx-20211020' of https://source.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20211020
-------------------

First PR from u-boot-imx for 2022.01

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

- new board: kontron-sl-mx8mm
- imx8m:
- fix secure boot
- imx ESDHC: fixes
- i.MX53: Support thum2, bmode and fixes for Menlo board
  usbarmory switch to Ethernet driver model
- imx6 :
- DDR calibration for Toradex boards
- imx7:
- Fixes
- Updated gateworks boards (ventana / venice)

# gpg verification failed.

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Wed, 20 Oct 2021 18:23:08 +0000 (14:23 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- Assorted warning fixes, io read/write bugfix

2 years agodoc: imx: psb: Add documentation for MX8MM behavior with Fast Boot fuse blown
Marek Vasut [Tue, 10 Aug 2021 19:12:50 +0000 (21:12 +0200)]
doc: imx: psb: Add documentation for MX8MM behavior with Fast Boot fuse blown

On iMX8MM with Fast Boot fuse blown, the SIT and A-copy image are
placed at different offset than on iMX8MM with Fast Boot fuse NOT
blown. List both options and both offsets to avoid confusion.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agodoc: imx: psb: Fix PERSIST_SECONDARY_BOOT bit location in GPR10
Marek Vasut [Tue, 10 Aug 2021 19:12:49 +0000 (21:12 +0200)]
doc: imx: psb: Fix PERSIST_SECONDARY_BOOT bit location in GPR10

The PERSIST_SECONDARY_BOOT is in GPR10 address 0x30390098, adjust the
text which currently says it is in GPR0 while using the correct address
of GPR10.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agocolibri-imx6ull: add emmc variant
Max Krummenacher [Wed, 6 Oct 2021 16:55:36 +0000 (18:55 +0200)]
colibri-imx6ull: add emmc variant

Add code to build the eMMC variant of the Colibri iMX6ULL, i.e. the
'Colibri iMX6ULL 1GB' which has a eMMC instead of the raw NAND used
on other SKUs.

Related-to: ELB-4056, ELB-4057
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agocolibri-imx6ull: imximage.cfg: integrate new 1GiB RAM variant
Philippe Schenker [Wed, 6 Oct 2021 16:55:35 +0000 (18:55 +0200)]
colibri-imx6ull: imximage.cfg: integrate new 1GiB RAM variant

Integrate new Toradex SKU 0062 Colibri iMX6ULL 1GB IT. This commit
basically adjusts three parameters of the RAM settings:

Increase density from 4Gb to 8Gb
Increase ROW address from 15 to 16
Increase tRFC (refresh command time) from 260 to 350

This timing is valid for all Toradex Colibri iMX6ULL SKUs

Related-to: ELB-4055, ELB-4057
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agotoradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus
Marcel Ziswiler [Wed, 6 Oct 2021 16:55:34 +0000 (18:55 +0200)]
toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agotoradex: configblock: fix interactive mode it handling
Denys Drozdov [Wed, 6 Oct 2021 16:55:33 +0000 (18:55 +0200)]
toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agotoradex: take over maintainership
Marcel Ziswiler [Wed, 6 Oct 2021 16:55:32 +0000 (18:55 +0200)]
toradex: take over maintainership

Also take over maintainership of remaining Toradex SoMs as Oleksandr
has left our company.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
CC: Oleksandr Suvorov <cryosay@gmail.com>
2 years agoimx8mm-evk: Generate a single bootable flash.bin again
Fabio Estevam [Mon, 23 Aug 2021 12:56:42 +0000 (09:56 -0300)]
imx8mm-evk: Generate a single bootable flash.bin again

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch
to use binman to pack images"), it is necessary to flash both flash.bin and
u-boot.itb to get a bootable system. Prior to this commit, only flash.bin
was needed.

Such new requirement breaks existing distro mechanisms to generate the
final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single
bootable binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more
descriptive name for its purpose, and can still be used standalone
(for example, for secure boot purposes).

Also update imx8mm_evk.rst to remove the u-boot.itb copy step.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agocolibri-imx6ull: fix setup of nand gpmi clock
Philippe Schenker [Fri, 15 Oct 2021 08:25:51 +0000 (10:25 +0200)]
colibri-imx6ull: fix setup of nand gpmi clock

NXP used to setup the gpmi clock root from gpmi_clk in early versions
in their downstream BSP. [1]
However on mainline the gpmi clock root was always setup from enfc
since the beginning of the i.MX 6 series SoCs, which is still the same
today. [2]

NXP followed the mainline approach at some point and changed
setup_gpmi_io_clk to setup gpmi clock root from enfc which left faulty
code behind in our board file. [3]

This commit follows the change of NXP as it improves the performance of
the NAND from ~1.2 MiB/s to ~12 MiB/s. [3]

This change was verified to work in recovery-mode and u-boot loaded
from NAND on all four Colibri iMX6ULL SKUs from Toradex.

The frequency used to read the NAND, measured on RE# (Read Enable):
before this patch: 1.4 MHz
after this patch:   22 MHz
in Linux Kernel:    50 MHz

[1] https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/cpu/armv7/mx6/clock.c?h=nxp/imx_v2016.03_4.1.15_2.0.0_ga#n62
[2] commit 23608e23fd65 ("i.mx: add the initial support for freescale i.MX6Q processor")
[3] https://source.codeaurora.org/external/imx/uboot-imx/commit/?id=7a82a19ceabfb04bbc1591a67c99751748781c7d

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
2 years agoboard: phytec: imx8mm-phycore: Switch to binman
Teresa Remmet [Wed, 6 Oct 2021 09:56:54 +0000 (11:56 +0200)]
board: phytec: imx8mm-phycore: Switch to binman

Use binman for image creation.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoconfigs: phycore-imx8mm_defconfig: Enable clk command
Teresa Remmet [Wed, 6 Oct 2021 09:56:53 +0000 (11:56 +0200)]
configs: phycore-imx8mm_defconfig: Enable clk command

Enable clk command to dump clock tree.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoboard: phytec: phycore-imx8mm: Add SPI-NOR flash support
Teresa Remmet [Wed, 6 Oct 2021 09:56:52 +0000 (11:56 +0200)]
board: phytec: phycore-imx8mm: Add SPI-NOR flash support

Adds SPI-NOR flash support to erase, read and write in bootloader.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoarm: dts: phycore-imx8mm: Fix property
Teresa Remmet [Wed, 6 Oct 2021 09:56:51 +0000 (11:56 +0200)]
arm: dts: phycore-imx8mm: Fix property

Fix misspelled property "stdout-path".

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoarm: dts: phycore-imx8mm-u-boot: Add wdog pinctrl entry
Teresa Remmet [Wed, 6 Oct 2021 09:56:50 +0000 (11:56 +0200)]
arm: dts: phycore-imx8mm-u-boot: Add wdog pinctrl entry

Add missing pinctrl entry in spl.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoinclude: configs: phycore-imx8mm: Do not use macro for address
Teresa Remmet [Wed, 6 Oct 2021 09:56:49 +0000 (11:56 +0200)]
include: configs: phycore-imx8mm: Do not use macro for address

Do not use size macros for addesses. So convert PHYS_SDRAM to address.
No functional change.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoinclude: configs: phycore-imx8mm: Remove not needed defines
Teresa Remmet [Wed, 6 Oct 2021 09:56:48 +0000 (11:56 +0200)]
include: configs: phycore-imx8mm: Remove not needed defines

Remove obsolet defines in phycore_imx8mm.h.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoinclude: configs: phycore_imx8mm: Remove hard coded network settings
Teresa Remmet [Wed, 6 Oct 2021 09:56:47 +0000 (11:56 +0200)]
include: configs: phycore_imx8mm: Remove hard coded network settings

Remove ip address and server ip from board config as they should not
be added hardcoded.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoboard: phytec: phycore_imx8mm: Clean up spl
Teresa Remmet [Wed, 6 Oct 2021 09:56:46 +0000 (11:56 +0200)]
board: phytec: phycore_imx8mm: Clean up spl

Remove not needed code in the spl board code.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
2 years agoverdin-imx8mm: fix watchdog pinctrl issue
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:13 +0000 (22:41 +0200)]
verdin-imx8mm: fix watchdog pinctrl issue

Finally, found the root cause of the issue already once mentioned back
here [2] which caused the following error message during boot:

imx_wdt watchdog@30280000:
 pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

Turns out while the watchdog node itself was already u-boot,dm-spl its
pinctrl node was not which caused it to be unavailable at that early
stage. Note that any and all other boards I checked also seem to be
missing this. However, I can't judge whether or not they might indeed
need a similar fix or not.

[2] https://marc.info/?l=u-boot&m=161786572422973

Fixes: commit d304e7ace3a6
 ("ARM: imx8m: Fix reset in SPL on Toradex iMX8MM Verdin")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoverdin-imx8mm: use preboot for fdtfile evaluation
Igor Opaniuk [Sat, 9 Oct 2021 20:41:12 +0000 (22:41 +0200)]
verdin-imx8mm: use preboot for fdtfile evaluation

Enable and set preboot var with fdtfile evaluation.
It will be checked and run immediately before starting the
CONFIG_BOOTDELAY countdown and/or running the auto-boot command resp.
entering interactive mode.

This provides possibility to use different boot cmds in interactive mode
without manual setting fdtfile value, as it it's already evaluated
before entering interactive mode.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoinclude/configs: apalis-imx8/verdin-imx8mm: rename kernel image variable
Oleksandr Suvorov [Sat, 9 Oct 2021 20:41:11 +0000 (22:41 +0200)]
include/configs: apalis-imx8/verdin-imx8mm: rename kernel image variable

Variable "kernel_image" is used in boot.scr script only, that sets its
own default value to the constant string @@KERNEL_IMAGETYPE@@ in case
"kernel_image" is not set.
The default name of the kernel image shipped with BSP 5.x is "Image.gz".
Setting kernel_image="Image" as a pre-defined u-boot variable
breaks booting systems with modern versions of boot.scr, whereas
renaming it fixes booting with modern scripts and does not break working
of earlier versions of boot.scr.

While at it also update the copyright period, rather than hard-coding
fdtfile default fdt_board to dev for the Verdin iMX8M Mini and fix its
closing #endif comment.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoverdin-imx8mm: drop support for v1.0 hardware
Max Krummenacher [Sat, 9 Oct 2021 20:41:10 +0000 (22:41 +0200)]
verdin-imx8mm: drop support for v1.0 hardware

We drop support for Verdin iMX8M Mini V1.0B.

Related-to: ELB-3551
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoverdin-imx8mm: clean-up include order
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:09 +0000 (22:41 +0200)]
verdin-imx8mm: clean-up include order

Alphabetically order includes.
While at it also update copyright year resp. period.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoverdin-imx8mm: enable sleep_moci output
Max Krummenacher [Sat, 9 Oct 2021 20:41:08 +0000 (22:41 +0200)]
verdin-imx8mm: enable sleep_moci output

This powers some peripherals on the carrier board e.g. the USB hub.

Related-to: ELB-3206
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoverdin-imx8mm: switch to use binman to pack images
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:07 +0000 (22:41 +0200)]
verdin-imx8mm: switch to use binman to pack images

Use binman to pack images.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agoarm64: dts: imx8mm-verdin-u-boot.dtsi: alphabetically re-order
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:06 +0000 (22:41 +0200)]
arm64: dts: imx8mm-verdin-u-boot.dtsi: alphabetically re-order

Alphabetically re-order nodes and properties.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoARM: dts: imx8mm-verdin: prepare for dek blob encapsulation
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:05 +0000 (22:41 +0200)]
ARM: dts: imx8mm-verdin: prepare for dek blob encapsulation

Prepare for DEK blob encapsulation support through "dek_blob" command.
On ARMv8, u-boot runs in non-secure, thus cannot encapsulate a DEK blob
for encrypted boot.
The DEK blob is encapsulated by OP-TEE through a trusted application
call. U-boot sends and receives the DEK and the DEK blob binaries
through OP-TEE dynamic shared memory.

To enable the DEK blob encapsulation, add to the defconfig:
CONFIG_SECURE_BOOT=y
CONFIG_FAT_WRITE=y
CONFIG_CMD_DEKBLOB=y

Taken from NXP's commit 56d2050f4028 ("imx8m: Add DEK blob encapsulation
for imx8m").

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoverdin-imx8mm: fix ethernet
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:04 +0000 (22:41 +0200)]
verdin-imx8mm: fix ethernet

Turns out Microship (formerly Micrel) meanwhile integrated proper
support for the DLL setup on their KSZ9131. Unfortunately, this
conflicts with our previous board code doing that.
Fix this by getting rid of our board code and just relying on the
generic implementation relying on rgmii-id being used as phy-mode.

Fixes: commit c6df0e2ffdc4
       ("net: phy: micrel: add support for DLL setup on ksz9131")
Fixes: commit af2d3c91d877
       ("ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoimx8m: clean-up kconfig indentation
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:03 +0000 (22:41 +0200)]
imx8m: clean-up kconfig indentation

Replace spurious spaces with proper tabs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoimx8mm-cl-iot-gate-optee: align config with Kconfig
Stefano Babic [Wed, 20 Oct 2021 10:13:44 +0000 (12:13 +0200)]
imx8mm-cl-iot-gate-optee: align config with Kconfig

Due to missing configs, CI goes in deadlock until an OOM is tracked. Add
CONFIG_SYS_LOAD_ADDR and replace CONFIG_SYS_EXTRA_OPTIONS with
CONFIG_IMX_CONFIG.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>
CC: Fabio Estevam <festevam@denx.de>
2 years agokontron-sl-mx8mm: fix missing configs and deadlock in CI
Stefano Babic [Wed, 20 Oct 2021 09:55:25 +0000 (11:55 +0200)]
kontron-sl-mx8mm: fix missing configs and deadlock in CI

Even if board can be successfuly built, CI goes in deadlock (see thread
on https://www.mail-archive.com/u-boot@lists.denx.de/msg419663.html).
This is caused by SYS_CONFIG set in header file and because defconfig
for the board is out of sync with Kconfig. As result, buildman goes on
to read from stdin until an OOM is reached.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Frieder Schrempf <frieder.schrempf@kontron.de>
2 years agobuildman: Detect Kconfig loops
Simon Glass [Wed, 20 Oct 2021 03:43:24 +0000 (21:43 -0600)]
buildman: Detect Kconfig loops

Hex and int Kconfig options are supposed to have defaults. This is so we
can configure U-Boot without having to enter particular values for the
items that don't have specific values in the board's defconfig file.

If this rule is not followed, then introducing a new Kconfig can produce
a loop like this:

   Break things (BREAK_ME) [] (NEW)
   Error in reading or end of file.

   Break things (BREAK_ME) [] (NEW)
   Error in reading or end of file.

The continues forever since buildman passes /dev/null to 'conf', and
the build system just tries again. Eventually there is so much output that
buildman runs out of memory.

We can detect this situation by looking for a symbol (like 'BREAK_ME')
which has no default (the '[]' above) and is marked as new. If this
appears multiple times in the output, we know something is wrong.

Add a filter function for the output which detects this situation. Allow
it to return True to terminate the process. Implement this termination in
cros_subprocess.

With this we get a nice message:

   buildman --board sandbox -T0
   Building current source for 1 boards (0 threads, 32 jobs per thread)
      sandbox:  w+   sandbox
   +.config:66:warning: symbol value '' invalid for BREAK_ME
   +
   +Error in reading or end of file.
   +make[3]: *** [scripts/kconfig/Makefile:75: syncconfig] Terminated
   +make[2]: *** [Makefile:569: syncconfig] Terminated
   +make: *** [Makefile:177: sub-make] Terminated
   +(** did you define an int/hex Kconfig with no default? **)

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobuildman: Write output even on fatal error
Simon Glass [Wed, 20 Oct 2021 03:43:23 +0000 (21:43 -0600)]
buildman: Write output even on fatal error

At present buildman does not write any output (to the 'out' and 'err)
files if the build terminates with a fatal error. This is to avoid adding
lots of spam to the logs.

However there are times when this is actually useful, such as when the
build fails for an obscure reason such as a Kconfig loop.

Update the logic to always write the output, so that the user gets a clue
as to what is happening.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoriscv: Avoid io read/write cause wrong result
Nick Hu [Mon, 18 Oct 2021 03:50:05 +0000 (11:50 +0800)]
riscv: Avoid io read/write cause wrong result

io read/write may cause wrong result because they may read/write data
from/to register instead of memory. Add 'volatile' to avoid it.

Signed-off-by: Nick Hu <nick.hu@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>