platform/kernel/u-boot.git
3 years agoefi: Create a 64-bit app
Simon Glass [Thu, 4 Nov 2021 03:09:07 +0000 (21:09 -0600)]
efi: Create a 64-bit app

Most modern platforms use 64-bit EFI so it is useful to have a U-Boot app
that runs under that. Add a (non-functional) build for this.

Note that --whole-archive causes the gcc 9.2 linker to crash, so disable
this for now. Once this is resolved, things should work.

For now, avoid mentioning the documentation for the 64-bit app, since it
does not work.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agox86: Create a 32/64-bit selection for the app
Simon Glass [Thu, 4 Nov 2021 03:09:06 +0000 (21:09 -0600)]
x86: Create a 32/64-bit selection for the app

Most EFI implementations use 64-bit but U-Boot only supports running as
a 32-bit app at present. While efi-x86_payload64 does boot from 64-bit
UEFI it immediately changes back to 32-bit before starting U-Boot.

In order to support a 64-bit U-Boot app, update the Kconfig to add an
option for 32/64 bit. Update the prompt for the existing option so it is
clear it relates to the stub. Move both up to just under the choice that
controls them, since this looks better and the menu.

Use CONFIG_EFI_APP in the Makefile instead of CONFIG_TARGET_EFI_APP,
since the latter is specific to a single target and we will have two.

Memory size is set to 32MB for now so that it can run on qemu without
increasing the default memory size. We may need to increase the default
later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Drop the OF_EMBED warning for EFI
Simon Glass [Thu, 4 Nov 2021 03:09:05 +0000 (21:09 -0600)]
efi: Drop the OF_EMBED warning for EFI

For the EFI app, we must embed the devicetree in the ELF file since that
is the only thing that is run by UEFI. Drop the warning to avoid
confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi: Enable DM_ETH for the app
Simon Glass [Thu, 4 Nov 2021 03:09:04 +0000 (21:09 -0600)]
efi: Enable DM_ETH for the app

There is no need to avoid driver model for networking. Drop this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Add a script to build an image for testing on UEFI
Simon Glass [Thu, 4 Nov 2021 03:09:03 +0000 (21:09 -0600)]
efi: Add a script to build an image for testing on UEFI

It is quite complicated to run U-Boot on QEMU since we have four
different builds and they must use different versions of qemu and the
UEFI binaries.

Add a script to help. It requires U-Boot itself to be built. Once that
is done you can use this script to build an image for use with qemu and
optionally run it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: add EFI_TCG2_PROTOCOL.SubmitCommand
Masahisa Kojima [Thu, 4 Nov 2021 13:59:16 +0000 (22:59 +0900)]
efi_loader: add EFI_TCG2_PROTOCOL.SubmitCommand

This commit adds the EFI_TCG2_PROTOCOL.SubmitCommand
required in the TCG PC Client PFP spec.
SubmitCommand enables to send the raw command to the TPM device.

To implement this api, tpm2_submit_command() is added
into tpm-v2.c.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: use byteshift unaligned access helper
Masahisa Kojima [Wed, 3 Nov 2021 02:04:09 +0000 (11:04 +0900)]
efi_loader: use byteshift unaligned access helper

Calling unaligned/access-ok.h version of put_unaligned_le64()
causes data abort in arm 32-bit QEMU.

The similar issue also occurs in linux kernel,
unaligned/access-ok.h is no longer used in linux kernel[1].

This commit uses the unaligned/be_byteshift.h and
unaligned/le_byteshift.h helper instead of unaligned/access-ok.h.

[1]https://lore.kernel.org/all/20210507220813.365382-8-arnd@kernel.org/

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi_loader: capsule: drop __weak from efi_get_public_key_data()
AKASHI Takahiro [Tue, 2 Nov 2021 00:55:01 +0000 (09:55 +0900)]
efi_loader: capsule: drop __weak from efi_get_public_key_data()

As we discussed in ML, currently a device tree is the only place
to store public keys for capsule authentication. So __weak is not
necessary for now.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: mmc rescan speed mode
Heinrich Schuchardt [Fri, 5 Nov 2021 15:35:44 +0000 (16:35 +0100)]
doc: mmc rescan speed mode

Provide human readable descriptions of the speed nodes instead of the name
of constants from the code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodoc: Remove the obsolete README.AMCC-eval-boards-cleanup file
Thomas Huth [Tue, 26 Oct 2021 06:13:04 +0000 (08:13 +0200)]
doc: Remove the obsolete README.AMCC-eval-boards-cleanup file

The related boards have been removed four years ago already, in
commit 98f705c9cefd ("powerpc: remove 4xx support"), so this README
file is not required anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agodoc: Remove obsolete doc/README.nand-boot-ppc440
Stefan Roese [Thu, 21 Oct 2021 05:20:12 +0000 (07:20 +0200)]
doc: Remove obsolete doc/README.nand-boot-ppc440

The PPC440 support has been removed in commit 98f705c9ce
("powerpc: remove 4xx support"). This patch removes this obsolete
file as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
3 years agoMerge branch '2021-11-05-Kconfig-syncs'
Tom Rini [Fri, 5 Nov 2021 19:38:46 +0000 (15:38 -0400)]
Merge branch '2021-11-05-Kconfig-syncs'

- An assortment of changes to finish migration of a number of symbols,
  and move YAFFS2 related options that we enable to Kconfig as well.

3 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 5 Nov 2021 15:31:59 +0000 (15:31 +0000)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_BOARD_EARLY_INIT_F et al to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:57 +0000 (23:03 -0400)]
Convert CONFIG_BOARD_EARLY_INIT_F et al to Kconfig

This converts the following to Kconfig:
   CONFIG_BOARD_EARLY_INIT_F
   CONFIG_BOARD_LATE_INIT
   CONFIG_DISPLAY_BOARDINFO
   CONFIG_DISPLAY_BOARDINFO_LATE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SPL_DRIVERS_MISC et al to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:56 +0000 (23:03 -0400)]
Convert CONFIG_SPL_DRIVERS_MISC et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SPL_DRIVERS_MISC
   CONFIG_SPL_ENV_SUPPORT
   CONFIG_SPL_GPIO
   CONFIG_SPL_I2C
   CONFIG_SPL_LDSCRIPT
   CONFIG_SPL_LIBCOMMON_SUPPORT
   CONFIG_SPL_LIBGENERIC_SUPPORT
   CONFIG_SPL_LOAD_FIT_ADDRESS
   CONFIG_SPL_MMC
   CONFIG_SPL_NAND_SUPPORT
   CONFIG_SPL_NO_CPU_SUPPORT
   CONFIG_SPL_OS_BOOT
   CONFIG_SPL_POWER
   CONFIG_SPL_STACK_R
   CONFIG_SPL_STACK_R_ADDR
   CONFIG_SPL_WATCHDOG
   CONFIG_SPL_TEXT_BASE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_BMP_16BPP to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:55 +0000 (23:03 -0400)]
Convert CONFIG_BMP_16BPP to Kconfig

This converts the following to Kconfig:
   CONFIG_BMP_16BPP

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_OF_EMBED to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:54 +0000 (23:03 -0400)]
Convert CONFIG_OF_EMBED to Kconfig

This converts the following to Kconfig:
   CONFIG_OF_EMBED

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoConvert CONFIG_MCFUART to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:53 +0000 (23:03 -0400)]
Convert CONFIG_MCFUART to Kconfig

This converts the following to Kconfig:
CONFIG_MCFUART

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_FEC_MXC to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:52 +0000 (23:03 -0400)]
Convert CONFIG_FEC_MXC to Kconfig

This converts the following to Kconfig:
CONFIG_FEC_MXC

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SUPPORT_EMMC_BOOT to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:51 +0000 (23:03 -0400)]
Convert CONFIG_SUPPORT_EMMC_BOOT to Kconfig

This converts the following to Kconfig:
CONFIG_SUPPORT_EMMC_BOOT

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_TEXT_BASE to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:50 +0000 (23:03 -0400)]
Convert CONFIG_SYS_TEXT_BASE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TEXT_BASE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_HZ to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:49 +0000 (23:03 -0400)]
Convert CONFIG_SYS_HZ to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_HZ

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agospl: Make use of CONFIG_IS_ENABLED(OS_BOOT) in SPL/TPL common code paths
Tom Rini [Sun, 31 Oct 2021 03:03:48 +0000 (23:03 -0400)]
spl: Make use of CONFIG_IS_ENABLED(OS_BOOT) in SPL/TPL common code paths

When building a system that has both TPL and SPL_OS_BOOT, code which
tests for CONFIG_SPL_OS_BOOT will be built and enabled in TPL, which is
not correct.  While there is no CONFIG_TPL_OS_BOOT symbol at this time
(and likely will not ever be) we can use CONFIG_IS_ENABLED(OS_BOOT) in
these common paths to ensure we only compile these parts in the SPL
case.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agofs: yaffs2: Finish Kconfig migration
Tom Rini [Wed, 20 Oct 2021 01:10:14 +0000 (21:10 -0400)]
fs: yaffs2: Finish Kconfig migration

For the symbols which are both hard-coded as enabled and used, move to
Kconfig.  The rest of the CONFIG_YAFFS namespace is unselected anywhere,
so we leave it as is.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 4 Nov 2021 13:14:19 +0000 (09:14 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Improved sysreset/watchdog uclass integration (Samuel)

3 years agosunxi: Use sysreset framework for poweroff/reset
Samuel Holland [Thu, 4 Nov 2021 03:55:16 +0000 (22:55 -0500)]
sunxi: Use sysreset framework for poweroff/reset

Instead of hardcoding the watchdog for reset, and the PMIC for poweroff,
use the sysreset framework to manage the available poweroff/reset
backends. This allows (as examples) using the PMIC to do a cold reset,
and using a GPIO to power off H3/H5 boards lacking a PMIC. Furthermore,
it removes the need to hardcode watchdog MMIO addresses, since the
sysreset backends can be discovered using the device tree.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosunxi: Avoid duplicate reset_cpu with SYSRESET enabled
Samuel Holland [Thu, 4 Nov 2021 03:55:15 +0000 (22:55 -0500)]
sunxi: Avoid duplicate reset_cpu with SYSRESET enabled

The sysreset uclass unconditionally provides a definition of the
reset_cpu() function. So does the sunxi board code. Fix the build with
SYSRESET enabled by omitting the function from the board code in that
case. The code still needs to be kept around for use in SPL.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agowatchdog: Automatically register device with sysreset
Samuel Holland [Thu, 4 Nov 2021 03:55:14 +0000 (22:55 -0500)]
watchdog: Automatically register device with sysreset

Add an option to automatically register watchdog devices with the
wdt_reboot driver for use with sysreset. This allows sysreset to be a
drop-in replacement for platform-specific watchdog reset code, without
needing any device tree changes.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosysreset: watchdog: Move watchdog reference to plat data
Samuel Holland [Thu, 4 Nov 2021 03:55:13 +0000 (22:55 -0500)]
sysreset: watchdog: Move watchdog reference to plat data

Currently, the wdt_reboot driver always gets its watchdog device
reference from an OF node. This prevents selecting a watchdog at
runtime. Move the watchdog device reference to the plat data, so
the driver can be bound with the reference pre-provided. The
reference will still be acquired from the OF node if it is not
already provided.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosysreset: Mark driver probe functions as static
Samuel Holland [Thu, 4 Nov 2021 03:55:12 +0000 (22:55 -0500)]
sysreset: Mark driver probe functions as static

These driver probe functions are not (and should not be) called from
outside the respective driver source files. Therefore, the functions
should be marked static.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosysreset: Add uclass Kconfig dependency to drivers
Samuel Holland [Thu, 4 Nov 2021 03:55:11 +0000 (22:55 -0500)]
sysreset: Add uclass Kconfig dependency to drivers

None of the sysreset drivers do anything beyond providing sysreset
uclass ops. They should depend on the sysreset uclass.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 3 Nov 2021 13:42:45 +0000 (09:42 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- usb: mtu3: flush cache for the first GPD when allocate GPD ring

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Wed, 3 Nov 2021 13:42:22 +0000 (09:42 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- pci_mvebu: Fix access to config space and PCIe Root Port (Pali)
- a37xx: pci: Program the data strobe for config read requests (Pali)
- kwboot: Misc improvements and fixes (Pali)

3 years agousb: mtu3: flush cache for the first GPD when allocate GPD ring
Chunfeng Yun [Thu, 21 Oct 2021 05:33:07 +0000 (13:33 +0800)]
usb: mtu3: flush cache for the first GPD when allocate GPD ring

When allocate the GPD ring, and tell its address to the controller, then
the driver starts or resumes the QMU, the controller will try to access
the first GPD, so need flush the first one to avoid wrong GPD status.

Reported-by: Xin Lin <Xin.Lin@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agoarm: a37xx: pci: Program the data strobe for config read requests
Pali Rohár [Mon, 1 Nov 2021 09:12:51 +0000 (10:12 +0100)]
arm: a37xx: pci: Program the data strobe for config read requests

According to the Armada 3720 Functional Specification Data Strobe applies
for both read and write config requests.

Data strobe bits configure which bytes from the start address should be
returned for read request. Set value 0xf (all 4 bits) into Data Strobe
register to read all four bytes from specified 32-bit config space
register. Same value for Data Strobe register is programmed by Linux
pci-aardvark.c driver for config read requests.

Without this patch pci-aardvark driver sets data strobe register only
during config write operations. So any followup config read operations
could result with just partial datai returned (if previous write operation
was not 32-bit wide). This patch fixes it and ensures that config read
operations always read all bytes from requested register.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not send magic seq when changing baudrate back to 115200
Pali Rohár [Mon, 1 Nov 2021 13:00:02 +0000 (14:00 +0100)]
tools: kwboot: Do not send magic seq when changing baudrate back to 115200

After successful transfer of whole image only two things can happen:
- BootROM starts execution of data block, which changes UART baudrate
  back to 115200 Bd,
- board crashes and causes CPU reset

In both cases UART baudrate is reset to the default speed. So there is
no need to send special magic sequence to inform kwboot that baudrate is
going to be reset and kwboot does not need to wait for this event and
can do it immediately after BootROM acknowledges end of xmodem transfer.

Move ARM code for sending magic sequence from main baudrate change
section to binhdr_pre section which is executed only before changing
baudrate from the default value of 115200 Bd to some new value. Remove
kwboot code waiting for magic sequence after successful xmodem transfer.

Rationale: sometimes when using very high UART speeds, magic sequence is
damaged and kwboot fails at this last stage. Removal of this magic
sequence makes booting more stable.

Data transfer protocol (xmodem) is using checksums and retransmit, so it
already deals with possible errors on transfer line.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not use stack when setting baudrate back to default value
Pali Rohár [Wed, 27 Oct 2021 18:57:02 +0000 (20:57 +0200)]
tools: kwboot: Do not use stack when setting baudrate back to default value

The ARM code we inject into the image to change baudrate back to the
default value of 115200 Baud, which is run after successful UART transfer
of the whole image, cannot use stack as at this stage stack pointer is not
initialized yet.

Stack can only be used when BootROM is executing binary header, to
preserve state of registers, since BootROM expects that.

Change the ARM baudrate code to not use stack at all and put binary
header specific pre + post code (which stores and restores registers) into
separate arrays.

The baudrate change code now jumps at it's end and expects that there is
either code which returns to the BootROM or jumps to the original exec
address.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Replace ARM mov + movt instruction pair by mov + orr
Pali Rohár [Wed, 27 Oct 2021 18:57:01 +0000 (20:57 +0200)]
tools: kwboot: Replace ARM mov + movt instruction pair by mov + orr

Older Armada SoCs have custom ARMv5te compatible core which does not
support movt instruction. So replace mov + movt instruction pair used for
immediate move construction by mov + orr instructions which are supported
also by ARMv5te.

After this change kwboot ARM code should be compatible with any 32-bit ARM
core compatible by ARMv2 or new. At least GNU AS does not throw any error
or warning.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Increase delay after changing baudrate in ARM code
Pali Rohár [Wed, 27 Oct 2021 18:57:00 +0000 (20:57 +0200)]
tools: kwboot: Increase delay after changing baudrate in ARM code

Increase loop cycles from 600000 to 2998272, which should increase delay
from 1ms to about 5ms on 1200 MHz CPU.

The Number 2998272 was chosen as the nearest value around 3000000 which can
be encoded into one ARM mov instruction. It avoids usage of movt instruction
which is not supported by ARMv5te cores.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not call tcdrain() after each sent packet
Pali Rohár [Wed, 27 Oct 2021 18:56:59 +0000 (20:56 +0200)]
tools: kwboot: Do not call tcdrain() after each sent packet

Kwboot puts each xmodem packet to kernel queue, then waits until all bytes
of that packet are transmitted over UART and then waits for xmodem reply
until it is received into kernel queue.

If some reply is received during the time we are waiting until all bytes
are transmitted, then kernel puts them into the queue and returns it to
kwboot in next read() call.

So there is no need to wait (with tcdrain() function) until all bytes from
xmodem packet are transmitted over UART, since any reply received either
during that time or after is returned to kwboot with the next read().

Therefore do not call tcdrain() after each xmodem packet sent. Instead
directly wait for any reply after putting xmodem packet into write kernel
queue.

This change could speed up xmodem transfer in case tcdrain() function waits
for a longer time.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Fix sending retry of last header packet
Pali Rohár [Wed, 27 Oct 2021 18:56:58 +0000 (20:56 +0200)]
tools: kwboot: Fix sending retry of last header packet

After the trasfer of last header packet, it is possible that baudrate
change pattern is received, and also that NAK byte is received so that
the packet should be sent again.

Thus we should not clear the baudrate change state when sending retry
of that packet.

Move code for initializing state variables from kwboot_xm_recv_reply()
to kwboot_xm_sendblock().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Resend first 3 xmodem retry packets immediately
Pali Rohár [Mon, 25 Oct 2021 13:13:04 +0000 (15:13 +0200)]
tools: kwboot: Resend first 3 xmodem retry packets immediately

Currently when kwboot receive some garbage reply which does not understand,
it waits 1s before it tries to resend packet again.

The most common error on UART is that receiver sees some bit flipped which
results in invalid reply.

This behavior slows down xmodem transfer over UART as basically on every
error kwboot is waiting one second.

To fix this, try to resend xmodem packet for first 3 attempts immediately
without any delay. If broken reply is received also after the 3 attempts,
continue retrying with 1s delay like it was before.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Change retry loop from decreasing to increasing
Pali Rohár [Mon, 25 Oct 2021 13:13:03 +0000 (15:13 +0200)]
tools: kwboot: Change retry loop from decreasing to increasing

This patch does not change behavior of the code, just allows to implement
new changes more easily.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_g...
Pali Rohár [Mon, 25 Oct 2021 13:13:02 +0000 (15:13 +0200)]
tools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_grow_hdr()

Size of the header stored in kwbimage may be larger than real used size in
the kwbimage header. If there is unused space in kwbimage header then use
it for growing it. So update code to calculate used space of kwbimage
header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not modify kwbimage header before increasing its size
Pali Rohár [Mon, 25 Oct 2021 13:13:01 +0000 (15:13 +0200)]
tools: kwboot: Do not modify kwbimage header before increasing its size

This ensures that kwboot_img_grow_hdr() function still sees valid kwbimage
header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Simplify code for aligning image header
Pali Rohár [Mon, 25 Oct 2021 13:13:00 +0000 (15:13 +0200)]
tools: kwboot: Simplify code for aligning image header

Expression (hdrsz % KWBOOT_XM_BLKSZ) is non-zero therefore expression
(KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) is always less than value
KWBOOT_XM_BLKSZ. So there is no need to add another modulo. Also rename
variable `offset` to `grow` which better describes what is stored in
this variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Show verbose message when waiting for baudrate change magic
Pali Rohár [Mon, 25 Oct 2021 13:12:59 +0000 (15:12 +0200)]
tools: kwboot: Show verbose message when waiting for baudrate change magic

It is hard to debug why kwboot is failing when the last message is
'Finishing transfer' and no additional output. So show verbose message when
kwboot finished transfer and is waiting for baudrate change magic sequence.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Correctly set configuration of UART for BootROM messages
Pali Rohár [Mon, 25 Oct 2021 13:12:58 +0000 (15:12 +0200)]
tools: kwboot: Correctly set configuration of UART for BootROM messages

For kwbimage v1, tell BootROM to send BootROM messages to UART port number
0 (used also for UART booting) with default baudrate (which should be
115200) and do not touch UART MPP configuration.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Recalculate 4-byte data checksum after injecting baudrate code
Pali Rohár [Mon, 25 Oct 2021 13:12:57 +0000 (15:12 +0200)]
tools: kwboot: Recalculate 4-byte data checksum after injecting baudrate code

If data part of image is modified, update 4-byte data checksum.

It looks like A385 BootROM does not verify this checksum for image
loaded via UART, but we do not know if other BootROMs are also ignoring
it. It is always better to provide correct checksum.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Inject baudrate change back code after data part
Pali Rohár [Mon, 25 Oct 2021 13:12:56 +0000 (15:12 +0200)]
tools: kwboot: Inject baudrate change back code after data part

Some vendor U-Boot kwbimage binaries (e.g. those for A375) have load
address set to zero. Therefore it is not possible to inject code which
changes baudrate back to 115200 Bd before the data part.

So instead inject it after the data part and change kwbimage execution
address to that offset. Also store original execution address into
baudrate change code, so after it changes baudrate back to 115200 Bd, it
can jump to orignal address.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Validate 4-byte image data checksum
Pali Rohár [Mon, 25 Oct 2021 13:12:55 +0000 (15:12 +0200)]
tools: kwboot: Validate 4-byte image data checksum

Data part of the image contains 4-byte checksum. Validate it when
processing the image.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Reserve enough space for patching kwbimage in memory
Pali Rohár [Mon, 25 Oct 2021 13:12:54 +0000 (15:12 +0200)]
tools: kwboot: Reserve enough space for patching kwbimage in memory

SPI image header and data parts do not have to be aligned to 128 byte
xmodem block size. So reserve additional memory for aligning header part
and additional memory for aligning data part.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Fix initialization of tty device
Pali Rohár [Mon, 25 Oct 2021 13:12:53 +0000 (15:12 +0200)]
tools: kwboot: Fix initialization of tty device

Explicitly disable 2 stop bits by clearing CSTOPB flag, disable modem
control flow by clearing CRTSCTS flag and do not send hangup after closing
device by clearing HUPCL flag.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Initialize rfds to zero
Pali Rohár [Mon, 25 Oct 2021 13:12:52 +0000 (15:12 +0200)]
tools: kwboot: Initialize rfds to zero

Explicitly zero out the rfds fd_set with FD_ZERO() before using it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Fix comment about driver class name
Pali Rohár [Fri, 22 Oct 2021 14:22:15 +0000 (16:22 +0200)]
pci: pci_mvebu: Fix comment about driver class name

This is a pci driver, not an eth driver.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Setup PCI controller to Root Complex mode
Pali Rohár [Fri, 22 Oct 2021 14:22:14 +0000 (16:22 +0200)]
pci: pci_mvebu: Setup PCI controller to Root Complex mode

Root Complex should be the default mode, let's set it explicitly.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Do not automatically enable bus mastering on PCI Bridge
Pali Rohár [Fri, 22 Oct 2021 14:22:13 +0000 (16:22 +0200)]
pci: pci_mvebu: Do not automatically enable bus mastering on PCI Bridge

Now that PCI Bridge is working, U-Boot's CONFIG_PCI_PNP code automatically
enables memory access and bus mastering when it is needed. So do not
prematurely enable memory access and bus mastering.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Fix place of link up detection
Pali Rohár [Fri, 22 Oct 2021 14:22:12 +0000 (16:22 +0200)]
pci: pci_mvebu: Fix place of link up detection

PCI Bridge is always accessible also when link is down. So move detection
of link up from mvebu_pcie_of_to_plat() function to mvebu_pcie_valid_addr()
function which is used when accessing PCI config space.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Remove unused functions
Pali Rohár [Fri, 22 Oct 2021 14:22:11 +0000 (16:22 +0200)]
pci: pci_mvebu: Remove unused functions

Functions mvebu_pcie_get_local_bus_nr() and mvebu_pcie_get_local_dev_nr()
are not used, so remove them.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Properly configure and use PCI Bridge (PCIe Root Port)
Pali Rohár [Fri, 22 Oct 2021 14:22:10 +0000 (16:22 +0200)]
pci: pci_mvebu: Properly configure and use PCI Bridge (PCIe Root Port)

The mysterious "Memory controller" PCI device which is present in PCI
config space is improperly configured and crippled PCI Bridge which acts
as PCIe Root Port for endpoint PCIe card.

This PCI Bridge reports in PCI config space incorrect Class Code (Memory
Controller) and incorrect Header Type (Type 0). It looks like HW bug in
mvebu PCIe controller but apparently it can be changed via mvebu registers
to correct values.

The worst thing is that this PCI Bridge is crippled and its PCI config
registers in range 0x10-0x34 alias access to internal mvebu registers which
have different functionality as PCI Bridge registers. Moreover,
configuration of PCI primary and secondary bus numbers (registers 0x18
and 0x19) is done via totally different mvebu registers via totally strange
method and cannot be done via PCI Bridge config space.

Due to above fact about PCI config range 0x10-0x34, allocate a private
cfgcache[] buffer in the driver, to which PCI config access requests to
the 0x10-0x34 space will be redirected in mvebu_pcie_read_config() and
mvebu_pcie_write_config() functions. Function mvebu_pcie_write_config()
will also catch writes to PCI_PRIMARY_BUS (0x18) and PCI_SECONDARY_BUS
(0x19) registers and set PCI Bridge primary and secondary bus numbers via
mvebu's own method.

Also, Expansion ROM Base Address register (0x38) is available, but at
different offset 0x30. So recalculate register offset before accessing PCI
config space.

After these steps U-Boot sees working PCI Bridge and CONFIG_PCI_PNP code
can finally start enumerating all PCIe devices correctly, even with more
complicated PCI topology. So update also mvebu_pcie_valid_addr() function
to reflect state of the real device topology.

Each PCIe port is de-facto isolated and every PCI Bridge which is part of
PCIe Root Complex is also isolated, so put them on separate PCI buses as
(local) device 0.

U-Boot already supports enumerating separate PCI buses, real (HW) bus
number can be retrieved by "PCI_BUS(bdf) - dev_seq(bus)" code, so update
config read/write functions to properly handle more complicated tree
topologies (e.g. when a PCIe switch with multiple PCI buses is connected
to the PCIe port).

Local bus number and local device number on mvebu are used for determining
which config request type is used (Type 0 vs Type 1). On normal non-broken
PCIe hardware it is done by primary and secondary bus numbers. So correctly
translate settings between these numbers to ensure that correct config
requests are sent over the PCIe bus.

As bus numbers are correctly re-configured, it does not make sense to print
some initial bogus configuration during probe, so remove this debug code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Fix read_config() with PCI_SIZE_8 or PCI_SIZE_16
Pali Rohár [Fri, 22 Oct 2021 14:22:09 +0000 (16:22 +0200)]
pci: pci_mvebu: Fix read_config() with PCI_SIZE_8 or PCI_SIZE_16

When reading 8 or 16 bits from config space, use appropriate readb() or
readw() calls. This ensures that PCIe controller does not read more bits
from endpoint card as asked by read_config() function.

Technically there should not be an issue with reading data from config
space which are not later used as there are no clear-by-read registers.
But it is better to use correct read operation based on requested size.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: pci_mvebu: Fix write_config() with PCI_SIZE_8 or PCI_SIZE_16
Pali Rohár [Fri, 22 Oct 2021 14:22:08 +0000 (16:22 +0200)]
pci: pci_mvebu: Fix write_config() with PCI_SIZE_8 or PCI_SIZE_16

Current implementation of write_config() is broken for PCI_SIZE_8 or
PCI_SIZE_16 as it always uses writel(), which means that write operation
is always 32-bit, so upper 24 bits for PCI_SIZE_8 and upper 16 bits for
PCI_SIZE_16 are cleared.

Fix this by using writeb() and writew(), respectively.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoMerge tag 'u-boot-amlogic-20211102' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 2 Nov 2021 12:56:42 +0000 (08:56 -0400)]
Merge tag 'u-boot-amlogic-20211102' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- add sm efuse write support and cmd for read/write efuse
- add JetHub D1 eth mac generation with manufacturer OUI

3 years agoPrepare v2022.01-rc1
Tom Rini [Mon, 1 Nov 2021 19:16:16 +0000 (15:16 -0400)]
Prepare v2022.01-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 1 Nov 2021 12:19:22 +0000 (12:19 +0000)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 1 Nov 2021 12:14:45 +0000 (08:14 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- Fixes for x86 build with Clang/LLVM compiler
- Tangier ACPI changes
- Edison SD card detect pin fix
- EFI on x86 doc update with latest instructions
- PXE utility fixes to align with latest x86 zboot implementation

3 years agox86: tangier: pinmux: Move error message to the caller
Andy Shevchenko [Wed, 27 Oct 2021 14:23:38 +0000 (17:23 +0300)]
x86: tangier: pinmux: Move error message to the caller

Move error message to the caller of mrfld_pinconfig*() in order
to unify them in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tangier: pinmux: Move is_protected assignment closer to its user
Andy Shevchenko [Wed, 27 Oct 2021 14:23:37 +0000 (17:23 +0300)]
x86: tangier: pinmux: Move is_protected assignment closer to its user

Move is_protected assignment closer to its user.
This increases readability and makes maintenance easier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: edison: Don't take SD card detect pin into consideration
Andy Shevchenko [Wed, 27 Oct 2021 11:28:10 +0000 (14:28 +0300)]
x86: edison: Don't take SD card detect pin into consideration

There are two PCB designs in the wild which use the opposite
signaling for SD card detection. This makes U-Boot working
in one case and failing in the other. Quirk this out by
disconnecting SD card detection pin from the PCB by switching
it to mode 3. In the disconnected state the read value is always
the same and inverted to what we are expecting in the code.

BugLink: https://github.com/edison-fw/meta-intel-edison/issues/136
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tangier: Enable support for SD/SDIO family in the pinmux driver
Andy Shevchenko [Wed, 27 Oct 2021 11:28:09 +0000 (14:28 +0300)]
x86: tangier: Enable support for SD/SDIO family in the pinmux driver

We would need to quirk out the Card Detect case and for that we allow
configuring the SD/SDIO family of pins.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Fix i8254 ifdef include guard
Alistair Delva [Wed, 20 Oct 2021 21:31:30 +0000 (21:31 +0000)]
x86: Fix i8254 ifdef include guard

When building U-Boot with clang, it notices that the i8254.h include
guard does not work correctly due to a typo. Fix it.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fixed the other same typo at the end of the same file]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: chromebook_coral: fix C block comment
Alistair Delva [Wed, 20 Oct 2021 21:31:29 +0000 (21:31 +0000)]
x86: chromebook_coral: fix C block comment

Fix a warning seen when compiling this dts file.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tangier: Replace Method() by Name() for _STA object
Andy Shevchenko [Wed, 20 Oct 2021 12:51:18 +0000 (15:51 +0300)]
x86: tangier: Replace Method() by Name() for _STA object

There is no point to use Method() for the constant.
Replace it with Name() defined object. For the _STA
case it saves 3 bytes per each entry.

Before: 2881
After: 2833

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopxe_utils: Clean up {bootm,zboot}_argv generation
Zhaofeng Li [Wed, 20 Oct 2021 07:18:15 +0000 (00:18 -0700)]
pxe_utils: Clean up {bootm,zboot}_argv generation

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopxe_utils: Fix arguments to x86 zboot
Zhaofeng Li [Wed, 20 Oct 2021 07:18:14 +0000 (00:18 -0700)]
pxe_utils: Fix arguments to x86 zboot

bootm and zboot accept different arguments:

> bootm [addr [arg ...]]
>    - boot application image stored in memory
>        passing arguments 'arg ...'; when booting a Linux kernel,
>        'arg' can be the address of an initrd image

> zboot [addr] [size] [initrd addr] [initrd size] [setup] [cmdline]
>       addr -        The optional starting address of the bzimage.
>                     If not set it defaults to the environment
>                     variable "fileaddr".
>       size -        The optional size of the bzimage. Defaults to
>                     zero.
>       initrd addr - The address of the initrd image to use, if any.
>       initrd size - The size of the initrd image to use, if any.

In the zboot flow, the current code will reuse the bootm args and attempt
to pass the initrd arg (argv[2]) as the kernel size (should be argv[3]).
zboot also expects the initrd address and size to be separate arguments.

Let's untangle them and have separate argv/argc locals.

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodocs: uefi: Update stale U-Boot on EFI doc
Bin Meng [Mon, 21 Jun 2021 02:12:32 +0000 (10:12 +0800)]
docs: uefi: Update stale U-Boot on EFI doc

The existing intructions in the U-Boot on EFI doc do not work with
the latest QEMU. Update the doc with the correct instructions, as
well as using the new OVMF URL link.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMerge tag 'dm-pull-boo21' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 31 Oct 2021 19:48:43 +0000 (15:48 -0400)]
Merge tag 'dm-pull-boo21' of https://source.denx.de/u-boot/custodians/u-boot-dm

Environment tidy-ups
patman 'postfix' support
fix binman test race condition causing a timeout error

# gpg: Signature made Sun 31 Oct 2021 03:36:55 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 agobootstage: Add SPL support
Marek Vasut [Sat, 23 Oct 2021 01:06:03 +0000 (03:06 +0200)]
bootstage: Add SPL support

Allow usage of the bootstage facilities in SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Add "postfix" support to patch subjects
Sean Anderson [Fri, 22 Oct 2021 23:07:04 +0000 (19:07 -0400)]
patman: Add "postfix" support to patch subjects

In some communities, it may be necessary to append something after PATCH
in the subject line. For example, the Linux networking subsystem
expects [1] patch subject prefixes like [RFC PATCH net-next 0/99]. This
adds support for such "postfix"s to patman. Although entirely cosmetic,
it is still nice to have.

[1] https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html#how-do-i-indicate-which-tree-net-vs-net-next-my-patch-should-be-in

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: Use static_assert() to check if default_environment is too large
Marek Behún [Fri, 22 Oct 2021 13:47:25 +0000 (15:47 +0200)]
env: Use static_assert() to check if default_environment is too large

Check sizeof(default_environment) against ENV_SIZE in a static_assert()
instead of runtime.
Only check if !USE_HOSTCC (for in fw_env tool ENV_SIZE expands to a
variable, and cannot be checked statically) nad
!DEFAULT_ENV_INSTANCE_EMBEDDED, for in that case the default_environment
variable is not set.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: Always use char for default_environment
Marek Behún [Fri, 22 Oct 2021 13:47:24 +0000 (15:47 +0200)]
env: Always use char for default_environment

Sometimes we use uchar and sometimes char for the default environment
array. By always using char, we can get rid of some explicit casts.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoboard: freescale: various boards: Let env subsystem set gd->env_addr
Marek Behún [Fri, 22 Oct 2021 13:47:23 +0000 (15:47 +0200)]
board: freescale: various boards: Let env subsystem set gd->env_addr

Various freescale boards set gd->env_addr to default_environment in
board_init(), conditional on CONFIG_ENV_IS_NOWHERE, but this is
redundant, since it is done by env_init() before board_init() is called.

Let the env subsystem handle this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>
Cc: Mian Yousaf Kaukab <ykaukab@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoboard: synquacer: developerbox: Don't set gd->env_addr to default_environment
Marek Behún [Fri, 22 Oct 2021 13:47:22 +0000 (15:47 +0200)]
board: synquacer: developerbox: Don't set gd->env_addr to default_environment

This board sets gd->env_addr to default_environment in board_init(), but
the board has environment in SPI flash according to defconfig. Let the
env API handle environment automatically.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: flash: Cosmetic fix
Marek Behún [Fri, 22 Oct 2021 13:47:21 +0000 (15:47 +0200)]
env: flash: Cosmetic fix

Change tab to space in env_flash_init().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: flash: Let generic env_init() assign default environment
Marek Behún [Fri, 22 Oct 2021 13:47:20 +0000 (15:47 +0200)]
env: flash: Let generic env_init() assign default environment

env_flash_init() (both implementations) assigns default environment if
ENV_INVALID, but this is done in the generic env_init() function, which
calls this initializer, so drop it from here.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: nowhere: Cosmetic fix
Marek Behún [Fri, 22 Oct 2021 13:47:19 +0000 (15:47 +0200)]
env: nowhere: Cosmetic fix

Use spaces instead of tabs in assignments, since there are no lines to
align assignment values to.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: nowhere: Let generic env_init() assign default environment
Marek Behún [Fri, 22 Oct 2021 13:47:18 +0000 (15:47 +0200)]
env: nowhere: Let generic env_init() assign default environment

env_nowhere_init() assigns default environment if ENV_INVALID, but this
is done in the generic env_init() function, which calls this
initializer, so drop it from here.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: nvram: Cosmetic fix in env_nvram_init()
Marek Behún [Fri, 22 Oct 2021 13:47:17 +0000 (15:47 +0200)]
env: nvram: Cosmetic fix in env_nvram_init()

Use spaces consistently in assignments instead of tabs.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: nvram: Let generic env_init() assign default environment
Marek Behún [Fri, 22 Oct 2021 13:47:16 +0000 (15:47 +0200)]
env: nvram: Let generic env_init() assign default environment

env_nvram_init() assigns default environment if ENV_INVALID, but this is
done in the generic env_init() function, which calls this initializer,
so drop it from here.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: nand: Put ENV_INVALID into gd->env_valid if default environment
Marek Behún [Fri, 22 Oct 2021 13:47:15 +0000 (15:47 +0200)]
env: nand: Put ENV_INVALID into gd->env_valid if default environment

env_nand_init() says the environment is valid even if it is assigning
default environment due to not being able to access nand pre-reloaction
(determined by macro values). Change this to ENV_INVALID and let the
generic env_init() function, which calls this initializer, assign the
default environment.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: Put ENV_INVALID into gd->env_valid on CRC failure
Marek Behún [Fri, 22 Oct 2021 13:47:14 +0000 (15:47 +0200)]
env: sf: Put ENV_INVALID into gd->env_valid on CRC failure

env_sf_init_addr() says the environment is valid even if it is assigning
default environment due to CRC failure. Change this to ENV_INVALID and
let the generic env_init() function, which calls this initializer,
assign the default environment.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: Use ENV_VALID enum names instead of literals
Marek Behún [Fri, 22 Oct 2021 13:47:13 +0000 (15:47 +0200)]
env: sf: Use ENV_VALID enum names instead of literals

The function env_sf_init_addr() assigns number literals (1) instead of
ENV_VALID to gd->env_valid. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: Cosmetic fix in env_sf_init_addr()
Marek Behún [Fri, 22 Oct 2021 13:47:12 +0000 (15:47 +0200)]
env: sf: Cosmetic fix in env_sf_init_addr()

In the if clause we use tabs and in the else clause spaces. Let's use
spaces in the if clause too.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: Fix linking u-boot with ld.lld
Alistair Delva [Wed, 20 Oct 2021 21:31:33 +0000 (21:31 +0000)]
x86: Fix linking u-boot with ld.lld

When linking the final u-boot binary with LLD, the following link errors
are seen:

ld.lld: error: can't create dynamic relocation R_386_32 against local
               symbol in readonly segment; recompile object files with
               -fPIC or pass '-Wl,-z,notext' to allow text relocations
               in the output
>>> defined in arch/x86/cpu/start.o
>>> referenced by arch/x86/cpu/start.o:(.text.start+0x32)
[...]
>>> defined in arch/x86/cpu/start16.o
>>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C)

According to Nick Desaulniers:

"This is a known difference between GNU and LLVM linkers; the GNU
 linkers permit relocations in readonly segments (making them not read
 only), LLVM does not (by default)."

Since U-Boot apparently seems to use relocations in readonly segments,
change the global linker flags to permit them when linking with LLD by
specifying '-z notext'.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Migrate ARCH_MAP_SYSMEM to Kconfig
Tom Rini [Wed, 20 Oct 2021 01:16:55 +0000 (21:16 -0400)]
sandbox: Migrate ARCH_MAP_SYSMEM to Kconfig

Move this from a hard-coded define in config.mk to Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Allow timeout to occur in the image or its section
Simon Glass [Mon, 18 Oct 2021 18:13:15 +0000 (12:13 -0600)]
binman: Allow timeout to occur in the image or its section

At present testThreadTimeout() assumes that the expected timeout happens
first when building the section, but it can just as easily happen at the
top-level image. Update the test to cope with both.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
3 years agoimage.h: make image_sign_info.fit point to const
Hannu Lounento [Mon, 18 Oct 2021 05:49:03 +0000 (08:49 +0300)]
image.h: make image_sign_info.fit point to const

The data blob apparently does not need to be modified through the fit
field of the image_sign_info struct so make it point to const to avoid
the need to cast away constness in functions that assign a pointer to
const data to the field.

fit_image_setup_verify already had to cast away constness as it assigned
a const void * argument to the field. The cast can now be removed.

Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 31 Oct 2021 16:48:08 +0000 (12:48 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- usb_mass_storage, xhci-brcm bugfixes

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 31 Oct 2021 16:47:35 +0000 (12:47 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sh

- rzg2_beacon updates

3 years agoMerge branch '2021-10-31-assorted-platform-updates'
Tom Rini [Sun, 31 Oct 2021 16:21:12 +0000 (12:21 -0400)]
Merge branch '2021-10-31-assorted-platform-updates'

- Revert GIC LPI changes that need to be reworked.
- mvebu SATA booting bugfix
- Samsung Galaxy S9/S9+(SM-G96x0), Samsung Galaxy A and Apple M1
  platform support.