]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agoefi_loader: simplify efi_sigstore_parse_sigdb()
Heinrich Schuchardt [Thu, 9 Sep 2021 06:25:08 +0000 (08:25 +0200)]
efi_loader: simplify efi_sigstore_parse_sigdb()

Simplify efi_sigstore_parse_sigdb() by using existing functions.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: function to get GUID for variable name
Heinrich Schuchardt [Thu, 9 Sep 2021 06:22:58 +0000 (08:22 +0200)]
efi_loader: function to get GUID for variable name

In multiple places we need the default GUID matching a variable name.
The patch provides a library function. For secure boot related variables
like 'PK', 'KEK', 'db' a lookup table is used. For all other variable
names EFI_GLOBAL_VARIABLE is returned.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: treat UEFI variable name as const
Heinrich Schuchardt [Thu, 9 Sep 2021 05:12:14 +0000 (07:12 +0200)]
efi_loader: treat UEFI variable name as const

UEFI variable names are typically constants and hence should be defined as
const. Unfortunately some of our API functions do not define the parameters
for UEFI variable names as const. This requires unnecessary conversions.

Adjust parameters of several internal functions to tre UEFI variable names
as const.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: capsule: add back efi_get_public_key_data()
AKASHI Takahiro [Thu, 7 Oct 2021 06:23:32 +0000 (15:23 +0900)]
efi_loader: capsule: add back efi_get_public_key_data()

The commit 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to
.rodata"") failed to revert the removal of efi_get_public_key_data().

Add back this function and move it under lib/efi_loader so that other
platforms can utilize it. It is now declared as a weak function so that
it can be replaced with a platform-specific implementation.

Fixes: 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to
.rodata"")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoRevert "Revert "doc: Update CapsuleUpdate READMEs""
AKASHI Takahiro [Thu, 7 Oct 2021 06:23:31 +0000 (15:23 +0900)]
Revert "Revert "doc: Update CapsuleUpdate READMEs""

This reverts commit a7e4f905d206d5895dab4bd38a8316e4f2fe15fe.
The description originally written by Sughosh is still valid
even after the commit 47a25e81d35c ("Revert "efi_capsule: Move signature
from DTB to .rodata"") was applied.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agoRevert "Revert "mkeficapsule: Remove dtb related options""
AKASHI Takahiro [Thu, 7 Oct 2021 06:23:30 +0000 (15:23 +0900)]
Revert "Revert "mkeficapsule: Remove dtb related options""

This reverts commit d428e81266a59974ade74c1ba019af39f23304ab.
We have agreed with removing dtb-related stuff from mkeficapsule
command even if the commit 47a25e81d35c ("Revert "efi_capsule: Move
signature from DTB to .rodata"") was applied.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years ago.mailmap: add Heinrich Schuchardt
Heinrich Schuchardt [Sat, 23 Oct 2021 14:08:29 +0000 (16:08 +0200)]
.mailmap: add Heinrich Schuchardt

Add a mailmap entry for me.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi_loader: add missing const qualifier
Masahisa Kojima [Fri, 22 Oct 2021 11:24:24 +0000 (20:24 +0900)]
efi_loader: add missing const qualifier

This commit fixes the following compilation warning
of boottime->install_configuration_table() function.

lib/efi_selftest/efi_selftest_tcg2.c:475:46:
warning: passing argument 1 of ‘boottime->install_configuration_table’
discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  ret = boottime->install_configuration_table(&smbios_guid, dmi);

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodoc: Remove the obsolete README.mpc74xx file
Thomas Huth [Mon, 25 Oct 2021 06:56:14 +0000 (08:56 +0200)]
doc: Remove the obsolete README.mpc74xx file

Support for the PPC74xx processors has been removed in commit
d928664f41 ("powerpc: 74xx_7xx: remove 74xx_7xx cpu support")
more than 6 years ago already. So the corresponding README file
can now be removed, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodoc: remove AMCC PPC405 processor references
Heinrich Schuchardt [Sat, 23 Oct 2021 11:14:39 +0000 (13:14 +0200)]
doc: remove AMCC PPC405 processor references

Support for PPC4XX processors has been removed. So we should not mention it
in the documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
3 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 25 Oct 2021 16:09:57 +0000 (12:09 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

- Add and enable watchdog driver
- Prepare for SYSRESET driven AXP poweroff
- Prepare for SoCs without MMC2
- Some fixes for extending SPL (SPL-DM for RISC-V)
- Some preparations for proper VBUS management
- Fix secure monitor move

3 years agommc: sunxi: conditionally include MMC2 initialization code
Icenowy Zheng [Thu, 22 Jul 2021 06:30:05 +0000 (14:30 +0800)]
mmc: sunxi: conditionally include MMC2 initialization code

Allwinner R329 has no MMC2.

Only include the code of MMC2 if the base address of it is defined.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: only include alias for eMMC when mmc2 used
Icenowy Zheng [Thu, 22 Jul 2021 06:30:04 +0000 (14:30 +0800)]
sunxi: only include alias for eMMC when mmc2 used

Some Allwinner SoCs (e.g. R329) doesn't have a MMC2 controller at all,
and on boards that we do not utilize MMC2, the alias for it is just
useless.

Only include the alias when we specify CONFIG_MMC_SUNXI_EXTRA_SLOT to 2.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: dts: H616: Enable the watchdog
Samuel Holland [Sun, 22 Aug 2021 18:53:29 +0000 (13:53 -0500)]
sunxi: dts: H616: Enable the watchdog

For some reason, the watchdog was disabled in the H616 device tree. Most
likely this is a copy-paste from the H6 device tree: the H6 watchdog is
disabled because it is broken in some chips. However, there is no
evidence of issues with the H616 watchdog.

Enable the watchdog node so it can be used by the driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoMerge tag 'u-boot-imx-20211022' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Mon, 25 Oct 2021 13:54:36 +0000 (09:54 -0400)]
Merge tag 'u-boot-imx-20211022' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20211022
-------------------

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

- i.MX8:
- Toradex Verdin (switch to binman, cleanup, etc.)
- Phytec phycore_imx8mm (fixes, boot from SPI-NOR)
- fixes for imx8mp_evk
- doc (i.MX): MX8MM with Fast boot
- i.MX6:
- Toradex : colibri-imx6ull with eMMC, fixes
- i.MX7ULP :
- preparation for OPTEE + Serial Number
- generic:
- imx8m_image: Support ddr3 firmware

3 years agosunxi: Enable watchdog timer support by default
Samuel Holland [Sun, 22 Aug 2021 18:53:28 +0000 (13:53 -0500)]
sunxi: Enable watchdog timer support by default

A watchdog helps recover from hangs or failure to boot an OS. It can
also be used by the sysreset framework to intentionally reset the
system. Now that a driver is available, let's enable this functionality
on sunxi boards.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agowatchdog: Add a driver for the sunxi watchdog
Samuel Holland [Sun, 22 Aug 2021 18:53:27 +0000 (13:53 -0500)]
watchdog: Add a driver for the sunxi watchdog

This driver supports the sun4i/sun6i/sun20i watchdog timers.
They have a maximum timeout of 16 seconds.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoclk: sunxi: Extend DM_RESET selection to SPL
Samuel Holland [Sat, 11 Sep 2021 19:45:31 +0000 (14:45 -0500)]
clk: sunxi: Extend DM_RESET selection to SPL

The sunxi clock driver exposes a reset controller, so it selects the
reset controller framework. Ensure that dependency is also satisfied
when building the driver for the SPL.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: SPL SPI: Allow larger SPL
Andre Przywara [Mon, 5 Jul 2021 23:04:43 +0000 (00:04 +0100)]
sunxi: SPL SPI: Allow larger SPL

The more recent Allwinner SoCs BootROMs can actually load SPL images
larger than 32KB. We use this on the H616 to fit the extra code needed
for the PMIC into the image, and have provisions in board.c to respect
that larger SPL size when booting from MMC.

However the sunxi SPL SPI loader has a hardcoded load offset of 32KB,
which will fail on the H616.

To fix this, use the same algorithm we use for MMC: if the SPL size is
smaller than 32KB, we use 32KB, otherwise we expect the U-Boot payload
directly after the SPL code.

This prepares for SPI booting with larger SPLs like on the H616.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agopower: pmic: axp: Implement poweroff via sysreset
Samuel Holland [Mon, 25 Oct 2021 02:00:10 +0000 (21:00 -0500)]
power: pmic: axp: Implement poweroff via sysreset

The AXP PMICs have the ability to power off the system. The existing
code for this is duplicated for each PMIC variant, and uses the legacy
non-DM "pmic_bus" interface. When SYSRESET is enabled, this can all be
replaced with a sysreset device using the DM_PMIC interface.

Since the trigger bit is the same on all PMIC variants, use the register
definitions from the oldest supported PMIC.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agopower: axp: Avoid do_poweroff conflict with sysreset
Samuel Holland [Sun, 22 Aug 2021 23:18:05 +0000 (18:18 -0500)]
power: axp: Avoid do_poweroff conflict with sysreset

The sysreset uclass has an option to provide the do_poweroff() function.
When that option is enabled, the AXP power drivers should not provide
their own definition.

For the AXP305, which is paired with 64-bit systems where TF-A provides
PSCI, there is another possible conflict with the PSCI firmware driver.
This driver can be enabled even if CONFIG_PSCI_RESET is disabled, so
make sure to use the right symbol in the condition.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoinclude: axp_pmic: Include headers for all variants
Samuel Holland [Sun, 22 Aug 2021 23:18:04 +0000 (18:18 -0500)]
include: axp_pmic: Include headers for all variants

A single DM-based driver should be able to support some feature for
several PMIC variants where the interface is the same. For example,
all PMIC variants use the same register bit to trigger poweroff.

However, currently only definitions for a single PMIC are available at
a time. This requires drivers to use #ifdefs and different indentifiers
for each variant they support.

Let's simplify this by making register definitions for all variants
available from the header. Then no preprocessor conditions are needed;
the driver can use the register definition from any variant that
supports the relevant feature.

An exception is the GPIO-related definitions, which do not use unique
identifiers. So for now, keep them like before. They will be cleaned up
along with the GPIO driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoinclude: axp_pmic: Add missing header guard definition
Samuel Holland [Sun, 22 Aug 2021 23:18:03 +0000 (18:18 -0500)]
include: axp_pmic: Add missing header guard definition

This header attempted to avoid multiple inclusion using a header guard.
But the preprocessor symbol was never defined, so the guard had no
effect. Fix this by defining the symbol.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agotools: mksunxiboot: Use sunxi_image header directly
Samuel Holland [Wed, 13 Oct 2021 00:35:41 +0000 (19:35 -0500)]
tools: mksunxiboot: Use sunxi_image header directly

When adding eGON support to mkimage, the struct boot_file_head
definition was moved to its own header. This is the only thing
mksunxiboot needed out of asm/arch/spl.h. Clean up the relative
include by switching to new header.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: A23/A33/H3: Actually move the secure monitor
Samuel Holland [Tue, 12 Oct 2021 23:54:56 +0000 (18:54 -0500)]
sunxi: A23/A33/H3: Actually move the secure monitor

commit 1ebfc0c631e3 ("sunxi: A23/A33/H3: Move sun8i secure monitor to
SRAM A2") attempted to move the secure monitor to SRAM A2. But not all
sun8i SoCs have SRAM A2, so a check was put in for SUNXI_SRAM_A2_SIZE to
avoid breaking the other SoCs.

However, because the header providing SUNXI_SRAM_A2_SIZE was not
included, this unintentionally skipped the new definitions on all SoCs.
Fix this by including the right header.

Fixes: 1ebfc0c631e3 ("sunxi: A23/A33/H3: Move sun8i secure monitor to SRAM A2")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agophy: sun4i-usb: Support VBUS detection via power supply
Samuel Holland [Sun, 12 Sep 2021 14:22:42 +0000 (09:22 -0500)]
phy: sun4i-usb: Support VBUS detection via power supply

The device tree binding provides for getting VBUS state from a device
referenced by phandle, as an optional alternative to using a GPIO. In
U-Boot, where there is no power supply class, this VBUS detection will
be implemented using a regulator device and its get_enable method.
Let's hook this up to the PHY driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agophy: sun4i-usb: Refactor VBUS detection to match Linux
Samuel Holland [Sun, 12 Sep 2021 14:22:41 +0000 (09:22 -0500)]
phy: sun4i-usb: Refactor VBUS detection to match Linux

The Linux driver checks the VBUS detection GPIO first; then VBUS power
supply; then finally assumes VBUS is present. When adding VBUS power
supply support, we want to match that order, so we get the same behavior
in case both a GPIO and a power supply are provided in the device tree.

So refactor the function a bit to remove the early return, and use the
same "assume VBUS is present" final fallback.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agophy: sun4i-usb: Remove a couple of debug messages
Samuel Holland [Sun, 12 Sep 2021 14:22:40 +0000 (09:22 -0500)]
phy: sun4i-usb: Remove a couple of debug messages

Both of these messages log the GPIO number of the ID detection GPIO,
which is not terribly useful, especially in the VBUS detection function.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Select SPL_SEPARATE_BSS
Samuel Holland [Sun, 22 Aug 2021 18:23:53 +0000 (13:23 -0500)]
sunxi: Select SPL_SEPARATE_BSS

sunxi-common.h defines CONFIG_SPL_BSS_START_ADDR to put SPL's BSS in
DRAM. Due to this, we must select SPL_SEPARATE_BSS, or else SPL will
attempt to load its DTB from the wrong address (after BSS in DRAM).

This change fixes booting with SPL_OF_CONTROL=y.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Sat, 23 Oct 2021 14:49:28 +0000 (10:49 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-spi

- Fix mtd erase with mtdpart (Marek Behún)
- NXP fspi driver fixes (Kuldeep Singh)

3 years agospi: nxp_fspi: Implement errata workaround for LS1028A
Kuldeep Singh [Tue, 3 Aug 2021 09:02:58 +0000 (14:32 +0530)]
spi: nxp_fspi: Implement errata workaround for LS1028A

Errata ERR050568 description says that "Flash access by FlexSPI AHB
command may not work with platform frequency equal to 300 MHz" on
LS1028A.

By default, smaller length reads(equal to RX FIFO size) are done by IP
bus and larger length reads using AHB bus. For adding errata workaround,
use IP bus to read entire flash contents and disable AHB path when
platform frequency is 300Mhz.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agospi: nxp-fspi: Add support for IP read only
Kuldeep Singh [Tue, 3 Aug 2021 09:02:57 +0000 (14:32 +0530)]
spi: nxp-fspi: Add support for IP read only

Add support for disabling AHB bus and read entire flash contents via IP
bus only. Please note, this enables IP bus read using a quirk which can
be enabled directly in device-type data or in existence of an errata
where AHB bus may need to be disabled.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: spi-nor-ids: Add SECT_4K to mt25qu512a
Kris Chaplin [Mon, 18 Oct 2021 10:30:18 +0000 (03:30 -0700)]
mtd: spi-nor-ids: Add SECT_4K to mt25qu512a

The mt25qu512a supports 4K or 64K sectors, so adding
SECT_4K to enable 4K sector usage.

Tested on Intel n5x hardware with QSPI carrier card

Signed-off-by: Kris Chaplin <kris.chaplin@linux.intel.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
[jagan: droped Tested-by of patch author and datasheet link]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: spi-nor-ids: Add is25lp512 and is25wp512 devices
Kris Chaplin [Mon, 18 Oct 2021 10:26:50 +0000 (03:26 -0700)]
mtd: spi-nor-ids: Add is25lp512 and is25wp512 devices

Add is25lp512 and is25wp512 devices to spi-nor id table

Tested on Intel n5x hardware with QSPI carrier card

Signed-off-by: Kris Chaplin <kris.chaplin@linux.intel.com>
[jagan: droped Tested-by of patch author]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: Remove mtd_erase_callback() entirely
Marek Behún [Tue, 5 Oct 2021 13:56:06 +0000 (15:56 +0200)]
mtd: Remove mtd_erase_callback() entirely

The original purpose of mtd_erase_callback() in Linux at the time it was
imported to U-Boot, was to inform the caller that erasing is done (since
it was an asynchronous operation).

All supplied callback methods in U-Boot do nothing, but the
mtd_erase_callback() function was (until previous patch) grossly abused
in U-Boot's mtdpart implementation for completely different purpose.

Since we got rid of the abusement, remove the mtd_erase_callback()
function and the .callback member from struct erase_info entirely, in
order to avoid such problems in the future.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
3 years agomtd: mtdpart: Make mtdpart's _erase method sane
Marek Behún [Tue, 5 Oct 2021 13:56:05 +0000 (15:56 +0200)]
mtd: mtdpart: Make mtdpart's _erase method sane

The _erase() method of the mtdpart driver, part_erase(), currently
implements offset shifting (for given mtdpart partition) in a weird way:
  1. part_erase() adds partition offset to block address
  2. parent driver's _erase() method is called
  3. parent driver's _erase() method calls mtd_erase_callback()
  4. mtd_erase_callback() subtracts partition offset from block address
     so that the callback function is given correct address
The problem here is that if the parent's driver does not call
mtd_erase_callback() in some scenario (this was recently a case for
spi_nor_erase(), which did not call mtd_erase_callback() at all), the
offset is not shifted back.

Moreover the code would be more readable if part_erase() not only added
partition offset before calling parent's _erase(), but also subtracted
it back afterwards. Currently the mtd_erase_callback() is expected to do
this subtracting since it does have to do it anyway.

Add the more steps to this procedure:
  5. mtd_erase_callback() adds partition offset to block address so that
     it returns the the erase_info structure members as it received them
  6. part_erase() subtracts partition offset from block address

This makes the code more logical and also prevents errors in case
parent's driver does not call mtd_erase_callback() for some reason.

(BTW, the purpose of mtd_erase_callback() in Linux is to inform the
 caller that it is done, since in Linux erasing is done asynchronously.
 We are abusing the purpose of mtd_erase_callback() in U-Boot for
 completely different purpose. The callback function itself has empty
 implementation in all cases in U-Boot.)

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Check for ctrlc() in spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:04 +0000 (15:56 +0200)]
mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase()

May it possible to interrupt the spi_nor_erase() function.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:03 +0000 (15:56 +0200)]
mtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase()

The spi_nor_erase() function does not call mtd_erase_callback() as it
should.

The mtdpart code currently implements the subtraction of partition
offset in mtd_erase_callback().

This results in partition offset being added prior calling
spi_nor_erase(), but not subtracted back on return. The result is that
the `mtd erase` command does not erase the whole partition, only some of
it's blocks:

  => mtd erase "Rescue system"
  Erasing 0x00000000 ... 0x006fffff (1792 eraseblock(s))
  jedec_spi_nor spi-nor@0: at 0x100000, len 4096
  jedec_spi_nor spi-nor@0: at 0x201000, len 4096
  jedec_spi_nor spi-nor@0: at 0x302000, len 4096
  jedec_spi_nor spi-nor@0: at 0x403000, len 4096
  jedec_spi_nor spi-nor@0: at 0x504000, len 4096
  jedec_spi_nor spi-nor@0: at 0x605000, len 4096
  jedec_spi_nor spi-nor@0: at 0x706000, len 4096

This is obviously wrong.

Add proper calling of mtd_erase_callback() into the spi_nor_erase()
function.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reported-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:02 +0000 (15:56 +0200)]
mtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase()

This check is already done in all callers: mtdcore's mtd_write() /
mtd_erase(), legacy spi_nor_write() / spi_flash_erase(). No reason to do
this here as well.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
3 years agomtd: spi-flash: Check for zero length in legacy spi_flash_*()
Marek Behún [Tue, 5 Oct 2021 13:56:01 +0000 (15:56 +0200)]
mtd: spi-flash: Check for zero length in legacy spi_flash_*()

Check for zero length in the legacy spi_flash_read() /
spi_flash_write() / spi_flash_erase() functions.
On zero length, return 0 immediately, don't call the underlying method.

Rationale:
- these legacy functions call the _read(), _write() and _erase() methods
  of struct mtd
- the DM callers of these methods already check for zero length
- making all callers of these methods check for zero length makes it
  possible to remove the check from implementations of these _read(),
  _write() and _erase() methods

Signed-off-by: Marek Behún <marek.behun@nic.cz>
3 years agomtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:00 +0000 (15:56 +0200)]
mtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase()

The cleanup code of spi_nor_erase() function calls write_disable(), but
does not return it's return value even in case of failure. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Don't overwrite return value if it is non-zero
Marek Behún [Tue, 5 Oct 2021 13:55:59 +0000 (15:55 +0200)]
mtd: spi-nor-core: Don't overwrite return value if it is non-zero

The cleanup code of the spi_nor_erase() function overwrites the ret
variable with return value of clean_bar(), even if the ret variable is
already set. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:55:58 +0000 (15:55 +0200)]
mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()

The spi_nor_erase() function does not check return value of the
write_enable() call. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Try cleaning up in case writing BAR failed
Marek Behún [Tue, 5 Oct 2021 13:55:57 +0000 (15:55 +0200)]
mtd: spi-nor-core: Try cleaning up in case writing BAR failed

Use the cleanup codepath of spi_nor_erase() also in the event of failure
of writing the BAR register.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor: Add support for Spansion S25FL256L
Takahiro Kuwano [Thu, 30 Sep 2021 02:23:37 +0000 (11:23 +0900)]
mtd: spi-nor: Add support for Spansion S25FL256L

The S25FL256L is a part of the S25FL-L family and has the same feature set
as S25FL128L except the density.

The datasheet can be found in the following link.
https://www.cypress.com/file/316171/download

The S25FL256L is 32MB NOR Flash that does not support Bank Address
Register. This fixup is activated if CONFIG_SPI_FLASH_BAR is enabled and
returns ENOTSUPP in setup() hook to avoid further ops.

Tested on Xilinx Zynq-7000 FPGA board.

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
3 years agomtd: spi-nor-ids: Add GD25LQ256D Chip
Yanhong Wang [Thu, 30 Sep 2021 11:53:01 +0000 (19:53 +0800)]
mtd: spi-nor-ids: Add GD25LQ256D Chip

Add Gigadevice GD25LQ256D SPI NOR chip.
https://www.gigadevice.com/datasheet/gd25lq256d/

Signed-off-by: Yanhong Wang <yanhong.wang@starfivetech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[jagan: updated commit message]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agoMerge tag 'efi-2022-01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 22 Oct 2021 12:56:45 +0000 (08:56 -0400)]
Merge tag 'efi-2022-01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-01-rc1

Documentation:
Use Sphinx 3.43.
Move system reset documentation to HTML

UEFI:
Fix linking EFI apps with LLVM
Fix alignment of loaded image
Correct simple network protocol test
Code cleanup

3 years agoMerge tag 'dm-pull-21oct21' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 22 Oct 2021 01:41:47 +0000 (21:41 -0400)]
Merge tag 'dm-pull-21oct21' of https://source.denx.de/u-boot/custodians/u-boot-dm

Refactoring of env_get_char() etc.
Update buildman to use gcc-11.1.0
Use in-container toolchain for nokia_rx51 CI test

# gpg: Signature made Thu 21 Oct 2021 09:34:07 PM EDT
# gpg:                using RSA key B25C0022AF86A7CC1655B6277F173A3E9008ADE6
# gpg:                issuer "sjg@chromium.org"
# gpg: Good signature from "Simon Glass <sjg@chromium.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B25C 0022 AF86 A7CC 1655  B627 7F17 3A3E 9008 ADE6

3 years agoenv: Move non-cli env functions to env/common.c
Marek Behún [Sun, 17 Oct 2021 15:36:38 +0000 (17:36 +0200)]
env: Move non-cli env functions to env/common.c

Move the following functions from cmd/nvedit.c to env/common.c:
  env_set_ulong()
  env_set_hex()
  env_get_hex()
  eth_env_get_enetaddr()
  eth_env_set_enetaddr()
  env_get()
  from_env()
  env_get_f()
  env_get_ulong()
since these functions are not specific for U-Boot's CLI.

We leave env_set() in cmd/nvedit.c, since it calls _do_env_set(), which
is a static function in that file.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: Simplify env_match() and inline into env_get_f()
Marek Behún [Sun, 17 Oct 2021 15:36:37 +0000 (17:36 +0200)]
env: Simplify env_match() and inline into env_get_f()

In the past the env_match() function was used to match envs with
- name, i.e. string "name"
- variable assignment, i.e. string "name=other_value"

The latter is not the case anymore, since the env_match() function is
now used only in env_get_f(), and so we can simplify the function into
a simple strncmp() with an additional comparison to '='.

Let's do this, and since the resulting function is quite simple, let's
also inline its code into env_get_f().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: Use memcpy() instead of ad-hoc code to copy variable value
Marek Behún [Sun, 17 Oct 2021 15:36:36 +0000 (17:36 +0200)]
env: Use memcpy() instead of ad-hoc code to copy variable value

Copy the value of the found variable into given buffer with memcpy()
instead of ad-hoc code.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: Make return value of env_get_f() behave like sprintf() on success
Marek Behún [Sun, 17 Oct 2021 15:36:35 +0000 (17:36 +0200)]
env: Make return value of env_get_f() behave like sprintf() on success

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This is not the case anymore.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The setup functions should be independent for two ethernet controllers

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Currently we always overwrite ethaddrs with those from EEPROM.

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

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

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

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

Refactor the code to use a for cycle.

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

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

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

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

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

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

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

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

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

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

This option is not used anywhere.

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

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

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

Move config options CONFIG_LAST_STAGE_INIT and
CONFIG_DISPLAY_BOARDINFO_LATE to turris_mox_defconfig.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Create the GUID as a global variable.

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

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

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

Use printf code %pD for printing device paths.

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

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

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>