]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
2 years agoARM: dts: at91: sam9x60_curiosity: add onewire support
Durai Manickam KR [Thu, 7 Jul 2022 11:10:56 +0000 (16:40 +0530)]
ARM: dts: at91: sam9x60_curiosity: add onewire support

Add support for onewire memory.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoboard: sam9x60_curiosity: add pda detect call at init time
Durai Manickam KR [Thu, 7 Jul 2022 11:10:55 +0000 (16:40 +0530)]
board: sam9x60_curiosity: add pda detect call at init time

Call the PDA detection mechanism at boot time so that we can
have the pda environment variable ready for use.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoconfigs: sama9x60_curiosity: add onewire and eeprom drivers
Durai Manickam KR [Thu, 7 Jul 2022 11:10:54 +0000 (16:40 +0530)]
configs: sama9x60_curiosity: add onewire and eeprom drivers

SAM9X60 SoC can have extra clip boards (PDAs) connected, which have
an EEPROM memory for identification. A special GPIO can be used to read
this memory over 1wire protocol. Enabling one wire and eeprom drivers
for this memory.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agommc: atmel_sdhci: re-enable sdhci after SD Card re-insertion
Sergiu Moga [Wed, 22 Jun 2022 13:30:47 +0000 (16:30 +0300)]
mmc: atmel_sdhci: re-enable sdhci after SD Card re-insertion

Whenever the SD Card would be removed and then re-inserted while in the
U-Boot command line, the `SDBPWR` bit of the `SDMMC_PCR` register would
remain unset afterwards. In order for the bit to be set again after
re-insertion, register an additional `deferred_probe` method that the
DM would then transparently call. This method will call the generic
`sdhci_probe` which will, during its execution flow, set this bit to 1.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reported-by: Mihai Sain <mihai.sain@microchip.com>
Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-watchdog into...
Tom Rini [Sun, 18 Sep 2022 12:34:31 +0000 (08:34 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-watchdog into next

- Migrate watchdog reset to cyclic infrastructure (Stefan)

2 years agowatchdog: Further cleanup
Stefan Roese [Fri, 2 Sep 2022 12:10:49 +0000 (14:10 +0200)]
watchdog: Further cleanup

Remove some now unused macros and #ifdef's.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2 years agowatchdog: Remove WATCHDOG_RESET macro
Stefan Roese [Fri, 2 Sep 2022 12:10:48 +0000 (14:10 +0200)]
watchdog: Remove WATCHDOG_RESET macro

Now that we've globally replaced all WATCHDOG_RESET occurances, let's
remove the ugly macro itself in the header.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2 years agowatchdog: Get rid of ASSEMBLY hacks
Stefan Roese [Fri, 2 Sep 2022 12:10:47 +0000 (14:10 +0200)]
watchdog: Get rid of ASSEMBLY hacks

Only one occurance of WATCHDOG_RESET is left in one assembler file.
This patch changes this occurance to a direct call to watchdog_reset
and then removes all the ASSEMBLY ifdef'ery in watchdog.h, as it's not
needed any more to clean this mess a bit up.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2 years agocyclic: Use schedule() instead of WATCHDOG_RESET()
Stefan Roese [Fri, 2 Sep 2022 12:10:46 +0000 (14:10 +0200)]
cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2 years agocyclic: Introduce schedule() function
Stefan Roese [Fri, 2 Sep 2022 12:10:45 +0000 (14:10 +0200)]
cyclic: Introduce schedule() function

This patch introduces a schedule() function, which shall be used instead
of the old WATCHDOG_RESET. Follow-up patches will make sure, that this
new function is used.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2 years agowatchdog: Integrate watchdog triggering into the cyclic framework
Stefan Roese [Thu, 18 Aug 2022 11:22:46 +0000 (13:22 +0200)]
watchdog: Integrate watchdog triggering into the cyclic framework

This patch integrates the watchdog triggering into the recently added
cyclic infrastructure. Each watchdog device that shall be triggered
registers it's own cyclic function. This way, multiple watchdog devices
are still supported, each via a cyclic function with separate trigger
intervals.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 16 Sep 2022 20:06:46 +0000 (16:06 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2022-09-16-rationalize-the-block-interface' into next
Tom Rini [Fri, 16 Sep 2022 19:35:47 +0000 (15:35 -0400)]
Merge branch '2022-09-16-rationalize-the-block-interface' into next

The block interface has two separate implementations, one using driver
model and one not. The latter is really only needed for SPL, where
size constraints allegedly don't allow use of driver model. Of course
we still need space for filesystems and other code, so it isn't clear
that driver model is anything more than the straw that breaks the
camel's back.

The driver model version uses a uclass ID for the interface time, but
converts back and forth between that and if_type, which is the legacy
type.

The HAVE_BLOCK_DEVICE define is mostly a hangover from the old days.
At present its main purpose is to enable the legacy block implementation
in SPL.

Finally the use of 'select' to enable BLK does not work very well. It
causes kconfig errors when another option depends on BLK and it is
not recommended by the kconfig style guide.

This series aims to clean things up:
- Enable BLK based on whether different media types are used, but still
  allow boards to disable it
- Rename HAVE_BLOCK_DEVICE to indicates its real purpose
- Drop if_type and use the uclass instead
- Drop some obsolete if_type values

An issue not resolved by this series is that the sandbox host interface
does not actually have a device. At present it uses the root device, which
was convenience for the driver model conversion but not really correct. It
should be possible to clean this up, in a future series.

Another minor issue is the use of UCLASS_USB for a mass-storage device.
This has been the case for a while and is not addresed by this series,
other than to add a comment.

Note that this test relies on Tom Rini's series to drop various boards
including warp and cm_t335

Finally, a patch is included to make binman put fake files in a
subdirectory, since repeated runs of certain boards can cause unrelated
failues (e.g. chromebook_coral) when fake files are left around.

2 years agoblk: Drop if_type
Simon Glass [Fri, 12 Aug 2022 01:35:01 +0000 (19:35 -0600)]
blk: Drop if_type

Use the uclass ID instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agodisk: Handle UCLASS_EFI_MEDIA in dev_print()
Simon Glass [Fri, 12 Aug 2022 01:35:00 +0000 (19:35 -0600)]
disk: Handle UCLASS_EFI_MEDIA in dev_print()

This is currently missing. Add it.

Fix the code style for the function while we are here.

Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Switch over to using uclass IDs
Simon Glass [Fri, 12 Aug 2022 01:34:59 +0000 (19:34 -0600)]
blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoefi: Correct assumption about if_type
Simon Glass [Fri, 12 Aug 2022 01:34:58 +0000 (19:34 -0600)]
efi: Correct assumption about if_type

efi_set_blk_dev_to_system_partition() assumes that 0 is an invalid
if_type. This is true now but is about to be false. Fix this bug to avoid
a test failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Rewrite if_type to name functions
Simon Glass [Fri, 12 Aug 2022 01:34:57 +0000 (19:34 -0600)]
blk: Rewrite if_type to name functions

These are currently using a simple array lookup in one direction, and
relying on if_type being sequential.

With the move to uclass IDs this needs to change. Update the code to
prepare for the new way. This patch is intended to introduce no
functional change.

The returning of "(none)" from blk_get_if_type_name() is handling a case
that should not happen in either case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Rename var in blk_get_devnum_by_typename()
Simon Glass [Fri, 12 Aug 2022 01:34:56 +0000 (19:34 -0600)]
blk: Rename var in blk_get_devnum_by_typename()

At present we use a variable with the same name as the enum. Change this
since we plan to #define the enum to uclass_id.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Drop IF_TYPE_SD
Simon Glass [Fri, 12 Aug 2022 01:34:55 +0000 (19:34 -0600)]
blk: Drop IF_TYPE_SD

This is not really needed since it does the same things as MMC. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Drop IF_TYPE_ATAPI
Simon Glass [Fri, 12 Aug 2022 01:34:54 +0000 (19:34 -0600)]
blk: Drop IF_TYPE_ATAPI

This is not really needed since it does the same things as IDE. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoide: Use a flag for an ATAPI device
Simon Glass [Fri, 12 Aug 2022 01:34:53 +0000 (19:34 -0600)]
ide: Use a flag for an ATAPI device

Rather than setting a different interface type, use a flag to indicate
that a device is ATAPI.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Drop IF_TYPE_DOC
Simon Glass [Fri, 12 Aug 2022 01:34:52 +0000 (19:34 -0600)]
blk: Drop IF_TYPE_DOC

This doesn't seem to be used for anything and it isn't clear what it is.
It dates from the first U-Boot commit.

Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Hide the BLK and SPL_LEGACY_BLOCK options
Simon Glass [Fri, 12 Aug 2022 01:34:51 +0000 (19:34 -0600)]
blk: Hide the BLK and SPL_LEGACY_BLOCK options

We don't want boards to be able to change these. They can be handled
as dependencies of options that need them, such as SPL_MMC. There is no
point in enabling the block interface without any storage devices to
create a block device.

Hide both options from the 'menuconfig' display and deny their use in
defconfig files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Drop unnecessary CONFIG_SPL_LEGACY_BLOCK in defconfigs
Simon Glass [Fri, 12 Aug 2022 01:34:50 +0000 (19:34 -0600)]
blk: Drop unnecessary CONFIG_SPL_LEGACY_BLOCK in defconfigs

This is defined automatically when needed, so drop it from the few
defconfig files that define it manually.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Select SPL_LEGACY_BLOCK automatically
Simon Glass [Fri, 12 Aug 2022 01:34:49 +0000 (19:34 -0600)]
blk: Select SPL_LEGACY_BLOCK automatically

Selecting this option can be handled in the Kconfig option itself, as it
is with BLK. Update this an drop the various 'select' clauses.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Rename HAVE_BLOCK_DEVICE
Simon Glass [Fri, 12 Aug 2022 01:34:48 +0000 (19:34 -0600)]
blk: Rename HAVE_BLOCK_DEVICE

This option is fact really related to SPL. For U-Boot proper we always use
driver model for block devices, so CONFIG_BLK is enabled if block devices
are in use.

It is only for SPL that we have two cases:

- SPL_BLK is enabled, in which case we use driver model and blk-uclass.c
- SPL_BLK is not enabled, in which case (if we need block devices) we must
  use blk_legacy.c

Rename the symbol to SPL_LEGACY_BLOCK to make this clear. This is
different enough from BLK and SPL_BLK that there should be no confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Drop unnecessary #ifdef in in blk_legacy
Simon Glass [Fri, 12 Aug 2022 01:34:47 +0000 (19:34 -0600)]
blk: Drop unnecessary #ifdef in in blk_legacy

We can rely on the compiler to eliminate any dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocmd: Drop use of HAVE_BLOCK_DEVICE
Simon Glass [Fri, 12 Aug 2022 01:34:46 +0000 (19:34 -0600)]
cmd: Drop use of HAVE_BLOCK_DEVICE

This condition is not needed for these commands, since BLK is enabled for
all boards which use block devices and commands are not available in SPL,
so even if SPL_BLK is not enabled, it doesn't affect commands.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Use a function for whether block devices are available
Simon Glass [Fri, 12 Aug 2022 01:34:45 +0000 (19:34 -0600)]
blk: Use a function for whether block devices are available

At present we use HAVE_BLOCK_DEVICE to indicate when block devices are
available.

This is a very strange option, since it partially duplicates the BLK
option used by driver model. It also covers both U-Boot proper and SPL,
even though one might have block devices and another not.

As a first step towards correcting this, create a new inline function
called blk_enabled() which indicates if block devices are available.
This cannot be used in Makefiles, or #if clauses, but can be used in C
code.

A function is useful because we cannot use CONFIG_IS_ENABLED(BLK) to
decide if block devices are needed, since we must consider the legacy
block interface, enabled by HAVE_BLOCK_DEVICE

Update a few places where it can be used and drop some unnecessary #if
checks around some functions in disk/part.c - rely on the compiler's
dead-code elimination instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodisk: Use Makefile to omit partition drivers
Simon Glass [Fri, 12 Aug 2022 01:34:44 +0000 (19:34 -0600)]
disk: Use Makefile to omit partition drivers

At present these files have an #ifdef covering the whole file. Move the
condition to the Makefile instead.

Add BLK to the condition since future patches will adjust things so that
HAVE_BLOCK_DEVICE is only for SPL, but the partition drivers are needed
in U-Boot proper too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Avoid defining HAVE_BLOCK_DEVICE in Konfig
Simon Glass [Fri, 12 Aug 2022 01:34:43 +0000 (19:34 -0600)]
sandbox: Avoid defining HAVE_BLOCK_DEVICE in Konfig

This is not needed as it is implied or selected by other options anyway.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoata: Fix an instance of SPL_SATA_SUPPORT
Simon Glass [Fri, 12 Aug 2022 01:34:42 +0000 (19:34 -0600)]
ata: Fix an instance of SPL_SATA_SUPPORT

The _SUPPORT suffix should be dropped. This happened because the rename
was applied around the same time as this new option, so did not include
renaming the new option.

The relevant commits are:

   f7560376ae sata: Rename SATA_SUPPORT to SATA
   73059529b2 ata: ahci-pci: Add new option CONFIG_SPL_AHCI_PCI

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Enable CONFIG_BLK for all media
Simon Glass [Fri, 12 Aug 2022 01:34:41 +0000 (19:34 -0600)]
blk: Enable CONFIG_BLK for all media

Enable this option on all boards which support block devices. Drop the
related depencies on BLK since these are not needed anymore.

Disable BLOCK_CACHE on M5253DEMO as this causes a build error.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodisk: Correct help for TPL_PARTITIONS
Simon Glass [Fri, 12 Aug 2022 01:34:40 +0000 (19:34 -0600)]
disk: Correct help for TPL_PARTITIONS

Fix a few typos in this help text. Fix a typo in SPL_PARTITIONS while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-09-15-TI-platform-updates' into next
Tom Rini [Thu, 15 Sep 2022 21:02:52 +0000 (17:02 -0400)]
Merge branch '2022-09-15-TI-platform-updates' into next

- Updated for assorted platforms using various TI SoCs.

2 years agoNokia RX-51: Add booting from UBI into test script
Pali Rohár [Thu, 15 Sep 2022 18:59:48 +0000 (20:59 +0200)]
Nokia RX-51: Add booting from UBI into test script

Compile U-Boot with UBI/UBIFS support according to doc/board/nokia/rx51.rst
instructions and add test case for loading kernel image from UBI volume.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Add comment describing kernel image type into test script
Pali Rohár [Sun, 4 Sep 2022 01:29:05 +0000 (03:29 +0200)]
Nokia RX-51: Add comment describing kernel image type into test script

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Do not set useless ARCH= in test script
Pali Rohár [Sun, 4 Sep 2022 01:29:04 +0000 (03:29 +0200)]
Nokia RX-51: Do not set useless ARCH= in test script

U-Boot ignores ARCH= variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Fix documentation how to enable UBI support
Pali Rohár [Sun, 4 Sep 2022 01:29:03 +0000 (03:29 +0200)]
Nokia RX-51: Fix documentation how to enable UBI support

Disable UBI fastmap support which is not supported by original Maemo 5
kernel and explicitly set UBI BEB limit to 10%, which is the value used by
original Maemo 5 kernel. U-Boot default value is 20%.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Call bootm in test script only when image is valid
Pali Rohár [Sun, 4 Sep 2022 01:29:02 +0000 (03:29 +0200)]
Nokia RX-51: Call bootm in test script only when image is valid

When reading of image fails then do not call bootm. This prevents false
positive test result in case something bootable is present in memory.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Change UBIFS volume size to 1870 LEBs in test script
Pali Rohár [Sun, 4 Sep 2022 01:29:01 +0000 (03:29 +0200)]
Nokia RX-51: Change UBIFS volume size to 1870 LEBs in test script

Original Nokia UBIFS system image has 1870 LEBs, so set UBIFS volume size
in test script to the same value. Number of 1870 LEBs corresponds to 230MiB
(LEB size * num of LEBs = 126KiB * 1870 = 230MiB).

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Set default SYS_LOAD_ADDR to 0x80008000
Pali Rohár [Sun, 4 Sep 2022 01:29:00 +0000 (03:29 +0200)]
Nokia RX-51: Set default SYS_LOAD_ADDR to 0x80008000

At address 0x80000100 are stored initial atags passed to U-Boot by NOLO.
So do not overwrite them when using $loadaddr variable which value is set
from CONFIG_SYS_LOAD_ADDR option.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Do not clear unknown memory in lowlevel_init.S
Pali Rohár [Sun, 4 Sep 2022 01:28:59 +0000 (03:28 +0200)]
Nokia RX-51: Do not clear unknown memory in lowlevel_init.S

If kernel image in uImage or zImage format is not detected by
lowlevel_init.S code then do not clear memory location where image was
expected. If image is not detected then this memory region is unknown.
So do not unconditionally clear it.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Remove label copy_kernel_start from lowlevel_init.S
Pali Rohár [Sun, 4 Sep 2022 01:28:58 +0000 (03:28 +0200)]
Nokia RX-51: Remove label copy_kernel_start from lowlevel_init.S

Label copy_kernel_start is now unused. Remove it.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoconfigs: Add configs for j721s2 High Security EVM
Jayesh Choudhary [Tue, 30 Aug 2022 10:24:30 +0000 (15:54 +0530)]
configs: Add configs for j721s2 High Security EVM

Add j721s2 High Security EVM defconfig.

These configs are same as for the non-secure part, except for:
        CONFIG_TI_SECURE_DEVICE option set to 'y'
        CONFIG_FIT_IMAGE_POST_PROCESS option set to 'y'
        CONFIG_SPL_FIT_IMAGE_POST_PROCESS option set to 'y'
        CONFIG_BOOTCOMMAND uses FIT images for booting

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
2 years agoconfigs: Add configs for J7200 High Security EVM
Andrew Davis [Tue, 30 Aug 2022 10:24:29 +0000 (15:54 +0530)]
configs: Add configs for J7200 High Security EVM

Add J7200 High Security EVM defconfig.

These defconfigs are the same as for the non-secure part, except for:
    CONFIG_TI_SECURE_DEVICE option set to 'y'
    CONFIG_BOOTCOMMAND uses FIT images for booting

Signed-off-by: Andrew Davis <afd@ti.com>
[j-choudhary@ti.com: add few configs from GP variant which were missing]
Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
2 years agobrppt1: Update environment to support new boot concept
Bernhard Messerklinger [Thu, 25 Aug 2022 06:54:04 +0000 (08:54 +0200)]
brppt1: Update environment to support new boot concept

* Drop legacy /boot/PPTImage.md5 check
* Update device tree naming
* Update t30args#0 root cmd line property to support latest kernel
  versions (root=/dev/mmcblk0p2 for linux < 4 and
  root=/dev/mmcblk1p2 for linux >= 4)
* Add custom bootloader version string
* Destroy invalid dtb at ${dtbaddr} and configuration script at
  ${cfgaddr} to ensure proper boot in warm restart case.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2 years agoinclude: configs: brppt1: Fix commit 0ea4fc4dcf90
Bernhard Messerklinger [Thu, 25 Aug 2022 06:54:03 +0000 (08:54 +0200)]
include: configs: brppt1: Fix commit 0ea4fc4dcf90

Commit 0ea4fc4dcf90 ("board/BuR: invalidate ${dtbaddr} before cfgscr")
destroys the boot targets b_t30lgcy#0 and b_t30lgcy#1. The reason behind
this is, that b_t30lgcy#0 and b_t30lgcy#1 both load the for booting
needed device trees from mmc and the cfgscr script patches those. Because
of this, cfgscr is not allowed to destroy the previously loaded device
tree otherwise cfgscr will fail.
This patch moves the device trees invalidation on warm restart to the
PREBOOT cmd to fix that issue.

Fixes: 0ea4fc4dcf90 ("board/BuR: invalidate ${dtbaddr} before cfgscr")
Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2 years agobrppt1: Cleanup device tree
Bernhard Messerklinger [Thu, 25 Aug 2022 06:54:02 +0000 (08:54 +0200)]
brppt1: Cleanup device tree

* Remove unnecessary device tree nodes which are not needed in
  U-Boot directly.
* Move all U-Boot specific device tree properties to u-boot dtsi.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2 years agobrppt1: Fix SPL boot stage
Bernhard Messerklinger [Thu, 25 Aug 2022 06:54:01 +0000 (08:54 +0200)]
brppt1: Fix SPL boot stage

Commit 6337d53fdf45 ("arm: dts: sync am33xx with Linux 5.9-rc7") syncs
the am335x device tree with the latest linux kernel am335x device tree.
That causes problems with device tree in SPL stage.
To fix the issues CONFIG_SPL_OF_TRANSLATE must be set to handle the
synced bus addresses correctly.
A custom U-Boot device tree is also needed since the SPL build removes
bus properties from bus nodes which are not explicitly marked with the
u-boot,dm-spl or u-boot,dm-pre-reloc flag. Therefore all parent buses of
the in the SPL needed devices must be marked with u-boot,dm-pre-reloc.
Also since there is no driver for "ti,sysc" compatible property in SPL
the buses marked with this compatible string must also be marked with
compatible = "simple-bus" to make the underlying devices visible in
SPL. Otherwise the matching device drivers aren't found and the uclass
drivers are dropped.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2 years agobrppt1: Remove unused board variants
Bernhard Messerklinger [Thu, 25 Aug 2022 06:54:00 +0000 (08:54 +0200)]
brppt1: Remove unused board variants

The SPI and NAND board variants never went into production.
Drop those board variants.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2 years agoMerge branch '2022-09-15-general-improvements' into next
Tom Rini [Thu, 15 Sep 2022 13:59:47 +0000 (09:59 -0400)]
Merge branch '2022-09-15-general-improvements' into next

- Add uncompressed kernel image support to falcon mode, TEE
  improvements, make xyz-modem timeout configurable, gpio updates and
  other assorted improvements.

2 years agolib: rsa: fix padding_pss_verify
Heinrich Schuchardt [Wed, 31 Aug 2022 19:13:40 +0000 (21:13 +0200)]
lib: rsa: fix padding_pss_verify

Check the that the hash length is shorter than the message length. This
avoids:

    ./tools/../lib/rsa/rsa-verify.c:275:11: warning:
    ‘*db’ may be used uninitialized [-Wmaybe-uninitialized]
      275 |         db[0] &= 0xff >> leftmost_bits;

Fixes: 061daa0b61f0 ("rsa: add support of padding pss")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocli: Reduce size of readline buffers in SPL
Sean Anderson [Tue, 30 Aug 2022 20:40:37 +0000 (16:40 -0400)]
cli: Reduce size of readline buffers in SPL

Normally, readline is not used int SPL. However, it may be useful to
enable the Freescale DDR interactive mode in SPL, while U-Boot is still
executing from SRAM. The default settings for readline result in a large
buffer being allocated. Reduce the size of the maximum input line, and
the number of lines of scrollback when building for SPL.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agogpio: sandbox: Add GPIOD_IS_AF for gpio configured in alternate function
Patrice Chotard [Tue, 30 Aug 2022 12:09:14 +0000 (14:09 +0200)]
gpio: sandbox: Add GPIOD_IS_AF for gpio configured in alternate function

This allows to test if a pin's label if displayed using gpio_get_status()
when this pin is configured in alternate function.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agopinctrl: pinctrl_stm32: Populate uc_priv->name[] with pinmux node's name
Patrice Chotard [Tue, 30 Aug 2022 12:09:13 +0000 (14:09 +0200)]
pinctrl: pinctrl_stm32: Populate uc_priv->name[] with pinmux node's name

Populate uc_priv->name[] with pinmux node's name in order to indicate
the pinmuxing's name in case GPIO is configured in alternate.

For example, for STM32 SoC's based platform, "gpio status" command
output :

  before
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func
      GPIOZ5: func
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

  After
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func i2c4-0
      GPIOZ5: func i2c4-0
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agogpio: Fix pin's status display for pin with GPIOF_UNUSED function
Patrice Chotard [Tue, 30 Aug 2022 12:09:12 +0000 (14:09 +0200)]
gpio: Fix pin's status display for pin with GPIOF_UNUSED function

Even pin with GPIOF_UNUSED function can have a label.
The criteria to add or not a space character is linked to label not to
the used/unused status.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agogpio: Allow to print pin's label even for pin with GPIOF_FUNC function
Patrice Chotard [Tue, 30 Aug 2022 12:09:11 +0000 (14:09 +0200)]
gpio: Allow to print pin's label even for pin with GPIOF_FUNC function

Currently, if pin's function is GPIOF_FUNC, only "func" if displayed
without any other information. It would be interesting, if information is
available, to indicate which pinmuxing's name is used.

For example, for STM32 SoC's based platform, "gpio status" command
output :

   before
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func
      GPIOZ5: func
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

   After
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func i2c4-0
      GPIOZ5: func i2c4-0
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agovirtio: pci: fix bug of virtio_pci_map_capability
Xiang W [Sun, 28 Aug 2022 23:53:15 +0000 (07:53 +0800)]
virtio: pci: fix bug of virtio_pci_map_capability

The bar of the structure virtio_pci_cap is the index, and each base
address occupies 4 bytes, so it needs to be multiplied by 4.

This patch fixes a bug reported by Felix Yan
https://lists.denx.de/pipermail/u-boot/2022-August/492779.html

Signed-off-by: Xiang W <wxjstz@126.com>
Tested-by: Felix Yan <felixonmars@archlinux.org>
2 years agonvme: Fix multipage prp-list
Alexander Sowarka [Sun, 28 Aug 2022 19:30:20 +0000 (21:30 +0200)]
nvme: Fix multipage prp-list

The nvme driver falsely assumed that the last entry on a page
of the prp-list always points to the next page of the prp-list.
This potentially can lead to the illegal creation of pages on
the prp-list with only a single entry. This change now ensures
that splitting the prp-list into multiple pages, behaves now as
required by the NVME-Spec.

Related to this, also the size of the memory allocation is adjusted
accordingly.

Signed-off-by: Alexander Sowarka <alexander.sowarka@aerq.com>
2 years agodoc: cmd: loady: Document new configuration
Pali Rohár [Mon, 29 Aug 2022 15:36:23 +0000 (17:36 +0200)]
doc: cmd: loady: Document new configuration

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoxyz-modem: Allow to configure initial timeout for loadx and loady
Pali Rohár [Sat, 27 Aug 2022 14:37:55 +0000 (16:37 +0200)]
xyz-modem: Allow to configure initial timeout for loadx and loady

Now when loadx and loady commands could be aborted / cancelled by CTRL+C,
allow to configure timeout for initial x/y-modem packet via env variable
$loadxy_timeout and by default use value from new compile-time config
option CONFIG_CMD_LOADXY_TIMEOUT. Value is in seconds and zero value means
infinite timeout. Default value is 90s which is the value used before this
change for loadx command.

Other load commands loadb and loads already waits infinitely. Same behavior
for loadx and loady commands can be achieved by setting $loadxy_timeout or
CONFIG_CMD_LOADXY_TIMEOUT to 0.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agopost: memory: Fix format strings
Sean Anderson [Tue, 23 Aug 2022 19:10:39 +0000 (15:10 -0400)]
post: memory: Fix format strings

This fixes numerous cases of format strings not matching their
arguments. Also keep the format strings on one line for easier grepping.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodrivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY
Etienne Carriere [Tue, 26 Jul 2022 14:21:43 +0000 (16:21 +0200)]
drivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY

Changes optee_rng driver to register itself has a OP-TEE service so
that a device is bound for the driver when OP-TEE enumerates the
PTA RNG service.

Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agodrivers: tee: optee: discover OP-TEE services
Etienne Carriere [Tue, 26 Jul 2022 14:21:42 +0000 (16:21 +0200)]
drivers: tee: optee: discover OP-TEE services

This change defines resources for OP-TEE service drivers to register
themselves for being bound to when OP-TEE firmware reports the related
service is supported. OP-TEE services are discovered during optee
driver probe sequence which mandates optee driver is always probe once
bound.

Discovery of optee services and binding to related U-Boot drivers is
embedded upon configuration switch CONFIG_OPTEE_SERVICE_DISCOVERY.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agodrivers: tee: optee: remove unused probe local variable
Etienne Carriere [Tue, 26 Jul 2022 14:21:41 +0000 (16:21 +0200)]
drivers: tee: optee: remove unused probe local variable

Removes local variable child in optee_probe() that is not used.

Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agospl: fit: Allocate buffers aligned to cache line size
Stefan Herbrechtsmeier [Tue, 14 Jun 2022 14:12:00 +0000 (16:12 +0200)]
spl: fit: Allocate buffers aligned to cache line size

Allocate memory for buffers at a cache-line boundary to avoid
misaligned buffer address for subsequent reads. This avoids an
additional sector-based memory copy in the fat file system driver:

FAT: Misaligned buffer address (...)

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2 years agomisc: usb251xb: Support 8/16 bit device tree values
Stefan Herbrechtsmeier [Tue, 14 Jun 2022 13:21:31 +0000 (15:21 +0200)]
misc: usb251xb: Support 8/16 bit device tree values

The device tree binding [1] specify the vendor-id, product-id, device-id
and language-id as 16 bit values and the linux driver reads the boost-up
value as 8 bit value.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/usb/usb251xb.txt

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agodm: core: Add functions to read 8/16-bit integers
Stefan Herbrechtsmeier [Tue, 14 Jun 2022 13:21:30 +0000 (15:21 +0200)]
dm: core: Add functions to read 8/16-bit integers

Add functions to read 8/16-bit integers like the existing functions for
32/64-bit to simplify read of 8/16-bit integers from device tree
properties.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoAdd in the ability to load and boot an uncompressed kernel image during the Falcon...
Nathan Barrett-Morrison [Wed, 2 Feb 2022 20:05:18 +0000 (15:05 -0500)]
Add in the ability to load and boot an uncompressed kernel image during the Falcon Mode boot sequence.

This is required for architectures which do not support compressed kernel images (i.e. ARM64).  This is only used while not booting via FIT image.

Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'efi-next-2022-09-14' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 14 Sep 2022 16:31:44 +0000 (12:31 -0400)]
Merge tag 'efi-next-2022-09-14' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for efi next

UEFI:

Implement a command eficonfig to maintain Load Options and boot order via
menus.

2 years agoMerge branch '2022-09-14-refactor-ramdisk-code-again' into next
Tom Rini [Wed, 14 Sep 2022 15:50:21 +0000 (11:50 -0400)]
Merge branch '2022-09-14-refactor-ramdisk-code-again' into next

To quote the author:
The previous attempt at this[1] broke a board and was reverted in [2].
This series adopts a slightly different approach, splitting the changes
into many commits.

[1] f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")
[2] 621158d106f ("Revert "image: Remove #ifdefs from select_ramdisk()"")

2 years agoimage: Drop some other #ifdefs in image-board.c
Simon Glass [Sun, 28 Aug 2022 18:32:53 +0000 (12:32 -0600)]
image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Correct indentation in select_ramdisk()
Simon Glass [Sun, 28 Aug 2022 18:32:52 +0000 (12:32 -0600)]
image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Drop remaining FIT #ifdef
Simon Glass [Sun, 28 Aug 2022 18:32:51 +0000 (12:32 -0600)]
image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Drop another #ifdef for FIT
Simon Glass [Sun, 28 Aug 2022 18:32:50 +0000 (12:32 -0600)]
image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Drop one #ifdef for FIT
Simon Glass [Sun, 28 Aug 2022 18:32:49 +0000 (12:32 -0600)]
image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Drop #ifdefs for LEGACY_IMAGE_FORMAT
Simon Glass [Sun, 28 Aug 2022 18:32:48 +0000 (12:32 -0600)]
image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Track when ramdisk processing is completed
Simon Glass [Sun, 28 Aug 2022 18:32:47 +0000 (12:32 -0600)]
image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Fix up ANDROID_BOOT_IMAGE ramdisk code
Simon Glass [Sun, 28 Aug 2022 18:32:46 +0000 (12:32 -0600)]
image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-09-13-add-support-for-cyclic-function-execution' into next
Tom Rini [Wed, 14 Sep 2022 12:57:39 +0000 (08:57 -0400)]
Merge branch '2022-09-13-add-support-for-cyclic-function-execution' into next

To quote the author:
This patchset adds the basic infrastructure to periodically execute
code, e.g. all 100ms. Examples for such functions might be LED blinking
etc. The functions that are hooked into this cyclic list should be
small timewise as otherwise the execution of the other code that relies
on a high frequent polling (e.g. UART rx char ready check) might be
delayed too much. This patch also adds the Kconfig option
CONFIG_CYCLIC_MAX_CPU_TIME_US, which configures the max allowed time
for such a cyclic function. If it's execution time exceeds this time,
this cyclic function will get removed from the cyclic list.

How is this cyclic functionality executed?
This patchset integrates the main function responsible for calling all
registered cyclic functions cyclic_run() into the common WATCHDOG_RESET
macro. This guarantees that cyclic_run() is executed very often, which
is necessary for the cyclic functions to get scheduled and executed at
their configured periods.

This cyclic infrastructure will be used by a board specific function on
the NIC23 MIPS Octeon board, which needs to check periodically, if a
PCIe FLR has occurred.

Ideas how to continue:
One idea is to rename WATCHDOG_RESET to something like SCHEDULE and
move the watchdog_reset call into this cyclic infrastructure as well.
Or to perhaps move the shell UART RX ready polling to a cyclic
function.

It's also possible to extend the "cyclic" command, to support the
creation of periodically executed shell commands (for testing etc).

2 years agotest: unit test for eficonfig
Masahisa Kojima [Mon, 12 Sep 2022 08:33:59 +0000 (17:33 +0900)]
test: unit test for eficonfig

Provide a unit test for the eficonfig command.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodoc:eficonfig: add documentation for eficonfig command
Masahisa Kojima [Mon, 12 Sep 2022 08:33:58 +0000 (17:33 +0900)]
doc:eficonfig: add documentation for eficonfig command

Add documentation for eficonfig command.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodoc:bootmenu: add description for UEFI boot support
Masahisa Kojima [Mon, 12 Sep 2022 08:33:57 +0000 (17:33 +0900)]
doc:bootmenu: add description for UEFI boot support

The bootmenu enumerates the UEFI boot options
for boot device selection.
This commit adds the description how the UEFI boot work
in bootmenu. This commit also adds "Synopsis", "Description"
and "Configuration" sections to follow the U-Boot command
documentation format.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoeficonfig: add "Change Boot Order" menu entry
Masahisa Kojima [Mon, 12 Sep 2022 08:33:56 +0000 (17:33 +0900)]
eficonfig: add "Change Boot Order" menu entry

This commit adds the menu entry to update UEFI BootOrder variable.
User moves the entry with UP/DOWN key, changes the order
with PLUS/MINUS key, press SPACE to activate or deactivate
the entry, then finalizes the order by ENTER key.
If the entry is activated, the boot index is added into the
BootOrder variable in the order of the list.

The U-Boot menu framework is well designed for static menu,
this commit implements the own menu display and key handling
for dynamically change the order of menu entry.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2 years agoeficonfig: scan media device in eficonfig startup
Masahisa Kojima [Mon, 12 Sep 2022 08:33:55 +0000 (17:33 +0900)]
eficonfig: scan media device in eficonfig startup

In eficonfig startup, scan media devices and update
the UEFI boot option.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2 years agobootmenu: add removable media entries
Masahisa Kojima [Mon, 12 Sep 2022 08:33:54 +0000 (17:33 +0900)]
bootmenu: add removable media entries

UEFI specification requires booting from removal media using
a architecture-specific default image name such as BOOTAA64.EFI.
This commit adds the removable media entries into bootmenu,
so that user can select the removable media and boot with
default image.

The bootmenu automatically enumerates the possible bootable
media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL,
add it as new UEFI boot option(BOOT####) and update BootOrder
variable. This automatically generated UEFI boot option
has the dedicated guid in the optional_data to distinguish it from
the UEFI boot option user adds manually. This optional_data is
removed when the efi bootmgr loads the selected UEFI boot option.

This commit also provides the BOOT#### variable maintenance feature.
Depending on the system hardware setup, some devices
may not exist at a later system boot, so bootmenu checks the
available device in each bootmenu invocation and automatically
removes the BOOT#### variable corrensponding to the non-existent
media device.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2 years agoeficonfig: add "Delete Boot Option" menu entry
Masahisa Kojima [Mon, 12 Sep 2022 08:33:53 +0000 (17:33 +0900)]
eficonfig: add "Delete Boot Option" menu entry

This commit adds the menu entry to delete the UEFI boot option.
User moves the entry with UP/DOWN key, changes, then presses
ENTER key to delete the selected boot option.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2 years agomenu: add KEY_PLUS, KEY_MINUS and KEY_SPACE handling
Masahisa Kojima [Mon, 12 Sep 2022 08:33:52 +0000 (17:33 +0900)]
menu: add KEY_PLUS, KEY_MINUS and KEY_SPACE handling

This is preparation to support menu-driven UEFI BootOrder
variable updated by KEY_PLUS, KEY_MINUS and KEY_SPACE.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoeficonfig: add "Edit Boot Option" menu entry
Masahisa Kojima [Mon, 12 Sep 2022 08:33:51 +0000 (17:33 +0900)]
eficonfig: add "Edit Boot Option" menu entry

This commit adds the menu entry to edit the existing
BOOT#### variable contents.
User selects the item from the boot option list, then
user can edit the description, file path and optional_data.

Note that automatically generated boot option entry by bootmenu
to support the removable media device is filtered out and user
can not edit the automatically generated entry.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2 years agoeficonfig: menu-driven addition of UEFI boot option
Masahisa Kojima [Mon, 12 Sep 2022 08:33:50 +0000 (17:33 +0900)]
eficonfig: menu-driven addition of UEFI boot option

This commit add the "eficonfig" command.
The "eficonfig" command implements the menu-driven UEFI boot option
maintenance feature. This commit implements the addition of
new boot option. User can select the block device volume having
efi_simple_file_system_protocol and select the file corresponding
to the Boot#### variable. User can also enter the description and
optional_data of the BOOT#### variable in utf8.

This commit adds "include/efi_config.h", it contains the common
definition to be used from other menus such as UEFI Secure Boot
key management.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2 years agocyclic: Add a simple test
Stefan Roese [Fri, 2 Sep 2022 11:57:54 +0000 (13:57 +0200)]
cyclic: Add a simple test

Add a test for cyclic function registration and activation.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocyclic: Add documentation
Stefan Roese [Fri, 2 Sep 2022 11:57:53 +0000 (13:57 +0200)]
cyclic: Add documentation

Add documentation for the cyclic function infrastructure, including the
cyclic command.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agomips: octeon_nic23: Add PCIe FLR fixup via cyclic infrastructure
Aaron Williams [Fri, 2 Sep 2022 11:57:52 +0000 (13:57 +0200)]
mips: octeon_nic23: Add PCIe FLR fixup via cyclic infrastructure

This patch adds a fixup function related to a PCIe FLR (Function Level
Reset) problem on the NIC23 PCIe board. This function is imported from
the Marvell Octeon 2013 U-Boot version as a (nearly) verbatim copy. It
uses the newly introduced cyclic infrastructure, so that this function
gets called every 100us, which is needed to detect this FLR issue.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agocyclic: Add 'cyclic list' and 'cyclic demo' commands
Stefan Roese [Fri, 2 Sep 2022 11:57:51 +0000 (13:57 +0200)]
cyclic: Add 'cyclic list' and 'cyclic demo' commands

This patch adds the cyclic command, which currently only supports the
'list' subcommand, to list all currently registered cyclic functions.
Here an example:

=> cyclic list
function: cyclic_demo, cpu-time: 7010 us, frequency: 99.80 times/s
function: cyclic_demo2, cpu-time: 1 us, frequency: 1.13 times/s

As you can see, the cpu-time is accounted, so that cyclic functions
that take too long might be discovered. Additionally the frequency is
logged.

The 'cyclic demo' commands registers the cyclic_demo() function to
be executed all 'cycletime_ms' milliseconds. The only thing this
function does is delaying by 'delay_us' microseconds.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocyclic: Integrate cyclic functionality at bootup in board_r/f
Stefan Roese [Fri, 2 Sep 2022 11:57:50 +0000 (13:57 +0200)]
cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocyclic: Integrate cyclic infrastructure into WATCHDOG_RESET
Stefan Roese [Fri, 2 Sep 2022 11:57:49 +0000 (13:57 +0200)]
cyclic: Integrate cyclic infrastructure into WATCHDOG_RESET

This patch integrates the main function responsible for calling all
registered cyclic functions cyclic_run() into the common WATCHDOG_RESET
macro. This guarantees that cyclic_run() is executed very often, which
is necessary for the cyclic functions to get scheduled and executed at
their configured periods.

If CONFIG_WATCHDOG is not enabled, only cyclic_run() without calling
watchdog_reset(). This guarantees that the cyclic functionality does not
rely on CONFIG_WATCHDOG being enabled.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocyclic: Add basic support for cyclic function execution infrastruture
Stefan Roese [Fri, 2 Sep 2022 11:57:48 +0000 (13:57 +0200)]
cyclic: Add basic support for cyclic function execution infrastruture

Add the basic infrastructure to periodically execute code, e.g. all
100ms. Examples for such functions might be LED blinking etc. The
functions that are hooked into this cyclic list should be small timewise
as otherwise the execution of the other code that relies on a high
frequent polling (e.g. UART rx char ready check) might be delayed too
much. This patch also adds the Kconfig option
CONFIG_CYCLIC_MAX_CPU_TIME_US, which configures the max allowed time
for such a cyclic function. If it's execution time exceeds this time,
this cyclic function will get removed from the cyclic list.

How is this cyclic functionality executed?
The following patch integrates the main function responsible for
calling all registered cyclic functions cyclic_run() into the
common WATCHDOG_RESET macro. This guarantees that cyclic_run() is
executed very often, which is necessary for the cyclic functions to
get scheduled and executed at their configured periods.

This cyclic infrastructure will be used by a board specific function on
the NIC23 MIPS Octeon board, which needs to check periodically, if a
PCIe FLR has occurred.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotime: Import time_after64() and friends from Linux
Stefan Roese [Fri, 2 Sep 2022 11:57:47 +0000 (13:57 +0200)]
time: Import time_after64() and friends from Linux

When using us times it makes sense to use 64bit variables for storage.
The currently implemented time_after() and friends functions only handle
32bit variables. This patch now includes the 64bit variants as well
from Linux. This will be used by the upcoming generic cyclic function
infrastructure.

These macros were copied from include/linux/jiffies.h of Linux 5.18.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>