platform/kernel/u-boot.git
2 years agoMerge tag 'u-boot-stm32-20211110' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Wed, 10 Nov 2021 19:11:30 +0000 (14:11 -0500)]
Merge tag 'u-boot-stm32-20211110' of https://source.denx.de/u-boot/custodians/u-boot-stm

- DHSOM update:
   - Remove nWP GPIO hog
   - Increase SF bus frequency to 50Mhz and enable SFDP
   - Disable video output for DHSOM
   - Disable EFI
   - Enable DFU_MTD support
- Create include file for STM32 gpio driver private data
- Split board and SOC STM32MP15 configuration
- Device tree alignement with v5.15-rc6 for STM32MP15
- Add binman support for STM32MP15x
- Normalise newlines for stm32prog
- Update OTP shadow registers in SPL

2 years agostm32mp15: tidy up #ifdefs in cpu.c
Patrick Delaunay [Mon, 11 Oct 2021 07:52:51 +0000 (09:52 +0200)]
stm32mp15: tidy up #ifdefs in cpu.c

We should avoid #ifdef in C modules and the unused functions
are eliminated by the linker.

Use the more readable IS_ENABLE() instead.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agostm32mp15: replace CONFIG_TFABOOT when it is possible
Patrick Delaunay [Mon, 11 Oct 2021 07:52:50 +0000 (09:52 +0200)]
stm32mp15: replace CONFIG_TFABOOT when it is possible

In some part of STM32MP15 support the CONFIG_TFABOOT can be replaced
by other config: CONFIG_ARMV7_PSCI and CONFIG_ARM_SMCCC.

This patch also simplifies the code in cpu.c, stm32mp1_ram.c and
clk_stml32mp1.c as execution of U-Boot in sysram (boot without SPL and
without TFA) is not supported: the associated initialization code is
present only in SPL.

This cleanup patch is a preliminary step to support SPL load of OP-TEE
in secure world, with SPL in secure world and U-Boot in no-secure world.

Reported-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agostm32mp15: remove configs dependency on CONFIG_TFABOOT
Patrick Delaunay [Mon, 11 Oct 2021 07:52:49 +0000 (09:52 +0200)]
stm32mp15: remove configs dependency on CONFIG_TFABOOT

Remove the dependency on CONFIG_TFABOOT in stm32mp Kconfig
- always activate the ARCH config: CONFIG_ARCH_SUPPORT_PSCI
  and CONFIG_CPU_V7_HAS_NONSEC
- CONFIG_ARMV7_NONSEC is deactivated in trusted defconfig
- the correct sysreset driver is activated in each defconfig:
  CONFIG_SYSRESET_PSCI or SYSRESET_SYSCON

Reported-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoarm: stm32mp: bsec: Update OTP shadow registers in SPL
Patrick Delaunay [Mon, 11 Oct 2021 07:52:48 +0000 (09:52 +0200)]
arm: stm32mp: bsec: Update OTP shadow registers in SPL

Currently the upper OTP (after 57) are shadowed in U-Boot proper,
when TFABOOT is not used.

This choice cause an issue when U-Boot is not executed after SPL,
so this BSEC initialization is moved in SPL and no more executed in U-Boot,
so it is still executed only one time.

After this patch this BSEC initialization is done in FSBL: SPL or TF-A.

To force this initialization in all the case, the probe of the BSEC
driver is forced in SPL in the arch st32mp function: spl_board_init().

Even if today BSEC driver is already probed in STM32MP15x clock driver
clk_stm32mp1.c because get_cpu_type() is called in
stm32mp1_get_max_opp_freq() function.

Reported-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: stm32: Align mtdparts with SPI NOR layout on DHSOM
Marek Vasut [Sat, 23 Oct 2021 22:46:17 +0000 (00:46 +0200)]
ARM: stm32: Align mtdparts with SPI NOR layout on DHSOM

The DHSOM uses different SPI NOR layout than the ST devkit, stop
pulling in the ST specific runtime mtdparts settings and adjust
the mtdparts accordingly.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: stm32: Disable video output on DHSOM
Marek Vasut [Sat, 23 Oct 2021 18:33:57 +0000 (20:33 +0200)]
ARM: stm32: Disable video output on DHSOM

The video output support is unused and disabling it saves about 20 kiB of space.
In case video output support is required, it can be re-enabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: stm32: Disable EFI on DHSOM
Marek Vasut [Sat, 23 Oct 2021 18:33:56 +0000 (20:33 +0200)]
ARM: stm32: Disable EFI on DHSOM

The EFI support is unused and disabling it saves about 70 kiB of space.
In case EFI support is required, it can be re-enabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: stm32: Increase default SF bus frequency to 50 MHz and enable SFDP
Marek Vasut [Sat, 23 Oct 2021 18:33:34 +0000 (20:33 +0200)]
ARM: stm32: Increase default SF bus frequency to 50 MHz and enable SFDP

Increase default SPI NOR bus frequency from 1 MHz to 50 MHz and
enable SFDP parsing to obtain more accurate SPI NOR configuration.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: dts: stm32: Drop nWP GPIO hog on DHSOM
Marek Vasut [Sat, 23 Oct 2021 18:33:33 +0000 (20:33 +0200)]
ARM: dts: stm32: Drop nWP GPIO hog on DHSOM

The nWP GPIO hog was used to unlock the SPI NOR write protect when U-Boot
used to operate the SPI NOR in 1-1-1 mode. Now that the SPI NOR is operated
in 1-1-4 mode, the hog has adverse effects and causes transfer corruption,
since the hogged pin is also the IO2 pin. Remove the hogs.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: stm32: Enable DFU MTD support on DHSOM
Marek Vasut [Sat, 23 Oct 2021 18:32:48 +0000 (20:32 +0200)]
ARM: stm32: Enable DFU MTD support on DHSOM

All the STM32MP1 based DHSOM have SPI NOR from which they boot,
enable DFU_MTD support to make it possible to expose that SPI NOR
via the DFU.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agogpio: stm32: create include file for driver private data
Patrick Delaunay [Fri, 22 Oct 2021 18:12:34 +0000 (20:12 +0200)]
gpio: stm32: create include file for driver private data

The stm32 gpio driver private data are not needed in arch include files,
they are not used by code except for stm32 gpio and pincontrol drivers,
using the same IP; the defines for this IP is moved in a new file
"stm32_gpio_priv.h" in driver/gpio.

This patch avoids to have duplicated file gpio.h for each SOC
in MPU directory mach-stm32mp and in each MCU directory arch-stm32*
and allows to remove CONFIG_GPIO_EXTRA_HEADER for all STM32.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoboard: stmp32mp1: split board and SOC STM32MP15 configuration
Patrick Delaunay [Fri, 22 Oct 2021 08:19:25 +0000 (10:19 +0200)]
board: stmp32mp1: split board and SOC STM32MP15 configuration

Add a configuration file "stm32mp15_st_common.h" to handle the
STMicroelectronics boards configuration and rename stm32mp1.h to
"stm32mp15_common.h" to handle the generic STM32MP15x series configuration.

The configuration file "dh_stm32mp1.h" is also renamed to
"stm32mp15_dh_dhcom" for the configuration of board based on the
dhelectronics STM32MP15x SOM.

In the STMicroelectronics board configuration the default bootcmd
"bootcmd_stm32mp" is updated to only select the extlinux file found on
SD-Card on STM32MP15x EV1 for boot from NOR device.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoarm: dts: stm32mp15: alignment with v5.15-rc6
Patrick Delaunay [Thu, 21 Oct 2021 09:54:11 +0000 (11:54 +0200)]
arm: dts: stm32mp15: alignment with v5.15-rc6

Device tree alignment with Linux kernel v5.15-rc6
- Set {bitclock,frame}-master phandles on ST DKx
- Add coprocessor detach mbox on stm32mp15x-dkx boards
- Add coprocessor detach mbox on stm32mp157c-ed1 board

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Wed, 10 Nov 2021 14:15:18 +0000 (09:15 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell

- Minor kwboot improvements (Pali)
- Misc kwbimage improvements (Pali)
- pci_mvebu: Use global MBUS_PCI_MEM_SIZE macro (Pali)

2 years agostm32mp: add binman support for STM32MP15x
Patrick Delaunay [Wed, 13 Oct 2021 13:11:18 +0000 (15:11 +0200)]
stm32mp: add binman support for STM32MP15x

Use binman to add the stm32image header on SPL binary for basic boot
or on U-Boot binary when it is required, i.e. for TF-A boot without FIP
support, when CONFIG_STM32MP15x_STM32IMAGE is activated.

The "binman" tool is the recommended tool for specific image generation.
This patch allows to suppress the config.mk file and it is a preliminary
step to manage FIT generation with binman.

The init_r parsing of U-Boot device tree to search the binman
information is not required for STM32MP15, so the binman library
can be removed in U-Boot (CONFIG_BINMAN_FDT is deactivated).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agostm32mp: stm32prog: Normalise newlines
William Grant [Wed, 13 Oct 2021 09:56:58 +0000 (20:56 +1100)]
stm32mp: stm32prog: Normalise newlines

The missing trailing newline could confuse check-config.sh if the
definition of an option was on the first line of the next file that
find(1) happened to return.

Signed-off-by: William Grant <wgrant@ubuntu.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agotools: kwbimage: Properly set srcaddr in kwbimage v0
Pali Rohár [Mon, 8 Nov 2021 17:12:51 +0000 (18:12 +0100)]
tools: kwbimage: Properly set srcaddr in kwbimage v0

Field srcaddr in kwbimage v0 needs to be adjusted similarly like in v1.

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>
2 years agotools: kwbimage: Properly calculate and align kwbimage v0 header size
Pali Rohár [Mon, 8 Nov 2021 17:12:50 +0000 (18:12 +0100)]
tools: kwbimage: Properly calculate and align kwbimage v0 header size

Kwbimage v0 has similar alignment requirements as v1.

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>
2 years agotools: kwbimage: Fill the real header size into the main header
Pali Rohár [Mon, 8 Nov 2021 17:12:49 +0000 (18:12 +0100)]
tools: kwbimage: Fill the real header size into the main header

Fill the real header size without padding into the main header

This allows to reduce final image when converting image to another format
which does not need additional padding.

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>
2 years agotools: kwbimage: Align kwbimage header to proper size
Pali Rohár [Mon, 8 Nov 2021 17:12:48 +0000 (18:12 +0100)]
tools: kwbimage: Align kwbimage header to proper size

Currently kwbimage header is always aligned to 4096 bytes. But it does not
have to be aligned to such a high value.

The header needs to be just 4-byte aligned, while some image types have
additional alignment restrictions.

This change reduces size of kwbimage binaries by removing extra padding
between header and data part.

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>
2 years agotools: kwbimage: Do not put final image padding to the image data size
Pali Rohár [Mon, 8 Nov 2021 17:12:47 +0000 (18:12 +0100)]
tools: kwbimage: Do not put final image padding to the image data size

This change allows to convert image from one format to another without need
to include unnecessary padding (e.g. when target image format has smaller
alignment requirement as source image format).

Do it by storing real image data size without padding to the kwbimage
header.

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>
2 years agotools: kwbimage: Align final UART image to 128 bytes
Pali Rohár [Mon, 8 Nov 2021 17:12:46 +0000 (18:12 +0100)]
tools: kwbimage: Align final UART image to 128 bytes

xmodem block size is 128 bytes, therefore it is possible to transfer only
images with size multiple of 128 bytes. kwboot automatically pads image
with zero bytes at the end to align it to 128 bytes boundary.

Do this padding when generating image to allow uploading with other xmodem
tools or older kwboot versions.

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>
2 years agotools: kwbimage: Remove unused enums and prototypes
Pali Rohár [Mon, 8 Nov 2021 17:12:45 +0000 (18:12 +0100)]
tools: kwbimage: Remove unused enums and prototypes

There are more unused enums and function prototypes. Remove them. The
function kwbimage_check_params() does not return enum kwbimage_cmd_types,
but a boolean value returned as int.

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>
2 years agotools: kwbimage: Fix validation of kwbimage v0
Pali Rohár [Mon, 8 Nov 2021 17:12:44 +0000 (18:12 +0100)]
tools: kwbimage: Fix validation of kwbimage v0

kwbimage v0 sldo has 32-bit data checksum at the end like kwbimage v1.

Use same data checksum validation for both v0 and v1 image types.

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>
2 years agotools: kwbimage: Set BOOT_FROM by default to SPI
Pali Rohár [Mon, 8 Nov 2021 17:12:43 +0000 (18:12 +0100)]
tools: kwbimage: Set BOOT_FROM by default to SPI

kwbimage must have valid blockid member instead of zero value. Thus if
config file does not contain BOOT_FROM command, use by default the value
for SPI booting (which is probably the most common).

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>
2 years agotools: kwbimage: Explicitly set version also for kwbimage v0
Pali Rohár [Mon, 8 Nov 2021 17:12:42 +0000 (18:12 +0100)]
tools: kwbimage: Explicitly set version also for kwbimage v0

For documentation purposes update struct main_hdr_v0 to include information
where version of the image must be stored. For kwbimage v0 it obviously
must be 0. By default all image header memory is initialized to zero,
therefore this change has no functional effect.

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>
2 years agotools: kwbimage: Add support for new commands UART_PORT and UART_MPP
Pali Rohár [Mon, 8 Nov 2021 17:12:41 +0000 (18:12 +0100)]
tools: kwbimage: Add support for new commands UART_PORT and UART_MPP

These two commands allow to specify custom setting of UART port used for
printing BootROM messages.

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>
2 years agopci: pci_mvebu: Use global MBUS_PCI_MEM_SIZE macro
Pali Rohár [Sat, 6 Nov 2021 11:16:12 +0000 (12:16 +0100)]
pci: pci_mvebu: Use global MBUS_PCI_MEM_SIZE macro

Header file mach/cpu.h already defines MBUS_PCI_MEM_SIZE macro which
defines size of MBUS_PCI_MEM_BASE window. So use global MBUS_PCI_MEM_SIZE
macro instead of locally defined PCIE_MEM_SIZE macro. Both macros have same
definition.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Always print kwboot version
Pali Rohár [Fri, 5 Nov 2021 22:30:42 +0000 (23:30 +0100)]
tools: kwboot: Always print kwboot version

It is useful to see kwboot version in the boot log output for debugging
purposes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Fix sending Kirkwood v0 images
Pali Rohár [Fri, 5 Nov 2021 22:29:58 +0000 (23:29 +0100)]
tools: kwboot: Fix sending Kirkwood v0 images

Properly calculate and align image header size to xmodem block size.

Kirkwood v0 images do not have stored total size of header in header
structure itself like it is for v1 images. So kwbheader_size() calculates
size by traversing image structure itself. Aligning is done in kwboot by
putting zero padding bytes between the header and data part.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Wed, 10 Nov 2021 03:26:56 +0000 (22:26 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

- watchdog: don't autostart watchdog on Sunxi boards

2 years agowatchdog: don't autostart watchdog on Sunxi boards
Heinrich Schuchardt [Fri, 5 Nov 2021 18:34:31 +0000 (19:34 +0100)]
watchdog: don't autostart watchdog on Sunxi boards

The Sunxi boards only support a 16 second watchdog timeout. This is too
short to boot Linux. The UEFI specification requires 300 seconds as
default timeout.

Change the default for CONFIG_WATCHDOG_AUTOSTART for ARCH_SUNXI.

Fixes: b147bd3607f8 ("sunxi: Enable watchdog timer support by default")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-samsung
Tom Rini [Tue, 9 Nov 2021 13:51:00 +0000 (08:51 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-samsung

[trini: Migrate CONFIG_EXYNOS7420 as part of merging, so espresso7420
still builds]

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoexynos: mmu: use CONFIG_IS_ENABLED
Minkyu Kang [Thu, 4 Nov 2021 07:13:17 +0000 (16:13 +0900)]
exynos: mmu: use CONFIG_IS_ENABLED

to fix following checkpatch warnings.
Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where
possible

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Cc: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoexynos78x0: pinctrl: set const to structs
Minkyu Kang [Thu, 4 Nov 2021 07:13:15 +0000 (16:13 +0900)]
exynos78x0: pinctrl: set const to structs

to fix following checkpatch warings.
WARNING: struct  should normally be const

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Cc: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoexynos: pwm: Deal with a PWM at 100%
Simon Glass [Wed, 3 Nov 2021 19:21:33 +0000 (13:21 -0600)]
exynos: pwm: Deal with a PWM at 100%

At present the counter never hits the comparitor in this case. Add a
special case.

This ensures that the snow backlight works when at full brightness.

Fixes: 76c2ff3e5fd video: backlight: fix pwm's duty cycle calculation

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 9 Nov 2021 02:44:02 +0000 (21:44 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

2 years agoFix syntax error
Leo Yu-Chi Liang [Wed, 27 Oct 2021 09:00:41 +0000 (17:00 +0800)]
Fix syntax error

This statement has an unmatched parentheses, fix it.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoriscv: ae350: Use #if defined instead of CONFIG_IS_ENABLED
Leo Yu-Chi Liang [Mon, 1 Nov 2021 09:00:43 +0000 (17:00 +0800)]
riscv: ae350: Use #if defined instead of CONFIG_IS_ENABLED

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0
when CONFIG_SPL_BUILD is defined because
there is no CONFIG_SPL_OF_BOARD.

Use #if defined instead.

Fixes: 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoriscv: add #define in asm/io.h for some device drivers
Wei Fu [Sat, 23 Oct 2021 16:31:12 +0000 (00:31 +0800)]
riscv: add #define in asm/io.h for some device drivers

This patch adds memcpy_fromio and memcpy_toio definitions for some device
drivers which have these definitions, like cadence_qspi_apb.c

Signed-off-by: Wei Fu <wefu@redhat.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agocmd: sbi: show SBI implementation version
Heinrich Schuchardt [Mon, 25 Oct 2021 13:09:35 +0000 (15:09 +0200)]
cmd: sbi: show SBI implementation version

Let the sbi command show the SBI implementation version

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agoriscv: function to retrieve SBI implementation version
Heinrich Schuchardt [Mon, 25 Oct 2021 13:09:34 +0000 (15:09 +0200)]
riscv: function to retrieve SBI implementation version

Provide function sbi_get_impl_version() to retrieve the SBI implementation
version.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agoMerge tag 'efi-2022-01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 8 Nov 2021 04:00:29 +0000 (23:00 -0500)]
Merge tag 'efi-2022-01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-01-rc2

Documentation:
* improve description of mmc rescan
* remove obsolete PPC documenation

UEFI
* Provide unit test for the EFI_TCG2_PROTOCOL
* Implement add EFI_TCG2_PROTOCOL.SubmitCommand
* Start the implementation of a 64 bit EFI app
* Reduce rcar3_salvator-x image size

2 years agodfu: newline after updating
Heinrich Schuchardt [Fri, 5 Mar 2021 17:36:37 +0000 (18:36 +0100)]
dfu: newline after updating

Currently output of dfu commands ends on a line with leading hash signs
('#'). The succeeding output should be placed on a new line.

After writing updates via dfu print a new line.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoARM: renesas: reduce rcar3_salvator-x image size
Heinrich Schuchardt [Sat, 14 Aug 2021 19:07:47 +0000 (21:07 +0200)]
ARM: renesas: reduce rcar3_salvator-x image size

rcar3_salvator-x u-boot.img is very close to the 0x100000 size limit.

Disable support for Unicode capitalization.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot
Masahisa Kojima [Thu, 4 Nov 2021 10:45:46 +0000 (19:45 +0900)]
efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot

This commit adds the missing EFI_TCG2_PROTOCOL selftest
and Measured Boot selftest in lib/efi_selftest.

This selftest includes PE/COFF image measurement test, some PCR values are
different in each architecture. With that, this commit also adds pre-built
versions of lib/efi_selftest/efi_miniapp_file_image_exit.c for PE/COFF
image measurement test for 32-bit arm, arm64, ia32, x86_64, riscv32 and
riscv64. Prebuilding avoids the problem of reproducible builds.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Make the test 'onrequest'.
Add code comments to the includes with the binaries.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi: Add video support to the app
Simon Glass [Thu, 4 Nov 2021 03:09:10 +0000 (21:09 -0600)]
efi: Add video support to the app

The current EFI video driver only works when running in the stub. In that
case the stub calls boot services (before jumping to U-Boot proper) and
copies the graphics info over to the efi table. This is necessary because
the stub exits boot services before jumping to U-Boot.

The app maintains access to boot services throughout its life, so does not
need to do this. Update the driver to support calling boot services
directly.

Enable video output for the app. Note that this uses the
EFI_GRAPHICS_OUTPUT_PROTOCOL protocol, even though it mentions vesa.

A sample qemu command-line for this case is:

   qemu-system-x86_64 -bios /usr/share/edk2.git/ovmf-ia32/OVMF-pure-efi.fd
   -drive id=disk,file=try.img,if=none,format=raw -nic none
   -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi: Add a way to obtain boot services in the app
Simon Glass [Thu, 4 Nov 2021 03:09:09 +0000 (21:09 -0600)]
efi: Add a way to obtain boot services in the app

Add a function to return this information along with a stub for the
efi_info_get() function, since calling it otherwise hangs U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agox86: Don't duplicate global_ptr in 64-bit EFI app
Simon Glass [Thu, 4 Nov 2021 03:09:08 +0000 (21:09 -0600)]
x86: Don't duplicate global_ptr in 64-bit EFI app

This variable is already defined by the EFI code. Drop the duplicate
definition when building a 64-bit EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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.

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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)

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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

2 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)

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>