platform/kernel/u-boot.git
9 months agolib: Suppress E when writing error-string output
Simon Glass [Sun, 30 Jul 2023 17:15:13 +0000 (11:15 -0600)]
lib: Suppress E when writing error-string output

When CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the
format string. Fix this.

Fixes: 7f331941321 ("lib: Support printing an error string")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 months agousb: Return -ENOENT when no devices are found
Simon Glass [Sun, 30 Jul 2023 17:15:12 +0000 (11:15 -0600)]
usb: Return -ENOENT when no devices are found

When USB finds no devices it currently returns -EPERM which bootstd does
not understand. This causes other bootdevs of the same priority to be
skipped.

Fix this by returning the correct error code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 months agoMerge branch '2023-08-08-introuce-Arm-FF-A-support'
Tom Rini [Tue, 8 Aug 2023 19:23:16 +0000 (15:23 -0400)]
Merge branch '2023-08-08-introuce-Arm-FF-A-support'

To quote the author:
Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A].

FF-A specifies interfaces that enable a pair of software execution
environments aka partitions to communicate with each other. A partition
could be a VM in the Normal or Secure world, an application in S-EL0, or
a Trusted OS in S-EL1.

FF-A is a discoverable bus and similar to architecture features.
FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed by
the PSCI driver.

   => dm tree

    Class     Index  Probed  Driver                Name
   -----------------------------------------------------------
   ...
    firmware      0  [ + ]   psci                      |-- psci
    ffa                   0  [   ]   arm_ffa               |   `-- arm_ffa
   ...

Clients are able to probe then use the FF-A bus by calling the DM class
searching APIs (e.g: uclass_first_device).

This implementation of the specification provides support for Aarch64.

The FF-A driver uses the SMC ABIs defined by the FF-A specification to:

    - Discover the presence of secure partitions (SPs) of interest
    - Access an SP's service through communication protocols
      (e.g: EFI MM communication protocol)

The FF-A support provides the following features:

    - Being generic by design and can be used by any Arm 64-bit platform
    - FF-A support can be compiled and used without EFI
    - Support for SMCCCv1.2 x0-x17 registers
    - Support for SMC32 calling convention
    - Support for 32-bit and 64-bit FF-A direct messaging
    - Support for FF-A MM communication (compatible with EFI boot time)
    - Enabling FF-A and MM communication in Corstone1000 platform as a use case
    - A Uclass driver providing generic FF-A methods.
    - An Arm FF-A device driver providing Arm-specific methods and reusing the Uclass methods.
    - A sandbox emulator for Arm FF-A, emulates the FF-A side of the Secure World and provides
      FF-A ABIs inspection methods.
    - An FF-A sandbox device driver for FF-A communication with the emulated Secure World.
      The driver leverages the FF-A Uclass to establish FF-A communication.
    - Sandbox FF-A test cases.
    - A new command called armffa is provided as an example of how to access the
      FF-A bus

For more details about the FF-A support please refer to [B] and refer to [C] for
how to use the armffa command.

Please find at [D] an example of the expected boot logs when enabling
FF-A support for a platform. In this example the platform is
Corstone1000. But it can be any Arm 64-bit platform.

More details:

[A]: https://developer.arm.com/documentation/den0077/latest/
[B]: doc/arch/arm64.ffa.rst
[C]: doc/usage/cmd/armffa.rst
[D]: example of boot logs when enabling FF-A

9 months agoarm_ffa: efi: corstone1000: enable MM communication
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:45 +0000 (14:33 +0100)]
arm_ffa: efi: corstone1000: enable MM communication

turn on EFI MM communication

On Corstone-1000 platform MM communication between u-boot
and the secure world (Optee) is done using the FF-A bus.

Changes made are generated using savedefconfig.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
9 months agoarm_ffa: efi: introduce FF-A MM communication
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:44 +0000 (14:33 +0100)]
arm_ffa: efi: introduce FF-A MM communication

Add MM communication support using FF-A transport

This feature allows accessing MM partitions services through
EFI MM communication protocol. MM partitions such as StandAlonneMM
or smm-gateway secure partitions which reside in secure world.

An MM shared buffer and a door bell event are used to exchange
the data.

The data is used by EFI services such as GetVariable()/SetVariable()
and copied from the communication buffer to the MM shared buffer.

The secure partition is notified about availability of data in the
MM shared buffer by an FF-A message (door bell).

On such event, MM SP can read the data and updates the MM shared
buffer with the response data.

The response data is copied back to the communication buffer and
consumed by the EFI subsystem.

MM communication protocol supports FF-A 64-bit direct messaging.

We tested the FF-A MM communication on the Corstone-1000 platform.

We ran the UEFI SCT test suite containing EFI setVariable, getVariable and
getNextVariable tests which involve FF-A MM communication and all tests
are passing with the current changes.

We made the SCT test reports (part of the ACS results) public following the
latest Corstone-1000 platform software release. Please find the test
reports at [1].

[1]: https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-test-report/-/tree/master/embedded-a/corstone1000/CORSTONE1000-2023.06/acs_results_fpga.zip

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Tested-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agoarm_ffa: introduce armffa command
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:43 +0000 (14:33 +0100)]
arm_ffa: introduce armffa command

Provide armffa command showcasing the use of the U-Boot FF-A support

armffa is a command showcasing how to invoke FF-A operations.
This provides a guidance to the client developers on how to
call the FF-A bus interfaces. The command also allows to gather secure
partitions information and ping these  partitions. The command is also
helpful in testing the communication with secure partitions.

For more details please refer to the command documentation [1].

A Sandbox test is provided for the armffa command.

[1]: doc/usage/cmd/armffa.rst

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agoarm_ffa: introduce sandbox test cases for UCLASS_FFA
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:42 +0000 (14:33 +0100)]
arm_ffa: introduce sandbox test cases for UCLASS_FFA

Add functional test cases for the FF-A support

These tests rely on the FF-A sandbox emulator and FF-A
sandbox driver which help in inspecting the FF-A communication.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agoarm_ffa: introduce sandbox FF-A support
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:41 +0000 (14:33 +0100)]
arm_ffa: introduce sandbox FF-A support

Emulate Secure World's FF-A ABIs and allow testing U-Boot FF-A support

Features of the sandbox FF-A support:

- Introduce an FF-A emulator
- Introduce an FF-A device driver for FF-A comms with emulated Secure World
- Provides test methods allowing to read the status of the inspected ABIs

The sandbox FF-A emulator supports only 64-bit direct messaging.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agoarm_ffa: introduce Arm FF-A support
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:40 +0000 (14:33 +0100)]
arm_ffa: introduce Arm FF-A support

Add Arm FF-A support implementing Arm Firmware Framework for Armv8-A v1.0

The Firmware Framework for Arm A-profile processors (FF-A v1.0) [1]
describes interfaces (ABIs) that standardize communication
between the Secure World and Normal World leveraging TrustZone
technology.

This driver uses 64-bit registers as per SMCCCv1.2 spec and comes
on top of the SMCCC layer. The driver provides the FF-A ABIs needed for
querying the FF-A framework from the secure world.

The driver uses SMC32 calling convention which means using the first
32-bit data of the Xn registers.

All supported ABIs come with their 32-bit version except FFA_RXTX_MAP
which has 64-bit version supported.

Both 32-bit and 64-bit direct messaging are supported which allows both
32-bit and 64-bit clients to use the FF-A bus.

FF-A is a discoverable bus and similar to architecture features.
FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed
by the PSCI driver.

Clients are able to probe then use the FF-A bus by calling the DM class
searching APIs (e.g: uclass_first_device).

The Secure World is considered as one entity to communicate with
using the FF-A bus. FF-A communication is handled by one device and
one instance (the bus). This FF-A driver takes care of all the
interactions between Normal world and Secure World.

The driver exports its operations to be used by upper layers.

Exported operations:

- ffa_partition_info_get
- ffa_sync_send_receive
- ffa_rxtx_unmap

Generic FF-A methods are implemented in the Uclass (arm-ffa-uclass.c).
Arm specific methods are implemented in the Arm driver (arm-ffa.c).

For more details please refer to the driver documentation [2].

[1]: https://developer.arm.com/documentation/den0077/latest/
[2]: doc/arch/arm64.ffa.rst

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agolib: uuid: introduce testcase for uuid_str_to_le_bin
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:39 +0000 (14:33 +0100)]
lib: uuid: introduce testcase for uuid_str_to_le_bin

provide a test case

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
9 months agolib: uuid: introduce uuid_str_to_le_bin function
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:38 +0000 (14:33 +0100)]
lib: uuid: introduce uuid_str_to_le_bin function

convert UUID string to little endian binary data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
9 months agoarm64: smccc: add support for SMCCCv1.2 x0-x17 registers
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:37 +0000 (14:33 +0100)]
arm64: smccc: add support for SMCCCv1.2 x0-x17 registers

add support for x0-x17 registers used by the SMC calls

In SMCCC v1.2 [1] arguments are passed in registers x1-x17.
Results are returned in x0-x17.

This work is inspired from the following kernel commit:

arm64: smccc: Add support for SMCCCv1.2 extended input/output registers

[1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6?token=

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
9 months agoPrepare v2023.10-rc2
Tom Rini [Mon, 7 Aug 2023 19:26:50 +0000 (15:26 -0400)]
Prepare v2023.10-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 7 Aug 2023 19:17:12 +0000 (15:17 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoMerge branch '2023-08-07-assorted-fixes'
Tom Rini [Mon, 7 Aug 2023 19:11:17 +0000 (15:11 -0400)]
Merge branch '2023-08-07-assorted-fixes'

- Update Azure jobs again, a few MAINTAINERS updates, a few Kconfig
  fixes, an erofs fix and a fix for the recent ten64 updates.

9 months agofs/erofs: Remove an unnecessary assertion
Yifan Zhao [Wed, 26 Jul 2023 04:56:04 +0000 (12:56 +0800)]
fs/erofs: Remove an unnecessary assertion

In [1] Sam points out an assertion does not hold true for 32-bit
platforms, which only impacts Large File Support (LFS) API usage
in erofs-utils according to Xiang [2]. We don't think these APIs
are used in u-boot and this restriction could be safely removed.

[1] https://lists.denx.de/pipermail/u-boot/2023-July/524679.html
[2] https://lists.denx.de/pipermail/u-boot/2023-July/524727.html

Fixes: 3a21e92fc255 ("fs/erofs: Introduce new features including ztailpacking, fragments and dedupe")
Signed-off-by: Yifan Zhao <zhaoyifan@sjtu.edu.cn>
Tested-by: Sam Edwards <CFSworks@gmail.com>
9 months agocommon: Drop duplicate space in SPL_BMP description
Marek Vasut [Sat, 29 Jul 2023 13:34:51 +0000 (15:34 +0200)]
common: Drop duplicate space in SPL_BMP description

Drop duplicate space in Kconfig symbol description.

Signed-off-by: Marek Vasut <marex@denx.de>
9 months agocommon: fix detection of SYS_MALLOC_F_LEN=0x0
Heinrich Schuchardt [Tue, 1 Aug 2023 13:33:41 +0000 (15:33 +0200)]
common: fix detection of SYS_MALLOC_F_LEN=0x0

CONFIG_$(SPL_TPL_)SYS_MALLOC_F_LEN is defined as hex. If set to zero
manually, .config contains '0x0' and not '0' as value.

The default value for CONFIG_SPL_SYS_MALLOC_F_LEN should not be set to 0
but to 0x0 if CONFIG_SPL_FRAMEWORK=n to match a manually set value.

Fixes: c0126bd862a0 ("spl: Support bootstage, log, hash and early malloc in TPL")
Fixes: b61694705217 ("SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agospl: move SPL_CRC32 option to lib/Kconfig
Oleksandr Suvorov [Thu, 3 Aug 2023 16:05:40 +0000 (19:05 +0300)]
spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agospl: remove duplicate SPL_MD5 option
Oleksandr Suvorov [Thu, 3 Aug 2023 16:05:39 +0000 (19:05 +0300)]
spl: remove duplicate SPL_MD5 option

There is another SPL_MD5 option defined in lib/Kconfig.
Renaming SPL_MD5_SUPPORT introduced duplicate option with
different description. As for now FIT and hash algorithm options
are not related to each others, removing a duplicate option seems OK.

Fixes: 4b00fd1a84c ("Kconfig: Rename SPL_MD5_SUPPORT to SPL_MD5")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
9 months agobloblist: Enforce CRC32
Tom Rini [Mon, 7 Aug 2023 16:32:19 +0000 (12:32 -0400)]
bloblist: Enforce CRC32

In the common bloblist code we call crc32 to get a checksum for the
data.  Ensure we will have the CRC32 code via select.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoMAINTAINERS: Update rockchip platform maintain files
Kever Yang [Mon, 7 Aug 2023 07:52:47 +0000 (15:52 +0800)]
MAINTAINERS: Update rockchip platform maintain files

Add px30, rv1126 soc, and rockchip soc based boards.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
9 months agoMAINTAINERS: add DT/bindings files to at91 entry
Eugen Hristev [Mon, 7 Aug 2023 07:22:03 +0000 (10:22 +0300)]
MAINTAINERS: add DT/bindings files to at91 entry

With this change the DT and binding files are under the at91 tree
maintainer, and get_maintainer.pl correctly reports the entry.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
9 months agoboard: ten64: add missing error checks for retimer power on
Mathew McBride [Mon, 7 Aug 2023 01:41:08 +0000 (01:41 +0000)]
board: ten64: add missing error checks for retimer power on

The retimer reset/power on logic was changed in a recent commit,
however, it neglected to check if the commands sent to the
board microcontroller (to control power to the retimer chip)
actually completed.

Add return checks for these operations so any failures will
be reported to the user.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Fixes: 7a041fea2 ("board: traverse: ten64: ensure retimer reset
is done on new board revisions")

9 months agoARM: renesas: Update MAINTAINERS file
Marek Vasut [Sun, 6 Aug 2023 18:57:34 +0000 (20:57 +0200)]
ARM: renesas: Update MAINTAINERS file

Update MAINTAINERS file. Add missing MAINTAINERS file for Spider,
Whitehawk and V3HSK boards. Update mail addresses. Add file globs
to match on DT and driver files related to these boards.

The GRPEACH and R2DPLUS are special in that they are not R-Car
and have their own set of specialized drivers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
9 months agoget_maintainer.pl: Add an ignore list for git history
Tom Rini [Mon, 7 Aug 2023 13:20:53 +0000 (09:20 -0400)]
get_maintainer.pl: Add an ignore list for git history

As Pali Rohár has asked to not be copied on changes to files he is not
a specific maintainer of, add his address to .get_maintainer.ignore.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
9 months agoAzure: Squash a number of jobs and re-order slightly
Tom Rini [Fri, 4 Aug 2023 21:07:44 +0000 (17:07 -0400)]
Azure: Squash a number of jobs and re-order slightly

To reduce overall job time, move a number of smaller jobs together.
These should still be safely under 1 hour total time, but reducing the
overall number of jobs should help with the queue slightly.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoAzure: Rework Rockchip jobs again
Tom Rini [Fri, 4 Aug 2023 20:46:15 +0000 (16:46 -0400)]
Azure: Rework Rockchip jobs again

The job for rockchip vendor platforms has again gotten close to or
exceeded one hour.  Rework things such that we move the 32bit platforms
back to the general 32bit ARM job (as there's time there) and make these
build only the 64bit platforms.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoMerge tag 'dm-pull-5aug23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 6 Aug 2023 02:11:04 +0000 (22:11 -0400)]
Merge tag 'dm-pull-5aug23' of https://source.denx.de/u-boot/custodians/u-boot-dm

binman support for Xilinx signing
buildman minor fixes

9 months agobuildman: Drop warning about orphaned defconfigs
Simon Glass [Thu, 3 Aug 2023 18:51:37 +0000 (12:51 -0600)]
buildman: Drop warning about orphaned defconfigs

Some boards use a MAINTAINERS entry to specify common files without
referencing any defconfigs. This is allowed and should not result in a
warning.

Drop the warning in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agobuildman: Exit after reading toolchain
Simon Glass [Thu, 3 Aug 2023 18:51:36 +0000 (12:51 -0600)]
buildman: Exit after reading toolchain

Recent refactoring changed buildman to continue operation after fetching
a toolchain. Fix this.

Fixes: b8680646521 ("bulidman: Move toolchain handling to a function")

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agoevent: Fix a wrong type_name from dm_post_init to dm_post_init_f
Jaehoon Chung [Tue, 1 Aug 2023 10:17:00 +0000 (19:17 +0900)]
event: Fix a wrong type_name from dm_post_init to dm_post_init_f

DM_POST_INIT was changed to DM_POST_INIT_F.
To debug correct message, change type_name from dm_post_init to
dm_post_init_f.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
s/an/a/ :
Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agobinman: ftest: Add test for xilinx-bootgen etype
Lukas Funke [Thu, 3 Aug 2023 15:22:14 +0000 (17:22 +0200)]
binman: ftest: Add test for xilinx-bootgen etype

Add test for the 'xilinx-bootgen' etype

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Allow missing bootgen tool; comment testXilinxBootgenMissing() comment:
Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agobinman: etype: Add xilinx-bootgen etype
Lukas Funke [Thu, 3 Aug 2023 15:22:15 +0000 (17:22 +0200)]
binman: etype: Add xilinx-bootgen etype

This adds a new etype 'xilinx-bootgen'. By using this etype it is
possible to created an signed SPL (FSBL in Xilinx terms) for
ZynqMP boards.

The etype uses Xilinx Bootgen tools in order to transform the SPL into
a bootable image and sign the image with a given primary and secondary
public key. For more information to signing the FSBL please refer to the
Xilinx Bootgen documentation.

Here is an example of the etype in use:

    spl {
        filename = "boot.signed.bin";

        xilinx-bootgen {
            pmufw-filename = "pmu-firmware.elf";
            psk-key-name-hint = "psk0";
            ssk-key-name-hint = "ssk0";
            auth-params = "ppk_select=0", "spk_id=0x00000000";

            u-boot-spl-nodtb {
            };
            u-boot-spl-dtb {
            };
        };
    };

For this to work the hash of the primary public key has to be fused
into the ZynqMP device and authentication (RSA_EN) has to be set.

For testing purposes: if ppk hash check should be skipped one can add
the property 'fsbl_config = "bh_auth_enable";' to the etype. However,
this should only be used for testing(!).

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agobinman: btool: Add Xilinx Bootgen btool
Lukas Funke [Thu, 3 Aug 2023 15:22:13 +0000 (17:22 +0200)]
binman: btool: Add Xilinx Bootgen btool

Add the Xilinx Bootgen as bintool. Xilinx Bootgen is used to create
bootable SPL (FSBL in Xilinx terms) images for Zynq/ZynqMP devices. The
btool creates a signed version of the SPL. Additionally to signing the
key source for the decryption engine can be passend to the boot image.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
9 months agobinman: Renumber 291 and 292 test files
Simon Glass [Thu, 3 Aug 2023 23:23:58 +0000 (17:23 -0600)]
binman: Renumber 291 and 292 test files

These have ended up with the same numbers as earlier files. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sat, 5 Aug 2023 16:24:33 +0000 (12:24 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- Fix some issues with usb gadget ethernet.  A small set of updates for
  docs, etc, is still pending

9 months agocmd: Enable BIND by default if we have USB_ETHER
Tom Rini [Fri, 4 Aug 2023 16:06:21 +0000 (12:06 -0400)]
cmd: Enable BIND by default if we have USB_ETHER

The nature of the network stack means that if we are going to use the
gadget mode USB network driver there's no easy path to implicitly
bind/unbind the driver. Enable the "bind" command by default here so
that we can bind/unbind this as needed.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
9 months agousb: gadget: ether: Handle gadget driver registration in probe and remove
Marek Vasut [Fri, 4 Aug 2023 15:41:11 +0000 (17:41 +0200)]
usb: gadget: ether: Handle gadget driver registration in probe and remove

Move the ethernet gadget driver registration and removal from ethernet
bind and unbind callbacks into driver DM probe and remove callbacks.
This way, when the driver is bound, which is triggered deliberately
using 'bind' command, the USB ethernet gadget driver is instantiated
and bound to the matching UDC. In reverse, when the driver is unbound,
which is again triggered deliberately using 'unbind' command, the USB
ethernet gadget driver instance is removed.

Effectively, this now behaves like running either 'ums' or 'dfu' or
any other commands utilizing USB gadget functionality.

This also drops use of usb_gadget_release() and moves the use of
usb_gadget_initialize() into usb_ether_init() used only by legacy
platforms that do not use 'bind' command properly yet. Those have
no place in drivers.

Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agousb: gadget: ether: Move probe function above driver structure
Marek Vasut [Fri, 4 Aug 2023 15:41:10 +0000 (17:41 +0200)]
usb: gadget: ether: Move probe function above driver structure

Move the driver probe function above the driver structure, so it
can be placed alongside other related functions, like upcoming
remove function. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Tom Rini <trini@konsulko.com>
Tested-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agousb: gadget: ether: Inline functions used once
Marek Vasut [Fri, 4 Aug 2023 15:41:09 +0000 (17:41 +0200)]
usb: gadget: ether: Inline functions used once

These functions here are only ever called once since drop of non-DM
networking code. Inline them. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Tom Rini <trini@konsulko.com>
Tested-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agoMerge branch '2023-08-04-toradex-platform-updates'
Tom Rini [Fri, 4 Aug 2023 20:04:11 +0000 (16:04 -0400)]
Merge branch '2023-08-04-toradex-platform-updates'

Two Toradex platform series.  First, to quote Andrejs:

This series adds Yavia Carrier board name string to the known
Toradex carrier board list, and reworks carrier board and display
adapter name handling.

And then to quote Marcel:
This series adds initial support for the Toradex Verdin AM62 SoM.
The first commit adds resp. PID4s to the ConfigBlock, the second one
fixes an early clocking issue confirmed to be a weird bug in TI's
scripting, the third one fixes some binman labeling issue. And last but
not least support for the Toradex Verdin AM62 is added.

9 months agoboard: toradex: add verdin am62 support
Marcel Ziswiler [Fri, 4 Aug 2023 10:08:08 +0000 (12:08 +0200)]
board: toradex: add verdin am62 support

This adds initial support for the Toradex Verdin AM62 Quad 1GB WB IT
V1.0A module and subsequent V1.1 launch configuration SKUs. They are
strapped to boot from their on-module eMMC. U-Boot supports booting
from the on-module eMMC only, DFU support is disabled for now due to
missing AM62x USB support.

The device trees were taken straight from Linux v6.5-rc1.

Boot sequence is:
SYSFW ---> R5 SPL (both in tiboot3.bin) ---> ATF (TF-A) ---> OP-TEE
  ---> A53 SPL (part of tispl.bin) ---> U-boot proper (u-boot.img)

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
9 months agoarm: dts: k3-binman: fix rcfg_yaml and pcfg_yaml labels
Marcel Ziswiler [Fri, 4 Aug 2023 10:08:07 +0000 (12:08 +0200)]
arm: dts: k3-binman: fix rcfg_yaml and pcfg_yaml labels

Fix rcfg_yaml to really point to rm-cfg.yaml and pcfg_yaml to really
point to pm-cfg.yaml which likely is the intention.

While at it also add labels for the remaining items like custmpk_pem,
dkey_pem, bcfg_yaml_sysfw, scfg_yaml_sysfw, pcfg_yaml_sysfw and
rcfg_yaml_sysfw.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
9 months agoarm: mach-k3: am62: fix 2nd mux option of clkout0
Marcel Ziswiler [Fri, 4 Aug 2023 10:08:06 +0000 (12:08 +0200)]
arm: mach-k3: am62: fix 2nd mux option of clkout0

Fix second mux option of clkout0 which should really be
DEV_BOARD0_CLKOUT0_IN_PARENT_HSDIV4_16FFT_MAIN_2_HSDIVOUT1_CLK10
rather than twice the same according to [1].

[1] https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am62x/clocks.html#clocks-for-board0-device

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
9 months agotoradex: tdx-cfg-block: add verdin am62 skus
Marcel Ziswiler [Fri, 4 Aug 2023 10:08:05 +0000 (12:08 +0200)]
toradex: tdx-cfg-block: add verdin am62 skus

Add initial Verdin AM62 Quad 1GB WB IT prototype and launch
configuration SKUs to ConfigBlock handling.

0069: Verdin AM62 Quad 1GB WB IT
0071: Verdin AM62 Solo 512MB
0072: Verdin AM62 Solo 512MB WB IT
0073: Verdin AM62 Dual 1GB ET
0074: Verdin AM62 Dual 1GB IT
0075: Verdin AM62 Dual 1GB WB IT
0076: Verdin AM62 Quad 2GB WB IT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
9 months agotoradex: tdx-cfg-block: rework display adapter name handling
Max Krummenacher [Tue, 18 Jul 2023 09:07:34 +0000 (11:07 +0200)]
toradex: tdx-cfg-block: rework display adapter name handling

Rework the rather big array of zero length strings with 4 entries of
actual display adapter names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
9 months agotoradex: tdx-cfg-block: rework carrier board name handling
Max Krummenacher [Tue, 18 Jul 2023 09:07:33 +0000 (11:07 +0200)]
toradex: tdx-cfg-block: rework carrier board name handling

Rework the rather big array of zero length strings with 4 entries of
actual carrier board names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
Rework the user of the information to use the accessor.

Note that check_pid8_sanity() is used for early samples of Dahlia and
the development board. Yavia isn't affected.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
9 months agotoradex: tdx-cfg-block: add yavia carrier cfg block info
Max Krummenacher [Tue, 18 Jul 2023 09:07:32 +0000 (11:07 +0200)]
toradex: tdx-cfg-block: add yavia carrier cfg block info

Add the Yavia Carrier board name string to the known carrier
board list.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
9 months agoMerge branch '2023-08-03-assorted-fixes'
Tom Rini [Thu, 3 Aug 2023 21:45:38 +0000 (17:45 -0400)]
Merge branch '2023-08-03-assorted-fixes'

- More MAINTAINERS file updates, bootstd fixes, a fat fix and debug
  message fix

9 months agobootstd: Init the size before reading extlinux file
Simon Glass [Thu, 27 Jul 2023 03:01:25 +0000 (21:01 -0600)]
bootstd: Init the size before reading extlinux file

The implementation in extlinux_pxe_getfile() does not pass a valid size
to bootmeth_read_file(), so this can fail if the uninited value happens to
be too small.

Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agobootstd: Init the size before reading the devicetree
Simon Glass [Thu, 27 Jul 2023 03:01:24 +0000 (21:01 -0600)]
bootstd: Init the size before reading the devicetree

The implementation in distro_efi_try_bootflow_files() does not pass a
valid size to bootmeth_common_read_file(), so this can fail if the
uninted value happens to be too small.

Fix this.

This was reported by someone but I cannot now find the email.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agobootstd: Avoid allocating memory for the EFI file
Simon Glass [Thu, 27 Jul 2023 03:01:23 +0000 (21:01 -0600)]
bootstd: Avoid allocating memory for the EFI file

The current bootflow-iteration algorithm reads the bootflow file into
an allocated memory buffer so it can be examined. This works well in
most cases.

However, while the common case is that the first bootflow is immediately
booted, it is also possible just to scan for available bootflows, perhaps
selecting one to boot later.

Even with the common case, EFI bootflows can be quite large. It doesn't
make sense to read it into an allocated buffer when we have kernel_addr_t
providing a suitable address for it. Even if we do have plenty of malloc()
space available, it is a violation of U-Boot's lazy-init principle to
read the bootflow before it is needed.

So overall it seems better to make a change.

Adjust the logic to read just the size of the EFI file at first. Later,
when the bootflow is booted, read the rest of the file into the designated
kernel buffer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Da Xue <da@libre.computer>
Reported-by: Vincent Stehlé <vincent.stehle@arm.com>
9 months agobootstd: Use a function to detect network in EFI bootmeth
Simon Glass [Thu, 27 Jul 2023 03:01:22 +0000 (21:01 -0600)]
bootstd: Use a function to detect network in EFI bootmeth

This checks for a network-based bootflow in two places, one of which is
less than ideal. Move the correct test into a function and use it in both
places.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agobootflow: Export setup_fs()
Simon Glass [Thu, 27 Jul 2023 03:01:21 +0000 (21:01 -0600)]
bootflow: Export setup_fs()

This function is used in some bootmeth implementations. Export it.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 months agovirtio: provide driver name in debug message
Heinrich Schuchardt [Wed, 26 Jul 2023 15:43:40 +0000 (17:43 +0200)]
virtio: provide driver name in debug message

If a driver cannot be bound, provide the driver name in the debug
message. Now the debug message may look like this:

    (virtio-pci.l#0): virtio-rng driver not configured

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agofat: correct sign for deletion mark
Heinrich Schuchardt [Wed, 26 Jul 2023 08:33:13 +0000 (10:33 +0200)]
fat: correct sign for deletion mark

The FAT file systems uses character '\xe5' to mark a deleted directory
entry. If a file name starts with this character, it is substituted by
'\x05' in the directory entry.

While (signed char)'\xe5' is a negative number 0xe5 is a positive integer
number. We therefore have define a constant DELETED_MARK which matches the
signedness of the characters in the directory entry.

Correct a comparison where we used the constant 0xe5 with the wrong sign.
Use the constant aRING instead of 0x05 like in the rest of the code.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: 57b745e2387a ("fs: fat: call set_name() only once")
Fixes: 28cef9ca2e86 ("fs: fat: create correct short names")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agorzn1-snarc: Add missing MAINTAINERS file
Tom Rini [Tue, 25 Jul 2023 22:31:55 +0000 (18:31 -0400)]
rzn1-snarc: Add missing MAINTAINERS file

This should have been included when the platform was added, make one
now.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoboard/freescale: Drop two orphaned entries
Tom Rini [Tue, 25 Jul 2023 22:31:54 +0000 (18:31 -0400)]
board/freescale: Drop two orphaned entries

As the defconfig files here have been removed we can also remove the
entries.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 months agovexpress64: Rework MAINTAINERS file slightly
Tom Rini [Tue, 25 Jul 2023 22:31:53 +0000 (18:31 -0400)]
vexpress64: Rework MAINTAINERS file slightly

Given that we no longer have a configs/vexpress_aemv8a_defconfig file,
drop that and then include at least the aarch64-specific config.h file
here.  Also move Linus and Peter up to the main entry as well so that
they'll get tagged for the board code too and not literally only the
defconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoARM: imx: Update MAINTAINERS file on DH electronics i.MX8M Plus DHCOM
Marek Vasut [Tue, 18 Jul 2023 16:14:35 +0000 (18:14 +0200)]
ARM: imx: Update MAINTAINERS file on DH electronics i.MX8M Plus DHCOM

Make use of globs to cover all the DTs and defconfigs.
Fill in missing DH u-boot list name.

Signed-off-by: Marek Vasut <marex@denx.de>
9 months agofreescale: Remove Rajesh Bhagat MAINTAINERS
Sean Anderson [Tue, 18 Oct 2022 18:12:46 +0000 (14:12 -0400)]
freescale: Remove Rajesh Bhagat MAINTAINERS

Rajesh's email bounces. Remove his email from all boards he maintains.
Fortunately, he has co-maintainers on most boards. I have taken the
liberty of volunteering Pramod to maintain the LS1012AFRDM, since he
also maintains the LS1012AFRWY. Let me know if the board should be
orphaned instead.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
9 months agoMerge tag 'efi-2023-10-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 3 Aug 2023 16:43:24 +0000 (12:43 -0400)]
Merge tag 'efi-2023-10-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-10-rc2-2

Documentation:

* Move README.falcon to HTML
* Describe usage of QEMU virtio block device
* Add SPDX license identifiers to svg images
* Add more detail to the description of U-Boot boot phases

UEFI:

* Fix buffer overflows
* Fix memory leak in efi_add_memory_map_pg
* Properly check return values of calloc, uuid_str_to_bin,
  efi_parse_pkcs7_header

9 months agoMerge branch '2023-08-03-mediatek-and-ten64-updates'
Tom Rini [Thu, 3 Aug 2023 14:34:04 +0000 (10:34 -0400)]
Merge branch '2023-08-03-mediatek-and-ten64-updates'

Merge in a series for MediaTek update and another for Ten64.

To quote Weijie Gao for MediaTek:
This patch series add support for MediaTek MT7988 SoC with its reference
boards and related drivers.

This patch series add basic boot support on eMMC/SD/SPI-NOR/SPI-NAND for
these boards. The clock, pinctrl drivers and the SoC initializaton code
are also included.

Product spec for MT7988:
https://www.mediatek.com/products/broadband-wifi/mediatek-filogic-880

And to quote Mathew McBride for Ten64:
This is a series of updates for the Ten64 board,
that are part of our firmware releases but not yet upstreamed
into U-Boot.

Changes of note include:

- Turning on standard boot support

  Standard boot improves the user experience over distroboot on Ten64,
  as we had various hacks in our firmware to solve some corner-case
  issues (e.g DTB handling) in distroboot, which are not needed with the
  bootflow system.

- Recognition of the new 'RevD' board variant distributed to OEM
  customers

- Fixing various boot issues related to FIT images and operating systems
  running out of the NAND (OpenWrt, recovery environment).

- A better 'opt-out' solution for fsl_setenv_bootcmd for Layerscape
  platforms booting from TF-A.

  This was discussed when the Ten64 was upstreamed into U-Boot. I think
  declaring fsl_setenv_bootcmd as __weak and allowing individual boards
  to override is the best way to do this without significant rework.
  (We actually depend on a similar feature for the DPAA2/MC firmware
  loading)

Compared to our firmware branch, there is still a few features missing (e.g USB
Hub, fan controller and fixes for the VSC8514). Some of these depend on other
things (like sorting out device tree schemas) so may not appear in mainline
U-Boot for a while yet.

9 months agoboard: ten64: strip extra u-boot compatibles from FDT
Mathew McBride [Fri, 21 Jul 2023 04:39:31 +0000 (04:39 +0000)]
board: ten64: strip extra u-boot compatibles from FDT

The u-boot version of the LS1088A device tree has
an extra compatible (simple-mfd) added to &fsl_mc
to facilitate usage with U-Boot's device model.

Unfortunately FreeBSD will only match the single
"fsl,qoriq-mc" exactly when the node is a "bus"
object, so we need to strip out the extra compatible
before presenting it to the operating system.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: ten64: opt out of fsl_setenv_bootcmd
Mathew McBride [Fri, 21 Jul 2023 04:39:30 +0000 (04:39 +0000)]
board: ten64: opt out of fsl_setenv_bootcmd

Our bootcmd is the same regardless of where the SoC
loaded it's code from, so we don't want
fsl_setenv_bootcmd to do anything.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoarch: arm: fsl-layerscape: allow "opt-out" of fsl_setenv_bootcmd
Mathew McBride [Fri, 21 Jul 2023 04:39:29 +0000 (04:39 +0000)]
arch: arm: fsl-layerscape: allow "opt-out" of fsl_setenv_bootcmd

Allow individual Layerscape boards to opt-out of fsl_setenv_bootcmd
by declaring the original function as weak.

fsl_setenv_bootcmd is used to change the bootcmd based on the
TF-A boot source (e.g QSPI vs SD/MMC) for reasons including
secure boot / integrity measurements and DPAA2 configuration loading.
See previous discussion at [1].

On the Ten64 board, our bootcmd is the same across
all TF-A boot sources so we don't want this behaviour.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] https://patchwork.ozlabs.org/project/uboot/patch/20211110044639.7070-3-matt@traverse.com.au/#2790037

Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: adopt standard boot defaults
Mathew McBride [Fri, 21 Jul 2023 04:39:28 +0000 (04:39 +0000)]
board: traverse: ten64: adopt standard boot defaults

With the previous updates to the device tree, Ten64
can use Standard Boot 'out of the box'.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: ten64: disable watchdog autostart
Mathew McBride [Fri, 21 Jul 2023 04:39:27 +0000 (04:39 +0000)]
board: ten64: disable watchdog autostart

The watchdog driver was previously enabled but not used
until U-Boot's fsl-ls1088a.dtsi was updated to describe them.

Some Linux distributions (e.g Debian 11) do not engage the
SP805 watchdogs, causing unexpected resets after boot.

To conserve the user experience, turn off the autostart,
and we will provide a mechanism to turn them on at boot
via env vars.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: set serial# to be 'label' MAC
Mathew McBride [Fri, 21 Jul 2023 04:39:26 +0000 (04:39 +0000)]
board: traverse: ten64: set serial# to be 'label' MAC

The GE0 (first Gigabit Ethernet interface) is used as the
'serial number' for the board and appliance.

To ensure the 'true' board S/N is available regardless of how
the DPAA2 subsystem is configured, use serial# so it is passed in
the device tree.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: fix allocation order of MAC addresses
Mathew McBride [Fri, 21 Jul 2023 04:39:25 +0000 (04:39 +0000)]
board: traverse: ten64: fix allocation order of MAC addresses

On Ten64 boards, the "serial number" is the MAC address of the
first Gigabit Ethernet interface (labelled GE0 on the appliance),
and counted up from there.

The previous logic did not take into account U-Boot's ordering
of the network interfaces. By setting aliases/ethernetX in the device
tree we can ensure the U-Boot 'ethX' is the same as the labelled
port order on the unit, as well as the one adopted by Linux.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
9 months agoboard: traverse: ten64: init nvme devices in late boot to ensure bootflow availability
Mathew McBride [Fri, 21 Jul 2023 04:39:24 +0000 (04:39 +0000)]
board: traverse: ten64: init nvme devices in late boot to ensure bootflow availability

Ensure nvme devices are scanned before reaching the shell,
otherwise extra user intervention ("nvme scan") is required
before they are visible to bootdev/bootflow.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoconfigs: ten64: enable NVME_PCI
Mathew McBride [Fri, 21 Jul 2023 04:39:23 +0000 (04:39 +0000)]
configs: ten64: enable NVME_PCI

This restores NVMe functionality after PCI(e) NVMe support
was split out from the NVMe driver.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: ten64: add a bootmenu entries for NAND-based entries
Mathew McBride [Fri, 21 Jul 2023 04:39:22 +0000 (04:39 +0000)]
board: ten64: add a bootmenu entries for NAND-based entries

The recovery-firmware and OpenWrt-NAND do not yet have bootflow
/bootstd entrypoints, so add bootmenu entries to make them
accessible.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: add NAND based OpenWrt bootcmd
Mathew McBride [Fri, 21 Jul 2023 04:39:21 +0000 (04:39 +0000)]
board: traverse: ten64: add NAND based OpenWrt bootcmd

The default Ten64 MTD configuration reserves two ubifs partitions
for OpenWrt residing on NAND flash. Add the bootcmd for this system
into the default environment.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: specify bootargs for recovery environment
Mathew McBride [Fri, 21 Jul 2023 04:39:20 +0000 (04:39 +0000)]
board: traverse: ten64: specify bootargs for recovery environment

The recovery environment[1] on the Ten64 is a OpenWrt-
based ramdisk stored on the NAND intended to help with
system setup tasks.

Before the bootargs were not being set for the recovery
command, relying instead on the existing bootargs variable.

Ensure the bootargs are set correctly prior to booting recovery.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] https://ten64doc.traverse.com.au/software/recovery/

Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: update DPAA2 (network) binary path on sdcards
Mathew McBride [Fri, 21 Jul 2023 04:39:19 +0000 (04:39 +0000)]
board: traverse: ten64: update DPAA2 (network) binary path on sdcards

Change the firmware on microSD path to "firmware/traverse/ten64"
as per EBBR section 4.2[1].

The Traverse firmware tools now locate the DPAA2 firmware
and configuration files under that path on the rescue
SD card image.
If a user then installs a standard Linux
distribution over the top of that sdcard, (in theory)
it will be left alone by distribution boot tooling.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] https://arm-software.github.io/ebbr/index.html#firmware-partition-filesystem

Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: fix DPAA2 (network) DPL corruption issue
Mathew McBride [Fri, 21 Jul 2023 04:39:18 +0000 (04:39 +0000)]
board: traverse: ten64: fix DPAA2 (network) DPL corruption issue

The DPAA2 DPL (data plane layout) file was previously
being loaded into 0x80300000, and set to be applied
just before hand off to the kernel.

When a FIT image with a load_address of 0x80000000 was
booted with bootm, the DPL in memory was overwritten.

Move the DPL load to 0x8E000000 (196MiB away from 0x80000000,
and below the other typical load addr of 0x90000000).

Ideally in the future, the DPL lazyapply command
("fsl_mc lazyapply DPL $dpl_addr") should be set to
load the DPL contents into a memory area owned by U-Boot.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: traverse: ten64: ensure retimer reset is done on new board revisions
Mathew McBride [Fri, 21 Jul 2023 04:39:17 +0000 (04:39 +0000)]
board: traverse: ten64: ensure retimer reset is done on new board revisions

Board revision C (production) and later require the SFP+
retimer to be turned on (or reset) on boot, by way of issuing
a command to the board's microcontroller (via I2C).

The comparison statement here was incorrect, as the board
ID decrements every revision (from 0xFF downwards),
so this was matching board RevA,B,C instead of Rev >= C.

Another oops that transpired when working on this issue,
is that if the board controller is not called (such as
CONFIG_TEN64_CONTROLLER=n or earlier board rev), then
the retimer udevice was not obtained. So the board
version check has to be moved inside board_cycle_retimer
(which probes/fetches the retimer device) as well.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
9 months agoboard: traverse: ten64: recognize board revision D
Mathew McBride [Fri, 21 Jul 2023 04:39:16 +0000 (04:39 +0000)]
board: traverse: ten64: recognize board revision D

Ten64 board revision D is a variant that removes the USB hub
and PCIe expander/switch, but is otherwise compatible with the
main production "C" version.

At the same time, revise the printf specifiers (PCB version
"1064-0201%s") to reduce the number of string characters related
to the boot printout.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
9 months agoboard: mediatek: add MT7988 reference boards
Weijie Gao [Wed, 19 Jul 2023 09:17:54 +0000 (17:17 +0800)]
board: mediatek: add MT7988 reference boards

This patch adds general board files based on MT7988 SoCs.

MT7988 uses one mmc controller for booting from both SD and eMMC,
and the pins of mmc controller booting from SD are also shared with
one of spi controllers.
So two configs are need for these boot types:

1. mt7988_rfb_defconfig - SPI-NOR, SPI-NAND and eMMC
2. mt7988_sd_rfb_defconfig - SPI-NAND and SD

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agoarm: mediatek: add support for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:17:49 +0000 (17:17 +0800)]
arm: mediatek: add support for MediaTek MT7988 SoC

This patch adds basic support for MediaTek MT7988 SoC.
This includes files that will initialize the SoC after boot and
its device tree.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agotools: mtk_image: use uint32_t for ghf header magic and version
Weijie Gao [Wed, 19 Jul 2023 09:17:45 +0000 (17:17 +0800)]
tools: mtk_image: use uint32_t for ghf header magic and version

This patch converts magic and version fields of ghf common header
to one field with the type of uint32_t to make this header flexible
for futher updates.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add support for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:17:41 +0000 (17:17 +0800)]
net: mediatek: add support for MediaTek MT7988 SoC

This patch adds support for MediaTek MT7988.

MT7988 features MediaTek NETSYS v3, including three GMACs, and two
of them supports 10Gbps USXGMII.

MT7988 embeds a MT7531 switch (not MCM) which supports accessing
internal registers through MMIO instead of MDIO.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add support for NETSYS v3
Weijie Gao [Wed, 19 Jul 2023 09:17:37 +0000 (17:17 +0800)]
net: mediatek: add support for NETSYS v3

This patch adds support for NETSYS v3 hardware.
Comparing to NETSYS v2, NETSYS v3 has three GMACs.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add USXGMII support
Weijie Gao [Wed, 19 Jul 2023 09:17:31 +0000 (17:17 +0800)]
net: mediatek: add USXGMII support

This patch adds support for USXGMII of SoC.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agoarm: dts: mediatek: add infracfg registers to support GMAC/USB3 Co-PHY
Weijie Gao [Wed, 19 Jul 2023 09:17:27 +0000 (17:17 +0800)]
arm: dts: mediatek: add infracfg registers to support GMAC/USB3 Co-PHY

This patch adds infracfg to eth node to support enabling GMAC2.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add support for GMAC/USB3 PHY mux mode for MT7981
Weijie Gao [Wed, 19 Jul 2023 09:17:22 +0000 (17:17 +0800)]
net: mediatek: add support for GMAC/USB3 PHY mux mode for MT7981

MT7981 has its GMAC2 PHY shared with USB3. To enable GMAC2, mux
register must be set to connect the SGMII phy to GMAC2.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agoarm: dts: medaitek: convert gmac link mode to 2500base-x
Weijie Gao [Wed, 19 Jul 2023 09:17:18 +0000 (17:17 +0800)]
arm: dts: medaitek: convert gmac link mode to 2500base-x

Now that individual 2.5Gbps SGMII support has been added to
mtk-eth, all boards that use 2.5Gbps link with mt7531 must be
converted to use "2500base-x" instead of "sgmii".

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add support for SGMII 1Gbps auto-negotiation mode
Weijie Gao [Wed, 19 Jul 2023 09:17:13 +0000 (17:17 +0800)]
net: mediatek: add support for SGMII 1Gbps auto-negotiation mode

Existing SGMII support of mtk-eth is actually a MediaTek-specific
2.5Gbps high-speed SGMII (HSGMII) which does not support
auto-negotiation mode.

This patch adds SGMII 1Gbps auto-negotiation mode and rename the
existing HSGMII to 2500basex.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add missing static qualifier
Weijie Gao [Wed, 19 Jul 2023 09:17:07 +0000 (17:17 +0800)]
net: mediatek: add missing static qualifier

mt7531_mmd_ind_read and mt753x_switch_init are defined without static.
Since they're not used outside this file, we should add them back.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
fixup to add static qualifier

9 months agonet: mediatek: fix direct MDIO clause 45 access via SoC
Weijie Gao [Wed, 19 Jul 2023 09:17:03 +0000 (17:17 +0800)]
net: mediatek: fix direct MDIO clause 45 access via SoC

The original direct MDIO clause 45 access via SoC is missing the
data output. This patch adds it back to ensure MDIO clause 45 can
work properly for external PHYs.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: optimize the switch reset delay wait time
Weijie Gao [Wed, 19 Jul 2023 09:16:59 +0000 (17:16 +0800)]
net: mediatek: optimize the switch reset delay wait time

Not all switches requires 1 second delay after deasserting reset.
MT7531 requires only maximum 200ms.

This patch defines dedicated reset wait time for each switch chip, and will
significantly improve the boot time for boards using MT7531.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: connect switch to PSE only when starting eth is requested
Weijie Gao [Wed, 19 Jul 2023 09:16:54 +0000 (17:16 +0800)]
net: mediatek: connect switch to PSE only when starting eth is requested

So far the switch is initialized in probe stage and is connected to PSE
unconditionally. This will cause all packets being flooded to PSE and may
cause PSE hang before entering linux.

This patch changes the connection between switch and PSE:
- Still initialize switch in probe stage, but disconnect it with PSE
- Connect switch with PSE on eth start
- Disconnect on eth stop

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agopinctrl: mediatek: add pinctrl driver for MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:50 +0000 (17:16 +0800)]
pinctrl: mediatek: add pinctrl driver for MT7988 SoC

This patch adds pinctrl and gpio support for MT7988 SoC

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agopinctrl: mediatek: add pinmux_set ops support
Weijie Gao [Wed, 19 Jul 2023 09:16:46 +0000 (17:16 +0800)]
pinctrl: mediatek: add pinmux_set ops support

This patch adds pinmux_set ops for mediatek pinctrl framework

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agopinctrl: mediatek: fix the return value in driving configuration functions
Weijie Gao [Wed, 19 Jul 2023 09:16:42 +0000 (17:16 +0800)]
pinctrl: mediatek: fix the return value in driving configuration functions

The original mediatek pinctrl functions for driving configuration
'mtk_pinconf_drive_set_*' do not return -ENOSUPP even if input
parameters are not supported.
This patch fixes the return value in those functions.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agopinctrl: mediatek: convert most definitions to const
Weijie Gao [Wed, 19 Jul 2023 09:16:37 +0000 (17:16 +0800)]
pinctrl: mediatek: convert most definitions to const

There exists a situation of the mediatek pinctrl driver that may return
wrong pin function value for the pinmux driver:
- All pin function arrays are defined without const
- Some pin function arrays contain all-zero value, e.g.:
  static int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, };
- These arrays will be put into .bss section during compilation
- .bss section has no "a" attribute and does not exist in the final binary
  file after objcopy.
- FDT binary blob is appended to the u-boot binary, which occupies the
  .bss section.
- During board_f stage, .bss has not been initialized, and contains the
  data of FDT, which is not full-zero data.
- pinctrl driver is initialized in board_f stage, and it will get wrong
  data if another driver is going to set default pinctrl.

Since pinmux information and soc data are only meant to be read-only, thus
should be declared as const. This will force all pinctrl data being put
into .rodata section. Since .rodata has "a" attribute, even the all-zero
data will be allocated and filled with correct value in to u-boot binary.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agoreset: mediatek: add reset definition for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:33 +0000 (17:16 +0800)]
reset: mediatek: add reset definition for MediaTek MT7988 SoC

This patch adds reset bits for MediaTek MT7988

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agoclk: mediatek: add clock driver support for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:28 +0000 (17:16 +0800)]
clk: mediatek: add clock driver support for MediaTek MT7988 SoC

This patch adds clock driver support for MediaTek MT7988 SoC

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>